Skip to content

Commit b1e556d

Browse files
authored
Merge branch 'master' into violationDetails
2 parents 8c182e5 + 03f5de9 commit b1e556d

33 files changed

+1051
-66
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ Doxyfile
2323
Doxyfile.zh-cn
2424
DartConfiguration.tcl
2525
*.nupkg
26+
27+
# Files created by OS
28+
*.DS_Store

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
140140
* Redo all documentation (English, Simplified Chinese)
141141

142142
### Changed
143-
* Copyright ownership transfered to THL A29 Limited (a Tencent company).
143+
* Copyright ownership transferred to THL A29 Limited (a Tencent company).
144144
* Migrating from Premake to CMAKE (#192)
145145
* Resolve all warning reports
146146

CMakeLists.txt

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ option(RAPIDJSON_BUILD_CXX11 "Build rapidjson with C++11 (gcc/clang)" ON)
3535
option(RAPIDJSON_BUILD_ASAN "Build rapidjson with address sanitizer (gcc/clang)" OFF)
3636
option(RAPIDJSON_BUILD_UBSAN "Build rapidjson with undefined behavior sanitizer (gcc/clang)" OFF)
3737

38+
option(RAPIDJSON_ENABLE_INSTRUMENTATION_OPT "Build rapidjson with -march or -mcpu options" ON)
39+
3840
option(RAPIDJSON_HAS_STDSTRING "" OFF)
3941
if(RAPIDJSON_HAS_STDSTRING)
4042
add_definitions(-DRAPIDJSON_HAS_STDSTRING)
@@ -50,11 +52,13 @@ if(CCACHE_FOUND)
5052
endif(CCACHE_FOUND)
5153

5254
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
53-
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "powerpc" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "ppc64" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "ppc64le")
54-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=native")
55-
else()
56-
#FIXME: x86 is -march=native, but doesn't mean every arch is this option. To keep original project's compatibility, I leave this except POWER.
57-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
55+
if(${RAPIDJSON_ENABLE_INSTRUMENTATION_OPT})
56+
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "powerpc" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "ppc64" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "ppc64le")
57+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=native")
58+
else()
59+
#FIXME: x86 is -march=native, but doesn't mean every arch is this option. To keep original project's compatibility, I leave this except POWER.
60+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
61+
endif()
5862
endif()
5963
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror")
6064
set(EXTRA_CXX_FLAGS -Weffc++ -Wswitch-default -Wfloat-equal -Wconversion -Wsign-conversion)
@@ -181,6 +185,8 @@ EXPORT( PACKAGE ${PROJECT_NAME} )
181185
# ... for the build tree
182186
SET( CONFIG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
183187
SET( CONFIG_DIR ${CMAKE_CURRENT_BINARY_DIR})
188+
SET( ${PROJECT_NAME}_INCLUDE_DIR "\${${PROJECT_NAME}_SOURCE_DIR}/include" )
189+
184190
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}Config.cmake.in
185191
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake @ONLY )
186192
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}ConfigVersion.cmake.in

bin/jsonschema/remotes/.DS_Store

-6 KB
Binary file not shown.

bin/jsonschema/tests/.DS_Store

-6 KB
Binary file not shown.

bin/jsonschema/tests/draft4/.DS_Store

-6 KB
Binary file not shown.

doc/dom.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ And the `InputStream` is type of input stream.
128128
129129
## Parse Error {#ParseError}
130130
131-
When the parse processing succeeded, the `Document` contains the parse results. When there is an error, the original DOM is *unchanged*. And the error state of parsing can be obtained by `bool HasParseError()`, `ParseErrorCode GetParseError()` and `size_t GetParseOffset()`.
131+
When the parse processing succeeded, the `Document` contains the parse results. When there is an error, the original DOM is *unchanged*. And the error state of parsing can be obtained by `bool HasParseError()`, `ParseErrorCode GetParseError()` and `size_t GetErrorOffset()`.
132132
133133
Parse Error Code | Description
134134
--------------------------------------------|---------------------------------------------------
@@ -241,7 +241,7 @@ Some techniques about using DOM API is discussed here.
241241
242242
## DOM as SAX Event Publisher
243243
244-
In RapidJSON, stringifying a DOM with `Writer` may be look a little bit weired.
244+
In RapidJSON, stringifying a DOM with `Writer` may be look a little bit weird.
245245
246246
~~~~~~~~~~cpp
247247
// ...

doc/dom.zh-cn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ GenericDocument& GenericDocument::Parse(const Ch* str);
128128
129129
## 解析错误 {#ParseError}
130130
131-
当解析过程顺利完成,`Document` 便会含有解析结果。当过程出现错误,原来的 DOM 会*维持不变*。可使用 `bool HasParseError()`、`ParseErrorCode GetParseError()` 及 `size_t GetParseOffset()` 获取解析的错误状态。
131+
当解析过程顺利完成,`Document` 便会含有解析结果。当过程出现错误,原来的 DOM 会*维持不变*。可使用 `bool HasParseError()`、`ParseErrorCode GetParseError()` 及 `size_t GetErrorOffset()` 获取解析的错误状态。
132132
133133
解析错误代号 | 描述
134134
--------------------------------------------|---------------------------------------------------

doc/encoding.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The earlier [RFC4627](http://www.ietf.org/rfc/rfc4627.txt) stated that,
1010
1111
> (in §6) JSON may be represented using UTF-8, UTF-16, or UTF-32. When JSON is written in UTF-8, JSON is 8bit compatible. When JSON is written in UTF-16 or UTF-32, the binary content-transfer-encoding must be used.
1212
13-
RapidJSON supports various encodings. It can also validate the encodings of JSON, and transconding JSON among encodings. All these features are implemented internally, without the need for external libraries (e.g. [ICU](http://site.icu-project.org/)).
13+
RapidJSON supports various encodings. It can also validate the encodings of JSON, and transcoding JSON among encodings. All these features are implemented internally, without the need for external libraries (e.g. [ICU](http://site.icu-project.org/)).
1414

1515
[TOC]
1616

doc/faq.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
~~~~~~~~~~cpp
117117
Value(kObjectType).Swap(d);
118118
~~~~~~~~~~
119-
or equivalent, but sightly longer to type:
119+
or equivalent, but slightly longer to type:
120120
~~~~~~~~~~cpp
121121
d.Swap(Value(kObjectType).Move());
122122
~~~~~~~~~~
@@ -140,11 +140,11 @@
140140
}
141141
~~~~~~~~~~
142142

143-
The most important requirement to take care of document and value life-cycle as well as consistent memory managent using the right allocator during the value transfer.
143+
The most important requirement to take care of document and value life-cycle as well as consistent memory management using the right allocator during the value transfer.
144144

145145
Simple yet most efficient way to achieve that is to modify the `address` definition above to initialize it with allocator of the `person` document, then we just add the root member of the value:
146146
~~~~~~~~~~cpp
147-
Documnet address(person.GetAllocator());
147+
Document address(person.GetAllocator());
148148
...
149149
person["person"].AddMember("address", address["address"], person.GetAllocator());
150150
~~~~~~~~~~
@@ -174,7 +174,7 @@ Alternatively, if we don't want to explicitly refer to the root value of `addres
174174

175175
3. Why do I need to provide the length of string?
176176

177-
Since C string is null-terminated, the length of string needs to be computed via `strlen()`, with linear runtime complexity. This incurs an unncessary overhead of many operations, if the user already knows the length of string.
177+
Since C string is null-terminated, the length of string needs to be computed via `strlen()`, with linear runtime complexity. This incurs an unnecessary overhead of many operations, if the user already knows the length of string.
178178

179179
Also, RapidJSON can handle `\u0000` (null character) within a string. If a string contains null characters, `strlen()` cannot return the true length of it. In such case user must provide the length of string explicitly.
180180

@@ -204,7 +204,7 @@ Alternatively, if we don't want to explicitly refer to the root value of `addres
204204

205205
2. Can it validate the encoding?
206206

207-
Yes, just pass `kParseValidateEncodingFlag` to `Parse()`. If there is invalid encoding in the stream, it wil generate `kParseErrorStringInvalidEncoding` error.
207+
Yes, just pass `kParseValidateEncodingFlag` to `Parse()`. If there is invalid encoding in the stream, it will generate `kParseErrorStringInvalidEncoding` error.
208208

209209
3. What is surrogate pair? Does RapidJSON support it?
210210

@@ -248,7 +248,7 @@ Alternatively, if we don't want to explicitly refer to the root value of `addres
248248

249249
1. Is RapidJSON really fast?
250250

251-
Yes. It may be the fastest open source JSON library. There is a [benchmark](https://github.com/miloyip/nativejson-benchmark) for evaluating performance of C/C++ JSON libaries.
251+
Yes. It may be the fastest open source JSON library. There is a [benchmark](https://github.com/miloyip/nativejson-benchmark) for evaluating performance of C/C++ JSON libraries.
252252

253253
2. Why is it fast?
254254

@@ -262,13 +262,13 @@ Alternatively, if we don't want to explicitly refer to the root value of `addres
262262

263263
The design of RapidJSON aims at reducing memory footprint.
264264

265-
In the SAX API, `Reader` consumes memory portional to maximum depth of JSON tree, plus maximum length of JSON string.
265+
In the SAX API, `Reader` consumes memory proportional to maximum depth of JSON tree, plus maximum length of JSON string.
266266

267267
In the DOM API, each `Value` consumes exactly 16/24 bytes for 32/64-bit architecture respectively. RapidJSON also uses a special memory allocator to minimize overhead of allocations.
268268

269269
5. What is the purpose of being high performance?
270270

271-
Some applications need to process very large JSON files. Some server-side applications need to process huge amount of JSONs. Being high performance can improve both latency and throuput. In a broad sense, it will also save energy.
271+
Some applications need to process very large JSON files. Some server-side applications need to process huge amount of JSONs. Being high performance can improve both latency and throughput. In a broad sense, it will also save energy.
272272

273273
## Gossip
274274

0 commit comments

Comments
 (0)