1717 Commits

Author SHA1 Message Date
Milo Yip
17254e090e Version 1.1.0
Change version numbers
Fixed some document linkage
Fix #648
2016-08-25 14:35:17 +08:00
Milo Yip
ab791ae90c Merge pull request #703 from jmallach/master
Fix builds on x32 platform.
2016-08-02 10:47:00 +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
Milo Yip
fedae8552a Remove google analytics 2016-08-01 09:21:31 +08:00
Milo Yip
6d9ab582b2 Fix doxygen build 2016-07-29 15:27:32 +08:00
Milo Yip
319248eb52 Remove disqus in documentation 2016-07-29 14:49:08 +08:00
Milo Yip
c76ebf98de Merge pull request #698 from jseward/master
Add std::string overload to PrettyWriter::Key() when RAPIDJSON_HAS_STDSTRING is #defined
2016-07-27 16:46:31 +08: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
67d8a99477 Merge pull request #691 from miloyip/issue682_mallocfail
Handle malloc() fail in PoolAllocator
2016-07-23 10:31:55 +08: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
99ba17bd66 Merge pull request #689 from miloyip/issue684_flush
Add Flush() for all value types
2016-07-21 10:59:57 +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
Milo Yip
369de87e5d Merge pull request #681 from niukuo/master
fix rapidjson::value::Get<std::string>() may returns wrong data
2016-07-11 16:05:38 +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
Milo Yip
5e8a382c19 Merge pull request #674 from sjasonsmith/master
Make GenericSchemaDocument constructor explicit
2016-07-02 21:00:47 +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
Milo Yip
727e2b958d Merge pull request #673 from sjasonsmith/master
Fix buffer overrun using PutN (closes #672)
2016-07-01 17:44:01 +08: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
Milo Yip
c79958a29b Fix #670 remote schema provider document 2016-06-29 09:48:38 +08:00
Milo Yip
f51d7c9d4b Merge pull request #669 from pah/fixes/666
readertest: Suppress "dangling-else" warning on GCC 7 and later
2016-06-28 09:58:22 +08:00
Philipp A. Hartmann
ad32940da8 readertest: Suppress "dangling-else" warning on GCC 7 and later
GCC 6.x doesn't yet support this warning flag, as reported by
@ragnar-ouchterlony.
2016-06-27 19:05:29 +02:00
Milo Yip
6da92274ae Merge pull request #667 from pah/fixes/666
Fix warnings on GCC 6 and later (closes #666)
2016-06-27 09:58:14 +08:00
Milo Yip
cf7324b466 Merge pull request #660 from andytimes/for-milo
document typo fix and .gitignore update
2016-06-27 09:35:42 +08: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
Andy Deng
dabbd2b028 gitignore: ignore Doxyfile.zh-cn
Doxyfile.zh-cn is a generated file that we need to ignore.
2016-06-15 11:56:20 +08:00
Andy Deng
2246ef3e6b doc/tutorial-zh-cn: Fix a typo in tutorial 2016-06-15 11:53:23 +08:00
Milo Yip
1c087b77cb Fix #650 SAX documentation bug 2016-06-15 09:46:30 +08:00
Milo Yip
b34f18525e Fix tutorial bug 2016-06-15 09:41:56 +08:00
Milo Yip
62ff0a9df9 Merge pull request #646 from efidler/ubsan
Fix undefined behaviour
2016-06-15 09:35:12 +08:00
Eli Fidler
8c4059766e test for no-double-promotion instead of just checking compiler version 2016-06-14 07:01:41 -07: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
Eli Fidler
df9b45a656 avoid division by zero, which is undefined behavior
UBSAN gave:
runtime error: division by zero
2016-06-14 07:01:41 -07:00
Eli Fidler
760ea4316c avoid signed-integer underflow, which is undefined behavior
maybe these tests should just be deleted?

UBSAN gave:
runtime error: signed integer overflow: -9223372036854775808 - 1 cannot be represented in type 'long'
runtime error: signed integer overflow: -9223372036854775808 - 2 cannot be represented in type 'long'
2016-06-14 07:01:41 -07:00
Eli Fidler
be1eedf808 avoid signed-integer overflow, which is undefined behavior
UBSAN gave for test/unittest/itoatest.cpp:87:
runtime error: signed integer overflow: 4611686018427387904 * 2 cannot be represented in type 'long'
2016-06-14 07:01:41 -07:00
Eli Fidler
61637d3382 avoid passing a null pointer to memcpy
UBSAN on Clang/Linux gave:
runtime error: null pointer passed as argument 2, which is declared to never be null
/usr/include/string.h:43:45: note: nonnull attribute specified here
2016-06-13 07:24:26 -07:00
Eli Fidler
8074b722f0 avoid reference to null pointer and member access within null pointer
UBSAN gave issues with the typeless Schema:
runtime error: reference binding to null pointer of type 'rapidjson::GenericSchemaDocument<rapidjson::GenericValue<rapidjson::UTF16<wchar_t>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >, rapidjson::CrtAllocator>'
and
runtime error: member access within null pointer of type 'AllocatorType' (aka 'rapidjson::CrtAllocator')
2016-06-13 07:24:26 -07:00
Eli Fidler
fe550f3866 avoid array index out-of-bounds
UBSAN gave "runtime error: index 13 out of bounds for type 'const uint32_t [10]'"
2016-06-13 07:24:26 -07:00
Eli Fidler
5c77c9248c with recent clang, this triggers -Wunevaluated-expression
specifically, "expression with side effects has no effect in an unevaluated context"
2016-06-13 07:24:26 -07:00
Eli Fidler
035271091f with recent clang, when expected is false, this code triggers -Wunreachable-code
clang advises: "note: silence by adding parentheses to mark code as explicitly dead"
2016-06-13 07:24:26 -07:00
Eli Fidler
13e3aa9b00 we do need to avoid the double-promotion warning on clang, since we're compiling with -Werror 2016-06-13 07:24:26 -07:00
Eli Fidler
89f6b8a380 Clang doesn't like the C-style casts in nmmintrin.h 2016-06-13 07:24:26 -07:00
Eli Fidler
56bb9992b0 support building with ASAN and UBSAN on Clang and GCC 2016-06-13 07:24:26 -07:00
Milo Yip
2e66339137 Disable parsebyparts example for clang 2016-06-13 09:54:02 +08:00
Milo Yip
fee5190def Fix a clang warning 2016-06-13 09:34:47 +08:00
Milo Yip
024fc49586 Merge pull request #654 from efidler/travis-clang
switch Clang from broken Ubuntu PPA to upstream binary release
2016-06-13 09:21:02 +08:00