From a8ed3cb36f92ddf8c8b8033ad8a0ecf912187531 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Tue, 7 Jul 2026 17:42:24 +0300 Subject: [PATCH] fix macos build (#859) * update macos.yml * update macos.yml * update macos.yml * update macos.yml * update macos.yml * update macos.yml * update workflows * update test * fix unused function warning * update test * fixes * update test * update test * update macos.yml * Revert "update workflows" This reverts commit ae78ff3ca24e845364776c9ff14c93e47991c4ce. --- src/util/SmallHeap.hpp | 8 ++++---- src/window/detail/GLFWWindow.cpp | 3 +++ test/util/SmallHeap.cpp | 4 ++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/util/SmallHeap.hpp b/src/util/SmallHeap.hpp index 213d36958..6ff8cf238 100644 --- a/src/util/SmallHeap.hpp +++ b/src/util/SmallHeap.hpp @@ -11,9 +11,9 @@ namespace util { template - inline T read_int_le(const uint8_t* src, ptrdiff_t offset=0) { + inline T read_int_le(const uint8_t* src) { T tmp; - std::memcpy(&tmp, src + offset * sizeof(T), sizeof(T)); + std::memcpy(&tmp, src, sizeof(T)); return dataio::le2h(tmp); } @@ -126,7 +126,7 @@ namespace util { if (ptr == nullptr) { return 0; } - return read_int_le(ptr, -1); + return read_int_le(ptr - sizeof(Tsize)); } /// @return number of entries @@ -177,7 +177,7 @@ namespace util { ) : buffer(buffer), index(index), offset(offset) {} Tsize size() const { - return read_int_le(buffer.data() + offset, -1); + return read_int_le(buffer.data() + offset - sizeof(Tsize)); } bool operator!=(const const_iterator& o) const { diff --git a/src/window/detail/GLFWWindow.cpp b/src/window/detail/GLFWWindow.cpp index db3d67241..394472783 100644 --- a/src/window/detail/GLFWWindow.cpp +++ b/src/window/detail/GLFWWindow.cpp @@ -33,6 +33,7 @@ static void init_gl_extensions_list() { } } +[[maybe_unused]] static bool is_gl_extension_supported(const char *extension) { if (!extension || !*extension) { return false; @@ -40,6 +41,7 @@ static bool is_gl_extension_supported(const char *extension) { return supported_gl_extensions.find(extension) != supported_gl_extensions.end(); } +#ifndef __APPLE__ static const char* gl_error_name(int error) { switch (error) { case GL_DEBUG_TYPE_ERROR: return "ERROR"; @@ -80,6 +82,7 @@ static void GLAPIENTRY gl_message_callback( logger.warning() << "GL:" << gl_error_name(type) << ":" << gl_severity_name(severity) << ": " << message; } +#endif static bool initialize_gl(int width, int height) { glewExperimental = GL_TRUE; diff --git a/test/util/SmallHeap.cpp b/test/util/SmallHeap.cpp index c5b3adf28..a4ecab842 100644 --- a/test/util/SmallHeap.cpp +++ b/test/util/SmallHeap.cpp @@ -8,9 +8,13 @@ TEST(SmallHeap, Allocation) { auto index = 0; auto size = 4; + std::cout << "step 1" << std::endl; SmallHeap map; + std::cout << "step 2" << std::endl; auto ptr = map.allocate(index, size); + std::cout << "ptr: " << (void*)ptr << " le2h(1): " << dataio::le2h(1) << " h2le(1): " << dataio::h2le(1) << std::endl; EXPECT_EQ(map.sizeOf(ptr), size); + std::cout << "step 4" << std::endl; EXPECT_EQ(ptr, map.find(index)); }