1974 Commits

Author SHA1 Message Date
Milo Yip
609381fc2e Fixed some clang -Weverything warnings. 2014-06-25 23:14:32 +08:00
Milo Yip
adf6629223 Fixed VC which doesn't have INT64_C()/UINT64_C macros. 2014-06-25 22:38:18 +08:00
Milo Yip
208d2bd7a8 Separate the RAPIDJSON_FORCEINLINE from RAPIDJSON_NO_INT64DEFINE 2014-06-25 22:30:21 +08:00
Philipp A. Hartmann
16029e6b33 FileStream: avoid warning about missing initialisation
FileStream::current_ is now explicitly initialized in the constructor.
Avoids reading the garbage value in case of an empty file.
2014-06-25 13:57:04 +02:00
Philipp A. Hartmann
4b32a30593 MemoryPoolAllocator: prohibit copying and assignment
The MemoryPoolAllocator implementation cannot and should not be
copied (Rule of Three).  Declare copy constructor and copy-assignment
operator as private.
2014-06-25 13:57:04 +02:00
Philipp A. Hartmann
72de00f672 GenericValue/GenericDocument: fix alloctaor/Alloactor typos
This patch fixes some misspellings of "allocator" in document.h.
Fixes the Doxygen documentation of GenericDocument as well.
2014-06-25 13:57:04 +02:00
Philipp A. Hartmann
7fb82c2528 GenericDocument::ParseStream: make SourceEncoding optional
The ParseStream() function current requires explicitly passing
the SourceEncoding parameter as explicit template argument
while the other Parse*() functions provide overloads to omit
this parameter and use the document's own encoding by default.

This patch adds the corresponding overload for ParseStream(),
enabling the simple usage again:

  rapidjson::FileStream is(fp);
  rapidjson::Document   d;
  d.ParseStream<0>(is);
2014-06-25 13:56:07 +02:00
Philipp A. Hartmann
37b3acf40c GenericDocument: forward allocator to GenericReader
Fixes http://code.google.com/p/rapidjson/issues/detail?id=72.
2014-06-25 13:56:06 +02:00
Philipp A. Hartmann
e1a97561ba GenericValue: explicit constructors
In case of overloaded functions taking either a GenericValue or another
class that can also be constructed from the same primitive types
(e.g. std::string, which can be constructed from const char*), the
overloading becomes ambiguous:

  void foo( const std::string& );
  void foo( const rapidjson::Value & );

Declaring the GenericValue constructors taking primitive types as
'explicit' avoids this problem.  This should not have any negative
side-effects, since a GenericValue can't be copied or implicitly
converted to other types.

Fixes http://code.google.com/p/rapidjson/issues/detail?id=70.
2014-06-25 13:56:06 +02:00
Philipp A. Hartmann
d4ff956b2d GenericValue: fixup construction from NumberType
Constructing an empty GenericValue with a specific Type has failed
for any kNumberType (Int, Int64, Double...) due to incomplete definition
of the corresponding default flag value.

This patch adds a new constant kNumberAnyFlag to the flags enumeration
in GenericValue to cover this case.

This fixes http://code.google.com/p/rapidjson/issues/detail?id=57
2014-06-25 13:56:06 +02:00
Philipp A. Hartmann
1320ba77a7 drop trailing commas in enums
In C++'98/03, trailing commas in enumerations are not allowed, but have
been introduced in C++11.  This patch drops the trailing commas in order
to avoid compiler warnings (e.g. GCC with -pedantic).

Fixes http://code.google.com/p/rapidjson/issues/detail?id=49.
2014-06-25 13:56:06 +02:00
Milo Yip
be8433737f Fixed some clang -Weverything warnings. 2014-06-25 19:21:17 +08:00
Milo Yip
f930d9e2e5 Revert "Remove some clang -Weverything warnings."
This reverts commit e4ffa48a7563e892047c27f0a50fdeb6f71e6b8b.
2014-06-25 16:07:44 +08:00
Milo Yip
7ab36cf1a8 Revert "Merge branch 'master' into dev"
This reverts commit d4cb506d4b3c29dba1b4f27fa109b80b33bd6d1b, reversing
changes made to dfe201e3c1e9f184a3967719dbb0e59ef12ed54b.
2014-06-25 16:06:45 +08:00
Milo Yip
d4cb506d4b Merge branch 'master' into dev 2014-06-25 16:06:05 +08:00
Milo Yip
e4ffa48a75 Remove some clang -Weverything warnings. 2014-06-25 16:06:00 +08:00
Milo Yip
dfe201e3c1 Revert "Adds GenericDocument::ParseStream() overload to make SourceEncoding optional"
This reverts commit 84f64ba58a73a0898ad78ea239323942b63c6d51.
2014-06-25 01:06:04 +08: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
84f64ba58a Adds GenericDocument::ParseStream() overload to make SourceEncoding optional
https://github.com/pah/rapidjson/commit/77e5c6b1
2014-06-24 22:22:37 +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
0a56e6496f GenericValue: avoid memset/memcpy(this,...)
To avoid writing outside of the current GenericValue object and to
follow the C++ standard more closely, this patch drops the
memset/memcpy(this,...) occurences in GenericValue in favour of explicit
initialisations/assignments of the data_ and flag_ members.

https://code.google.com/p/rapidjson/issues/detail?id=11
https://github.com/pah/rapidjson/commit/7475a969
2014-06-20 16:18:08 +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
23056abad1 Added #include <new> for placement new operator.
git-svn-id: https://rapidjson.googlecode.com/svn/trunk@105 c5894555-1306-4e8d-425f-1f6f381ee07c
2012-11-16 14:33:03 +00:00
miloyip@gmail.com
5136516293 Remove warnings in examples
git-svn-id: https://rapidjson.googlecode.com/svn/trunk@95 c5894555-1306-4e8d-425f-1f6f381ee07c
2012-11-16 13:02:05 +00: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
90f983ced2 Fixed Issue 46: old style cast to 'void*' casts away const in document.h
git-svn-id: https://rapidjson.googlecode.com/svn/trunk@88 c5894555-1306-4e8d-425f-1f6f381ee07c
2012-11-15 03:46:14 +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
b7d12d8ab5 Fixed Issue 48: incorrect return type of GetUint64()
git-svn-id: https://rapidjson.googlecode.com/svn/trunk@86 c5894555-1306-4e8d-425f-1f6f381ee07c
2012-11-15 03:01:17 +00:00
miloyip@gmail.com
7606d05fed Fixed Issue 45: const Value cannot be stringify
git-svn-id: https://rapidjson.googlecode.com/svn/trunk@84 c5894555-1306-4e8d-425f-1f6f381ee07c
2012-11-14 07:14:46 +00:00
miloyip@gmail.com
9b960b6b0a Fixed Issue 7: GenericValue& operator[](const Ch* name) - bug if key not found
Makes GenericValue::FindMember() public.
Added array element and object member iteration APIs in examples.

git-svn-id: https://rapidjson.googlecode.com/svn/trunk@83 c5894555-1306-4e8d-425f-1f6f381ee07c
2012-11-14 07:07:06 +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
94d05da2bc Fixed Issue 28: Parameter ‘inArray’ shadows a member of 'Level' in writer.h
git-svn-id: https://rapidjson.googlecode.com/svn/trunk@78 c5894555-1306-4e8d-425f-1f6f381ee07c
2012-11-14 02:58:16 +00:00
miloyip@gmail.com
790b7f127c Fixed Issue 27 Default allocator is used for GenericReader in GenericDocument::ParseStream
git-svn-id: https://rapidjson.googlecode.com/svn/trunk@77 c5894555-1306-4e8d-425f-1f6f381ee07c
2012-11-14 02:53:04 +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
22ddf37cf0 Fixed issue 30
git-svn-id: https://rapidjson.googlecode.com/svn/trunk@70 c5894555-1306-4e8d-425f-1f6f381ee07c
2012-11-13 09:46:54 +00:00
miloyip@gmail.com
e5562a5757 Fixed a mistake of r67
git-svn-id: https://rapidjson.googlecode.com/svn/trunk@69 c5894555-1306-4e8d-425f-1f6f381ee07c
2012-11-13 09:46:31 +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
8668aebf66 Fixed issue 17 from 0.1x branch
git-svn-id: https://rapidjson.googlecode.com/svn/trunk@59 c5894555-1306-4e8d-425f-1f6f381ee07c
2012-02-28 06:07:32 +00:00
miloyip@gmail.com
c008d5176b Fixed several issues (10, 11, 13, 14) from 0.1x branch
git-svn-id: https://rapidjson.googlecode.com/svn/trunk@57 c5894555-1306-4e8d-425f-1f6f381ee07c
2012-02-19 15:42:58 +00:00
miloyip@gmail.com
bedeb0d8ea Fixed issue 6: range check bug
git-svn-id: https://rapidjson.googlecode.com/svn/trunk@51 c5894555-1306-4e8d-425f-1f6f381ee07c
2011-12-06 04:28:36 +00:00
miloyip@gmail.com
bf8fcd19c1 Added prettyauto example, which can handle UTF-8/UTF-16LE/UTF-16BE/UTF-32LE/UTF-32BE
Fixed a bug for using Reader with AutoUTFInputStream 

git-svn-id: https://rapidjson.googlecode.com/svn/trunk@50 c5894555-1306-4e8d-425f-1f6f381ee07c
2011-12-03 11:14:39 +00:00
miloyip@gmail.com
7c914a9d4c Added RAPIDJSON_STATIC_ASSERT() and applied it to check size of character types in encodings.
Modified API documentation to previous changes.
Rename Stream to InputStream/OutputStream/InputByteStream/OutputByteStream, and stream to is/os according to the context.


git-svn-id: https://rapidjson.googlecode.com/svn/trunk@49 c5894555-1306-4e8d-425f-1f6f381ee07c
2011-12-03 09:57:17 +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