MSVC corrections thanks to Norbert Szabó

This commit is contained in:
hooper114 2009-08-06 18:48:42 +00:00
parent 22dec4892c
commit 776154d3fe
7 changed files with 29 additions and 26 deletions

View File

@ -106,16 +106,16 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[])
1 = Tracker and Ascender 1 = Tracker and Ascender
2 = Tracker and Descender 2 = Tracker and Descender
3 = Tracker only */ 3 = Tracker only */
int error_number, zeroes;
int writer, i;
unsigned int loopey, reader;
char data_pattern[200]; char data_pattern[200];
char fcc[3], dpid[10]; char fcc[3], dpid[10];
unsigned int loopey, reader;
int writer, i;
strcpy (data_pattern, "");
int error_number, zeroes;
char localstr[30]; char localstr[30];
error_number = 0; error_number = 0;
strcpy (data_pattern, "");
strcpy(localstr, ""); strcpy(localstr, "");
/* Do all of the length checking first to avoid stack smashing */ /* Do all of the length checking first to avoid stack smashing */

View File

@ -375,12 +375,12 @@ int c93(struct zint_symbol *symbol, unsigned char source[])
int h, weight, c, k, values[100], error_number; int h, weight, c, k, values[100], error_number;
char buffer[100], temp[2]; char buffer[100], temp[2];
char set_copy[] = TCSET; char set_copy[] = TCSET;
strcpy(buffer, "");
int ascii_value; int ascii_value;
char dest[1000]; char dest[1000];
unsigned char local_source[47]; unsigned char local_source[47];
error_number = 0; error_number = 0;
strcpy(buffer, "");
strcpy(dest, ""); strcpy(dest, "");
ustrcpy(local_source, source); ustrcpy(local_source, source);

View File

@ -182,13 +182,13 @@ int code16k(struct zint_symbol *symbol, unsigned char source[])
unsigned int i, j, k, m, e_count, read, mx_reader, writer; unsigned int i, j, k, m, e_count, read, mx_reader, writer;
unsigned int values[160]; unsigned int values[160];
unsigned int bar_characters; unsigned int bar_characters;
strcpy(width_pattern, "");
float glyph_count; float glyph_count;
int errornum, first_sum, second_sum; int errornum, first_sum, second_sum;
int input_length; int input_length;
int gs1, c_count; int gs1, c_count;
errornum = 0; errornum = 0;
strcpy(width_pattern, "");
input_length = ustrlen(source); input_length = ustrlen(source);
if(symbol->input_mode == GS1_MODE) { gs1 = 1; } else { gs1 = 0; } if(symbol->input_mode == GS1_MODE) { gs1 = 1; } else { gs1 = 0; }

View File

@ -143,9 +143,9 @@ 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) void set_module(struct zint_symbol *symbol, int y_coord, int x_coord)
{ {
int x_char, x_sub;
if(module_is_set(symbol, y_coord, x_coord)) { return; } if(module_is_set(symbol, y_coord, x_coord)) { return; }
int x_char, x_sub;
x_char = x_coord / 7; x_char = x_coord / 7;
x_sub = 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) 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_char = x_coord / 7;
x_sub = x_coord % 7; x_sub = x_coord % 7;

View File

@ -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[]) void crc_machine(char data_prefix_bitstream[], int scheme, unsigned char source[])
{ {
int input_length, i; int input_length, i;
input_length = ustrlen(source);
char xor_register[17]; char xor_register[17];
#ifndef _MSC_VER #ifndef _MSC_VER
char precrc_bitstream[(input_length * 8) + 18]; char precrc_bitstream[(input_length * 8) + 18];
@ -51,6 +50,7 @@ void crc_machine(char data_prefix_bitstream[], int scheme, unsigned char source[
#endif #endif
int machine_cycles; int machine_cycles;
char input_bit, out1, out2, out3; char input_bit, out1, out2, out3;
input_length = ustrlen(source);
switch(scheme) { switch(scheme) {
case 11: strcpy(precrc_bitstream, "0000000100000000"); break; case 11: strcpy(precrc_bitstream, "0000000100000000"); break;
@ -1075,7 +1075,6 @@ void protect_ecc140(char protected_stream[], char unprotected_stream[])
int matrix89(struct zint_symbol *symbol, unsigned char source[]) int matrix89(struct zint_symbol *symbol, unsigned char source[])
{ {
int i, j, input_length, scheme; int i, j, input_length, scheme;
input_length = ustrlen(source);
char unprotected_stream[2210]; char unprotected_stream[2210];
char data_prefix_bitstream[31]; char data_prefix_bitstream[31];
char protected_stream[6630]; char protected_stream[6630];
@ -1086,6 +1085,7 @@ int matrix89(struct zint_symbol *symbol, unsigned char source[])
int symbol_size, hex_segment, width; int symbol_size, hex_segment, width;
int error_number; int error_number;
input_length = ustrlen(source);
error_number = 0; error_number = 0;
symbol_size = 0; symbol_size = 0;

View File

@ -388,15 +388,17 @@ int gs1_compliant(int symbology)
int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source) int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source)
{ {
int error_number, error_buffer; int error_number, error_buffer;
error_number = 0;
int input_length; int input_length;
#ifdef _MSC_VER
unsigned char* preprocessed;
#endif
input_length = ustrlen(source); input_length = ustrlen(source);
error_number = 0;
#ifndef _MSC_VER #ifndef _MSC_VER
unsigned char preprocessed[input_length]; unsigned char preprocessed[input_length];
#else #else
unsigned char* preprocessed = (unsigned char*)_alloca(input_length + 1); preprocessed = (unsigned char*)_alloca(input_length + 1);
#endif #endif
if(ustrlen(source) == 0) { if(ustrlen(source) == 0) {

View File

@ -503,12 +503,14 @@ int japan_post(struct zint_symbol *symbol, unsigned char source[])
int writer, loopey, inter_posn, i, sum, check; int writer, loopey, inter_posn, i, sum, check;
char check_char; char check_char;
char inter[23]; char inter[23];
#ifdef _MSC_VER
char* local_source;
#endif
input_length = ustrlen(source); input_length = ustrlen(source);
#ifndef _MSC_VER #ifndef _MSC_VER
char local_source[input_length + 1]; char local_source[input_length + 1];
#else #else
char* local_source = (char*)_alloca(input_length + 1); local_source = (char*)_alloca(input_length + 1);
#endif #endif
inter_posn = 0; inter_posn = 0;