From 8cfb4897ecc1b27e9339623765759a1fe4efc83d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 6 Jul 2025 22:53:13 +0200 Subject: [PATCH] Report 1-based positions in wxFileConfig warning message 0-based positions are probably not what the users expect. --- src/common/fileconf.cpp | 2 +- tests/config/fileconf.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index ac4db7714f..76afbc6762 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -2151,7 +2151,7 @@ static wxString FilterInValue(const wxString& str) else if ( i != end - 1 ) { wxLogWarning(_("unexpected \" at position %zu in '%s'."), - i - str.begin(), str); + i - str.begin() + 1, str); } //else: it's the last quote of a quoted string, ok } diff --git a/tests/config/fileconf.cpp b/tests/config/fileconf.cpp index 9b8ddda162..728431daf5 100644 --- a/tests/config/fileconf.cpp +++ b/tests/config/fileconf.cpp @@ -657,7 +657,7 @@ TEST_CASE_METHOD(LogTestCase, "wxFileConfig::Error", "[fileconfig][error]") checkWarning("foo=\\", "trailing backslash"); // Check that it's the second quote which is unexpected, not the first one. - checkWarning(R"(foo="x"y)", R"(unexpected " at position 2)"); + checkWarning(R"(foo="x"y)", R"(unexpected " at position 3)"); } #endif // wxUSE_FILECONFIG