Fix MSVC Spectre warnings
This commit is contained in:
@@ -246,8 +246,15 @@ void wapp_str8_to_lower(Str8 *dst, Str8RO *src) {
|
|||||||
wapp_debug_assert(dst->capacity >= src->capacity, "`dst` does not have enough capacity");
|
wapp_debug_assert(dst->capacity >= src->capacity, "`dst` does not have enough capacity");
|
||||||
|
|
||||||
dst->size = src->size;
|
dst->size = src->size;
|
||||||
for (u64 i = 0; i < src->size; ++i) {
|
|
||||||
wapp_str8_set(dst, i, (u8)tolower(wapp_str8_get(src, i)));
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
|
// MSVC Spectre mitigation warnings
|
||||||
|
u64 index = 0;
|
||||||
|
b8 running = true;
|
||||||
|
while (running) {
|
||||||
|
wapp_str8_set(dst, index, (u8)tolower(wapp_str8_get(src, index)));
|
||||||
|
++index;
|
||||||
|
running = index < src->size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,8 +263,15 @@ void wapp_str8_to_upper(Str8 *dst, Str8RO *src) {
|
|||||||
wapp_debug_assert(dst->capacity >= src->capacity, "`dst` does not have enough capacity");
|
wapp_debug_assert(dst->capacity >= src->capacity, "`dst` does not have enough capacity");
|
||||||
|
|
||||||
dst->size = src->size;
|
dst->size = src->size;
|
||||||
for (u64 i = 0; i < src->size; ++i) {
|
|
||||||
wapp_str8_set(dst, i, (u8)toupper(wapp_str8_get(src, i)));
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
|
// MSVC Spectre mitigation warnings
|
||||||
|
u64 index = 0;
|
||||||
|
b8 running = true;
|
||||||
|
while (running) {
|
||||||
|
wapp_str8_set(dst, index, (u8)toupper(wapp_str8_get(src, index)));
|
||||||
|
++index;
|
||||||
|
running = index < src->size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user