469 Commits

Author SHA1 Message Date
Milo Yip
4cd14b7c0e Merge pull request #305 from pah/fix/strict-memcpy
Avoid calling memcpy with NULL pointers
2015-04-17 12:28:37 +08:00
Philipp A. Hartmann
0c5c1538dc Avoid calling memcpy with NULL pointers
According to the C/C++ standards, calling `memcpy(NULL, NULL, 0)` is
undefined behaviour. Recent GCC versions may rely on this by optimizing
NULL pointer checks more aggressively, see [1].

This patch tries to avoid calling std::memcpy with zero elements.
As a side effect, explicitly return NULL when requesting an empty block
from MemoryPoolAllocator::Malloc.

This may be related to #301.

[1] https://gcc.gnu.org/gcc-4.9/porting_to.html
2015-04-16 21:05:08 +02:00
miloyip
22021d6622 Converts tabs to spaces 2015-04-16 10:15:23 +08:00
Milo Yip
8f2add7527 Not enforce force inline for debug configuration 2015-04-15 22:23:00 +08:00
thebusytypist
6ef29ff431 Fix warning about unused argument. 2015-04-15 16:09:29 +08:00
thebusytypist
5ae48a0380 Assert on impossible state transition in Transit(); Put the last case and all non-enumerated cases(also supply assertion for them) in for code coverage. 2015-04-15 15:21:42 +08:00
thebusytypist
399333226b Use assertion for impossible case(The Predict() can ensure the token is ColonToken, otherwise it would be marked as Error state. So there is no need to check ColonToken again). 2015-04-15 14:54:44 +08:00
miloyip
76d67b7eae Improves coverage of Value::Accept() 2015-04-15 12:16:16 +08:00
miloyip
2689cc4974 Remove more unused code paths in double conversions 2015-04-15 11:52:24 +08:00
miloyip
402d75a801 Fix gcc warning 2015-04-15 11:07:13 +08:00
miloyip
37d820a13e Remove unused code paths in double conversions 2015-04-15 10:58:49 +08:00
Milo Yip
afe2fbdc3f Fix the warnings again 2015-04-14 21:30:57 +08:00
Milo Yip
84e5741204 Fix gcc warning 2015-04-14 21:23:44 +08:00
Milo Yip
872aba660c Improve coverage of encoded streams 2015-04-14 21:08:33 +08:00
miloyip
4be4857a19 Remove ununused BigInteger::FullAdd() 2015-04-14 14:58:48 +08:00
miloyip
4824f12efb Fixed a bug in trimming long number sequence 2015-04-14 13:59:05 +08:00
miloyip
81c539e739 Merge remote-tracking branch 'origin/master' into issue298_coverage 2015-04-14 11:29:58 +08:00
miloyip
67be9ed2cb Remove depreciated FileStream 2015-04-14 11:08:47 +08:00
miloyip
04011cdae2 Adjust spaces 2015-04-13 22:46:27 +08:00
miloyip
65bffef4b1 Merge remote-tracking branch 'origin/master' into issue298_coverage 2015-04-13 18:39:06 +08:00
miloyip
2d07198863 Fix compilation 2015-04-13 18:24:10 +08:00
miloyip
e7f1c6dd08 Remove an invalid Document::ParseInsitu() API 2015-04-13 18:21:15 +08:00
miloyip
e9b92256a2 Add itoatest 2015-04-13 15:11:32 +08:00
miloyip
18a8891f0d Improve coverage for Writer and PrettyWriter 2015-04-13 14:50:08 +08:00
miloyip
3c028685df Add tests for Writer API for RAPIDJSON_HAS_STDSTRING 2015-04-13 14:25:05 +08:00
miloyip
127ce7175a Add a missing error handling for Writer, and add tests for invalid encoding. 2015-04-13 14:05:43 +08:00
miloyip
6ee691550f Move GenericPointer::kInvalidIndex to rapidjson::kPointerInvalidIndex
It is needed to prevent linking error for gcc/clang
2015-04-11 14:48:33 +08:00
miloyip
e346b93325 Try to fix a potential set fault on some compiler
Merge the fix from https://github.com/miloyip/itoa-benchmark/issues/8
2015-04-11 12:10:44 +08:00
miloyip
cb59a5a9a2 Correct the Value::operator==() for double. 2015-04-11 11:34:44 +08:00
Milo Yip
5ae85e67f6 Yet two more warnings 2015-04-11 00:41:09 +08:00
Milo Yip
2452afbf3c Fix -Wfloat-equal warnings in Value::operator== and valuetest 2015-04-11 00:02:17 +08:00
Milo Yip
bd435f76ab Another trial to fix the kInvalidIndex problem 2015-04-10 23:32:28 +08:00
Milo Yip
c7bcdb9c0c Fix a clang/gcc linker error
static const member integer not working
2015-04-10 23:06:17 +08:00
Milo Yip
dfba62e143 Fixed two -Wfloat-equal warnings 2015-04-10 22:57:41 +08:00
Milo Yip
26be3be5c7 Fix several clang/gcc warnings 2015-04-10 22:12:59 +08:00
Milo Yip
dfc864b1d3 Fix a bug in Pointer::Create() which makes it very slow 2015-04-10 22:06:56 +08:00
Milo Yip
02aa12a29e Merge pull request #291 from miloyip/issue289_NegativeZeroRoundtrip
Fix #289 negative zero roundtrip (double only)
2015-04-10 21:53:58 +08:00
Milo Yip
1b9cab7f12 Try to fix more gcc/clang compilation errors 2015-04-10 21:40:18 +08:00
Milo Yip
e5cf3b85f3 Fix #289 negative zero roundtrip (double only) 2015-04-10 21:24:29 +08:00
Milo Yip
601a62e5b3 Try to fix a gcc/clang issue after removing Document::ValueType 2015-04-10 20:59:39 +08:00
Milo Yip
b7e34100ed Fix #288 double quote in unicode escape 2015-04-10 20:36:27 +08:00
Milo Yip
b2d72ef751 Add XXXByPointer() helper functions 2015-04-10 19:28:12 +08:00
Milo Yip
cf0ff19cac Add Pointer default/copy constructor, assignment operator. Test constructor with tokens 2015-04-10 18:25:02 +08:00
Milo Yip
c11547ebfa Implement Pointer::Create(). Get(). GetWithDefault(). Set(). Swap() 2015-04-10 17:43:11 +08:00
Milo Yip
852c25123c Implement parser/generator for JSON Pointer 2015-04-10 14:54:13 +08:00
Milo Yip
d1959ba6e3 Change copyright owner and related changes. 2015-04-03 12:57:16 +08:00
Philipp A. Hartmann
cda34f0033 encodings.h: hide overflow warning 2015-04-01 22:39:42 +02:00
Philipp A. Hartmann
525e8c5770 biginteger/diyfp: mark __int128 as extension on GCC 2015-04-01 22:39:26 +02:00
Philipp A. Hartmann
2f010e6e4b document.h: include <string>, iff RAPIDJSON_HAS_STDSTRING==1
Reported-by: Janusz Chorko (@yachoor)
See: https://github.com/miloyip/rapidjson/commit/c1c9ba7c#commitcomment-10434694
2015-03-30 22:37:24 +02:00
thebusytypist
92c7485be0 Check libstdc++ version to decide if enable rvalue ref support. 2015-03-24 17:03:24 +08:00