1
0
mirror of https://git.code.sf.net/p/zint/code synced 2026-06-10 15:43:40 +00:00

general: add -Wshorten-64-to-32 compiler flag & suppress warnings

(ticket #351, props Axel Waggershauser)
This commit is contained in:
gitlost
2026-02-26 18:23:21 +00:00
parent 9ef5bc7298
commit bd33953fc1
24 changed files with 106 additions and 102 deletions
+3 -3
View File
@@ -111,7 +111,7 @@ static void test_bwipp_random(const testCtx *const p_ctx, const struct random_it
bwipp_buf, sizeof(bwipp_buf), NULL);
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
bwipp_len = strlen(bwipp_buf);
bwipp_len = (int) strlen(bwipp_buf);
assert_nonzero(bwipp_len, "i:%d bwipp_len %d = 0\n", i, bwipp_len);
symbol->width = width_func ? width_func(rdata, bwipp_len) : bwipp_len;
@@ -405,7 +405,7 @@ static void test_aztec_bwipjs_354(const testCtx *const p_ctx) {
sizeof(bwipp_buf), NULL);
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
bwipp_len = strlen(bwipp_buf);
bwipp_len = (int) strlen(bwipp_buf);
assert_nonzero(bwipp_len, "i:%d bwipp_len %d = 0\n", i, bwipp_len);
symbol->width = sqrt_width_func(NULL /*rdata*/, bwipp_len);
@@ -496,7 +496,7 @@ static void test_codablockf_fnc4_digit(const testCtx *const p_ctx) {
bwipp_buf, sizeof(bwipp_buf), NULL);
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
bwipp_len = strlen(bwipp_buf);
bwipp_len = (int) strlen(bwipp_buf);
assert_nonzero(bwipp_len, "i:%d bwipp_len %d = 0\n", i, bwipp_len);
symbol->width = codablockf_width_func(rdata, bwipp_len);
+1 -1
View File
@@ -1468,7 +1468,7 @@ static void test_encode_file_unreadable(const testCtx *const p_ctx) {
fd = creat(filename, S_IWUSR);
assert_notequal(fd, -1, "Unreadable input file (%s) not created == -1 (%d: %s)\n",
filename, errno, strerror(errno));
ret = write(fd, buf, 1);
ret = (int) write(fd, buf, 1);
assert_equal(ret, 1, "Unreadable write ret %d != 1\n", ret);
ret = close(fd);
assert_zero(ret, "Unreadable close(%s) != 0(%d: %s)\n", filename, errno, strerror(errno));
+9 -9
View File
@@ -1182,7 +1182,7 @@ int testUtilModulesDump(const struct zint_symbol *symbol, char dump[], int dump_
return -1;
}
*d = '\0';
return d - dump;
return (int) (d - dump);
}
/* Print out module dump (for generate tests) */
@@ -1492,24 +1492,24 @@ int testUtilDataPath(char *buffer, int buffer_size, const char *subdir, const ch
s = s2;
}
*s = '\0';
len = s - buffer;
len = (int) (s - buffer);
}
if ((s = strstr(buffer, "/backend")) != NULL) {
while ((s2 = strstr(s + 1, "/backend")) != NULL) { /* Find rightmost */
s = s2;
}
*s = '\0';
len = s - buffer;
len = (int) (s - buffer);
} else if ((s = strstr(buffer, "/frontend")) != NULL) {
while ((s2 = strstr(s + 1, "/frontend")) != NULL) { /* Find rightmost */
s = s2;
}
*s = '\0';
len = s - buffer;
len = (int) (s - buffer);
}
if (cmake_src_dir == NULL && (s = strrchr(buffer, '/')) != NULL) { /* Remove "build" dir */
*s = '\0';
len = s - buffer;
len = (int) (s - buffer);
}
if (subdir_len) {
@@ -2196,7 +2196,7 @@ int testUtilVerifyLibreOffice(const char *filename, int debug) {
return -1;
}
while (!feof(fp) && b < be) {
if (fgets(b, be - b, fp) == NULL) {
if (fgets(b, (int) (be - b), fp) == NULL) {
fprintf(stderr, "testUtilVerifyLibreOffice: failed to get line from '%s' (%s)\n", svg, cmd);
fclose(fp);
return -1;
@@ -2642,7 +2642,7 @@ static char *testUtilBwippCvtGS1Data(char *bwipp_data, const int bwipp_data_size
*b = ')';
} else if ((*c == '+' || *c == ' ') && upcean && !pipe) {
*b = ' ';
*addon_posn = b - bwipp_data;
*addon_posn = (int) (b - bwipp_data);
} else {
*b = *c;
}
@@ -3780,7 +3780,7 @@ int testUtilBwippSegs(int index, struct zint_symbol *symbol, int option_1, int o
d += local_segs[i].length;
}
}
total_len = d - data;
total_len = (int) (d - data);
if (unicode_mode) {
symbol->input_mode = DATA_MODE;
@@ -4273,7 +4273,7 @@ static int textUtilZXingCPPDX(const char *expected, const int expected_len, cons
static int textUtilZXingCPPEAN13AddOn(const char *expected, const int expected_len, char *out) {
char *sep;
if ((sep = strchr(expected, '+')) != NULL || (sep = strchr(expected, ' ')) != NULL) {
const int addon_len = expected_len - (sep + 1 - expected);
const int addon_len = expected_len - (int) (sep + 1 - expected);
if (addon_len <= 2) {
memset(out + 13, '0', 2 - addon_len);
memcpy(out + 13 + (2 - addon_len), sep + 1, addon_len);