2283 Commits

Author SHA1 Message Date
ylavic
dbb594bdb3 Use the allocator of the Schema for its Pointer.
The Pointer passed to construct the Schema can be from the stack or any
transient storage, so the copy stored in the Schema must have the same
lifetime/allocator as the Schema itself.
2019-01-10 18:42:16 +01:00
Milo Yip
bfdcf49110
Merge pull request #1426 from ylavic/pointer_less_than
Add "less than" operator to Pointer.
2018-12-19 16:25:09 +08:00
Milo Yip
b56eb28575
Merge branch 'master' into pointer_less_than 2018-12-18 09:32:09 +08:00
Milo Yip
8549e3db6a
Merge pull request #1431 from ylavic/pointer_swap
Allow to (std::)Swap two pointers.
2018-12-18 09:31:05 +08:00
ylavic
2ce91b823c Pointer tests now need <algorithm> (for std::swap), but no tabs. 2018-12-17 14:45:23 +01:00
ylavic
a66cf7924c Allow to (std::)Swap two pointers. 2018-12-17 14:33:32 +01:00
ylavic
eb6ee17d2d Speed up Pointer::operator<().
Speed is more important than alphabetical order (which makes few sense in
JSON in general, and with pointers especially). The use case is indexing
in std containers, i.e. O(log n) with rbtree, so the faster comparison
the better.
2018-12-12 22:32:56 +01:00
ylavic
0e34ed43f4 Rework Pointer::operator<() loop.
I must be too dumb to understand the mess MSVC (32bit only) did with the
previous loop, and to figure out how it might have make it never end.
Anyway, hopefully any compiler can grok this new loop...
2018-12-12 15:15:43 +01:00
ylavic
af17f196c6 Unit test for Pointer::operator<(). 2018-12-11 00:19:13 +01:00
ylavic
055f1fa61e Add less than operator to Pointer.
Allows to sort pointers in (std-)containers and/or index by them.
2018-12-10 22:02:25 +01:00
Milo Yip
66eb6067b1
Merge pull request #1425 from ylavic/filereadstream_peek4
Fix off by one in FileReadStream::Peek4()
2018-12-06 23:44:10 +08:00
Milo Yip
b4b0e13b4d
Merge pull request #1424 from ylavic/file_input_streams
Optimize FileReadStream and BasicIStreamWrapper.
2018-12-06 23:43:48 +08:00
Milo Yip
eea3e57bcf
Merge pull request #1416 from ylavic/regex_syntax_noassert
GenericRegex: don't throw/abort on syntax error (unclosed parenthesis).
2018-12-06 23:41:45 +08:00
ylavic
38d25d7458 Fix FileReadStream::Peek4().
Until Read() reaches EOF, Peek4() must not take off by one in
bufferLast_ into account; otherwise a buffer of size exactly 4 always
returns NULL.
2018-12-06 08:38:21 +01:00
ylavic
8aab3db129 Base buffered BasicIStreamWrapper on the original (better performing) FileReadStream algorithm. 2018-12-06 00:21:05 +01:00
ylavic
124e8b6079 Possibly std::ios::binary helps with streams on Windows 2018-12-05 18:35:45 +01:00
ylavic
2498c5776f Optimize FileReadStream and BasicIStreamWrapper.
On (my) linux, perftest reports:
- ~40% gain for FileReadStream (Take() loop),
- ~10% gain for ReaderParse_DummyHandler_FileReadStream.

With the same logic applied to BasicIStreamWrapper, which thus can now
also be created with a user buffer, performances align with those of
FileReadStream (same buffer size).

The "unbuffered" versions (added for FileReadStream) work solely with
the internal peekBuffer (Ch[4]) and are measured in perftest.  When
performances don't matter much, they can avoid the use of large
stack/heap buffers.
2018-12-05 16:43:54 +01:00
seky
d0188462d9 removed std::string and receiving const Value in printIt 2018-12-05 08:24:59 +01:00
seky
c9060b4a5c added example for sorting keys 2018-12-04 22:40:40 +01:00
ylavic
8c14787398 Unit test for invalid GenericRegex (unclosed parenthesis). 2018-12-03 11:49:34 +01:00
ylavic
be96f4d7fb GenericRegex: don't throw/abort on syntax error (unclosed parenthesis). 2018-12-03 11:42:29 +01:00
Milo Yip
30d92a6399
Merge pull request #1413 from ylavic/schema_regex_leak
Fix a memory leak for invalid std::regex in Schema.
2018-12-03 09:53:39 +08:00
Milo Yip
1c5b90f409
Merge pull request #1414 from ylavic/regex_allocator
Use passed in allocator for internal regex parser.
2018-12-03 09:51:50 +08:00
ylavic
3e6956767e Fix a memory leak for invalid std::regex in Schema. 2018-12-01 23:36:45 +01:00
ylavic
b0c96f9baf Use passed in allocator for internal regex parser. 2018-12-01 22:02:48 +01:00
Milo Yip
a63216054d
Merge pull request #1388 from yhager/yhager/clang-7
silence clang-7 self-assign-overloaded warning
2018-11-22 12:30:02 +08:00
Milo Yip
595ed48d54
Merge pull request #1403 from jcmonnin/fix-warning
Fix warning when NDEBUG is defined [-Wunused-variable]
2018-11-22 12:22:41 +08:00
Jean-Claude Monnin
51ca982aa1 Fix warning when NDEBUG is defined [-Wunused-variable]
Because `isPeek()` is side effect free this should not change anything.

The reason this warning is not shown in the unit tests is because the asserts
are always evaluated in the unit test:

#define RAPIDJSON_ASSERT(x) (!(x) ? throw AssertException(RAPIDJSON_STRINGIFY(x)) : (void)0u)
2018-11-21 13:24:06 +01:00
Philipp A. Hartmann
0cc44c82c9
Update test/unittest/pointertest.cpp
Co-Authored-By: yhager <yhager@users.noreply.github.com>
2018-10-31 20:31:04 -07:00
Yuval Hager
a77b49dcb8 silence clang-7 self-assign-overloaded warning 2018-10-26 14:58:57 -07:00
Milo Yip
67fac85e96
Merge pull request #1373 from lelit/issue1368
Add test case on kParseNumbersAsStringsFlag being able to load big ints
2018-10-09 00:20:35 +08:00
Lele Gaifax
91d50c849d Add test case on kParseNumbersAsStringsFlag being able to load big ints
See issue #1368.
2018-10-08 10:21:25 +02:00
Konstantin Käfer
16872af889 Avoid pointer arithmetic on null pointer to remove undefined behavior
The existing checks triggered undefined behavior when the stack was empty (null pointer). This change avoid this:
* If `stackTop_` and `stackEnd_` are null, it results in a `ptrdiff_t` of `0`
* If `stackTop_` and `stackEnd_` are valid pointers, they produce a `ptrdiff_t` with the remaining size on the stack
2018-10-05 09:26:20 +02:00
Milo Yip
663f076c7b
Merge pull request #1362 from jiapengwen/master
fix tutorial error
2018-09-19 12:58:56 +08:00
Milo Yip
2a5e733b6f
Merge pull request #1364 from jcourtat/fixfaq
faq: fix document insertion example
2018-09-19 12:58:14 +08:00
Julien Courtat
68349ed914 faq: fix document insertion example
GenericDocument contructor requires a pointer to an Allocator, but GetAllocator() only
returns a reference.

Signed-off-by: Julien Courtat <julien.courtat@aqsacom.com>
2018-09-18 14:51:12 +02:00
jiapeng.wen
1cfa861d4c fix tutorial error 2018-09-18 10:51:16 +08:00
Milo Yip
c0ca05f6dd
Merge pull request #1329 from pah/fix-noexcept
Add RAPIDJSON_NOEXCEPT_ASSERT
2018-09-11 10:13:09 +08:00
Milo Yip
c2aa79dc88
Merge pull request #1356 from gongminmin/AppVeyor2017
Update appveyor rule to support VS2017.
2018-09-10 16:59:39 +08:00
Milo Yip
783b819e67
Update rapidjson.h 2018-09-10 13:11:17 +08:00
Minmin Gong
a6be583efa Update appveyor rule to support VS2017. 2018-09-09 20:58:02 -07:00
Milo Yip
8a96a95de2
Merge branch 'master' into fix-noexcept 2018-09-10 11:27:45 +08:00
Milo Yip
f5f6052c56
Merge pull request #1327 from gongminmin/FixCompileInVS
Fix the compiling problems in VS
2018-09-10 11:23:26 +08:00
Milo Yip
08b1a8a41e
Merge pull request #1302 from chwarr/min-max-guard
Guard against min/max being macros in reader.h
2018-09-10 11:22:28 +08:00
Milo Yip
81af404b7f
Merge pull request #1284 from mobileben/noexcept-assert
Handle non-throwing exception specifications that can still throw #1280
2018-09-10 11:21:34 +08:00
Milo Yip
73063f5002
Merge pull request #1340 from lelit/issue1336
Wrap all WriteXxx() calls within EndValue()
2018-08-05 19:01:46 +08:00
Lele Gaifax
c9eabf9e13 Extend the test on issue #1336 to cover all basic types 2018-08-05 09:44:15 +02:00
Lele Gaifax
3fc9299b84 Add simple test for issue #1336 2018-08-03 12:34:03 +02:00
Lele Gaifax
11defb7aa4 Wrap all WriteXxx() calls within EndValue(), to ensure a flush after root-level scalar value
This attempts to fix issue #1336.
2018-08-03 12:17:29 +02:00
Milo Yip
6a905f9311
Merge pull request #1331 from JPEWdev/mem-alignment-fix
Fix SIGBUS due to unaligned access
2018-08-01 11:56:25 +08:00