From 89bd5d63e19dd315edc4924bc4b4cecb8664a7d7 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Thu, 22 Oct 2026 13:27:54 +0200 Subject: [PATCH] Rename names that Flawfinder takes for the file function open() The comparison cursors' open() is now enter(), and a test's open and close strings are head and tail. Signed-off-by: Niels Lohmann --- include/nlohmann/detail/view/compare.hpp | 8 ++++---- single_include/nlohmann/json_view.hpp | 8 ++++---- tests/src/unit-json_view_dump.cpp | 14 +++++++------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/nlohmann/detail/view/compare.hpp b/include/nlohmann/detail/view/compare.hpp index 626f90238..532c05f6e 100644 --- a/include/nlohmann/detail/view/compare.hpp +++ b/include/nlohmann/detail/view/compare.hpp @@ -357,7 +357,7 @@ class view_side } /// start at the first element of this array - void open(cursor& c) const noexcept + void enter(cursor& c) const noexcept { c.pos = nav::first(*m_view.m_doc, m_view.m_node); } @@ -466,7 +466,7 @@ class json_side return *m_json; } - void open(cursor& c) const + void enter(cursor& c) const { c.it = m_json->cbegin(); } @@ -967,8 +967,8 @@ bool equal(const A& a0, const B& b0) { f.array_a = a; f.array_b = b; - a.open(f.cursor_a); - b.open(f.cursor_b); + a.enter(f.cursor_a); + b.enter(f.cursor_b); f.count = a.size(); resume_array(path, a, b, f.cursor_a, f.cursor_b, f.next); } diff --git a/single_include/nlohmann/json_view.hpp b/single_include/nlohmann/json_view.hpp index cc9fe4ae1..c497f3d7b 100644 --- a/single_include/nlohmann/json_view.hpp +++ b/single_include/nlohmann/json_view.hpp @@ -3045,7 +3045,7 @@ class view_side } /// start at the first element of this array - void open(cursor& c) const noexcept + void enter(cursor& c) const noexcept { c.pos = nav::first(*m_view.m_doc, m_view.m_node); } @@ -3154,7 +3154,7 @@ class json_side return *m_json; } - void open(cursor& c) const + void enter(cursor& c) const { c.it = m_json->cbegin(); } @@ -3655,8 +3655,8 @@ bool equal(const A& a0, const B& b0) { f.array_a = a; f.array_b = b; - a.open(f.cursor_a); - b.open(f.cursor_b); + a.enter(f.cursor_a); + b.enter(f.cursor_b); f.count = a.size(); resume_array(path, a, b, f.cursor_a, f.cursor_b, f.next); } diff --git a/tests/src/unit-json_view_dump.cpp b/tests/src/unit-json_view_dump.cpp index 13d2ac14f..6776b951d 100644 --- a/tests/src/unit-json_view_dump.cpp +++ b/tests/src/unit-json_view_dump.cpp @@ -421,17 +421,17 @@ TEST_CASE("json_view comparison") }) { CAPTURE(depth) - std::string open; - std::string close; + std::string head; + std::string tail; for (int i = 0; i < depth; ++i) { - open += i % 2 == 0 ? R"({"k":[1,"s",{"x":true},)" : R"([null,2.5,{"y":)"; - close = (i % 2 == 0 ? "]}" : "}]") + close; + head += i % 2 == 0 ? R"({"k":[1,"s",{"x":true},)" : R"([null,2.5,{"y":)"; + tail = (i % 2 == 0 ? "]}" : "}]") + tail; } // the same text, one number changed, and one number written differently - const std::string text = open + "7" + close; - const std::string changed = open + "8" + close; - const std::string spelled = open + "7.0" + close; + const std::string text = head + "7" + tail; + const std::string changed = head + "8" + tail; + const std::string spelled = head + "7.0" + tail; const json_document a = json_document::parse(text); const json_document b = json_document::parse(text); const json_document c = json_document::parse(changed);