From 60dbf8763238bca866f221c55b0688a4219825a5 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Wed, 11 Nov 2026 18:52:17 +0100 Subject: [PATCH] docs: add version-history notes for fixed start_pos and error positions Two bugs of 3.12.0 are fixed on develop without a note on the pages. With JSON_DIAGNOSTIC_POSITIONS, start_pos() of a string that contains escape sequences was too large; the position is now that of the opening quote. A parse error for an unexpected number that is followed by a line feed reported column 0 (for "1 2" and a line feed, line 1, column 0); for "1", line feed, "2", line feed it now reports line 2, column 1. Signed-off-by: Niels Lohmann --- docs/mkdocs/docs/api/basic_json/parse.md | 4 ++++ docs/mkdocs/docs/api/basic_json/start_pos.md | 4 ++++ docs/mkdocs/docs/api/macros/json_diagnostic_positions.md | 2 ++ 3 files changed, 10 insertions(+) diff --git a/docs/mkdocs/docs/api/basic_json/parse.md b/docs/mkdocs/docs/api/basic_json/parse.md index 1ec40217c..917c86a1e 100644 --- a/docs/mkdocs/docs/api/basic_json/parse.md +++ b/docs/mkdocs/docs/api/basic_json/parse.md @@ -313,6 +313,10 @@ outside of a string, invalid) byte; see the [FAQ entry](../../home/faq.md#nul-by it as end of input; planned to become the default in version 4.0.0. - Extended empty-input detection to also cover an `std::istream` without a stream buffer, and fixed a crash (`std::terminate`) when parsing from an `std::istream` with `eofbit` in its exception mask, in version 3.13.0. +- Fixed the position that a [`parse_error.101`](../../home/exceptions.md#jsonexceptionparse_error101) reports for an + unexpected number that is followed by a line feed in version 3.13.0: for the input `1`, line feed, `2`, line feed, + version 3.12.0 reported "line 2, column 0" and version 3.13.0 reports "line 2, column 1"; for `1 2` and a line feed, + the report was "line 1, column 0" and is now "line 1, column 3". - Parsing from an `std::istream` scans the characters in its stream buffer in bulk in version 3.13.0 ([`JSON_DISABLE_STREAM_BULK_SCAN`](../macros/json_disable_stream_bulk_scan.md) restores reading one character at a time). diff --git a/docs/mkdocs/docs/api/basic_json/start_pos.md b/docs/mkdocs/docs/api/basic_json/start_pos.md index fb43fb52b..68fabbec8 100644 --- a/docs/mkdocs/docs/api/basic_json/start_pos.md +++ b/docs/mkdocs/docs/api/basic_json/start_pos.md @@ -67,3 +67,7 @@ Constant. ## Version history - Added in version 3.12.0. +- Fixed in version 3.13.0: in version 3.12.0, the start position of a string that contains escape sequences (for + example `#!cpp "\n"` or `#!cpp "\u00e4"`) was too large, by the number of bytes the escape sequences add to the + source text. The position is now always that of the opening `"`. The "(bytes a-b)" range in the messages of + [`JSON_DIAGNOSTICS`](../macros/json_diagnostics.md) was wrong in the same way. diff --git a/docs/mkdocs/docs/api/macros/json_diagnostic_positions.md b/docs/mkdocs/docs/api/macros/json_diagnostic_positions.md index 340498acb..4358a373a 100644 --- a/docs/mkdocs/docs/api/macros/json_diagnostic_positions.md +++ b/docs/mkdocs/docs/api/macros/json_diagnostic_positions.md @@ -125,3 +125,5 @@ When the macro is not defined, the library will define it to its default value. ## Version history - Added in version 3.12.0. +- Fixed in version 3.13.0: in version 3.12.0, [`start_pos()`](../basic_json/start_pos.md) of a string that contains + escape sequences was too large; it is now the position of the opening `"`.