modifications for VS2015, some

additional static/const's and a few bugfixes for HanXin and DotStream.

Patch by Michael <virtual_worlds@gmx.de>
This commit is contained in:
Robin Stuart 2016-09-05 22:06:50 +01:00
parent 8d3abf8440
commit 2c2200a7cb
31 changed files with 1639 additions and 1278 deletions

View File

@ -190,7 +190,7 @@ int logic_two_of_five(struct zint_symbol *symbol, unsigned char source[], int le
} }
/* Code 2 of 5 Interleaved */ /* Code 2 of 5 Interleaved */
int interleaved_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length) { int interleaved_two_of_five(struct zint_symbol *symbol, const unsigned char source[], size_t length) {
int i, j, k, error_number; int i, j, k, error_number;
char bars[7], spaces[7], mixed[14], dest[1000]; char bars[7], spaces[7], mixed[14], dest[1000];

View File

@ -106,7 +106,8 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt
3 = Tracker only */ 3 = Tracker only */
int error_number, zeroes; int error_number, zeroes;
int writer; int writer;
unsigned int loopey, reader, h; unsigned int loopey, reader;
size_t h;
char data_pattern[200]; char data_pattern[200];
char fcc[3] = {0, 0, 0}, dpid[10]; char fcc[3] = {0, 0, 0}, dpid[10];

View File

@ -40,10 +40,12 @@
#include "aztec.h" #include "aztec.h"
#include "reedsol.h" #include "reedsol.h"
static int AztecMap[22801];
/** /**
* Shorten the string by one character * Shorten the string by one character
*/ */
void mapshorten(int *charmap, int *typemap, int start, int length) { static void mapshorten(int *charmap, int *typemap, const int start, const int length) {
memmove(charmap + start + 1, charmap + start + 2, (length - 1) * sizeof (int)); memmove(charmap + start + 1, charmap + start + 2, (length - 1) * sizeof (int));
memmove(typemap + start + 1, typemap + start + 2, (length - 1) * sizeof (int)); memmove(typemap + start + 1, typemap + start + 2, (length - 1) * sizeof (int));
} }
@ -51,7 +53,7 @@ void mapshorten(int *charmap, int *typemap, int start, int length) {
/** /**
* Insert a character into the middle of a string at position posn * Insert a character into the middle of a string at position posn
*/ */
void insert(char binary_string[], int posn, char newbit) { static void insert(char binary_string[], const size_t posn, const char newbit) {
size_t i, end; size_t i, end;
end = strlen(binary_string); end = strlen(binary_string);
@ -64,7 +66,7 @@ void insert(char binary_string[], int posn, char newbit) {
/** /**
* Encode input data into a binary string * Encode input data into a binary string
*/ */
int aztec_text_process(unsigned char source[], const unsigned int src_len, char binary_string[], int gs1, int eci) { static int aztec_text_process(const unsigned char source[], const unsigned int src_len, char binary_string[], const int gs1, const int eci) {
int i, j, k, p, bytes; int i, j, k, p, bytes;
int curtable, newtable, lasttable, chartype, maplength, blocks, debug; int curtable, newtable, lasttable, chartype, maplength, blocks, debug;
#ifndef _MSC_VER #ifndef _MSC_VER
@ -723,10 +725,8 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
} }
/* Prevent data from obscuring reference grid */ /* Prevent data from obscuring reference grid */
int avoidReferenceGrid(int input) { static int avoidReferenceGrid(int output) {
int output;
output = input;
if (output > 10) { if (output > 10) {
output++; output++;
} }
@ -759,7 +759,7 @@ int avoidReferenceGrid(int input) {
} }
/* Calculate the position of the bits in the grid */ /* Calculate the position of the bits in the grid */
void populate_map() { static void populate_map() {
int layer, start, length, n, i; int layer, start, length, n, i;
int x, y; int x, y;
@ -930,7 +930,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) {
ecc_level = 2; ecc_level = 2;
} }
data_length = strlen(binary_string); data_length = (int) strlen(binary_string);
layers = 0; /* Keep compiler happy! */ layers = 0; /* Keep compiler happy! */
data_maxsize = 0; /* Keep compiler happy! */ data_maxsize = 0; /* Keep compiler happy! */
@ -1059,7 +1059,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) {
i++; i++;
} while (i <= (data_length + 1)); } while (i <= (data_length + 1));
adjusted_string[j] = '\0'; adjusted_string[j] = '\0';
adjusted_length = strlen(adjusted_string); adjusted_length = (int) strlen(adjusted_string);
adjustment_size = adjusted_length - data_length; adjustment_size = adjusted_length - data_length;
/* Add padding */ /* Add padding */
@ -1073,7 +1073,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) {
for (i = 0; i < padbits; i++) { for (i = 0; i < padbits; i++) {
strcat(adjusted_string, "1"); strcat(adjusted_string, "1");
} }
adjusted_length = strlen(adjusted_string); adjusted_length = (int) strlen(adjusted_string);
count = 0; count = 0;
for (i = (adjusted_length - codeword_size); i < adjusted_length; i++) { for (i = (adjusted_length - codeword_size); i < adjusted_length; i++) {
@ -1167,7 +1167,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) {
i++; i++;
} while (i <= (data_length + 1)); } while (i <= (data_length + 1));
adjusted_string[j] = '\0'; adjusted_string[j] = '\0';
adjusted_length = strlen(adjusted_string); adjusted_length = (int) strlen(adjusted_string);
remainder = adjusted_length % codeword_size; remainder = adjusted_length % codeword_size;
@ -1179,7 +1179,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) {
for (i = 0; i < padbits; i++) { for (i = 0; i < padbits; i++) {
strcat(adjusted_string, "1"); strcat(adjusted_string, "1");
} }
adjusted_length = strlen(adjusted_string); adjusted_length = (int) strlen(adjusted_string);
count = 0; count = 0;
for (i = (adjusted_length - codeword_size); i < adjusted_length; i++) { for (i = (adjusted_length - codeword_size); i < adjusted_length; i++) {

View File

@ -37,8 +37,6 @@
#define DIGIT 16 #define DIGIT 16
#define BINARY 32 #define BINARY 32
static int AztecMap[22801];
static const int CompactAztecMap[] = { static const int CompactAztecMap[] = {
/* 27 x 27 data grid */ /* 27 x 27 data grid */
609, 608, 411, 413, 415, 417, 419, 421, 423, 425, 427, 429, 431, 433, 435, 437, 439, 441, 443, 445, 447, 449, 451, 453, 455, 457, 459, 609, 608, 411, 413, 415, 417, 419, 421, 423, 425, 427, 429, 431, 433, 435, 437, 439, 441, 443, 445, 447, 449, 451, 453, 455, 457, 459,

View File

@ -69,7 +69,7 @@ int bmp_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width
if (symbol->bitmap != NULL) if (symbol->bitmap != NULL)
free(symbol->bitmap); free(symbol->bitmap);
row_size = 4 * floor((24 * symbol->bitmap_width + 31) / 32); row_size = 4 * floor((24.0 * symbol->bitmap_width + 31) / 32);
symbol->bitmap = (char *) malloc(row_size * symbol->bitmap_height); symbol->bitmap = (char *) malloc(row_size * symbol->bitmap_height);
/* sort out colour options */ /* sort out colour options */

View File

@ -703,7 +703,7 @@ int codablock(struct zint_symbol *symbol, unsigned char source[], int length) {
rows = 1; rows = 1;
} else { } else {
/* use 3/1 aspect/ratio Codablock */ /* use 3/1 aspect/ratio Codablock */
rows = ((int)floor(sqrt(dataLength)))/3; rows = ((int)floor(sqrt(1.0*dataLength)))/3;
if (rows < 1) if (rows < 1)
rows = 1; rows = 1;
else if (rows > 44) else if (rows > 44)
@ -771,7 +771,7 @@ int codablock(struct zint_symbol *symbol, unsigned char source[], int length) {
#ifndef _MSC_VER #ifndef _MSC_VER
uchar pOutput[columns * rows]; uchar pOutput[columns * rows];
#else #else
pOutput = (char *)_alloca(columns * rows * sizeof(char)); pOutput = (unsigned char *)_alloca(columns * rows * sizeof(char));
#endif #endif
pOutPos = pOutput; pOutPos = pOutput;
charCur=0; charCur=0;
@ -782,7 +782,7 @@ int codablock(struct zint_symbol *symbol, unsigned char source[], int length) {
/* >> Empty line with StartCCodeBCodeC */ /* >> Empty line with StartCCodeBCodeC */
characterSetCur=CodeC; characterSetCur=CodeC;
/* CDB Start C*/ /* CDB Start C*/
pOutPos+=sprintf(pOutPos,"\x67\x63"); pOutPos+=sprintf((char*)pOutPos,"\x67\x63");
SummeASCII(&pOutPos,rowCur+42,CodeC); SummeASCII(&pOutPos,rowCur+42,CodeC);
emptyColumns=useColumns-2; emptyColumns=useColumns-2;
while (emptyColumns>0) while (emptyColumns>0)

View File

@ -187,7 +187,7 @@ int code_11(struct zint_symbol *symbol, unsigned char source[], int length) { /*
} }
/* Code 39 */ /* Code 39 */
int c39(struct zint_symbol *symbol, unsigned char source[], int length) { int c39(struct zint_symbol *symbol, unsigned char source[], const size_t length) {
unsigned int i; unsigned int i;
unsigned int counter; unsigned int counter;
char check_digit; char check_digit;
@ -269,7 +269,7 @@ int c39(struct zint_symbol *symbol, unsigned char source[], int length) {
if ((symbol->symbology == BARCODE_LOGMARS) || (symbol->symbology == BARCODE_HIBC_39)) { if ((symbol->symbology == BARCODE_LOGMARS) || (symbol->symbology == BARCODE_HIBC_39)) {
/* LOGMARS uses wider 'wide' bars than normal Code 39 */ /* LOGMARS uses wider 'wide' bars than normal Code 39 */
counter = strlen(dest); counter = (unsigned int) strlen(dest);
for (i = 0; i < counter; i++) { for (i = 0; i < counter; i++) {
if (dest[i] == '2') { if (dest[i] == '2') {
dest[i] = '3'; dest[i] = '3';
@ -404,7 +404,7 @@ int c93(struct zint_symbol *symbol, unsigned char source[], int length) {
} }
/* Now we can check the true length of the barcode */ /* Now we can check the true length of the barcode */
h = strlen(buffer); h = (int) strlen(buffer);
if (h > 107) { if (h > 107) {
strcpy(symbol->errtxt, "Input too long"); strcpy(symbol->errtxt, "Input too long");
return ZINT_ERROR_TOO_LONG; return ZINT_ERROR_TOO_LONG;

View File

@ -140,7 +140,7 @@ int dq4bi(unsigned char source[], int sourcelen, int position) {
return 0; return 0;
} }
int c1_look_ahead_test(unsigned char source[], int sourcelen, int position, int current_mode, int gs1) { static int c1_look_ahead_test(unsigned char source[], int sourcelen, int position, int current_mode, int gs1) {
float ascii_count, c40_count, text_count, edi_count, byte_count; float ascii_count, c40_count, text_count, edi_count, byte_count;
char reduced_char; char reduced_char;
int done, best_scheme, best_count, sp; int done, best_scheme, best_count, sp;
@ -861,7 +861,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
} }
if (decimal_count != 3) { if (decimal_count != 3) {
int bits_left_in_byte, target_count; size_t bits_left_in_byte, target_count;
int sub_target; int sub_target;
/* Finish Decimal mode and go back to ASCII */ /* Finish Decimal mode and go back to ASCII */
@ -1150,7 +1150,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
} }
if (current_mode == C1_DECIMAL) { if (current_mode == C1_DECIMAL) {
int bits_left_in_byte, target_count; size_t bits_left_in_byte, target_count;
int sub_target; int sub_target;
/* Finish Decimal mode and go back to ASCII */ /* Finish Decimal mode and go back to ASCII */

View File

@ -681,7 +681,7 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length) {
} }
/* Handle EAN-128 (Now known as GS1-128) */ /* Handle EAN-128 (Now known as GS1-128) */
int ean_128(struct zint_symbol *symbol, unsigned char source[], int length) { int ean_128(struct zint_symbol *symbol, unsigned char source[], const size_t length) {
int i, j, values[170], bar_characters, read, total_sum; int i, j, values[170], bar_characters, read, total_sum;
int error_number, indexchaine, indexliste; int error_number, indexchaine, indexliste;
char set[170], mode, last_set; char set[170], mode, last_set;

View File

@ -35,16 +35,10 @@
#include "common.h" #include "common.h"
/* Local replacement for strlen() with unsigned char strings */ /* Local replacement for strlen() with unsigned char strings */
int ustrlen(const unsigned char data[]) { size_t ustrlen(const unsigned char data[]) {
return strlen((const char*) data); return strlen((const char*) data);
} }
/* Local replacement for strcpy() with unsigned char strings */
void ustrcpy(unsigned char target[], const unsigned char source[]) {
strcpy((char *) target, (const char*) source);
}
/* Converts a character 0-9 to its equivalent integer value */ /* Converts a character 0-9 to its equivalent integer value */
int ctoi(const char source) { int ctoi(const char source) {
if ((source >= '0') && (source <= '9')) if ((source >= '0') && (source <= '9'))
@ -63,7 +57,7 @@ char itoc(const int source) {
/* Converts lower case characters to upper case in a string source[] */ /* Converts lower case characters to upper case in a string source[] */
void to_upper(unsigned char source[]) { void to_upper(unsigned char source[]) {
unsigned int i, src_len = ustrlen(source); size_t i, src_len = ustrlen(source);
for (i = 0; i < src_len; i++) { for (i = 0; i < src_len; i++) {
if ((source[i] >= 'a') && (source[i] <= 'z')) { if ((source[i] >= 'a') && (source[i] <= 'z')) {
@ -73,9 +67,9 @@ void to_upper(unsigned char source[]) {
} }
/* Verifies that a string only uses valid characters */ /* Verifies that a string only uses valid characters */
int is_sane(const char test_string[], const unsigned char source[], const int length) { int is_sane(const char test_string[], const unsigned char source[], const size_t length) {
unsigned int i, j, latch; unsigned int j, latch;
unsigned int lt = strlen(test_string); size_t i, lt = strlen(test_string);
for (i = 0; i < length; i++) { for (i = 0; i < length; i++) {
latch = FALSE; latch = FALSE;
@ -95,7 +89,7 @@ int is_sane(const char test_string[], const unsigned char source[], const int le
/* Returns the position of data in set_string */ /* Returns the position of data in set_string */
int posn(const char set_string[], const char data) { int posn(const char set_string[], const char data) {
unsigned int i, n = strlen(set_string); size_t i, n = strlen(set_string);
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
if (data == set_string[i]) { if (data == set_string[i]) {
@ -107,7 +101,7 @@ int posn(const char set_string[], const char data) {
/* Replaces huge switch statements for looking up in tables */ /* Replaces huge switch statements for looking up in tables */
void lookup(const char set_string[], const char *table[], const char data, char dest[]) { void lookup(const char set_string[], const char *table[], const char data, char dest[]) {
unsigned int i, n = strlen(set_string); size_t i, n = strlen(set_string);
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
if (data == set_string[i]) { if (data == set_string[i]) {
@ -134,7 +128,7 @@ void unset_module(struct zint_symbol *symbol, const int y_coord, const int x_coo
/* Expands from a width pattern to a bit pattern */ /* Expands from a width pattern to a bit pattern */
void expand(struct zint_symbol *symbol, const char data[]) { void expand(struct zint_symbol *symbol, const char data[]) {
unsigned int reader, n = strlen(data); size_t reader, n = strlen(data);
int writer, i; int writer, i;
char latch; char latch;

View File

@ -46,17 +46,19 @@
#define NEON "0123456789" #define NEON "0123456789"
#include "zint.h" #include "zint.h"
#include <stdlib.h>
#define ustrcpy(target,source) strcpy((char*)target,(const char*)source)
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
extern int ustrlen(const unsigned char source[]); extern size_t ustrlen(const unsigned char source[]);
extern void ustrcpy(unsigned char target[], const unsigned char source[]);
extern int ctoi(const char source); extern int ctoi(const char source);
extern char itoc(const int source); extern char itoc(const int source);
extern void to_upper(unsigned char source[]); extern void to_upper(unsigned char source[]);
extern int is_sane(const char test_string[], const unsigned char source[], const int length); extern int is_sane(const char test_string[], const unsigned char source[], const size_t length);
extern void lookup(const char set_string[], const char *table[], const char data, char dest[]); extern void lookup(const char set_string[], const char *table[], const char data, char dest[]);
extern int posn(const char set_string[], const char data); extern int posn(const char set_string[], const char data);
extern void expand(struct zint_symbol *symbol, const char data[]); extern void expand(struct zint_symbol *symbol, const char data[]);

View File

@ -65,7 +65,7 @@
extern int general_rules(char field[], char type[]); extern int general_rules(char field[], char type[]);
extern int eanx(struct zint_symbol *symbol, unsigned char source[], int length); extern int eanx(struct zint_symbol *symbol, unsigned char source[], int length);
extern int ean_128(struct zint_symbol *symbol, unsigned char source[], int length); extern int ean_128(struct zint_symbol *symbol, unsigned char source[], const size_t length);
extern int rss14(struct zint_symbol *symbol, unsigned char source[], int length); extern int rss14(struct zint_symbol *symbol, unsigned char source[], int length);
extern int rsslimited(struct zint_symbol *symbol, unsigned char source[], int length); extern int rsslimited(struct zint_symbol *symbol, unsigned char source[], int length);
extern int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int length); extern int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int length);

View File

@ -306,31 +306,31 @@ static int look_ahead_test(const unsigned char inputData[], const int sourcelen,
/* step (j) */ /* step (j) */
if (current_mode == DM_ASCII) { if (current_mode == DM_ASCII) {
ascii_count = 0.0; ascii_count = 0.0F;
c40_count = 1.0; c40_count = 1.0F;
text_count = 1.0; text_count = 1.0F;
x12_count = 1.0; x12_count = 1.0F;
edf_count = 1.0; edf_count = 1.0F;
b256_count = 1.25; b256_count = 1.25F;
} else { } else {
ascii_count = 1.0; ascii_count = 1.0F;
c40_count = 2.0; c40_count = 2.0F;
text_count = 2.0; text_count = 2.0F;
x12_count = 2.0; x12_count = 2.0F;
edf_count = 2.0; edf_count = 2.0F;
b256_count = 2.25; b256_count = 2.25F;
} }
switch (current_mode) { switch (current_mode) {
case DM_C40: c40_count = 0.0; case DM_C40: c40_count = 0.0F;
break; break;
case DM_TEXT: text_count = 0.0; case DM_TEXT: text_count = 0.0F;
break; break;
case DM_X12: x12_count = 0.0; case DM_X12: x12_count = 0.0F;
break; break;
case DM_EDIFACT: edf_count = 0.0; case DM_EDIFACT: edf_count = 0.0F;
break; break;
case DM_BASE256: b256_count = 0.0; case DM_BASE256: b256_count = 0.0F;
break; break;
} }
@ -339,12 +339,12 @@ static int look_ahead_test(const unsigned char inputData[], const int sourcelen,
do { do {
if (sp == (sourcelen - 1)) { if (sp == (sourcelen - 1)) {
/* At the end of data ... step (k) */ /* At the end of data ... step (k) */
ascii_count = ceil(ascii_count); ascii_count = ceilf(ascii_count);
b256_count = ceil(b256_count); b256_count = ceilf(b256_count);
edf_count = ceil(edf_count); edf_count = ceilf(edf_count);
text_count = ceil(text_count); text_count = ceilf(text_count);
x12_count = ceil(x12_count); x12_count = ceilf(x12_count);
c40_count = ceil(c40_count); c40_count = ceilf(c40_count);
best_count = c40_count; best_count = c40_count;
best_scheme = DM_C40; // (k)(7) best_scheme = DM_C40; // (k)(7)
@ -379,9 +379,9 @@ static int look_ahead_test(const unsigned char inputData[], const int sourcelen,
ascii_count += 0.5F; // (l)(1) ascii_count += 0.5F; // (l)(1)
} else { } else {
if (inputData[sp] > 127) { if (inputData[sp] > 127) {
ascii_count = ceil(ascii_count) + 2.0F; // (l)(2) ascii_count = ceilf(ascii_count) + 2.0F; // (l)(2)
} else { } else {
ascii_count = ceil(ascii_count) + 1.0F; // (l)(3) ascii_count = ceilf(ascii_count) + 1.0F; // (l)(3)
} }
} }
@ -572,7 +572,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
if (symbol->eci > 3) { if (symbol->eci > 3) {
target[tp] = 241; /* ECI Character */ target[tp] = 241; /* ECI Character */
tp++; tp++;
target[tp] = symbol->eci + 1; target[tp] = (unsigned char) (symbol->eci + 1);
tp++; tp++;
if (debug) printf("ECI %d ", symbol->eci + 1); if (debug) printf("ECI %d ", symbol->eci + 1);
} }
@ -718,7 +718,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
int iv; int iv;
iv = (1600 * process_buffer[0]) + (40 * process_buffer[1]) + (process_buffer[2]) + 1; iv = (1600 * process_buffer[0]) + (40 * process_buffer[1]) + (process_buffer[2]) + 1;
target[tp] = iv / 256; target[tp] = (unsigned char) (iv / 256);
tp++; tp++;
target[tp] = iv % 256; target[tp] = iv % 256;
tp++; tp++;
@ -781,7 +781,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
int iv; int iv;
iv = (1600 * process_buffer[0]) + (40 * process_buffer[1]) + (process_buffer[2]) + 1; iv = (1600 * process_buffer[0]) + (40 * process_buffer[1]) + (process_buffer[2]) + 1;
target[tp] = iv / 256; target[tp] = (unsigned char) (iv / 256);
tp++; tp++;
target[tp] = iv % 256; target[tp] = iv % 256;
tp++; tp++;
@ -842,7 +842,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
int iv; int iv;
iv = (1600 * process_buffer[0]) + (40 * process_buffer[1]) + (process_buffer[2]) + 1; iv = (1600 * process_buffer[0]) + (40 * process_buffer[1]) + (process_buffer[2]) + 1;
target[tp] = iv / 256; target[tp] = (unsigned char) (iv / 256);
tp++; tp++;
target[tp] = iv % 256; target[tp] = iv % 256;
tp++; tp++;
@ -889,11 +889,11 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
} }
if (*process_p >= 4) { if (*process_p >= 4) {
target[tp] = (process_buffer[0] << 2) + ((process_buffer[1] & 0x30) >> 4); target[tp] = (unsigned char) ((process_buffer[0] << 2) + ((process_buffer[1] & 0x30) >> 4));
tp++; tp++;
target[tp] = ((process_buffer[1] & 0x0f) << 4) + ((process_buffer[2] & 0x3c) >> 2); target[tp] = ((process_buffer[1] & 0x0f) << 4) + ((process_buffer[2] & 0x3c) >> 2);
tp++; tp++;
target[tp] = ((process_buffer[2] & 0x03) << 6) + process_buffer[3]; target[tp] = (unsigned char) (((process_buffer[2] & 0x03) << 6) + process_buffer[3]);
tp++; tp++;
strcat(binary, " "); strcat(binary, " ");
if (debug) printf("[%d %d %d %d] ", process_buffer[0], process_buffer[1], process_buffer[2], process_buffer[3]); if (debug) printf("[%d %d %d %d] ", process_buffer[0], process_buffer[1], process_buffer[2], process_buffer[3]);
@ -966,9 +966,9 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
prn = ((149 * (i + 1)) % 255) + 1; prn = ((149 * (i + 1)) % 255) + 1;
temp = target[i] + prn; temp = target[i] + prn;
if (temp <= 255) { if (temp <= 255) {
target[i] = temp; target[i] = (unsigned char) (temp);
} else { } else {
target[i] = temp - 256; target[i] = (unsigned char) (temp - 256);
} }
} }
} }
@ -1126,18 +1126,18 @@ static void add_tail(unsigned char target[], int tp, const int tail_length) {
prn = ((149 * (tp + 1)) % 253) + 1; prn = ((149 * (tp + 1)) % 253) + 1;
temp = 129 + prn; temp = 129 + prn;
if (temp <= 254) { if (temp <= 254) {
target[tp] = temp; target[tp] = (unsigned char) (temp);
tp++; tp++;
} else { } else {
target[tp] = temp - 254; target[tp] = (unsigned char) (temp - 254);
tp++; tp++;
} }
} }
} }
} }
int data_matrix_200(struct zint_symbol *symbol, unsigned char source[], const int length) { int data_matrix_200(struct zint_symbol *symbol, const unsigned char source[], const int in_length) {
int inputlen, i, skew = 0; int i, inputlen = in_length, skew = 0;
unsigned char binary[2200]; unsigned char binary[2200];
int binlen; int binlen;
int process_buffer[8]; /* holds remaining data to finalised */ int process_buffer[8]; /* holds remaining data to finalised */
@ -1148,7 +1148,6 @@ int data_matrix_200(struct zint_symbol *symbol, unsigned char source[], const in
int last_mode = DM_ASCII; int last_mode = DM_ASCII;
unsigned char *grid = 0; unsigned char *grid = 0;
int symbols_left; int symbols_left;
inputlen = length;
/* inputlen may be decremented by 2 if macro character is used */ /* inputlen may be decremented by 2 if macro character is used */
binlen = dm200encode(symbol, source, binary, &last_mode, &inputlen, process_buffer, &process_p); binlen = dm200encode(symbol, source, binary, &last_mode, &inputlen, process_buffer, &process_p);
@ -1291,12 +1290,12 @@ int data_matrix_200(struct zint_symbol *symbol, unsigned char source[], const in
return error_number; return error_number;
} }
int dmatrix(struct zint_symbol *symbol, unsigned char source[], const int length) { int dmatrix(struct zint_symbol *symbol, const unsigned char source[], const int in_length) {
int error_number; int error_number;
if (symbol->option_1 <= 1) { if (symbol->option_1 <= 1) {
/* ECC 200 */ /* ECC 200 */
error_number = data_matrix_200(symbol, source, length); error_number = data_matrix_200(symbol, source, in_length);
} else { } else {
/* ECC 000 - 140 */ /* ECC 000 - 140 */
strcpy(symbol->errtxt, "Older Data Matrix standards are no longer supported"); strcpy(symbol->errtxt, "Older Data Matrix standards are no longer supported");

View File

@ -44,7 +44,7 @@
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
extern int data_matrix_200(struct zint_symbol *symbol, unsigned char source[], const int length); extern int data_matrix_200(struct zint_symbol *symbol, const unsigned char source[], const int length);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -38,11 +38,11 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include <stdint.h>
#ifndef _MSC_VER #ifndef _MSC_VER
#include <stdint.h> #include <stdint.h>
#else #else
#include <malloc.h> #include <malloc.h>
#include "ms_stdint.h"
#endif #endif
#include "common.h" #include "common.h"
#include "gs1.h" #include "gs1.h"
@ -223,7 +223,7 @@ void rsencode(int nd, int nc, unsigned char *wd) {
} }
/* Check if the next character is directly encodable in code set A (Annex F.II.D) */ /* Check if the next character is directly encodable in code set A (Annex F.II.D) */
int datum_a(unsigned char source[], int position, int length) { int datum_a(const unsigned char source[], int position, int length) {
int retval = 0; int retval = 0;
if (position < length) { if (position < length) {
@ -236,7 +236,7 @@ int datum_a(unsigned char source[], int position, int length) {
} }
/* Check if the next character is directly encodable in code set B (Annex F.II.D) */ /* Check if the next character is directly encodable in code set B (Annex F.II.D) */
int datum_b(unsigned char source[], int position, int length) { int datum_b(const unsigned char source[], int position, int length) {
int retval = 0; int retval = 0;
if (position < length) { if (position < length) {
@ -263,7 +263,7 @@ int datum_b(unsigned char source[], int position, int length) {
} }
/* Check if the next characters are directly encodable in code set C (Annex F.II.D) */ /* Check if the next characters are directly encodable in code set C (Annex F.II.D) */
int datum_c(unsigned char source[], int position, int length) { int datum_c(const unsigned char source[], int position, int length) {
int retval = 0; int retval = 0;
if (position < length - 2) { if (position < length - 2) {
@ -276,7 +276,7 @@ int datum_c(unsigned char source[], int position, int length) {
} }
/* Returns how many consecutive digits lie immediately ahead (Annex F.II.A) */ /* Returns how many consecutive digits lie immediately ahead (Annex F.II.A) */
int n_digits(unsigned char source[], int position, int length) { int n_digits(const unsigned char source[], int position, int length) {
int i; int i;
for (i = position; ((source[i] >= '0') && (source[i] <= '9')) && (i < length); i++); for (i = position; ((source[i] >= '0') && (source[i] <= '9')) && (i < length); i++);
@ -285,7 +285,7 @@ int n_digits(unsigned char source[], int position, int length) {
} }
/* checks ahead for 10 or more digits starting "17xxxxxx10..." (Annex F.II.B) */ /* checks ahead for 10 or more digits starting "17xxxxxx10..." (Annex F.II.B) */
int seventeen_ten(unsigned char source[], int position, int length) { int seventeen_ten(const unsigned char source[], int position, int length) {
int found = 0; int found = 0;
if (n_digits(source, position, length) >= 10) { if (n_digits(source, position, length) >= 10) {
@ -301,7 +301,7 @@ int seventeen_ten(unsigned char source[], int position, int length) {
/* checks how many characters ahead can be reached while datum_c is true, /* checks how many characters ahead can be reached while datum_c is true,
* returning the resulting number of codewords (Annex F.II.E) * returning the resulting number of codewords (Annex F.II.E)
*/ */
int ahead_c(unsigned char source[], int position, int length) { int ahead_c(const unsigned char source[], int position, int length) {
int count = 0; int count = 0;
int i; int i;
@ -313,7 +313,7 @@ int ahead_c(unsigned char source[], int position, int length) {
} }
/* Annex F.II.F */ /* Annex F.II.F */
int try_c(unsigned char source[], int position, int length) { int try_c(const unsigned char source[], int position, int length) {
int retval = 0; int retval = 0;
if (n_digits(source, position, length) > 0) { if (n_digits(source, position, length) > 0) {
@ -326,7 +326,7 @@ int try_c(unsigned char source[], int position, int length) {
} }
/* Annex F.II.G */ /* Annex F.II.G */
int ahead_a(unsigned char source[], int position, int length) { int ahead_a(const unsigned char source[], int position, int length) {
int count = 0; int count = 0;
int i; int i;
@ -339,7 +339,7 @@ int ahead_a(unsigned char source[], int position, int length) {
} }
/* Annex F.II.H */ /* Annex F.II.H */
int ahead_b(unsigned char source[], int position, int length) { int ahead_b(const unsigned char source[], int position, int length) {
int count = 0; int count = 0;
int i; int i;
@ -352,7 +352,7 @@ int ahead_b(unsigned char source[], int position, int length) {
} }
/* checks if the next character is in the range 128 to 255 (Annex F.II.I) */ /* checks if the next character is in the range 128 to 255 (Annex F.II.I) */
int binary(unsigned char source[], int position, int length) { int binary(const unsigned char source[], int position, int length) {
int retval = 0; int retval = 0;
if (source[position] >= 128) { if (source[position] >= 128) {
@ -363,7 +363,7 @@ int binary(unsigned char source[], int position, int length) {
} }
/* Analyse input data stream and encode using algorithm from Annex F */ /* Analyse input data stream and encode using algorithm from Annex F */
int dotcode_encode_message(struct zint_symbol *symbol, unsigned char source[], int length, unsigned char *codeword_array) { int dotcode_encode_message(struct zint_symbol *symbol, const unsigned char source[], int length, unsigned char *codeword_array) {
int input_position, array_length, i; int input_position, array_length, i;
char encoding_mode; char encoding_mode;
int inside_macro, done; int inside_macro, done;
@ -889,7 +889,7 @@ int dotcode_encode_message(struct zint_symbol *symbol, unsigned char source[], i
} }
/* Convert codewords to binary data stream */ /* Convert codewords to binary data stream */
int make_dotstream(unsigned char masked_array[], int array_length, char dot_stream[]) { static size_t make_dotstream(unsigned char masked_array[], int array_length, char dot_stream[]) {
int i, j; int i, j;
int mask = 0x100; int mask = 0x100;
@ -1035,14 +1035,15 @@ void fold_dotstream(char dot_stream[], int width, int height, char dot_array[])
} }
} }
int dotcode(struct zint_symbol *symbol, unsigned char source[], int length) { int dotcode(struct zint_symbol *symbol, const unsigned char source[], int length) {
int i, j, k; int i, j, k;
size_t jc;
int data_length, ecc_length; int data_length, ecc_length;
int min_dots, n_dots; int min_dots, n_dots;
int height, width, pad_chars; int height, width, pad_chars;
int mask_score[4]; int mask_score[4];
int weight; int weight;
int dot_stream_length; size_t dot_stream_length;
int high_score, best_mask; int high_score, best_mask;
int debug = 0; int debug = 0;
@ -1068,7 +1069,7 @@ int dotcode(struct zint_symbol *symbol, unsigned char source[], int length) {
if (symbol->option_2 == 0) { if (symbol->option_2 == 0) {
height = sqrt(2 * min_dots); height = (int) sqrt(2.0 * min_dots);
if (height % 2) { if (height % 2) {
height++; height++;
} }
@ -1096,12 +1097,15 @@ int dotcode(struct zint_symbol *symbol, unsigned char source[], int length) {
n_dots = (height * width) / 2; n_dots = (height * width) / 2;
#ifndef _MSC_VER #ifndef _MSC_VER
char dot_stream[n_dots + 3]; char dot_stream[height * width * 3];
char dot_array[width * height]; char dot_array[width * height * sizeof (char) ];
#else #else
dot_stream = (char *) _alloca((n_dots + 3) * sizeof (char)); dot_stream = (char *) _alloca(height * width * 3);
if (!dot_stream) return ZINT_ERROR_MEMORY;
dot_array = (char *) _alloca(width * height * sizeof (char)); dot_array = (char *) _alloca(width * height * sizeof (char));
#endif /* _MSC_VER */ if (!dot_array) return ZINT_ERROR_MEMORY;
#endif
/* Add pad characters */ /* Add pad characters */
for (pad_chars = 0; 9 * ((data_length + pad_chars + 3 + ((data_length + pad_chars) / 2)) + 2) < n_dots; pad_chars++); for (pad_chars = 0; 9 * ((data_length + pad_chars + 3 + ((data_length + pad_chars) / 2)) + 2) < n_dots; pad_chars++);
@ -1166,7 +1170,7 @@ int dotcode(struct zint_symbol *symbol, unsigned char source[], int length) {
dot_stream_length = make_dotstream(masked_codeword_array, (data_length + ecc_length + 1), dot_stream); dot_stream_length = make_dotstream(masked_codeword_array, (data_length + ecc_length + 1), dot_stream);
/* Add pad bits */ /* Add pad bits */
for (j = dot_stream_length; j < n_dots; j++) { for (jc = dot_stream_length; jc < n_dots; jc++) {
strcat(dot_stream, "1"); strcat(dot_stream, "1");
} }
@ -1220,7 +1224,7 @@ int dotcode(struct zint_symbol *symbol, unsigned char source[], int length) {
dot_stream_length = make_dotstream(masked_codeword_array, (data_length + ecc_length + 1), dot_stream); dot_stream_length = make_dotstream(masked_codeword_array, (data_length + ecc_length + 1), dot_stream);
/* Add pad bits */ /* Add pad bits */
for (j = dot_stream_length; j < n_dots; j++) { for (jc = dot_stream_length; jc < n_dots; jc++) {
strcat(dot_stream, "1"); strcat(dot_stream, "1");
} }

View File

@ -31,8 +31,12 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include "eci.h" #include "eci.h"
#include "zint.h" #include "zint.h"
#ifdef _MSC_VER
#include <malloc.h>
#endif
/* Convert Unicode to other character encodings */ /* Convert Unicode to other character encodings */
int utf_to_eci(int eci, const unsigned char source[], unsigned char dest[], int *length) { int utf_to_eci(int eci, const unsigned char source[], unsigned char dest[], int *length) {

View File

@ -36,7 +36,7 @@
extern "C" { extern "C" {
#endif #endif
static int iso_8859_1[] = { // Latin alphabet No. 1 static const int iso_8859_1[] = {// Latin alphabet No. 1
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
@ -47,7 +47,7 @@ static int iso_8859_1[] = { // Latin alphabet No. 1
0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff
}; };
static int iso_8859_2[] = { // Latin alphabet No. 2 static const int iso_8859_2[] = {// Latin alphabet No. 2
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x00a0, 0x0104, 0x02d8, 0x0141, 0x00a4, 0x013d, 0x015a, 0x00a7, 0x00a8, 0x0160, 0x015e, 0x0164, 0x0179, 0x00ad, 0x017d, 0x017b, 0x00a0, 0x0104, 0x02d8, 0x0141, 0x00a4, 0x013d, 0x015a, 0x00a7, 0x00a8, 0x0160, 0x015e, 0x0164, 0x0179, 0x00ad, 0x017d, 0x017b,
@ -58,7 +58,7 @@ static int iso_8859_2[] = { // Latin alphabet No. 2
0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7, 0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9 0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7, 0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9
}; };
static int iso_8859_3[] = { // Latin alphabet No. 3 static const int iso_8859_3[] = {// Latin alphabet No. 3
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x00a0, 0x0126, 0x02d8, 0x00a3, 0x00a4, 0x0000, 0x0124, 0x00a7, 0x00a8, 0x0130, 0x015e, 0x011e, 0x0134, 0x00ad, 0x0000, 0x017b, 0x00a0, 0x0126, 0x02d8, 0x00a3, 0x00a4, 0x0000, 0x0124, 0x00a7, 0x00a8, 0x0130, 0x015e, 0x011e, 0x0134, 0x00ad, 0x0000, 0x017b,
@ -69,7 +69,7 @@ static int iso_8859_3[] = { // Latin alphabet No. 3
0x0000, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x0121, 0x00f6, 0x00f7, 0x011d, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x016d, 0x015d, 0x02d9 0x0000, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x0121, 0x00f6, 0x00f7, 0x011d, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x016d, 0x015d, 0x02d9
}; };
static int iso_8859_4[] = { // Latin alphabet No. 4 static const int iso_8859_4[] = {// Latin alphabet No. 4
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x00a0, 0x0104, 0x0138, 0x0156, 0x00a4, 0x012b, 0x013b, 0x00a7, 0x00a8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00ad, 0x017d, 0x00af, 0x00a0, 0x0104, 0x0138, 0x0156, 0x00a4, 0x012b, 0x013b, 0x00a7, 0x00a8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00ad, 0x017d, 0x00af,
@ -80,7 +80,7 @@ static int iso_8859_4[] = { // Latin alphabet No. 4
0x0111, 0x0146, 0x014d, 0x0137, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x0169, 0x016b, 0x02d9 0x0111, 0x0146, 0x014d, 0x0137, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x0169, 0x016b, 0x02d9
}; };
static int iso_8859_5[] = { // Latin/Cyrillic alphabet static const int iso_8859_5[] = {// Latin/Cyrillic alphabet
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x00a0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x00ad, 0x040e, 0x040f, 0x00a0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x00ad, 0x040e, 0x040f,
@ -91,7 +91,7 @@ static int iso_8859_5[] = { // Latin/Cyrillic alphabet
0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x00a7, 0x045e, 0x045f 0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x00a7, 0x045e, 0x045f
}; };
static int iso_8859_6[] = { // Latin/Arabic alphabet static const int iso_8859_6[] = {// Latin/Arabic alphabet
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x00a0, 0x0000, 0x0000, 0x0000, 0x00a4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x060c, 0x00ad, 0x0000, 0x0000, 0x00a0, 0x0000, 0x0000, 0x0000, 0x00a4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x060c, 0x00ad, 0x0000, 0x0000,
@ -102,7 +102,7 @@ static int iso_8859_6[] = { // Latin/Arabic alphabet
0x0650, 0x0651, 0x0652, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 0x0650, 0x0651, 0x0652, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
}; };
static int iso_8859_7[] = { // Latin/Greek alphabet static const int iso_8859_7[] = {// Latin/Greek alphabet
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x00a0, 0x2018, 0x2019, 0x00a3, 0x20ac, 0x20af, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x037a, 0x00ab, 0x00ac, 0x00ad, 0x0000, 0x2015, 0x00a0, 0x2018, 0x2019, 0x00a3, 0x20ac, 0x20af, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x037a, 0x00ab, 0x00ac, 0x00ad, 0x0000, 0x2015,
@ -113,7 +113,7 @@ static int iso_8859_7[] = { // Latin/Greek alphabet
0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, 0x03ca, 0x03cb, 0x03cc, 0x03cd, 0x03ce, 0x0000 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, 0x03ca, 0x03cb, 0x03cc, 0x03cd, 0x03ce, 0x0000
}; };
static int iso_8859_8[] = { // Latin/Hebrew alphabet static const int iso_8859_8[] = {// Latin/Hebrew alphabet
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x00a0, 0x0000, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00d7, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, 0x00a0, 0x0000, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00d7, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
@ -124,7 +124,7 @@ static int iso_8859_8[] = { // Latin/Hebrew alphabet
0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, 0x05e8, 0x05e9, 0x05ea, 0x0000, 0x0000, 0x200e, 0x200f, 0x0000 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, 0x05e8, 0x05e9, 0x05ea, 0x0000, 0x0000, 0x200e, 0x200f, 0x0000
}; };
static int iso_8859_9[] = { // Latin alphabet No. 5 static const int iso_8859_9[] = {// Latin alphabet No. 5
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
@ -135,7 +135,7 @@ static int iso_8859_9[] = { // Latin alphabet No. 5
0x011f, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0131, 0x015f, 0x00ff 0x011f, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0131, 0x015f, 0x00ff
}; };
static int iso_8859_10[] = { // Latin alphabet No. 6 static const int iso_8859_10[] = {// Latin alphabet No. 6
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x00a0, 0x0104, 0x0112, 0x0122, 0x012a, 0x012b, 0x0136, 0x00a7, 0x013b, 0x0110, 0x0160, 0x0166, 0x017d, 0x00ad, 0x016a, 0x014a, 0x00a0, 0x0104, 0x0112, 0x0122, 0x012a, 0x012b, 0x0136, 0x00a7, 0x013b, 0x0110, 0x0160, 0x0166, 0x017d, 0x00ad, 0x016a, 0x014a,
@ -146,7 +146,7 @@ static int iso_8859_10[] = { // Latin alphabet No. 6
0x00f0, 0x0146, 0x014d, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x0169, 0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x0138 0x00f0, 0x0146, 0x014d, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x0169, 0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x0138
}; };
static int iso_8859_11[] = { // Latin/Thai alphabet static const int iso_8859_11[] = {// Latin/Thai alphabet
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x00a0, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, 0x00a0, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f,
@ -157,7 +157,7 @@ static int iso_8859_11[] = { // Latin/Thai alphabet
0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, 0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0x0000, 0x0000, 0x0000, 0x0000 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, 0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0x0000, 0x0000, 0x0000, 0x0000
}; };
static int iso_8859_13[] = { // Latin alphabet No. 7 static const int iso_8859_13[] = {// Latin alphabet No. 7
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x00a0, 0x201d, 0x00a2, 0x00a3, 0x00a4, 0x201e, 0x00a6, 0x00a7, 0x00d8, 0x00a9, 0x0156, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00c6, 0x00a0, 0x201d, 0x00a2, 0x00a3, 0x00a4, 0x201e, 0x00a6, 0x00a7, 0x00d8, 0x00a9, 0x0156, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00c6,
@ -168,7 +168,7 @@ static int iso_8859_13[] = { // Latin alphabet No. 7
0x0161, 0x0144, 0x0146, 0x00f3, 0x014d, 0x00f5, 0x00f6, 0x00f7, 0x0173, 0x0142, 0x015b, 0x016b, 0x00fc, 0x017c, 0x017e, 0x2019 0x0161, 0x0144, 0x0146, 0x00f3, 0x014d, 0x00f5, 0x00f6, 0x00f7, 0x0173, 0x0142, 0x015b, 0x016b, 0x00fc, 0x017c, 0x017e, 0x2019
}; };
static int iso_8859_14[] = { // Latin alphabet No. 8 (Celtic) static const int iso_8859_14[] = {// Latin alphabet No. 8 (Celtic)
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x00a0, 0x1e02, 0x1e03, 0x00a3, 0x010a, 0x010b, 0x1e0a, 0x00a7, 0x1e80, 0x00a9, 0x1e82, 0x1e0b, 0x1ef2, 0x00ad, 0x00ae, 0x0178, 0x00a0, 0x1e02, 0x1e03, 0x00a3, 0x010a, 0x010b, 0x1e0a, 0x00a7, 0x1e80, 0x00a9, 0x1e82, 0x1e0b, 0x1ef2, 0x00ad, 0x00ae, 0x0178,
@ -179,7 +179,7 @@ static int iso_8859_14[] = { // Latin alphabet No. 8 (Celtic)
0x0175, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x1e6b, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x0177, 0x00ff 0x0175, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x1e6b, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x0177, 0x00ff
}; };
static int iso_8859_15[] = { // Latin alphabet No. 9 static const int iso_8859_15[] = {// Latin alphabet No. 9
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x20ac, 0x00a5, 0x0160, 0x00a7, 0x0161, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x20ac, 0x00a5, 0x0160, 0x00a7, 0x0161, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
@ -190,7 +190,7 @@ static int iso_8859_15[] = { // Latin alphabet No. 9
0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff
}; };
static int iso_8859_16[] = { // Latin alphabet No. 10 static const int iso_8859_16[] = {// Latin alphabet No. 10
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x00a0, 0x0104, 0x0105, 0x0141, 0x20ac, 0x201e, 0x0160, 0x00a7, 0x0161, 0x00a9, 0x0218, 0x00ab, 0x0179, 0x00ad, 0x017a, 0x017b, 0x00a0, 0x0104, 0x0105, 0x0141, 0x20ac, 0x201e, 0x0160, 0x00a7, 0x0161, 0x00a9, 0x0218, 0x00ab, 0x0179, 0x00ad, 0x017a, 0x017b,
@ -200,7 +200,7 @@ static int iso_8859_16[] = { // Latin alphabet No. 10
0x0111, 0x0144, 0x00f2, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x015b, 0x0171, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0119, 0x021b, 0x00ff 0x0111, 0x0144, 0x00f2, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x015b, 0x0171, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0119, 0x021b, 0x00ff
}; };
static int windows_1250[] = { static const int windows_1250[] = {
0x20ac, 0x0000, 0x201a, 0x0000, 0x201e, 0x2026, 0x2020, 0x2021, 0x0000, 0x2030, 0x0160, 0x2039, 0x015a, 0x0164, 0x017d, 0x0179, 0x20ac, 0x0000, 0x201a, 0x0000, 0x201e, 0x2026, 0x2020, 0x2021, 0x0000, 0x2030, 0x0160, 0x2039, 0x015a, 0x0164, 0x017d, 0x0179,
0x0000, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x0000, 0x2122, 0x0161, 0x203a, 0x015b, 0x0165, 0x017e, 0x017a, 0x0000, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x0000, 0x2122, 0x0161, 0x203a, 0x015b, 0x0165, 0x017e, 0x017a,
0x00a0, 0x02c7, 0x02db, 0x0141, 0x00a4, 0x0104, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x015e, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x017b, 0x00a0, 0x02c7, 0x02db, 0x0141, 0x00a4, 0x0104, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x015e, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x017b,
@ -211,7 +211,7 @@ static int windows_1250[] = {
0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7, 0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9 0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7, 0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9
}; };
static int windows_1251[] = { static const int windows_1251[] = {
0x0402, 0x0403, 0x201a, 0x0453, 0x201e, 0x2026, 0x2020, 0x2021, 0x20ac, 0x2030, 0x0409, 0x2039, 0x040a, 0x040c, 0x040b, 0x040f, 0x0402, 0x0403, 0x201a, 0x0453, 0x201e, 0x2026, 0x2020, 0x2021, 0x20ac, 0x2030, 0x0409, 0x2039, 0x040a, 0x040c, 0x040b, 0x040f,
0x0452, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x0000, 0x2122, 0x0459, 0x203a, 0x045a, 0x045c, 0x045b, 0x045f, 0x0452, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x0000, 0x2122, 0x0459, 0x203a, 0x045a, 0x045c, 0x045b, 0x045f,
0x00a0, 0x040e, 0x045e, 0x0408, 0x00a4, 0x0490, 0x00a6, 0x00a7, 0x0401, 0x00a9, 0x0404, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x0407, 0x00a0, 0x040e, 0x045e, 0x0408, 0x00a4, 0x0490, 0x00a6, 0x00a7, 0x0401, 0x00a9, 0x0404, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x0407,
@ -222,7 +222,7 @@ static int windows_1251[] = {
0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f
}; };
static int windows_1252[] = { static const int windows_1252[] = {
0x20ac, 0x0000, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, 0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0x0000, 0x017d, 0x0000, 0x20ac, 0x0000, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, 0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0x0000, 0x017d, 0x0000,
0x0000, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0x0000, 0x017e, 0x0178, 0x0000, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0x0000, 0x017e, 0x0178,
0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
@ -233,7 +233,7 @@ static int windows_1252[] = {
0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff
}; };
static int windows_1256[] = { static const int windows_1256[] = {
0x20ac, 0x067e, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, 0x02c6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688, 0x20ac, 0x067e, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, 0x02c6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688,
0x06af, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x06a9, 0x2122, 0x0691, 0x203a, 0x0153, 0x200c, 0x200d, 0x06ba, 0x06af, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x06a9, 0x2122, 0x0691, 0x203a, 0x0153, 0x200c, 0x200d, 0x06ba,
0x00a0, 0x060c, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x06be, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, 0x00a0, 0x060c, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x06be, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,

View File

@ -34,11 +34,11 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "common.h" #include "common.h"
#include "pcx.h" /* PCX header structure */
#include <math.h> #include <math.h>
#ifdef _MSC_VER #ifdef _MSC_VER
#include <io.h> #include <io.h>
#include <fcntl.h> #include <fcntl.h>
#include <malloc.h>
#endif #endif
#define SSET "0123456789ABCDEF" #define SSET "0123456789ABCDEF"
@ -68,8 +68,7 @@ typedef struct s_statestruct {
unsigned char NodePix[4096]; unsigned char NodePix[4096];
} statestruct; } statestruct;
static char BufferNextByte(statestruct *pState) static char BufferNextByte(statestruct *pState) {
{
(pState->OutPosCur)++; (pState->OutPosCur)++;
/* Check if this position is a byte count position /* Check if this position is a byte count position
* fg_f_bytecountbyte_set indicates, if byte count position bytes should be * fg_f_bytecountbyte_set indicates, if byte count position bytes should be
@ -78,8 +77,7 @@ static char BufferNextByte(statestruct *pState)
* (e.g. 255 bytes in between), a byte count byte is inserted, and the value * (e.g. 255 bytes in between), a byte count byte is inserted, and the value
* of the last one is set to 255. * of the last one is set to 255.
* */ * */
if ( pState->fByteCountByteSet && ( pState->OutByteCountPos + 256 == pState->OutPosCur ) ) if (pState->fByteCountByteSet && (pState->OutByteCountPos + 256 == pState->OutPosCur)) {
{
(pState->pOut)[pState->OutByteCountPos] = 255; (pState->pOut)[pState->OutByteCountPos] = 255;
pState->OutByteCountPos = pState->OutPosCur; pState->OutByteCountPos = pState->OutPosCur;
(pState->OutPosCur)++; (pState->OutPosCur)++;
@ -90,11 +88,9 @@ static char BufferNextByte(statestruct *pState)
return 0; return 0;
} }
static char AddCodeToBuffer(statestruct *pState, unsigned short CodeIn,unsigned char CodeBits) static char AddCodeToBuffer(statestruct *pState, unsigned short CodeIn, unsigned char CodeBits) {
{
/* Check, if we may fill up the current byte completely */ /* Check, if we may fill up the current byte completely */
if (CodeBits >= pState->OutBitsFree) if (CodeBits >= pState->OutBitsFree) {
{
(pState->pOut)[pState->OutPosCur] |= (unsigned char) (pState->pOut)[pState->OutPosCur] |= (unsigned char)
(CodeIn << (8 - pState->OutBitsFree)); (CodeIn << (8 - pState->OutBitsFree));
if (BufferNextByte(pState)) if (BufferNextByte(pState))
@ -103,8 +99,7 @@ static char AddCodeToBuffer(statestruct *pState, unsigned short CodeIn,unsigned
CodeBits -= pState->OutBitsFree; CodeBits -= pState->OutBitsFree;
pState->OutBitsFree = 8; pState->OutBitsFree = 8;
/* Write a full byte if there are at least 8 code bits left */ /* Write a full byte if there are at least 8 code bits left */
if (CodeBits >= pState->OutBitsFree) if (CodeBits >= pState->OutBitsFree) {
{
(pState->pOut)[pState->OutPosCur] = (unsigned char) CodeIn; (pState->pOut)[pState->OutPosCur] = (unsigned char) CodeIn;
if (BufferNextByte(pState)) if (BufferNextByte(pState))
return -1; return -1;
@ -113,8 +108,7 @@ static char AddCodeToBuffer(statestruct *pState, unsigned short CodeIn,unsigned
} }
} }
/* The remaining bits of CodeIn fit in the current byte. */ /* The remaining bits of CodeIn fit in the current byte. */
if( CodeBits > 0 ) if (CodeBits > 0) {
{
(pState->pOut)[pState->OutPosCur] |= (unsigned char) (pState->pOut)[pState->OutPosCur] |= (unsigned char)
(CodeIn << (8 - pState->OutBitsFree)); (CodeIn << (8 - pState->OutBitsFree));
pState->OutBitsFree -= CodeBits; pState->OutBitsFree -= CodeBits;
@ -122,23 +116,18 @@ static char AddCodeToBuffer(statestruct *pState, unsigned short CodeIn,unsigned
return 0; return 0;
} }
static void FlushStringTable(statestruct *pState) static void FlushStringTable(statestruct *pState) {
{
unsigned short Pos; unsigned short Pos;
for( Pos = 0; Pos < pState->ClearCode; Pos++ ) for (Pos = 0; Pos < pState->ClearCode; Pos++) {
{
(pState->NodeAxon)[Pos] = 0; (pState->NodeAxon)[Pos] = 0;
} }
} }
unsigned short FindPixelOutlet(statestruct *pState, unsigned short HeadNode, unsigned char Byte) {
unsigned short FindPixelOutlet( statestruct *pState, unsigned short HeadNode, unsigned char Byte )
{
unsigned short Outlet; unsigned short Outlet;
Outlet = (pState->NodeAxon)[HeadNode]; Outlet = (pState->NodeAxon)[HeadNode];
while( Outlet ) while (Outlet) {
{
if ((pState->NodePix)[Outlet] == Byte) if ((pState->NodePix)[Outlet] == Byte)
return Outlet; return Outlet;
Outlet = (pState->NodeNext)[Outlet]; Outlet = (pState->NodeNext)[Outlet];
@ -146,8 +135,7 @@ unsigned short FindPixelOutlet( statestruct *pState, unsigned short HeadNode, un
return 0; return 0;
} }
static char NextCode ( statestruct *pState, unsigned char * pPixelValueCur, unsigned char CodeBits ) static char NextCode(statestruct *pState, unsigned char * pPixelValueCur, unsigned char CodeBits) {
{
unsigned short UpNode; unsigned short UpNode;
unsigned short DownNode; unsigned short DownNode;
/* start with the root node for last pixel chain */ /* start with the root node for last pixel chain */
@ -159,8 +147,7 @@ static char NextCode ( statestruct *pState, unsigned char * pPixelValueCur, unsi
(pState->pIn)++; (pState->pIn)++;
(pState->InLen)--; (pState->InLen)--;
/* Follow the string table and the data stream to the end of the longest string that has a code */ /* Follow the string table and the data stream to the end of the longest string that has a code */
while( 0 != ( DownNode = FindPixelOutlet(pState, UpNode, *pPixelValueCur ) ) ) while (0 != (DownNode = FindPixelOutlet(pState, UpNode, *pPixelValueCur))) {
{
UpNode = DownNode; UpNode = DownNode;
if ((pState->InLen) == 0) if ((pState->InLen) == 0)
return AddCodeToBuffer(pState, UpNode, CodeBits); return AddCodeToBuffer(pState, UpNode, CodeBits);
@ -178,12 +165,10 @@ static char NextCode ( statestruct *pState, unsigned char * pPixelValueCur, unsi
(pState->NodeAxon)[pState->FreeCode] = (pState->NodeNext)[pState->FreeCode] = 0; (pState->NodeAxon)[pState->FreeCode] = (pState->NodeNext)[pState->FreeCode] = 0;
/* ...and link it to the end of the chain emanating from fg_axon[UpNode]. */ /* ...and link it to the end of the chain emanating from fg_axon[UpNode]. */
DownNode = (pState->NodeAxon)[UpNode]; DownNode = (pState->NodeAxon)[UpNode];
if( ! DownNode ) if (!DownNode) {
{
(pState->NodeAxon)[UpNode] = pState->FreeCode; (pState->NodeAxon)[UpNode] = pState->FreeCode;
} else { } else {
while( (pState->NodeNext)[DownNode] ) while ((pState->NodeNext)[DownNode]) {
{
DownNode = (pState->NodeNext)[DownNode]; DownNode = (pState->NodeNext)[DownNode];
} }
(pState->NodeNext)[DownNode] = pState->FreeCode; (pState->NodeNext)[DownNode] = pState->FreeCode;
@ -191,8 +176,7 @@ static char NextCode ( statestruct *pState, unsigned char * pPixelValueCur, unsi
return 1; return 1;
} }
int gif_lzw(unsigned char *pOut, int OutLength, unsigned char *pIn, int InLen) int gif_lzw(unsigned char *pOut, int OutLength, unsigned char *pIn, int InLen) {
{
unsigned char PixelValueCur; unsigned char PixelValueCur;
unsigned char CodeBits; unsigned char CodeBits;
unsigned short Pos; unsigned short Pos;
@ -237,28 +221,24 @@ int gif_lzw(unsigned char *pOut, int OutLength, unsigned char *pIn, int InLen)
if (AddCodeToBuffer(&State, State.ClearCode, CodeBits)) if (AddCodeToBuffer(&State, State.ClearCode, CodeBits))
return 0; return 0;
for(;;) for (;;) {
{
char Res; char Res;
/* generate and save the next code, which may consist of multiple input pixels. */ /* generate and save the next code, which may consist of multiple input pixels. */
Res = NextCode(&State, &PixelValueCur, CodeBits); Res = NextCode(&State, &PixelValueCur, CodeBits);
if (Res < 0) if (Res < 0)
return 0; return 0;
//* Check for end of data stream */ //* Check for end of data stream */
if( ! Res ) if (!Res) {
{
/* submit 'eoi' as the last item of the code stream */ /* submit 'eoi' as the last item of the code stream */
if (AddCodeToBuffer(&State, (unsigned short) (State.ClearCode + 1), CodeBits)) if (AddCodeToBuffer(&State, (unsigned short) (State.ClearCode + 1), CodeBits))
return 0; return 0;
State.fByteCountByteSet = 0; State.fByteCountByteSet = 0;
if( State.OutBitsFree < 8 ) if (State.OutBitsFree < 8) {
{
if (BufferNextByte(&State)) if (BufferNextByte(&State))
return 0; return 0;
} }
// > Update last bytecount byte; // > Update last bytecount byte;
if ( State.OutByteCountPos < State.OutPosCur ) if (State.OutByteCountPos < State.OutPosCur) {
{
(State.pOut)[State.OutByteCountPos] = (unsigned char) (State.OutPosCur - State.OutByteCountPos - 1); (State.pOut)[State.OutByteCountPos] = (unsigned char) (State.OutPosCur - State.OutByteCountPos - 1);
} }
State.OutPosCur++; State.OutPosCur++;
@ -269,8 +249,7 @@ int gif_lzw(unsigned char *pOut, int OutLength, unsigned char *pIn, int InLen)
CodeBits++; CodeBits++;
State.FreeCode++; State.FreeCode++;
/* Check for full stringtable */ /* Check for full stringtable */
if( State.FreeCode == 0xfff ) if (State.FreeCode == 0xfff) {
{
FlushStringTable(&State); FlushStringTable(&State);
if (AddCodeToBuffer(&State, State.ClearCode, CodeBits)) if (AddCodeToBuffer(&State, State.ClearCode, CodeBits))
return 0; return 0;
@ -440,8 +419,7 @@ int gif_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width
/* A graphic control extension block is used for overlay gifs. /* A graphic control extension block is used for overlay gifs.
* This is necessary to define a transparent color. * This is necessary to define a transparent color.
*/ */
if (TRANSPARENT_INDEX != -1) if (TRANSPARENT_INDEX != -1) {
{
/* Extension Introducer = '!' */ /* Extension Introducer = '!' */
outbuf[0] = '\x21'; outbuf[0] = '\x21';
/* Graphic Control Label */ /* Graphic Control Label */
@ -493,8 +471,7 @@ int gif_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width
image_height * image_width, image_height * image_width,
(unsigned char *) rotated_bitmap, (unsigned char *) rotated_bitmap,
image_height * image_width); image_height * image_width);
if (byte_out <= 0) if (byte_out <= 0) {
{
fclose(gif_file); fclose(gif_file);
return ZINT_ERROR_MEMORY; return ZINT_ERROR_MEMORY;
} }

View File

@ -69,7 +69,7 @@ void itostr(char ai_string[], int ai_value) {
strcat(ai_string, ")"); strcat(ai_string, ")");
} }
int gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const unsigned int src_len, char reduced[]) { int gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const size_t src_len, char reduced[]) {
int i, j, last_ai, ai_latch; int i, j, last_ai, ai_latch;
char ai_string[6]; char ai_string[6];
int bracket_level, max_bracket_level, ai_length, max_ai_length, min_ai_length; int bracket_level, max_bracket_level, ai_length, max_ai_length, min_ai_length;

View File

@ -36,7 +36,7 @@
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
extern int gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const unsigned int src_len, char reduced[]); extern int gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const size_t src_len, char reduced[]);
extern int ugs1_verify(struct zint_symbol *symbol, const unsigned char source[], const unsigned int src_len, unsigned char reduced[]); extern int ugs1_verify(struct zint_symbol *symbol, const unsigned char source[], const unsigned int src_len, unsigned char reduced[]);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -41,6 +41,7 @@
#include "reedsol.h" #include "reedsol.h"
#include "hanxin.h" #include "hanxin.h"
#include "gb18030.h" #include "gb18030.h"
#include "assert.h"
/* Find which submode to use for a text character */ /* Find which submode to use for a text character */
int getsubmode(char input) { int getsubmode(char input) {
@ -1376,9 +1377,9 @@ int han_xin(struct zint_symbol *symbol, const unsigned char source[], int length
} }
} }
} }
length = posn;
} }
length = posn;
hx_define_mode(mode, gbdata, length); hx_define_mode(mode, gbdata, length);
est_binlen = calculate_binlength(mode, gbdata, length, symbol->eci); est_binlen = calculate_binlength(mode, gbdata, length, symbol->eci);
@ -1390,13 +1391,9 @@ int han_xin(struct zint_symbol *symbol, const unsigned char source[], int length
#ifndef _MSC_VER #ifndef _MSC_VER
char binary[est_binlen + 1]; char binary[est_binlen + 1];
#else #else
binary = (char *) _alloca((est_binlen + 1) * sizeof (char));; binary = (char *) _alloca((est_binlen + 10) * sizeof (char));
#endif #endif
for (i = 0; i < est_binlen + 1; i++) { memset(binary, 0, (est_binlen + 1) * sizeof (char));
binary[i] = '\0';
}
binary[0] = '\0';
if ((ecc_level <= 0) || (ecc_level >= 5)) { if ((ecc_level <= 0) || (ecc_level >= 5)) {
ecc_level = 1; ecc_level = 1;
@ -1431,6 +1428,9 @@ int han_xin(struct zint_symbol *symbol, const unsigned char source[], int length
data_codewords = hx_data_codewords_L4[i - 1]; data_codewords = hx_data_codewords_L4[i - 1];
} }
break; break;
default:
assert(0);
break;
} }
} }

View File

@ -31,7 +31,7 @@
*/ */
/* Data from table B1: Data capacity of Han Xin Code */ /* Data from table B1: Data capacity of Han Xin Code */
static int hx_total_codewords[] = { static const int hx_total_codewords[] = {
25, 37, 50, 54, 69, 84, 100, 117, 136, 155, 161, 181, 203, 225, 249, 25, 37, 50, 54, 69, 84, 100, 117, 136, 155, 161, 181, 203, 225, 249,
273, 299, 325, 353, 381, 411, 422, 453, 485, 518, 552, 587, 623, 660, 273, 299, 325, 353, 381, 411, 422, 453, 485, 518, 552, 587, 623, 660,
698, 737, 754, 794, 836, 878, 922, 966, 1011, 1058, 1105, 1126, 1175, 698, 737, 754, 794, 836, 878, 922, 966, 1011, 1058, 1105, 1126, 1175,
@ -41,7 +41,7 @@ static int hx_total_codewords[] = {
3500, 3585, 3671, 3758, 3798, 3886 3500, 3585, 3671, 3758, 3798, 3886
}; };
static int hx_data_codewords_L1[] = { static const int hx_data_codewords_L1[] = {
21, 31, 42, 46, 57, 70, 84, 99, 114, 131, 135, 153, 171, 189, 209, 229, 21, 31, 42, 46, 57, 70, 84, 99, 114, 131, 135, 153, 171, 189, 209, 229,
251, 273, 297, 321, 345, 354, 381, 407, 436, 464, 493, 523, 554, 586, 619, 251, 273, 297, 321, 345, 354, 381, 407, 436, 464, 493, 523, 554, 586, 619,
634, 666, 702, 738, 774, 812, 849, 888, 929, 946, 987, 1028, 1071, 1115, 634, 666, 702, 738, 774, 812, 849, 888, 929, 946, 987, 1028, 1071, 1115,
@ -51,7 +51,7 @@ static int hx_data_codewords_L1[] = {
3083, 3156, 3190, 3264 3083, 3156, 3190, 3264
}; };
static int hx_data_codewords_L2[] = { static const int hx_data_codewords_L2[] = {
17, 25, 34, 38, 49, 58, 70, 81, 96, 109, 113, 127, 143, 157, 175, 191, 209, 17, 25, 34, 38, 49, 58, 70, 81, 96, 109, 113, 127, 143, 157, 175, 191, 209,
227, 247, 267, 287, 296, 317, 339, 362, 386, 411, 437, 462, 488, 515, 528, 227, 247, 267, 287, 296, 317, 339, 362, 386, 411, 437, 462, 488, 515, 528,
556, 586, 614, 646, 676, 707, 740, 773, 788, 823, 856, 893, 929, 966, 1004, 556, 586, 614, 646, 676, 707, 740, 773, 788, 823, 856, 893, 929, 966, 1004,
@ -61,7 +61,7 @@ static int hx_data_codewords_L2[] = {
2720 2720
}; };
static int hx_data_codewords_L3[] = { static const int hx_data_codewords_L3[] = {
13, 19, 26, 30, 37, 46, 54, 63, 74, 83, 87, 97, 109, 121, 135, 147, 161, 13, 19, 26, 30, 37, 46, 54, 63, 74, 83, 87, 97, 109, 121, 135, 147, 161,
175, 191, 205, 221, 228, 245, 261, 280, 298, 317, 337, 358, 376, 397, 408, 175, 191, 205, 221, 228, 245, 261, 280, 298, 317, 337, 358, 376, 397, 408,
428, 452, 474, 498, 522, 545, 572, 597, 608, 635, 660, 689, 717, 746, 774, 428, 452, 474, 498, 522, 545, 572, 597, 608, 635, 660, 689, 717, 746, 774,
@ -70,7 +70,7 @@ static int hx_data_codewords_L3[] = {
1713, 1756, 1800, 1844, 1890, 1935, 1983, 2030, 2050, 2098 1713, 1756, 1800, 1844, 1890, 1935, 1983, 2030, 2050, 2098
}; };
static int hx_data_codewords_L4[] = { static const int hx_data_codewords_L4[] = {
9, 15, 20, 22, 27, 34, 40, 47, 54, 61, 65, 73, 81, 89, 99, 109, 119, 129, 9, 15, 20, 22, 27, 34, 40, 47, 54, 61, 65, 73, 81, 89, 99, 109, 119, 129,
141, 153, 165, 168, 181, 195, 208, 220, 235, 251, 264, 280, 295, 302, 318, 141, 153, 165, 168, 181, 195, 208, 220, 235, 251, 264, 280, 295, 302, 318,
334, 352, 368, 386, 405, 424, 441, 450, 469, 490, 509, 531, 552, 574, 595, 605, 334, 352, 368, 386, 405, 424, 441, 450, 469, 490, 509, 531, 552, 574, 595, 605,
@ -80,7 +80,7 @@ static int hx_data_codewords_L4[] = {
}; };
/* Value 'k' from Annex A */ /* Value 'k' from Annex A */
static int hx_module_k[] = { static const int hx_module_k[] = {
0, 0, 0, 14, 16, 16, 17, 18, 19, 20, 0, 0, 0, 14, 16, 16, 17, 18, 19, 20,
14, 15, 16, 16, 17, 17, 18, 19, 20, 20, 14, 15, 16, 16, 17, 17, 18, 19, 20, 20,
21, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 16, 17, 17, 18, 18, 19, 19, 20, 20,
@ -93,7 +93,7 @@ static int hx_module_k[] = {
}; };
/* Value 'r' from Annex A */ /* Value 'r' from Annex A */
static int hx_module_r[] = { static const int hx_module_r[] = {
0, 0, 0, 15, 15, 17, 18, 19, 20, 21, 0, 0, 0, 15, 15, 17, 18, 19, 20, 21,
15, 15, 15, 17, 17, 19, 19, 19, 19, 21, 15, 15, 15, 17, 17, 19, 19, 19, 19, 21,
21, 17, 16, 18, 17, 19, 18, 20, 19, 21, 21, 17, 16, 18, 17, 19, 18, 20, 19, 21,
@ -106,7 +106,7 @@ static int hx_module_r[] = {
}; };
/* Value of 'm' from Annex A */ /* Value of 'm' from Annex A */
static int hx_module_m[] = { static const int hx_module_m[] = {
0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3,
@ -119,7 +119,7 @@ static int hx_module_m[] = {
}; };
/* Error correction block sizes from Table D1 */ /* Error correction block sizes from Table D1 */
static int hx_table_d1[] = { static const int hx_table_d1[] = {
/* #blocks, k, 2t, #blocks, k, 2t, #blocks, k, 2t */ /* #blocks, k, 2t, #blocks, k, 2t, #blocks, k, 2t */
1, 21, 4, 0, 0, 0, 0, 0, 0, // version 1 1, 21, 4, 0, 0, 0, 0, 0, 0, // version 1
1, 17, 8, 0, 0, 0, 0, 0, 0, 1, 17, 8, 0, 0, 0, 0, 0, 0,

View File

@ -150,21 +150,21 @@ extern int get_best_eci(unsigned char source[], int length); /* Calculate suitab
extern int utf_to_eci(int eci, const unsigned char source[], unsigned char dest[], int *length); /* Convert Unicode to other encodings */ extern int utf_to_eci(int eci, const unsigned char source[], unsigned char dest[], int *length); /* Convert Unicode to other encodings */
extern int eanx(struct zint_symbol *symbol, unsigned char source[], int length); /* EAN system barcodes */ extern int eanx(struct zint_symbol *symbol, unsigned char source[], int length); /* EAN system barcodes */
extern int c39(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 3 from 9 (or Code 39) */ extern int c39(struct zint_symbol *symbol, unsigned char source[], const size_t length); /* Code 3 from 9 (or Code 39) */
extern int pharmazentral(struct zint_symbol *symbol, unsigned char source[], int length); /* Pharmazentral Nummer (PZN) */ extern int pharmazentral(struct zint_symbol *symbol, unsigned char source[], int length); /* Pharmazentral Nummer (PZN) */
extern int ec39(struct zint_symbol *symbol, unsigned char source[], int length); /* Extended Code 3 from 9 (or Code 39+) */ extern int ec39(struct zint_symbol *symbol, unsigned char source[], int length); /* Extended Code 3 from 9 (or Code 39+) */
extern int codabar(struct zint_symbol *symbol, unsigned char source[], int length); /* Codabar - a simple substitution cipher */ extern int codabar(struct zint_symbol *symbol, unsigned char source[], int length); /* Codabar - a simple substitution cipher */
extern int matrix_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 2 of 5 Standard (& Matrix) */ extern int matrix_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 2 of 5 Standard (& Matrix) */
extern int industrial_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 2 of 5 Industrial */ extern int industrial_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 2 of 5 Industrial */
extern int iata_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 2 of 5 IATA */ extern int iata_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 2 of 5 IATA */
extern int interleaved_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 2 of 5 Interleaved */ extern int interleaved_two_of_five(struct zint_symbol *symbol, const unsigned char source[], size_t length); /* Code 2 of 5 Interleaved */
extern int logic_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 2 of 5 Data Logic */ extern int logic_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 2 of 5 Data Logic */
extern int itf14(struct zint_symbol *symbol, unsigned char source[], int length); /* ITF-14 */ extern int itf14(struct zint_symbol *symbol, unsigned char source[], int length); /* ITF-14 */
extern int dpleit(struct zint_symbol *symbol, unsigned char source[], int length); /* Deutsche Post Leitcode */ extern int dpleit(struct zint_symbol *symbol, unsigned char source[], int length); /* Deutsche Post Leitcode */
extern int dpident(struct zint_symbol *symbol, unsigned char source[], int length); /* Deutsche Post Identcode */ extern int dpident(struct zint_symbol *symbol, unsigned char source[], int length); /* Deutsche Post Identcode */
extern int c93(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 93 - a re-working of Code 39+, generates 2 check digits */ extern int c93(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 93 - a re-working of Code 39+, generates 2 check digits */
extern int code_128(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 128 and NVE-18 */ extern int code_128(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 128 and NVE-18 */
extern int ean_128(struct zint_symbol *symbol, unsigned char source[], int length); /* EAN-128 (GS1-128) */ extern int ean_128(struct zint_symbol *symbol, unsigned char source[], const size_t length); /* EAN-128 (GS1-128) */
extern int code_11(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 11 */ extern int code_11(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 11 */
extern int msi_handle(struct zint_symbol *symbol, unsigned char source[], int length); /* MSI Plessey */ extern int msi_handle(struct zint_symbol *symbol, unsigned char source[], int length); /* MSI Plessey */
extern int telepen(struct zint_symbol *symbol, unsigned char source[], int length); /* Telepen ASCII */ extern int telepen(struct zint_symbol *symbol, unsigned char source[], int length); /* Telepen ASCII */
@ -181,7 +181,7 @@ extern int royal_plot(struct zint_symbol *symbol, unsigned char source[], int le
extern int australia_post(struct zint_symbol *symbol, unsigned char source[], int length); /* Australia Post 4-state */ extern int australia_post(struct zint_symbol *symbol, unsigned char source[], int length); /* Australia Post 4-state */
extern int code16k(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 16k */ extern int code16k(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 16k */
extern int pdf417enc(struct zint_symbol *symbol, unsigned char source[], int length); /* PDF417 */ extern int pdf417enc(struct zint_symbol *symbol, unsigned char source[], int length); /* PDF417 */
extern int dmatrix(struct zint_symbol *symbol, unsigned char source[], int length); /* Data Matrix (IEC16022) */ extern int dmatrix(struct zint_symbol *symbol, const unsigned char source[], int length); /* Data Matrix (IEC16022) */
extern int qr_code(struct zint_symbol *symbol, const unsigned char source[], int length); /* QR Code */ extern int qr_code(struct zint_symbol *symbol, const unsigned char source[], int length); /* QR Code */
extern int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], int length); /* Micro PDF417 */ extern int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], int length); /* Micro PDF417 */
extern int maxicode(struct zint_symbol *symbol, unsigned char source[], int length); /* Maxicode */ extern int maxicode(struct zint_symbol *symbol, unsigned char source[], int length); /* Maxicode */
@ -283,7 +283,7 @@ int dump_plot(struct zint_symbol *symbol) {
} }
/* Process health industry bar code data */ /* Process health industry bar code data */
int hibc(struct zint_symbol *symbol, unsigned char source[], int length) { static int hibc(struct zint_symbol *symbol, unsigned char source[], size_t length) {
int counter, error_number, i; int counter, error_number, i;
char to_process[40], temp[2], check_digit; char to_process[40], temp[2], check_digit;
@ -575,14 +575,14 @@ static int extended_charset(struct zint_symbol *symbol, const unsigned char *sou
return error_number; return error_number;
} }
static int reduced_charset(struct zint_symbol *symbol, const unsigned char *source, int length) { static int reduced_charset(struct zint_symbol *symbol, const unsigned char *source, int in_length) {
/* These are the "norm" standards which only support Latin-1 at most */ /* These are the "norm" standards which only support Latin-1 at most */
int error_number = 0; int error_number = 0;
#ifndef _MSC_VER #ifndef _MSC_VER
unsigned char preprocessed[length + 1]; unsigned char preprocessed[in_length + 1];
#else #else
unsigned char* preprocessed = (unsigned char*) _alloca(length + 1); unsigned char* preprocessed = (unsigned char*) _alloca(in_length + 1);
#endif #endif
if (symbol->symbology == BARCODE_CODE16K) { if (symbol->symbology == BARCODE_CODE16K) {
@ -592,7 +592,7 @@ static int reduced_charset(struct zint_symbol *symbol, const unsigned char *sour
symbol->output_options += BARCODE_BIND; symbol->output_options += BARCODE_BIND;
} }
} }
else
if (symbol->symbology == BARCODE_ITF14) { if (symbol->symbology == BARCODE_ITF14) {
symbol->whitespace_width = 20; symbol->whitespace_width = 20;
symbol->border_width = 8; symbol->border_width = 8;
@ -604,11 +604,11 @@ static int reduced_charset(struct zint_symbol *symbol, const unsigned char *sour
switch (symbol->input_mode) { switch (symbol->input_mode) {
case DATA_MODE: case DATA_MODE:
case GS1_MODE: case GS1_MODE:
memcpy(preprocessed, source, length); memcpy(preprocessed, source, in_length);
preprocessed[length] = '\0'; preprocessed[in_length] = '\0';
break; break;
case UNICODE_MODE: case UNICODE_MODE:
error_number = utf_to_eci(symbol->eci, source, preprocessed, &length); error_number = utf_to_eci(symbol->eci, source, preprocessed, &in_length);
if (error_number != 0) { if (error_number != 0) {
strcpy(symbol->errtxt, "Invalid characters in input data"); strcpy(symbol->errtxt, "Invalid characters in input data");
return error_number; return error_number;
@ -617,186 +617,186 @@ static int reduced_charset(struct zint_symbol *symbol, const unsigned char *sour
} }
switch (symbol->symbology) { switch (symbol->symbology) {
case BARCODE_C25MATRIX: error_number = matrix_two_of_five(symbol, preprocessed, length); case BARCODE_C25MATRIX: error_number = matrix_two_of_five(symbol, preprocessed, in_length);
break; break;
case BARCODE_C25IND: error_number = industrial_two_of_five(symbol, preprocessed, length); case BARCODE_C25IND: error_number = industrial_two_of_five(symbol, preprocessed, in_length);
break; break;
case BARCODE_C25INTER: error_number = interleaved_two_of_five(symbol, preprocessed, length); case BARCODE_C25INTER: error_number = interleaved_two_of_five(symbol, preprocessed, in_length);
break; break;
case BARCODE_C25IATA: error_number = iata_two_of_five(symbol, preprocessed, length); case BARCODE_C25IATA: error_number = iata_two_of_five(symbol, preprocessed, in_length);
break; break;
case BARCODE_C25LOGIC: error_number = logic_two_of_five(symbol, preprocessed, length); case BARCODE_C25LOGIC: error_number = logic_two_of_five(symbol, preprocessed, in_length);
break; break;
case BARCODE_DPLEIT: error_number = dpleit(symbol, preprocessed, length); case BARCODE_DPLEIT: error_number = dpleit(symbol, preprocessed, in_length);
break; break;
case BARCODE_DPIDENT: error_number = dpident(symbol, preprocessed, length); case BARCODE_DPIDENT: error_number = dpident(symbol, preprocessed, in_length);
break; break;
case BARCODE_UPCA: error_number = eanx(symbol, preprocessed, length); case BARCODE_UPCA: error_number = eanx(symbol, preprocessed, in_length);
break; break;
case BARCODE_UPCE: error_number = eanx(symbol, preprocessed, length); case BARCODE_UPCE: error_number = eanx(symbol, preprocessed, in_length);
break; break;
case BARCODE_EANX: error_number = eanx(symbol, preprocessed, length); case BARCODE_EANX: error_number = eanx(symbol, preprocessed, in_length);
break; break;
case BARCODE_EAN128: error_number = ean_128(symbol, preprocessed, length); case BARCODE_EAN128: error_number = ean_128(symbol, preprocessed, in_length);
break; break;
case BARCODE_CODE39: error_number = c39(symbol, preprocessed, length); case BARCODE_CODE39: error_number = c39(symbol, preprocessed, in_length);
break; break;
case BARCODE_PZN: error_number = pharmazentral(symbol, preprocessed, length); case BARCODE_PZN: error_number = pharmazentral(symbol, preprocessed, in_length);
break; break;
case BARCODE_EXCODE39: error_number = ec39(symbol, preprocessed, length); case BARCODE_EXCODE39: error_number = ec39(symbol, preprocessed, in_length);
break; break;
case BARCODE_CODABAR: error_number = codabar(symbol, preprocessed, length); case BARCODE_CODABAR: error_number = codabar(symbol, preprocessed, in_length);
break; break;
case BARCODE_CODE93: error_number = c93(symbol, preprocessed, length); case BARCODE_CODE93: error_number = c93(symbol, preprocessed, in_length);
break; break;
case BARCODE_LOGMARS: error_number = c39(symbol, preprocessed, length); case BARCODE_LOGMARS: error_number = c39(symbol, preprocessed, in_length);
break; break;
case BARCODE_CODE128: error_number = code_128(symbol, preprocessed, length); case BARCODE_CODE128: error_number = code_128(symbol, preprocessed, in_length);
break; break;
case BARCODE_CODE128B: error_number = code_128(symbol, preprocessed, length); case BARCODE_CODE128B: error_number = code_128(symbol, preprocessed, in_length);
break; break;
case BARCODE_NVE18: error_number = nve_18(symbol, preprocessed, length); case BARCODE_NVE18: error_number = nve_18(symbol, preprocessed, in_length);
break; break;
case BARCODE_CODE11: error_number = code_11(symbol, preprocessed, length); case BARCODE_CODE11: error_number = code_11(symbol, preprocessed, in_length);
break; break;
case BARCODE_MSI_PLESSEY: error_number = msi_handle(symbol, preprocessed, length); case BARCODE_MSI_PLESSEY: error_number = msi_handle(symbol, preprocessed, in_length);
break; break;
case BARCODE_TELEPEN: error_number = telepen(symbol, preprocessed, length); case BARCODE_TELEPEN: error_number = telepen(symbol, preprocessed, in_length);
break; break;
case BARCODE_TELEPEN_NUM: error_number = telepen_num(symbol, preprocessed, length); case BARCODE_TELEPEN_NUM: error_number = telepen_num(symbol, preprocessed, in_length);
break; break;
case BARCODE_PHARMA: error_number = pharma_one(symbol, preprocessed, length); case BARCODE_PHARMA: error_number = pharma_one(symbol, preprocessed, in_length);
break; break;
case BARCODE_PLESSEY: error_number = plessey(symbol, preprocessed, length); case BARCODE_PLESSEY: error_number = plessey(symbol, preprocessed, in_length);
break; break;
case BARCODE_ITF14: error_number = itf14(symbol, preprocessed, length); case BARCODE_ITF14: error_number = itf14(symbol, preprocessed, in_length);
break; break;
case BARCODE_FLAT: error_number = flattermarken(symbol, preprocessed, length); case BARCODE_FLAT: error_number = flattermarken(symbol, preprocessed, in_length);
break; break;
case BARCODE_FIM: error_number = fim(symbol, preprocessed, length); case BARCODE_FIM: error_number = fim(symbol, preprocessed, in_length);
break; break;
case BARCODE_POSTNET: error_number = post_plot(symbol, preprocessed, length); case BARCODE_POSTNET: error_number = post_plot(symbol, preprocessed, in_length);
break; break;
case BARCODE_PLANET: error_number = planet_plot(symbol, preprocessed, length); case BARCODE_PLANET: error_number = planet_plot(symbol, preprocessed, in_length);
break; break;
case BARCODE_RM4SCC: error_number = royal_plot(symbol, preprocessed, length); case BARCODE_RM4SCC: error_number = royal_plot(symbol, preprocessed, in_length);
break; break;
case BARCODE_AUSPOST: error_number = australia_post(symbol, preprocessed, length); case BARCODE_AUSPOST: error_number = australia_post(symbol, preprocessed, in_length);
break; break;
case BARCODE_AUSREPLY: error_number = australia_post(symbol, preprocessed, length); case BARCODE_AUSREPLY: error_number = australia_post(symbol, preprocessed, in_length);
break; break;
case BARCODE_AUSROUTE: error_number = australia_post(symbol, preprocessed, length); case BARCODE_AUSROUTE: error_number = australia_post(symbol, preprocessed, in_length);
break; break;
case BARCODE_AUSREDIRECT: error_number = australia_post(symbol, preprocessed, length); case BARCODE_AUSREDIRECT: error_number = australia_post(symbol, preprocessed, in_length);
break; break;
case BARCODE_CODE16K: error_number = code16k(symbol, preprocessed, length); case BARCODE_CODE16K: error_number = code16k(symbol, preprocessed, in_length);
break; break;
case BARCODE_PHARMA_TWO: error_number = pharma_two(symbol, preprocessed, length); case BARCODE_PHARMA_TWO: error_number = pharma_two(symbol, preprocessed, in_length);
break; break;
case BARCODE_ONECODE: error_number = imail(symbol, preprocessed, length); case BARCODE_ONECODE: error_number = imail(symbol, preprocessed, in_length);
break; break;
case BARCODE_ISBNX: error_number = eanx(symbol, preprocessed, length); case BARCODE_ISBNX: error_number = eanx(symbol, preprocessed, in_length);
break; break;
case BARCODE_RSS14: error_number = rss14(symbol, preprocessed, length); case BARCODE_RSS14: error_number = rss14(symbol, preprocessed, in_length);
break; break;
case BARCODE_RSS14STACK: error_number = rss14(symbol, preprocessed, length); case BARCODE_RSS14STACK: error_number = rss14(symbol, preprocessed, in_length);
break; break;
case BARCODE_RSS14STACK_OMNI: error_number = rss14(symbol, preprocessed, length); case BARCODE_RSS14STACK_OMNI: error_number = rss14(symbol, preprocessed, in_length);
break; break;
case BARCODE_RSS_LTD: error_number = rsslimited(symbol, preprocessed, length); case BARCODE_RSS_LTD: error_number = rsslimited(symbol, preprocessed, in_length);
break; break;
case BARCODE_RSS_EXP: error_number = rssexpanded(symbol, preprocessed, length); case BARCODE_RSS_EXP: error_number = rssexpanded(symbol, preprocessed, in_length);
break; break;
case BARCODE_RSS_EXPSTACK: error_number = rssexpanded(symbol, preprocessed, length); case BARCODE_RSS_EXPSTACK: error_number = rssexpanded(symbol, preprocessed, in_length);
break; break;
case BARCODE_EANX_CC: error_number = composite(symbol, preprocessed, length); case BARCODE_EANX_CC: error_number = composite(symbol, preprocessed, in_length);
break; break;
case BARCODE_EAN128_CC: error_number = composite(symbol, preprocessed, length); case BARCODE_EAN128_CC: error_number = composite(symbol, preprocessed, in_length);
break; break;
case BARCODE_RSS14_CC: error_number = composite(symbol, preprocessed, length); case BARCODE_RSS14_CC: error_number = composite(symbol, preprocessed, in_length);
break; break;
case BARCODE_RSS_LTD_CC: error_number = composite(symbol, preprocessed, length); case BARCODE_RSS_LTD_CC: error_number = composite(symbol, preprocessed, in_length);
break; break;
case BARCODE_RSS_EXP_CC: error_number = composite(symbol, preprocessed, length); case BARCODE_RSS_EXP_CC: error_number = composite(symbol, preprocessed, in_length);
break; break;
case BARCODE_UPCA_CC: error_number = composite(symbol, preprocessed, length); case BARCODE_UPCA_CC: error_number = composite(symbol, preprocessed, in_length);
break; break;
case BARCODE_UPCE_CC: error_number = composite(symbol, preprocessed, length); case BARCODE_UPCE_CC: error_number = composite(symbol, preprocessed, in_length);
break; break;
case BARCODE_RSS14STACK_CC: error_number = composite(symbol, preprocessed, length); case BARCODE_RSS14STACK_CC: error_number = composite(symbol, preprocessed, in_length);
break; break;
case BARCODE_RSS14_OMNI_CC: error_number = composite(symbol, preprocessed, length); case BARCODE_RSS14_OMNI_CC: error_number = composite(symbol, preprocessed, in_length);
break; break;
case BARCODE_RSS_EXPSTACK_CC: error_number = composite(symbol, preprocessed, length); case BARCODE_RSS_EXPSTACK_CC: error_number = composite(symbol, preprocessed, in_length);
break; break;
case BARCODE_KIX: error_number = kix_code(symbol, preprocessed, length); case BARCODE_KIX: error_number = kix_code(symbol, preprocessed, in_length);
break; break;
case BARCODE_CODE32: error_number = code32(symbol, preprocessed, length); case BARCODE_CODE32: error_number = code32(symbol, preprocessed, in_length);
break; break;
case BARCODE_DAFT: error_number = daft_code(symbol, preprocessed, length); case BARCODE_DAFT: error_number = daft_code(symbol, preprocessed, in_length);
break; break;
case BARCODE_EAN14: error_number = ean_14(symbol, preprocessed, length); case BARCODE_EAN14: error_number = ean_14(symbol, preprocessed, in_length);
break; break;
case BARCODE_AZRUNE: error_number = aztec_runes(symbol, preprocessed, length); case BARCODE_AZRUNE: error_number = aztec_runes(symbol, preprocessed, in_length);
break; break;
case BARCODE_KOREAPOST: error_number = korea_post(symbol, preprocessed, length); case BARCODE_KOREAPOST: error_number = korea_post(symbol, preprocessed, in_length);
break; break;
case BARCODE_HIBC_128: error_number = hibc(symbol, preprocessed, length); case BARCODE_HIBC_128: error_number = hibc(symbol, preprocessed, in_length);
break; break;
case BARCODE_HIBC_39: error_number = hibc(symbol, preprocessed, length); case BARCODE_HIBC_39: error_number = hibc(symbol, preprocessed, in_length);
break; break;
case BARCODE_HIBC_DM: error_number = hibc(symbol, preprocessed, length); case BARCODE_HIBC_DM: error_number = hibc(symbol, preprocessed, in_length);
break; break;
case BARCODE_HIBC_QR: error_number = hibc(symbol, preprocessed, length); case BARCODE_HIBC_QR: error_number = hibc(symbol, preprocessed, in_length);
break; break;
case BARCODE_HIBC_PDF: error_number = hibc(symbol, preprocessed, length); case BARCODE_HIBC_PDF: error_number = hibc(symbol, preprocessed, in_length);
break; break;
case BARCODE_HIBC_MICPDF: error_number = hibc(symbol, preprocessed, length); case BARCODE_HIBC_MICPDF: error_number = hibc(symbol, preprocessed, in_length);
break; break;
case BARCODE_HIBC_AZTEC: error_number = hibc(symbol, preprocessed, length); case BARCODE_HIBC_AZTEC: error_number = hibc(symbol, preprocessed, in_length);
break; break;
case BARCODE_HIBC_BLOCKF: error_number = hibc(symbol, preprocessed, length); case BARCODE_HIBC_BLOCKF: error_number = hibc(symbol, preprocessed, in_length);
break; break;
case BARCODE_JAPANPOST: error_number = japan_post(symbol, preprocessed, length); case BARCODE_JAPANPOST: error_number = japan_post(symbol, preprocessed, in_length);
break; break;
case BARCODE_CODE49: error_number = code_49(symbol, preprocessed, length); case BARCODE_CODE49: error_number = code_49(symbol, preprocessed, in_length);
break; break;
case BARCODE_CHANNEL: error_number = channel_code(symbol, preprocessed, length); case BARCODE_CHANNEL: error_number = channel_code(symbol, preprocessed, in_length);
break; break;
case BARCODE_CODEONE: error_number = code_one(symbol, preprocessed, length); case BARCODE_CODEONE: error_number = code_one(symbol, preprocessed, in_length);
break; break;
case BARCODE_DATAMATRIX: error_number = dmatrix(symbol, preprocessed, length); case BARCODE_DATAMATRIX: error_number = dmatrix(symbol, preprocessed, in_length);
break; break;
case BARCODE_PDF417: error_number = pdf417enc(symbol, preprocessed, length); case BARCODE_PDF417: error_number = pdf417enc(symbol, preprocessed, in_length);
break; break;
case BARCODE_PDF417TRUNC: error_number = pdf417enc(symbol, preprocessed, length); case BARCODE_PDF417TRUNC: error_number = pdf417enc(symbol, preprocessed, in_length);
break; break;
case BARCODE_MICROPDF417: error_number = micro_pdf417(symbol, preprocessed, length); case BARCODE_MICROPDF417: error_number = micro_pdf417(symbol, preprocessed, in_length);
break; break;
case BARCODE_MAXICODE: error_number = maxicode(symbol, preprocessed, length); case BARCODE_MAXICODE: error_number = maxicode(symbol, preprocessed, in_length);
break; break;
case BARCODE_AZTEC: error_number = aztec(symbol, preprocessed, length); case BARCODE_AZTEC: error_number = aztec(symbol, preprocessed, in_length);
break; break;
case BARCODE_DOTCODE: error_number = dotcode(symbol, preprocessed, length); case BARCODE_DOTCODE: error_number = dotcode(symbol, preprocessed, in_length);
break; break;
case BARCODE_CODABLOCK: error_number = codablock(symbol, preprocessed, length); case BARCODE_CODABLOCK: error_number = codablock(symbol, preprocessed, in_length);
break; break;
} }
return error_number; return error_number;
} }
int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int length) { int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int in_length) {
int error_number, error_buffer, i; int error_number, error_buffer, i;
#ifdef _MSC_VER #ifdef _MSC_VER
unsigned char* local_source; unsigned char* local_source;
#endif #endif
error_number = 0; error_number = 0;
if (length == 0) { if (in_length == 0) {
length = ustrlen(source); in_length = (int) ustrlen(source);
} }
if (length == 0) { if (in_length == 0) {
strcpy(symbol->errtxt, "No input data"); strcpy(symbol->errtxt, "No input data");
error_tag(symbol->errtxt, ZINT_ERROR_INVALID_DATA); error_tag(symbol->errtxt, ZINT_ERROR_INVALID_DATA);
return ZINT_ERROR_INVALID_DATA; return ZINT_ERROR_INVALID_DATA;
@ -810,9 +810,9 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
#endif #endif
} }
#ifndef _MSC_VER #ifndef _MSC_VER
unsigned char local_source[length + 1]; unsigned char local_source[in_length + 1];
#else #else
local_source = (unsigned char*) _alloca(length + 1); local_source = (unsigned char*) _alloca(in_length + 1);
#endif #endif
/* First check the symbology field */ /* First check the symbology field */
@ -965,25 +965,25 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
} }
if (symbol->input_mode == GS1_MODE) { if (symbol->input_mode == GS1_MODE) {
for (i = 0; i < length; i++) { for (i = 0; i < in_length; i++) {
if (source[i] == '\0') { if (source[i] == '\0') {
strcpy(symbol->errtxt, "NULL characters not permitted in GS1 mode"); strcpy(symbol->errtxt, "NULL characters not permitted in GS1 mode");
return ZINT_ERROR_INVALID_DATA; return ZINT_ERROR_INVALID_DATA;
} }
} }
if (gs1_compliant(symbol->symbology) == 1) { if (gs1_compliant(symbol->symbology) == 1) {
error_number = ugs1_verify(symbol, source, length, local_source); error_number = ugs1_verify(symbol, source, in_length, local_source);
if (error_number != 0) { if (error_number != 0) {
return error_number; return error_number;
} }
length = ustrlen(local_source); in_length = ustrlen(local_source);
} else { } else {
strcpy(symbol->errtxt, "Selected symbology does not support GS1 mode"); strcpy(symbol->errtxt, "Selected symbology does not support GS1 mode");
return ZINT_ERROR_INVALID_OPTION; return ZINT_ERROR_INVALID_OPTION;
} }
} else { } else {
memcpy(local_source, source, length); memcpy(local_source, source, in_length);
local_source[length] = '\0'; local_source[in_length] = '\0';
} }
switch (symbol->symbology) { switch (symbol->symbology) {
@ -991,17 +991,17 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
case BARCODE_MICROQR: case BARCODE_MICROQR:
case BARCODE_GRIDMATRIX: case BARCODE_GRIDMATRIX:
case BARCODE_HANXIN: case BARCODE_HANXIN:
error_number = extended_charset(symbol, local_source, length); error_number = extended_charset(symbol, local_source, in_length);
break; break;
default: default:
error_number = reduced_charset(symbol, local_source, length); error_number = reduced_charset(symbol, local_source, in_length);
break; break;
} }
if ((error_number == ZINT_ERROR_INVALID_DATA) && (supports_eci(symbol->symbology) if ((error_number == ZINT_ERROR_INVALID_DATA) && (supports_eci(symbol->symbology)
&& (symbol->input_mode == UNICODE_MODE))) { && (symbol->input_mode == UNICODE_MODE))) {
/* Try another ECI mode */ /* Try another ECI mode */
symbol->eci = get_best_eci(local_source, length); symbol->eci = get_best_eci(local_source, in_length);
if (symbol->eci >= 3) { if (symbol->eci >= 3) {
@ -1012,18 +1012,18 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
case BARCODE_MICROQR: case BARCODE_MICROQR:
case BARCODE_GRIDMATRIX: case BARCODE_GRIDMATRIX:
case BARCODE_HANXIN: case BARCODE_HANXIN:
error_number = utf_to_eci(symbol->eci, source, local_source, &length); error_number = utf_to_eci(symbol->eci, source, local_source, &in_length);
error_number = extended_charset(symbol, local_source, length); error_number = extended_charset(symbol, local_source, in_length);
break; break;
default: default:
error_number = reduced_charset(symbol, local_source, length); error_number = reduced_charset(symbol, local_source, in_length);
break; break;
} }
} }
} }
if ((symbol->symbology == BARCODE_CODE128) || (symbol->symbology == BARCODE_CODE128B)) { if ((symbol->symbology == BARCODE_CODE128) || (symbol->symbology == BARCODE_CODE128B)) {
for (i = 0; i < length; i++) { for (i = 0; i < in_length; i++) {
if (local_source[i] == '\0') { if (local_source[i] == '\0') {
symbol->text[i] = ' '; symbol->text[i] = ' ';
} else { } else {

View File

@ -35,7 +35,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "common.h" #include "common.h"
extern int c39(struct zint_symbol *symbol, unsigned char source[], int length); extern int c39(struct zint_symbol *symbol, unsigned char source[], const size_t length);
/* Codabar table checked against EN 798:1995 */ /* Codabar table checked against EN 798:1995 */
#define CALCIUM "0123456789-$:/.+ABCD" #define CALCIUM "0123456789-$:/.+ABCD"

View File

@ -36,6 +36,7 @@
#include "common.h" #include "common.h"
#include "pcx.h" /* PCX header structure */ #include "pcx.h" /* PCX header structure */
#include <math.h> #include <math.h>
#include <malloc.h>
#ifdef _MSC_VER #ifdef _MSC_VER
#include <io.h> #include <io.h>
#include <fcntl.h> #include <fcntl.h>

View File

@ -58,7 +58,7 @@ int ps_plot(struct zint_symbol *symbol) {
#ifndef _MSC_VER #ifndef _MSC_VER
unsigned char local_text[ustrlen(symbol->text) + 1]; unsigned char local_text[ustrlen(symbol->text) + 1];
#else #else
unsigned char* local_text = (unsigned char*) _alloca(ustrlen(symbol->text) + 1); unsigned char* local_text = (unsigned char*) malloc(ustrlen(symbol->text) + 1);
#endif #endif
row_height = 0; row_height = 0;

View File

@ -35,6 +35,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
#include <malloc.h>
#include "common.h" #include "common.h"
#define SSET "0123456789ABCDEF" #define SSET "0123456789ABCDEF"

236
win32/libzint.vcxproj Normal file
View File

@ -0,0 +1,236 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release_LIB|Win32">
<Configuration>Release_LIB</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{5C08DC40-8F7D-475E-AA3C-814DED735A4B}</ProjectGuid>
<RootNamespace>libzint_png_qr</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_LIB|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>false</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>false</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_LIB|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>12.0.30501.0</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>$(Configuration)\</IntDir>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>$(Configuration)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_LIB|Win32'">
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\support\lpng169;..\..\zlib128-dll\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NO_PNG;WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;ZINT_VERSION="2.4.4";BUILD_ZINT_DLL;ZLIB_DLL;PNG_DLL;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<ExceptionHandling />
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<SmallerTypeCheck>true</SmallerTypeCheck>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
<DisableSpecificWarnings>4018;4244;4305;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
<Link>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)zintd.dll</OutputFile>
<AdditionalLibraryDirectories>..\..\..\support\lpng169\projects\visualc71\Win32_LIB_Debug;..\..\..\support\lpng169\projects\visualc71\Win32_LIB_Debug\ZLib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries>libcmtd.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>false</IntrinsicFunctions>
<AdditionalIncludeDirectories>..\..\..\support\lpng169;..\..\zlib128-dll\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;ZINT_VERSION="2.4.4";BUILD_ZINT_DLL;ZLIB_DLL;PNG_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling />
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>false</FunctionLevelLinking>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat />
<CompileAs>CompileAsCpp</CompileAs>
<DisableSpecificWarnings>4018;4244;4305;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
<Link>
<AdditionalDependencies>libpng.lib;zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)zint.dll</OutputFile>
<AdditionalLibraryDirectories>..\..\..\support\lpng169\projects\visualc71\Win32_LIB_Release;..\..\..\support\lpng169\projects\visualc71\Win32_LIB_Release\ZLib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_LIB|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>false</IntrinsicFunctions>
<AdditionalIncludeDirectories>d:\opt\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;ZINT_VERSION="2.4.4";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling />
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>false</FunctionLevelLinking>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat />
<CompileAs>CompileAsCpp</CompileAs>
<DisableSpecificWarnings>4018;4244;4305;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Lib>
<OutputFile>$(OutDir)libzintMD.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\backend\2of5.c" />
<ClCompile Include="..\backend\auspost.c" />
<ClCompile Include="..\backend\aztec.c" />
<ClCompile Include="..\backend\bmp.c" />
<ClCompile Include="..\backend\codablock.c" />
<ClCompile Include="..\backend\code.c" />
<ClCompile Include="..\backend\code1.c" />
<ClCompile Include="..\backend\code128.c" />
<ClCompile Include="..\backend\code16k.c" />
<ClCompile Include="..\backend\code49.c" />
<ClCompile Include="..\backend\common.c" />
<ClCompile Include="..\backend\composite.c" />
<ClCompile Include="..\backend\dllversion.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_LIB|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\backend\dmatrix.c" />
<ClCompile Include="..\backend\dotcode.c" />
<ClCompile Include="..\backend\eci.c" />
<ClCompile Include="..\backend\gif.c" />
<ClCompile Include="..\backend\gridmtx.c" />
<ClCompile Include="..\backend\gs1.c" />
<ClCompile Include="..\backend\hanxin.c" />
<ClCompile Include="..\backend\imail.c" />
<ClCompile Include="..\backend\large.c" />
<ClCompile Include="..\backend\library.c" />
<ClCompile Include="..\backend\maxicode.c" />
<ClCompile Include="..\backend\medical.c" />
<ClCompile Include="..\backend\pcx.c" />
<ClCompile Include="..\backend\pdf417.c" />
<ClCompile Include="..\backend\plessey.c" />
<ClCompile Include="..\backend\png.c" />
<ClCompile Include="..\backend\postal.c" />
<ClCompile Include="..\backend\ps.c" />
<ClCompile Include="..\backend\qr.c" />
<ClCompile Include="..\backend\raster.c" />
<ClCompile Include="..\backend\reedsol.c" />
<ClCompile Include="..\backend\render.c" />
<ClCompile Include="..\backend\rss.c" />
<ClCompile Include="..\backend\svg.c" />
<ClCompile Include="..\backend\telepen.c" />
<ClCompile Include="..\backend\upcean.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\backend\aztec.h" />
<ClInclude Include="..\backend\code1.h" />
<ClInclude Include="..\backend\code49.h" />
<ClInclude Include="..\backend\common.h" />
<ClInclude Include="..\backend\composite.h" />
<ClInclude Include="..\backend\dm200.h" />
<ClInclude Include="..\backend\dmatrix.h" />
<ClInclude Include="..\backend\font.h" />
<ClInclude Include="..\backend\gb2312.h" />
<ClInclude Include="..\backend\gridmtx.h" />
<ClInclude Include="..\backend\gs1.h" />
<ClInclude Include="..\backend\large.h" />
<ClInclude Include="..\backend\maxicode.h" />
<ClInclude Include="..\backend\maxipng.h" />
<ClInclude Include="..\backend\ms_stdint.h" />
<ClInclude Include="..\backend\pdf417.h" />
<ClInclude Include="..\backend\qr.h" />
<ClInclude Include="..\backend\reedsol.h" />
<ClInclude Include="..\backend\resource.h" />
<ClInclude Include="..\backend\rss.h" />
<ClInclude Include="..\backend\sjis.h" />
<ClInclude Include="..\backend\zint.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\backend\libzint.rc">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_LIB|Win32'">true</ExcludedFromBuild>
</ResourceCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,12 +1,11 @@
 
Microsoft Visual Studio Solution File, Format Version 10.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2008 # Visual Studio 2013
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zint", "zint.vcproj", "{3169C7FA-E52C-4BFC-B7BB-E55EBA133770}" VisualStudioVersion = 12.0.40629.0
ProjectSection(ProjectDependencies) = postProject MinimumVisualStudioVersion = 10.0.40219.1
{5C08DC40-8F7D-475E-AA3C-814DED735A4B} = {5C08DC40-8F7D-475E-AA3C-814DED735A4B} Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zint", "zint.vcxproj", "{3169C7FA-E52C-4BFC-B7BB-E55EBA133770}"
EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libzint", "libzint.vcproj", "{5C08DC40-8F7D-475E-AA3C-814DED735A4B}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libzint", "libzint.vcxproj", "{5C08DC40-8F7D-475E-AA3C-814DED735A4B}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution

145
win32/zint.vcxproj Normal file
View File

@ -0,0 +1,145 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release_LIB|Win32">
<Configuration>Release_LIB</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{3169C7FA-E52C-4BFC-B7BB-E55EBA133770}</ProjectGuid>
<RootNamespace>zint</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_LIB|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>false</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>false</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_LIB|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>12.0.30501.0</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_LIB|Win32'">
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\backend;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;ZINT_VERSION="2.3.0";ZINT_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<ExceptionHandling />
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<SmallerTypeCheck>true</SmallerTypeCheck>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\backend;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;ZINT_VERSION="2.3.0";ZINT_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling />
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>false</FunctionLevelLinking>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat />
</ClCompile>
<Link>
<AdditionalLibraryDirectories>d:\opt\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_LIB|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\backend;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;ZINT_VERSION="2.3.0";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling />
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>false</FunctionLevelLinking>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat />
</ClCompile>
<Link>
<AdditionalDependencies>libpngMD.lib;zlibMD.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>d:\opt\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\frontend\getopt.c" />
<ClCompile Include="..\frontend\getopt1.c" />
<ClCompile Include="..\frontend\main.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\frontend\resource.h" />
<ClInclude Include="frontend\getopt.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\frontend\zint.rc" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="libzint.vcxproj">
<Project>{5c08dc40-8f7d-475e-aa3c-814ded735a4b}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>