Эх сурвалжийг харах

Fixed alignment bug after buffer reallocation

Previously if a dynamic back buffer is full and reallocated then the
current allocation alignment will be alignet at the direct memory
address instead of memory address minus size. This is now fixed and
alignment should work correctly.
vurtun 9 жил өмнө
parent
commit
76ba0b2374
1 өөрчлөгдсөн 1 нэмэгдсэн , 1 устгасан
  1. 1 1
      nuklear.h

+ 1 - 1
nuklear.h

@@ -4384,7 +4384,7 @@ nk_buffer_alloc(struct nk_buffer *b, enum nk_buffer_allocation_type type,
         /* align newly allocated pointer */
         if (type == NK_BUFFER_FRONT)
             unaligned = nk_ptr_add(void, b->memory.ptr, b->allocated);
-        else unaligned = nk_ptr_add(void, b->memory.ptr, b->size);
+        else unaligned = nk_ptr_add(void, b->memory.ptr, b->size - size);
         memory = nk_buffer_align(unaligned, align, &alignment, type);
     }