fix ub reported by gcc builds

This commit is contained in:
Ryan Fleury committed 2026-10-02 08:17:23 -07:00
1 parent f6b4a38134
commit 2db9ec1312
5 files changed
+7 -10

No files matched your search

-3
View File
@@ -437,13 +437,10 @@ dr_mesh(R_Handle mesh_vertices, R_Handle mesh_indices, R_GeoTopologyKind mesh_ge
U64 buffer[] = U64 buffer[] =
{ {
mesh_vertices.u64[0], mesh_vertices.u64[0],
mesh_vertices.u64[1],
mesh_indices.u64[0], mesh_indices.u64[0],
mesh_indices.u64[1],
(U64)mesh_geo_topology, (U64)mesh_geo_topology,
(U64)mesh_geo_vertex_flags, (U64)mesh_geo_vertex_flags,
albedo_tex.u64[0], albedo_tex.u64[0],
albedo_tex.u64[1],
(U64)dr_top_tex2d_sample_kind(), (U64)dr_top_tex2d_sample_kind(),
}; };
hash = dr_hash_from_string(str8((U8 *)buffer, sizeof(buffer))); hash = dr_hash_from_string(str8((U8 *)buffer, sizeof(buffer)));
+3 -3
View File
@@ -1251,11 +1251,11 @@ e_value_eval_from_eval(E_Eval eval)
{ {
default:{}break; default:{}break;
case E_TypeKind_Char8: case E_TypeKind_Char8:
case E_TypeKind_S8: {eval.value.s64 = (S64)*((S8 *)&eval.value.u64);}break; case E_TypeKind_S8: {eval.value.s64 = (S64)*((S8 *)&eval.value.u128.u8[0]);}break;
case E_TypeKind_Char16: case E_TypeKind_Char16:
case E_TypeKind_S16: {eval.value.s64 = (S64)*((S16 *)&eval.value.u64);}break; case E_TypeKind_S16: {eval.value.s64 = (S64)*((S16 *)&eval.value.u128.u8[0]);}break;
case E_TypeKind_Char32: case E_TypeKind_Char32:
case E_TypeKind_S32: {eval.value.s64 = (S64)*((S32 *)&eval.value.u64);}break; case E_TypeKind_S32: {eval.value.s64 = (S64)*((S32 *)&eval.value.u128.u8[0]);}break;
} }
} }
} }
+2 -2
View File
@@ -516,12 +516,12 @@ fnt_hash2style_from_tag_size_flags(FNT_Tag tag, F32 size, FNT_RasterFlags flags)
//- rjf: tag * size -> style hash //- rjf: tag * size -> style hash
U64 style_hash = {0}; U64 style_hash = {0};
{ {
F64 size_f64 = size; union { F64 size_f64; U64 size_u64; } size_pun = {.size_f64 = (F64)size};
U64 buffer[] = U64 buffer[] =
{ {
tag.u64[0], tag.u64[0],
tag.u64[1], tag.u64[1],
*(U64 *)(&size_f64), size_pun.size_u64,
(U64)flags, (U64)flags,
}; };
style_hash = fnt_little_hash_from_string(5381, str8((U8 *)buffer, sizeof(buffer))); style_hash = fnt_little_hash_from_string(5381, str8((U8 *)buffer, sizeof(buffer)));
+1 -1
View File
@@ -189,7 +189,7 @@ sh_install_or_uninstall_self(B32 write, B32 install)
//- rjf: make symlink in binary path to this exe //- rjf: make symlink in binary path to this exe
make_directory(str8_chop_last_slash(symlink_path)); make_directory(str8_chop_last_slash(symlink_path));
symlink((char *)get_process_info()->binary_file_path.str, (char *)symlink_path.str); LNX_RETRY_ON_EINTR(symlink((char *)get_process_info()->binary_file_path.str, (char *)symlink_path.str));
} }
//- rjf: uninstall -> delete files //- rjf: uninstall -> delete files
@@ -1141,7 +1141,7 @@ wm_get_events(Arena *arena, B32 wait)
if(poll_fds[1].revents & POLLIN) if(poll_fds[1].revents & POLLIN)
{ {
U64 dummy = 0; U64 dummy = 0;
read(lnx_wm_state->wakeup_fd, &dummy, sizeof(dummy)); LNX_RETRY_ON_EINTR(read(lnx_wm_state->wakeup_fd, &dummy, sizeof(dummy)));
wait = 0; wait = 0;
} }
} }