Commit Graph

241 Commits

Author SHA1 Message Date
Christopher Dunn
0db9d6ea01 Merge pull request #7 from cdunn2001/fix-locale
Use std::stringstream instead of snprintf() for double->string conversion
2014-07-09 11:47:48 -07:00
Steffen Kieß
b8aaa03367 Use std::stringstream instead of snprintf() for double->string conversion
`snprintf()` will use the current `LC_NUMERIC` locale
for converting a double to a string,
which will use a `,` instead of a `.` in some locales (e.g. de_DE).
`std::stringstream` allows setting the locale to `"C"` to always get a `.`.
This occurs only for that `stringstream` instance; no global is
altered.
2014-07-09 11:46:00 -07:00
Christopher Dunn
06dcb1fc89 cmake updates this 2014-07-08 21:57:12 -07:00
Christopher Dunn
973de3988b Merge pull request #1 from cdunn2001/patch-renu555
dead-code patch by renu555
2014-07-05 19:10:34 -07:00
renu555
41b79398a3 Always true condition.
for (int index = 0; index < size && !isMultiLine; ++index) 
In addition to dead code, in the above if condition checking to !isMultiLine is of no use as it will be always true and hence "for" depends only on condition [index < size.]
The mentioned test case works fine in this case also.
2014-07-05 19:05:41 -07:00
renu555
66b77384d8 Fix dead code scenario.
Changes explained
2014-07-05 19:05:41 -07:00
renu555
17c244e644 Fixing unreachable condition.
if (!isMultiLine) at line 563 suggests that isMultiline is 0 when if takes true branch. So the condition && at line 571 will always be false.
Also at line 568 !isMultiline in loop conditional check suggests that it depends only on one condition i.e. index <size because !isMultiline is always true. 
Hence , it seems logical mistake at line 571 of using && instead of ||
2014-07-05 19:05:41 -07:00
Christopher Dunn
8050d8b677 Merge pull request #6 from cdunn2001/fix-static-init
I will try to pull the other changes from Chromium as well.

This passed Travis.
2014-07-05 17:39:19 -07:00
Christopher Dunn
28836b8acc fix bug for static init
Ugh! Static initialization of instance variables is a very bad idea.

This fix is taken from the Chromium code-base. It includes their
double-fix for ARM.

* https://codereview.chromium.org/24984004
* https://src.chromium.org/viewvc/chrome?revision=226099&view=revision
* https://code.google.com/p/webrtc/issues/detail?id=1777
2014-07-05 17:36:20 -07:00
Aaron Jacobs
47f1577fd3 Gave the license section a makeover. 2014-07-01 13:13:46 +10:00
Aaron Jacobs
9cc184146f Gave the test output section a makeover. 2014-07-01 13:13:03 +10:00
Aaron Jacobs
c151549937 Gave the reader/writer test section a makeover. 2014-07-01 13:11:05 +10:00
Aaron Jacobs
d61fa29da8 Gave the amalgamated source section a makeover. 2014-07-01 13:09:15 +10:00
Aaron Jacobs
b2a086adeb Gave the documentation section a makeover. 2014-07-01 13:07:21 +10:00
Aaron Jacobs
8d0f8d0dcd Gave the testing section a makeover. 2014-07-01 13:06:40 +10:00
Aaron Jacobs
49ed6c9774 Gave the scons section a makeover. 2014-07-01 12:06:16 +10:00
Aaron Jacobs
38c9826423 Gave the cmake section a makeover. 2014-07-01 12:02:57 +10:00
Aaron Jacobs
969921748b Gave the using section a makeover. 2014-07-01 11:59:25 +10:00
Aaron Jacobs
ff22ca7973 Gave the introduction section a makeover. 2014-07-01 11:56:56 +10:00
Aaron Jacobs
4b687640cb Began converting the README to Markdown. 2014-07-01 11:54:14 +10:00
Aaron Jacobs
3a0c4fcc82 Ran clang-format again. 2014-07-01 09:20:48 +10:00
Aaron Jacobs
445328ace6 Fixed some clang-format weirdness. 2014-07-01 09:15:11 +10:00
Aaron Jacobs
9fa4e849a1 Ran clang-format over all .h and .cpp files.
clang-format -i $(find . -name '*.h' -or -name '*.cpp')
2014-07-01 08:48:54 +10:00
Aaron Jacobs
1b137a3802 Set BinPackParameters to false.
This option personally drives me crazy. I think it's much more readable
to be able to see one parameter per line when there are many.
2014-07-01 08:47:46 +10:00
Aaron Jacobs
fd6ada015e Added a clang-format config file, in preparation for formatting jsoncpp.
clang-format -style=llvm -dump-config > .clang-format
2014-07-01 08:45:32 +10:00
Aaron Jacobs
8540868347 Fixed some cruft in the Travis CI config file. 2014-06-30 19:57:59 +10:00
Aaron Jacobs
2de98d9bd1 Updated notification settings for Travis CI. 2014-06-30 19:51:29 +10:00
Christopher Dunn
6764059395 fix stdexcept
https://sourceforge.net/p/jsoncpp/bugs/68/
2014-05-13 09:49:25 +00:00
Aaron Jacobs
5d32295a6e Fixed a test that causes a crash when exceptions are disabled.
While I was at it, corrected whitespace too.
2014-04-23 23:57:59 +00:00
Aaron Jacobs
68db655347 Added structured error reporting to Reader.
This allows applications for interactively viewing or editing JSON to do
a better job of highlighting errors. Also added offset accessors to
Value, offering the same sort of functionality even for non-errors.

Thanks to Zach Clifford (zacharyc@google.com) for the patch.
2014-04-23 23:41:12 +00:00
Aaron Jacobs
642befc836 Added features that allow the reader to accept common non-standard JSON.
This is a version of patch #17, from Clay Wood:

    http://sourceforge.net/p/jsoncpp/patches/17/
2014-04-23 23:28:23 +00:00
Christopher Dunn
77cd83890d vim modeline
http://vim.wikia.com/wiki/Modeline_magic
2014-04-19 21:41:03 +00:00
Christopher Dunn
09439b7bc7 Comment reading/write improvements
This patch fixes some aspects of reading and writing comments:
- Multiple C++-style comments before a Json value had extra newlines appended to them. This patch removes the addition of those newlines.
- Comments written before Json values in the StyledWriter were not indented to match the indentation level of the value. This patch adds indentation to comments.
- Fixed inconsistency in newlines following C- and C++-style comments being saved as part of the comment. All newlines at the end of a comment are now removed.
- Added an additional test of comments.

https://sourceforge.net/p/jsoncpp/patches/25/
2014-04-19 21:19:24 +00:00
Christopher Dunn
ea0797351f JSON_ASSERT -> JSON_ASSERT_MESSAGE
This way, assertions can produce exceptions.
https://sourceforge.net/p/jsoncpp/bugs/67/
2014-04-19 06:37:23 +00:00
Aaron Jacobs
94d17e9fdf Added missing includes for std::istream.
Thanks to Quentin Fiard for the report.
2014-01-29 00:13:38 +00:00
Baptiste Lepilleur
a3f19c23a0 Fixed broken build on VS 2012 2013-09-23 14:10:39 +00:00
Aaron Jacobs
d2618806ba Fixed some snprintf-related build breakages in Visual Studio. 2013-08-08 23:08:28 +00:00
Aaron Jacobs
36400ac0c1 Updated two calls to sprintf that I missed in r269. 2013-08-08 00:39:32 +00:00
Aaron Jacobs
32ffb931e7 Replaced the complex implementation of valueToString(double).
The previous one was confusing and prone to buffer overflows, and didn't
work correctly with 16-decimal-digit numbers. The new one simply uses
snprintf with a standard format string.

The major change is that we don't always print a decimal point now.
Fortunately, JSON doesn't distinguish between integers and reals.
2013-08-08 00:39:12 +00:00
Aaron Jacobs
bb53cd0899 Added more floating point tests.
The first demonstrates a bug that I will soon fix.
2013-08-08 00:37:39 +00:00
Aaron Jacobs
4c531bb584 Added further floating point tests. 2013-08-08 00:13:10 +00:00
Aaron Jacobs
42d918b7aa Switched away from sprintf, which is prone to buffer overflows.
Most reasonable platforms have this function. If you're here because
this broke the build for you, consider adding an ifdef for your platform
and using sprintf there (but not on other platforms).
2013-08-06 23:12:56 +00:00
Baptiste Lepilleur
700b38020e - CMake: added option to turn fail compilation if warning occurs, and warning level 4 with MSVC.
- Fixed some warnings
2013-05-09 18:42:33 +00:00
Baptiste Lepilleur
7b62ceacee - disabled warning 4786 for VS6 caused by STL (identifier was truncated to '255' characters in the debug information)
- added batchbuild config for XP VM
2013-05-09 16:24:13 +00:00
Baptiste Lepilleur
cb5ae30f6e Added simple batch build script for CMake. 2013-05-09 15:22:14 +00:00
Baptiste Lepilleur
58b6541478 Added missing source file to CMakeLists.txt. 2013-05-09 15:21:06 +00:00
Baptiste Lepilleur
1ccfdfcb9b 2013-05-09 15:20:32 +00:00
Baptiste Lepilleur
71860de813 Fixed continuous integration matrix for debug/release build. Made static debug build verbose. 2013-05-08 22:23:07 +00:00
Baptiste Lepilleur
c515b8ec30 Added continuous integration matrix for debug/release build. Made static debug build verbose. 2013-05-08 22:15:15 +00:00
Baptiste Lepilleur
5fff185aa4 Added continuous integration matrix for shared/static library (specified through environment variables). 2013-05-08 22:04:57 +00:00