Fix MSVC errors and warnings

This commit is contained in:
2024-10-05 20:07:48 +01:00
parent 1ddc5610f9
commit ffb99a3644
9 changed files with 77 additions and 51 deletions

View File

@@ -48,21 +48,21 @@ TestFuncResult test_arena_alloc_fails_when_over_capacity(void) {
}
TestFuncResult test_arena_realloc_bigger_size(void) {
u64 count = 10;
u64 old_count = 10;
u64 new_count = 20;
i32 *bytes = wapp_mem_arena_alloc(arena, count * sizeof(i32));
i32 *bytes = wapp_mem_arena_alloc(arena, old_count * sizeof(i32));
for (u64 i = 0; i < count; ++i) {
bytes[i] = i;
for (u64 i = 0; i < old_count; ++i) {
bytes[i] = (i32)i;
}
i32 *new_bytes = wapp_mem_arena_realloc(arena, bytes, count * sizeof(i32), new_count * sizeof(i32));
i32 *new_bytes = wapp_mem_arena_realloc(arena, bytes, old_count * sizeof(i32), new_count * sizeof(i32));
if (!new_bytes) {
return wapp_tester_result(false);
}
for (u64 i = 0; i < new_count; ++i) {
if (i < count && new_bytes[i] != bytes[i]) {
if (i < old_count && new_bytes[i] != bytes[i]) {
return wapp_tester_result(false);
}
}
@@ -71,15 +71,15 @@ TestFuncResult test_arena_realloc_bigger_size(void) {
}
TestFuncResult test_arena_realloc_smaller_size(void) {
u64 count = 10;
u64 old_count = 10;
u64 new_count = 5;
i32 *bytes = wapp_mem_arena_alloc(arena, count * sizeof(i32));
i32 *bytes = wapp_mem_arena_alloc(arena, old_count * sizeof(i32));
for (u64 i = 0; i < count; ++i) {
bytes[i] = i;
for (u64 i = 0; i < old_count; ++i) {
bytes[i] = (i32)i;
}
i32 *new_bytes = wapp_mem_arena_realloc(arena, bytes, count * sizeof(i32), new_count * sizeof(i32));
i32 *new_bytes = wapp_mem_arena_realloc(arena, bytes, old_count * sizeof(i32), new_count * sizeof(i32));
if (!new_bytes) {
return wapp_tester_result(false);
}