From be54fe31e7a9c13a8e49c094399960bbdfd66cf0 Mon Sep 17 00:00:00 2001 From: Martin Felis Date: Fri, 5 Nov 2021 14:01:39 +0100 Subject: [PATCH] Minor type safety cleanup. --- src/sconvcol.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/sconvcol.h b/src/sconvcol.h index 7aa43c0..4f7c47e 100644 --- a/src/sconvcol.h +++ b/src/sconvcol.h @@ -166,9 +166,9 @@ bool sch_hull_sat(const sch_hull* hull_A, const sch_hull* hull_B, sch_manifold* int sch_hull_is_vertex_concave(const sch_hull* hull, const simd4f p); -int sch_hull_is_closed (const sch_hull* hull); +SchHullResult sch_hull_is_closed (const sch_hull* hull); -int sch_hull_connect_face_edges(const sch_hull* hull, int face_index); +SchHullResult sch_hull_connect_face_edges(const sch_hull* hull, int face_index); void sch_create_face(int num_vert, simd4f* vertices, sch_face* out_face); @@ -232,8 +232,8 @@ void sch_create_face(int num_vert, simd4f* vertices, sch_face* out_face) { assert(out_face->edge == NULL); int i = 0; - sch_edge* f_edges = malloc(sizeof(sch_edge) * num_vert); - sch_vert* f_verts = malloc(sizeof(sch_vert) * num_vert); + sch_edge* f_edges = (sch_edge*) malloc(sizeof(sch_edge) * num_vert); + sch_vert* f_verts = (sch_vert*) malloc(sizeof(sch_vert) * num_vert); while (i < num_vert) { sch_vert* vert = &f_verts[i]; @@ -384,7 +384,7 @@ SchHullResult sch_builder_create_hull(sch_hull_builder* builder, sch_hull* out_h prev_edge = edge; } - int edge_add_result = sch_hull_connect_face_edges (out_hull, face_index); + SchHullResult edge_add_result = sch_hull_connect_face_edges (out_hull, face_index); if (edge_add_result != SchHullResultOK) { sch_hull_free_memory(out_hull); return edge_add_result; @@ -555,7 +555,7 @@ float sch_query_edge_directions (const sch_hull* hull_A, const sch_hull* hull_B, } void sch_clip_faces (const sch_face* ref_face, const sch_face* inc_face, sch_manifold* manifold) { - simd4f* input_vertices = malloc(sizeof(simd4f) * manifold->num_vertices); + simd4f* input_vertices = (simd4f*) malloc(sizeof(simd4f) * manifold->num_vertices); assert (input_vertices != NULL); sch_edge* inc_start_edge = inc_face->edge; @@ -722,7 +722,7 @@ int sch_hull_is_vertex_concave(const sch_hull* hull, const simd4f v) { return 0; } -int sch_hull_connect_face_edges(const sch_hull* hull, int new_face_index) { +SchHullResult sch_hull_connect_face_edges(const sch_hull* hull, int new_face_index) { sch_face* new_face = &hull->faces[new_face_index]; sch_edge* new_face_edge0 = new_face->edge; @@ -771,7 +771,7 @@ int sch_hull_connect_face_edges(const sch_hull* hull, int new_face_index) { return SchHullResultOK; } -int sch_hull_is_closed (const sch_hull* hull) { +SchHullResult sch_hull_is_closed (const sch_hull* hull) { for (int ei = 0; ei < hull->num_edges; ei++) { if (hull->edges[ei].twin == NULL) { return SchHullResultOpenHull;