Skip to content

Commit

Permalink
fix(Archive): more MSVC incompatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
lmichaelis committed Dec 28, 2023
1 parent e970a05 commit 3dfb0ce
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/archive/ArchiveAscii.cc
Original file line number Diff line number Diff line change
Expand Up @@ -351,15 +351,19 @@ namespace zenkit {
std::array<char, (std::numeric_limits<uint8_t>::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<size_t>(n)));

std::string_view s(buf.begin(), static_cast<size_t>(n));
this->write_entry(name, "color", s);
}

void WriteArchiveAscii::write_vec3(std::string_view name, glm::vec3 const& v) {
std::array<char,
(std::numeric_limits<float>::max_exponent10 + std::numeric_limits<float>::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<size_t>(n)));

std::string_view s(buf.begin(), static_cast<size_t>(n));
this->write_entry(name, "vec3", s);
}

void WriteArchiveAscii::write_vec2(std::string_view name, glm::vec2 v) {
Expand Down Expand Up @@ -387,7 +391,7 @@ namespace zenkit {

std::array<char, 2> buf {};
for (auto i = 0u; i < length; ++i) {
std::to_chars(buf.begin(), buf.end(), static_cast<std::uint8_t>(v[i]), 16);
std::to_chars(buf.begin(), buf.end(), static_cast<unsigned char>(v[i]), 16);
this->_m_write->write_string({buf.begin(), 2});
}

Expand Down

0 comments on commit 3dfb0ce

Please sign in to comment.