From ee1208aa60e7427bcd298e55f07ed3705b0de50a Mon Sep 17 00:00:00 2001 From: Daniel Albuschat Date: Wed, 17 Nov 2021 19:21:54 +0100 Subject: [PATCH 1/3] Docs: Update `skip_comments` to `ignore_comments` (#3145) In the docs, the `ignore_comments` parameter to `nlohmann::json::parse()` is described as `skip_comments`, which does not match the actual implementation. While the demo code compiles and works, the parameter name is wrong. --- doc/mkdocs/docs/features/comments.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/mkdocs/docs/features/comments.md b/doc/mkdocs/docs/features/comments.md index f82029eee..c5874c9f1 100644 --- a/doc/mkdocs/docs/features/comments.md +++ b/doc/mkdocs/docs/features/comments.md @@ -25,7 +25,7 @@ However, you can pass set parameter `ignore_comments` to `#!c true` in the parse } ``` - When calling `parse` without additional argument, a parse error exception is thrown. If `skip_comments` is set to `#! true`, the comments are skipped during parsing: + When calling `parse` without additional argument, a parse error exception is thrown. If `ignore_comments` is set to `#! true`, the comments are ignored during parsing: ```cpp #include @@ -55,7 +55,7 @@ However, you can pass set parameter `ignore_comments` to `#!c true` in the parse json j = json::parse(s, /* callback */ nullptr, /* allow exceptions */ true, - /* skip_comments */ true); + /* ignore_comments */ true); std::cout << j.dump(2) << '\n'; } ``` @@ -80,4 +80,4 @@ However, you can pass set parameter `ignore_comments` to `#!c true` in the parse "Neptune" ] } - ``` \ No newline at end of file + ``` From 760304635dc74a5bf77903ad92446a6febb85acf Mon Sep 17 00:00:00 2001 From: Prince Mendiratta Date: Thu, 18 Nov 2021 16:28:49 +0530 Subject: [PATCH 2/3] Fix FAQ hyperlink typo in readme (#3148) Signed-off-by: Prince Mendiratta --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a6b23ba74..b08e3400d 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ - [Design goals](#design-goals) - [Sponsors](#sponsors) -- [Support](#support) ([documentation](https://json.nlohmann.me), [FAQ](http://127.0.0.1:8000/home/faq/), [discussions](https://github.com/nlohmann/json/discussions), [API](https://json.nlohmann.me/api/basic_json/), [bug issues](https://github.com/nlohmann/json/issues)) +- [Support](#support) ([documentation](https://json.nlohmann.me), [FAQ](https://json.nlohmann.me/home/faq/), [discussions](https://github.com/nlohmann/json/discussions), [API](https://json.nlohmann.me/api/basic_json/), [bug issues](https://github.com/nlohmann/json/issues)) - [Examples](#examples) - [JSON as first-class data type](#json-as-first-class-data-type) - [Serialization / Deserialization](#serialization--deserialization) From 825d3230d1f31448be906d3242cad9c3e4044733 Mon Sep 17 00:00:00 2001 From: Maarten Becker Date: Fri, 17 Dec 2021 07:24:59 +0100 Subject: [PATCH 3/3] Fix: Warning for shadowed variables (#3188) (#3193) * Rename variable count to resolve shadowing (#3188) * Amalgamate: Rename variable count to resolve shadowing (#3188) Co-authored-by: Maarten Becker --- include/nlohmann/json.hpp | 6 +++--- single_include/nlohmann/json.hpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index 7ea86c38c..16c9353ca 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -1278,15 +1278,15 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec #endif } - iterator set_parents(iterator it, typename iterator::difference_type count) + iterator set_parents(iterator it, typename iterator::difference_type count_set_parents) { #if JSON_DIAGNOSTICS - for (typename iterator::difference_type i = 0; i < count; ++i) + for (typename iterator::difference_type i = 0; i < count_set_parents; ++i) { (it + i)->m_parent = this; } #else - static_cast(count); + static_cast(count_set_parents); #endif return it; } diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 580097630..5dce1b1de 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -18818,15 +18818,15 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec #endif } - iterator set_parents(iterator it, typename iterator::difference_type count) + iterator set_parents(iterator it, typename iterator::difference_type count_set_parents) { #if JSON_DIAGNOSTICS - for (typename iterator::difference_type i = 0; i < count; ++i) + for (typename iterator::difference_type i = 0; i < count_set_parents; ++i) { (it + i)->m_parent = this; } #else - static_cast(count); + static_cast(count_set_parents); #endif return it; }