1136 Commits

Author SHA1 Message Date
Jeroen Doggen
e7b6e5a208 Fix: 'Stringify NaN, Inf as null'
The code path where 'null' is written was never reached when 'writeFlags == kWriteNanAndInfNullFlag'
2023-09-21 18:42:43 +01:00
Albert Hung (Embedded)
476ffa2fd2 Rename to fix allocator shadowing
The identifier 'allocator' in the RapidJSON StdAllocator class declaration shadows the identifier 'allocator' in the
std::allocator class. To fix this, rename the 'allocator'
identifier in the StdAllocator class declaration to a different name.
2023-08-21 11:02:43 +08:00
Albert Hung
5e17dbed34 Eliminate old style cast warning
Use static_cast to replace old style cast.

Change-Id: I30e659c8f2aadc02750555b0f041bfd2e1c8004a
2023-08-17 16:55:04 +08:00
Albert Hung
516d047394 Remove empty cross-reference in comment
Remove useless comment block which owns a '\see' cross-reference, but
doesn't provide any data after it. This empty cross-reference triggers
a compiler warning.

Change-Id: I5c01d57579e5efedcb4bf17b80b06db313a61ab3
2023-08-14 18:08:33 +08:00
Jihadist
a95e013b97 Stringify NaN, Inf as null if needs 2023-07-17 11:02:35 +08:00
Leonard Chan
973dc9c06d Avoid ptrdiff between pointers to different allocations
When using running both Undefined Behavior Sanitizer (UBSan) and
Hardware-Assisted Address Sanitizer (HWASan) on Fuchsia, ubsan
complained about a pointer overflow when computing the new token->name pointer.
This happens because the initial pointer diff takes the offset between
two allocations with different tags, so the arithmetic results in a very
large diff that gets added to the original token->name ptr which
overflows.

Any arithmetic between pointers to two allocations is unspecified
behavior, so hwasan+ubsan is catching a bug here. It looks like
rapidjson is just attempting to update the name pointers to strings
copied into the new nameBuffer_ via this arithmetic, but since these
strings and the tokens are in the same buffer, the offset between them
should be the same. For each token we can just get this offset and
adjust the new name pointers accordingly which avoids the bad arithmetic.
2023-05-17 16:16:27 +08:00
Albert Hung
2a1f586ba6 Check for __GNUC__ definition
Wrap code checking against __GNUC__ to ensure it is defined. This can cause errors with compilers which do not define this preprocessor value.
2023-05-10 12:41:04 +08:00
Flaviu_
949c771b03 Resolve conflict with Windows header about max macro 2023-04-07 18:45:27 +08:00
supperpiccle
012be85287 Use passed in allocator. 2023-01-12 14:24:04 +08:00
Tana0910
76281ff388 fix a typo in error.h: literial -> literal 2023-01-04 17:45:39 +08:00
Kent Ross
a98e99992b do not define operator!= in C++20
A change to the semantics of equality operator rewriting in C++20 (P2468R2: The Equality Operator You Are Looking For) means that operator== may not be rewritten with reversed operands if operator!= is also defined. Since operator!= can normally be synthesized from operator== regardless in this language standard, we can and should avoid defining those when the new language semantics are available.

This fixes the compilation of tests (and probably consuming code) in C++20 onwards for compilers that implement this new semantic, including recent nightly builds of clang-16.

Reference: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2468r2.html
2022-12-19 05:30:49 +08:00
Steve Hanson
b08672d469 review comment updates 2022-12-19 05:30:00 +08:00
Steve Hanson
55eca66f39 code & tests for openapi 2.0 & 3.0 suppprt 2022-12-19 05:30:00 +08:00
Steve Hanson
80b6d1c834 small corrections for schema.h 2022-12-01 00:42:44 +08:00
Steve Hanson
97fd830175 attempt to fix SEH 2022-12-01 00:42:44 +08:00
Steve Hanson
7cad78e236 tidy up after merge from master 2022-12-01 00:42:44 +08:00
Steve Hanson
89f6717f0b corrections 2022-12-01 00:42:44 +08:00
Steve Hanson
338d8defdb initial 2022-12-01 00:42:44 +08:00
jwillcox-telework
06d58b9e84 Update dtoa.h
Fixed DigitGen to use proper suffix for uint64_t numeric types. Change from U suffix to ULL suffix.

On SLED 11.0 compiler, code would not compile.

cd rapidjson-master
g++ -Wall -m32 -ggdb -Iinclude -O1 ./example/simpledom/simpledom.cpp -o simpledom 2>&1 | tee out.txt
2022-08-23 10:52:40 +08:00
jwillcox-telework
22a62fcc2c Update allocators.h
Fixing compiler error on older compilers, such as SLED 11.0.

cd rapidjson-master
g++ -Wall -m32 -ggdb -Iinclude -O1 ./example/simpledom/simpledom.cpp -o simpledom 2>&1 | tee out.txt

Changed SIZE_MAX to std::numeric_limits<size_t>::max() in code to get rid of SIZE_MAX error.
2022-08-23 10:52:40 +08:00
Kent Ross
64faab2e92 gate definition of symmetric equality operators on impl, not lib
These operators call themselves recursively if C++20 semantics are present in the compiler, regardless of standard library support for the operator; therefore the test should be on __cpp_impl_three_way_comparison, not __cpp_lib_[...].

This fixes the Value.EqualtoOperator test when the language standard is set to C++20 and the standard library does not yet define the library support macro.
2022-05-24 10:03:13 +08:00
Johnny Shaw
dd3f730d74 Make schema dtor robust against exceptions 2022-05-21 09:35:41 +08:00
Peter Kasting
781a4e667d Try to fix MSVC build. 2022-05-19 11:55:17 +08:00
Peter Kasting
88f8ddd70c Include conceptual change from PR 2001. 2022-05-19 11:55:17 +08:00
Peter Kasting
4695953567 Avoid exit-time destructors.
operator[]() was recently changed to use the existing code in order to
correctly align the returned pointer; however this broke
-Wexit-time-destructors.  Change to a method that is still correctly
aligned but does not generate a destructor.
2022-05-19 11:55:17 +08:00
Peter Kasting
0390b1ad57 Avoid exit-time destructors.
operator[]() was recently changed to use the existing code in order to
correctly align the returned pointer; however this broke
-Wexit-time-destructors.  Change to a method that is still correctly
aligned but does not generate a destructor.
2022-05-19 11:55:17 +08:00
Milo Yip
fcb23c2dbf
Merge pull request #2008 from agate-pris/access-to-allocator-types
Access to allocator types
2022-04-06 12:28:13 +08:00
Leonid Terenin
6b500986c4 fix shadowed variable, take 2 2022-04-06 10:42:40 +09:00
Leonid Terenin
3988c5e25e fix shadowed variable 2022-04-06 09:58:56 +09:00
agate-pris
386d31ab69 Allow access to the template parameter StackAllocator in the GenericDocument
Add the typedef declaration `StackAllocatorType` to the class template
`GenericDocument`. This allows the user to access the template parameter
`StackAllocator`.
2022-03-18 19:34:11 +09:00
agate-pris
79d7a448e9 Allow the macro RAPIDJSON_DEFAULT_STACK_ALLOCATOR to be used in any namespace
RAPIDJSON_DEFAULT_STACK_ALLOCATOR uses names in the namespace
`RAPIDJSON_NAMESPACE`. Replace this with a name starting in the global
namespace.
2022-03-18 19:32:01 +09:00
agate-pris
9965ab37f6 Allow the macro RAPIDJSON_DEFAULT_ALLOCATOR to be used in any namespace
`RAPIDJSON_DEFAULT_ALLOCATOR` uses names in the namespace
`RAPIDJSON_NAMESPACE`. Replace this with a name starting in the global
namespace.
2022-03-18 19:22:19 +09:00
Milo Yip
8261c1ddf4
Merge pull request #1969 from MalcolmTyrrell/MalcolmTyrrell/sanitizeSchemaCode
Sanitize the code in schema.h
2022-03-09 12:15:45 +08:00
Adam Calhoon
1dff2abff7 Fix the alignment of placement new buffer for GenericValue.
When using operator[] on a GenericValue type clang-tidy complains,
appropriately, about the alignment of the buffer used for placement-new
of the "dummy" GenericValue.
2022-02-08 22:29:15 -05:00
Malcolm Tyrrell
53602ec6bb Sanitize the code in schema.h 2021-11-17 09:31:22 +00:00
jedwards
060c348ea0 use softintrin on arm64ec 2021-10-29 15:31:10 -07:00
ardb-uk
14f1e37f85
Resolve issue 1948
Correct instances of >> as they failed compilation.
2021-10-12 16:22:22 +01:00
Steve Hanson
9ea3f45dbd fix the warning 2021-09-24 08:51:03 +01:00
Milo Yip
00dbcf2c6e
Merge pull request #1926 from Kyrega/master
Fix RawNumber for characters with sizeof(Ch) > sizeof(char)
2021-08-13 12:25:41 +08:00
Kyrega
a3d52c75b7 No default template parameter for older compilers 2021-08-10 17:38:41 +02:00
Kyrega
19b55c9049 No default template parameter for older compilers 2021-08-10 17:38:23 +02:00
Kyrega
128b1031b0 Use rapidjson internal::SelectIf 2021-08-10 17:38:09 +02:00
Kyrega
8710d7e989 Do not depend on c++11 conditional 2021-08-10 17:37:35 +02:00
Kyrega
7fac34f7bb Added typename 2021-08-10 17:35:49 +02:00
Kyrega
b952a592a4 Fix RawNumber for longer char types 2021-08-10 17:35:07 +02:00
jack_perisich
bb06211088 Fix small errors in dtoa output for certain doubles 2021-07-27 19:50:51 -04:00
Milo Yip
48fbd8cd20
Merge pull request #1848 from smhdfdl/id-and-ref
Fix issue 1843 - support Id keyword
2021-07-09 10:57:40 +08:00
Steve Hanson
8d16abd980 Uri Parse improvements 2021-06-30 17:09:52 +01:00
Steve Hanson
a21cf9f7b8 equiv fix for issue 1899 2021-06-14 11:35:00 +01:00
Milo Yip
8c29a7b493 Fix Pointer::Append() crash for custom allocator on Windows
Fix #1899
2021-06-11 11:49:14 +08:00