mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
MSVC corrections thanks to Norbert Szabó
This commit is contained in:
parent
776154d3fe
commit
f48a8603e8
@ -664,7 +664,11 @@ int aztec(struct zint_symbol *symbol, unsigned char source[])
|
||||
int err_code, ecc_level, compact, data_length, data_maxsize, codeword_size, adjusted_length;
|
||||
int remainder, padbits, count, gs1, adjustment_size;
|
||||
int debug = 0;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
unsigned int* data_part;
|
||||
unsigned int* ecc_part;
|
||||
#endif
|
||||
|
||||
memset(binary_string,0,20000);
|
||||
memset(adjusted_string,0,20000);
|
||||
|
||||
@ -953,8 +957,8 @@ int aztec(struct zint_symbol *symbol, unsigned char source[])
|
||||
#ifndef _MSC_VER
|
||||
unsigned int data_part[data_blocks + 3], ecc_part[ecc_blocks + 3];
|
||||
#else
|
||||
unsigned int* data_part = (unsigned int*)_alloca((data_blocks + 3) * sizeof(unsigned int));
|
||||
unsigned int* ecc_part = (unsigned int*)_alloca((ecc_blocks + 3) * sizeof(unsigned int));
|
||||
data_part = (unsigned int*)_alloca((data_blocks + 3) * sizeof(unsigned int));
|
||||
ecc_part = (unsigned int*)_alloca((ecc_blocks + 3) * sizeof(unsigned int));
|
||||
#endif
|
||||
/* Copy across data into separate integers */
|
||||
memset(data_part,0,(data_blocks + 2)*sizeof(int));
|
||||
|
@ -61,12 +61,12 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[]);
|
||||
|
||||
static UINT pwr928[69][7];
|
||||
|
||||
int min(int first, int second) {
|
||||
if(first <= second) {
|
||||
return first;
|
||||
} else {
|
||||
return second;
|
||||
}
|
||||
int _min(int first, int second) {
|
||||
|
||||
if(first <= second)
|
||||
return first;
|
||||
else
|
||||
return second;
|
||||
}
|
||||
|
||||
/* gets bit in bitString at bitPos */
|
||||
@ -98,7 +98,7 @@ void init928(void) {
|
||||
int encode928(UINT bitString[], UINT codeWords[], int bitLng) {
|
||||
int i, j, b, bitCnt, cwNdx, cwCnt, cwLng;
|
||||
for (cwNdx = cwLng = b = 0; b < bitLng; b += 69, cwNdx += 7) {
|
||||
bitCnt = min(bitLng-b, 69);
|
||||
bitCnt = _min(bitLng-b, 69);
|
||||
cwLng += cwCnt = bitCnt/10 + 1;
|
||||
for (i = 0; i < cwCnt; i++)
|
||||
codeWords[cwNdx+i] = 0; /* init 0 */
|
||||
|
@ -771,7 +771,6 @@ void add_tail(unsigned char target[], int tp, int tail_length, int last_mode)
|
||||
int data_matrix_200(struct zint_symbol *symbol, unsigned char source[])
|
||||
{
|
||||
int inputlen, i;
|
||||
inputlen = ustrlen(source);
|
||||
unsigned char binary[2000];
|
||||
int binlen;
|
||||
int symbolsize, optionsize, calcsize;
|
||||
@ -779,6 +778,7 @@ int data_matrix_200(struct zint_symbol *symbol, unsigned char source[])
|
||||
int H, W, FH, FW, datablock, bytes, rsblock;
|
||||
int last_mode;
|
||||
unsigned char *grid = 0;
|
||||
inputlen = ustrlen(source);
|
||||
|
||||
binlen = dm200encode(symbol, source, binary, &last_mode);
|
||||
if(binlen == 0) {
|
||||
|
@ -41,16 +41,22 @@ void crc_machine(char data_prefix_bitstream[], int scheme, unsigned char source[
|
||||
{
|
||||
int input_length, i;
|
||||
char xor_register[17];
|
||||
int machine_cycles;
|
||||
char input_bit, out1, out2, out3;
|
||||
#ifdef _MSC_VER
|
||||
char* precrc_bitstream;
|
||||
char* precrc_bitstream_reversed;
|
||||
#endif
|
||||
|
||||
input_length = ustrlen(source);
|
||||
|
||||
#ifndef _MSC_VER
|
||||
char precrc_bitstream[(input_length * 8) + 18];
|
||||
char precrc_bitstream_reversed[(input_length * 8) + 18];
|
||||
#else
|
||||
char* precrc_bitstream = (char*)_alloca((input_length * 8) + 18);
|
||||
char* precrc_bitstream_reversed = (char*)_alloca((input_length * 8) + 18);
|
||||
precrc_bitstream = (char*)_alloca((input_length * 8) + 18);
|
||||
precrc_bitstream_reversed = (char*)_alloca((input_length * 8) + 18);
|
||||
#endif
|
||||
int machine_cycles;
|
||||
char input_bit, out1, out2, out3;
|
||||
input_length = ustrlen(source);
|
||||
|
||||
switch(scheme) {
|
||||
case 11: strcpy(precrc_bitstream, "0000000100000000"); break;
|
||||
|
@ -309,7 +309,15 @@ int imail(struct zint_symbol *symbol, unsigned char source[])
|
||||
{
|
||||
char data_pattern[200];
|
||||
int error_number;
|
||||
|
||||
int i, j, read;
|
||||
char zip[35], tracker[35], zip_adder[11], temp[2];
|
||||
short int accum[112], x_reg[112], y_reg[112];
|
||||
unsigned char byte_array[13];
|
||||
unsigned short usps_crc;
|
||||
int codeword[10];
|
||||
unsigned short characters[10];
|
||||
short int bit_pattern[13], bar_map[130];
|
||||
|
||||
error_number = 0;
|
||||
|
||||
if(ustrlen(source) > 32) {
|
||||
@ -322,18 +330,10 @@ int imail(struct zint_symbol *symbol, unsigned char source[])
|
||||
return error_number;
|
||||
}
|
||||
|
||||
int i, j, read;
|
||||
char zip[35], tracker[35], zip_adder[11], temp[2];
|
||||
short int accum[112], x_reg[112], y_reg[112];
|
||||
strcpy(zip, "");
|
||||
strcpy(tracker, "");
|
||||
unsigned char byte_array[13];
|
||||
unsigned short usps_crc;
|
||||
int codeword[10];
|
||||
unsigned short characters[10];
|
||||
short int bit_pattern[13], bar_map[130];
|
||||
|
||||
/* separate the tracking code from the routing code */
|
||||
strcpy(zip, "");
|
||||
strcpy(tracker, "");
|
||||
|
||||
/* separate the tracking code from the routing code */
|
||||
|
||||
read = 0;
|
||||
j = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user