File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111
1212namespace 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 {
Original file line number Diff line number Diff line change @@ -33,13 +33,15 @@ static void init_gl_extensions_list() {
3333 }
3434}
3535
36+ [[maybe_unused]]
3637static 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__
4345static 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
8487static bool initialize_gl (int width, int height) {
8588 glewExperimental = GL_TRUE ;
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments