From 3dfb0ce66d2af456abfce9e732719b7d3e186e7f Mon Sep 17 00:00:00 2001 From: Luis Michaelis Date: Thu, 28 Dec 2023 12:01:30 +0100 Subject: [PATCH] fix(Archive): more MSVC incompatibility --- src/archive/ArchiveAscii.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/archive/ArchiveAscii.cc b/src/archive/ArchiveAscii.cc index 5b67c57f..9499e7a2 100644 --- a/src/archive/ArchiveAscii.cc +++ b/src/archive/ArchiveAscii.cc @@ -351,7 +351,9 @@ namespace zenkit { std::array::digits10 + 2) * 4> buf {}; auto n = std::snprintf(buf.data(), buf.size(), "%d %d %d %d", v.r, v.g, v.b, v.a); - this->write_entry(name, "color", std::string_view(buf.begin(), static_cast(n))); + + std::string_view s(buf.begin(), static_cast(n)); + this->write_entry(name, "color", s); } void WriteArchiveAscii::write_vec3(std::string_view name, glm::vec3 const& v) { @@ -359,7 +361,9 @@ namespace zenkit { (std::numeric_limits::max_exponent10 + std::numeric_limits::max_digits10 + 3) * 3> buf {}; auto n = std::snprintf(buf.data(), buf.size(), "%f %f %f", v.x, v.y, v.z); - this->write_entry(name, "vec3", std::string_view(buf.begin(), static_cast(n))); + + std::string_view s(buf.begin(), static_cast(n)); + this->write_entry(name, "vec3", s); } void WriteArchiveAscii::write_vec2(std::string_view name, glm::vec2 v) { @@ -387,7 +391,7 @@ namespace zenkit { std::array buf {}; for (auto i = 0u; i < length; ++i) { - std::to_chars(buf.begin(), buf.end(), static_cast(v[i]), 16); + std::to_chars(buf.begin(), buf.end(), static_cast(v[i]), 16); this->_m_write->write_string({buf.begin(), 2}); }