mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Make command line version compile with MS-VC6 and QT-Version with MS-VC8
This commit is contained in:
@ -36,6 +36,7 @@
|
||||
#include "common.h"
|
||||
#ifdef _MSC_VER
|
||||
#include <malloc.h>
|
||||
#define inline _inline
|
||||
#endif
|
||||
|
||||
static const char *C25MatrixTable[10] = {"113311", "311131", "131131", "331111", "113131", "313111",
|
||||
|
@ -53,6 +53,9 @@ static const char *AusBarTable[64] = {"000", "001", "002", "003", "010", "011",
|
||||
#include <stdlib.h>
|
||||
#include "common.h"
|
||||
#include "reedsol.h"
|
||||
#ifdef _MSC_VER
|
||||
#define inline _inline
|
||||
#endif
|
||||
|
||||
static inline char convert_pattern(char data, int shift)
|
||||
{
|
||||
|
@ -679,6 +679,8 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
unsigned char local_source[length + 1];
|
||||
#else
|
||||
unsigned char* local_source = (unsigned char*)_alloca(length + 1);
|
||||
unsigned int* data_part;
|
||||
unsigned int* ecc_part;
|
||||
#endif
|
||||
|
||||
memset(binary_string,0,20000);
|
||||
@ -1014,8 +1016,8 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
#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));
|
||||
|
@ -927,6 +927,7 @@ int grid_matrix(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
int utfdata[length + 1];
|
||||
int gbdata[length + 1];
|
||||
#else
|
||||
char* grid;
|
||||
int* utfdata = (int *)_alloca((length + 1) * sizeof(int));
|
||||
int* gbdata = (int *)_alloca((length + 1) * sizeof(int));
|
||||
#endif
|
||||
@ -1050,7 +1051,7 @@ int grid_matrix(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
#ifndef _MSC_VER
|
||||
char grid[size * size];
|
||||
#else
|
||||
char* grid = (char *)_alloca((size * size) * sizeof(char));
|
||||
grid = (char *)_alloca((size * size) * sizeof(char));
|
||||
#endif
|
||||
|
||||
for(x = 0; x < size; x++) {
|
||||
|
@ -596,6 +596,9 @@ int reduced_charset(struct zint_symbol *symbol, unsigned char *source, int lengt
|
||||
int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int length)
|
||||
{
|
||||
int error_number, error_buffer, i;
|
||||
#ifdef _MSC_VER
|
||||
unsigned char* local_source;
|
||||
#endif
|
||||
error_number = 0;
|
||||
|
||||
if(length == 0) {
|
||||
@ -613,7 +616,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
|
||||
#ifndef _MSC_VER
|
||||
unsigned char local_source[length + 1];
|
||||
#else
|
||||
unsigned char* local_source = (unsigned char*)_alloca(length + 1);
|
||||
local_source = (unsigned char*)_alloca(length + 1);
|
||||
#endif
|
||||
|
||||
/* First check the symbology field */
|
||||
|
@ -84,18 +84,19 @@ int png_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width
|
||||
{
|
||||
struct mainprog_info_type wpng_info;
|
||||
struct mainprog_info_type *graphic;
|
||||
png_structp png_ptr;
|
||||
png_infop info_ptr;
|
||||
unsigned char *image_data;
|
||||
int i, row, column, errno;
|
||||
int fgred, fggrn, fgblu, bgred, bggrn, bgblu;
|
||||
|
||||
#ifndef _MSC_VER
|
||||
unsigned char outdata[image_width * 3];
|
||||
#else
|
||||
unsigned char* outdata = (unsigned char*)_alloca(image_width * 3);
|
||||
#endif
|
||||
png_structp png_ptr;
|
||||
png_infop info_ptr;
|
||||
|
||||
graphic = &wpng_info;
|
||||
unsigned char *image_data;
|
||||
int i, row, column, errno;
|
||||
int fgred, fggrn, fgblu, bgred, bggrn, bgblu;
|
||||
|
||||
switch(rotate_angle) {
|
||||
case 0:
|
||||
@ -691,7 +692,7 @@ void to_latin1(unsigned char source[], unsigned char preprocessed[])
|
||||
|
||||
j = 0;
|
||||
i = 0;
|
||||
do {
|
||||
while (i < input_length) {
|
||||
if(source[i] < 128) {
|
||||
preprocessed[j] = source[i];
|
||||
j++;
|
||||
@ -708,7 +709,7 @@ void to_latin1(unsigned char source[], unsigned char preprocessed[])
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
} while (i < input_length);
|
||||
}
|
||||
preprocessed[j] = '\0';
|
||||
|
||||
return;
|
||||
|
22
backend/qr.c
22
backend/qr.c
@ -771,6 +771,8 @@ int evaluate(unsigned char *grid, int size, int pattern)
|
||||
int dark_mods;
|
||||
int percentage, k, k2;
|
||||
char str[15];
|
||||
int m;
|
||||
int smallest;
|
||||
|
||||
#ifndef _MSC_VER
|
||||
char local[size * size];
|
||||
@ -987,7 +989,7 @@ int evaluate(unsigned char *grid, int size, int pattern)
|
||||
}
|
||||
}
|
||||
percentage = 100 * (dark_mods / (size * size));
|
||||
int m=0;
|
||||
m=0;
|
||||
for(x = 0; x < 100; x+=5) {
|
||||
if(x<percentage)
|
||||
m=x;
|
||||
@ -997,7 +999,7 @@ int evaluate(unsigned char *grid, int size, int pattern)
|
||||
k=abs((m-50)/5);
|
||||
k2=abs((m+5-50)/5);
|
||||
|
||||
int smallest=k;
|
||||
smallest=k;
|
||||
if(k2<smallest)
|
||||
smallest=k2;
|
||||
|
||||
@ -1214,7 +1216,10 @@ int qr_code(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
int jisdata[length + 1];
|
||||
char mode[length + 1];
|
||||
#else
|
||||
int* utfdata = (int *)_alloca((length + 1) * sizeof(int));
|
||||
int* datastream;
|
||||
int* fullstream;
|
||||
unsigned char* grid;
|
||||
int* utfdata = (int *)_alloca((length + 1) * sizeof(int));
|
||||
int* jisdata = (int *)_alloca((length + 1) * sizeof(int));
|
||||
char* mode = (char *)_alloca(length + 1);
|
||||
#endif
|
||||
@ -1325,8 +1330,8 @@ int qr_code(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
int datastream[target_binlen + 1];
|
||||
int fullstream[qr_total_codewords[version - 1] + 1];
|
||||
#else
|
||||
int* datastream = (int *)_alloca((target_binlen + 1) * sizeof(int));
|
||||
int* fullstream = (int *)_alloca((qr_total_codewords[version - 1] + 1) * sizeof(int));
|
||||
datastream = (int *)_alloca((target_binlen + 1) * sizeof(int));
|
||||
fullstream = (int *)_alloca((qr_total_codewords[version - 1] + 1) * sizeof(int));
|
||||
#endif
|
||||
|
||||
qr_binary(datastream, version, target_binlen, mode, jisdata, length, gs1, est_binlen);
|
||||
@ -1336,7 +1341,7 @@ int qr_code(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
#ifndef _MSC_VER
|
||||
unsigned char grid[size * size];
|
||||
#else
|
||||
unsigned char* grid = (unsigned char *)_alloca((size * size) * sizeof(unsigned char));
|
||||
grid = (unsigned char *)_alloca((size * size) * sizeof(unsigned char));
|
||||
#endif
|
||||
|
||||
for(i = 0; i < size; i++) {
|
||||
@ -2214,6 +2219,9 @@ int microqr(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
int binary_count[4];
|
||||
int ecc_level, autoversion, version;
|
||||
int n_count, a_count, bitmask, format, format_full;
|
||||
#ifdef _MSC_VER
|
||||
unsigned char* grid;
|
||||
#endif
|
||||
|
||||
if(length > 35) {
|
||||
strcpy(symbol->errtxt, "Input data too long");
|
||||
@ -2384,7 +2392,7 @@ int microqr(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
#ifndef _MSC_VER
|
||||
unsigned char grid[size * size];
|
||||
#else
|
||||
unsigned char* grid = (unsigned char *)_alloca((size * size) * sizeof(unsigned char));
|
||||
grid = (unsigned char *)_alloca((size * size) * sizeof(unsigned char));
|
||||
#endif
|
||||
|
||||
for(i = 0; i < size; i++) {
|
||||
|
Reference in New Issue
Block a user