From 7d5b63be7620ac9e10c5e0fbda7ac9278c89d843 Mon Sep 17 00:00:00 2001 From: Knightly Date: Tue, 14 Apr 2026 19:33:28 -1000 Subject: [PATCH] fix: Visual Studio warnings for narrowing conversion log: fix MSVC narrowing conversion warnings --- include/yaml-cpp/emitter.h | 2 +- include/yaml-cpp/node/convert.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/yaml-cpp/emitter.h b/include/yaml-cpp/emitter.h index 2c5af34c7..44eb36624 100644 --- a/include/yaml-cpp/emitter.h +++ b/include/yaml-cpp/emitter.h @@ -189,7 +189,7 @@ inline Emitter& Emitter::WriteStreamable(T value) { } if (!special) { - auto value_as_str = FpToString(value, stream.precision()); + auto value_as_str = FpToString(value, static_cast(stream.precision())); if (GetShowTrailingZero()) { bool isInScientificNotation = (value_as_str.find('e') != std::string::npos); bool hasDot = (value_as_str.find('.') != std::string::npos); diff --git a/include/yaml-cpp/node/convert.h b/include/yaml-cpp/node/convert.h index 0f04ea6fd..fbec7bb53 100644 --- a/include/yaml-cpp/node/convert.h +++ b/include/yaml-cpp/node/convert.h @@ -130,7 +130,7 @@ inner_encode(const T& rhs, std::stringstream& stream){ stream << ".inf"; } } else { - stream << FpToString(rhs, stream.precision()); + stream << FpToString(rhs, static_cast(stream.precision())); } }