Avoid type definition outside of blocks to be VC6 compatible.

This commit is contained in:
Harald Oehlmann 2016-02-24 08:42:15 +01:00
parent 7d6050bd3b
commit 0d7ee10ef5
3 changed files with 14 additions and 7 deletions

View File

@ -1299,7 +1299,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) {
break; break;
case 10: case 10:
for (i = 0; i < data_blocks; i++) { for (i = 0; i < data_blocks; i++) {
for(int p = 0; p < 10; p++) { for(p = 0; p < 10; p++) {
if (adjusted_string[i * codeword_size + p] == '1') { if (adjusted_string[i * codeword_size + p] == '1') {
data_part[i] += (0x200 >> p); data_part[i] += (0x200 >> p);
} }

View File

@ -465,8 +465,9 @@ void qr_binary(int datastream[], int version, int target_binlen, char mode[], in
/* Put data into 8-bit codewords */ /* Put data into 8-bit codewords */
for (i = 0; i < current_bytes; i++) { for (i = 0; i < current_bytes; i++) {
int p;
datastream[i] = 0x00; datastream[i] = 0x00;
for (int p = 0; p < 8; p++) { for (p = 0; p < 8; p++) {
if (binary[i * 8 + p] == '1') { if (binary[i * 8 + p] == '1') {
datastream[i] += (0x80 >> p); datastream[i] += (0x80 >> p);
} }
@ -1299,7 +1300,13 @@ void applyOptimisation(int version, char inputMode[], int inputLength) {
int blockCount = 0; int blockCount = 0;
int i, j; int i, j;
char currentMode = ' '; // Null char currentMode = ' '; // Null
int block;
#ifdef _MSC_VER
int* blockLength;
int* blockMode;
#endif
for (i = 0; i < inputLength; i++) { for (i = 0; i < inputLength; i++) {
if (inputMode[i] != currentMode) { if (inputMode[i] != currentMode) {
currentMode = inputMode[i]; currentMode = inputMode[i];
@ -1311,8 +1318,8 @@ void applyOptimisation(int version, char inputMode[], int inputLength) {
int blockLength[blockCount]; int blockLength[blockCount];
char blockMode[blockCount]; char blockMode[blockCount];
#else #else
int* blockLength = (int *) _alloca(blockCount * sizeof (int)); blockLength = (int *) _alloca(blockCount * sizeof (int));
int* blockMode = (int *) _alloca(blockMode * sizeof(int)); blockMode = (int *) _alloca(blockCount * sizeof(int));
#endif #endif
j = -1; j = -1;
@ -1391,7 +1398,7 @@ void applyOptimisation(int version, char inputMode[], int inputLength) {
} }
j = 0; j = 0;
for (int block = 0; block < blockCount; block++) { for (block = 0; block < blockCount; block++) {
currentMode = blockMode[block]; currentMode = blockMode[block];
for (i = 0; i < blockLength[block]; i++) { for (i = 0; i < blockLength[block]; i++) {
inputMode[j] = currentMode; inputMode[j] = currentMode;

View File

@ -2011,7 +2011,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
/* GS1 DataBar Expanded */ /* GS1 DataBar Expanded */
int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len) { int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len) {
int i, j, k, l, data_chars, vs[21], group[21], v_odd[21], v_even[21]; int i, j, k, l, p, data_chars, vs[21], group[21], v_odd[21], v_even[21];
char substring[21][14], latch; char substring[21][14], latch;
int char_widths[21][8], checksum, check_widths[8], c_group; int char_widths[21][8], checksum, check_widths[8], c_group;
int check_char, c_odd, c_even, elements[235], pattern_width, reader, writer; int check_char, c_odd, c_even, elements[235], pattern_width, reader, writer;
@ -2067,7 +2067,7 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len)
for (i = 0; i < data_chars; i++) { for (i = 0; i < data_chars; i++) {
vs[i] = 0; vs[i] = 0;
for (int p = 0; p < 12; p++) { for (p = 0; p < 12; p++) {
if (substring[i][p] == '1') { if (substring[i][p] == '1') {
vs[i] += (0x800 >> p); vs[i] += (0x800 >> p);
} }