Commit Graph

409 Commits

Author SHA1 Message Date
IMaloney
1da813f56a ensuring local tags are retained after loading a node + test 2024-12-17 09:20:46 -06:00
Simon Gene Gottlieb
9ce5a25188 fix: spell fix 2024-11-07 15:14:36 -06:00
Simon Gene Gottlieb
ebfbf27115 patch: added more defensive programming techniques 2024-11-07 15:14:36 -06:00
Simon Gene Gottlieb
06ffaf3104 remove reduntant license information 2024-11-07 15:14:36 -06:00
Simon Gene Gottlieb
0b945415fd fix: add missing include 2024-11-07 15:14:36 -06:00
Simon Gene Gottlieb
d8de96524c patch: move dragonbox.h from 'include' folder to 'src' folder 2024-11-07 15:14:36 -06:00
Simon Gene Gottlieb
5d9e4b6251 patch: split fp_to_string.h into fptostring.h and fptostring.cpp 2024-11-07 15:14:36 -06:00
Federico Di Pierro
bc67157109 fix(src): avoid possible infinite loop in LoadAll().
Leave at first empty root.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-10-29 22:21:05 -05:00
Federico Di Pierro
1f2b841949 fix(src,include,test): fixed multiple cases where a bad yaml was accepted.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-13 10:18:41 +02:00
Simon Gene Gottlieb
84459a7f98 fix: missing token enum name 2024-08-22 07:55:33 -05:00
Simon Gene Gottlieb
ee9c4d19be fix: parse files with '\r' symbols as line ending correctly 2024-08-22 07:53:52 -05:00
Christopher Fore
7b469b4220 emitterutils: Explicitly include <cstdint>
GCC 15 will no longer include it by default, resulting in build
failures in projects that do not explicitly include it.

Error:
src/emitterutils.cpp:221:11: error: 'uint16_t' was not declared in this scope
  221 | std::pair<uint16_t, uint16_t> EncodeUTF16SurrogatePair(int codePoint) {
      |           ^~~~~~~~
src/emitterutils.cpp:13:1: note: 'uint16_t' is defined in header '<cstdint>';
this is probably fixable by adding '#include <cstdint>'
   12 | #include "yaml-cpp/null.h"
  +++ |+#include <cstdint>
   13 | #include "yaml-cpp/ostream_wrapper.h"

Tests pass.

Closes: #1307
See-also: https://gcc.gnu.org/pipermail/gcc-cvs/2024-August/407124.html
See-also: https://bugs.gentoo.org/937412
Signed-off-by: Christopher Fore <csfore@posteo.net>
2024-08-18 15:19:15 -05:00
NameSirius
06c3d1db51 fix compile warning(Pull requests #1305)(Issues #1306) 2024-08-06 10:39:36 -05:00
Jesse Beder
04dddd6999 Revert "Fix compile warning with -Wshadow"
This reverts commit 1f5e971f77.

See #1306; the previous commit caused an error with -Wpedantic:

yaml-cpp/include/yaml-cpp/emitterstyle.h:13:2: error: extra ‘;’ [-Wpedantic]

Since the original commit was to resolve warnings, reverting and the OP can produce a new one that fixes this issue.
2024-08-05 15:50:36 -05:00
NameSirius
1f5e971f77 Fix compile warning with -Wshadow 2024-08-05 09:50:21 -05:00
Josiah VanderZee
9f7babc3ff Use c-strings to constant initialize token array
Since `std::string` has to be dynamically constructed and destructed,
it could be accessed before initialization or after destruction in a
multithreaded context. By using constant c-strings instead, we guarantee
that the array will be valid for the whole lifetime of the program. The
use of `constexpr` also enforces this requirement.

I have run clang-format on the file to format my changes according to
CONTRIBUTING.md.
2024-08-01 22:54:57 -05:00
Simon Gene Gottlieb
b95aa146ec fix: use C locale by default 2024-07-17 13:39:30 -05:00
Frank Osterfeld
1d8ca1f35e Avoid static reference to temporary
These caused issues when used in a wasm project.
2024-05-02 09:29:05 -05:00
Alejandro-FA
c67d701ad8 Fix indentation of empty sequences and add test 2024-01-26 12:30:06 -06:00
James Brown
1b50109f7b Include property nodes in the long key check (#1140) 2022-10-04 18:51:53 -05:00
Igor [hyperxor]
c73ee34704 Small perfomance optimization in Directives and Tag methods (#1112) 2022-05-31 18:05:22 -05:00
Igor [hyperxor]
190ad502b5 Remove redundant include (#1110) 2022-05-21 07:20:18 -05:00
Dr. Andre Vehreschild
13626af92a Fix escaping anchors in keys (#1101) 2022-04-21 08:19:51 -05:00
Dr. Andre Vehreschild
4c982d59dc Improve build and fix single cr on windows (#1099) 2022-04-19 12:39:55 -05:00
Dr. Andre Vehreschild
a6db7e32ac Fix single cr not recognized (#1094)
Complies with YAML Standard [5.4](https://yaml.org/spec/1.2.2/#54-line-break-characters) [25] instead of matching `\r` only in combination with `\n`.
2022-03-31 22:16:35 -05:00
TheVice
d8d9419092 Fix shared library tests for Windows (#1074)
Add copying of shared library to the output directory with a test binary.

[binary] removed using of non unsigned char as argument at
'std::isspace' function that was provokes undefined behavior.

[.github/workflows/build.yml] enabled run of test at the
'windows-latest' environment.
2021-12-15 13:38:09 -06:00
Robert Sebastian Herlim
2f8997565b Use static_cast<unsigned char> on DecodeBase64 to prevent SEGV on negative values (#1051) 2021-10-20 10:18:08 -05:00
Pino Toscano
0733aeb451 Revert "Revert "Hide most of non-public symbols by default (#984)" (#1038)" (#1045) 2021-10-09 21:48:05 -05:00
Jesse Beder
0d9dbcfe8c Revert "Hide most of non-public symbols by default (#984)" (#1038)
This reverts commit da1c8d360e. and fixes #1036.
2021-09-28 08:41:55 -05:00
Pino Toscano
da1c8d360e Hide most of non-public symbols by default (#984)
* Export YAML::detail::node::m_amount

The internal header node/detail/node.h is included by public headers;
YAML::detail::node is implemented in the header itself, and thus it gets
inlined... except for its static m_amount class member, which is
instantiated in the library only. Right now all the symbols of yaml-cpp
are exported (nothing is hidden), so the linker will find node::m_amount
in the yaml-cpp library.

As solution/workaround, explicitly export YAML::detail::node::m_amount.

* CMake: use GenerateExportHeader

Make use of the GenerateExportHeader CMake module to generate the dll.h
header with export macros.

While the produced dll.h is different, the result should be the same,
i.e. nothing changes for yaml-cpp or its users.

* CMake: hide all the symbols by default

Hide all the symbols that are not explicitly exported with YAML_CPP_API.
This way the ABI will be way smaller, and only actually exposing the
public classes/functions.
2021-09-25 12:10:58 -05:00
Snow Pettersen
db6deedcd3 Include name of anchor in invalid anchor error (#1015) 2021-07-23 14:52:21 -05:00
theamarin
9ee3928754 Prevent trailing spaces when emitting literal strings (#1005) 2021-07-04 22:30:04 -05:00
Chen
98acc5a887 Emit the correct Alias on the key (#908) (#929) 2020-07-27 13:49:04 -05:00
Chen
1c9abc8fa4 fix issue743: handle the empty content of flow sep/map correctly during emitting. (#921)
* fix issue743: handle the empty content of flow sep/map correctly during emitting.

* handle the empty Tag/Anchor properly.

* delete comment
2020-07-24 07:28:40 -05:00
Chen
c2793a36d5 Fix runtime exceptions in Visual Studio environment. (#926) 2020-07-23 08:48:20 -05:00
Chen
c3df6d87d4 Properly allow a trailing tab character on a block scalar (#919)
Fixes #917
2020-07-16 10:08:09 -05:00
Chen
51ce663085 Handle a key with length over 1024 as a long key. (#916)
Fixes #501
2020-07-16 09:51:54 -05:00
Oliver Hamlet
c82d3129dd Add support for JSON-compatible string escapes (#485)
For completeness I've implemented escaping for characters outside the
basic multilingual plane, but it doesn't get used (as there's no
EscapeAsAsciiJson emitter option implemented).
2020-07-13 21:16:34 -05:00
Chen
6d5cfab5fd fix bug from issue298:Emitter stylings settings overridden by node settings. (#915) 2020-07-06 08:16:38 -05:00
Chen
026a53fbe1 Parse colon in plain scalar correctly when in a flow collection
Fixes #740.
2020-07-02 14:08:14 -05:00
Raffaello Bertini
1c2e767347 Fix YAML::Newline in a sequence or map.
Inside of a sequence or map, `YAML::Newline` wouldn't reset the collection state, which would cause behavior like this:

```
nodeA:   
    k: [{i: 0},
 {i:1},
  ]NodeB:
    k: [{i: 0},
 {i:1},
  ]
```
2020-07-01 22:31:51 -05:00
Chen
3f381f13a0 remove the wrong swap file. (#907) 2020-06-29 08:19:35 -05:00
Chen
08aa252611 Support kinds of emitter format-setting for YAML::Null. (#906)
* Support kinds of emitter format-setting for YAML::Null.

* update the code and test cases

* add the comment //fallthrough
2020-06-28 23:31:53 -05:00
Chen
5a9ab177ba tag_null (#897) 2020-06-17 12:49:09 -05:00
Chen
72fe73a104 fix issue752: generate right long keys (#879)
* fix issue752: generate right long keys

* Improve the readability of test cases

* update to raw string literal
2020-06-17 00:57:28 -05:00
Rosen Penev
a7a7908dc5 [clang-tidy] use auto (#888)
Found with modernize-use-auto

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-06-16 10:22:14 -05:00
Rosen Penev
0b0bf35c48 [clang-tidy] convert several functions to use references (#894)
Found with performance-unnecessary-value-param

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-06-15 17:34:27 -05:00
Rosen Penev
b2cd008717 partially fix clang compilation (#893)
* partially fix clang compilation

Missing header and mistaken algorithm usage.

Also removed it name from range loops. It's not correct.

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* run through clang's -Wrange-loop-analysis

Some range loops should not use references as they need to copy.

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* manual range loop conversions

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-06-15 16:59:27 -05:00
Rosen Penev
6387cbc0ca [clang-tidy] use braced initialization list (#883)
Found with modernize-return-braced-init-list

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-06-15 15:41:14 -05:00
Rosen Penev
1bf9540a7d [clang-tidy] fix inconsistent declaration (#884)
Found with readability-inconsistent-declaration-parameter-name

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-06-15 15:39:04 -05:00