942 Commits

Author SHA1 Message Date
Philipp A. Hartmann
70171f9790 GenericStringRef: move assert out of expression 2017-07-10 22:32:18 +02:00
Milo Yip
f624a3037c Merge pull request #1010 from pah/fixes/817-stringref-null
Improve handling of NULL strings
2017-07-10 10:08:21 +08:00
Philipp A. Hartmann
47c3c1ec9f Improved handling of NULL strings
* Safely assert upon passing NULL string without length
   (requires usage of RAPIDJSON_ASSERT within an expression)
 * Allow using a NULL string together with an explicit length 0
   (GenericStringRef, GenericValue::SetString, ...), see #817
 * Add GenericValue::SetString(StringRefType, Allocator&) overload
 * Add tests for the various cases
2017-07-09 14:46:59 +02:00
Philipp A. Hartmann
14218aeb0a ParseResult: improve bool conversion and add operator!=
* Use safe-bool idiom for boolean conversion to avoid accidental
   misuse of ParseResult values (closes #989)
 * Add operator!= to support more comparison expressions
   (previously silently/erroneously used operator bool)
2017-07-09 11:13:31 +02:00
Milo Yip
2f45319b4e Merge pull request #968 from TomaszNo/icc-preprocessor-guard
Intel C++ Compiler preprocessor guard for #pragma intrinsic - diyfp.h
2017-06-28 11:36:55 +08:00
Milo Yip
df6362d450 Fix patternProperties & additionalProperties lead to ASSERT
Fix #825
2017-06-09 10:16:24 +08:00
Philipp A. Hartmann
68c96e987b Fixup #964 by forwarding copyConstStrings recursively
As reported by @Llerd in #962, the `copyConstStrings` parameter
has not been forwarded recursively to the constructors of
object members and array elements.
2017-05-27 10:26:35 +02:00
Tomasz Noczynski (Linux)
294ad93e30 To avoid Intel C++ Compiler #1879 warnings:
warning #1879: unimplemented pragma ignored: #pragma intrinsic(_BitScanReverse64)
warning #1879: unimplemented pragma ignored: #pragma intrinsic(_umul128)
2017-05-25 14:14:16 +02:00
Tomasz Noczynski (Linux)
77d2fadfb6 If storage class is not specified as first in declaration then Intel C++ Compiler 2017 generates message:
message #82: storage class is not first
2017-05-25 13:21:57 +02:00
Philipp A. Hartmann
4ef1ff4fba GenericValue::CopyFrom: add option to force copying of strings
Copying the result of an in-situ parsing into another value/document
currently requires that the original buffer - still holding the strings
from the parsing, outlives the  destination object as well.

In order to obtain a "full" copy of a GenericValue, this commit adds
an optional flag `copyConstStrings` to `CopyFrom`, which then forces
to take a copy of all embedded strings in the source value.

This solves the problem discussed in #962.
2017-05-18 19:11:04 +02:00
Hartwig
568107e178 Add convenience method Key(std::basic_string<Ch> const&) to Writer 2017-05-10 22:56:01 +02:00
Harry Wong
cba45fe9de Onley apply to GCC 7 2017-05-04 10:32:45 +08:00
Harry Wong
fe19b7b601 Supress implicit fallthrough in GCC 2017-05-04 10:08:48 +08:00
Milo Yip
b45c5408d1 Merge pull request #932 from JunHe77/master
Added ARM-Neon support for SIMD.SkipWhitespace*
2017-04-24 16:22:14 +08:00
Oliver Hahm
885b5cd2f9 common notation of empty if/else case 2017-04-21 14:49:30 +02:00
Oliver Hahm
63423eb6f8 fix return values 2017-04-21 14:49:12 +02:00
Alejandro Martinez
2291258bb8 Added ARM-Neon support for SIMD.SkipWhitespace*
Change-Id: Iaf210d029758723a7eeb7f28fc10cab7467889a9
Signed-off-by: Jun He <jun.he@arm.com>
2017-04-21 07:33:17 +00:00
Milo Yip
e6d7247ed9 Merge pull request #924 from lichray/fix-gcc7-warning
Fix a non-type template parameter type mismatch
2017-04-17 14:44:08 +08:00
Philipp A. Hartmann
f93a29bec2 RAPIDJSON_STATIC_ASSERT: use C++11 static_assert, if available 2017-04-14 20:19:16 +02:00
Zhihao Yuan
ec90588c72
Fix a non-type template parameter type mismatch
This issues a warning in gcc7.
2017-04-08 22:51:15 -05:00
Milo Yip
77f643dc51 Fix #910 incorrect casting 2017-04-07 10:23:30 +08:00
Milo Yip
5d9d0f78b5 Merge pull request #909 from miloyip/issue905_PrettyWriterWriteFlags
Fix #905 unable to set writeFlags for PrettyWriter
2017-03-27 18:26:17 +08:00
Milo Yip
d88be8ef16 Fix #905 unable to set writeFlags for PrettyWriter 2017-03-27 14:05:03 +08:00
Alejandro Martinez
85500e8c8f Changed error code for invalid special ascii chars, fixed writer tests 2017-03-24 13:37:23 +00:00
Alejandro Martinez
da4fd6794c Fixed bug on space hexadecimal encoding 2017-03-22 10:19:54 +00:00
Milo Yip
e5635fb27f Fix #899 2017-03-16 10:46:48 +08:00
Milo Yip
bba388b4fa Merge pull request #896 from StilesCrisis/writer-flush-api
Writer flush api
2017-03-16 10:36:25 +08:00
Milo Yip
465fab45c1 Merge pull request #897 from StilesCrisis/issue-889-pretty-writer
Issue 889 pretty writer
2017-03-16 10:35:26 +08:00
John Stiles
d5d18cf694 Fix template length optimization issue in PrettyWriter
Missed PrettyWriter in the initial fix for Issue #889
2017-03-14 23:48:41 -07:00
John Stiles
31c6c50ac6 Provide a Flush() API within Writer
This is helpful if you’re writing code that needs to control flush
behavior and you don’t want to pass around your buffer object to each
handler function alongside the writer. Seems like an easy convenience
to add.
2017-03-14 23:28:59 -07:00
John Stiles
55f8a32020 Remove broken templatized string length optimization
It did not support char arrays.
2017-03-12 23:47:59 -07:00
John Stiles
c4e3d6243c Fix msvc x64 compilation issue
Disambiguate by putting the ENABLEIF on the return value instead of in
the argument list.
2017-03-05 09:50:03 -08:00
John Stiles
cdea825a0b Assert that String() and Key() are given null-terminated strings
Assert in case users attempt to pass a char array to String() or Key()
that is not null terminated; that is not the intended use of the API.
Null terminate your string buffers.
2017-03-05 09:23:03 -08:00
John Stiles
61f8c4ef0d Quoted strings to String() or Key() are auto-sized by template
Same fix as previous commit, to prettywriter
2017-03-05 00:38:34 -08:00
John Stiles
dd97ede84d Quoted strings to String() or Key() are auto-sized by template
No strlen call needs to be made when templates can auto-deduce the
string length. No strlen = faster!

Unfortunately this needs a touch of  SFINAE to allow multiple overrides
to coexist cleanly.
2017-03-05 00:27:08 -08:00
John Stiles
db8d3bb4d6 Remove unneeded change 2017-03-03 00:42:00 -08:00
John Stiles
3f9ebfe9e9 Trivial change to trigger Travis CI 2017-03-02 21:24:03 -08:00
StilesCrisis
6e2e5c7dbe Specialize StrLen for char/wchar_t
Compilers generally provide a much smarter strlen than ours.
2017-02-28 01:11:30 -08:00
Milo Yip
e6b192a75c Merge pull request #869 from StilesCrisis/writer-key-fix
Writer EndObject missing-value fix
2017-02-28 16:02:52 +08:00
StilesCrisis
4643104b8a Fix null handler construction
We should not malloc the null-handler object and cast to OutputHandler;
we need to actually invoke the constructor via placement new.
2017-02-27 23:28:25 -08:00
StilesCrisis
fa84cd18f4 Add matching fix for PrettyWriter
PrettyWriter EndObject will now also assert if called when a key is
missing its matching value.
2017-02-27 22:53:59 -08:00
StilesCrisis
2e9b7b1ae6 Added assertion
Documented existing assertions in EndObject
Added new assertion in EndObject to catch error condition where objects
are ended with a key but no matching value.
2017-02-27 22:44:13 -08:00
Milo Yip
97e2f7f16f Try fixing Error compilation Ubuntu 14.04 #834 2017-02-28 09:48:36 +08:00
Milo Yip
82295b1f4d Merge pull request #842 from StilesCrisis/token-by-token-parsing
Token-by-token pull parsing
2017-02-26 22:36:04 +08:00
ylavic
b977fd3c9d Missing "internal" namespace for StrLen
include/rapidjson/pointer.h:243:40: error: 'StrLen' was not declared in this scope
         return Append(name, StrLen(name), allocator);
2017-02-24 16:46:53 +01:00
StilesCrisis
ecf3d64293 Merge branch 'nan-inf-parse-fix' into token-by-token-parsing 2017-02-23 00:19:07 -08:00
StilesCrisis
5e785d3db2 Fix parsing of NaN/Inf
A failed half-consume of “NaN” now returns “value invalid” instead of
attempting to consume an “Inf”.
2017-02-23 00:11:12 -08:00
John Stiles
0f8389e787 Restored original IterativeParse implementation
Runs about 1-2% faster (original speed) by running in a tight loop, at
the expense of slight code duplication with IterativeParseNext.
2017-02-07 00:02:08 -08:00
StilesCrisis
4394b3bac7 Add LIKELY and UNLIKELY hints
Doesn’t seem to affect timings in perftest on my machine, but it may
help others.
2017-02-04 00:05:34 -08:00
StilesCrisis
116f65994b Improve coverage and performance
Further improvement to perftest and hoping to make coveralls happy.
2017-02-03 18:58:37 -08:00