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

@ -59,7 +59,7 @@ static inline char check_digit(unsigned int count) {
} }
/* Code 2 of 5 Standard (Code 2 of 5 Matrix) */ /* Code 2 of 5 Standard (Code 2 of 5 Matrix) */
int matrix_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length) { int matrix_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length) {
int i, error_number; int i, error_number;
char dest[512]; /* 6 + 80 * 6 + 6 + 1 ~ 512*/ char dest[512]; /* 6 + 80 * 6 + 6 + 1 ~ 512*/
@ -84,7 +84,7 @@ int matrix_two_of_five(struct zint_symbol *symbol, unsigned char source[], int l
} }
/* Stop character */ /* Stop character */
strcat(dest, "41111"); strcat(dest, "41111");
expand(symbol, dest); expand(symbol, dest);
ustrcpy(symbol->text, source); ustrcpy(symbol->text, source);
@ -92,7 +92,7 @@ int matrix_two_of_five(struct zint_symbol *symbol, unsigned char source[], int l
} }
/* Code 2 of 5 Industrial */ /* Code 2 of 5 Industrial */
int industrial_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length) { int industrial_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length) {
int i, error_number; int i, error_number;
char dest[512]; /* 6 + 40 * 10 + 6 + 1 */ char dest[512]; /* 6 + 40 * 10 + 6 + 1 */
@ -117,7 +117,7 @@ int industrial_two_of_five(struct zint_symbol *symbol, unsigned char source[], i
} }
/* Stop character */ /* Stop character */
strcat(dest, "31113"); strcat(dest, "31113");
expand(symbol, dest); expand(symbol, dest);
ustrcpy(symbol->text, source); ustrcpy(symbol->text, source);
@ -125,7 +125,7 @@ int industrial_two_of_five(struct zint_symbol *symbol, unsigned char source[], i
} }
/* Code 2 of 5 IATA */ /* Code 2 of 5 IATA */
int iata_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length) { int iata_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length) {
int i, error_number; int i, error_number;
char dest[512]; /* 4 + 45 * 10 + 3 + 1 */ char dest[512]; /* 4 + 45 * 10 + 3 + 1 */
@ -149,7 +149,7 @@ int iata_two_of_five(struct zint_symbol *symbol, unsigned char source[], int len
} }
/* stop */ /* stop */
strcat(dest, "311"); strcat(dest, "311");
expand(symbol, dest); expand(symbol, dest);
ustrcpy(symbol->text, source); ustrcpy(symbol->text, source);
@ -157,7 +157,7 @@ int iata_two_of_five(struct zint_symbol *symbol, unsigned char source[], int len
} }
/* Code 2 of 5 Data Logic */ /* Code 2 of 5 Data Logic */
int logic_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length) { int logic_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length) {
int i, error_number; int i, error_number;
char dest[512]; /* 4 + 80 * 6 + 3 + 1 */ char dest[512]; /* 4 + 80 * 6 + 3 + 1 */
@ -182,7 +182,7 @@ int logic_two_of_five(struct zint_symbol *symbol, unsigned char source[], int le
} }
/* Stop character */ /* Stop character */
strcat(dest, "311"); strcat(dest, "311");
expand(symbol, dest); expand(symbol, dest);
ustrcpy(symbol->text, source); ustrcpy(symbol->text, source);
@ -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];
@ -219,7 +219,7 @@ int interleaved_two_of_five(struct zint_symbol *symbol, unsigned char source[],
ustrcpy(temp, (unsigned char *) "0"); ustrcpy(temp, (unsigned char *) "0");
length++; length++;
} }
strcat((char*)temp, (char*)source); strcat((char*) temp, (char*) source);
/* start character */ /* start character */
strcpy(dest, "1111"); strcpy(dest, "1111");
@ -240,11 +240,11 @@ int interleaved_two_of_five(struct zint_symbol *symbol, unsigned char source[],
k++; k++;
} }
mixed[k] = '\0'; mixed[k] = '\0';
strcat(dest, mixed); strcat(dest, mixed);
} }
/* Stop character */ /* Stop character */
strcat(dest, "311"); strcat(dest, "311");
expand(symbol, dest); expand(symbol, dest);
ustrcpy(symbol->text, temp); ustrcpy(symbol->text, temp);
@ -296,7 +296,7 @@ int itf14(struct zint_symbol *symbol, unsigned char source[], int length) {
} }
/* Deutshe Post Leitcode */ /* Deutshe Post Leitcode */
int dpleit(struct zint_symbol *symbol, unsigned char source[], int length) { int dpleit(struct zint_symbol *symbol, unsigned char source[], int length) {
int i, error_number; int i, error_number;
unsigned int count; unsigned int count;
char localstr[16]; char localstr[16];
@ -334,7 +334,7 @@ int dpleit(struct zint_symbol *symbol, unsigned char source[], int length) {
} }
/* Deutsche Post Identcode */ /* Deutsche Post Identcode */
int dpident(struct zint_symbol *symbol, unsigned char source[], int length) { int dpident(struct zint_symbol *symbol, unsigned char source[], int length) {
int i, error_number, zeroes; int i, error_number, zeroes;
unsigned int count; unsigned int count;
char localstr[16]; char localstr[16];

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

@ -68,8 +68,8 @@ 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 */
@ -189,13 +189,13 @@ int bmp_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width
data_size = symbol->bitmap_height * row_size; data_size = symbol->bitmap_height * row_size;
symbol->bitmap_byte_length = data_size; symbol->bitmap_byte_length = data_size;
file_header.header_field = 0x4d42; // "BM"
file_header.file_size = sizeof(bitmap_file_header_t) + sizeof(bitmap_info_header_t) + data_size;
file_header.reserved = 0;
file_header.data_offset = sizeof(bitmap_file_header_t) + sizeof(bitmap_info_header_t);
info_header.header_size = sizeof(bitmap_info_header_t); file_header.header_field = 0x4d42; // "BM"
file_header.file_size = sizeof (bitmap_file_header_t) + sizeof (bitmap_info_header_t) + data_size;
file_header.reserved = 0;
file_header.data_offset = sizeof (bitmap_file_header_t) + sizeof (bitmap_info_header_t);
info_header.header_size = sizeof (bitmap_info_header_t);
info_header.width = symbol->bitmap_width; info_header.width = symbol->bitmap_width;
info_header.height = symbol->bitmap_height; info_header.height = symbol->bitmap_height;
info_header.colour_planes = 1; info_header.colour_planes = 1;
@ -206,17 +206,17 @@ int bmp_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width
info_header.vert_res = 0; info_header.vert_res = 0;
info_header.colours = 0; info_header.colours = 0;
info_header.important_colours = 0; info_header.important_colours = 0;
bitmap_file_start = (unsigned char*)malloc(file_header.file_size); bitmap_file_start = (unsigned char*) malloc(file_header.file_size);
memset(bitmap_file_start, 0xff, file_header.file_size); memset(bitmap_file_start, 0xff, file_header.file_size);
bmp_posn = bitmap_file_start; bmp_posn = bitmap_file_start;
memcpy( bitmap_file_start, &file_header, sizeof(bitmap_file_header_t)); memcpy(bitmap_file_start, &file_header, sizeof (bitmap_file_header_t));
bmp_posn += sizeof(bitmap_file_header_t); bmp_posn += sizeof (bitmap_file_header_t);
memcpy(bmp_posn, &info_header, sizeof(bitmap_info_header_t) ); memcpy(bmp_posn, &info_header, sizeof (bitmap_info_header_t));
bmp_posn += sizeof(bitmap_info_header_t); bmp_posn += sizeof (bitmap_info_header_t);
memcpy(bmp_posn, symbol->bitmap, data_size); memcpy(bmp_posn, symbol->bitmap, data_size);
/* Open output file in binary mode */ /* Open output file in binary mode */
if ((symbol->output_options & BARCODE_STDOUT) != 0) { if ((symbol->output_options & BARCODE_STDOUT) != 0) {
#ifdef _MSC_VER #ifdef _MSC_VER
@ -232,10 +232,10 @@ int bmp_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width
return ZINT_ERROR_FILE_ACCESS; return ZINT_ERROR_FILE_ACCESS;
} }
} }
fwrite(bitmap_file_start, file_header.file_size, 1, bmp_file); fwrite(bitmap_file_start, file_header.file_size, 1, bmp_file);
fclose(bmp_file); fclose(bmp_file);
free(bitmap_file_start); free(bitmap_file_start);
return 0; return 0;
} }

View File

@ -36,11 +36,11 @@
extern "C" { extern "C" {
#endif #endif
#ifdef _MSC_VER #ifdef _MSC_VER
#include <windows.h> #include <windows.h>
#include "stdint_msvc.h" #include "stdint_msvc.h"
#else #else
#include <stdint.h> #include <stdint.h>
#endif #endif
typedef struct bitmap_file_header { typedef struct bitmap_file_header {
@ -48,12 +48,12 @@ extern "C" {
uint32_t file_size; uint32_t file_size;
uint32_t reserved; uint32_t reserved;
uint32_t data_offset; uint32_t data_offset;
} }
#ifdef __GNUC__ #ifdef __GNUC__
__attribute__((__packed__ )) __attribute__((__packed__))
#endif #endif
bitmap_file_header_t; bitmap_file_header_t;
typedef struct bitmap_info_header { typedef struct bitmap_info_header {
uint32_t header_size; uint32_t header_size;
int32_t width; int32_t width;
@ -66,11 +66,11 @@ extern "C" {
int32_t vert_res; int32_t vert_res;
uint32_t colours; uint32_t colours;
uint32_t important_colours; uint32_t important_colours;
} }
#ifdef __GNUC__ #ifdef __GNUC__
__attribute__((__packed__ )) __attribute__((__packed__))
#endif #endif
bitmap_info_header_t; bitmap_info_header_t;
#ifdef __cplusplus #ifdef __cplusplus
} }

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;
@ -168,11 +162,11 @@ void expand(struct zint_symbol *symbol, const char data[]) {
/* Indicates which symbologies can have row binding */ /* Indicates which symbologies can have row binding */
int is_stackable(const int symbology) { int is_stackable(const int symbology) {
int retval = 0; int retval = 0;
if (symbology < BARCODE_PDF417) { if (symbology < BARCODE_PDF417) {
retval = 1; retval = 1;
} }
switch (symbology) { switch (symbology) {
case BARCODE_CODE128B: case BARCODE_CODE128B:
case BARCODE_ISBNX: case BARCODE_ISBNX:

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)
} }
} }
@ -568,11 +568,11 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
if (debug) printf("RP "); if (debug) printf("RP ");
} }
} }
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);
} }
} }
} }
@ -1074,7 +1074,7 @@ static int dm200encode_remainder(unsigned char target[], int target_length, cons
if (process_p == 1) { if (process_p == 1) {
target[target_length] = (unsigned char) ((process_buffer[0] << 2) + ((31 & 0x30) >> 4)); target[target_length] = (unsigned char) ((process_buffer[0] << 2) + ((31 & 0x30) >> 4));
target_length++; target_length++;
target[target_length] = (unsigned char) ((31 & 0x0f) << 4) ; target[target_length] = (unsigned char) ((31 & 0x0f) << 4);
target_length++; target_length++;
target[target_length] = (unsigned char) 0; target[target_length] = (unsigned char) 0;
target_length++; target_length++;
@ -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"
@ -160,7 +160,7 @@ int score_array(char Dots[], int Hgt, int Wid) {
if ((!get_dot(Dots, Hgt, Wid, x - 1, y - 1)) if ((!get_dot(Dots, Hgt, Wid, x - 1, y - 1))
&& (!get_dot(Dots, Hgt, Wid, x + 1, y - 1)) && (!get_dot(Dots, Hgt, Wid, x + 1, y - 1))
&& (!get_dot(Dots, Hgt, Wid, x - 1, y + 1)) && (!get_dot(Dots, Hgt, Wid, x - 1, y + 1))
&&(!get_dot(Dots, Hgt, Wid, x + 1, y + 1)) && (!get_dot(Dots, Hgt, Wid, x + 1, y + 1))
&& ((!get_dot(Dots, Hgt, Wid, x, y)) && ((!get_dot(Dots, Hgt, Wid, x, y))
|| ((!get_dot(Dots, Hgt, Wid, x - 2, y)) || ((!get_dot(Dots, Hgt, Wid, x - 2, y))
&& (!get_dot(Dots, Hgt, Wid, x, y - 2)) && (!get_dot(Dots, Hgt, Wid, x, y - 2))
@ -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,9 +301,9 @@ 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;
for (i = position; (i < length) && datum_c(source, i, length); i += 2) { for (i = position; (i < length) && datum_c(source, i, length); i += 2) {
count++; count++;
@ -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,9 +326,9 @@ 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;
for (i = position; ((i < length) && datum_a(source, i, length)) for (i = position; ((i < length) && datum_a(source, i, length))
&& (try_c(source, i, length) < 2); i++) { && (try_c(source, i, length) < 2); i++) {
@ -339,9 +339,9 @@ 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;
for (i = position; ((i < length) && datum_b(source, i, length)) for (i = position; ((i < length) && datum_b(source, i, length))
&& (try_c(source, i, length) < 2); i++) { && (try_c(source, i, length) < 2); 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;
@ -391,7 +391,7 @@ int dotcode_encode_message(struct zint_symbol *symbol, unsigned char source[], i
codeword_array[array_length] = 107; // FNC1 codeword_array[array_length] = 107; // FNC1
array_length++; array_length++;
} }
if (symbol->eci > 3) { if (symbol->eci > 3) {
codeword_array[array_length] = 108; // FNC2 codeword_array[array_length] = 108; // FNC2
array_length++; array_length++;
@ -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;
@ -1065,10 +1066,10 @@ int dotcode(struct zint_symbol *symbol, unsigned char source[], int length) {
} }
min_dots = 9 * (data_length + 3 + (data_length / 2)) + 2; min_dots = 9 * (data_length + 3 + (data_length / 2)) + 2;
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++;
} }
@ -1092,16 +1093,19 @@ int dotcode(struct zint_symbol *symbol, unsigned char source[], int length) {
strcpy(symbol->errtxt, "Specified symbol size is too large"); strcpy(symbol->errtxt, "Specified symbol size is too large");
return ZINT_ERROR_INVALID_OPTION; return ZINT_ERROR_INVALID_OPTION;
} }
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++);
@ -1116,7 +1120,7 @@ int dotcode(struct zint_symbol *symbol, unsigned char source[], int length) {
codeword_array[data_length] = 106; // Pad codeword_array[data_length] = 106; // Pad
data_length++; data_length++;
} }
if (data_length > 450) { if (data_length > 450) {
// Larger data sets than this cause rsencode() to throw SIGSEGV // Larger data sets than this cause rsencode() to throw SIGSEGV
// This should probably be fixed by somebody who understands what rsencode() does... // This should probably be fixed by somebody who understands what rsencode() does...
@ -1125,7 +1129,7 @@ int dotcode(struct zint_symbol *symbol, unsigned char source[], int length) {
} }
ecc_length = 3 + (data_length / 2); ecc_length = 3 + (data_length / 2);
/* Evaluate data mask options */ /* Evaluate data mask options */
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
switch (i) { switch (i) {
@ -1160,16 +1164,16 @@ int dotcode(struct zint_symbol *symbol, unsigned char source[], int length) {
} }
break; break;
} }
rsencode(data_length + 1, ecc_length, masked_codeword_array); rsencode(data_length + 1, ecc_length, masked_codeword_array);
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");
} }
fold_dotstream(dot_stream, width, height, dot_array); fold_dotstream(dot_stream, width, height, dot_array);
mask_score[i] = score_array(dot_array, height, width); mask_score[i] = score_array(dot_array, height, width);
@ -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) {
@ -51,19 +55,19 @@ int utf_to_eci(int eci, const unsigned char source[], unsigned char dest[], int
dest[*length] = '\0'; dest[*length] = '\0';
return 0; return 0;
} }
in_posn = 0; in_posn = 0;
out_posn = 0; out_posn = 0;
do { do {
/* Single byte (ASCII) character */ /* Single byte (ASCII) character */
bytelen = 1; bytelen = 1;
glyph = (int)source[in_posn]; glyph = (int) source[in_posn];
if ((source[in_posn] >= 0x80) && (source[in_posn] < 0xc0)) { if ((source[in_posn] >= 0x80) && (source[in_posn] < 0xc0)) {
/* Something has gone wrong, abort */ /* Something has gone wrong, abort */
return ZINT_ERROR_INVALID_DATA; return ZINT_ERROR_INVALID_DATA;
} }
if ((source[in_posn] >= 0xc0) && (source[in_posn] < 0xe0)) { if ((source[in_posn] >= 0xc0) && (source[in_posn] < 0xe0)) {
/* Two-byte character */ /* Two-byte character */
bytelen = 2; bytelen = 2;
@ -72,78 +76,78 @@ int utf_to_eci(int eci, const unsigned char source[], unsigned char dest[], int
if (*length < (in_posn + 2)) { if (*length < (in_posn + 2)) {
return ZINT_ERROR_INVALID_DATA; return ZINT_ERROR_INVALID_DATA;
} }
if (source[in_posn + 1] > 0xc0) { if (source[in_posn + 1] > 0xc0) {
return ZINT_ERROR_INVALID_DATA; return ZINT_ERROR_INVALID_DATA;
} }
glyph += (source[in_posn + 1] & 0x3f); glyph += (source[in_posn + 1] & 0x3f);
} }
if ((source[in_posn] >= 0xe0) && (source[in_posn] < 0xf0)) { if ((source[in_posn] >= 0xe0) && (source[in_posn] < 0xf0)) {
/* Three-byte character */ /* Three-byte character */
bytelen = 3; bytelen = 3;
glyph = (source[in_posn] & 0x0f) << 12; glyph = (source[in_posn] & 0x0f) << 12;
if (*length < (in_posn + 2)) { if (*length < (in_posn + 2)) {
return ZINT_ERROR_INVALID_DATA; return ZINT_ERROR_INVALID_DATA;
} }
if (*length < (in_posn + 3)) { if (*length < (in_posn + 3)) {
return ZINT_ERROR_INVALID_DATA; return ZINT_ERROR_INVALID_DATA;
} }
if (source[in_posn + 1] > 0xc0) { if (source[in_posn + 1] > 0xc0) {
return ZINT_ERROR_INVALID_DATA; return ZINT_ERROR_INVALID_DATA;
} }
if (source[in_posn + 2] > 0xc0) { if (source[in_posn + 2] > 0xc0) {
return ZINT_ERROR_INVALID_DATA; return ZINT_ERROR_INVALID_DATA;
} }
glyph += (source[in_posn + 1] & 0x3f) << 6; glyph += (source[in_posn + 1] & 0x3f) << 6;
glyph += (source[in_posn + 2] & 0x3f); glyph += (source[in_posn + 2] & 0x3f);
} }
if ((source[in_posn] >= 0xf0) && (source[in_posn] < 0xf7)) { if ((source[in_posn] >= 0xf0) && (source[in_posn] < 0xf7)) {
/* Four-byte character */ /* Four-byte character */
bytelen = 4; bytelen = 4;
glyph = (source[in_posn] & 0x07) << 18; glyph = (source[in_posn] & 0x07) << 18;
if (*length < (in_posn + 2)) { if (*length < (in_posn + 2)) {
return ZINT_ERROR_INVALID_DATA; return ZINT_ERROR_INVALID_DATA;
} }
if (*length < (in_posn + 3)) { if (*length < (in_posn + 3)) {
return ZINT_ERROR_INVALID_DATA; return ZINT_ERROR_INVALID_DATA;
} }
if (*length < (in_posn + 4)) { if (*length < (in_posn + 4)) {
return ZINT_ERROR_INVALID_DATA; return ZINT_ERROR_INVALID_DATA;
} }
if (source[in_posn + 1] > 0xc0) { if (source[in_posn + 1] > 0xc0) {
return ZINT_ERROR_INVALID_DATA; return ZINT_ERROR_INVALID_DATA;
} }
if (source[in_posn + 2] > 0xc0) { if (source[in_posn + 2] > 0xc0) {
return ZINT_ERROR_INVALID_DATA; return ZINT_ERROR_INVALID_DATA;
} }
if (source[in_posn + 3] > 0xc0) { if (source[in_posn + 3] > 0xc0) {
return ZINT_ERROR_INVALID_DATA; return ZINT_ERROR_INVALID_DATA;
} }
glyph += (source[in_posn + 1] & 0x3f) << 12; glyph += (source[in_posn + 1] & 0x3f) << 12;
glyph += (source[in_posn + 2] & 0x3f) << 6; glyph += (source[in_posn + 2] & 0x3f) << 6;
glyph += (source[in_posn + 3] & 0x3f); glyph += (source[in_posn + 3] & 0x3f);
} }
if (source[in_posn] >= 0xf7) { if (source[in_posn] >= 0xf7) {
/* More than 4 bytes not supported */ /* More than 4 bytes not supported */
return ZINT_ERROR_INVALID_DATA; return ZINT_ERROR_INVALID_DATA;
} }
if (glyph < 128) { if (glyph < 128) {
dest[out_posn] = glyph; dest[out_posn] = glyph;
} else { } else {
@ -268,12 +272,12 @@ int utf_to_eci(int eci, const unsigned char source[], unsigned char dest[], int
break; break;
} }
} }
if (!(done)) { if (!(done)) {
return ZINT_ERROR_INVALID_DATA; return ZINT_ERROR_INVALID_DATA;
} }
} }
in_posn += bytelen; in_posn += bytelen;
out_posn++; out_posn++;
} while (in_posn < *length); } while (in_posn < *length);
@ -292,14 +296,14 @@ int get_best_eci(unsigned char source[], int length) {
#else #else
unsigned char *local_source = (unsigned char*) _alloca(length + 1); unsigned char *local_source = (unsigned char*) _alloca(length + 1);
#endif #endif
do { do {
if (utf_to_eci(eci, source, local_source, &length) == 0) { if (utf_to_eci(eci, source, local_source, &length) == 0) {
return eci; return eci;
} }
eci++; eci++;
} while (eci < 25); } while (eci < 25);
return 26; // If all of these fail, use Unicode! return 26; // If all of these fail, use Unicode!
} }

View File

@ -35,214 +35,214 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
static 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,
0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf,
0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df,
0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
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_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, 0x0104, 0x02d8, 0x0141, 0x00a4, 0x013d, 0x015a, 0x00a7, 0x00a8, 0x0160, 0x015e, 0x0164, 0x0179, 0x00ad, 0x017d, 0x017b, 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
0x00b0, 0x0105, 0x02db, 0x0142, 0x00b4, 0x013e, 0x015b, 0x02c7, 0x00b8, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c, 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf,
0x0154, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0139, 0x0106, 0x00c7, 0x010c, 0x00c9, 0x0118, 0x00cb, 0x011a, 0x00cd, 0x00ce, 0x010e, 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
0x0110, 0x0143, 0x0147, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x00d7, 0x0158, 0x016e, 0x00da, 0x0170, 0x00dc, 0x00dd, 0x0162, 0x00df, 0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df,
0x0155, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x013a, 0x0107, 0x00e7, 0x010d, 0x00e9, 0x0119, 0x00eb, 0x011b, 0x00ed, 0x00ee, 0x010f, 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7, 0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff
}; };
static int iso_8859_3[] = { // Latin alphabet No. 3 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, 0x0126, 0x02d8, 0x00a3, 0x00a4, 0x0000, 0x0124, 0x00a7, 0x00a8, 0x0130, 0x015e, 0x011e, 0x0134, 0x00ad, 0x0000, 0x017b, 0x00a0, 0x0104, 0x02d8, 0x0141, 0x00a4, 0x013d, 0x015a, 0x00a7, 0x00a8, 0x0160, 0x015e, 0x0164, 0x0179, 0x00ad, 0x017d, 0x017b,
0x00b0, 0x0127, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x0125, 0x00b7, 0x00b8, 0x0131, 0x015f, 0x011f, 0x0135, 0x00bd, 0x0000, 0x017c, 0x00b0, 0x0105, 0x02db, 0x0142, 0x00b4, 0x013e, 0x015b, 0x02c7, 0x00b8, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c,
0x00c0, 0x00c1, 0x00c2, 0x0000, 0x00c4, 0x010a, 0x0108, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, 0x0154, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0139, 0x0106, 0x00c7, 0x010c, 0x00c9, 0x0118, 0x00cb, 0x011a, 0x00cd, 0x00ce, 0x010e,
0x0000, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x0120, 0x00d6, 0x00d7, 0x011c, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x016c, 0x015c, 0x00df, 0x0110, 0x0143, 0x0147, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x00d7, 0x0158, 0x016e, 0x00da, 0x0170, 0x00dc, 0x00dd, 0x0162, 0x00df,
0x00e0, 0x00e1, 0x00e2, 0x0000, 0x00e4, 0x010b, 0x0109, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, 0x0155, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x013a, 0x0107, 0x00e7, 0x010d, 0x00e9, 0x0119, 0x00eb, 0x011b, 0x00ed, 0x00ee, 0x010f,
0x0000, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x0121, 0x00f6, 0x00f7, 0x011d, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x016d, 0x015d, 0x02d9 0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7, 0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9
}; };
static int iso_8859_4[] = { // Latin alphabet No. 4 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, 0x0104, 0x0138, 0x0156, 0x00a4, 0x012b, 0x013b, 0x00a7, 0x00a8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00ad, 0x017d, 0x00af, 0x00a0, 0x0126, 0x02d8, 0x00a3, 0x00a4, 0x0000, 0x0124, 0x00a7, 0x00a8, 0x0130, 0x015e, 0x011e, 0x0134, 0x00ad, 0x0000, 0x017b,
0x00b0, 0x0105, 0x02db, 0x0157, 0x00b4, 0x0129, 0x013c, 0x02c7, 0x00b8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014a, 0x017e, 0x014b, 0x00b0, 0x0127, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x0125, 0x00b7, 0x00b8, 0x0131, 0x015f, 0x011f, 0x0135, 0x00bd, 0x0000, 0x017c,
0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e, 0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x012a, 0x00c0, 0x00c1, 0x00c2, 0x0000, 0x00c4, 0x010a, 0x0108, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
0x0110, 0x0145, 0x014c, 0x0136, 0x00d4, 0x00d5, 0x00d6, 0x00d7, 0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x0168, 0x016a, 0x00df, 0x0000, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x0120, 0x00d6, 0x00d7, 0x011c, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x016c, 0x015c, 0x00df,
0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f, 0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x012b, 0x00e0, 0x00e1, 0x00e2, 0x0000, 0x00e4, 0x010b, 0x0109, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
0x0111, 0x0146, 0x014d, 0x0137, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x0169, 0x016b, 0x02d9 0x0000, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x0121, 0x00f6, 0x00f7, 0x011d, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x016d, 0x015d, 0x02d9
}; };
static int iso_8859_5[] = { // Latin/Cyrillic alphabet 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, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x00ad, 0x040e, 0x040f, 0x00a0, 0x0104, 0x0138, 0x0156, 0x00a4, 0x012b, 0x013b, 0x00a7, 0x00a8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00ad, 0x017d, 0x00af,
0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, 0x00b0, 0x0105, 0x02db, 0x0157, 0x00b4, 0x0129, 0x013c, 0x02c7, 0x00b8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014a, 0x017e, 0x014b,
0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, 0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e, 0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x012a,
0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, 0x0110, 0x0145, 0x014c, 0x0136, 0x00d4, 0x00d5, 0x00d6, 0x00d7, 0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x0168, 0x016a, 0x00df,
0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, 0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f, 0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x012b,
0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x00a7, 0x045e, 0x045f 0x0111, 0x0146, 0x014d, 0x0137, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x0169, 0x016b, 0x02d9
}; };
static int iso_8859_6[] = { // Latin/Arabic 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, 0x0000, 0x0000, 0x0000, 0x00a4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x060c, 0x00ad, 0x0000, 0x0000, 0x00a0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x00ad, 0x040e, 0x040f,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x061b, 0x0000, 0x0000, 0x0000, 0x061f, 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f,
0x0000, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f,
0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, 0x0638, 0x0639, 0x063a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f,
0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, 0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f,
0x0650, 0x0651, 0x0652, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x00a7, 0x045e, 0x045f
}; };
static int iso_8859_7[] = { // Latin/Greek 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, 0x2018, 0x2019, 0x00a3, 0x20ac, 0x20af, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x037a, 0x00ab, 0x00ac, 0x00ad, 0x0000, 0x2015, 0x00a0, 0x0000, 0x0000, 0x0000, 0x00a4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x060c, 0x00ad, 0x0000, 0x0000,
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x0384, 0x0385, 0x0386, 0x00b7, 0x0388, 0x0389, 0x038a, 0x00bb, 0x038c, 0x00bd, 0x038e, 0x038f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x061b, 0x0000, 0x0000, 0x0000, 0x061f,
0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, 0x0000, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f,
0x03a0, 0x03a1, 0x0000, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9, 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, 0x0638, 0x0639, 0x063a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x03b0, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, 0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f,
0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, 0x03ca, 0x03cb, 0x03cc, 0x03cd, 0x03ce, 0x0000 0x0650, 0x0651, 0x0652, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
}; };
static int iso_8859_8[] = { // Latin/Hebrew 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, 0x0000, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00d7, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, 0x00a0, 0x2018, 0x2019, 0x00a3, 0x20ac, 0x20af, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x037a, 0x00ab, 0x00ac, 0x00ad, 0x0000, 0x2015,
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00f7, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x0000, 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x0384, 0x0385, 0x0386, 0x00b7, 0x0388, 0x0389, 0x038a, 0x00bb, 0x038c, 0x00bd, 0x038e, 0x038f,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2017, 0x03a0, 0x03a1, 0x0000, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9, 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03ae, 0x03af,
0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, 0x03b0, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf,
0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, 0x05e8, 0x05e9, 0x05ea, 0x0000, 0x0000, 0x200e, 0x200f, 0x0000 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, 0x03ca, 0x03cb, 0x03cc, 0x03cd, 0x03ce, 0x0000
}; };
static int iso_8859_9[] = { // Latin alphabet No. 5 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, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, 0x00a0, 0x0000, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00d7, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00f7, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x0000,
0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x011e, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0130, 0x015e, 0x00df, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2017,
0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df,
0x011f, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0131, 0x015f, 0x00ff 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, 0x05e8, 0x05e9, 0x05ea, 0x0000, 0x0000, 0x200e, 0x200f, 0x0000
}; };
static int iso_8859_10[] = { // Latin alphabet No. 6 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, 0x0104, 0x0112, 0x0122, 0x012a, 0x012b, 0x0136, 0x00a7, 0x013b, 0x0110, 0x0160, 0x0166, 0x017d, 0x00ad, 0x016a, 0x014a, 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
0x00b0, 0x0105, 0x0113, 0x0123, 0x012b, 0x0129, 0x0137, 0x00b7, 0x013c, 0x0111, 0x0161, 0x0167, 0x017e, 0x2015, 0x016b, 0x014b, 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf,
0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e, 0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x00cf, 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
0x00d0, 0x0145, 0x014c, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x0168, 0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, 0x011e, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0130, 0x015e, 0x00df,
0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f, 0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x00ef, 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
0x00f0, 0x0146, 0x014d, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x0169, 0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x0138 0x011f, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0131, 0x015f, 0x00ff
}; };
static int iso_8859_11[] = { // Latin/Thai alphabet 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, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, 0x00a0, 0x0104, 0x0112, 0x0122, 0x012a, 0x012b, 0x0136, 0x00a7, 0x013b, 0x0110, 0x0160, 0x0166, 0x017d, 0x00ad, 0x016a, 0x014a,
0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, 0x00b0, 0x0105, 0x0113, 0x0123, 0x012b, 0x0129, 0x0137, 0x00b7, 0x013c, 0x0111, 0x0161, 0x0167, 0x017e, 0x2015, 0x016b, 0x014b,
0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, 0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e, 0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x00cf,
0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e36, 0x0e36, 0x0e37, 0x0e38, 0x0e39, 0x0e3a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0e3f, 0x00d0, 0x0145, 0x014c, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x0168, 0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df,
0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e4e, 0x0e4f, 0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f, 0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x00ef,
0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, 0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0x0000, 0x0000, 0x0000, 0x0000 0x00f0, 0x0146, 0x014d, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x0169, 0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x0138
}; };
static int iso_8859_13[] = { // Latin alphabet No. 7 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, 0x201d, 0x00a2, 0x00a3, 0x00a4, 0x201e, 0x00a6, 0x00a7, 0x00d8, 0x00a9, 0x0156, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00c6, 0x00a0, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f,
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x201c, 0x00b5, 0x00b6, 0x00b7, 0x00f8, 0x00b9, 0x0157, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00e6, 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f,
0x0104, 0x012e, 0x0100, 0x0106, 0x00c4, 0x00c5, 0x0118, 0x0112, 0x010c, 0x00c9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012a, 0x013b, 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f,
0x0160, 0x0143, 0x0145, 0x00d3, 0x014c, 0x00d5, 0x00d6, 0x00d7, 0x0172, 0x0141, 0x015a, 0x016a, 0x00dc, 0x017b, 0x017d, 0x00df, 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e36, 0x0e36, 0x0e37, 0x0e38, 0x0e39, 0x0e3a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0e3f,
0x0105, 0x012f, 0x0101, 0x0107, 0x00e4, 0x00e5, 0x0119, 0x0113, 0x010d, 0x00e9, 0x017a, 0x0117, 0x0123, 0x0137, 0x012b, 0x013c, 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e4e, 0x0e4f,
0x0161, 0x0144, 0x0146, 0x00f3, 0x014d, 0x00f5, 0x00f6, 0x00f7, 0x0173, 0x0142, 0x015b, 0x016b, 0x00fc, 0x017c, 0x017e, 0x2019 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, 0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0x0000, 0x0000, 0x0000, 0x0000
}; };
static int iso_8859_14[] = { // Latin alphabet No. 8 (Celtic) 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, 0x1e02, 0x1e03, 0x00a3, 0x010a, 0x010b, 0x1e0a, 0x00a7, 0x1e80, 0x00a9, 0x1e82, 0x1e0b, 0x1ef2, 0x00ad, 0x00ae, 0x0178, 0x00a0, 0x201d, 0x00a2, 0x00a3, 0x00a4, 0x201e, 0x00a6, 0x00a7, 0x00d8, 0x00a9, 0x0156, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00c6,
0x1e1e, 0x1e1f, 0x0120, 0x0121, 0x1e40, 0x1e41, 0x00b6, 0x1e56, 0x1e81, 0x1e57, 0x1e83, 0x1e60, 0x1ef3, 0x1e84, 0x1e85, 0x1e61, 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x201c, 0x00b5, 0x00b6, 0x00b7, 0x00f8, 0x00b9, 0x0157, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00e6,
0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, 0x0104, 0x012e, 0x0100, 0x0106, 0x00c4, 0x00c5, 0x0118, 0x0112, 0x010c, 0x00c9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012a, 0x013b,
0x0174, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x1e6a, 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x0176, 0x00df, 0x0160, 0x0143, 0x0145, 0x00d3, 0x014c, 0x00d5, 0x00d6, 0x00d7, 0x0172, 0x0141, 0x015a, 0x016a, 0x00dc, 0x017b, 0x017d, 0x00df,
0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, 0x0105, 0x012f, 0x0101, 0x0107, 0x00e4, 0x00e5, 0x0119, 0x0113, 0x010d, 0x00e9, 0x017a, 0x0117, 0x0123, 0x0137, 0x012b, 0x013c,
0x0175, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x1e6b, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x0177, 0x00ff 0x0161, 0x0144, 0x0146, 0x00f3, 0x014d, 0x00f5, 0x00f6, 0x00f7, 0x0173, 0x0142, 0x015b, 0x016b, 0x00fc, 0x017c, 0x017e, 0x2019
}; };
static int iso_8859_15[] = { // Latin alphabet No. 9 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, 0x00a1, 0x00a2, 0x00a3, 0x20ac, 0x00a5, 0x0160, 0x00a7, 0x0161, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, 0x00a0, 0x1e02, 0x1e03, 0x00a3, 0x010a, 0x010b, 0x1e0a, 0x00a7, 0x1e80, 0x00a9, 0x1e82, 0x1e0b, 0x1ef2, 0x00ad, 0x00ae, 0x0178,
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x017d, 0x00b5, 0x00b6, 0x00b7, 0x017e, 0x00b9, 0x00ba, 0x00bb, 0x0152, 0x0153, 0x0178, 0x00bf, 0x1e1e, 0x1e1f, 0x0120, 0x0121, 0x1e40, 0x1e41, 0x00b6, 0x1e56, 0x1e81, 0x1e57, 0x1e83, 0x1e60, 0x1ef3, 0x1e84, 0x1e85, 0x1e61,
0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, 0x0174, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x1e6a, 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x0176, 0x00df,
0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff 0x0175, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x1e6b, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x0177, 0x00ff
}; };
static int iso_8859_16[] = { // Latin alphabet No. 10 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, 0x0104, 0x0105, 0x0141, 0x20ac, 0x201e, 0x0160, 0x00a7, 0x0161, 0x00a9, 0x0218, 0x00ab, 0x0179, 0x00ad, 0x017a, 0x017b, 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x20ac, 0x00a5, 0x0160, 0x00a7, 0x0161, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
0x00b0, 0x00b1, 0x010c, 0x0142, 0x017d, 0x201d, 0x00b6, 0x00b7, 0x017e, 0x010d, 0x0219, 0x00bb, 0x0152, 0x0153, 0x0178, 0x017c, 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x017d, 0x00b5, 0x00b6, 0x00b7, 0x017e, 0x00b9, 0x00ba, 0x00bb, 0x0152, 0x0153, 0x0178, 0x00bf,
0x00c0, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0106, 0x00c6, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
0x00e0, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x0107, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, 0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df,
0x0111, 0x0144, 0x00f2, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x015b, 0x0171, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0119, 0x021b, 0x00ff 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
}; 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff
};
static int windows_1250[] = { static const int iso_8859_16[] = {// Latin alphabet No. 10
0x20ac, 0x0000, 0x201a, 0x0000, 0x201e, 0x2026, 0x2020, 0x2021, 0x0000, 0x2030, 0x0160, 0x2039, 0x015a, 0x0164, 0x017d, 0x0179, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x0000, 0x2122, 0x0161, 0x203a, 0x015b, 0x0165, 0x017e, 0x017a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x00a0, 0x02c7, 0x02db, 0x0141, 0x00a4, 0x0104, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x015e, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x017b, 0x00a0, 0x0104, 0x0105, 0x0141, 0x20ac, 0x201e, 0x0160, 0x00a7, 0x0161, 0x00a9, 0x0218, 0x00ab, 0x0179, 0x00ad, 0x017a, 0x017b,
0x00b0, 0x00b1, 0x02db, 0x0142, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x0105, 0x015f, 0x00bb, 0x013d, 0x02dd, 0x013e, 0x017c, 0x00b0, 0x00b1, 0x010c, 0x0142, 0x017d, 0x201d, 0x00b6, 0x00b7, 0x017e, 0x010d, 0x0219, 0x00bb, 0x0152, 0x0153, 0x0178, 0x017c,
0x0154, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0139, 0x0106, 0x00c7, 0x010c, 0x00c9, 0x0118, 0x00cb, 0x011a, 0x00cd, 0x00ce, 0x010e, 0x00c0, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0106, 0x00c6, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
0x0110, 0x0143, 0x0147, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x00d7, 0x0158, 0x016e, 0x00da, 0x0170, 0x00dc, 0x00dd, 0x0162, 0x00df, 0x00e0, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x0107, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
0x0155, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x013a, 0x0107, 0x00e7, 0x010d, 0x00e9, 0x0119, 0x00eb, 0x011b, 0x00ed, 0x00ee, 0x010f, 0x0111, 0x0144, 0x00f2, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x015b, 0x0171, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0119, 0x021b, 0x00ff
0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7, 0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9 };
};
static int windows_1251[] = { static const int windows_1250[] = {
0x0402, 0x0403, 0x201a, 0x0453, 0x201e, 0x2026, 0x2020, 0x2021, 0x20ac, 0x2030, 0x0409, 0x2039, 0x040a, 0x040c, 0x040b, 0x040f, 0x20ac, 0x0000, 0x201a, 0x0000, 0x201e, 0x2026, 0x2020, 0x2021, 0x0000, 0x2030, 0x0160, 0x2039, 0x015a, 0x0164, 0x017d, 0x0179,
0x0452, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x0000, 0x2122, 0x0459, 0x203a, 0x045a, 0x045c, 0x045b, 0x045f, 0x0000, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x0000, 0x2122, 0x0161, 0x203a, 0x015b, 0x0165, 0x017e, 0x017a,
0x00a0, 0x040e, 0x045e, 0x0408, 0x00a4, 0x0490, 0x00a6, 0x00a7, 0x0401, 0x00a9, 0x0404, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x0407, 0x00a0, 0x02c7, 0x02db, 0x0141, 0x00a4, 0x0104, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x015e, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x017b,
0x00b0, 0x00b1, 0x0406, 0x0456, 0x0491, 0x00b5, 0x00b6, 0x00b7, 0x0451, 0x2116, 0x0454, 0x00bb, 0x0458, 0x0405, 0x0455, 0x0457, 0x00b0, 0x00b1, 0x02db, 0x0142, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x0105, 0x015f, 0x00bb, 0x013d, 0x02dd, 0x013e, 0x017c,
0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, 0x0154, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0139, 0x0106, 0x00c7, 0x010c, 0x00c9, 0x0118, 0x00cb, 0x011a, 0x00cd, 0x00ce, 0x010e,
0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, 0x0110, 0x0143, 0x0147, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x00d7, 0x0158, 0x016e, 0x00da, 0x0170, 0x00dc, 0x00dd, 0x0162, 0x00df,
0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, 0x0155, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x013a, 0x0107, 0x00e7, 0x010d, 0x00e9, 0x0119, 0x00eb, 0x011b, 0x00ed, 0x00ee, 0x010f,
0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f 0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7, 0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9
}; };
static int windows_1252[] = { static const int windows_1251[] = {
0x20ac, 0x0000, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, 0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0x0000, 0x017d, 0x0000, 0x0402, 0x0403, 0x201a, 0x0453, 0x201e, 0x2026, 0x2020, 0x2021, 0x20ac, 0x2030, 0x0409, 0x2039, 0x040a, 0x040c, 0x040b, 0x040f,
0x0000, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0x0000, 0x017e, 0x0178, 0x0452, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x0000, 0x2122, 0x0459, 0x203a, 0x045a, 0x045c, 0x045b, 0x045f,
0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, 0x00a0, 0x040e, 0x045e, 0x0408, 0x00a4, 0x0490, 0x00a6, 0x00a7, 0x0401, 0x00a9, 0x0404, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x0407,
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, 0x00b0, 0x00b1, 0x0406, 0x0456, 0x0491, 0x00b5, 0x00b6, 0x00b7, 0x0451, 0x2116, 0x0454, 0x00bb, 0x0458, 0x0405, 0x0455, 0x0457,
0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f,
0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f,
0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f,
0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f
}; };
static int windows_1256[] = { static const int windows_1252[] = {
0x20ac, 0x067e, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, 0x02c6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688, 0x20ac, 0x0000, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, 0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0x0000, 0x017d, 0x0000,
0x06af, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x06a9, 0x2122, 0x0691, 0x203a, 0x0153, 0x200c, 0x200d, 0x06ba, 0x0000, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0x0000, 0x017e, 0x0178,
0x00a0, 0x060c, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x06be, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x061b, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x061f, 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf,
0x06c1, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x00d7, 0x0637, 0x0638, 0x0639, 0x063a, 0x0640, 0x0641, 0x0642, 0x0643, 0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df,
0x00e0, 0x0644, 0x00e2, 0x0645, 0x0646, 0x0647, 0x0648, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x0649, 0x064a, 0x00ee, 0x00ef, 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
0x064b, 0x064c, 0x064d, 0x064e, 0x00f4, 0x064f, 0x0650, 0x00f7, 0x0651, 0x00f9, 0x0652, 0x00fb, 0x00fc, 0x200e, 0x200f, 0x06d2 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff
}; };
static const int windows_1256[] = {
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,
0x00a0, 0x060c, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x06be, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x061b, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x061f,
0x06c1, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f,
0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x00d7, 0x0637, 0x0638, 0x0639, 0x063a, 0x0640, 0x0641, 0x0642, 0x0643,
0x00e0, 0x0644, 0x00e2, 0x0645, 0x0646, 0x0647, 0x0648, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x0649, 0x064a, 0x00ee, 0x00ef,
0x064b, 0x064c, 0x064d, 0x064e, 0x00f4, 0x064f, 0x0650, 0x00f7, 0x0651, 0x00f9, 0x0652, 0x00fb, 0x00fc, 0x200e, 0x200f, 0x06d2
};
#ifdef __cplusplus #ifdef __cplusplus
} }

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"
@ -53,232 +53,211 @@
#include <stdlib.h> #include <stdlib.h>
typedef struct s_statestruct { typedef struct s_statestruct {
unsigned char * pOut; unsigned char * pOut;
unsigned char *pIn; unsigned char *pIn;
unsigned int InLen; unsigned int InLen;
unsigned int OutLength; unsigned int OutLength;
unsigned int OutPosCur; unsigned int OutPosCur;
unsigned int OutByteCountPos; unsigned int OutByteCountPos;
unsigned short ClearCode; unsigned short ClearCode;
unsigned short FreeCode; unsigned short FreeCode;
char fByteCountByteSet; char fByteCountByteSet;
unsigned char OutBitsFree; unsigned char OutBitsFree;
unsigned short NodeAxon[4096]; unsigned short NodeAxon[4096];
unsigned short NodeNext[4096]; unsigned short NodeNext[4096];
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 * inserted in general.
* inserted in general. * If this is true, and the distance to the last byte count position is 256
* If this is true, and the distance to the last byte count position is 256 * (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->OutByteCountPos = pState->OutPosCur;
(pState->pOut)[pState->OutByteCountPos] = 255; (pState->OutPosCur)++;
pState->OutByteCountPos = pState->OutPosCur; }
(pState->OutPosCur)++; if (pState->OutPosCur >= pState->OutLength)
} return 1;
if ( pState->OutPosCur >= pState->OutLength ) (pState->pOut)[pState->OutPosCur] = 0x00;
return 1; return 0;
(pState->pOut)[pState->OutPosCur]=0x00;
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)
{ (CodeIn << (8 - pState->OutBitsFree));
(pState->pOut)[pState->OutPosCur] |= (unsigned char) if (BufferNextByte(pState))
( CodeIn << ( 8 - pState->OutBitsFree ) ); return -1;
if ( BufferNextByte(pState) ) CodeIn = (unsigned short) (CodeIn >> pState->OutBitsFree);
return -1; CodeBits -= pState->OutBitsFree;
CodeIn = (unsigned short) ( CodeIn >> pState->OutBitsFree ); pState->OutBitsFree = 8;
CodeBits -= pState->OutBitsFree; /* Write a full byte if there are at least 8 code bits left */
pState->OutBitsFree = 8; if (CodeBits >= pState->OutBitsFree) {
/* Write a full byte if there are at least 8 code bits left */ (pState->pOut)[pState->OutPosCur] = (unsigned char) CodeIn;
if (CodeBits >= pState->OutBitsFree) if (BufferNextByte(pState))
{ return -1;
(pState->pOut)[pState->OutPosCur] = (unsigned char) CodeIn; CodeIn = (unsigned short) (CodeIn >> 8);
if ( BufferNextByte(pState) ) CodeBits -= 8;
return -1; }
CodeIn = (unsigned short) ( CodeIn >> 8 ); }
CodeBits -= 8; /* The remaining bits of CodeIn fit in the current byte. */
} if (CodeBits > 0) {
} (pState->pOut)[pState->OutPosCur] |= (unsigned char)
/* The remaining bits of CodeIn fit in the current byte. */ (CodeIn << (8 - pState->OutBitsFree));
if( CodeBits > 0 ) pState->OutBitsFree -= CodeBits;
{ }
(pState->pOut)[pState->OutPosCur] |= (unsigned char) return 0;
( CodeIn << ( 8 - pState->OutBitsFree ) );
pState->OutBitsFree -= CodeBits;
}
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 Outlet;
unsigned short FindPixelOutlet( statestruct *pState, unsigned short HeadNode, unsigned char Byte ) Outlet = (pState->NodeAxon)[HeadNode];
{ while (Outlet) {
unsigned short Outlet; if ((pState->NodePix)[Outlet] == Byte)
return Outlet;
Outlet = (pState->NodeAxon)[HeadNode]; Outlet = (pState->NodeNext)[Outlet];
while( Outlet ) }
{ return 0;
if ( (pState->NodePix)[Outlet] == Byte )
return Outlet;
Outlet = (pState->NodeNext)[Outlet];
}
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 */ UpNode = *pPixelValueCur;
UpNode = *pPixelValueCur; if ((pState->InLen) == 0)
if ( (pState->InLen) == 0 ) return AddCodeToBuffer(pState, UpNode, CodeBits);
return AddCodeToBuffer(pState, UpNode, CodeBits );
*pPixelValueCur = (*(pState->pIn)) - '0';
*pPixelValueCur = (*(pState->pIn))-'0'; (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;
{ if ((pState->InLen) == 0)
UpNode = DownNode; return AddCodeToBuffer(pState, UpNode, CodeBits);
if ( (pState->InLen) == 0 )
return AddCodeToBuffer(pState, UpNode, CodeBits); *pPixelValueCur = (*(pState->pIn)) - '0';
(pState->pIn)++;
*pPixelValueCur = (*(pState->pIn)) - '0'; (pState->InLen)--;
(pState->pIn)++; }
(pState->InLen)--; /* Submit 'UpNode' which is the code of the longest string */
} if (AddCodeToBuffer(pState, UpNode, CodeBits))
/* Submit 'UpNode' which is the code of the longest string */ return -1;
if ( AddCodeToBuffer(pState, UpNode, CodeBits ) ) /* ... and extend the string by appending 'PixelValueCur' */
return -1; /* Create a successor node for 'PixelValueCur' whose code is 'freecode' */
/* ... and extend the string by appending 'PixelValueCur' */ (pState->NodePix)[pState->FreeCode] = *pPixelValueCur;
/* Create a successor node for 'PixelValueCur' whose code is 'freecode' */ (pState->NodeAxon)[pState->FreeCode] = (pState->NodeNext)[pState->FreeCode] = 0;
(pState->NodePix)[pState->FreeCode] = *pPixelValueCur; /* ...and link it to the end of the chain emanating from fg_axon[UpNode]. */
(pState->NodeAxon)[pState->FreeCode] = (pState->NodeNext)[pState->FreeCode]=0; DownNode = (pState->NodeAxon)[UpNode];
/* ...and link it to the end of the chain emanating from fg_axon[UpNode]. */ if (!DownNode) {
DownNode = (pState->NodeAxon)[UpNode]; (pState->NodeAxon)[UpNode] = pState->FreeCode;
if( ! DownNode ) } else {
{ while ((pState->NodeNext)[DownNode]) {
(pState->NodeAxon)[UpNode] = pState->FreeCode; DownNode = (pState->NodeNext)[DownNode];
} else { }
while( (pState->NodeNext)[DownNode] ) (pState->NodeNext)[DownNode] = pState->FreeCode;
{ }
DownNode = (pState->NodeNext)[DownNode]; return 1;
}
(pState->NodeNext)[DownNode] = pState->FreeCode;
}
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; statestruct State;
statestruct State;
State.pIn = pIn;
State.pIn = pIn; State.InLen = InLen;
State.InLen = InLen; State.pOut = pOut;
State.pOut = pOut; State.OutLength = OutLength;
State.OutLength = OutLength; // > Get first data byte
// > Get first data byte if (State.InLen == 0)
if (State.InLen == 0) return 0;
return 0;
PixelValueCur = (unsigned char) ((*(State.pIn)) - '0');
PixelValueCur = (unsigned char) ((*(State.pIn)) - '0'); (State.pIn)++;
(State.pIn)++; (State.InLen)--;
(State.InLen)--; CodeBits = 3;
CodeBits = 3; State.ClearCode = 4;
State.ClearCode = 4; State.FreeCode = 6;
State.FreeCode = 6; State.OutBitsFree = 8;
State.OutBitsFree = 8; State.OutPosCur = -1;
State.OutPosCur = -1; State.fByteCountByteSet = 0;
State.fByteCountByteSet = 0;
if (BufferNextByte(&State))
if ( BufferNextByte(&State) ) return 0;
return 0;
for (Pos = 0; Pos < State.ClearCode; Pos++)
for ( Pos = 0; Pos < State.ClearCode; Pos++) State.NodePix[Pos] = (unsigned char) Pos;
State.NodePix[Pos] = (unsigned char) Pos;
FlushStringTable(&State);
FlushStringTable(&State);
/* Write what the GIF specification calls the "code size". */
/* Write what the GIF specification calls the "code size". */ (State.pOut)[State.OutPosCur] = 2;
(State.pOut)[State.OutPosCur] = 2; /* Reserve first bytecount byte */
/* Reserve first bytecount byte */ if (BufferNextByte(&State))
if ( BufferNextByte(&State) ) return 0;
return 0; State.OutByteCountPos = State.OutPosCur;
State.OutByteCountPos = State.OutPosCur; if (BufferNextByte(&State))
if ( BufferNextByte(&State) ) return 0;
return 0; State.fByteCountByteSet = 1;
State.fByteCountByteSet = 1; /* Submit one 'ClearCode' as the first code */
/* Submit one 'ClearCode' as the first code */ if (AddCodeToBuffer(&State, State.ClearCode, CodeBits))
if ( AddCodeToBuffer(&State, State.ClearCode, CodeBits) ) return 0;
return 0;
for (;;) {
for(;;) char Res;
{ /* generate and save the next code, which may consist of multiple input pixels. */
char Res; Res = NextCode(&State, &PixelValueCur, CodeBits);
/* generate and save the next code, which may consist of multiple input pixels. */ if (Res < 0)
Res = NextCode(&State, &PixelValueCur, CodeBits); return 0;
if ( Res < 0) //* Check for end of data stream */
return 0; if (!Res) {
//* Check for end of data stream */ /* submit 'eoi' as the last item of the code stream */
if( ! Res ) if (AddCodeToBuffer(&State, (unsigned short) (State.ClearCode + 1), CodeBits))
{ return 0;
/* submit 'eoi' as the last item of the code stream */ State.fByteCountByteSet = 0;
if ( AddCodeToBuffer(&State, (unsigned short)(State.ClearCode + 1), CodeBits ) ) if (State.OutBitsFree < 8) {
return 0; if (BufferNextByte(&State))
State.fByteCountByteSet = 0; return 0;
if( State.OutBitsFree < 8 ) }
{ // > Update last bytecount byte;
if ( BufferNextByte(&State) ) if (State.OutByteCountPos < State.OutPosCur) {
return 0; (State.pOut)[State.OutByteCountPos] = (unsigned char) (State.OutPosCur - State.OutByteCountPos - 1);
} }
// > Update last bytecount byte; State.OutPosCur++;
if ( State.OutByteCountPos < State.OutPosCur ) return State.OutPosCur;
{ }
(State.pOut)[State.OutByteCountPos] = (unsigned char) (State.OutPosCur - State.OutByteCountPos - 1); /* Check for currently last code */
} if (State.FreeCode == (1U << CodeBits))
State.OutPosCur++; CodeBits++;
return State.OutPosCur; State.FreeCode++;
} /* Check for full stringtable */
/* Check for currently last code */ if (State.FreeCode == 0xfff) {
if( State.FreeCode == ( 1U << CodeBits ) ) FlushStringTable(&State);
CodeBits++; if (AddCodeToBuffer(&State, State.ClearCode, CodeBits))
State.FreeCode++; return 0;
/* Check for full stringtable */
if( State.FreeCode == 0xfff ) CodeBits = (unsigned char) (1 + 2);
{ State.FreeCode = (unsigned short) (State.ClearCode + 2);
FlushStringTable(&State); }
if ( AddCodeToBuffer(&State, State.ClearCode, CodeBits ) ) }
return 0;
CodeBits=(unsigned char)( 1 + 2 );
State.FreeCode=(unsigned short)( State.ClearCode + 2 );
}
}
} }
int gif_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width, char *pixelbuf, int rotate_angle) { int gif_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width, char *pixelbuf, int rotate_angle) {
@ -286,21 +265,21 @@ int gif_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width
int errno; int errno;
int row, column; int row, column;
FILE *gif_file; FILE *gif_file;
unsigned short ImageWidth = image_width; unsigned short ImageWidth = image_width;
unsigned short ImageHeight = image_height; unsigned short ImageHeight = image_height;
unsigned short usTemp; unsigned short usTemp;
int byte_out; int byte_out;
#ifdef _MSC_VER #ifdef _MSC_VER
char* rotated_bitmap; char* rotated_bitmap;
char * lzwoutbuf; char * lzwoutbuf;
#endif #endif
#ifndef _MSC_VER #ifndef _MSC_VER
char rotated_bitmap[image_height * image_width]; char rotated_bitmap[image_height * image_width];
char lzwoutbuf[image_height * image_width]; char lzwoutbuf[image_height * image_width];
#else #else
rotated_bitmap = (char *) _alloca((image_height * image_width) * sizeof(char)); rotated_bitmap = (char *) _alloca((image_height * image_width) * sizeof (char));
lzwoutbuf = (char *) _alloca((image_height * image_width) * sizeof(char)); lzwoutbuf = (char *) _alloca((image_height * image_width) * sizeof (char));
#endif /* _MSC_VER */ #endif /* _MSC_VER */
switch (rotate_angle) { switch (rotate_angle) {
@ -376,9 +355,9 @@ int gif_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width
} }
break; break;
} }
/* Open output file in binary mode */ /* Open output file in binary mode */
if ((symbol->output_options & BARCODE_STDOUT) != 0) { if ((symbol->output_options & BARCODE_STDOUT) != 0) {
#ifdef _MSC_VER #ifdef _MSC_VER
@ -400,26 +379,26 @@ int gif_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width
rotated_bitmap[1] = 1; rotated_bitmap[1] = 1;
rotated_bitmap[2] = 0; rotated_bitmap[2] = 0;
rotated_bitmap[3] = 0; rotated_bitmap[3] = 0;
*/ */
/* GIF signature (6) */ /* GIF signature (6) */
memcpy(outbuf,"GIF87a",6); memcpy(outbuf, "GIF87a", 6);
if ( TRANSPARENT_INDEX != -1 ) if (TRANSPARENT_INDEX != -1)
outbuf[4]='9'; outbuf[4] = '9';
fwrite(outbuf, 6, 1, gif_file); fwrite(outbuf, 6, 1, gif_file);
/* Screen Descriptor (7) */ /* Screen Descriptor (7) */
/* Screen Width */ /* Screen Width */
usTemp=(unsigned short)ImageWidth; usTemp = (unsigned short) ImageWidth;
outbuf[0] = (unsigned char)(0xff & usTemp); outbuf[0] = (unsigned char) (0xff & usTemp);
outbuf[1] = (unsigned char)( (0xff00 & usTemp) / 0x100 ); outbuf[1] = (unsigned char) ((0xff00 & usTemp) / 0x100);
/* Screen Height */ /* Screen Height */
usTemp=(unsigned short)ImageHeight; usTemp = (unsigned short) ImageHeight;
outbuf[2] = (unsigned char)( 0xff & usTemp ); outbuf[2] = (unsigned char) (0xff & usTemp);
outbuf[3] = (unsigned char)( (0xff00 & usTemp) / 0x100 ); outbuf[3] = (unsigned char) ((0xff00 & usTemp) / 0x100);
/* write ImageBits-1 to the three least significant bits of byte 5 of /* write ImageBits-1 to the three least significant bits of byte 5 of
* the Screen Descriptor * the Screen Descriptor
*/ */
outbuf[4] = (unsigned char)( 0xf0 | (0x7&(DESTINATION_IMAGE_BITS-1)) ); outbuf[4] = (unsigned char) (0xf0 | (0x7 & (DESTINATION_IMAGE_BITS - 1)));
/* Background color = colortable index 0 */ /* Background color = colortable index 0 */
outbuf[5] = 0x00; outbuf[5] = 0x00;
/* Byte 7 must be 0x00 */ /* Byte 7 must be 0x00 */
@ -427,21 +406,20 @@ int gif_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width
fwrite(outbuf, 7, 1, gif_file); fwrite(outbuf, 7, 1, gif_file);
/* Global Color Table (6) */ /* Global Color Table (6) */
/* RGB 0 color */ /* RGB 0 color */
outbuf[0] = (unsigned char)(16 * ctoi(symbol->bgcolour[0])) + ctoi(symbol->bgcolour[1]); outbuf[0] = (unsigned char) (16 * ctoi(symbol->bgcolour[0])) + ctoi(symbol->bgcolour[1]);
outbuf[1] = (unsigned char)(16 * ctoi(symbol->bgcolour[2])) + ctoi(symbol->bgcolour[3]); outbuf[1] = (unsigned char) (16 * ctoi(symbol->bgcolour[2])) + ctoi(symbol->bgcolour[3]);
outbuf[2] = (unsigned char)(16 * ctoi(symbol->bgcolour[4])) + ctoi(symbol->bgcolour[5]); outbuf[2] = (unsigned char) (16 * ctoi(symbol->bgcolour[4])) + ctoi(symbol->bgcolour[5]);
/* RGB 1 color */ /* RGB 1 color */
outbuf[3] = (unsigned char)(16 * ctoi(symbol->fgcolour[0])) + ctoi(symbol->fgcolour[1]); outbuf[3] = (unsigned char) (16 * ctoi(symbol->fgcolour[0])) + ctoi(symbol->fgcolour[1]);
outbuf[4] = (unsigned char)(16 * ctoi(symbol->fgcolour[2])) + ctoi(symbol->fgcolour[3]); outbuf[4] = (unsigned char) (16 * ctoi(symbol->fgcolour[2])) + ctoi(symbol->fgcolour[3]);
outbuf[5] = (unsigned char)(16 * ctoi(symbol->fgcolour[4])) + ctoi(symbol->fgcolour[5]); outbuf[5] = (unsigned char) (16 * ctoi(symbol->fgcolour[4])) + ctoi(symbol->fgcolour[5]);
fwrite(outbuf, 6, 1, gif_file); fwrite(outbuf, 6, 1, gif_file);
/* Graphic control extension (8) */ /* Graphic control extension (8) */
/* 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 */
@ -459,7 +437,7 @@ int gif_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width
outbuf[4] = 0; outbuf[4] = 0;
outbuf[5] = 0; outbuf[5] = 0;
/* Transparent Color Index */ /* Transparent Color Index */
outbuf[6] = (unsigned char)TRANSPARENT_INDEX; outbuf[6] = (unsigned char) TRANSPARENT_INDEX;
/* Block Terminator */ /* Block Terminator */
outbuf[7] = 0; outbuf[7] = 0;
fwrite(outbuf, 8, 1, gif_file); fwrite(outbuf, 8, 1, gif_file);
@ -474,35 +452,34 @@ int gif_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width
outbuf[3] = 0x00; outbuf[3] = 0x00;
outbuf[4] = 0x00; outbuf[4] = 0x00;
/* Image Width (low byte first) */ /* Image Width (low byte first) */
outbuf[5] = (unsigned char)(0xff & ImageWidth); outbuf[5] = (unsigned char) (0xff & ImageWidth);
outbuf[6] = (unsigned char)((0xff00 & ImageWidth) / 0x100); outbuf[6] = (unsigned char) ((0xff00 & ImageWidth) / 0x100);
/* Image Height */ /* Image Height */
outbuf[7] = (unsigned char)(0xff & ImageHeight); outbuf[7] = (unsigned char) (0xff & ImageHeight);
outbuf[8] = (unsigned char)((0xff00 & ImageHeight) / 0x100); outbuf[8] = (unsigned char) ((0xff00 & ImageHeight) / 0x100);
/* Byte 10 contains the interlaced flag and /* Byte 10 contains the interlaced flag and
* information on the local color table. * information on the local color table.
* There is no local color table if its most significant bit is reset. * There is no local color table if its most significant bit is reset.
*/ */
outbuf[9] = (unsigned char)(0|(0x7 & (DESTINATION_IMAGE_BITS-1))); outbuf[9] = (unsigned char) (0 | (0x7 & (DESTINATION_IMAGE_BITS - 1)));
fwrite(outbuf, 10, 1, gif_file); fwrite(outbuf, 10, 1, gif_file);
/* call lzw encoding */ /* call lzw encoding */
byte_out = gif_lzw( byte_out = gif_lzw(
(unsigned char *) lzwoutbuf, (unsigned char *) lzwoutbuf,
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;
} }
fwrite(lzwoutbuf, byte_out, 1, gif_file); fwrite(lzwoutbuf, byte_out, 1, gif_file);
/* GIF terminator */ /* GIF terminator */
fputc('\x3b', gif_file); fputc('\x3b', gif_file);
fclose(gif_file); fclose(gif_file);
return 0; return 0;
} }

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

File diff suppressed because it is too large Load Diff

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,8 +51,8 @@ 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,
1043, 1059, 1099, 1140, 1180, 1221, 1263, 1307, 1351, 1394, 1415, 1460, 1043, 1059, 1099, 1140, 1180, 1221, 1263, 1307, 1351, 1394, 1415, 1460,
@ -61,16 +61,16 @@ 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,
805, 817, 847, 880, 910, 943, 975, 1009, 1041, 1076, 1091, 1126, 1161, 1198, 805, 817, 847, 880, 910, 943, 975, 1009, 1041, 1076, 1091, 1126, 1161, 1198,
1234, 1271, 1309, 1348, 1366, 1404, 1443, 1485, 1524, 1566, 1607,1650, 1693, 1234, 1271, 1309, 1348, 1366, 1404, 1443, 1485, 1524, 1566, 1607, 1650, 1693,
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,8 +80,8 @@ 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,
21, 17, 17, 18, 18, 19, 19, 19, 20, 20, 21, 17, 17, 18, 18, 19, 19, 19, 20, 20,
@ -93,8 +93,8 @@ 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,
20, 17, 19, 17, 19, 17, 19, 21, 19, 21, 20, 17, 19, 17, 19, 17, 19, 21, 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,
@ -247,7 +247,7 @@ static int hx_table_d1[] = {
13, 19, 28, 3, 16, 26, 0, 0, 0, 13, 19, 28, 3, 16, 26, 0, 0, 0,
4, 127, 24, 1, 126, 24, 0, 0, 0, // version 32 4, 127, 24, 1, 126, 24, 0, 0, 0, // version 32
7, 66, 28, 1, 66, 30, 0, 0, 0, 7, 66, 28, 1, 66, 30, 0, 0, 0,
12, 30,24, 1, 24, 28, 1, 24, 30, 12, 30, 24, 1, 24, 28, 1, 24, 30,
15, 19, 28, 1, 17, 32, 0, 0, 0, 15, 19, 28, 1, 17, 32, 0, 0, 0,
7, 84, 16, 1, 78, 16, 0, 0, 0, // version 33 7, 84, 16, 1, 78, 16, 0, 0, 0, // version 33
7, 70, 30, 1, 66, 28, 0, 0, 0, 7, 70, 30, 1, 66, 28, 0, 0, 0,

View File

@ -123,7 +123,7 @@ void ZBarcode_Delete(struct zint_symbol *symbol) {
free(s->text); free(s->text);
free(s); free(s);
} }
// Free Rings // Free Rings
ring = symbol->rendered->rings; ring = symbol->rendered->rings;
while (ring) { while (ring) {
@ -131,7 +131,7 @@ void ZBarcode_Delete(struct zint_symbol *symbol) {
ring = ring->next; ring = ring->next;
free(r); free(r);
} }
// Free Hexagons // Free Hexagons
hexagon = symbol->rendered->hexagons; hexagon = symbol->rendered->hexagons;
while (hexagon) { while (hexagon) {
@ -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 */
@ -236,7 +236,7 @@ int dump_plot(struct zint_symbol *symbol) {
char hex[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', char hex[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8',
'9', 'A', 'B', 'C', 'D', 'E', 'F'}; '9', 'A', 'B', 'C', 'D', 'E', 'F'};
int space = 0; int space = 0;
if (symbol->output_options & BARCODE_STDOUT) { if (symbol->output_options & BARCODE_STDOUT) {
f = stdout; f = stdout;
} else { } else {
@ -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;
@ -412,9 +412,9 @@ static int gs1_compliant(const int symbology) {
static int is_matrix(const int symbology) { static int is_matrix(const int symbology) {
/* Returns 1 if symbology is a matrix design */ /* Returns 1 if symbology is a matrix design */
int result = 0; int result = 0;
switch (symbology) { switch (symbology) {
case BARCODE_QRCODE: case BARCODE_QRCODE:
case BARCODE_DATAMATRIX: case BARCODE_DATAMATRIX:
@ -431,15 +431,15 @@ static int is_matrix(const int symbology) {
result = 1; result = 1;
break; break;
} }
return result; return result;
} }
static int supports_eci(const int symbology) { static int supports_eci(const int symbology) {
/* Returns 1 if symbology can encode the ECI character */ /* Returns 1 if symbology can encode the ECI character */
int result = 0; int result = 0;
switch (symbology) { switch (symbology) {
case BARCODE_AZTEC: case BARCODE_AZTEC:
case BARCODE_DATAMATRIX: case BARCODE_DATAMATRIX:
@ -454,7 +454,7 @@ static int supports_eci(const int symbology) {
result = 1; result = 1;
break; break;
} }
return result; return result;
} }
@ -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,8 +592,8 @@ 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;
if (!(symbol->output_options & BARCODE_BOX)) { if (!(symbol->output_options & BARCODE_BOX)) {
@ -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 */
@ -949,12 +949,12 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
} else { } else {
error_buffer = error_number; error_buffer = error_number;
} }
if ((!(supports_eci(symbol->symbology))) && (symbol->eci != 3)) { if ((!(supports_eci(symbol->symbology))) && (symbol->eci != 3)) {
strcpy(symbol->errtxt, "Symbology does not support ECI switching"); strcpy(symbol->errtxt, "Symbology does not support ECI switching");
error_number = ZINT_ERROR_INVALID_OPTION; error_number = ZINT_ERROR_INVALID_OPTION;
} }
if ((symbol->eci < 3) || (symbol->eci > 26) || (symbol->eci == 14) || (symbol->eci == 19) || (symbol->eci == 25)) { if ((symbol->eci < 3) || (symbol->eci > 26) || (symbol->eci == 14) || (symbol->eci == 19) || (symbol->eci == 25)) {
strcpy(symbol->errtxt, "Invalid or unsupported ECI mode"); strcpy(symbol->errtxt, "Invalid or unsupported ECI mode");
error_number = ZINT_ERROR_INVALID_OPTION; error_number = ZINT_ERROR_INVALID_OPTION;
@ -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,39 +991,39 @@ 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) {
//printf("Data will encode with ECI %d\n", symbol->eci); //printf("Data will encode with ECI %d\n", symbol->eci);
switch (symbol->symbology) { switch (symbol->symbology) {
case BARCODE_QRCODE: case BARCODE_QRCODE:
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 {
@ -1060,7 +1060,7 @@ int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle) {
return ZINT_ERROR_INVALID_OPTION; return ZINT_ERROR_INVALID_OPTION;
} }
} }
if (strlen(symbol->outfile) > 3) { if (strlen(symbol->outfile) > 3) {
output[0] = symbol->outfile[strlen(symbol->outfile) - 3]; output[0] = symbol->outfile[strlen(symbol->outfile) - 3];
output[1] = symbol->outfile[strlen(symbol->outfile) - 2]; output[1] = symbol->outfile[strlen(symbol->outfile) - 2];
@ -1084,7 +1084,7 @@ int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle) {
if (symbol->scale < 1.0) { if (symbol->scale < 1.0) {
symbol->text[0] = '\0'; symbol->text[0] = '\0';
} }
error_number = plot_raster(symbol, rotate_angle, OUT_PCX_FILE); error_number = plot_raster(symbol, rotate_angle, OUT_PCX_FILE);
} else } else
if (!(strcmp(output, "GIF"))) { if (!(strcmp(output, "GIF"))) {
if (symbol->scale < 1.0) { if (symbol->scale < 1.0) {
@ -1115,7 +1115,7 @@ int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle) {
/* If libpng is not installed */ /* If libpng is not installed */
strcpy(symbol->errtxt, "Unknown output format"); strcpy(symbol->errtxt, "Unknown output format");
} }
error_tag(symbol->errtxt, error_number); error_tag(symbol->errtxt, error_number);
return error_number; return error_number;
} }

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

@ -1,251 +1,252 @@
/* pcx.c - Handles output to ZSoft PCX file */ /* pcx.c - Handles output to ZSoft PCX file */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2009-2016 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2009-2016 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
are met: are met:
1. Redistributions of source code must retain the above copyright 1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer. notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright 2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution. documentation and/or other materials provided with the distribution.
3. Neither the name of the project nor the names of its contributors 3. Neither the name of the project nor the names of its contributors
may be used to endorse or promote products derived from this software may be used to endorse or promote products derived from this software
without specific prior written permission. without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
#include <stdio.h> #include <stdio.h>
#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 "pcx.h" /* PCX header structure */
#include <math.h> #include <math.h>
#ifdef _MSC_VER #include <malloc.h>
#include <io.h> #ifdef _MSC_VER
#include <fcntl.h> #include <io.h>
#endif #include <fcntl.h>
#endif
#define SSET "0123456789ABCDEF"
#define SSET "0123456789ABCDEF"
int pcx_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width, char *pixelbuf, int rotate_angle) {
int fgred, fggrn, fgblu, bgred, bggrn, bgblu; int pcx_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width, char *pixelbuf, int rotate_angle) {
int errno; int fgred, fggrn, fgblu, bgred, bggrn, bgblu;
int row, column, i, colour; int errno;
int run_count; int row, column, i, colour;
FILE *pcx_file; int run_count;
pcx_header_t header; FILE *pcx_file;
#ifdef _MSC_VER pcx_header_t header;
char* rotated_bitmap; #ifdef _MSC_VER
unsigned char* rle_row; char* rotated_bitmap;
#endif unsigned char* rle_row;
#endif
#ifndef _MSC_VER
char rotated_bitmap[image_height * image_width]; #ifndef _MSC_VER
#else char rotated_bitmap[image_height * image_width];
rotated_bitmap = (char *) _alloca((image_height * image_width) * sizeof(char)); #else
#endif /* _MSC_VER */ rotated_bitmap = (char *) _alloca((image_height * image_width) * sizeof (char));
#endif /* _MSC_VER */
switch (rotate_angle) {
case 0: switch (rotate_angle) {
case 180: case 0:
symbol->bitmap_width = image_width; case 180:
symbol->bitmap_height = image_height; symbol->bitmap_width = image_width;
break; symbol->bitmap_height = image_height;
case 90: break;
case 270: case 90:
symbol->bitmap_width = image_height; case 270:
symbol->bitmap_height = image_width; symbol->bitmap_width = image_height;
break; symbol->bitmap_height = image_width;
} break;
}
#ifndef _MSC_VER
unsigned char rle_row[symbol->bitmap_width]; #ifndef _MSC_VER
#else unsigned char rle_row[symbol->bitmap_width];
rle_row = (unsigned char *) _alloca((symbol->bitmap_width * 6) * sizeof(unsigned char)); #else
#endif /* _MSC_VER */ rle_row = (unsigned char *) _alloca((symbol->bitmap_width * 6) * sizeof (unsigned char));
#endif /* _MSC_VER */
/* sort out colour options */
to_upper((unsigned char*) symbol->fgcolour); /* sort out colour options */
to_upper((unsigned char*) symbol->bgcolour); to_upper((unsigned char*) symbol->fgcolour);
to_upper((unsigned char*) symbol->bgcolour);
if (strlen(symbol->fgcolour) != 6) {
strcpy(symbol->errtxt, "Malformed foreground colour target"); if (strlen(symbol->fgcolour) != 6) {
return ZINT_ERROR_INVALID_OPTION; strcpy(symbol->errtxt, "Malformed foreground colour target");
} return ZINT_ERROR_INVALID_OPTION;
if (strlen(symbol->bgcolour) != 6) { }
strcpy(symbol->errtxt, "Malformed background colour target"); if (strlen(symbol->bgcolour) != 6) {
return ZINT_ERROR_INVALID_OPTION; strcpy(symbol->errtxt, "Malformed background colour target");
} return ZINT_ERROR_INVALID_OPTION;
errno = is_sane(SSET, (unsigned char*) symbol->fgcolour, strlen(symbol->fgcolour)); }
if (errno == ZINT_ERROR_INVALID_DATA) { errno = is_sane(SSET, (unsigned char*) symbol->fgcolour, strlen(symbol->fgcolour));
strcpy(symbol->errtxt, "Malformed foreground colour target"); if (errno == ZINT_ERROR_INVALID_DATA) {
return ZINT_ERROR_INVALID_OPTION; strcpy(symbol->errtxt, "Malformed foreground colour target");
} return ZINT_ERROR_INVALID_OPTION;
errno = is_sane(SSET, (unsigned char*) symbol->bgcolour, strlen(symbol->fgcolour)); }
if (errno == ZINT_ERROR_INVALID_DATA) { errno = is_sane(SSET, (unsigned char*) symbol->bgcolour, strlen(symbol->fgcolour));
strcpy(symbol->errtxt, "Malformed background colour target"); if (errno == ZINT_ERROR_INVALID_DATA) {
return ZINT_ERROR_INVALID_OPTION; strcpy(symbol->errtxt, "Malformed background colour target");
} return ZINT_ERROR_INVALID_OPTION;
}
fgred = (16 * ctoi(symbol->fgcolour[0])) + ctoi(symbol->fgcolour[1]);
fggrn = (16 * ctoi(symbol->fgcolour[2])) + ctoi(symbol->fgcolour[3]); fgred = (16 * ctoi(symbol->fgcolour[0])) + ctoi(symbol->fgcolour[1]);
fgblu = (16 * ctoi(symbol->fgcolour[4])) + ctoi(symbol->fgcolour[5]); fggrn = (16 * ctoi(symbol->fgcolour[2])) + ctoi(symbol->fgcolour[3]);
bgred = (16 * ctoi(symbol->bgcolour[0])) + ctoi(symbol->bgcolour[1]); fgblu = (16 * ctoi(symbol->fgcolour[4])) + ctoi(symbol->fgcolour[5]);
bggrn = (16 * ctoi(symbol->bgcolour[2])) + ctoi(symbol->bgcolour[3]); bgred = (16 * ctoi(symbol->bgcolour[0])) + ctoi(symbol->bgcolour[1]);
bgblu = (16 * ctoi(symbol->bgcolour[4])) + ctoi(symbol->bgcolour[5]); bggrn = (16 * ctoi(symbol->bgcolour[2])) + ctoi(symbol->bgcolour[3]);
bgblu = (16 * ctoi(symbol->bgcolour[4])) + ctoi(symbol->bgcolour[5]);
/* Rotate image before plotting */
switch (rotate_angle) { /* Rotate image before plotting */
case 0: /* Plot the right way up */ switch (rotate_angle) {
for (row = 0; row < image_height; row++) { case 0: /* Plot the right way up */
for (column = 0; column < image_width; column++) { for (row = 0; row < image_height; row++) {
rotated_bitmap[(row * image_width) + column] = for (column = 0; column < image_width; column++) {
*(pixelbuf + (image_width * row) + column); rotated_bitmap[(row * image_width) + column] =
} *(pixelbuf + (image_width * row) + column);
} }
break; }
case 90: /* Plot 90 degrees clockwise */ break;
for (row = 0; row < image_width; row++) { case 90: /* Plot 90 degrees clockwise */
for (column = 0; column < image_height; column++) { for (row = 0; row < image_width; row++) {
rotated_bitmap[(row * image_height) + column] = for (column = 0; column < image_height; column++) {
*(pixelbuf + (image_width * (image_height - column - 1)) + row); rotated_bitmap[(row * image_height) + column] =
} *(pixelbuf + (image_width * (image_height - column - 1)) + row);
} }
break; }
case 180: /* Plot upside down */ break;
for (row = 0; row < image_height; row++) { case 180: /* Plot upside down */
for (column = 0; column < image_width; column++) { for (row = 0; row < image_height; row++) {
rotated_bitmap[(row * image_width) + column] = for (column = 0; column < image_width; column++) {
*(pixelbuf + (image_width * (image_height - row - 1)) + (image_width - column - 1)); rotated_bitmap[(row * image_width) + column] =
} *(pixelbuf + (image_width * (image_height - row - 1)) + (image_width - column - 1));
} }
break; }
case 270: /* Plot 90 degrees anti-clockwise */ break;
for (row = 0; row < image_width; row++) { case 270: /* Plot 90 degrees anti-clockwise */
for (column = 0; column < image_height; column++) { for (row = 0; row < image_width; row++) {
rotated_bitmap[(row * image_height) + column] = for (column = 0; column < image_height; column++) {
*(pixelbuf + (image_width * column) + (image_width - row - 1)); rotated_bitmap[(row * image_height) + column] =
} *(pixelbuf + (image_width * column) + (image_width - row - 1));
} }
break; }
} break;
}
header.manufacturer = 10; // ZSoft
header.version = 5; // Version 3.0 header.manufacturer = 10; // ZSoft
header.encoding = 1; // Run length encoding header.version = 5; // Version 3.0
header.bits_per_pixel = 8; header.encoding = 1; // Run length encoding
header.window_xmin = 0; header.bits_per_pixel = 8;
header.window_ymin = 0; header.window_xmin = 0;
header.window_xmax = symbol->bitmap_width - 1; header.window_ymin = 0;
header.window_ymax = symbol->bitmap_height - 1; header.window_xmax = symbol->bitmap_width - 1;
header.horiz_dpi = 300; header.window_ymax = symbol->bitmap_height - 1;
header.vert_dpi = 300; header.horiz_dpi = 300;
header.vert_dpi = 300;
for(i = 0; i < 48; i++) {
header.colourmap[i] = 0x00; for (i = 0; i < 48; i++) {
} header.colourmap[i] = 0x00;
}
header.reserved = 0;
header.number_of_planes = 3; header.reserved = 0;
header.number_of_planes = 3;
if (symbol->bitmap_width % 2) {
header.bytes_per_line = symbol->bitmap_width + 1; if (symbol->bitmap_width % 2) {
} else { header.bytes_per_line = symbol->bitmap_width + 1;
header.bytes_per_line = symbol->bitmap_width; } else {
} header.bytes_per_line = symbol->bitmap_width;
}
header.palette_info = 1; // Colour
header.horiz_screen_size = 0; header.palette_info = 1; // Colour
header.vert_screen_size = 0; header.horiz_screen_size = 0;
header.vert_screen_size = 0;
for(i = 0; i < 54; i++) {
header.filler[i] = 0x00; for (i = 0; i < 54; i++) {
} header.filler[i] = 0x00;
}
/* Open output file in binary mode */
if (symbol->output_options & BARCODE_STDOUT) { /* Open output file in binary mode */
#ifdef _MSC_VER if (symbol->output_options & BARCODE_STDOUT) {
if (-1 == _setmode(_fileno(stdout), _O_BINARY)) { #ifdef _MSC_VER
strcpy(symbol->errtxt, "Can't open output file"); if (-1 == _setmode(_fileno(stdout), _O_BINARY)) {
return ZINT_ERROR_FILE_ACCESS; strcpy(symbol->errtxt, "Can't open output file");
} return ZINT_ERROR_FILE_ACCESS;
#endif }
pcx_file = stdout; #endif
} else { pcx_file = stdout;
if (!(pcx_file = fopen(symbol->outfile, "wb"))) { } else {
strcpy(symbol->errtxt, "Can't open output file"); if (!(pcx_file = fopen(symbol->outfile, "wb"))) {
return ZINT_ERROR_FILE_ACCESS; strcpy(symbol->errtxt, "Can't open output file");
} return ZINT_ERROR_FILE_ACCESS;
} }
}
fwrite(&header, sizeof(pcx_header_t), 1, pcx_file);
fwrite(&header, sizeof (pcx_header_t), 1, pcx_file);
for(row = 0; row < symbol->bitmap_height; row++) {
for (colour = 0; colour < 3; colour++) { for (row = 0; row < symbol->bitmap_height; row++) {
for (column = 0; column < symbol->bitmap_width; column++) { for (colour = 0; colour < 3; colour++) {
switch(colour) { for (column = 0; column < symbol->bitmap_width; column++) {
case 0: switch (colour) {
if (rotated_bitmap[(row * symbol->bitmap_width) + column] == '1') { case 0:
rle_row[column] = fgred; if (rotated_bitmap[(row * symbol->bitmap_width) + column] == '1') {
} else { rle_row[column] = fgred;
rle_row[column] = bgred; } else {
} rle_row[column] = bgred;
break; }
case 1: break;
if (rotated_bitmap[(row * symbol->bitmap_width) + column] == '1') { case 1:
rle_row[column] = fggrn; if (rotated_bitmap[(row * symbol->bitmap_width) + column] == '1') {
} else { rle_row[column] = fggrn;
rle_row[column] = bggrn; } else {
} rle_row[column] = bggrn;
break; }
case 2: break;
if (rotated_bitmap[(row * symbol->bitmap_width) + column] == '1') { case 2:
rle_row[column] = fgblu; if (rotated_bitmap[(row * symbol->bitmap_width) + column] == '1') {
} else { rle_row[column] = fgblu;
rle_row[column] = bgblu; } else {
} rle_row[column] = bgblu;
break; }
} break;
} }
}
run_count = 1;
for (column = 1; column < symbol->bitmap_width; column++) { run_count = 1;
if ((rle_row[column - 1] == rle_row[column]) && (run_count < 63)) { for (column = 1; column < symbol->bitmap_width; column++) {
run_count++; if ((rle_row[column - 1] == rle_row[column]) && (run_count < 63)) {
} else { run_count++;
run_count += 0xc0; } else {
fputc(run_count, pcx_file); run_count += 0xc0;
fputc(rle_row[column - 1], pcx_file); fputc(run_count, pcx_file);
run_count = 1; fputc(rle_row[column - 1], pcx_file);
} run_count = 1;
} }
}
if (run_count > 1) {
run_count += 0xc0; if (run_count > 1) {
fputc(run_count, pcx_file); run_count += 0xc0;
fputc(rle_row[column - 1], pcx_file); fputc(run_count, pcx_file);
} fputc(rle_row[column - 1], pcx_file);
} }
} }
}
fclose(pcx_file);
fclose(pcx_file);
return 0;
return 0;
} }

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;
@ -67,7 +67,7 @@ int ps_plot(struct zint_symbol *symbol) {
strcpy(addon, ""); strcpy(addon, "");
comp_offset = 0; comp_offset = 0;
addon_text_posn = 0.0; addon_text_posn = 0.0;
if (symbol->show_hrt != 0) { if (symbol->show_hrt != 0) {
/* Copy text from symbol */ /* Copy text from symbol */
ustrcpy(local_text, symbol->text); ustrcpy(local_text, symbol->text);
@ -97,7 +97,7 @@ int ps_plot(struct zint_symbol *symbol) {
local_text[0] = '\0'; local_text[0] = '\0';
break; break;
} }
} }
if (symbol->output_options & BARCODE_STDOUT) { if (symbol->output_options & BARCODE_STDOUT) {
feps = stdout; feps = stdout;
@ -149,7 +149,7 @@ int ps_plot(struct zint_symbol *symbol) {
red_paper = bgred / 256.0; red_paper = bgred / 256.0;
green_paper = bggrn / 256.0; green_paper = bggrn / 256.0;
blue_paper = bgblu / 256.0; blue_paper = bgblu / 256.0;
/* Convert RGB to CMYK */ /* Convert RGB to CMYK */
if (red_ink > green_ink) { if (red_ink > green_ink) {
if (blue_ink > red_ink) { if (blue_ink > red_ink) {
@ -173,7 +173,7 @@ int ps_plot(struct zint_symbol *symbol) {
magenta_ink = 0.0; magenta_ink = 0.0;
yellow_ink = 0.0; yellow_ink = 0.0;
} }
if (red_paper > green_paper) { if (red_paper > green_paper) {
if (blue_paper > red_paper) { if (blue_paper > red_paper) {
black_paper = 1 - blue_paper; black_paper = 1 - blue_paper;
@ -284,9 +284,9 @@ int ps_plot(struct zint_symbol *symbol) {
} }
fprintf(feps, "%%%%Pages: 0\n"); fprintf(feps, "%%%%Pages: 0\n");
if (symbol->symbology != BARCODE_MAXICODE) { if (symbol->symbology != BARCODE_MAXICODE) {
fprintf(feps, "%%%%BoundingBox: 0 0 %d %d\n", (int)ceil((symbol->width + xoffset + xoffset) * scaler), (int)ceil((symbol->height + textoffset + yoffset + yoffset) * scaler)); fprintf(feps, "%%%%BoundingBox: 0 0 %d %d\n", (int) ceil((symbol->width + xoffset + xoffset) * scaler), (int) ceil((symbol->height + textoffset + yoffset + yoffset) * scaler));
} else { } else {
fprintf(feps, "%%%%BoundingBox: 0 0 %d %d\n", (int)ceil((74.0F + xoffset + xoffset) * scaler), (int)ceil((72.0F + yoffset + yoffset) * scaler)); fprintf(feps, "%%%%BoundingBox: 0 0 %d %d\n", (int) ceil((74.0F + xoffset + xoffset) * scaler), (int) ceil((72.0F + yoffset + yoffset) * scaler));
} }
fprintf(feps, "%%%%EndComments\n"); fprintf(feps, "%%%%EndComments\n");
@ -385,7 +385,7 @@ int ps_plot(struct zint_symbol *symbol) {
if (symbol->symbology != BARCODE_MAXICODE) { if (symbol->symbology != BARCODE_MAXICODE) {
/* everything else uses rectangles (or squares) */ /* everything else uses rectangles (or squares) */
/* Works from the bottom of the symbol up */ /* Works from the bottom of the symbol up */
int addon_latch = 0; int addon_latch = 0;
for (r = 0; r < symbol->rows; r++) { for (r = 0; r < symbol->rows; r++) {
@ -405,19 +405,19 @@ int ps_plot(struct zint_symbol *symbol) {
} }
row_posn += (textoffset + yoffset); row_posn += (textoffset + yoffset);
if ((symbol->output_options & BARCODE_DOTTY_MODE) != 0) { if ((symbol->output_options & BARCODE_DOTTY_MODE) != 0) {
if ((symbol->output_options & CMYK_COLOUR) == 0) { if ((symbol->output_options & CMYK_COLOUR) == 0) {
fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", red_ink, green_ink, blue_ink); fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", red_ink, green_ink, blue_ink);
} else { } else {
fprintf(feps, "%.2f %.2f %.2f %.2f setcmykcolor\n", cyan_ink, magenta_ink, yellow_ink, black_ink); fprintf(feps, "%.2f %.2f %.2f %.2f setcmykcolor\n", cyan_ink, magenta_ink, yellow_ink, black_ink);
} }
/* Use dots instead of squares */ /* Use dots instead of squares */
for (i = 0; i < symbol->width; i++) { for (i = 0; i < symbol->width; i++) {
if (module_is_set(symbol, this_row, i)) { if (module_is_set(symbol, this_row, i)) {
fprintf(feps, "%.2f %.2f %.2f TD\n", ((i + xoffset) * scaler) + (scaler / 2.0), (row_posn * scaler) + (scaler / 2.0), (2.0 / 5.0) * scaler); fprintf(feps, "%.2f %.2f %.2f TD\n", ((i + xoffset) * scaler) + (scaler / 2.0), (row_posn * scaler) + (scaler / 2.0), (2.0 / 5.0) * scaler);
} }
} }
} else { } else {
/* Normal mode, with rectangles */ /* Normal mode, with rectangles */
@ -427,7 +427,7 @@ int ps_plot(struct zint_symbol *symbol) {
} else { } else {
fprintf(feps, "%.2f %.2f %.2f %.2f setcmykcolor\n", cyan_ink, magenta_ink, yellow_ink, black_ink); fprintf(feps, "%.2f %.2f %.2f %.2f setcmykcolor\n", cyan_ink, magenta_ink, yellow_ink, black_ink);
} }
fprintf(feps, "%.2f %.2f ", row_height * scaler, row_posn * scaler); fprintf(feps, "%.2f %.2f ", row_height * scaler, row_posn * scaler);
i = 0; i = 0;
if (module_is_set(symbol, this_row, 0)) { if (module_is_set(symbol, this_row, 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"
@ -63,7 +64,7 @@ int svg_plot(struct zint_symbol *symbol) {
strcpy(addon, ""); strcpy(addon, "");
comp_offset = 0; comp_offset = 0;
addon_text_posn = 0.0; addon_text_posn = 0.0;
if (symbol->show_hrt != 0) { if (symbol->show_hrt != 0) {
/* Copy text from symbol */ /* Copy text from symbol */
ustrcpy(local_text, symbol->text); ustrcpy(local_text, symbol->text);
@ -215,9 +216,9 @@ int svg_plot(struct zint_symbol *symbol) {
fprintf(fsvg, "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n"); fprintf(fsvg, "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n");
fprintf(fsvg, " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n"); fprintf(fsvg, " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n");
if (symbol->symbology != BARCODE_MAXICODE) { if (symbol->symbology != BARCODE_MAXICODE) {
fprintf(fsvg, "<svg width=\"%d\" height=\"%d\" version=\"1.1\"\n", (int)ceil((symbol->width + xoffset + xoffset) * scaler), (int)ceil((symbol->height + textoffset + yoffset + yoffset) * scaler)); fprintf(fsvg, "<svg width=\"%d\" height=\"%d\" version=\"1.1\"\n", (int) ceil((symbol->width + xoffset + xoffset) * scaler), (int) ceil((symbol->height + textoffset + yoffset + yoffset) * scaler));
} else { } else {
fprintf(fsvg, "<svg width=\"%d\" height=\"%d\" version=\"1.1\"\n", (int)ceil((74.0F + xoffset + xoffset) * scaler), (int)ceil((72.0F + yoffset + yoffset) * scaler)); fprintf(fsvg, "<svg width=\"%d\" height=\"%d\" version=\"1.1\"\n", (int) ceil((74.0F + xoffset + xoffset) * scaler), (int) ceil((72.0F + yoffset + yoffset) * scaler));
} }
fprintf(fsvg, " xmlns=\"http://www.w3.org/2000/svg\">\n"); fprintf(fsvg, " xmlns=\"http://www.w3.org/2000/svg\">\n");
if ((ustrlen(local_text) != 0) && (symbol->show_hrt != 0)) { if ((ustrlen(local_text) != 0) && (symbol->show_hrt != 0)) {
@ -229,9 +230,9 @@ int svg_plot(struct zint_symbol *symbol) {
fprintf(fsvg, "\n <g id=\"barcode\" fill=\"#%s\">\n", symbol->fgcolour); fprintf(fsvg, "\n <g id=\"barcode\" fill=\"#%s\">\n", symbol->fgcolour);
if (symbol->symbology != BARCODE_MAXICODE) { if (symbol->symbology != BARCODE_MAXICODE) {
fprintf(fsvg, " <rect x=\"0\" y=\"0\" width=\"%d\" height=\"%d\" fill=\"#%s\" />\n", (int)ceil((symbol->width + xoffset + xoffset) * scaler), (int)ceil((symbol->height + textoffset + yoffset + yoffset) * scaler), symbol->bgcolour); fprintf(fsvg, " <rect x=\"0\" y=\"0\" width=\"%d\" height=\"%d\" fill=\"#%s\" />\n", (int) ceil((symbol->width + xoffset + xoffset) * scaler), (int) ceil((symbol->height + textoffset + yoffset + yoffset) * scaler), symbol->bgcolour);
} else { } else {
fprintf(fsvg, " <rect x=\"0\" y=\"0\" width=\"%d\" height=\"%d\" fill=\"#%s\" />\n", (int)ceil((74.0F + xoffset + xoffset) * scaler), (int)ceil((72.0F + yoffset + yoffset) * scaler), symbol->bgcolour); fprintf(fsvg, " <rect x=\"0\" y=\"0\" width=\"%d\" height=\"%d\" fill=\"#%s\" />\n", (int) ceil((74.0F + xoffset + xoffset) * scaler), (int) ceil((72.0F + yoffset + yoffset) * scaler), symbol->bgcolour);
} }
if ((symbol->output_options & BARCODE_BOX) || (symbol->output_options & BARCODE_BIND)) { if ((symbol->output_options & BARCODE_BOX) || (symbol->output_options & BARCODE_BIND)) {
@ -310,8 +311,8 @@ int svg_plot(struct zint_symbol *symbol) {
} }
} }
row_posn += yoffset; row_posn += yoffset;
if (symbol->output_options & BARCODE_DOTTY_MODE) { if (symbol->output_options & BARCODE_DOTTY_MODE) {
/* Use (currently undocumented) dot mode - see SF ticket #29 */ /* Use (currently undocumented) dot mode - see SF ticket #29 */
for (i = 0; i < symbol->width; i++) { for (i = 0; i < symbol->width; i++) {
if (module_is_set(symbol, this_row, i)) { if (module_is_set(symbol, this_row, i)) {
@ -326,7 +327,7 @@ int svg_plot(struct zint_symbol *symbol) {
} else { } else {
latch = 0; latch = 0;
} }
do { do {
block_width = 0; block_width = 0;
do { do {

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>