From 0d7ee10ef54c17a657c90a81ea2c0dca7f435108 Mon Sep 17 00:00:00 2001 From: Harald Oehlmann Date: Wed, 24 Feb 2016 08:42:15 +0100 Subject: [PATCH] Avoid type definition outside of blocks to be VC6 compatible. --- backend/aztec.c | 2 +- backend/qr.c | 15 +++++++++++---- backend/rss.c | 4 ++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/backend/aztec.c b/backend/aztec.c index ed086b96..6def39b7 100644 --- a/backend/aztec.c +++ b/backend/aztec.c @@ -1299,7 +1299,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) { break; case 10: 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') { data_part[i] += (0x200 >> p); } diff --git a/backend/qr.c b/backend/qr.c index f83806ed..efbb9823 100644 --- a/backend/qr.c +++ b/backend/qr.c @@ -465,8 +465,9 @@ void qr_binary(int datastream[], int version, int target_binlen, char mode[], in /* Put data into 8-bit codewords */ for (i = 0; i < current_bytes; i++) { + int p; datastream[i] = 0x00; - for (int p = 0; p < 8; p++) { + for (p = 0; p < 8; p++) { if (binary[i * 8 + p] == '1') { datastream[i] += (0x80 >> p); } @@ -1299,7 +1300,13 @@ void applyOptimisation(int version, char inputMode[], int inputLength) { int blockCount = 0; int i, j; char currentMode = ' '; // Null + int block; +#ifdef _MSC_VER + int* blockLength; + int* blockMode; +#endif + for (i = 0; i < inputLength; i++) { if (inputMode[i] != currentMode) { currentMode = inputMode[i]; @@ -1311,8 +1318,8 @@ void applyOptimisation(int version, char inputMode[], int inputLength) { int blockLength[blockCount]; char blockMode[blockCount]; #else - int* blockLength = (int *) _alloca(blockCount * sizeof (int)); - int* blockMode = (int *) _alloca(blockMode * sizeof(int)); + blockLength = (int *) _alloca(blockCount * sizeof (int)); + blockMode = (int *) _alloca(blockCount * sizeof(int)); #endif j = -1; @@ -1391,7 +1398,7 @@ void applyOptimisation(int version, char inputMode[], int inputLength) { } j = 0; - for (int block = 0; block < blockCount; block++) { + for (block = 0; block < blockCount; block++) { currentMode = blockMode[block]; for (i = 0; i < blockLength[block]; i++) { inputMode[j] = currentMode; diff --git a/backend/rss.c b/backend/rss.c index 9b852e7b..3ec479d6 100644 --- a/backend/rss.c +++ b/backend/rss.c @@ -2011,7 +2011,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str /* GS1 DataBar Expanded */ 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; int char_widths[21][8], checksum, check_widths[8], c_group; 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++) { vs[i] = 0; - for (int p = 0; p < 12; p++) { + for (p = 0; p < 12; p++) { if (substring[i][p] == '1') { vs[i] += (0x800 >> p); }