Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
azure-cloud-mining-script
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Recolic
azure-cloud-mining-script
Commits
e3bda576
There was an error fetching the commit references. Please try again later.
Commit
e3bda576
authored
8 years ago
by
fireice-uk
Browse files
Options
Downloads
Patches
Plain Diff
Fix for BOM addition in some text editors
parent
c21b3d08
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
jconf.cpp
+17
-3
17 additions, 3 deletions
jconf.cpp
with
17 additions
and
3 deletions
jconf.cpp
+
17
−
3
View file @
e3bda576
...
@@ -209,9 +209,13 @@ bool jconf::parse_config(const char* sFilename)
...
@@ -209,9 +209,13 @@ bool jconf::parse_config(const char* sFilename)
return
false
;
return
false
;
}
}
buffer
=
(
char
*
)
malloc
(
flen
+
3
);
if
(
flen
<=
16
)
{
printer
::
inst
()
->
print_msg
(
L0
,
"File is empty or too short - %s."
,
sFilename
);
return
false
;
}
buffer
[
0
]
=
'{'
;
buffer
=
(
char
*
)
malloc
(
flen
+
3
)
;
if
(
fread
(
buffer
+
1
,
flen
,
1
,
pFile
)
!=
1
)
if
(
fread
(
buffer
+
1
,
flen
,
1
,
pFile
)
!=
1
)
{
{
free
(
buffer
);
free
(
buffer
);
...
@@ -219,9 +223,19 @@ bool jconf::parse_config(const char* sFilename)
...
@@ -219,9 +223,19 @@ bool jconf::parse_config(const char* sFilename)
printer
::
inst
()
->
print_msg
(
L0
,
"Read error while reading %s."
,
sFilename
);
printer
::
inst
()
->
print_msg
(
L0
,
"Read error while reading %s."
,
sFilename
);
return
false
;
return
false
;
}
}
fclose
(
pFile
);
//Replace Unicode BOM with spaces - we always use UTF-8
if
(
buffer
[
1
]
==
0xEF
&&
buffer
[
2
]
==
0xBB
&&
buffer
[
3
]
==
0xBF
)
{
buffer
[
1
]
=
' '
;
buffer
[
2
]
=
' '
;
buffer
[
3
]
=
' '
;
}
buffer
[
0
]
=
'{'
;
buffer
[
flen
]
=
'}'
;
buffer
[
flen
]
=
'}'
;
buffer
[
flen
+
1
]
=
'\0'
;
buffer
[
flen
+
1
]
=
'\0'
;
fclose
(
pFile
);
prv
->
jsonDoc
.
Parse
<
kParseCommentsFlag
|
kParseTrailingCommasFlag
>
(
buffer
,
flen
+
2
);
prv
->
jsonDoc
.
Parse
<
kParseCommentsFlag
|
kParseTrailingCommasFlag
>
(
buffer
,
flen
+
2
);
free
(
buffer
);
free
(
buffer
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment