mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-09 13:41:59 -04:00
general: suppress some CodeQL warnings
CODABLOCKF: tidy some comments
This commit is contained in:
parent
174bbf06a8
commit
c11ab5528d
6 changed files with 16 additions and 17 deletions
|
@ -69,7 +69,7 @@ typedef struct sCharacterSetTable {
|
|||
} CharacterSetTable;
|
||||
|
||||
/* Find the possible Code-128 Character sets for a character
|
||||
* The result is an or of CodeA, CodeB, CodeC, CodeFNC1, CodeFNC4 depending on the
|
||||
* The result is an OR of CodeA, CodeB, CodeC, CodeFNC1, CodeFNC4 depending on the
|
||||
* possible Code 128 character sets.
|
||||
*/
|
||||
static int GetPossibleCharacterSet(unsigned char C) {
|
||||
|
@ -87,13 +87,11 @@ static int GetPossibleCharacterSet(unsigned char C) {
|
|||
}
|
||||
|
||||
/* Create a Table with the following information for each Data character:
|
||||
* int CharacterSet is an or of CodeA, CodeB, CodeC, CodeFNC1, CodeFNC4,
|
||||
* depending on which character set is applicable.
|
||||
* (Result of GetPossibleCharacterSet)
|
||||
* int AFollowing,BFollowing The number of source characters you still may encode
|
||||
* in this character set.
|
||||
* int CFollowing The number of characters encodable in CodeC if we
|
||||
* start here.
|
||||
* int CharacterSet is an OR of CodeA, CodeB, CodeC, CodeFNC1, CodeFNC4,
|
||||
* depending on which character set is applicable.
|
||||
* (Result of GetPossibleCharacterSet)
|
||||
* int AFollowing, BFollowing The number of source characters you still may encode in this character set.
|
||||
* int CFollowing The number of characters encodable in CodeC if we start here.
|
||||
*/
|
||||
static void CreateCharacterSetTable(CharacterSetTable T[], unsigned char *data, const int dataLength) {
|
||||
int charCur;
|
||||
|
@ -260,6 +258,7 @@ static int Columns2Rows(struct zint_symbol *symbol, CharacterSetTable *T, const
|
|||
if (isFNC4) { /* So skip FNC4 and shift value instead */
|
||||
--emptyColumns;
|
||||
++charCur;
|
||||
assert(charCur < dataLength); /* FNC4s always followed by char */
|
||||
}
|
||||
pSet[charCur] |= CShift;
|
||||
} else {
|
||||
|
@ -292,6 +291,7 @@ static int Columns2Rows(struct zint_symbol *symbol, CharacterSetTable *T, const
|
|||
if (isFNC4) { /* So skip FNC4 and shift value instead */
|
||||
--emptyColumns;
|
||||
++charCur;
|
||||
assert(charCur < dataLength); /* FNC4s always followed by char */
|
||||
}
|
||||
pSet[charCur] |= CShift;
|
||||
} else {
|
||||
|
@ -684,7 +684,7 @@ INTERNAL int codablockf(struct zint_symbol *symbol, unsigned char source[], int
|
|||
|
||||
/* >>> Build C128 code numbers */
|
||||
/* The C128 column count contains Start (2CW), Row ID, Checksum, Stop */
|
||||
pOutput = (unsigned char *) z_alloca(columns * rows);
|
||||
pOutput = (unsigned char *) z_alloca((size_t) columns * (size_t) rows);
|
||||
pOutPos = pOutput;
|
||||
charCur = 0;
|
||||
/* >> Loop over rows */
|
||||
|
@ -780,7 +780,7 @@ INTERNAL int codablockf(struct zint_symbol *symbol, unsigned char source[], int
|
|||
--emptyColumns;
|
||||
}
|
||||
/* >> End Criteria */
|
||||
if ((pSet[charCur] & CFill) || (pSet[charCur] & CEnd)) {
|
||||
if (charCur < dataLength && ((pSet[charCur] & CFill) || (pSet[charCur] & CEnd))) {
|
||||
/* Fill line but leave space for checks in last line */
|
||||
if (rowCur == rows - 1) {
|
||||
emptyColumns -= 2;
|
||||
|
|
|
@ -1904,7 +1904,7 @@ static int dm_ecc200(struct zint_symbol *symbol, struct zint_seg segs[], const i
|
|||
const int NC = W - 2 * (W / FW);
|
||||
const int NR = H - 2 * (H / FH);
|
||||
int x, y, *places;
|
||||
if (!(places = (int *) calloc(NC * NR, sizeof(int)))) {
|
||||
if (!(places = (int *) calloc((size_t) NC * (size_t) NR, sizeof(int)))) {
|
||||
return errtxt(ZINT_ERROR_MEMORY, symbol, 718, "Insufficient memory for placement array");
|
||||
}
|
||||
dm_placement(places, NR, NC);
|
||||
|
|
|
@ -138,7 +138,8 @@ static int dx_parse_code(struct zint_symbol *symbol, const unsigned char *source
|
|||
int dx_extract;
|
||||
/* DX format is either 4 digits (DX Extract, eg: 1271) or 6 digits (DX Full, eg: 012710) */
|
||||
if (debug_print) printf("No \"-\" separator, computing from DX Extract (4 digits) or DX Full (6 digits)\n");
|
||||
if (dx_length == 5 || dx_length > 6) {
|
||||
assert(dx_length <= 6); /* I.e. DX_MAX_DX_INFO_LENGTH, guaranteed above */
|
||||
if (dx_length == 5) {
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 980,
|
||||
"DX number \"%s\" is incorrect; expected 4 digits (DX extract) or 6 digits (DX full)", dx_info);
|
||||
}
|
||||
|
@ -154,7 +155,7 @@ static int dx_parse_code(struct zint_symbol *symbol, const unsigned char *source
|
|||
}
|
||||
/* Compute the DX parts 1 and 2 from the DX extract */
|
||||
dx_extract = to_int((const unsigned char *) dx_info, dx_length);
|
||||
assert(dx_extract != -1);
|
||||
assert(dx_extract != -1); /* All digits (no hyphen) & length 6 max - can't fail */
|
||||
if (dx_extract < 16 || dx_extract > 2047) {
|
||||
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 981, "DX extract \"%d\" out of range (16 to 2047)",
|
||||
dx_extract);
|
||||
|
|
|
@ -875,8 +875,6 @@ static void gm_add_ecc(const char binary[], const int data_posn, const int layer
|
|||
}
|
||||
data_size = block_size - ecc_size;
|
||||
|
||||
/* printf("block %d/%d: data %d / ecc %d\n", i + 1, (b1 + b2), data_size, ecc_size);*/
|
||||
|
||||
for (j = 0; j < data_size; j++) {
|
||||
data_block[j] = data[wp];
|
||||
wp++;
|
||||
|
|
|
@ -1531,7 +1531,7 @@ int ZBarcode_Encode_File(struct zint_symbol *symbol, const char *filename) {
|
|||
}
|
||||
|
||||
/* Allocate memory */
|
||||
buffer = (unsigned char *) malloc(fileLen);
|
||||
buffer = (unsigned char *) malloc((size_t) fileLen);
|
||||
if (!buffer) {
|
||||
if (file_opened) {
|
||||
(void) fclose(file);
|
||||
|
|
|
@ -1141,7 +1141,7 @@ INTERNAL int ultra(struct zint_symbol *symbol, struct zint_seg segs[], const int
|
|||
total_width = columns + 6;
|
||||
|
||||
/* Build symbol */
|
||||
pattern = (char *) z_alloca(total_height * total_width);
|
||||
pattern = (char *) z_alloca((size_t) total_height * (size_t) total_width);
|
||||
|
||||
for (i = 0; i < (total_height * total_width); i++) {
|
||||
pattern[i] = 'W';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue