From 82ab34aa83463179339eb8382edf1c22cacdad61 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 26 May 2024 15:30:15 +0200 Subject: use array_size instead of std::size/arraySize --- loader/texture.cpp | 5 +++-- loader/wall-traits.cpp | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'loader') diff --git a/loader/texture.cpp b/loader/texture.cpp index fc180bc3..ce6fe3fa 100644 --- a/loader/texture.cpp +++ b/loader/texture.cpp @@ -1,6 +1,7 @@ #include "impl.hpp" #include "compat/assert.hpp" #include "compat/defs.hpp" +#include "compat/array-size.hpp" #include "compat/exception.hpp" #include "compat/strerror.hpp" #include @@ -29,11 +30,11 @@ Trade::ImageData2D loader_impl::texture(StringView prefix, StringView filename_) for (auto extension : { ".tga"_s, ".png"_s, ".webp"_s, }) { - fm_soft_assert(len + extension.size() < std::size(buf)); + fm_soft_assert(len + extension.size() < array_size(buf)); std::memcpy(buf + len, extension.data(), extension.size()); buf[len + extension.size()] = '\0'; auto path = StringView{buf, len + extension.size(), StringViewFlag::NullTerminated}; - fm_debug_assert(path.size() < std::size(buf)); + fm_debug_assert(path.size() < array_size(buf)); auto& importer = extension == ".tga"_s ? tga_importer : image_importer; if (Path::exists(path) && importer->openFile(path)) { diff --git a/loader/wall-traits.cpp b/loader/wall-traits.cpp index ecb88056..07ff7d9c 100644 --- a/loader/wall-traits.cpp +++ b/loader/wall-traits.cpp @@ -4,6 +4,7 @@ #include "loader.hpp" #include "src/tile-defs.hpp" #include "src/wall-atlas.hpp" +#include "compat/array-size.hpp" #include "compat/exception.hpp" #include #include @@ -49,7 +50,7 @@ auto wall_traits::make_atlas(StringView name, const Cell&) -> std::shared_ptr