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,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) {

View File

@ -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);

View File

@ -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; }

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)
{
if(module_is_set(symbol, y_coord, x_coord)) { return; }
int x_char, x_sub;
if(module_is_set(symbol, y_coord, x_coord)) { return; }
int x_char, x_sub;
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;

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[])
{
int input_length, i;
input_length = ustrlen(source);
char xor_register[17];
#ifndef _MSC_VER
char precrc_bitstream[(input_length * 8) + 18];
@ -51,6 +50,7 @@ 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;
@ -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++) {

View File

@ -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) {

View File

@ -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;