Make zint compile on MS-VC6. Adopt makefiles to new file list.

This commit is contained in:
Harald Oehlmann 2019-12-05 19:19:37 +01:00
parent 5fe97772cb
commit 045a9e3b00
7 changed files with 27 additions and 21 deletions

View file

@ -171,7 +171,7 @@ static void define_mode(unsigned int gbdata[], const size_t length, char* mode,
#ifndef _MSC_VER
char char_modes[length][GM_NUM_MODES];
#else
char* char_modes = (char*) _alloca(length * GM_NUM_MODES);
char** char_modes = (char**) _alloca(length * GM_NUM_MODES);
#endif
memset(char_modes, 0, length * GM_NUM_MODES);

View file

@ -513,6 +513,22 @@ static void qr_binary(unsigned char datastream[], const int version, const int t
/* Split data into blocks, add error correction and then interleave the blocks and error correction data */
static void add_ecc(unsigned char fullstream[], const unsigned char datastream[], const int version, const int data_cw, const int blocks, int debug) {
int ecc_cw;
int short_data_block_length;
int qty_long_blocks;
int qty_short_blocks;
int ecc_block_length;
int i, j, length_this_block, posn;
#ifdef _MSC_VER
unsigned char* data_block;
unsigned char* ecc_block;
unsigned char* interleaved_data;
unsigned char* interleaved_ecc;
#endif
short_data_block_length = data_cw / blocks;
qty_long_blocks = data_cw % blocks;
qty_short_blocks = blocks - qty_long_blocks;
ecc_block_length = ecc_cw / blocks;
if (version < RMQR_VERSION) {
ecc_cw = qr_total_codewords[version - 1] - data_cw;
@ -520,11 +536,6 @@ static void add_ecc(unsigned char fullstream[], const unsigned char datastream[]
ecc_cw = rmqr_total_codewords[version - RMQR_VERSION] - data_cw;
}
int short_data_block_length = data_cw / blocks;
int qty_long_blocks = data_cw % blocks;
int qty_short_blocks = blocks - qty_long_blocks;
int ecc_block_length = ecc_cw / blocks;
int i, j, length_this_block, posn;
#ifndef _MSC_VER
unsigned char data_block[short_data_block_length + 2];
@ -532,10 +543,10 @@ static void add_ecc(unsigned char fullstream[], const unsigned char datastream[]
unsigned char interleaved_data[data_cw + 2];
unsigned char interleaved_ecc[ecc_cw + 2];
#else
unsigned char* data_block = (unsigned char *) _alloca(short_data_block_length + 2);
unsigned char* ecc_block = (unsigned char *) _alloca(ecc_block_length + 2);
unsigned char* interleaved_data = (unsigned char *) _alloca(data_cw + 2);
unsigned char* interleaved_ecc = (unsigned char *) _alloca(ecc_cw + 2);
data_block = (unsigned char *) _alloca(short_data_block_length + 2);
ecc_block = (unsigned char *) _alloca(ecc_block_length + 2);
interleaved_data = (unsigned char *) _alloca(data_cw + 2);
interleaved_ecc = (unsigned char *) _alloca(ecc_cw + 2);
#endif
posn = 0;