987 Commits

Author SHA1 Message Date
Milo Yip
265fb6ee88 Fix #831 RAPIDJSON_HAS_CXX11_RANGE_FOR is error defined 2017-01-24 09:28:52 +08:00
Zhihao Yuan
3cc77d5d63
Treat signed-unsigned conversions as errors. 2017-01-18 18:09:18 -06:00
Milo Yip
03a7391049 Merge pull request #757 from patcheng/feature/fix_clang_warning
added assertion to help suppress clang warnings
2016-12-23 10:00:30 +08:00
Andrey Glebov
41ceb8624f - replaced RAPIDJSON_NEW with C++98 compatible version 2016-12-21 14:03:53 +03:00
Andrey Glebov
9fe93bb984 - replaced RAPIDJSON_NEW macro with variadic varient 2016-12-21 10:17:25 +03:00
Milo Yip
e07d0e9438 Move GenericValue deep-clone constructor into the class declaration. 2016-10-31 18:28:53 +08:00
Milo Yip
95b346c3ca Refactor GenericValue deep-clone constructor 2016-10-31 18:24:17 +08:00
Milo Yip
d7dd4106ea Remove empty NumberStream::~NumberStream()
Fix #781
2016-10-25 18:21:01 +08:00
Milo Yip
d6c8b378d4 Merge pull request #777 from miloyip/issue728_threadsafe
Fix nullHandler allocation bug
2016-10-21 17:35:53 +08:00
Milo Yip
992b7f5f8e Fix nullHandler allocation bug 2016-10-21 12:25:37 +08:00
Milo Yip
fba9ebd9bc Merge pull request #776 from miloyip/issue728_threadsafe
Remove singletons in schema classes
2016-10-20 14:01:32 +08:00
Milo Yip
59bcebbf3d Merge pull request #773 from bluehero/master
use _mm_cmpistri
2016-10-18 14:38:39 +08:00
Milo Yip
bf0cc7bea8 Fixed a bug for SchemaDocument move constructor 2016-10-18 13:53:00 +08:00
bluehero
31ace3b767 use _mm_cmpistri 2016-10-18 12:54:42 +08:00
Milo Yip
7c4e511eb0 Change Schema::GetTypeless() from singleton to instance
Now owned by SchemaDocument::typeless_, and be shared to its
Schema::typeless_
2016-10-18 11:37:15 +08:00
Milo Yip
ddbd2ef05d Restore missing deallocation of GenericSchemaValidator::nullHandler_ 2016-10-18 10:14:00 +08:00
Milo Yip
b963eb447b Change SchemaValidator::GetNullHandler() from singleton to instance. 2016-10-17 18:30:18 +08:00
Milo Yip
97fb9bc85b Merge pull request #770 from miloyip/issue728_threadsafe
Fixed another crash bug in #728
2016-10-17 15:35:01 +08:00
Milo Yip
3b1a037499 Merge pull request #748 from sfinktah/sfinktah-minwindef-fix
Fix for winmindef.h defining min/max macros
2016-10-17 14:29:10 +08:00
Milo Yip
517dd4dbb8 Fix failing to resolve $ref in allOf causes crash in SchemaValidator::StartObject() 2016-10-17 14:25:24 +08:00
Milo Yip
2363227974 Add Value::Value(float) and static_cast for suppressing clang warning 2016-10-14 22:03:54 +08:00
Patrick Cheng
95224aff7d When length is 0, the code does nothing, so skip it completely.
Previously, os.Push(0) would do nothing as well. But with the newly added assertion, is the stack is empty, it will fail the assertion.
2016-09-30 13:44:15 -07:00
Patrick Cheng
91a803d463 Reserve() is sometimes called when stackTop_ is null. The assert is invalid. 2016-09-30 11:12:23 -07:00
Patrick Cheng
9d8df28c1d added assertion to help suppress clang warnings 2016-09-30 10:47:00 -07:00
Adam Majer
cb017cbf5e Fix compilation with older GCC versions
Older GCC versions fail compiling RapidJSON due to a warning

include/rapidjson/reader.h:578: error: suggest a space before ';' or explicit braces around empty body in 'while' statement
: warnings being treated as errors
2016-09-30 17:10:04 +02:00
Sfinktah Bungholio
51a31ce006 Fix for winmindef.h defining min/max macros 2016-09-25 20:36:33 +10:00
Milo Yip
5cd62c235d Add StringBuffer::GetLength()
Fix #744
2016-09-22 18:11:22 +08:00
Milo Yip
f28203c7a1 Fix #741 2016-09-21 11:09:04 +08:00
Tall??di Mih??ly
62dc1077eb Move constructor support for PrettyWriter 2016-09-19 21:47:27 +02:00
Tall??di Mih??ly
307e021606 Move constructor support for Writer
This also requires turning off the c++98 compatibility checks when building
with clang.
2016-09-19 21:47:27 +02:00
Milo Yip
769185d68b Refactor regex
Remove mutable which causes reentrant issue
2016-09-16 12:13:02 +08:00
Milo Yip
3e2172bd52 Add preconditions in writer and string functions 2016-09-03 23:37:00 +08:00
niukuo
250cf666d3 fix wrong length in remote schema
Change-Id: Ia96ddf5746f1c18968e9e086f17fe4a24b8480d7
2016-08-31 16:26:27 +08:00
Janusz Chorko
862c39be37 Explicitly disable copy assignment operator 2016-08-26 21:26:50 +02:00
Janusz Chorko
3b2441b87f Removed non-compiling assignment operator. Fixed #718 2016-08-26 21:17:38 +02:00
Milo Yip
17254e090e Version 1.1.0
Change version numbers
Fixed some document linkage
Fix #648
2016-08-25 14:35:17 +08:00
Jordi Mallach
323a0dce43 Fix builds on x32 platform.
From the Debian wiki: https://wiki.debian.org/X32Port

X32 is an ABI for amd64/x86_64 CPUs using 32-bit integers, longs
and pointers. The idea is to combine the smaller memory and cache
footprint from 32-bit data types with the larger register set of
x86_64. The 64-bit registers can make computation more efficient,
and with 8 additional registers available, there is less pressure
compared to i386/i686.

rapidjson makes an incorrect assumption in a check for 64 bit
platforms, and uses __LP64__ exclusively. This fix adds an
additional check for __x86_64__ && __ILP32__ defines, as a very
conservative fix. However, the usage of __LP64__ would be a problem
for other "mixed" applications like ARM ILP32, so a better detection
scheme might be needed in the future.
2016-08-01 14:25:50 +02:00
Jamie Seward
78a7ecb946 Add std::string overload to PrettyWriter::Key() when RAPIDJSON_HAS_STDSTRING is #defined
Only String() has the std::string overload currently.
2016-07-26 22:35:46 -07:00
Milo Yip
332b61fe41 Handle malloc() fail in PoolAllocator
Fix #682
2016-07-21 17:25:17 +08:00
Milo Yip
2f751650e2 Merge pull request #690 from fuzhufang/master
optimize FindMember  when use std::string
2016-07-21 11:37:33 +08:00
Milo Yip
db6a6f3f64 Add Flush() for all value types
Fixes #684
2016-07-21 09:33:00 +08:00
fuzhufang
b67ff2fb11 if define RAPIDJSON_HAS_STDSTRING, FindMember use std::string, but it
also use internal::StrLen to get the string lengtht,
when it call FindMember(StringRef(name)).
Now use GenericValue construct it, then can use the std::string.size.
now it will be faster.
2016-07-14 17:50:48 +08:00
yiteng.nyt
8c43554de6 fix rapidjson::value::Get<std::string>() may returns wrong data
Change-Id: Ia7325edb437e3039e29223d0ecc4d9c83d824bc0
2016-07-11 12:38:10 +08:00
Jason Smith
899156172d Make GenericSchemaDocument constructor explicit
Prior to this change, a user could incorrectly pass a Document object to
SchemaValidator. This would implicitly construct a SchemaDocument, which
would then be destructed before the validator was used. This caused
unpredictable results including memory corruption and program crashes.
2016-07-01 06:59:07 -07:00
Jason Smith
252e8122bf Fix buffer overrun using PutN (closes #672)
Fix inconsistent calling of template functions in PutN in stream.h. When
used with a GenericStringBuffer<<UTF8>, MemoryPoolAllocator>, PutN would call
PutReserve from stream.h, and PutUnsafe from stringbuffer.h. This
resulted in bytes being added to the buffer without allocating space.

This was not an issue when used with the default memory allocator,
because in this case the specialized PutN is used from stringbuffer.h.
2016-06-30 14:18:14 -07:00
Philipp A. Hartmann
f6a07692f9 Fix warnings on GCC 6 and later (closes #666)
* document.h
  * suppress -Wterminate on GCC 6.x and later
  * simplify warning handling
* schema.h
  * drop RAPIDJSON_NOEXCEPT from GenericSchemaDocument constructor
    (calls RAPIDJSON_NEW anyway)
  * simplify warning handling
    (avoids RAPIDJSON_POP mismatch on Clang)
* encodingtest.cpp, istreamwrappertest.cpp
  * work around -Wdangling-else
* readertest.cpp
  * suppress -Wdangling-else
2016-06-23 21:42:16 +02:00
Eli Fidler
21acc56d57 range check in IsLosslessFloat to avoid undefined double->float cast
UBSAN gave in Value.IsLosslessFloat:
include/rapidjson/document.h:981:38: runtime error: value 3.40282e+38 is outside the range of representable values of type 'float'
2016-06-14 07:01:41 -07:00
Eli Fidler
c52cec7e51 fix undefined double to uint64_t cast
note that std::numeric_limits<uint64_t>::max() and
std::numeric_limits<int64_t>::max() aren't exactly representable in a
double, so we need to be strictly less to be definitely lossless

UBSAN gave during Value.IsLosslessDouble test:
include/rapidjson/document.h:955:42: runtime error: value 1.84467e+19 is outside the range of representable values of type 'unsigned long'
2016-06-14 07:01:41 -07:00
Eli Fidler
05f0592b34 avoid shift out-of-range error
UBSAN gave in Regex.Unicode test:
include/rapidjson/encodings.h:157:28: runtime error: shift exponent 32 is too large for 32-bit type 'int'
2016-06-14 07:01:41 -07:00
Eli Fidler
9dcf51c3a1 avoid shift out-of-range error
UBSAN gave during Reader.ParseNumber_FullPrecisionDouble test:
include/rapidjson/internal/strtod.h:149:11: runtime error: shift exponent 46 is too large for 32-bit type 'int'
2016-06-14 07:01:41 -07:00