@@ -32,9 +32,9 @@ extern "C" {
3232 */
3333typedef struct line_map {
3434 // the width of the line_map (same data type as bitmap width)
35- uint32_t width ;
35+ sxbp_figure_dimension_t width ;
3636 // the height of the line_map (same data type as bitmap height)
37- uint32_t height ;
37+ sxbp_figure_dimension_t height ;
3838 // dynamically allocated 2D array of pointers to lines
3939 sxbp_line_t * * * cells ;
4040} line_map ;
@@ -69,7 +69,7 @@ typedef struct suggest_previous_length_context {
6969static bool sxbp_free_line_map (line_map * map ) {
7070 // if map->cells is not null, then it needs to be deallocated
7171 if (map -> cells != NULL ) {
72- for (uint32_t col = 0 ; col < map -> width ; col ++ ) {
72+ for (sxbp_figure_dimension_t col = 0 ; col < map -> width ; col ++ ) {
7373 // but first check each column of the col inside cells too
7474 if (map -> cells [col ] != NULL ) {
7575 free (map -> cells [col ]);
@@ -101,24 +101,24 @@ static sxbp_result_t sxbp_init_line_map_from_bounds(
101101 * this makes sense because for example from 1 to 10 there are 10 values
102102 * and the difference of these is 9 so the number of values is 9+1 = 10
103103 */
104- map -> width = (bounds .x_max - bounds .x_min ) + 1 ;
105- map -> height = (bounds .y_max - bounds .y_min ) + 1 ;
104+ map -> width = (sxbp_figure_dimension_t )( bounds .x_max - bounds .x_min ) + 1 ;
105+ map -> height = (sxbp_figure_dimension_t )( bounds .y_max - bounds .y_min ) + 1 ;
106106 // allocate dynamic memory for the row
107107 map -> cells = calloc (map -> width , sizeof (sxbp_line_t * * ));
108108 // catch allocation error and exit early
109109 if (map -> cells == NULL ) {
110110 return SXBP_RESULT_FAIL_MEMORY ;
111111 } else {
112112 // now allocate memory for the columns of the row
113- for (uint32_t col = 0 ; col < map -> width ; col ++ ) {
113+ for (sxbp_figure_dimension_t col = 0 ; col < map -> width ; col ++ ) {
114114 map -> cells [col ] = calloc (map -> height , sizeof (sxbp_line_t * ));
115115 // catch allocation error, free and exit early
116116 if (map -> cells [col ] == NULL ) {
117117 sxbp_free_line_map (map );
118118 return SXBP_RESULT_FAIL_MEMORY ;
119119 }
120120 // pedantic, set all cells within the column explicitly to NULL
121- for (uint32_t row = 0 ; row < map -> height ; row ++ ) {
121+ for (sxbp_figure_dimension_t row = 0 ; row < map -> height ; row ++ ) {
122122 map -> cells [col ][row ] = NULL ;
123123 }
124124 }
@@ -266,21 +266,21 @@ static sxbp_length_t sxbp_resolve_collision(
266266 // rule out the combinations of directions not featured in the table (any
267267 // non-parallel combos, which cannot be optimised in this manner)
268268 if ((previous .direction == SXBP_UP ) && (collider .direction == SXBP_UP )) {
269- return (collider_origin .y - previous_origin .y ) + collider .length + 1 ;
269+ return (sxbp_figure_dimension_t )(( collider_origin .y - previous_origin .y ) + collider .length + 1 ) ;
270270 } else if ((previous .direction == SXBP_UP ) && (collider .direction == SXBP_DOWN )) {
271- return (collider_end .y - previous_origin .y ) + collider .length + 1 ;
271+ return (sxbp_figure_dimension_t )(( collider_end .y - previous_origin .y ) + collider .length + 1 ) ;
272272 } else if ((previous .direction == SXBP_RIGHT ) && (collider .direction == SXBP_RIGHT )) {
273- return (collider_origin .x - previous_origin .x ) + collider .length + 1 ;
273+ return (sxbp_figure_dimension_t )(( collider_origin .x - previous_origin .x ) + collider .length + 1 ) ;
274274 } else if ((previous .direction == SXBP_RIGHT ) && (collider .direction == SXBP_LEFT )) {
275- return (collider_end .x - previous_origin .x ) + collider .length + 1 ;
275+ return (sxbp_figure_dimension_t )(( collider_end .x - previous_origin .x ) + collider .length + 1 ) ;
276276 } else if ((previous .direction == SXBP_DOWN ) && (collider .direction == SXBP_UP )) {
277- return (previous_origin .y - collider_end .y ) + collider .length + 1 ;
277+ return (sxbp_figure_dimension_t )(( previous_origin .y - collider_end .y ) + collider .length + 1 ) ;
278278 } else if ((previous .direction == SXBP_DOWN ) && (collider .direction == SXBP_DOWN )) {
279- return (previous_origin .y - collider_origin .y ) + collider .length + 1 ;
279+ return (sxbp_figure_dimension_t )(( previous_origin .y - collider_origin .y ) + collider .length + 1 ) ;
280280 } else if ((previous .direction == SXBP_LEFT ) && (collider .direction == SXBP_RIGHT )) {
281- return (previous_origin .x - collider_end .x ) + collider .length + 1 ;
281+ return (sxbp_figure_dimension_t )(( previous_origin .x - collider_end .x ) + collider .length + 1 ) ;
282282 } else if ((previous .direction == SXBP_LEFT ) && (collider .direction == SXBP_LEFT )) {
283- return (previous_origin .x - collider_origin .x ) + collider .length + 1 ;
283+ return (sxbp_figure_dimension_t )(( previous_origin .x - collider_origin .x ) + collider .length + 1 ) ;
284284 } else {
285285 // this is the catch-all case, where no way to optimise was found
286286 return previous .length + 1 ;
0 commit comments