From b14629b0a61bf8a5a8969d7d3d07d7ef900ff9f8 Mon Sep 17 00:00:00 2001 From: Berkus Decker Date: Thu, 23 Mar 2017 14:50:41 +0200 Subject: [PATCH 1/3] Fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4677db56a..4bf678efa 100644 --- a/README.md +++ b/README.md @@ -880,7 +880,7 @@ The library is currently used in Apple macOS Sierra and iOS 10. I am not sure wh - Invalid surrogates (e.g., incomplete pairs such as `\uDEAD`) will yield parse errors. - The strings stored in the library are UTF-8 encoded. When using the default string type (`std::string`), note that its length/size functions return the number of stored bytes rather than the number of characters or glyphs. - The code can be compiled without C++ **runtime type identification** features; that is, you can use the `-fno-rtti` compiler flag. -- **Exceptions** are used widly within the library. They can, however, be switched off with either using the compiler flag `-fno-exceptions` or by defining the symbol `JSON_NOEXCEPTION`. In this case, exceptions are replaced by an `abort()` call. +- **Exceptions** are used widely within the library. They can, however, be switched off with either using the compiler flag `-fno-exceptions` or by defining the symbol `JSON_NOEXCEPTION`. In this case, exceptions are replaced by an `abort()` call. - By default, the library does not preserve the **insertion order of object elements**. This is standards-compliant, as the [JSON standard](https://tools.ietf.org/html/rfc7159.html) defines objects as "an unordered collection of zero or more name/value pairs". If you do want to preserve the insertion order, you can specialize the object type with containers like [`tsl::ordered_map`](https://github.com/Tessil/ordered-map) or [`nlohmann::fifo_map`](https://github.com/nlohmann/fifo_map). From cea242673168a4435cbbd987acae4e1c8f627bac Mon Sep 17 00:00:00 2001 From: Ted Lyngmo Date: Fri, 24 Mar 2017 14:56:48 +0100 Subject: [PATCH 2/3] UTF8 encoding enhancement --- src/json.hpp | 6 +++--- src/json.hpp.re2c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/json.hpp b/src/json.hpp index 1ccbfa613..6ec045aaa 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -10344,20 +10344,20 @@ class basic_json else if (codepoint <= 0x7ff) { // 2-byte characters: 110xxxxx 10xxxxxx - result.append(1, static_cast(0xC0 | ((codepoint >> 6) & 0x1F))); + result.append(1, static_cast(0xC0 | (codepoint >> 6))); result.append(1, static_cast(0x80 | (codepoint & 0x3F))); } else if (codepoint <= 0xffff) { // 3-byte characters: 1110xxxx 10xxxxxx 10xxxxxx - result.append(1, static_cast(0xE0 | ((codepoint >> 12) & 0x0F))); + result.append(1, static_cast(0xE0 | (codepoint >> 12))); result.append(1, static_cast(0x80 | ((codepoint >> 6) & 0x3F))); result.append(1, static_cast(0x80 | (codepoint & 0x3F))); } else if (codepoint <= 0x10ffff) { // 4-byte characters: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - result.append(1, static_cast(0xF0 | ((codepoint >> 18) & 0x07))); + result.append(1, static_cast(0xF0 | (codepoint >> 18))); result.append(1, static_cast(0x80 | ((codepoint >> 12) & 0x3F))); result.append(1, static_cast(0x80 | ((codepoint >> 6) & 0x3F))); result.append(1, static_cast(0x80 | (codepoint & 0x3F))); diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index 6a1e09e31..7d21f76bb 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -10344,20 +10344,20 @@ class basic_json else if (codepoint <= 0x7ff) { // 2-byte characters: 110xxxxx 10xxxxxx - result.append(1, static_cast(0xC0 | ((codepoint >> 6) & 0x1F))); + result.append(1, static_cast(0xC0 | (codepoint >> 6))); result.append(1, static_cast(0x80 | (codepoint & 0x3F))); } else if (codepoint <= 0xffff) { // 3-byte characters: 1110xxxx 10xxxxxx 10xxxxxx - result.append(1, static_cast(0xE0 | ((codepoint >> 12) & 0x0F))); + result.append(1, static_cast(0xE0 | (codepoint >> 12))); result.append(1, static_cast(0x80 | ((codepoint >> 6) & 0x3F))); result.append(1, static_cast(0x80 | (codepoint & 0x3F))); } else if (codepoint <= 0x10ffff) { // 4-byte characters: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - result.append(1, static_cast(0xF0 | ((codepoint >> 18) & 0x07))); + result.append(1, static_cast(0xF0 | (codepoint >> 18))); result.append(1, static_cast(0x80 | ((codepoint >> 12) & 0x3F))); result.append(1, static_cast(0x80 | ((codepoint >> 6) & 0x3F))); result.append(1, static_cast(0x80 | (codepoint & 0x3F))); From 3d597dda5d9fc758fd3d1aeb0ba19ef03625dfec Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Fri, 24 Mar 2017 19:51:11 +0100 Subject: [PATCH 3/3] :memo: update after #534 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4bf678efa..3d9123052 100644 --- a/README.md +++ b/README.md @@ -828,7 +828,7 @@ I deeply appreciate the help of the following people. - [rswanson-ihi](https://github.com/rswanson-ihi) noted a typo in the README. - [Mihai Stan](https://github.com/stanmihai4) fixed a bug in the comparison with `nullptr`s. - [Tushar Maheshwari](https://github.com/tusharpm) added [cotire](https://github.com/sakra/cotire) support to speed up the compilation. -- [TedLyngmo](https://github.com/TedLyngmo) noted a typo in the README and fixed some `-Weffc++` warnings. +- [TedLyngmo](https://github.com/TedLyngmo) noted a typo in the README, removed unnecessary bit arithmetic, and fixed some `-Weffc++` warnings. - [Krzysztof Woś](https://github.com/krzysztofwos) made exceptions more visible. - [ftillier](https://github.com/ftillier) fixed a compiler warning.