mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
raster.c: #191 suppress clang-tidy warnings
This commit is contained in:
parent
74beb5c50a
commit
2189201e95
@ -720,6 +720,7 @@ static int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int
|
||||
unsigned char* local_text = (unsigned char*) _alloca(ustrlen(symbol->text) + 1);
|
||||
#endif
|
||||
|
||||
memset(local_text, 0, ustrlen(symbol->text) + 1);
|
||||
if (symbol->show_hrt != 0) {
|
||||
/* Copy text from symbol */
|
||||
to_latin1(symbol->text, local_text);
|
||||
@ -734,8 +735,8 @@ static int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int
|
||||
} else {
|
||||
local_text[i] = ' ';
|
||||
}
|
||||
local_text[ustrlen(symbol->text)] = '\0';
|
||||
}
|
||||
local_text[ustrlen(symbol->text)] = '\0';
|
||||
} else {
|
||||
/* For everything else, just remove the text */
|
||||
local_text[0] = '\0';
|
||||
@ -744,7 +745,6 @@ static int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int
|
||||
|
||||
textdone = 0;
|
||||
main_width = symbol->width;
|
||||
strcpy(addon, "");
|
||||
comp_offset = 0;
|
||||
addon_text_posn = 0.0;
|
||||
row_height = 0;
|
||||
|
@ -38,6 +38,7 @@ static void test_chk_extendable(void)
|
||||
int ret;
|
||||
struct item {
|
||||
int symbology;
|
||||
int show_hrt;
|
||||
unsigned char* data;
|
||||
int ret;
|
||||
|
||||
@ -51,9 +52,10 @@ static void test_chk_extendable(void)
|
||||
};
|
||||
// s/\/\*[ 0-9]*\*\//\=printf("\/*%2d*\/", line(".") - line("'<"))
|
||||
struct item data[] = {
|
||||
/* 0*/ { BARCODE_EANX_CHK, "1234567890128+12", 0, 50, 1, 124, 288, 118, 5, 224 },
|
||||
/* 1*/ { BARCODE_UPCA_CHK, "12345678905+12345", 0, 50, 1, 151, 342, 118, 5, 258 },
|
||||
/* 2*/ { BARCODE_UPCE_CHK, "12345670+12", 0, 50, 1, 80, 200, 118, 5, 147 },
|
||||
/* 0*/ { BARCODE_EANX_CHK, -1, "1234567890128+12", 0, 50, 1, 124, 288, 118, 5, 224 },
|
||||
/* 1*/ { BARCODE_UPCA_CHK, -1, "12345678905+12345", 0, 50, 1, 151, 342, 118, 5, 258 },
|
||||
/* 2*/ { BARCODE_UPCE_CHK, -1, "12345670+12", 0, 50, 1, 80, 200, 118, 5, 147 },
|
||||
/* 3*/ { BARCODE_UPCE_CHK, 0, "12345670+12", 0, 50, 1, 80, 200, 118, 5, 147 },
|
||||
};
|
||||
int data_size = sizeof(data) / sizeof(struct item);
|
||||
|
||||
@ -63,6 +65,9 @@ static void test_chk_extendable(void)
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
symbol->symbology = data[i].symbology;
|
||||
if (data[i].show_hrt != -1) {
|
||||
symbol->show_hrt = data[i].show_hrt;
|
||||
}
|
||||
int length = strlen(data[i].data);
|
||||
|
||||
ret = ZBarcode_Encode_and_Buffer(symbol, data[i].data, length, 0);
|
||||
@ -84,7 +89,11 @@ static void test_chk_extendable(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
assert_nonzero(addon_text_bits_set, "i:%d (%d) addon_text_bits_set zero\n", i, data[i].symbology);
|
||||
if (symbol->show_hrt) {
|
||||
assert_nonzero(addon_text_bits_set, "i:%d (%d) addon_text_bits_set zero\n", i, data[i].symbology);
|
||||
} else {
|
||||
assert_zero(addon_text_bits_set, "i:%d (%d) addon_text_bits_set non-zero\n", i, data[i].symbology);
|
||||
}
|
||||
|
||||
ZBarcode_Delete(symbol);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user