Compile MS-VC6 compatible: only define variables after "{" or at top

This commit is contained in:
Harald Oehlmann 2016-07-04 12:08:08 +02:00
parent caa4bb913f
commit 188cfcdd1f
2 changed files with 17 additions and 5 deletions

View File

@ -331,6 +331,7 @@ void calculate_binary(char binary[], char mode[], int source[], int length) {
int first_byte, second_byte; int first_byte, second_byte;
int third_byte, fourth_byte; int third_byte, fourth_byte;
int glyph; int glyph;
int submode;
do { do {
block_length = 0; block_length = 0;
@ -413,7 +414,7 @@ void calculate_binary(char binary[], char mode[], int source[], int length) {
} }
} }
int submode = 1; submode = 1;
i = 0; i = 0;
@ -1283,7 +1284,6 @@ int hx_apply_bitmask(unsigned char *grid, int size) {
/* Han Xin Code - main */ /* Han Xin Code - main */
int han_xin(struct zint_symbol *symbol, const unsigned char source[], int length) { int han_xin(struct zint_symbol *symbol, const unsigned char source[], int length) {
char mode[length + 1];
int est_binlen; int est_binlen;
int ecc_level = symbol->option_1; int ecc_level = symbol->option_1;
int i, j, version, posn = 0, glyph, glyph2; int i, j, version, posn = 0, glyph, glyph2;
@ -1298,9 +1298,16 @@ int han_xin(struct zint_symbol *symbol, const unsigned char source[], int length
#ifndef _MSC_VER #ifndef _MSC_VER
int utfdata[length + 1]; int utfdata[length + 1];
int gbdata[(length + 1) * 2]; int gbdata[(length + 1) * 2];
char mode[length + 1];
#else #else
int* utfdata = (int *) _alloca((length + 1) * sizeof (int)); int* utfdata = (int *) _alloca((length + 1) * sizeof (int));
int* gbdata = (int *) _alloca(((length + 1) * 2) * sizeof (int)); int* gbdata = (int *) _alloca(((length + 1) * 2) * sizeof (int));
char* mode = (char *) _alloca((length + 1) * sizeof (char));
char* binary;
unsigned char *datastream;
unsigned char *fullstream;
unsigned char *picket_fence;
unsigned char *grid;
#endif #endif
switch (symbol->input_mode) { switch (symbol->input_mode) {
@ -1368,7 +1375,11 @@ int han_xin(struct zint_symbol *symbol, const unsigned char source[], int length
est_codewords++; est_codewords++;
} }
char binary[est_binlen + 1]; #ifndef _MSC_VER
char binary[est_binlen + 1];
#else
binary = (char *) _alloca((est_binlen + 1) * sizeof (char));;
#endif
for (i = 0; i < est_binlen + 1; i++) { for (i = 0; i < est_binlen + 1; i++) {
binary[i] = '\0'; binary[i] = '\0';
} }

View File

@ -598,7 +598,8 @@ void draw_letter(char *pixelbuf, unsigned char letter, int xposn, int yposn, int
break; break;
case 2: // bold font -> twice the regular font case 2: // bold font -> twice the regular font
{ {
char * linePtr;
max_x = 7; max_x = 7;
max_y = 14; max_y = 14;
@ -610,7 +611,7 @@ void draw_letter(char *pixelbuf, unsigned char letter, int xposn, int yposn, int
max_y = image_height - yposn - 1; max_y = image_height - yposn - 1;
} }
char * linePtr = pixelbuf + (yposn * image_width) + xposn + 1; linePtr = pixelbuf + (yposn * image_width) + xposn + 1;
for (y = 0; y < max_y; y++) { for (y = 0; y < max_y; y++) {
char * pixelPtr = linePtr; char * pixelPtr = linePtr;
int extra_dot = 0; int extra_dot = 0;