67 Commits

Author SHA1 Message Date
Philipp A. Hartmann
7a2e6e79c6 StrLen: align implementations
There are two copies of `StrLen` in the RapidJSON code base
 * strfunc.h: rapidjson::internal::StrLen<Ch>
 * unittest.h: Strlen<Ch>

To hide a warning on MSVC, align both implementations to use
'unsigned/SizeType' as return type and add an explicit cast.
2014-07-10 19:41:17 +02:00
Philipp A. Hartmann
3cdfb0dafe rapidjsontest.cpp: silence a warning (C4244) on MSVC 2014-07-10 19:38:57 +02:00
Philipp A. Hartmann
9a89eed11a adopt AddMember tests from #47 (726f986,b7bf73c) 2014-07-09 09:24:34 +02:00
Philipp A. Hartmann
8bbf41f7c7 update string API tests 2014-07-08 20:23:34 +02:00
Philipp A. Hartmann
6aa601cd51 perftest.h/unittest.h: fix pragma ordering 2014-07-08 15:12:02 +02:00
Philipp A. Hartmann
813da24d72 Add RAPIDJSON_DIAG_* macros to handle compiler warnings
Warning push/pop support has been added to GCC in version 4.6.0,
and pragmas to ignore certain warnings are present since 4.2.0.
This patch hides the compiler-specific warning push/pop/disable
pragmas behind a macro-based implementation (currently for MSVC and
clang /GCC.

This avoids warnings, as seen e.g. on GCC 4.4:
  ../../include/rapidjson/document.h:14: error: expected [error|warning|ignored] after ‘#pragma GCC diagnostic’
and earlier versions complaining about unknown pragmas being ignored.

Note: unittest.h and perftest.h need to check for compilers
explicitly, as rapidjson.h is not included there.
2014-07-08 14:45:19 +02:00
Milo Yip
469333af8f Fixes filename cases in source code 2014-07-04 17:03:58 +08:00
Milo Yip
ace56097fd Fixes compilation error. 2014-07-04 16:56:19 +08:00
Milo Yip
0bff4ffd0c Adds unit tests about streams. 2014-07-04 16:39:09 +08:00
Milo Yip
b01093b16c Fixes a compilation error in Reader when using encoded stream.
Added unit test for parsing EncodedStream to Document.
2014-07-04 14:32:44 +08:00
Milo Yip
9ed11d29a2 Safer implementation of Swap()
Also added documentation, unit tests for swapping Document/Value,
Document/Document.
2014-07-04 00:59:16 +08:00
Philipp A. Hartmann
3254a784bb add missing 'typename' 2014-07-03 17:13:17 +02:00
Philipp A. Hartmann
6b7f346437 ParseErrorCode: fix typo (NumberTooBig) 2014-07-03 17:06:35 +02:00
Philipp A. Hartmann
a22f325ae4 perftest: fix typo 2014-07-03 17:06:35 +02:00
Milo Yip
80a5b9093c In Value.CopyFrom unit test, run both allocators.
@pah
2014-07-03 22:57:09 +08:00
Milo Yip
1aa84342ba Added GenericValue::Swap() 2014-07-03 22:38:34 +08:00
Milo Yip
49b1a12799 Fixes two other warning about unused fread() return value 2014-07-03 01:24:52 +08:00
Milo Yip
0815f0560a Fixes a warning about unused fread() return value 2014-07-03 01:17:58 +08:00
Milo Yip
e4188c8040 Fixes a warning in release. 2014-07-03 01:11:52 +08:00
Milo Yip
1e99f0b537 Merge remote-tracking branch 'origin/master' into warning 2014-07-03 01:00:01 +08:00
Milo Yip
5a186104f4 Fixes warnings 2014-07-03 00:59:35 +08:00
Milo Yip
9aec8d6ad4 Fixes local copy optimization
The previous optimization #32 has problem that restoration requires
assignment operator.
Change the backup/restore process using a template wrapper class to
select code path.
2014-07-02 23:49:47 +08:00
Milo Yip
4843b790c0 Remove debug code 2014-06-30 21:28:57 +08:00
Milo Yip
10924e389c Fixes parsing small floating point values underflow
https://code.google.com/p/rapidjson/issues/detail?id=75

The modification is slightly different from dlbattle123 to improve
speed.
2014-06-30 21:26:43 +08:00
miloyip
389fe87cd8 Merge branch 'master' into issue23errorcode
Conflicts:
	example/condense/condense.cpp
	include/rapidjson/reader.h
	test/unittest/readertest.cpp
2014-06-30 09:44:24 +08:00
Milo Yip
789761ae1b Fixes compilation error
‘>>’ should be ‘> >’ within a nested template argument list
2014-06-29 21:18:31 +08:00
Milo Yip
bcf7cee788 Add stream copying optimization switch depending stream type.
An unit test is added
2014-06-29 20:59:01 +08:00
Milo Yip
1d14748bc9 Added overloaded functions for default parseFlags
Can write d.Parse(...) instead of d.Parse<0>(...)
Hope to reduce strangeness and confusion for beginner.
2014-06-29 15:03:38 +08:00
Milo Yip
69ca7487bc Manually merge the segfault fix from main branch and fix several unit tests about error code 2014-06-27 22:27:18 +08:00
Milo Yip
bb889b6ab6 Verify all error codes in unit tests of parsing. 2014-06-27 16:19:04 +08:00
Milo Yip
d5add05c9a Merge pull request #19 from pah/feature/double-precision
User-defined double output precision
2014-06-26 10:33:24 +08:00
Philipp A. Hartmann
65b4316da9 valuetest: add deep copy unit test
This commit adds some simple tests for the deep-copying
of values, either based on the explicit constructor, or
the CopyFrom function.

It uses the CrtAllocator to test for possible double-free
errors due to insufficient copying.
2014-06-25 18:09:26 +02:00
Philipp A. Hartmann
5474bc2f3d DoublePrecision: add a unit test for the precision handling 2014-06-25 18:09:16 +02:00
Milo Yip
1eb62770d3 Fixed gcc 4.8.x warnings. 2014-06-25 00:04:24 +08:00
Milo Yip
4bf350c5f9 Added a unit test for SkipWhitespace() 2014-06-24 23:04:27 +08:00
Milo Yip
02673bec74 Fixed out of bound read in FindMember() and added related new APIs
The original FindMember() may access out-of-bound of the 'const char*
name' parameter.
This commit firstly follows
f86af8c232

However, this must incur an StrLen() for name. A better API is by using
Value as the name, which provides the length of string internally. So a
set of new API are added:

operator[](const GenericValue& name)
FindMember(const GenericValue& name)
RemoveMember(const GenericValue& name)

During refactoring, it also adds an API:

RemoveMember(MemberIterator m)

which can be used for other purpose, such as removing a member while
iterating an object.

Fixes #7
2014-06-20 19:14:45 +08:00
Milo Yip
4d94a8057d Fixes unit testing on Visual Studio.
tmpnam() in VS prepends backslash in the path.
2014-06-20 16:08:58 +08:00
miloyip@gmail.com
47d60859d0 Additional fixes for Issue 48: incorrect return type of GetUint64()
git-svn-id: https://rapidjson.googlecode.com/svn/trunk@89 c5894555-1306-4e8d-425f-1f6f381ee07c
2012-11-15 07:16:26 +00:00
miloyip@gmail.com
d419c0ae5a Test warning fix for Issue 48: incorrect return type of GetUint64()
git-svn-id: https://rapidjson.googlecode.com/svn/trunk@87 c5894555-1306-4e8d-425f-1f6f381ee07c
2012-11-15 03:32:30 +00:00
miloyip@gmail.com
4ee17e67b1 Fixed Issue 38: Segmentation fault with CrtAllocator
git-svn-id: https://rapidjson.googlecode.com/svn/trunk@80 c5894555-1306-4e8d-425f-1f6f381ee07c
2012-11-14 03:33:10 +00:00
miloyip@gmail.com
9fb77b114b Fixed Issue 22 memory corruption via operator =
git-svn-id: https://rapidjson.googlecode.com/svn/trunk@74 c5894555-1306-4e8d-425f-1f6f381ee07c
2012-11-14 02:44:45 +00:00
miloyip@gmail.com
152c2eff6c Fixed Issue 41 Incorrect parsing of unsigned int number types
git-svn-id: https://rapidjson.googlecode.com/svn/trunk@72 c5894555-1306-4e8d-425f-1f6f381ee07c
2012-11-14 02:36:23 +00:00
miloyip@gmail.com
9c68ce986e Fixed a lots of vc2008/vs2010 and gcc3/4 warnings with the maximum warning level.
git-svn-id: https://rapidjson.googlecode.com/svn/trunk@67 c5894555-1306-4e8d-425f-1f6f381ee07c
2012-11-13 08:02:22 +00:00
miloyip@gmail.com
821c6ab73c Fixed Issue 44 SetStringRaw doesn't work with wchar_t
git-svn-id: https://rapidjson.googlecode.com/svn/trunk@65 c5894555-1306-4e8d-425f-1f6f381ee07c
2012-11-13 02:58:56 +00:00
miloyip@gmail.com
4fdd805c7d Fixed issue 18 from 0.1x branch
git-svn-id: https://rapidjson.googlecode.com/svn/trunk@64 c5894555-1306-4e8d-425f-1f6f381ee07c
2012-03-06 05:36:42 +00:00
miloyip@gmail.com
3d77ef8ee9 Added GenericStringBuffer::GetSize() within unit test, as in 0.1x branch.
git-svn-id: https://rapidjson.googlecode.com/svn/trunk@61 c5894555-1306-4e8d-425f-1f6f381ee07c
2012-02-28 06:21:03 +00:00
miloyip@gmail.com
f516a01769 Fixed an unit test issue due to without renaming the EncodedStreamTest class.
git-svn-id: https://rapidjson.googlecode.com/svn/trunk@48 c5894555-1306-4e8d-425f-1f6f381ee07c
2011-12-03 06:36:31 +00:00
miloyip@gmail.com
55587d6f62 Added transcoding support in Writer and PrettyWriter
git-svn-id: https://rapidjson.googlecode.com/svn/trunk@47 c5894555-1306-4e8d-425f-1f6f381ee07c
2011-12-03 04:17:07 +00:00
miloyip@gmail.com
8bdcd74227 Fixed one decoding/validating bug in UTF8
Fixed one decoding/validating buf in UTF16
Fixed incorrect return type in StringBuffer::GetString()
Added unit tests for encoding/decoding/validating of different encodings

git-svn-id: https://rapidjson.googlecode.com/svn/trunk@46 c5894555-1306-4e8d-425f-1f6f381ee07c
2011-12-03 04:15:56 +00:00
miloyip@gmail.com
c51c90b2a6 Added RFC4627's encoding detection method, with refactored BOM detection.
git-svn-id: https://rapidjson.googlecode.com/svn/trunk@45 c5894555-1306-4e8d-425f-1f6f381ee07c
2011-12-01 16:19:57 +00:00