From 776154d3fee22d30bd20425c4545c85fdfc828a7 Mon Sep 17 00:00:00 2001 From: hooper114 Date: Thu, 6 Aug 2009 18:48:42 +0000 Subject: [PATCH] =?UTF-8?q?MSVC=20corrections=20thanks=20to=20Norbert=20Sz?= =?UTF-8?q?ab=C3=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/auspost.c | 10 +++++----- backend/code.c | 6 +++--- backend/code16k.c | 4 ++-- backend/common.c | 11 +++++------ backend/dmatrix.c | 8 ++++---- backend/library.c | 10 ++++++---- backend/postal.c | 6 ++++-- 7 files changed, 29 insertions(+), 26 deletions(-) diff --git a/backend/auspost.c b/backend/auspost.c index e94cba03..1aa40a69 100644 --- a/backend/auspost.c +++ b/backend/auspost.c @@ -106,17 +106,17 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[]) 1 = Tracker and Ascender 2 = Tracker and Descender 3 = Tracker only */ + int error_number, zeroes; + int writer, i; + unsigned int loopey, reader; char data_pattern[200]; char fcc[3], dpid[10]; - unsigned int loopey, reader; - int writer, i; - strcpy (data_pattern, ""); - int error_number, zeroes; char localstr[30]; error_number = 0; - strcpy(localstr, ""); + strcpy (data_pattern, ""); + strcpy(localstr, ""); /* Do all of the length checking first to avoid stack smashing */ if(symbol->symbology == BARCODE_AUSPOST) { diff --git a/backend/code.c b/backend/code.c index 3fd2837e..8fc94e8b 100644 --- a/backend/code.c +++ b/backend/code.c @@ -375,13 +375,13 @@ int c93(struct zint_symbol *symbol, unsigned char source[]) int h, weight, c, k, values[100], error_number; char buffer[100], temp[2]; char set_copy[] = TCSET; - strcpy(buffer, ""); int ascii_value; char dest[1000]; unsigned char local_source[47]; error_number = 0; - strcpy(dest, ""); + strcpy(buffer, ""); + strcpy(dest, ""); ustrcpy(local_source, source); @@ -597,4 +597,4 @@ int channel_code(struct zint_symbol *symbol, unsigned char source[]) { expand(symbol, pattern); return error_number; -} \ No newline at end of file +} diff --git a/backend/code16k.c b/backend/code16k.c index 56b8e985..5fc68055 100644 --- a/backend/code16k.c +++ b/backend/code16k.c @@ -182,14 +182,14 @@ int code16k(struct zint_symbol *symbol, unsigned char source[]) unsigned int i, j, k, m, e_count, read, mx_reader, writer; unsigned int values[160]; unsigned int bar_characters; - strcpy(width_pattern, ""); float glyph_count; int errornum, first_sum, second_sum; int input_length; int gs1, c_count; errornum = 0; - input_length = ustrlen(source); + strcpy(width_pattern, ""); + input_length = ustrlen(source); if(symbol->input_mode == GS1_MODE) { gs1 = 1; } else { gs1 = 0; } diff --git a/backend/common.c b/backend/common.c index 2ea1840b..2c4a548a 100644 --- a/backend/common.c +++ b/backend/common.c @@ -143,10 +143,10 @@ int module_is_set(struct zint_symbol *symbol, int y_coord, int x_coord) void set_module(struct zint_symbol *symbol, int y_coord, int x_coord) { - if(module_is_set(symbol, y_coord, x_coord)) { return; } - - int x_char, x_sub; + int x_char, x_sub; + if(module_is_set(symbol, y_coord, x_coord)) { return; } + x_char = x_coord / 7; x_sub = x_coord % 7; @@ -163,9 +163,8 @@ void set_module(struct zint_symbol *symbol, int y_coord, int x_coord) void unset_module(struct zint_symbol *symbol, int y_coord, int x_coord) { - if(!(module_is_set(symbol, y_coord, x_coord))) { return; } - - int x_char, x_sub; + int x_char, x_sub; + if(!(module_is_set(symbol, y_coord, x_coord))) { return; } x_char = x_coord / 7; x_sub = x_coord % 7; diff --git a/backend/dmatrix.c b/backend/dmatrix.c index ac7031d5..f62c6b0f 100644 --- a/backend/dmatrix.c +++ b/backend/dmatrix.c @@ -40,7 +40,6 @@ extern int data_matrix_200(struct zint_symbol *symbol, unsigned char source[]); void crc_machine(char data_prefix_bitstream[], int scheme, unsigned char source[]) { int input_length, i; - input_length = ustrlen(source); char xor_register[17]; #ifndef _MSC_VER char precrc_bitstream[(input_length * 8) + 18]; @@ -51,7 +50,8 @@ void crc_machine(char data_prefix_bitstream[], int scheme, unsigned char source[ #endif int machine_cycles; char input_bit, out1, out2, out3; - + input_length = ustrlen(source); + switch(scheme) { case 11: strcpy(precrc_bitstream, "0000000100000000"); break; case 27: strcpy(precrc_bitstream, "0000001000000000"); break; @@ -1075,7 +1075,6 @@ void protect_ecc140(char protected_stream[], char unprotected_stream[]) int matrix89(struct zint_symbol *symbol, unsigned char source[]) { int i, j, input_length, scheme; - input_length = ustrlen(source); char unprotected_stream[2210]; char data_prefix_bitstream[31]; char protected_stream[6630]; @@ -1086,7 +1085,8 @@ int matrix89(struct zint_symbol *symbol, unsigned char source[]) int symbol_size, hex_segment, width; int error_number; - error_number = 0; + input_length = ustrlen(source); + error_number = 0; symbol_size = 0; for(i = 0; i < input_length; i++) { diff --git a/backend/library.c b/backend/library.c index 4a6d61d5..cabeff68 100644 --- a/backend/library.c +++ b/backend/library.c @@ -388,15 +388,17 @@ int gs1_compliant(int symbology) int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source) { int error_number, error_buffer; - error_number = 0; int input_length; - +#ifdef _MSC_VER + unsigned char* preprocessed; +#endif input_length = ustrlen(source); - + error_number = 0; + #ifndef _MSC_VER unsigned char preprocessed[input_length]; #else - unsigned char* preprocessed = (unsigned char*)_alloca(input_length + 1); + preprocessed = (unsigned char*)_alloca(input_length + 1); #endif if(ustrlen(source) == 0) { diff --git a/backend/postal.c b/backend/postal.c index b0510221..40f48021 100644 --- a/backend/postal.c +++ b/backend/postal.c @@ -503,12 +503,14 @@ int japan_post(struct zint_symbol *symbol, unsigned char source[]) int writer, loopey, inter_posn, i, sum, check; char check_char; char inter[23]; - +#ifdef _MSC_VER + char* local_source; +#endif input_length = ustrlen(source); #ifndef _MSC_VER char local_source[input_length + 1]; #else - char* local_source = (char*)_alloca(input_length + 1); + local_source = (char*)_alloca(input_length + 1); #endif inter_posn = 0;