Skip to content

Commit 37ebf16

Browse files
committed
Fix compiler warnings
See #69 Building with CFLAGS="-std=gnu23 -Wall -Wextra -Wsign-compare" luarocks --local make gives no compiler warnings
1 parent a47379a commit 37ebf16

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/luaharfbuzz/buffer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ static int buffer_add_codepoints(lua_State *L) {
143143
item_offset = luaL_optinteger(L, 3, 0);
144144
item_length = luaL_optinteger(L, 4, -1);
145145

146-
int n = lua_rawlen(L, 2);
146+
unsigned int n = lua_rawlen(L, 2);
147147

148148
hb_codepoint_t *text = (hb_codepoint_t *) malloc(n * sizeof(hb_codepoint_t));
149149

src/luaharfbuzz/face.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ static int face_var_get_axis_infos(lua_State *L) {
492492
hb_ot_var_get_axis_infos(*face, start, &count, axis_infos);
493493

494494
lua_createtable(L, count, 0);
495-
for (int i = 0; i != count; i++) {
495+
for (unsigned int i = 0; i != count; i++) {
496496
push_axis_info(L, axis_infos + i);
497497
lua_seti(L, -2, i + 1);
498498
}
@@ -549,7 +549,7 @@ static int face_var_named_instance_get_design_coords(lua_State *L) {
549549
unsigned int count = STATIC_ARRAY_SIZE;
550550
count = hb_ot_var_named_instance_get_design_coords(*face, index, &count, coords);
551551

552-
for (int i = 0; i != count; i++) {
552+
for (unsigned int i = 0; i != count; i++) {
553553
lua_pushnumber(L, coords[i]);
554554
}
555555
return count;
@@ -570,7 +570,7 @@ static int face_var_normalize_variations(lua_State *L) {
570570
int normalized[STATIC_ARRAY_SIZE];
571571
hb_ot_var_normalize_variations(*face, variations, count, normalized, coord_count);
572572

573-
for (int i = 0; i != coord_count; i++) {
573+
for (unsigned int i = 0; i != coord_count; i++) {
574574
lua_pushinteger(L, normalized[i]);
575575
}
576576
return coord_count;
@@ -590,7 +590,7 @@ static int face_var_normalize_coords(lua_State *L) {
590590
int normalized[STATIC_ARRAY_SIZE];
591591
hb_ot_var_normalize_coords(*face, count, coords, normalized);
592592

593-
for (int i = 0; i != count; i++) {
593+
for (unsigned int i = 0; i != count; i++) {
594594
lua_pushinteger(L, normalized[i]);
595595
}
596596
return count;

src/luaharfbuzz/font.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ static int font_set_variations(lua_State *L) {
249249
if (count > 128)
250250
count = 128;
251251
Variation variations[128];
252-
for (int i = 0; i != count; i++)
252+
for (unsigned int i = 0; i != count; i++)
253253
variations[i] = *(Variation *)luaL_checkudata(L, i + 2, "harfbuzz.Variation");
254254

255255
hb_font_set_variations(*f, variations, count);
@@ -262,7 +262,7 @@ static int font_set_var_coords_design(lua_State *L) {
262262
if (count > 128)
263263
count = 128;
264264
float coords[128];
265-
for (int i = 0; i != count; i++)
265+
for (unsigned int i = 0; i != count; i++)
266266
coords[i] = luaL_checknumber(L, i + 2);
267267

268268
hb_font_set_var_coords_design(*f, coords, count);
@@ -275,7 +275,7 @@ static int font_set_var_coords_normalized(lua_State *L) {
275275
if (count > 128)
276276
count = 128;
277277
int coords[128];
278-
for (int i = 0; i != count; i++)
278+
for (unsigned int i = 0; i != count; i++)
279279
coords[i] = luaL_checkinteger(L, i + 2);
280280

281281
hb_font_set_var_coords_normalized(*f, coords, count);
@@ -294,7 +294,7 @@ static int font_get_var_coords_normalized(lua_State *L) {
294294
Font *f = (Font *)luaL_checkudata(L, 1, "harfbuzz.Font");
295295
unsigned int count;
296296
const int *coords = hb_font_get_var_coords_normalized(*f, &count);
297-
for (int i = 0; i != count; i++)
297+
for (unsigned int i = 0; i != count; i++)
298298
lua_pushinteger(L, coords[i]);
299299
return count;
300300
}

0 commit comments

Comments
 (0)