diff --git a/backend/2of5.c b/backend/2of5.c index 316697c1..b567e485 100644 --- a/backend/2of5.c +++ b/backend/2of5.c @@ -215,6 +215,7 @@ int interleaved_two_of_five(struct zint_symbol *symbol, const unsigned char sour strcpy(dest, "1111"); for (i = 0; i < length; i += 2) { + int k = 0; /* look up the bars and the spaces and put them in two strings */ strcpy(bars, ""); lookup(NEON, C25InterTable, temp[i], bars); @@ -222,7 +223,6 @@ int interleaved_two_of_five(struct zint_symbol *symbol, const unsigned char sour lookup(NEON, C25InterTable, temp[i + 1], spaces); /* then merge (interlace) the strings together */ - int k = 0; for (j = 0; j <= 4; j++) { mixed[k] = bars[j]; k++; diff --git a/backend/auspost.c b/backend/auspost.c index 5f787ffe..32ae3b28 100644 --- a/backend/auspost.c +++ b/backend/auspost.c @@ -145,7 +145,8 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt strcpy(symbol->errtxt, "402: Invalid characters in data"); return error_number; } - } else { + } else { + int zeroes; if (length > 8) { strcpy(symbol->errtxt, "403: Auspost input is too long"); return ZINT_ERROR_TOO_LONG; @@ -160,7 +161,7 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt } /* Add leading zeros as required */ - int zeroes = 8 - length; + zeroes = 8 - length; memset(localstr, '0', zeroes); localstr[8] = '\0'; } diff --git a/backend/codablock.c b/backend/codablock.c index a99a315f..9700b7a6 100644 --- a/backend/codablock.c +++ b/backend/codablock.c @@ -223,10 +223,10 @@ static int Columns2Rows(CharacterSetTable *T, unsigned char *data, const size_t /* >>> Loop until rowsCur<44 */ do { + int charCur=0; + int fOneLiner=1; /* First try one-Liner */ memset(pSet,0,dataLength*sizeof(int)); - int charCur=0; rowsCur=0; - int fOneLiner=1; /* First try one-Liner */ /* >>> Line and OneLiner-try Loop */ do{ @@ -466,11 +466,12 @@ static int Rows2Columns(CharacterSetTable *T, unsigned char *data, const size_t testColumns = 1; } - for (;;) { + for (;;) { + int errorCur; pTestList[testListSize] = testColumns; testListSize++; useColumns=testColumns; /* Make a copy because it may be modified */ - int errorCur = Columns2Rows(T, data, dataLength, &rowsCur, &useColumns, pSet, &fillings); + errorCur = Columns2Rows(T, data, dataLength, &rowsCur, &useColumns, pSet, &fillings); if (errorCur != 0) return errorCur; if (rowsCur<=rowsRequested) { diff --git a/backend/code.c b/backend/code.c index 776be7b3..2a980aec 100644 --- a/backend/code.c +++ b/backend/code.c @@ -467,9 +467,9 @@ int c93(struct zint_symbol *symbol, unsigned char source[], int length) { void CheckCharacter() { if (value == target_value) { + int i; /* Target reached - save the generated pattern */ strcpy(pattern, "11110"); - int i; for (i = 0; i < 11; i++) { char part[3]; part[0] = itoc(S[i]); diff --git a/backend/code1.c b/backend/code1.c index c2cb1d87..0f03764a 100644 --- a/backend/code1.c +++ b/backend/code1.c @@ -1404,7 +1404,8 @@ int code_one(struct zint_symbol *symbol, unsigned char source[], int length) { unsigned int data[1500], ecc[600]; unsigned int sub_data[190], sub_ecc[75]; unsigned int stream[2100]; - int data_length; + int data_length; + int data_blocks; for (i = 0; i < 1500; i++) { data[i] = 0; @@ -1444,7 +1445,7 @@ int code_one(struct zint_symbol *symbol, unsigned char source[], int length) { sub_ecc[i] = 0; } - int data_blocks = c1_blocks[size - 1]; + data_blocks = c1_blocks[size - 1]; rs_init_gf(0x12d); rs_init_code(c1_ecc_blocks[size - 1], 0); diff --git a/backend/code128.c b/backend/code128.c index b46bf422..b147e517 100644 --- a/backend/code128.c +++ b/backend/code128.c @@ -107,10 +107,11 @@ void grwp(int *indexliste) { if (*(indexliste) > 1) { int i = 1; while (i < *(indexliste)) { - if (list[1][i - 1] == list[1][i]) { + if (list[1][i - 1] == list[1][i]) { + int j; /* bring together */ list[0][i - 1] = list[0][i - 1] + list[0][i]; - int j = i + 1; + j = i + 1; /* decreace the list */ while (j < *(indexliste)) { diff --git a/backend/code16k.c b/backend/code16k.c index 9077d07c..2e796551 100644 --- a/backend/code16k.c +++ b/backend/code16k.c @@ -94,10 +94,11 @@ static void grwp16(unsigned int *indexliste) { if (*(indexliste) > 1) { int i = 1; while(i < (int)*(indexliste)) { - if (list[1][i - 1] == list[1][i]) { + if (list[1][i - 1] == list[1][i]) { + int j; /* bring together */ list[0][i - 1] = list[0][i - 1] + list[0][i]; - int j = i + 1; + j = i + 1; /* decreace the list */ while(j < (int)*(indexliste)) { @@ -694,6 +695,8 @@ int code16k(struct zint_symbol *symbol, unsigned char source[], const size_t len bar_characters += 2; for (current_row = 0; current_row < rows_needed; current_row++) { + unsigned int writer; + int flip_flop; strcpy(width_pattern, ""); strcat(width_pattern, C16KStartStop[C16KStartValues[current_row]]); @@ -704,8 +707,8 @@ int code16k(struct zint_symbol *symbol, unsigned char source[], const size_t len strcat(width_pattern, C16KStartStop[C16KStopValues[current_row]]); /* Write the information into the symbol */ - unsigned int writer = 0; - int flip_flop = 1; + writer = 0; + flip_flop = 1; for (mx_reader = 0; mx_reader < strlen(width_pattern); mx_reader++) { for (looper = 0; looper < ctoi(width_pattern[mx_reader]); looper++) { if (flip_flop == 1) { diff --git a/backend/composite.c b/backend/composite.c index ebb54271..5486f69f 100644 --- a/backend/composite.c +++ b/backend/composite.c @@ -1004,13 +1004,14 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha /* No date data */ strcat(binary_string, "11"); read_posn = 2; - } else { + } else { + long int group_val; /* Production Date (11) or Expiration Date (17) */ char date_str[4]; date_str[0] = source[2]; date_str[1] = source[3]; date_str[2] = '\0'; - long int group_val = atoi(date_str) * 384; + group_val = atoi(date_str) * 384; date_str[0] = source[4]; date_str[1] = source[5]; @@ -1119,7 +1120,11 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha test3 = 1; } - if ((test1 != -1) && (test2 != 1) && (test3 == 0)) { + if ((test1 != -1) && (test2 != 1) && (test3 == 0)) { + int next_ai_posn; + char numeric_part[4]; + int numeric_value; + int table3_letter; /* Encodation method "11" can be used */ strcat(binary_string, "11"); @@ -1145,7 +1150,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha } } - int next_ai_posn = 2 + (int)strlen(ninety); + next_ai_posn = 2 + (int)strlen(ninety); if (source[next_ai_posn] == '[') { /* There are more AIs afterwords */ @@ -1169,7 +1174,6 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha break; } - char numeric_part[4]; if (test1 == 0) { strcpy(numeric_part, "0"); } else { @@ -1179,9 +1183,9 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha numeric_part[i] = '\0'; } - int numeric_value = atoi(numeric_part); + numeric_value = atoi(numeric_part); - int table3_letter = -1; + table3_letter = -1; if (numeric_value < 31) { table3_letter = posn("BDHIJKLNPQRSTVWZ", ninety[test1]); } diff --git a/backend/dmatrix.c b/backend/dmatrix.c index b8c9aec9..ce7e440d 100644 --- a/backend/dmatrix.c +++ b/backend/dmatrix.c @@ -1240,12 +1240,13 @@ int data_matrix_200(struct zint_symbol *symbol,const unsigned char source[], con } #endif { // placement - int x, y, NC, NR, *places; + int x, y, NC, NR, *places; + unsigned char *grid; NC = W - 2 * (W / FW); NR = H - 2 * (H / FH); places = (int*) malloc(NC * NR * sizeof (int)); ecc200placement(places, NR, NC); - unsigned char *grid = (unsigned char*) malloc(W * H); + grid = (unsigned char*) malloc(W * H); memset(grid, 0, W * H); for (y = 0; y < H; y += FH) { for (x = 0; x < W; x++) @@ -1296,7 +1297,7 @@ int data_matrix_200(struct zint_symbol *symbol,const unsigned char source[], con symbol->rows = H; symbol->width = W; - + return error_number; } diff --git a/backend/emf.c b/backend/emf.c index 31199d53..018c0f45 100644 --- a/backend/emf.c +++ b/backend/emf.c @@ -743,14 +743,15 @@ int emf_plot(struct zint_symbol *symbol) { } /* Make image rectangles, circles, hexagons */ - for (this_row = 0; this_row < symbol->rows; this_row++) { + for (this_row = 0; this_row < symbol->rows; this_row++) { + float row_posn; if (symbol->row_height[this_row] == 0) { row_height = large_bar_height; } else { row_height = symbol->row_height[this_row]; } - float row_posn = 0; + row_posn = 0; for (i = 0; i < this_row; i++) { if (symbol->row_height[i] == 0) { row_posn += large_bar_height; diff --git a/backend/gridmtx.c b/backend/gridmtx.c index c7a62e18..4f72dc6c 100644 --- a/backend/gridmtx.c +++ b/backend/gridmtx.c @@ -841,6 +841,7 @@ static void gm_add_ecc(const char binary[], const size_t data_posn, const int la /* Split the data into blocks */ wp = 0; for (i = 0; i < (b1 + b2); i++) { + int data_size; if (i < b1) { block_size = n1; } else { @@ -851,7 +852,7 @@ static void gm_add_ecc(const char binary[], const size_t data_posn, const int la } else { ecc_size = e2; } - int data_size = block_size - ecc_size; + data_size = block_size - ecc_size; /* printf("block %d/%d: data %d / ecc %d\n", i + 1, (b1 + b2), data_size, ecc_size);*/ diff --git a/backend/hanxin.c b/backend/hanxin.c index e4f8f168..72dd6438 100644 --- a/backend/hanxin.c +++ b/backend/hanxin.c @@ -1254,13 +1254,14 @@ int han_xin(struct zint_symbol *symbol, const unsigned char source[], size_t len gbdata[i] = (int) source[i]; } } else { + int posn; /* Convert Unicode input to GB-18030 */ int error_number = utf8toutf16(symbol, source, utfdata, &length); if (error_number != 0) { return error_number; } - int posn = 0; + posn = 0; for (i = 0; i < length; i++) { int done = 0; gbdata[posn] = 0; diff --git a/backend/maxicode.c b/backend/maxicode.c index 59c36e7c..d896f7cb 100644 --- a/backend/maxicode.c +++ b/backend/maxicode.c @@ -621,6 +621,8 @@ int maxicode(struct zint_symbol *symbol, unsigned char local_source[], const int } if ((mode == 2) || (mode == 3)) { /* Modes 2 and 3 need data in symbol->primary */ + int countrycode; + int service; if (lp == 0) { /* Mode set manually means lp doesn't get set */ lp = strlen(symbol->primary); } @@ -659,8 +661,8 @@ int maxicode(struct zint_symbol *symbol, unsigned char local_source[], const int servicestr[2] = symbol->primary[14]; servicestr[3] = '\0'; - int countrycode = atoi(countrystr); - int service = atoi(servicestr); + countrycode = atoi(countrystr); + service = atoi(servicestr); if (mode == 2) { maxi_do_primary_2(postcode, countrycode, service); diff --git a/backend/medical.c b/backend/medical.c index ffd79c9b..0efec22c 100644 --- a/backend/medical.c +++ b/backend/medical.c @@ -280,8 +280,9 @@ int code32(struct zint_symbol *symbol, unsigned char source[], int length) { /* Convert from decimal to base-32 */ devisor = 33554432; for (i = 5; i >= 0; i--) { + long int remainder; codeword[i] = pharmacode / devisor; - long int remainder = pharmacode % devisor; + remainder = pharmacode % devisor; pharmacode = remainder; devisor /= 32; } diff --git a/backend/pdf417.c b/backend/pdf417.c index df1deb03..6711bfba 100644 --- a/backend/pdf417.c +++ b/backend/pdf417.c @@ -107,9 +107,10 @@ void regroupe(int *indexliste) { int i = 1; while (i < *(indexliste)) { if (liste[1][i - 1] == liste[1][i]) { + int j; /* bring together */ liste[0][i - 1] = liste[0][i - 1] + liste[0][i]; - int j = i + 1; + j = i + 1; /* decreace the list */ while (j < *(indexliste)) { @@ -426,6 +427,7 @@ void byteprocess(int *chainemc, int *mclength, unsigned char chaine[], int start printf("913 %d\n", chainemc[*mclength - 1]); } } else { + int len; /* select the switch for multiple of 6 bytes */ if (length % 6 == 0) { chainemc[(*mclength)++] = 924; @@ -435,17 +437,18 @@ void byteprocess(int *chainemc, int *mclength, unsigned char chaine[], int start if (debug) printf("901 "); } - int len = 0; + len = 0; - while (len < length) { + while (len < length) { + uint64_t total; unsigned int chunkLen = length - len; if (6 <= chunkLen) /* Take groups of 6 */ { chunkLen = 6; len += chunkLen; #if defined(_MSC_VER) && _MSC_VER == 1200 - uint64_t total = 0; + total = 0; #else - uint64_t total = 0ULL; + total = 0ULL; #endif while (chunkLen--) { @@ -494,9 +497,10 @@ void numbprocess(int *chainemc, int *mclength, char chaine[], int start, int len j = 0; while (j < length) { + int longueur; int dumlength = 0; strcpy(chainemod, ""); - int longueur = length - j; + longueur = length - j; if (longueur > 44) { longueur = 44; } diff --git a/backend/png.c b/backend/png.c index 12fe6762..719a3a98 100644 --- a/backend/png.c +++ b/backend/png.c @@ -154,6 +154,7 @@ int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) { /* Pixel Plotting */ for (row = 0; row < symbol->bitmap_height; row++) { + unsigned char *image_data; for (column = 0; column < symbol->bitmap_width; column++) { i = column * 3; switch (*(pixelbuf + (symbol->bitmap_width * row) + column)) { @@ -171,7 +172,7 @@ int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) { } } /* write row contents to file */ - unsigned char *image_data = outdata; + image_data = outdata; png_write_row(png_ptr, image_data); } diff --git a/backend/ps.c b/backend/ps.c index c4bcddf7..1ac8066f 100644 --- a/backend/ps.c +++ b/backend/ps.c @@ -404,13 +404,14 @@ int ps_plot(struct zint_symbol *symbol) { int addon_latch = 0; for (r = 0; r < symbol->rows; r++) { + float row_posn; int this_row = symbol->rows - r - 1; /* invert r otherwise plots upside down */ if (symbol->row_height[this_row] == 0) { row_height = large_bar_height; } else { row_height = symbol->row_height[this_row]; } - float row_posn = 0; + row_posn = 0; for (i = 0; i < r; i++) { if (symbol->row_height[symbol->rows - i - 1] == 0) { row_posn += large_bar_height; diff --git a/backend/qr.c b/backend/qr.c index f2f70709..7b7e54d4 100644 --- a/backend/qr.c +++ b/backend/qr.c @@ -1422,8 +1422,8 @@ int qr_code(struct zint_symbol *symbol, const unsigned char source[], size_t len if (utfdata[i] <= 0xff) { jisdata[i] = utfdata[i]; } else { + int glyph = 0; j = 0; - int glyph = 0; do { if (sjis_lookup[j * 2] == utfdata[i]) { glyph = sjis_lookup[(j * 2) + 1]; @@ -1648,12 +1648,13 @@ static int micro_qr_intermediate(char binary[], const int jisdata[], const char } do { + char data_block; + int short_data_block_length = 0; if (strlen(binary) > 128) { return ZINT_ERROR_TOO_LONG; } - char data_block = mode[position]; - int short_data_block_length = 0; + data_block = mode[position]; do { short_data_block_length++; } while (((short_data_block_length + position) < length) && (mode[position + short_data_block_length] == data_block)); @@ -2586,8 +2587,8 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], size_t len if (utfdata[i] <= 0xff) { jisdata[i] = utfdata[i]; } else { + int glyph = 0; j = 0; - int glyph = 0; do { if (sjis_lookup[j * 2] == utfdata[i]) { glyph = sjis_lookup[(j * 2) + 1]; diff --git a/backend/raster.c b/backend/raster.c index 8d77e8a0..47875494 100644 --- a/backend/raster.c +++ b/backend/raster.c @@ -282,13 +282,13 @@ void draw_letter(char *pixelbuf, unsigned char letter, int xposn, int yposn, int if (skip == 0) { int glyph_no; + int x, y; if (letter > 128) { glyph_no = letter - 66; } else { glyph_no = letter - 33; } - int x, y; switch (textflags) { int max_x, max_y; @@ -816,16 +816,18 @@ int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_t /* Plot the body of the symbol to the pixel buffer */ for (r = 0; r < symbol->rows; r++) { + int plot_yposn; + int plot_height; int this_row = symbol->rows - r - 1; /* invert r otherwise plots upside down */ row_posn += row_height; - int plot_yposn = next_yposn; + plot_yposn = next_yposn; if (symbol->row_height[this_row] == 0) { row_height = large_bar_height; } else { row_height = symbol->row_height[this_row]; } next_yposn = (int) (row_posn + row_height); - int plot_height = next_yposn - plot_yposn; + plot_height = next_yposn - plot_yposn; i = 0; if (module_is_set(symbol, this_row, 0)) { diff --git a/backend/render.c b/backend/render.c index 066fc98d..c0ebec7c 100644 --- a/backend/render.c +++ b/backend/render.c @@ -330,13 +330,13 @@ int render_plot(struct zint_symbol *symbol, const float width, const float heigh } if (symbol->symbology == BARCODE_MAXICODE) { + struct zint_render_ring *ring; /* Maxicode is a fixed size */ scaler = GL_CONST; /* Converts from millimeters to the scale used by glabels */ render->width = 28.16 * scaler; render->height = 26.86 * scaler; /* Central bullseye pattern */ - struct zint_render_ring *ring; ring = render_plot_create_ring(13.64 * scaler, 13.43 * scaler, 0.85 * scaler, 0.67 * scaler); render_plot_add_ring(symbol, ring, &last_ring); ring = render_plot_create_ring(13.64 * scaler, 13.43 * scaler, 2.20 * scaler, 0.67 * scaler); diff --git a/backend/rss.c b/backend/rss.c index 2e7a5a9f..1b4feff8 100644 --- a/backend/rss.c +++ b/backend/rss.c @@ -428,6 +428,9 @@ int rss14(struct zint_symbol *symbol, unsigned char source[], int src_len) { /* Put this data into the symbol */ if ((symbol->symbology == BARCODE_RSS14) || (symbol->symbology == BARCODE_RSS14_CC)) { + int count; + int check_digit; + char hrt[15]; writer = 0; latch = '0'; for (i = 0; i < 46; i++) { @@ -486,9 +489,8 @@ int rss14(struct zint_symbol *symbol, unsigned char source[], int src_len) { } symbol->rows = symbol->rows + 1; - int count = 0; - int check_digit = 0; - char hrt[15]; + count = 0; + check_digit = 0; /* Calculate check digit from Annex A and place human readable text */ ustrcpy(symbol->text, (unsigned char*) "(01)"); @@ -1066,8 +1068,9 @@ int general_rules(char type[]) { block[1][block_count] = type[0]; for (i = 1; i < strlen(type); i++) { + char last; current = type[i]; - char last = type[i - 1]; + last = type[i - 1]; if (current == last) { block[0][block_count] = block[0][block_count] + 1; @@ -1081,8 +1084,9 @@ int general_rules(char type[]) { block_count++; for (i = 0; i < block_count; i++) { + char next; current = block[1][i]; - char next = (block[1][i + 1] & 0xFF); + next = (block[1][i + 1] & 0xFF); if ((current == ISOIEC) && (i != (block_count - 1))) { if ((next == ANY_ENC) && (block[0][i + 1] >= 4)) { @@ -2095,6 +2099,8 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len) } } else { + int stack_rows; + int current_row, current_block, left_to_right; /* RSS Expanded Stacked */ /* Bug corrected: Character missing for message @@ -2114,23 +2120,24 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len) symbol->option_2 = 2; } - int stack_rows = codeblocks / symbol->option_2; + stack_rows = codeblocks / symbol->option_2; if (codeblocks % symbol->option_2 > 0) { stack_rows++; } - int current_row, current_block = 0, left_to_right; + current_block = 0; for (current_row = 1; current_row <= stack_rows; current_row++) { + int special_case_row = 0; + int elements_in_sub; int sub_elements[235]; for (i = 0; i < 235; i++) { sub_elements[i] = 0; } - int special_case_row = 0; /* Row Start */ sub_elements[0] = 1; // left guard sub_elements[1] = 1; - int elements_in_sub = 2; + elements_in_sub = 2; /* Row Data */ reader = 0; diff --git a/backend_tcl/zint.c b/backend_tcl/zint.c index 009e68ed..17792d5c 100644 --- a/backend_tcl/zint.c +++ b/backend_tcl/zint.c @@ -347,26 +347,26 @@ EXPORT int Zint_Init (Tcl_Interp *interp) { /*------------------------------------------------------------------------*/ #ifdef USE_TCL_STUBS - if (Tcl_InitStubs(Interp, "8.1", 0) == NULL) + if (Tcl_InitStubs(interp, "8.1", 0) == NULL) #else - if (Tcl_PkgRequire(Interp, "Tcl", "8.1", 0) == NULL) + if (Tcl_PkgRequire(interp, "Tcl", "8.1", 0) == NULL) #endif { return TCL_ERROR; } /*------------------------------------------------------------------------*/ #ifdef USE_TK_STUBS - if (Tk_InitStubs(Interp, "8.1", 0) == NULL) + if (Tk_InitStubs(interp, "8.1", 0) == NULL) #else - if (Tcl_PkgRequire(Interp, "Tk", "8.1", 0) == NULL) + if (Tcl_PkgRequire(interp, "Tk", "8.1", 0) == NULL) #endif { return TCL_ERROR; } /*------------------------------------------------------------------------*/ - Tcl_CreateObjCommand(Interp, "zint", Zint, (ClientData)NULL, + Tcl_CreateObjCommand(interp, "zint", Zint, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); - Tcl_PkgProvide (Interp, "zint", version_string); + Tcl_PkgProvide (interp, "zint", version_string); /*------------------------------------------------------------------------*/ return TCL_OK; }