diff --git a/backend/aztec.c b/backend/aztec.c index 891f9ee9..ed086b96 100644 --- a/backend/aztec.c +++ b/backend/aztec.c @@ -65,7 +65,7 @@ void insert(char binary_string[], int posn, char newbit) { * Encode input data into a binary string */ int aztec_text_process(unsigned char source[], const unsigned int src_len, char binary_string[], int gs1) { - int i, j, k, bytes; + int i, j, k, p, bytes; int curtable, newtable, lasttable, chartype, maplength, blocks, debug; #ifndef _MSC_VER int charmap[src_len * 2], typemap[src_len * 2]; @@ -630,7 +630,7 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char /* Put 00000 followed by 11-bit number of bytes less 31 */ concat(binary_string, "00000"); - for (int p = 0; p < 11; p++) { + for (p = 0; p < 11; p++) { if ((bytes - 31) & (0x400 >> p)) { concat(binary_string, "1"); } else { @@ -639,7 +639,7 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char } } else { /* Put 5-bit number of bytes */ - for (int p = 0; p < 5; p++) { + for (p = 0; p < 5; p++) { if (bytes & (0x10 >> p)) { concat(binary_string, "1"); } else { @@ -678,7 +678,7 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char if (debug) printf("%d ", charmap[i]); break; case BINARY: - for (int p = 0; p < 8; p++) { + for (p = 0; p < 8; p++) { if (charmap[i] & (0x80 >> p)) { concat(binary_string, "1"); } else { @@ -856,7 +856,7 @@ void popilate_map() { } int aztec(struct zint_symbol *symbol, unsigned char source[], int length) { - int x, y, i, j, data_blocks, ecc_blocks, layers, total_bits; + int x, y, i, j, p, data_blocks, ecc_blocks, layers, total_bits; char binary_string[20000], bit_pattern[20045], descriptor[42]; char adjusted_string[20000]; unsigned char desc_data[4], desc_ecc[6]; @@ -1255,7 +1255,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) { switch (codeword_size) { case 6: for (i = 0; i < data_blocks; i++) { - for (int p = 0; p < 6; p++) { + for (p = 0; p < 6; p++) { if (adjusted_string[i * codeword_size + p] == '1') { data_part[i] += (0x20 >> p); } @@ -1265,7 +1265,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) { rs_init_code(ecc_blocks, 1); rs_encode_long(data_blocks, data_part, ecc_part); for (i = (ecc_blocks - 1); i >= 0; i--) { - for (int p = 0; p < 6; p++) { + for (p = 0; p < 6; p++) { if (ecc_part[i] & (0x20 >> p)) { concat(adjusted_string, "1"); } else { @@ -1277,7 +1277,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) { break; case 8: for (i = 0; i < data_blocks; i++) { - for (int p = 0; p < 8; p++) { + for (p = 0; p < 8; p++) { if (adjusted_string[i * codeword_size + p] == '1') { data_part[i] += (0x80 >> p); } @@ -1287,7 +1287,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) { rs_init_code(ecc_blocks, 1); rs_encode_long(data_blocks, data_part, ecc_part); for (i = (ecc_blocks - 1); i >= 0; i--) { - for (int p = 0; p < 8; p++) { + for (p = 0; p < 8; p++) { if (ecc_part[i] & (0x80 >> p)) { concat(adjusted_string, "1"); } else { @@ -1309,7 +1309,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) { rs_init_code(ecc_blocks, 1); rs_encode_long(data_blocks, data_part, ecc_part); for (i = (ecc_blocks - 1); i >= 0; i--) { - for (int p = 0; p < 10; p++) { + for (p = 0; p < 10; p++) { if (ecc_part[i] & (0x200 >> p)) { concat(adjusted_string, "1"); } else { @@ -1321,7 +1321,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) { break; case 12: for (i = 0; i < data_blocks; i++) { - for (int p = 0; p < 12; p++) { + for (p = 0; p < 12; p++) { if (adjusted_string[i * codeword_size + p] == '1') { data_part[i] += (0x800 >> p); } @@ -1331,7 +1331,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) { rs_init_code(ecc_blocks, 1); rs_encode_long(data_blocks, data_part, ecc_part); for (i = (ecc_blocks - 1); i >= 0; i--) { - for (int p = 0; p < 12; p++) { + for (p = 0; p < 12; p++) { if (ecc_part[i] & (0x800 >> p)) { concat(adjusted_string, "1"); } else { @@ -1620,7 +1620,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) { /* Encodes Aztec runes as specified in ISO/IEC 24778:2008 Annex A */ int aztec_runes(struct zint_symbol *symbol, unsigned char source[], int length) { - int input_value, error_number, i, y, x; + int input_value, error_number, i, p, y, x; char binary_string[28]; unsigned char data_codewords[3], ecc_codewords[6]; @@ -1653,7 +1653,7 @@ int aztec_runes(struct zint_symbol *symbol, unsigned char source[], int length) } strcpy(binary_string, ""); - for (int p = 0; p < 8; p++) { + for (p = 0; p < 8; p++) { if (input_value & (0x80 >> p)) { concat(binary_string, "1"); } else { diff --git a/backend/code1.c b/backend/code1.c index da47fa11..4efcc172 100644 --- a/backend/code1.c +++ b/backend/code1.c @@ -355,7 +355,7 @@ int c1_look_ahead_test(unsigned char source[], int sourcelen, int position, int int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int target[], int length) { int current_mode, next_mode; - int sp, tp, gs1, i, j, latch; + int sp, tp, gs1, i, j, p, latch; int c40_buffer[6], c40_p; int text_buffer[6], text_p; int edi_buffer[6], edi_p; @@ -1015,7 +1015,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t /* There are three digits - convert the value to binary */ value = (100 * ctoi(source[sp])) + (10 * ctoi(source[sp + 1])) + ctoi(source[sp + 2]) + 1; - for (int p = 0; p < 10; p++) { + for (p = 0; p < 10; p++) { if (value & (0x200 >> p)) { concat(decimal_binary, "1"); } else { @@ -1032,7 +1032,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t /* Binary buffer is full - transfer to target */ - for (int p = 0; p < 8; p++) { + for (p = 0; p < 8; p++) { if (decimal_binary[p] == '1') { target1 += (0x80 >> p); } diff --git a/backend/composite.c b/backend/composite.c index b4585fb0..3886be8e 100644 --- a/backend/composite.c +++ b/backend/composite.c @@ -371,7 +371,7 @@ int cc_b(struct zint_symbol *symbol, char source[], int cc_width) { unsigned char* data_string = (unsigned char*) _alloca((strlen(source) / 8) + 3); #endif int chainemc[180], mclength; - int k, j, longueur, mccorrection[50], offset; + int k, j, p, longueur, mccorrection[50], offset; int total, dummy[5]; char codebarre[100], pattern[580]; int variant, LeftRAPStart, CentreRAPStart, RightRAPStart, StartCluster; @@ -383,7 +383,7 @@ int cc_b(struct zint_symbol *symbol, char source[], int cc_width) { binloc = i * 8; data_string[i] = 0; - for (int p = 0; p < 8; p++) { + for (p = 0; p < 8; p++) { if (source[binloc + p] == '1') { data_string[i] += (0x80 >> p); } @@ -647,7 +647,7 @@ int cc_b(struct zint_symbol *symbol, char source[], int cc_width) { /* CC-C 2D component - byte compressed PDF417 */ int cc_c(struct zint_symbol *symbol, char source[], int cc_width, int ecc_level) { - int length, i, binloc; + int length, i, p, binloc; #ifndef _MSC_VER unsigned char data_string[(strlen(source) / 8) + 4]; #else @@ -664,7 +664,7 @@ int cc_c(struct zint_symbol *symbol, char source[], int cc_width, int ecc_level) binloc = i * 8; data_string[i] = 0; - for (int p = 0; p < 8; p++) { + for (p = 0; p < 8; p++) { if (source[binloc + p] == '1') { data_string[i] += (0x80 >> p); } diff --git a/backend/gridmtx.c b/backend/gridmtx.c index d872df81..1c26e81d 100644 --- a/backend/gridmtx.c +++ b/backend/gridmtx.c @@ -313,7 +313,9 @@ int seek_forward(int gbdata[], int length, int position, int current_mode) { /* Add the length indicator for byte encoded blocks */ void add_byte_count(char binary[], int byte_count_posn, int byte_count) { - for (int p = 0; p < 8; p++) { + int p; + + for (p = 0; p < 8; p++) { if (byte_count & (0x100 >> p)) { binary[byte_count_posn + p] = '0'; } else { @@ -324,7 +326,7 @@ void add_byte_count(char binary[], int byte_count_posn, int byte_count) { /* Add a control character to the data stream */ void add_shift_char(char binary[], int shifty) { - int i, debug = 0; + int i, p, debug = 0; int glyph = 0; for (i = 0; i < 64; i++) { @@ -337,7 +339,7 @@ void add_shift_char(char binary[], int shifty) { printf("SHIFT [%d] ", glyph); } - for (int p = 0; p < 6; p++) { + for (p = 0; p < 6; p++) { if (glyph & (0x20 >> p)) { concat(binary, "1"); } else { @@ -356,7 +358,7 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) { int numbuf[3], punt = 0; int number_pad_posn, debug = 0; int byte_count_posn = 0, byte_count = 0; - int shift, i; + int shift, i, q; strcpy(binary, ""); @@ -543,8 +545,8 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) { printf("[%d] ", glyph); } - for (int p = 0; p < 13; p++) { - if (glyph & (0x1000 >> p)) { + for (q = 0; q < 13; q++) { + if (glyph & (0x1000 >> q)) { concat(binary, "1"); } else { concat(binary, "0"); @@ -617,8 +619,8 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) { printf("[%d] ", glyph); } - for (int p = 0; p < 10; p++) { - if (glyph & (0x200 >> p)) { + for (q = 0; q < 10; q++) { + if (glyph & (0x200 >> q)) { concat(binary, "1"); } else { concat(binary, "0"); @@ -631,8 +633,8 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) { printf("[%d] ", glyph); } - for (int p = 0; p < 10; p++) { - if (glyph & (0x200 >> p)) { + for (q = 0; q < 10; q++) { + if (glyph & (0x200 >> q)) { concat(binary, "1"); } else { concat(binary, "0"); @@ -659,8 +661,8 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) { if (debug) { printf("[%d] ", glyph); } - for (int p = 0; p < 8; p++) { - if (glyph & (0x80 >> p)) { + for (q = 0; q < 8; q++) { + if (glyph & (0x80 >> q)) { concat(binary, "1"); } else { concat(binary, "0"); @@ -692,8 +694,8 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) { printf("[%d] ", glyph); } - for (int p = 0; p < 6; p++) { - if (glyph & (0x20 >> p)) { + for (q = 0; q < 6; q++) { + if (glyph & (0x20 >> q)) { concat(binary, "1"); } else { concat(binary, "0"); @@ -724,8 +726,8 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) { printf("[%d] ", glyph); } - for (int p = 0; p < 5; p++) { - if (glyph & (0x10 >> p)) { + for (q = 0; q < 5; q++) { + if (glyph & (0x10 >> q)) { concat(binary, "1"); } else { concat(binary, "0"); @@ -756,8 +758,8 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) { printf("[%d] ", glyph); } - for (int p = 0; p < 5; p++) { - if (glyph & (0x10 >> p)) { + for (q = 0; q < 5; q++) { + if (glyph & (0x10 >> q)) { concat(binary, "1"); } else { concat(binary, "0"); @@ -829,7 +831,7 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) { } void gm_add_ecc(char binary[], int data_posn, int layers, int ecc_level, int word[]) { - int data_cw, i, j, wp; + int data_cw, i, j, wp, p; int n1, b1, n2, b2, e1, b3, e2; int block_size, data_size, ecc_size; int data[1320], block[130]; @@ -843,7 +845,7 @@ void gm_add_ecc(char binary[], int data_posn, int layers, int ecc_level, int wor /* Convert from binary sream to 7-bit codewords */ for (i = 0; i < data_posn; i++) { - for (int p = 0; p < 7; p++) { + for (p = 0; p < 7; p++) { if (binary[i * 7 + p] == '1') { data[i] += (0x40 >> p); }