summaryrefslogtreecommitdiffhomepage
path: root/loader
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-05-26 15:30:15 +0200
committerStanislaw Halik <sthalik@misaki.pl>2024-05-26 15:30:15 +0200
commit82ab34aa83463179339eb8382edf1c22cacdad61 (patch)
tree3d02aaa7458a4f00e38527c7cfe0f8559398b5d5 /loader
parentc3bebd8c3263d67f3b66cab7437bc24f5ea724c8 (diff)
use array_size instead of std::size/arraySize
Diffstat (limited to 'loader')
-rw-r--r--loader/texture.cpp5
-rw-r--r--loader/wall-traits.cpp3
2 files changed, 5 insertions, 3 deletions
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 <cstring>
@@ -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 <cr/StringView.h>
#include <cr/Optional.h>
@@ -49,7 +50,7 @@ auto wall_traits::make_atlas(StringView name, const Cell&) -> std::shared_ptr<At
{
char file_buf[fm_FILENAME_MAX], json_buf[fm_FILENAME_MAX];
auto file = loader.make_atlas_path(file_buf, loader.WALL_TILESET_PATH, name);
- int json_size = std::snprintf(json_buf, std::size(json_buf), "%s.json", file_buf);
+ int json_size = std::snprintf(json_buf, array_size(json_buf), "%s.json", file_buf);
fm_soft_assert(json_size != 0 && (size_t)json_size <= std::size_t(json_buf));
auto json_name = StringView{json_buf, (size_t)json_size};
auto def = wall_atlas_def::deserialize(json_name);