diff --git a/backport-Fix-missing-token-enum-name.patch b/backport-Fix-missing-token-enum-name.patch new file mode 100644 index 0000000000000000000000000000000000000000..6986df1a9083727a30ab6848c4237f5153fad3bc --- /dev/null +++ b/backport-Fix-missing-token-enum-name.patch @@ -0,0 +1,23 @@ +From 84459a7f982ea4d10e943237b2e9c71afdab6a45 Mon Sep 17 00:00:00 2001 +From: Simon Gene Gottlieb +Date: Thu, 22 Aug 2024 12:13:35 +0200 +Subject: [PATCH] fix: missing token enum name + +--- + src/token.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/token.h b/src/token.h +index 1134af024..ebd8477c6 100644 +--- a/src/token.h ++++ b/src/token.h +@@ -18,7 +18,8 @@ constexpr const char* TokenNames[] = { + "BLOCK_MAP_START", "BLOCK_SEQ_END", "BLOCK_MAP_END", "BLOCK_ENTRY", + "FLOW_SEQ_START", "FLOW_MAP_START", "FLOW_SEQ_END", "FLOW_MAP_END", + "FLOW_MAP_COMPACT", "FLOW_ENTRY", "KEY", "VALUE", +- "ANCHOR", "ALIAS", "TAG", "SCALAR"}; ++ "ANCHOR", "ALIAS", "TAG", "SCALAR", ++ "NON_PLAIN_SCALAR"}; + + struct Token { + // enums diff --git a/backport-Fix-reference-types-in-iterators.patch b/backport-Fix-reference-types-in-iterators.patch new file mode 100644 index 0000000000000000000000000000000000000000..2e37225b5678ead462b16ed92a91d7231695a964 --- /dev/null +++ b/backport-Fix-reference-types-in-iterators.patch @@ -0,0 +1,36 @@ +From 850ec4f39e1c4a3a950e01e58329ffeb970769d8 Mon Sep 17 00:00:00 2001 +From: Orgad Shaneh +Date: Wed, 11 Nov 2020 18:51:46 +0200 +Subject: [PATCH] Fix reference types in iterators + +Amends 26faac387c237ccac75a56925c6858baf8ccda1b. +--- + include/yaml-cpp/node/detail/iterator.h | 2 +- + include/yaml-cpp/node/detail/node_iterator.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/yaml-cpp/node/detail/iterator.h b/include/yaml-cpp/node/detail/iterator.h +index 997c69a14..04d2da4fc 100644 +--- a/include/yaml-cpp/node/detail/iterator.h ++++ b/include/yaml-cpp/node/detail/iterator.h +@@ -41,7 +41,7 @@ class iterator_base { + using value_type = V; + using difference_type = std::ptrdiff_t; + using pointer = V*; +- using reference = V; ++ using reference = V&; + + public: + iterator_base() : m_iterator(), m_pMemory() {} +diff --git a/include/yaml-cpp/node/detail/node_iterator.h b/include/yaml-cpp/node/detail/node_iterator.h +index 49dcf958d..6eb4ddc13 100644 +--- a/include/yaml-cpp/node/detail/node_iterator.h ++++ b/include/yaml-cpp/node/detail/node_iterator.h +@@ -69,7 +69,7 @@ class node_iterator_base { + using value_type = node_iterator_value; + using difference_type = std::ptrdiff_t; + using pointer = node_iterator_value*; +- using reference = node_iterator_value; ++ using reference = node_iterator_value&; + using SeqIter = typename node_iterator_type::seq; + using MapIter = typename node_iterator_type::map; diff --git a/backport-fix-parse-files-with-r-symbols-as-line-ending-correctly.patch b/backport-fix-parse-files-with-r-symbols-as-line-ending-correctly.patch new file mode 100644 index 0000000000000000000000000000000000000000..bb3b1d8a6c1c06c389182b3c4739de6cc646f6f8 --- /dev/null +++ b/backport-fix-parse-files-with-r-symbols-as-line-ending-correctly.patch @@ -0,0 +1,79 @@ +From ee9c4d19bedd660734125afed7ef6cf1822ea196 Mon Sep 17 00:00:00 2001 +From: Simon Gene Gottlieb +Date: Thu, 22 Aug 2024 10:29:29 +0200 +Subject: [PATCH] fix: parse files with '\r' symbols as line ending correctly + +--- + src/stream.cpp | 19 ++++++++++++++++++- + src/stream.h | 1 + + test/integration/load_node_test.cpp | 16 ++++++++++++++++ + 3 files changed, 35 insertions(+), 1 deletion(-) + +diff --git a/src/stream.cpp b/src/stream.cpp +index b1aa092f6..72f0ec0ae 100644 +--- a/src/stream.cpp ++++ b/src/stream.cpp +@@ -262,7 +262,24 @@ char Stream::get() { + AdvanceCurrent(); + m_mark.column++; + +- if (ch == '\n') { ++ // if line ending symbol is unknown, set it to the first ++ // encountered line ending. ++ // if line ending '\r' set ending symbol to '\r' ++ // other wise set it to '\n' ++ if (!m_lineEndingSymbol) { ++ if (ch == '\n') { // line ending is '\n' ++ m_lineEndingSymbol = '\n'; ++ } else if (ch == '\r') { ++ auto ch2 = peek(); ++ if (ch2 == '\n') { // line ending is '\r\n' ++ m_lineEndingSymbol = '\n'; ++ } else { // line ending is '\r' ++ m_lineEndingSymbol = '\r'; ++ } ++ } ++ } ++ ++ if (ch == m_lineEndingSymbol) { + m_mark.column = 0; + m_mark.line++; + } +diff --git a/src/stream.h b/src/stream.h +index 2bc7a1521..214104ade 100644 +--- a/src/stream.h ++++ b/src/stream.h +@@ -53,6 +53,7 @@ class Stream { + Mark m_mark; + + CharacterSet m_charSet; ++ char m_lineEndingSymbol{}; // 0 means it is not determined yet, must be '\n' or '\r' + mutable std::deque m_readahead; + unsigned char* const m_pPrefetched; + mutable size_t m_nPrefetchedAvailable; +diff --git a/test/integration/load_node_test.cpp b/test/integration/load_node_test.cpp +index 9d0c790fd..1cc84a45a 100644 +--- a/test/integration/load_node_test.cpp ++++ b/test/integration/load_node_test.cpp +@@ -360,5 +360,21 @@ TEST(LoadNodeTest, BlockCRNLEncoded) { + EXPECT_EQ(1, node["followup"].as()); + } + ++TEST(LoadNodeTest, BlockCREncoded) { ++ Node node = Load( ++ "blockText: |\r" ++ " some arbitrary text \r" ++ " spanning some \r" ++ " lines, that are split \r" ++ " by CR and NL\r" ++ "followup: 1"); ++ EXPECT_EQ( ++ "some arbitrary text \nspanning some \nlines, that are split \nby CR and " ++ "NL\n", ++ node["blockText"].as()); ++ EXPECT_EQ(1, node["followup"].as()); ++} ++ ++ + } // namespace + } // namespace YAML diff --git a/backport-remove-build-debug-messages.patch b/backport-remove-build-debug-messages.patch new file mode 100644 index 0000000000000000000000000000000000000000..d681002e1234c4f95472d3416df9ab22b1a3524f --- /dev/null +++ b/backport-remove-build-debug-messages.patch @@ -0,0 +1,27 @@ +From 47cd2725d61e54719933b83ea51c64ad60c24066 Mon Sep 17 00:00:00 2001 +From: Orgad Shaneh +Date: Tue, 27 Aug 2024 18:42:15 +0300 +Subject: [PATCH] Remove build debug messages + +They were commented out before 0733aeb45, but when that commit +was reverted in 2b65c65e1 they were recovered uncommented. +--- + include/yaml-cpp/dll.h | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/include/yaml-cpp/dll.h b/include/yaml-cpp/dll.h +index eabdda1d9..4e55ab8c2 100644 +--- a/include/yaml-cpp/dll.h ++++ b/include/yaml-cpp/dll.h +@@ -15,11 +15,9 @@ + # ifndef YAML_CPP_API + # ifdef yaml_cpp_EXPORTS + /* We are building this library */ +-# pragma message( "Defining YAML_CPP_API for DLL export" ) + # define YAML_CPP_API __declspec(dllexport) + # else + /* We are using this library */ +-# pragma message( "Defining YAML_CPP_API for DLL import" ) + # define YAML_CPP_API __declspec(dllimport) + # endif + # endif diff --git a/yaml-cpp.spec b/yaml-cpp.spec index f9e6408e0a91c94496ebf0d68f30c278b391b979..515d565ad59f68f731a5c94a20513b5880d5f28e 100755 --- a/yaml-cpp.spec +++ b/yaml-cpp.spec @@ -1,11 +1,16 @@ Name: yaml-cpp Version: 0.8.0 -Release: 2 +Release: 3 Summary: A YAML parser and emitter in C++. License: MIT URL: https://github.com/jbeder/yaml-cpp Source0: https://github.com/jbeder/yaml-cpp/archive/%{version}/%{name}-%{version}.tar.gz Patch6001: backport-Specify-CMake-policy-range-to-avoid-deprecation-warning.patch +Patch6002: backport-fix-parse-files-with-r-symbols-as-line-ending-correctly.patch +Patch6003: backport-Fix-missing-token-enum-name.patch +Patch6004: backport-Fix-reference-types-in-iterators.patch +Patch6005: backport-remove-build-debug-messages.patch + BuildRequires: cmake >= 3.4 gcc gcc-c++ %description @@ -66,6 +71,12 @@ mv %{buildroot}%{_libdir}/pkgconfig/%{name}.pc \ %{_libdir}/pkgconfig/*.pc %changelog +* Mon Jul 28 2025 liuzhilin - 0.8.0-3 +- fix: parse files with '\r' symbols as line ending correctly +- fix: missing token enum name +- Fix reference types in iterators +- Remove build debug messages + * Tue Mar 04 2025 Funda Wang - 0.8.0-2 - add upstream patch to build with cmake 4.0