Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
481f377c
Commit
481f377c
authored
Jan 04, 2015
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+ guard call to std::ios_base::sync_with_stdio
parent
9537c70b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
+16
-3
src/JSON.cc
src/JSON.cc
+12
-3
src/JSON.h
src/JSON.h
+4
-0
No files found.
src/JSON.cc
View file @
481f377c
...
...
@@ -22,6 +22,7 @@
////////////////////
std
::
mutex
JSON
::
_token
;
bool
JSON
::
Parser
::
firstCall
=
true
;
///////////////////////////////////
...
...
@@ -1776,9 +1777,17 @@ Initialize the JSON parser given an input stream \p _is.
*/
JSON
::
Parser
::
Parser
(
std
::
istream
&
_is
)
{
// from http://www.manticmoo.com/articles/jeff/programming/c++/making-io-streams-efficient-in-c++.php
// Don't sync C++ and C I/O
std
::
ios_base
::
sync_with_stdio
(
false
);
// On first call, switch off syncing between C++ and C I/O. This call must
// be done before first I/O operation as the behavior may be undefined
// otherwise.
if
(
firstCall
)
{
firstCall
=
false
;
// Don't sync C++ and C I/O
// from http://www.manticmoo.com/articles/jeff/programming/c++/making-io-streams-efficient-in-c++.php
std
::
ios_base
::
sync_with_stdio
(
false
);
}
while
(
_is
)
{
std
::
string
input_line
;
...
...
src/JSON.h
View file @
481f377c
...
...
@@ -432,6 +432,10 @@ class JSON
char
_current
{};
/// the position inside the input buffer
size_t
_pos
=
0
;
private:
/// variable to guard std::ios_base::sync_with_stdio
static
bool
firstCall
;
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment