Commit graph

83 commits

Author SHA1 Message Date
Michael Balszun 5c045f7d0a Use correct accumulator type in binary_writer if size_t != ul
- Also fixes warning in msvc about possible loss of data in
  that size computation.
2019-11-19 11:06:45 +01:00
Xav83 13a7c60257 Correct a warning from cppcheck:
binary_writer.hpp:869: (style) Consider using std::accumulate algorithm instead of a raw loop.

910a7d2b87/checks (step):5:107

Signed-off-by: Xav83 <x.jouvenot@gmail.com>
2019-09-20 11:45:38 +02:00
Thomas Braun 6ce2f35ba8 Fix outputting extreme integer values in edge cases
For some gcc version (Ubuntu 5.5.0-12ubuntu1~16.04) the existing code
crashes when the minimum value of int64_t is outputted.

Resurrect the code from before 546e2cbf (🚨 fixed some warnings,
2019-03-13) but delegate the sign removal so that the compilers don't
complain about taking the negative value of an unsigned value.

In addition we also rewrite the expression so that we first increment
and then negate.

The definition of remove_sign(number_unsigned_t) is never called as
unsigned values are never negative.
2019-09-03 13:55:15 +02:00
Niels Lohmann a501365ea2
Merge branch 'feature/hedley' into develop 2019-07-14 20:58:08 +02:00
Niels Lohmann b17440c12f
🚨 fix compiler warnings 2019-07-12 21:05:16 +02:00
Niels Lohmann 947656544d
🚨 fix warnings 2019-07-02 21:06:42 +02:00
Niels Lohmann 90798caa62
🚚 rename Hedley macros 2019-07-01 22:37:30 +02:00
Niels Lohmann 897362191d
🔨 add NLOHMANN_JSON prefix and undef macros 2019-07-01 22:24:39 +02:00
Niels Lohmann 1720bfedd1
⚗️ add Hedley annotations 2019-06-30 22:14:02 +02:00
Niels Lohmann 8d3f4f21bc
🔨 clean up 2019-03-18 13:53:48 +01:00
Niels Lohmann 56f6d1d68e
💚 fix CI and #1521 2019-03-17 15:20:22 +01:00
Niels Lohmann b8451c236f
🚨 fixed warnings 2019-03-17 12:01:49 +01:00
Niels Lohmann 34f8b4f711
🚨 fixed more warnings 2019-03-17 00:27:44 +01:00
Niels Lohmann 27011e3718
🚨 fixed warnings 2019-03-15 14:55:13 +01:00
Niels Lohmann 0c65ba960e
Merge branch 'develop' of https://github.com/nlohmann/json into develop 2019-03-13 22:14:57 +01:00
Niels Lohmann 546e2cbf5e
🚨 fixed some warnings 2019-03-13 22:14:53 +01:00
Andreas Schwab bb22b1003f Do proper endian conversions
This fixes all testsuite failures on big endian hosts.
2019-02-25 12:09:13 +01:00
Niels Lohmann 6de4df23e4
🐛 fixed integer overflow in dump function #1447
Closes #1447.
2019-01-20 12:26:01 +01:00
scinart 899bd94b43 flush buffer in serializer::dump_escaped case UTF8_REJECT
serializer use fixed buffer. Whenever it is nearly full, it is flushed to `output_adapter_t<char> o`
But the code forgets to flush when there is a invalid utf8 code point
So there will be buffer overflow.
2019-01-18 20:35:48 -05:00
Patrick Boettcher d0c0d16110 🚨 fixed unused variable warning
Since 6503e83e74 "Improve dump_integer performance by implementing a more efficient int2ascii"
an unused variable and thus a warning existed.
2019-01-15 15:21:02 +01:00
Isaac Nickaein 6503e83e74 Improve dump_integer performance by implementing a more efficient int2ascii
This commits implements a faster int2ascii inspired by "Fastware" talk given
by Andrei Alexandrescu.
See: https://www.youtube.com/watch?v=o4-CwDo2zpg
2019-01-12 08:58:30 -08:00
Niels Lohmann 6f89613acd
🚨 fixed some warnings 2018-12-23 13:56:18 +01:00
Niels Lohmann da81e7be22
🏁 adding parentheses around std::snprintf calls #1337 2018-11-09 21:18:02 +01:00
Niels Lohmann d2e4f0b0d9
✏️ fixed some typos 2018-10-28 14:20:20 +01:00
Niels Lohmann 7d0dc10169
🚨 fixed a linter warning 2018-10-27 18:34:35 +02:00
Niels Lohmann 45a761bd60
Merge branch 'develop' of https://github.com/nlohmann/json into develop 2018-10-27 18:31:06 +02:00
Niels Lohmann 4e765596f7
🔨 small improvements 2018-10-27 18:31:03 +02:00
Niels Lohmann 5a6bdf5934
Merge branch 'develop' into feature/convert_char 2018-10-27 16:48:48 +02:00
Niels Lohmann 6384fe28db
🚨 fixed another linter warning 2018-10-26 23:12:41 +02:00
Niels Lohmann 544150d5a5
🚨 fixed another linter warning 2018-10-26 11:10:49 +02:00
Niels Lohmann c2e175763c
👌 added another conversion function #1315 2018-10-25 22:47:08 +02:00
Niels Lohmann 7ce720b700
🚨 fixed coverage 2018-10-25 18:21:50 +02:00
Niels Lohmann 19647e083c
🚨 fixed compiler warnings 2018-10-25 14:27:55 +02:00
Niels Lohmann 62126278a6
🔨 added fix for arrays 2018-10-25 13:01:18 +02:00
Niels Lohmann 1968e5c793
🎨 clean up binary formats 2018-10-24 23:39:30 +02:00
Niels Lohmann e2c5913a50
🚧 some changes to the BSON code
- added fuzz testers
- added some reference files
- made an exception text more clear
2018-10-24 15:43:37 +02:00
Niels Lohmann bba159121f
Merge branch 'feature/bson' of https://github.com/julian-becker/json into julian-becker-feature/bson 2018-10-24 15:03:15 +02:00
Niels Lohmann 7b501de054
Merge pull request #1314 from nlohmann/feature/codec_errors
Allow to set error handler for decoding errors
2018-10-24 08:40:58 +02:00
Niels Lohmann 20038e2703
📝 added a note to the discussion #1286 2018-10-23 23:00:43 +02:00
Niels Lohmann 87ef3f25f2
✏️ fixed a typo #1314 2018-10-23 22:56:10 +02:00
Niels Lohmann b49f76931f
👌 replaced static_cast to CharType by conversion function #1286 2018-10-23 17:49:04 +02:00
Niels Lohmann c51b1e6fab
🚧 fixed an issue with ensure_ascii #1198 2018-10-22 15:53:36 +02:00
Niels Lohmann c7af027cbb
🚧 respect ensure_ascii parameter #1198 2018-10-22 09:18:16 +02:00
Niels Lohmann e5dce64115
💚 added tests #1198
Test every prefix of Unicode sequences against the different dump functions.
2018-10-21 23:26:25 +02:00
Niels Lohmann c5821d91e5
🚧 overworked error handlers #1198 2018-10-21 11:49:37 +02:00
Julian Becker ad11b6c35e BSON: Improved exception-related tests and report location of U+0000 in the key-string as part of out_of_range.409-message 2018-10-18 20:05:46 +02:00
Julian Becker 8de10c518b BSON: Hopefully fixing ambiguity (on some compilers) to call to string::find() 2018-10-17 21:47:01 +02:00
Julian Becker 2a63869159 Merge branch 'develop' of https://github.com/nlohmann/json into feature/bson
Conflicts:
	include/nlohmann/detail/input/binary_reader.hpp
	single_include/nlohmann/json.hpp
	src/unit-bson.cpp
2018-10-17 20:26:00 +02:00
Niels Lohmann dbb0b63187
improved error messages for binary formats #1288
This commit is the equivalent of #1282 for CBOR, MessagePack, and UBJSON.
2018-10-17 12:15:58 +02:00
Julian Becker 978c3c4116 BSON: throw json.exception.out_of_range.409 in case a key to be serialized to BSON contains a U+0000 2018-10-16 20:42:00 +02:00