Skip to content

Commit a8ed3cb

Browse files
authored
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 ae78ff3.
1 parent 51c0f99 commit a8ed3cb

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

src/util/SmallHeap.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
namespace util {
1313
template<typename T>
14-
inline T read_int_le(const uint8_t* src, ptrdiff_t offset=0) {
14+
inline T read_int_le(const uint8_t* src) {
1515
T tmp;
16-
std::memcpy(&tmp, src + offset * sizeof(T), sizeof(T));
16+
std::memcpy(&tmp, src, sizeof(T));
1717
return dataio::le2h(tmp);
1818
}
1919

@@ -126,7 +126,7 @@ namespace util {
126126
if (ptr == nullptr) {
127127
return 0;
128128
}
129-
return read_int_le<Tsize>(ptr, -1);
129+
return read_int_le<Tsize>(ptr - sizeof(Tsize));
130130
}
131131

132132
/// @return number of entries
@@ -177,7 +177,7 @@ namespace util {
177177
) : buffer(buffer), index(index), offset(offset) {}
178178

179179
Tsize size() const {
180-
return read_int_le<Tsize>(buffer.data() + offset, -1);
180+
return read_int_le<Tsize>(buffer.data() + offset - sizeof(Tsize));
181181
}
182182

183183
bool operator!=(const const_iterator& o) const {

src/window/detail/GLFWWindow.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,15 @@ static void init_gl_extensions_list() {
3333
}
3434
}
3535

36+
[[maybe_unused]]
3637
static bool is_gl_extension_supported(const char *extension) {
3738
if (!extension || !*extension) {
3839
return false;
3940
}
4041
return supported_gl_extensions.find(extension) != supported_gl_extensions.end();
4142
}
4243

44+
#ifndef __APPLE__
4345
static const char* gl_error_name(int error) {
4446
switch (error) {
4547
case GL_DEBUG_TYPE_ERROR: return "ERROR";
@@ -80,6 +82,7 @@ static void GLAPIENTRY gl_message_callback(
8082
logger.warning() << "GL:" << gl_error_name(type) << ":"
8183
<< gl_severity_name(severity) << ": " << message;
8284
}
85+
#endif
8386

8487
static bool initialize_gl(int width, int height) {
8588
glewExperimental = GL_TRUE;

test/util/SmallHeap.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@ TEST(SmallHeap, Allocation) {
88
auto index = 0;
99
auto size = 4;
1010

11+
std::cout << "step 1" << std::endl;
1112
SmallHeap<uint16_t, uint8_t> map;
13+
std::cout << "step 2" << std::endl;
1214
auto ptr = map.allocate(index, size);
15+
std::cout << "ptr: " << (void*)ptr << " le2h(1): " << dataio::le2h(1) << " h2le(1): " << dataio::h2le(1) << std::endl;
1316
EXPECT_EQ(map.sizeOf(ptr), size);
17+
std::cout << "step 4" << std::endl;
1418
EXPECT_EQ(ptr, map.find(index));
1519
}
1620

0 commit comments

Comments
 (0)