This commit is contained in:
Rodrigo Torres 2017-09-10 12:03:09 -03:00 committed by Robin Stuart
parent 1882d76b70
commit 4963a772db
45 changed files with 334 additions and 351 deletions

View File

@ -184,7 +184,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, const unsigned char source[], size_t 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, error_number;
char bars[7], spaces[7], mixed[14], dest[1000]; char bars[7], spaces[7], mixed[14], dest[1000];
#ifndef _MSC_VER #ifndef _MSC_VER
unsigned char temp[length + 2]; unsigned char temp[length + 2];
@ -222,7 +222,7 @@ int interleaved_two_of_five(struct zint_symbol *symbol, const unsigned char sour
lookup(NEON, C25InterTable, temp[i + 1], spaces); lookup(NEON, C25InterTable, temp[i + 1], spaces);
/* then merge (interlace) the strings together */ /* then merge (interlace) the strings together */
k = 0; int k = 0;
for (j = 0; j <= 4; j++) { for (j = 0; j <= 4; j++) {
mixed[k] = bars[j]; mixed[k] = bars[j];
k++; k++;

View File

@ -104,7 +104,7 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt
1 = Tracker and Ascender 1 = Tracker and Ascender
2 = Tracker and Descender 2 = Tracker and Descender
3 = Tracker only */ 3 = Tracker only */
int error_number, zeroes; int error_number;
int writer; int writer;
unsigned int loopey, reader; unsigned int loopey, reader;
size_t h; size_t h;
@ -160,7 +160,7 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt
} }
/* Add leading zeros as required */ /* Add leading zeros as required */
zeroes = 8 - length; int zeroes = 8 - length;
memset(localstr, '0', zeroes); memset(localstr, '0', zeroes);
localstr[8] = '\0'; localstr[8] = '\0';
} }

View File

@ -135,13 +135,18 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len
int reduced_length; int reduced_length;
int byte_mode = 0; int byte_mode = 0;
encode_mode=(char*)alloca(src_len); encode_mode=(char*)malloc(src_len);
reduced_source=(char*)alloca(src_len); reduced_source=(char*)malloc(src_len);
reduced_encode_mode=(char*)alloca(src_len); reduced_encode_mode=(char*)malloc(src_len);
if ((!encode_mode) || if ((!encode_mode) ||
(!reduced_source) || (!reduced_source) ||
(!reduced_encode_mode)) return -1; (!reduced_encode_mode)) {
free(encode_mode);
free(reduced_source);
free(reduced_encode_mode);
return -1;
}
for (i = 0; i < src_len; i++) { for (i = 0; i < src_len; i++) {
if (source[i] > 128) { if (source[i] > 128) {
@ -803,6 +808,10 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len
printf("%s\n", binary_string); printf("%s\n", binary_string);
} }
free(encode_mode);
free(reduced_source);
free(reduced_encode_mode);
return 0; return 0;
} }
@ -842,7 +851,7 @@ static int avoidReferenceGrid(int output) {
/* Calculate the position of the bits in the grid */ /* Calculate the position of the bits in the grid */
static void populate_map() { static void populate_map() {
int layer, start, length, n, i; int layer, n, i;
int x, y; int x, y;
for (x = 0; x < 151; x++) { for (x = 0; x < 151; x++) {
@ -852,8 +861,8 @@ static void populate_map() {
} }
for (layer = 1; layer < 33; layer++) { for (layer = 1; layer < 33; layer++) {
start = (112 * (layer - 1)) + (16 * (layer - 1) * (layer - 1)) + 2; const int start = (112 * (layer - 1)) + (16 * (layer - 1) * (layer - 1)) + 2;
length = 28 + ((layer - 1) * 4) + (layer * 4); const int length = 28 + ((layer - 1) * 4) + (layer * 4);
/* Top */ /* Top */
i = 0; i = 0;
x = 64 - ((layer - 1) * 2); x = 64 - ((layer - 1) * 2);

View File

@ -211,11 +211,9 @@ static int Columns2Rows(CharacterSetTable *T, unsigned char *data, const size_t
int useColumns; /* Usable Characters per line */ int useColumns; /* Usable Characters per line */
int fillings; /* Number of filling characters */ int fillings; /* Number of filling characters */
int rowsCur; int rowsCur;
int charCur;
int runChar; int runChar;
int emptyColumns; /* Number of codes still empty in line. */ int emptyColumns; /* Number of codes still empty in line. */
int emptyColumns2; /* Alternative emptyColumns to compare */ int emptyColumns2; /* Alternative emptyColumns to compare */
int fOneLiner; /* Flag if One Liner */
int CPaires; /* Number of digit pairs which may fit in the line */ int CPaires; /* Number of digit pairs which may fit in the line */
int characterSetCur; /* Current Character Set */ int characterSetCur; /* Current Character Set */
@ -226,9 +224,9 @@ static int Columns2Rows(CharacterSetTable *T, unsigned char *data, const size_t
/* >>> Loop until rowsCur<44 */ /* >>> Loop until rowsCur<44 */
do { do {
memset(pSet,0,dataLength*sizeof(int)); memset(pSet,0,dataLength*sizeof(int));
charCur=0; int charCur=0;
rowsCur=0; rowsCur=0;
fOneLiner=1; /* First try one-Liner */ int fOneLiner=1; /* First try one-Liner */
/* >>> Line and OneLiner-try Loop */ /* >>> Line and OneLiner-try Loop */
do{ do{
@ -433,7 +431,6 @@ static int Columns2Rows(CharacterSetTable *T, unsigned char *data, const size_t
static int Rows2Columns(CharacterSetTable *T, unsigned char *data, const size_t dataLength, static int Rows2Columns(CharacterSetTable *T, unsigned char *data, const size_t dataLength,
int * pRows, int * pUseColumns, int * pSet, int * pFillings) int * pRows, int * pUseColumns, int * pSet, int * pFillings)
{ {
int errorCur;
int rowsCur; int rowsCur;
int rowsRequested; /* Number of requested rows */ int rowsRequested; /* Number of requested rows */
int backupRows = 0; int backupRows = 0;
@ -473,7 +470,7 @@ static int Rows2Columns(CharacterSetTable *T, unsigned char *data, const size_t
pTestList[testListSize] = testColumns; pTestList[testListSize] = testColumns;
testListSize++; testListSize++;
useColumns=testColumns; /* Make a copy because it may be modified */ useColumns=testColumns; /* Make a copy because it may be modified */
errorCur = Columns2Rows(T, data, dataLength, &rowsCur, &useColumns, pSet, &fillings); int errorCur = Columns2Rows(T, data, dataLength, &rowsCur, &useColumns, pSet, &fillings);
if (errorCur != 0) if (errorCur != 0)
return errorCur; return errorCur;
if (rowsCur<=rowsRequested) { if (rowsCur<=rowsRequested) {
@ -711,7 +708,7 @@ int codablock(struct zint_symbol *symbol,const unsigned char source[], const siz
if (columns > 64) if (columns > 64)
columns = 64; columns = 64;
#ifdef _DEBUG #ifdef _DEBUG
printf("Auto column count for %d characters:%d\n",dataLength,columns); printf("Auto column count for %zu characters:%d\n",dataLength,columns);
#endif #endif
} }
} }

View File

@ -188,7 +188,6 @@ int code_11(struct zint_symbol *symbol, unsigned char source[], int length) { /*
int c39(struct zint_symbol *symbol, unsigned char source[], const size_t 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;
int error_number; int error_number;
char dest[775]; char dest[775];
char localstr[2] = {0}; char localstr[2] = {0};
@ -223,9 +222,10 @@ int c39(struct zint_symbol *symbol, unsigned char source[], const size_t length)
if ((symbol->symbology == BARCODE_LOGMARS) || (symbol->option_2 == 1)) { if ((symbol->symbology == BARCODE_LOGMARS) || (symbol->option_2 == 1)) {
char check_digit;
counter = counter % 43; counter = counter % 43;
if (counter < 10) { if (counter < 10) {
check_digit = itoc(counter); check_digit = itoc(counter);
} else { } else {
if (counter < 36) { if (counter < 36) {
check_digit = (counter - 10) + 'A'; check_digit = (counter - 10) + 'A';
@ -465,13 +465,13 @@ int c93(struct zint_symbol *symbol, unsigned char source[], int length) {
assume no liability for the use of this document." */ assume no liability for the use of this document." */
void CheckCharacter() { void CheckCharacter() {
int i;
char part[3];
if (value == target_value) { if (value == target_value) {
/* Target reached - save the generated pattern */ /* Target reached - save the generated pattern */
strcpy(pattern, "11110"); strcpy(pattern, "11110");
int i;
for (i = 0; i < 11; i++) { for (i = 0; i < 11; i++) {
char part[3];
part[0] = itoc(S[i]); part[0] = itoc(S[i]);
part[1] = itoc(B[i]); part[1] = itoc(B[i]);
part[2] = '\0'; part[2] = '\0';

View File

@ -143,7 +143,7 @@ int dq4bi(unsigned char source[], int sourcelen, int position) {
static 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, sp;
/* Step J */ /* Step J */
if (current_mode == C1_ASCII) { if (current_mode == C1_ASCII) {
@ -285,7 +285,7 @@ static int c1_look_ahead_test(unsigned char source[], int sourcelen, int positio
if (sp == sourcelen) { if (sp == sourcelen) {
/* Step K */ /* Step K */
best_count = (int) edi_count; int best_count = (int) edi_count;
if (text_count <= best_count) { if (text_count <= best_count) {
best_count = (int) text_count; best_count = (int) text_count;
@ -303,7 +303,7 @@ static int c1_look_ahead_test(unsigned char source[], int sourcelen, int positio
} }
if (byte_count <= best_count) { if (byte_count <= best_count) {
best_count = (int) byte_count; // best_count = (int) byte_count;
best_scheme = C1_BYTE; best_scheme = C1_BYTE;
} }
} else { } else {
@ -361,11 +361,11 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
sp = 0; sp = 0;
tp = 0; tp = 0;
latch = 0; latch = 0;
memset(c40_buffer, 0, 6); memset(c40_buffer, 0, sizeof(*c40_buffer));
c40_p = 0; c40_p = 0;
memset(text_buffer, 0, 6); memset(text_buffer, 0, sizeof(*text_buffer));
text_p = 0; text_p = 0;
memset(edi_buffer, 0, 6); memset(edi_buffer, 0, sizeof(*edi_buffer));
edi_p = 0; edi_p = 0;
strcpy(decimal_binary, ""); strcpy(decimal_binary, "");
@ -538,10 +538,10 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
if (current_mode == C1_C40) { if (current_mode == C1_C40) {
/* Step C - C40 encodation */ /* Step C - C40 encodation */
int shift_set, value, done = 0, latch = 0;
next_mode = C1_C40; next_mode = C1_C40;
if (c40_p == 0) { if (c40_p == 0) {
int done = 0;
if ((length - sp) >= 12) { if ((length - sp) >= 12) {
j = 0; j = 0;
@ -558,6 +558,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
} }
if ((length - sp) >= 8) { if ((length - sp) >= 8) {
int latch = 0;
j = 0; j = 0;
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
@ -592,6 +593,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
target[tp] = 255; /* Unlatch */ target[tp] = 255; /* Unlatch */
tp++; tp++;
} else { } else {
int shift_set, value;
if (source[sp] > 127) { if (source[sp] > 127) {
c40_buffer[c40_p] = 1; c40_buffer[c40_p] = 1;
c40_p++; c40_p++;
@ -639,10 +641,10 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
if (current_mode == C1_TEXT) { if (current_mode == C1_TEXT) {
/* Step D - Text encodation */ /* Step D - Text encodation */
int shift_set, value, done = 0, latch = 0;
next_mode = C1_TEXT; next_mode = C1_TEXT;
if (text_p == 0) { if (text_p == 0) {
int done = 0;
if ((length - sp) >= 12) { if ((length - sp) >= 12) {
j = 0; j = 0;
@ -659,6 +661,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
} }
if ((length - sp) >= 8) { if ((length - sp) >= 8) {
int latch = 0;
j = 0; j = 0;
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
@ -693,6 +696,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
target[tp] = 255; target[tp] = 255;
tp++; /* Unlatch */ tp++; /* Unlatch */
} else { } else {
int shift_set, value;
if (source[sp] > 127) { if (source[sp] > 127) {
text_buffer[text_p] = 1; text_buffer[text_p] = 1;
text_p++; text_p++;
@ -740,7 +744,6 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
if (current_mode == C1_EDI) { if (current_mode == C1_EDI) {
/* Step E - EDI Encodation */ /* Step E - EDI Encodation */
int value = 0, latch = 0;
next_mode = C1_EDI; next_mode = C1_EDI;
if (edi_p == 0) { if (edi_p == 0) {
@ -759,6 +762,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
} }
if ((length - sp) >= 8) { if ((length - sp) >= 8) {
int latch = 0;
j = 0; j = 0;
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
@ -792,6 +796,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
target[tp] = 255; /* Unlatch */ target[tp] = 255; /* Unlatch */
tp++; tp++;
} else { } else {
int value = 0;
if (source[sp] == 13) { if (source[sp] == 13) {
value = 0; value = 0;
} }
@ -1179,7 +1184,7 @@ void block_copy(struct zint_symbol *symbol, char grid[][120], int start_row, int
} }
int code_one(struct zint_symbol *symbol, unsigned char source[], int length) { int code_one(struct zint_symbol *symbol, unsigned char source[], int length) {
int size = 1, i, j, data_blocks; int size = 1, i, j;
char datagrid[136][120]; char datagrid[136][120];
int row, col; int row, col;
@ -1439,7 +1444,7 @@ int code_one(struct zint_symbol *symbol, unsigned char source[], int length) {
sub_ecc[i] = 0; sub_ecc[i] = 0;
} }
data_blocks = c1_blocks[size - 1]; int data_blocks = c1_blocks[size - 1];
rs_init_gf(0x12d); rs_init_gf(0x12d);
rs_init_code(c1_ecc_blocks[size - 1], 0); rs_init_code(c1_ecc_blocks[size - 1], 0);

View File

@ -102,16 +102,15 @@ int parunmodd(const unsigned char llyth) {
* bring together same type blocks * bring together same type blocks
*/ */
void grwp(int *indexliste) { void grwp(int *indexliste) {
int i, j;
/* bring together same type blocks */ /* bring together same type blocks */
if (*(indexliste) > 1) { if (*(indexliste) > 1) {
i = 1; int i = 1;
while (i < *(indexliste)) { while (i < *(indexliste)) {
if (list[1][i - 1] == list[1][i]) { if (list[1][i - 1] == list[1][i]) {
/* bring together */ /* bring together */
list[0][i - 1] = list[0][i - 1] + list[0][i]; list[0][i - 1] = list[0][i - 1] + list[0][i];
j = i + 1; int j = i + 1;
/* decreace the list */ /* decreace the list */
while (j < *(indexliste)) { while (j < *(indexliste)) {
@ -131,11 +130,11 @@ void grwp(int *indexliste) {
* Implements rules from ISO 15417 Annex E * Implements rules from ISO 15417 Annex E
*/ */
void dxsmooth(int *indexliste) { void dxsmooth(int *indexliste) {
int i, current, last, next, length; int i, last, next;
for (i = 0; i < *(indexliste); i++) { for (i = 0; i < *(indexliste); i++) {
current = list[1][i]; int current = list[1][i];
length = list[0][i]; int length = list[0][i];
if (i != 0) { if (i != 0) {
last = list[1][i - 1]; last = list[1][i - 1];
} else { } else {

View File

@ -89,16 +89,15 @@ static const int C16KStopValues[16] = {
}; };
static void grwp16(unsigned int *indexliste) { static void grwp16(unsigned int *indexliste) {
int i, j;
/* bring together same type blocks */ /* bring together same type blocks */
if (*(indexliste) > 1) { if (*(indexliste) > 1) {
i = 1; int i = 1;
while(i < (int)*(indexliste)) { while(i < (int)*(indexliste)) {
if (list[1][i - 1] == list[1][i]) { if (list[1][i - 1] == list[1][i]) {
/* bring together */ /* bring together */
list[0][i - 1] = list[0][i - 1] + list[0][i]; list[0][i - 1] = list[0][i - 1] + list[0][i];
j = i + 1; int j = i + 1;
/* decreace the list */ /* decreace the list */
while(j < (int)*(indexliste)) { while(j < (int)*(indexliste)) {
@ -116,11 +115,11 @@ static void grwp16(unsigned int *indexliste) {
/* Implements rules from ISO 15417 Annex E */ /* Implements rules from ISO 15417 Annex E */
static void dxsmooth16(unsigned int *indexliste) { static void dxsmooth16(unsigned int *indexliste) {
int i, current, last, next, length; int i, last, next;
for(i = 0; i < (int)*(indexliste); i++) { for(i = 0; i < (int)*(indexliste); i++) {
current = list[1][i]; int current = list[1][i];
length = list[0][i]; int length = list[0][i];
if (i != 0) { if (i != 0) {
last = list[1][i - 1]; last = list[1][i - 1];
} else { } else {
@ -258,10 +257,10 @@ static void c16k_set_c(const unsigned char source_a, unsigned char source_b, uns
int code16k(struct zint_symbol *symbol, unsigned char source[], const size_t length) { int code16k(struct zint_symbol *symbol, unsigned char source[], const size_t length) {
char width_pattern[100]; char width_pattern[100];
int current_row, rows_needed, flip_flop, looper, first_check, second_check; int current_row, rows_needed, looper, first_check, second_check;
int indexchaine, f_state; int indexchaine, f_state;
char set[160] = {' '}, fset[160] = {' '}, mode, last_set, current_set; char set[160] = {' '}, fset[160] = {' '}, mode, last_set, current_set;
unsigned int pads_needed, indexliste, i, j, k, m, read, mx_reader, writer; unsigned int pads_needed, indexliste, i, j, k, m, read, mx_reader;
unsigned int values[160] = {0}; unsigned int values[160] = {0};
unsigned int bar_characters; unsigned int bar_characters;
float glyph_count; float glyph_count;
@ -705,8 +704,8 @@ int code16k(struct zint_symbol *symbol, unsigned char source[], const size_t len
strcat(width_pattern, C16KStartStop[C16KStopValues[current_row]]); strcat(width_pattern, C16KStartStop[C16KStopValues[current_row]]);
/* Write the information into the symbol */ /* Write the information into the symbol */
writer = 0; unsigned int writer = 0;
flip_flop = 1; int flip_flop = 1;
for (mx_reader = 0; mx_reader < strlen(width_pattern); mx_reader++) { for (mx_reader = 0; mx_reader < strlen(width_pattern); mx_reader++) {
for (looper = 0; looper < ctoi(width_pattern[mx_reader]); looper++) { for (looper = 0; looper < ctoi(width_pattern[mx_reader]); looper++) {
if (flip_flop == 1) { if (flip_flop == 1) {

View File

@ -87,11 +87,11 @@ 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 size_t length) { int is_sane(const char test_string[], const unsigned char source[], const size_t length) {
unsigned int j, latch; unsigned int j;
size_t i, 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; unsigned int latch = FALSE;
for (j = 0; j < lt; j++) { for (j = 0; j < lt; j++) {
if (source[i] == test_string[j]) { if (source[i] == test_string[j]) {
latch = TRUE; latch = TRUE;

View File

@ -54,7 +54,7 @@
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
extern size_t ustrlen(const unsigned char source[]); extern size_t ustrlen(const unsigned char data[]);
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[]);

View File

@ -109,9 +109,10 @@ static void init928(void) {
/* converts bit string to base 928 values, codeWords[0] is highest order */ /* converts bit string to base 928 values, codeWords[0] is highest order */
static int encode928(UINT bitString[], UINT codeWords[], int bitLng) { static int encode928(UINT bitString[], UINT codeWords[], int bitLng) {
int i, j, b, bitCnt, cwNdx, cwCnt, cwLng; int i, j, b, cwNdx, cwLng;
for (cwNdx = cwLng = b = 0; b < bitLng; b += 69, cwNdx += 7) { for (cwNdx = cwLng = b = 0; b < bitLng; b += 69, cwNdx += 7) {
bitCnt = _min(bitLng - b, 69); int bitCnt = _min(bitLng - b, 69);
int cwCnt;
cwLng += cwCnt = bitCnt / 10 + 1; cwLng += cwCnt = bitCnt / 10 + 1;
for (i = 0; i < cwCnt; i++) for (i = 0; i < cwCnt; i++)
codeWords[cwNdx + i] = 0; /* init 0 */ codeWords[cwNdx + i] = 0; /* init 0 */
@ -132,7 +133,7 @@ static int encode928(UINT bitString[], UINT codeWords[], int bitLng) {
/* CC-A 2D component */ /* CC-A 2D component */
static int cc_a(struct zint_symbol *symbol, char source[], int cc_width) { static int cc_a(struct zint_symbol *symbol, char source[], int cc_width) {
int i, strpos, segment, bitlen, cwCnt, variant, rows; int i, segment, bitlen, cwCnt, variant, rows;
int k, offset, j, total, rsCodeWords[8]; int k, offset, j, total, rsCodeWords[8];
int LeftRAPStart, RightRAPStart, CentreRAPStart, StartCluster; int LeftRAPStart, RightRAPStart, CentreRAPStart, StartCluster;
int LeftRAP, RightRAP, CentreRAP, Cluster, dummy[5]; int LeftRAP, RightRAP, CentreRAP, Cluster, dummy[5];
@ -162,7 +163,7 @@ static int cc_a(struct zint_symbol *symbol, char source[], int cc_width) {
local_source[208] = '\0'; local_source[208] = '\0';
for (segment = 0; segment < 13; segment++) { for (segment = 0; segment < 13; segment++) {
strpos = segment * 16; int strpos = segment * 16;
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
if (local_source[strpos + i] == '1') { if (local_source[strpos + i] == '1') {
bitStr[segment] += (0x8000 >> i); bitStr[segment] += (0x8000 >> i);
@ -335,7 +336,7 @@ static int cc_a(struct zint_symbol *symbol, char source[], int cc_width) {
/* CC-B 2D component */ /* CC-B 2D component */
static int cc_b(struct zint_symbol *symbol, char source[], int cc_width) { static int cc_b(struct zint_symbol *symbol, char source[], int cc_width) {
int length, i, binloc; int length, i;
#ifndef _MSC_VER #ifndef _MSC_VER
unsigned char data_string[(strlen(source) / 8) + 3]; unsigned char data_string[(strlen(source) / 8) + 3];
#else #else
@ -351,7 +352,7 @@ static int cc_b(struct zint_symbol *symbol, char source[], int cc_width) {
length = strlen(source) / 8; length = strlen(source) / 8;
for (i = 0; i < length; i++) { for (i = 0; i < length; i++) {
binloc = i * 8; int binloc = i * 8;
data_string[i] = 0; data_string[i] = 0;
for (p = 0; p < 8; p++) { for (p = 0; p < 8; p++) {
@ -368,7 +369,7 @@ static int cc_b(struct zint_symbol *symbol, char source[], int cc_width) {
chainemc[mclength] = 920; chainemc[mclength] = 920;
mclength++; mclength++;
byteprocess(chainemc, &mclength, data_string, 0, length, 0); byteprocess(chainemc, &mclength, data_string, 0, length);
/* Now figure out which variant of the symbol to use and load values accordingly */ /* Now figure out which variant of the symbol to use and load values accordingly */
@ -588,7 +589,7 @@ static int cc_b(struct zint_symbol *symbol, char source[], int cc_width) {
/* CC-C 2D component - byte compressed PDF417 */ /* CC-C 2D component - byte compressed PDF417 */
static int cc_c(struct zint_symbol *symbol, char source[], int cc_width, int ecc_level) { static int cc_c(struct zint_symbol *symbol, char source[], int cc_width, int ecc_level) {
int length, i, p, binloc; int length, i, p;
#ifndef _MSC_VER #ifndef _MSC_VER
unsigned char data_string[(strlen(source) / 8) + 4]; unsigned char data_string[(strlen(source) / 8) + 4];
#else #else
@ -602,7 +603,7 @@ static int cc_c(struct zint_symbol *symbol, char source[], int cc_width, int ecc
length = strlen(source) / 8; length = strlen(source) / 8;
for (i = 0; i < length; i++) { for (i = 0; i < length; i++) {
binloc = i * 8; int binloc = i * 8;
data_string[i] = 0; data_string[i] = 0;
for (p = 0; p < 8; p++) { for (p = 0; p < 8; p++) {
@ -619,7 +620,7 @@ static int cc_c(struct zint_symbol *symbol, char source[], int cc_width, int ecc
chainemc[mclength] = 920; /* CC-C identifier */ chainemc[mclength] = 920; /* CC-C identifier */
mclength++; mclength++;
byteprocess(chainemc, &mclength, data_string, 0, length, 0); byteprocess(chainemc, &mclength, data_string, 0, length);
chainemc[0] = mclength; chainemc[0] = mclength;
@ -962,9 +963,7 @@ int calc_padding_ccc(int binary_length, int *cc_width, int lin_width, int *ecc)
static int cc_binary_string(struct zint_symbol *symbol, const char source[], char binary_string[], int cc_mode, int *cc_width, int *ecc, int lin_width) { /* Handles all data encodation from section 5 of ISO/IEC 24723 */ static int cc_binary_string(struct zint_symbol *symbol, const char source[], char binary_string[], int cc_mode, int *cc_width, int *ecc, int lin_width) { /* Handles all data encodation from section 5 of ISO/IEC 24723 */
int encoding_method, read_posn, d1, d2, alpha_pad; int encoding_method, read_posn, d1, d2, alpha_pad;
int i, j, ai_crop, fnc1_latch; int i, j, ai_crop, fnc1_latch;
long int group_val;
int ai90_mode, latch, remainder, binary_length; int ai90_mode, latch, remainder, binary_length;
char date_str[4];
#ifndef _MSC_VER #ifndef _MSC_VER
char general_field[strlen(source) + 1], general_field_type[strlen(source) + 1]; char general_field[strlen(source) + 1], general_field_type[strlen(source) + 1];
#else #else
@ -1007,10 +1006,11 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha
read_posn = 2; read_posn = 2;
} else { } else {
/* Production Date (11) or Expiration Date (17) */ /* Production Date (11) or Expiration Date (17) */
char date_str[4];
date_str[0] = source[2]; date_str[0] = source[2];
date_str[1] = source[3]; date_str[1] = source[3];
date_str[2] = '\0'; date_str[2] = '\0';
group_val = atoi(date_str) * 384; long int group_val = atoi(date_str) * 384;
date_str[0] = source[4]; date_str[0] = source[4];
date_str[1] = source[5]; date_str[1] = source[5];
@ -1048,9 +1048,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha
#else #else
char* ninety = (char*) _alloca(strlen(source) + 1); char* ninety = (char*) _alloca(strlen(source) + 1);
#endif #endif
char numeric_part[4]; int alpha, alphanum, numeric, test1, test2, test3;
int alpha, alphanum, numeric, test1, test2, test3, next_ai_posn;
int numeric_value, table3_letter;
/* "This encodation method may be used if an element string with an AI /* "This encodation method may be used if an element string with an AI
90 occurs at the start of the data message, and if the data field 90 occurs at the start of the data message, and if the data field
@ -1147,7 +1145,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha
} }
} }
next_ai_posn = 2 + (int)strlen(ninety); int next_ai_posn = 2 + (int)strlen(ninety);
if (source[next_ai_posn] == '[') { if (source[next_ai_posn] == '[') {
/* There are more AIs afterwords */ /* There are more AIs afterwords */
@ -1171,6 +1169,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha
break; break;
} }
char numeric_part[4];
if (test1 == 0) { if (test1 == 0) {
strcpy(numeric_part, "0"); strcpy(numeric_part, "0");
} else { } else {
@ -1180,9 +1179,9 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha
numeric_part[i] = '\0'; numeric_part[i] = '\0';
} }
numeric_value = atoi(numeric_part); int numeric_value = atoi(numeric_part);
table3_letter = -1; int table3_letter = -1;
if (numeric_value < 31) { if (numeric_value < 31) {
table3_letter = posn("BDHIJKLNPQRSTVWZ", ninety[test1]); table3_letter = posn("BDHIJKLNPQRSTVWZ", ninety[test1]);
} }

View File

@ -194,12 +194,12 @@ static void ecc200placement(int *array, const int NR, const int NC) {
/* calculate and append ecc code, and if necessary interleave */ /* calculate and append ecc code, and if necessary interleave */
static void ecc200(unsigned char *binary, const int bytes, const int datablock, const int rsblock, const int skew) { static void ecc200(unsigned char *binary, const int bytes, const int datablock, const int rsblock, const int skew) {
int blocks = (bytes + 2) / datablock, b; int blocks = (bytes + 2) / datablock, b;
int n, p; int n;
rs_init_gf(0x12d); rs_init_gf(0x12d);
rs_init_code(rsblock, 1); rs_init_code(rsblock, 1);
for (b = 0; b < blocks; b++) { for (b = 0; b < blocks; b++) {
unsigned char buf[256], ecc[256]; unsigned char buf[256], ecc[256];
p = 0; int p = 0;
for (n = b; n < bytes; n += blocks) for (n = b; n < bytes; n += blocks)
buf[p++] = binary[n]; buf[p++] = binary[n];
rs_encode(p, buf, ecc); rs_encode(p, buf, ecc);
@ -698,7 +698,6 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
/* step (c) C40 encodation */ /* step (c) C40 encodation */
if (current_mode == DM_C40) { if (current_mode == DM_C40) {
int shift_set, value;
next_mode = DM_C40; next_mode = DM_C40;
if (*process_p == 0) { if (*process_p == 0) {
@ -712,6 +711,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
next_mode = DM_ASCII; next_mode = DM_ASCII;
if (debug) printf("ASC "); if (debug) printf("ASC ");
} else { } else {
int shift_set, value;
if (source[sp] > 127) { if (source[sp] > 127) {
process_buffer[*process_p] = 1; process_buffer[*process_p] = 1;
(*process_p)++; (*process_p)++;
@ -761,7 +761,6 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
/* step (d) Text encodation */ /* step (d) Text encodation */
if (current_mode == DM_TEXT) { if (current_mode == DM_TEXT) {
int shift_set, value;
next_mode = DM_TEXT; next_mode = DM_TEXT;
if (*process_p == 0) { if (*process_p == 0) {
@ -775,6 +774,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
next_mode = DM_ASCII; next_mode = DM_ASCII;
if (debug) printf("ASC "); if (debug) printf("ASC ");
} else { } else {
int shift_set, value;
if (source[sp] > 127) { if (source[sp] > 127) {
process_buffer[*process_p] = 1; process_buffer[*process_p] = 1;
(*process_p)++; (*process_p)++;
@ -824,7 +824,6 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
/* step (e) X12 encodation */ /* step (e) X12 encodation */
if (current_mode == DM_X12) { if (current_mode == DM_X12) {
int value = 0;
next_mode = DM_X12; next_mode = DM_X12;
if (*process_p == 0) { if (*process_p == 0) {
@ -838,6 +837,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
next_mode = DM_ASCII; next_mode = DM_ASCII;
if (debug) printf("ASC "); if (debug) printf("ASC ");
} else { } else {
int value = 0;
if (source[sp] == 13) { if (source[sp] == 13) {
value = 0; value = 0;
} }
@ -885,7 +885,6 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
/* step (f) EDIFACT encodation */ /* step (f) EDIFACT encodation */
if (current_mode == DM_EDIFACT) { if (current_mode == DM_EDIFACT) {
int value = 0;
next_mode = DM_EDIFACT; next_mode = DM_EDIFACT;
if (*process_p == 3) { if (*process_p == 3) {
@ -897,7 +896,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
(*process_p)++; (*process_p)++;
next_mode = DM_ASCII; next_mode = DM_ASCII;
} else { } else {
value = source[sp]; int value = source[sp];
if (source[sp] >= 64) { // '@' if (source[sp] >= 64) { // '@'
value -= 64; value -= 64;
@ -1148,7 +1147,6 @@ int data_matrix_200(struct zint_symbol *symbol,const unsigned char source[], con
int taillength, error_number = 0; int taillength, error_number = 0;
int H, W, FH, FW, datablock, bytes, rsblock; int H, W, FH, FW, datablock, bytes, rsblock;
int last_mode = DM_ASCII; int last_mode = DM_ASCII;
unsigned char *grid = 0;
int symbols_left; int symbols_left;
/* inputlen may be decremented by 2 if macro character is used */ /* inputlen may be decremented by 2 if macro character is used */
@ -1247,7 +1245,7 @@ int data_matrix_200(struct zint_symbol *symbol,const unsigned char source[], con
NR = H - 2 * (H / FH); NR = H - 2 * (H / FH);
places = (int*) malloc(NC * NR * sizeof (int)); places = (int*) malloc(NC * NR * sizeof (int));
ecc200placement(places, NR, NC); ecc200placement(places, NR, NC);
grid = (unsigned char*) malloc(W * H); unsigned char *grid = (unsigned char*) malloc(W * H);
memset(grid, 0, W * H); memset(grid, 0, W * H);
for (y = 0; y < H; y += FH) { for (y = 0; y < H; y += FH) {
for (x = 0; x < W; x++) for (x = 0; x < W; x++)

View File

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

View File

@ -436,7 +436,7 @@ int binary(const unsigned char source[], int position) {
int dotcode_encode_message(struct zint_symbol *symbol, const unsigned char source[], int length, unsigned char *codeword_array, int *binary_finish) { int dotcode_encode_message(struct zint_symbol *symbol, const unsigned char source[], int length, unsigned char *codeword_array, int *binary_finish) {
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;
int debug = symbol->debug; int debug = symbol->debug;
int binary_buffer_size = 0; int binary_buffer_size = 0;
int lawrencium[6]; // Reversed radix 103 values int lawrencium[6]; // Reversed radix 103 values
@ -524,7 +524,7 @@ int dotcode_encode_message(struct zint_symbol *symbol, const unsigned char sourc
} }
do { do {
done = 0; int done = 0;
/* Step A */ /* Step A */
if ((input_position == length - 2) && (inside_macro != 0) && (inside_macro != 100)) { if ((input_position == length - 2) && (inside_macro != 0) && (inside_macro != 100)) {
// inside_macro only gets set to 97, 98 or 99 if the last two characters are RS/EOT // inside_macro only gets set to 97, 98 or 99 if the last two characters are RS/EOT

View File

@ -40,8 +40,6 @@
/* Convert Unicode to other character encodings */ /* Convert Unicode to other character encodings */
int utf_to_eci(const int eci, const unsigned char source[], unsigned char dest[], size_t *length) { int utf_to_eci(const int eci, const unsigned char source[], unsigned char dest[], size_t *length) {
int glyph;
int bytelen;
int in_posn; int in_posn;
int out_posn; int out_posn;
int ext; int ext;
@ -60,8 +58,8 @@ int utf_to_eci(const int eci, const unsigned char source[], unsigned char dest[]
out_posn = 0; out_posn = 0;
do { do {
/* Single byte (ASCII) character */ /* Single byte (ASCII) character */
bytelen = 1; int bytelen = 1;
glyph = (int) source[in_posn]; int 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 */

View File

@ -43,13 +43,12 @@
int count_rectangles(struct zint_symbol *symbol) { int count_rectangles(struct zint_symbol *symbol) {
int rectangles = 0; int rectangles = 0;
int this_row;
int latch, i;
if ((symbol->symbology != BARCODE_MAXICODE) && if ((symbol->symbology != BARCODE_MAXICODE) &&
((symbol->output_options & BARCODE_DOTTY_MODE) == 0)) { ((symbol->output_options & BARCODE_DOTTY_MODE) == 0)) {
int this_row;
for(this_row = 0; this_row < symbol->rows; this_row++) { for(this_row = 0; this_row < symbol->rows; this_row++) {
latch = 0; int i, latch = 0;
for(i = 0; i < symbol->width; i++) { for(i = 0; i < symbol->width; i++) {
if ((module_is_set(symbol, this_row, i)) && (latch == 0)) { if ((module_is_set(symbol, this_row, i)) && (latch == 0)) {
latch = 1; latch = 1;
@ -68,12 +67,12 @@ int count_rectangles(struct zint_symbol *symbol) {
int count_circles(struct zint_symbol *symbol) { int count_circles(struct zint_symbol *symbol) {
int circles = 0; int circles = 0;
int this_row;
int i;
if ((symbol->symbology != BARCODE_MAXICODE) && if ((symbol->symbology != BARCODE_MAXICODE) &&
((symbol->output_options & BARCODE_DOTTY_MODE) != 0)) { ((symbol->output_options & BARCODE_DOTTY_MODE) != 0)) {
int this_row;
for(this_row = 0; this_row < symbol->rows; this_row++) { for(this_row = 0; this_row < symbol->rows; this_row++) {
int i;
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)) {
circles++; circles++;
@ -87,11 +86,11 @@ int count_circles(struct zint_symbol *symbol) {
int count_hexagons(struct zint_symbol *symbol) { int count_hexagons(struct zint_symbol *symbol) {
int hexagons = 0; int hexagons = 0;
int this_row;
int i;
if (symbol->symbology == BARCODE_MAXICODE) { if (symbol->symbology == BARCODE_MAXICODE) {
int this_row;
for(this_row = 0; this_row < symbol->rows; this_row++) { for(this_row = 0; this_row < symbol->rows; this_row++) {
int i;
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)) {
hexagons++; hexagons++;
@ -137,7 +136,7 @@ int bump_up(int input) {
int emf_plot(struct zint_symbol *symbol) { int emf_plot(struct zint_symbol *symbol) {
int i, block_width, latch, this_row; int i, block_width, latch, this_row;
float large_bar_height, preset_height, row_height, row_posn; float large_bar_height, preset_height, row_height;
FILE *emf_file; FILE *emf_file;
int fgred, fggrn, fgblu, bgred, bggrn, bgblu; int fgred, fggrn, fgblu, bgred, bggrn, bgblu;
int error_number = 0; int error_number = 0;
@ -751,7 +750,7 @@ int emf_plot(struct zint_symbol *symbol) {
} else { } else {
row_height = symbol->row_height[this_row]; row_height = symbol->row_height[this_row];
} }
row_posn = 0; float row_posn = 0;
for (i = 0; i < this_row; i++) { for (i = 0; i < this_row; i++) {
if (symbol->row_height[i] == 0) { if (symbol->row_height[i] == 0) {
row_posn += large_bar_height; row_posn += large_bar_height;

View File

@ -49,13 +49,13 @@ int number_lat(int gbdata[], const size_t length, const size_t position) {
a string which has "2.2.0" (cannot have more than one non-numeric character for each a string which has "2.2.0" (cannot have more than one non-numeric character for each
block of three numeric characters) */ block of three numeric characters) */
size_t sp; size_t sp;
int numb = 0, nonum = 0, done; int numb = 0, nonum = 0;
int tally = 0; int tally = 0;
sp = position; sp = position;
do { do {
done = 0; int done = 0;
if ((gbdata[sp] >= '0') && (gbdata[sp] <= '9')) { if ((gbdata[sp] >= '0') && (gbdata[sp] <= '9')) {
numb++; numb++;
@ -125,7 +125,7 @@ static int seek_forward(int gbdata[], const size_t length, const size_t position
possible combinations of input data */ possible combinations of input data */
int number_count, byte_count, mixed_count, upper_count, lower_count, chinese_count; int number_count, byte_count, mixed_count, upper_count, lower_count, chinese_count;
int best_mode, done; int best_mode;
size_t sp; size_t sp;
int best_count, last = -1; int best_count, last = -1;
int debug = 0; int debug = 0;
@ -194,7 +194,7 @@ static int seek_forward(int gbdata[], const size_t length, const size_t position
for (sp = position; (sp < length) && (sp <= (position + 8)); sp++) { for (sp = position; (sp < length) && (sp <= (position + 8)); sp++) {
done = 0; int done = 0;
if (gbdata[sp] >= 0xff) { if (gbdata[sp] >= 0xff) {
byte_count += 17; byte_count += 17;
@ -347,7 +347,7 @@ static int gm_encode(int gbdata[], const size_t length, char binary[],const int
/* Create a binary stream representation of the input data. /* Create a binary stream representation of the input data.
7 sets are defined - Chinese characters, Numerals, Lower case letters, Upper case letters, 7 sets are defined - Chinese characters, Numerals, Lower case letters, Upper case letters,
Mixed numerals and latters, Control characters and 8-bit binary data */ Mixed numerals and latters, Control characters and 8-bit binary data */
int sp, current_mode, next_mode, last_mode, glyph = 0; int sp, current_mode, last_mode, glyph = 0;
int c1, c2, done; int c1, c2, done;
int p = 0, ppos; int p = 0, ppos;
int numbuf[3], punt = 0; int numbuf[3], punt = 0;
@ -383,7 +383,7 @@ static int gm_encode(int gbdata[], const size_t length, char binary[],const int
} }
do { do {
next_mode = seek_forward(gbdata, length, sp, current_mode); int next_mode = seek_forward(gbdata, length, sp, current_mode);
if (next_mode != current_mode) { if (next_mode != current_mode) {
switch (current_mode) { switch (current_mode) {
@ -800,7 +800,7 @@ static int gm_encode(int gbdata[], const size_t length, char binary[],const int
static void gm_add_ecc(const char binary[], const size_t data_posn, const int layers, const int ecc_level, int word[]) { static void gm_add_ecc(const char binary[], const size_t data_posn, const int layers, const int ecc_level, int word[]) {
int data_cw, i, j, wp, p; int data_cw, i, j, wp, p;
int n1, b1, n2, b2, e1, b3, e2; int n1, b1, n2, b2, e1, b3, e2;
int block_size, data_size, ecc_size; int block_size, ecc_size;
int data[1320], block[130]; int data[1320], block[130];
unsigned char data_block[115], ecc_block[70]; unsigned char data_block[115], ecc_block[70];
@ -851,7 +851,7 @@ static void gm_add_ecc(const char binary[], const size_t data_posn, const int la
} else { } else {
ecc_size = e2; ecc_size = e2;
} }
data_size = block_size - ecc_size; int data_size = block_size - ecc_size;
/* printf("block %d/%d: data %d / ecc %d\n", i + 1, (b1 + b2), data_size, ecc_size);*/ /* printf("block %d/%d: data %d / ecc %d\n", i + 1, (b1 + b2), data_size, ecc_size);*/
@ -1000,9 +1000,9 @@ void place_layer_id(char* grid, int size, int layers, int modules, int ecc_level
} }
int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], size_t length) { int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], size_t length) {
int size, modules, dark, error_number; int size, modules, error_number;
int auto_layers, min_layers, layers, auto_ecc_level, min_ecc_level, ecc_level; int auto_layers, min_layers, layers, auto_ecc_level, min_ecc_level, ecc_level;
int x, y, i, j, glyph; int x, y, i;
char binary[9300]; char binary[9300];
int data_cw, input_latch = 0; int data_cw, input_latch = 0;
int word[1460], data_max, reader = 0; int word[1460], data_max, reader = 0;
@ -1035,8 +1035,8 @@ int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], size_t
if (utfdata[i] <= 0xff) { if (utfdata[i] <= 0xff) {
gbdata[i] = utfdata[i]; gbdata[i] = utfdata[i];
} else { } else {
j = 0; int j = 0;
glyph = 0; int glyph = 0;
do { do {
if (gb2312_lookup[j * 2] == utfdata[i]) { if (gb2312_lookup[j * 2] == utfdata[i]) {
glyph = gb2312_lookup[(j * 2) + 1]; glyph = gb2312_lookup[(j * 2) + 1];
@ -1174,7 +1174,7 @@ int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], size_t
/* Add macromodule frames */ /* Add macromodule frames */
for (x = 0; x < modules; x++) { for (x = 0; x < modules; x++) {
dark = 1 - (x & 1); int dark = 1 - (x & 1);
for (y = 0; y < modules; y++) { for (y = 0; y < modules; y++) {
if (dark == 1) { if (dark == 1) {
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {

View File

@ -228,11 +228,10 @@ int isFourByte(int glyph, int glyph2) {
static void hx_define_mode(char mode[], int source[], const size_t length) { static void hx_define_mode(char mode[], int source[], const size_t length) {
size_t i; size_t i;
char lastmode = 't'; char lastmode = 't';
int done;
i = 0; i = 0;
do { do {
done = 0; int done = 0;
if (isRegion1(source[i])) { if (isRegion1(source[i])) {
mode[i] = '1'; mode[i] = '1';
@ -330,7 +329,6 @@ int lookup_text2(char input) {
/* Convert input data to binary stream */ /* Convert input data to binary stream */
static void calculate_binary(char binary[], char mode[], int source[], const size_t length, const int eci, int debug) { static void calculate_binary(char binary[], char mode[], int source[], const size_t length, const int eci, int debug) {
int block_length;
int position = 0; int position = 0;
int i, count, encoding_value; int i, count, encoding_value;
int first_byte, second_byte; int first_byte, second_byte;
@ -355,7 +353,7 @@ static void calculate_binary(char binary[], char mode[], int source[], const siz
} }
do { do {
block_length = 0; int block_length = 0;
do { do {
block_length++; block_length++;
} while (mode[position + block_length] == mode[position]); } while (mode[position + block_length] == mode[position]);
@ -373,19 +371,19 @@ static void calculate_binary(char binary[], char mode[], int source[], const siz
i = 0; i = 0;
while (i < block_length) { while (i < block_length) {
int first = 0, second = 0, third = 0; int first = 0;
first = posn(NEON, (char) source[position + i]); first = posn(NEON, (char) source[position + i]);
count = 1; count = 1;
encoding_value = first; encoding_value = first;
if (i + 1 < block_length && mode[position + i + 1] == 'n') { if (i + 1 < block_length && mode[position + i + 1] == 'n') {
second = posn(NEON, (char) source[position + i + 1]); int second = posn(NEON, (char) source[position + i + 1]);
count = 2; count = 2;
encoding_value = (encoding_value * 10) + second; encoding_value = (encoding_value * 10) + second;
if (i + 2 < block_length && mode[position + i + 2] == 'n') { if (i + 2 < block_length && mode[position + i + 2] == 'n') {
third = posn(NEON, (char) source[position + i + 2]); int third = posn(NEON, (char) source[position + i + 2]);
count = 3; count = 3;
encoding_value = (encoding_value * 10) + third; encoding_value = (encoding_value * 10) + third;
} }
@ -910,15 +908,14 @@ void hx_add_ecc(unsigned char fullstream[], unsigned char datastream[], int vers
unsigned char data_block[180]; unsigned char data_block[180];
unsigned char ecc_block[36]; unsigned char ecc_block[36];
int i, j, block; int i, j, block;
int batch_size, data_length, ecc_length;
int input_position = -1; int input_position = -1;
int output_position = -1; int output_position = -1;
int table_d1_pos = ((version - 1) * 36) + ((ecc_level - 1) * 9); int table_d1_pos = ((version - 1) * 36) + ((ecc_level - 1) * 9);
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
batch_size = hx_table_d1[table_d1_pos + (3 * i)]; int batch_size = hx_table_d1[table_d1_pos + (3 * i)];
data_length = hx_table_d1[table_d1_pos + (3 * i) + 1]; int data_length = hx_table_d1[table_d1_pos + (3 * i) + 1];
ecc_length = hx_table_d1[table_d1_pos + (3 * i) + 2]; int ecc_length = hx_table_d1[table_d1_pos + (3 * i) + 2];
for (block = 0; block < batch_size; block++) { for (block = 0; block < batch_size; block++) {
for (j = 0; j < data_length; j++) { for (j = 0; j < data_length; j++) {
@ -1228,13 +1225,11 @@ int hx_apply_bitmask(unsigned char *grid, int size) {
int han_xin(struct zint_symbol *symbol, const unsigned char source[], size_t length) { int han_xin(struct zint_symbol *symbol, const unsigned char source[], size_t length) {
int est_binlen; int est_binlen;
int ecc_level = symbol->option_1; int ecc_level = symbol->option_1;
int i, j, version, posn = 0; int i, j, version;
int data_codewords = 0, size; int data_codewords = 0, size;
int codewords; int codewords;
int bitmask; int bitmask;
int error_number;
int bin_len; int bin_len;
int done;
char function_information[36]; char function_information[36];
unsigned char fi_cw[3] = {0, 0, 0}; unsigned char fi_cw[3] = {0, 0, 0};
unsigned char fi_ecc[4]; unsigned char fi_ecc[4];
@ -1260,14 +1255,14 @@ int han_xin(struct zint_symbol *symbol, const unsigned char source[], size_t len
} }
} else { } else {
/* Convert Unicode input to GB-18030 */ /* Convert Unicode input to GB-18030 */
error_number = utf8toutf16(symbol, source, utfdata, &length); int error_number = utf8toutf16(symbol, source, utfdata, &length);
if (error_number != 0) { if (error_number != 0) {
return error_number; return error_number;
} }
posn = 0; int posn = 0;
for (i = 0; i < length; i++) { for (i = 0; i < length; i++) {
done = 0; int done = 0;
gbdata[posn] = 0; gbdata[posn] = 0;
/* Single byte characters in range U+0000 -> U+007F */ /* Single byte characters in range U+0000 -> U+007F */

View File

@ -36,11 +36,11 @@
#include "large.h" #include "large.h"
void binary_add(short int accumulator[], short int input_buffer[]) { /* Binary addition */ void binary_add(short int accumulator[], short int input_buffer[]) { /* Binary addition */
int i, carry, done; int i, carry;
carry = 0; carry = 0;
for (i = 0; i < 112; i++) { for (i = 0; i < 112; i++) {
done = 0; int done = 0;
if (((input_buffer[i] == 0) && (accumulator[i] == 0)) if (((input_buffer[i] == 0) && (accumulator[i] == 0))
&& ((carry == 0) && (done == 0))) { && ((carry == 0) && (done == 0))) {
accumulator[i] = 0; accumulator[i] = 0;

View File

@ -102,22 +102,22 @@ void ZBarcode_Delete(struct zint_symbol *symbol) {
// If there is a rendered version, ensure its memory is released // If there is a rendered version, ensure its memory is released
if (symbol->rendered != NULL) { if (symbol->rendered != NULL) {
struct zint_render_line *line, *l; struct zint_render_line *line;
struct zint_render_string *string, *s; struct zint_render_string *string;
struct zint_render_ring *ring, *r; struct zint_render_ring *ring;
struct zint_render_hexagon *hexagon, *h; struct zint_render_hexagon *hexagon;
// Free lines // Free lines
line = symbol->rendered->lines; line = symbol->rendered->lines;
while (line) { while (line) {
l = line; struct zint_render_line *l = line;
line = line->next; line = line->next;
free(l); free(l);
} }
// Free Strings // Free Strings
string = symbol->rendered->strings; string = symbol->rendered->strings;
while (string) { while (string) {
s = string; struct zint_render_string *s = string;
string = string->next; string = string->next;
free(s->text); free(s->text);
free(s); free(s);
@ -126,7 +126,7 @@ void ZBarcode_Delete(struct zint_symbol *symbol) {
// Free Rings // Free Rings
ring = symbol->rendered->rings; ring = symbol->rendered->rings;
while (ring) { while (ring) {
r = ring; struct zint_render_ring *r = ring;
ring = ring->next; ring = ring->next;
free(r); free(r);
} }
@ -134,7 +134,7 @@ void ZBarcode_Delete(struct zint_symbol *symbol) {
// Free Hexagons // Free Hexagons
hexagon = symbol->rendered->hexagons; hexagon = symbol->rendered->hexagons;
while (hexagon) { while (hexagon) {
h = hexagon; struct zint_render_hexagon *h = hexagon;
hexagon = hexagon->next; hexagon = hexagon->next;
free(h); free(h);
} }
@ -215,9 +215,9 @@ extern int svg_plot(struct zint_symbol *symbol); /* Plot to SVG */
extern int emf_plot(struct zint_symbol *symbol); /* Plot to Metafile */ extern int emf_plot(struct zint_symbol *symbol); /* Plot to Metafile */
void error_tag(char error_string[], int error_number) { void error_tag(char error_string[], int error_number) {
char error_buffer[100];
if (error_number != 0) { if (error_number != 0) {
char error_buffer[100];
strcpy(error_buffer, error_string); strcpy(error_buffer, error_string);
if (error_number > 4) { if (error_number > 4) {
@ -234,7 +234,6 @@ void error_tag(char error_string[], int error_number) {
int dump_plot(struct zint_symbol *symbol) { int dump_plot(struct zint_symbol *symbol) {
FILE *f; FILE *f;
int i, r; int i, r;
int byt;
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;
@ -250,7 +249,7 @@ int dump_plot(struct zint_symbol *symbol) {
} }
for (r = 0; r < symbol->rows; r++) { for (r = 0; r < symbol->rows; r++) {
byt = 0; int byt = 0;
for (i = 0; i < symbol->width; i++) { for (i = 0; i < symbol->width; i++) {
byt = byt << 1; byt = byt << 1;
if (module_is_set(symbol, r, i)) { if (module_is_set(symbol, r, i)) {
@ -1083,7 +1082,6 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source,int
int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle) { int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle) {
int error_number; int error_number;
char output[4];
switch (rotate_angle) { switch (rotate_angle) {
case 0: case 0:
@ -1104,6 +1102,7 @@ int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle) {
} }
if (strlen(symbol->outfile) > 3) { if (strlen(symbol->outfile) > 3) {
char output[4];
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];
output[2] = symbol->outfile[strlen(symbol->outfile) - 1]; output[2] = symbol->outfile[strlen(symbol->outfile) - 1];

View File

@ -588,8 +588,8 @@ void maxi_do_primary_3(char postcode[], int country, int service) {
maxi_codeword[9] = ((service & 0x3f0) >> 4); maxi_codeword[9] = ((service & 0x3f0) >> 4);
} }
int maxicode(struct zint_symbol *symbol, unsigned char local_source[], int length) { int maxicode(struct zint_symbol *symbol, unsigned char local_source[], const int length) {
int i, j, block, bit, mode, countrycode = 0, service = 0, lp = 0; int i, j, block, bit, mode, lp = 0;
int bit_pattern[7], internal_error = 0, eclen; int bit_pattern[7], internal_error = 0, eclen;
char postcode[12], countrystr[4], servicestr[4]; char postcode[12], countrystr[4], servicestr[4];
@ -659,8 +659,8 @@ int maxicode(struct zint_symbol *symbol, unsigned char local_source[], int lengt
servicestr[2] = symbol->primary[14]; servicestr[2] = symbol->primary[14];
servicestr[3] = '\0'; servicestr[3] = '\0';
countrycode = atoi(countrystr); int countrycode = atoi(countrystr);
service = atoi(servicestr); int service = atoi(servicestr);
if (mode == 2) { if (mode == 2) {
maxi_do_primary_2(postcode, countrycode, service); maxi_do_primary_2(postcode, countrycode, service);

View File

@ -235,7 +235,7 @@ int codabar(struct zint_symbol *symbol, unsigned char source[], int length) {
int code32(struct zint_symbol *symbol, unsigned char source[], int length) { int code32(struct zint_symbol *symbol, unsigned char source[], int length) {
int i, zeroes, error_number, checksum, checkpart, checkdigit; int i, zeroes, error_number, checksum, checkpart, checkdigit;
char localstr[10], risultante[7]; char localstr[10], risultante[7];
long int pharmacode, remainder, devisor; long int pharmacode, devisor;
int codeword[6]; int codeword[6];
char tabella[34]; char tabella[34];
@ -281,7 +281,7 @@ int code32(struct zint_symbol *symbol, unsigned char source[], int length) {
devisor = 33554432; devisor = 33554432;
for (i = 5; i >= 0; i--) { for (i = 5; i >= 0; i--) {
codeword[i] = pharmacode / devisor; codeword[i] = pharmacode / devisor;
remainder = pharmacode % devisor; long int remainder = pharmacode % devisor;
pharmacode = remainder; pharmacode = remainder;
devisor /= 32; devisor /= 32;
} }

View File

@ -101,16 +101,15 @@ int quelmode(char codeascii) {
/* 844 */ /* 844 */
void regroupe(int *indexliste) { void regroupe(int *indexliste) {
int i, j;
/* bring together same type blocks */ /* bring together same type blocks */
if (*(indexliste) > 1) { if (*(indexliste) > 1) {
i = 1; int i = 1;
while (i < *(indexliste)) { while (i < *(indexliste)) {
if (liste[1][i - 1] == liste[1][i]) { if (liste[1][i - 1] == liste[1][i]) {
/* bring together */ /* bring together */
liste[0][i - 1] = liste[0][i - 1] + liste[0][i]; liste[0][i - 1] = liste[0][i - 1] + liste[0][i];
j = i + 1; int j = i + 1;
/* decreace the list */ /* decreace the list */
while (j < *(indexliste)) { while (j < *(indexliste)) {
@ -224,11 +223,9 @@ void pdfsmooth(int *indexliste) {
} }
/* 547 */ /* 547 */
void textprocess(int *chainemc, int *mclength, char chaine[], int start, int length, int block) { void textprocess(int *chainemc, int *mclength, char chaine[], int start, int length) {
int j, indexlistet, curtable, listet[2][5000], chainet[5000], wnet; int j, indexlistet, curtable, listet[2][5000], chainet[5000], wnet;
char codeascii;
codeascii = 0;
wnet = 0; wnet = 0;
for (j = 0; j < 1000; j++) { for (j = 0; j < 1000; j++) {
@ -236,7 +233,7 @@ void textprocess(int *chainemc, int *mclength, char chaine[], int start, int len
} }
/* listet will contain the table numbers and the value of each characters */ /* listet will contain the table numbers and the value of each characters */
for (indexlistet = 0; indexlistet < length; indexlistet++) { for (indexlistet = 0; indexlistet < length; indexlistet++) {
codeascii = chaine[start + indexlistet]; char codeascii = chaine[start + indexlistet];
switch (codeascii) { switch (codeascii) {
case '\t': listet[0][indexlistet] = 12; case '\t': listet[0][indexlistet] = 12;
listet[1][indexlistet] = 12; listet[1][indexlistet] = 12;
@ -417,17 +414,8 @@ void textprocess(int *chainemc, int *mclength, char chaine[], int start, int len
} }
/* 671 */ /* 671 */
void byteprocess(int *chainemc, int *mclength, unsigned char chaine[], int start, int length, int block) { void byteprocess(int *chainemc, int *mclength, unsigned char chaine[], int start, int length) {
int debug = 0; int debug = 0;
int len = 0;
unsigned int chunkLen = 0;
#if defined(_MSC_VER) && _MSC_VER == 1200
uint64_t mantisa = 0;
uint64_t total = 0;
#else
uint64_t mantisa = 0ULL;
uint64_t total = 0ULL;
#endif
if (debug) printf("\nEntering byte mode at position %d\n", start); if (debug) printf("\nEntering byte mode at position %d\n", start);
@ -447,19 +435,21 @@ void byteprocess(int *chainemc, int *mclength, unsigned char chaine[], int start
if (debug) printf("901 "); if (debug) printf("901 ");
} }
int len = 0;
while (len < length) { while (len < length) {
chunkLen = length - len; unsigned int chunkLen = length - len;
if (6 <= chunkLen) /* Take groups of 6 */ { if (6 <= chunkLen) /* Take groups of 6 */ {
chunkLen = 6; chunkLen = 6;
len += chunkLen; len += chunkLen;
#if defined(_MSC_VER) && _MSC_VER == 1200 #if defined(_MSC_VER) && _MSC_VER == 1200
total = 0; uint64_t total = 0;
#else #else
total = 0ULL; uint64_t total = 0ULL;
#endif #endif
while (chunkLen--) { while (chunkLen--) {
mantisa = chaine[start++]; uint64_t mantisa = chaine[start++];
#if defined(_MSC_VER) && _MSC_VER == 1200 #if defined(_MSC_VER) && _MSC_VER == 1200
total |= mantisa << (uint64_t) (chunkLen * 8); total |= mantisa << (uint64_t) (chunkLen * 8);
#else #else
@ -490,8 +480,8 @@ void byteprocess(int *chainemc, int *mclength, unsigned char chaine[], int start
} }
/* 712 */ /* 712 */
void numbprocess(int *chainemc, int *mclength, char chaine[], int start, int length, int block) { void numbprocess(int *chainemc, int *mclength, char chaine[], int start, int length) {
int j, loop, longueur, dummy[100], dumlength, diviseur, nombre; int j, loop, dummy[100], diviseur, nombre;
char chainemod[50], chainemult[100], temp; char chainemod[50], chainemult[100], temp;
strcpy(chainemod, ""); strcpy(chainemod, "");
@ -504,9 +494,9 @@ void numbprocess(int *chainemc, int *mclength, char chaine[], int start, int len
j = 0; j = 0;
while (j < length) { while (j < length) {
dumlength = 0; int dumlength = 0;
strcpy(chainemod, ""); strcpy(chainemod, "");
longueur = length - j; int longueur = length - j;
if (longueur > 44) { if (longueur > 44) {
longueur = 44; longueur = 44;
} }
@ -645,13 +635,13 @@ static int pdf417(struct zint_symbol *symbol, unsigned char chaine[], const size
for (i = 0; i < indexliste; i++) { for (i = 0; i < indexliste; i++) {
switch (liste[1][i]) { switch (liste[1][i]) {
case TEX: /* 547 - text mode */ case TEX: /* 547 - text mode */
textprocess(chainemc, &mclength, (char*) chaine, indexchaine, liste[0][i], i); textprocess(chainemc, &mclength, (char*) chaine, indexchaine, liste[0][i]);
break; break;
case BYT: /* 670 - octet stream mode */ case BYT: /* 670 - octet stream mode */
byteprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i], i); byteprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i]);
break; break;
case NUM: /* 712 - numeric mode */ case NUM: /* 712 - numeric mode */
numbprocess(chainemc, &mclength, (char*) chaine, indexchaine, liste[0][i], i); numbprocess(chainemc, &mclength, (char*) chaine, indexchaine, liste[0][i]);
break; break;
} }
indexchaine = indexchaine + liste[0][i]; indexchaine = indexchaine + liste[0][i];
@ -974,13 +964,13 @@ int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], const size_
for (i = 0; i < indexliste; i++) { for (i = 0; i < indexliste; i++) {
switch (liste[1][i]) { switch (liste[1][i]) {
case TEX: /* 547 - text mode */ case TEX: /* 547 - text mode */
textprocess(chainemc, &mclength, (char*) chaine, indexchaine, liste[0][i], i); textprocess(chainemc, &mclength, (char*) chaine, indexchaine, liste[0][i]);
break; break;
case BYT: /* 670 - octet stream mode */ case BYT: /* 670 - octet stream mode */
byteprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i], i); byteprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i]);
break; break;
case NUM: /* 712 - numeric mode */ case NUM: /* 712 - numeric mode */
numbprocess(chainemc, &mclength, (char*) chaine, indexchaine, liste[0][i], i); numbprocess(chainemc, &mclength, (char*) chaine, indexchaine, liste[0][i]);
break; break;
} }
indexchaine = indexchaine + liste[0][i]; indexchaine = indexchaine + liste[0][i];

View File

@ -511,4 +511,4 @@ static const unsigned short int rap_centre[52] = {
0x2DC, 0x2DE 0x2DC, 0x2DE
}; };
void byteprocess(int *chainemc, int *mclength, unsigned char chaine[], int start, int length, int block); void byteprocess(int *chainemc, int *mclength, unsigned char chaine[], int start, int length);

View File

@ -51,7 +51,7 @@ static const char *MSITable[10] = {
/* Not MSI/Plessey but the older Plessey standard */ /* Not MSI/Plessey but the older Plessey standard */
int plessey(struct zint_symbol *symbol, unsigned char source[], const size_t length) { int plessey(struct zint_symbol *symbol, unsigned char source[], const size_t length) {
unsigned int i, check; unsigned int i;
unsigned char *checkptr; unsigned char *checkptr;
static const char grid[9] = {1, 1, 1, 1, 0, 1, 0, 0, 1}; static const char grid[9] = {1, 1, 1, 1, 0, 1, 0, 0, 1};
char dest[1024]; /* 8 + 65 * 8 + 8 * 2 + 9 + 1 ~ 1024 */ char dest[1024]; /* 8 + 65 * 8 + 8 * 2 + 9 + 1 ~ 1024 */
@ -73,7 +73,7 @@ int plessey(struct zint_symbol *symbol, unsigned char source[], const size_t len
/* Data area */ /* Data area */
for (i = 0; i < length; i++) { for (i = 0; i < length; i++) {
check = posn(SSET, source[i]); unsigned int check = posn(SSET, source[i]);
lookup(SSET, PlessTable, source[i], dest); lookup(SSET, PlessTable, source[i], dest);
checkptr[4 * i] = check & 1; checkptr[4 * i] = check & 1;
checkptr[4 * i + 1] = (check >> 1) & 1; checkptr[4 * i + 1] = (check >> 1) & 1;
@ -85,10 +85,11 @@ int plessey(struct zint_symbol *symbol, unsigned char source[], const size_t len
used in GNU Barcode */ used in GNU Barcode */
for (i = 0; i < (4 * length); i++) { for (i = 0; i < (4 * length); i++) {
int j; if (checkptr[i]) {
if (checkptr[i]) int j;
for (j = 0; j < 9; j++) for (j = 0; j < 9; j++)
checkptr[i + j] ^= grid[j]; checkptr[i + j] ^= grid[j];
}
} }
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
@ -171,7 +172,7 @@ int msi_plessey_mod10(struct zint_symbol *symbol, unsigned char source[], int le
dau = strtoul(un, NULL, 10); dau = strtoul(un, NULL, 10);
dau *= 2; dau *= 2;
sprintf(tri, "%ld", dau); sprintf(tri, "%lu", dau);
pedwar = 0; pedwar = 0;
h = strlen(tri); h = strlen(tri);
@ -240,7 +241,7 @@ int msi_plessey_mod1010(struct zint_symbol *symbol, unsigned char source[], cons
dau = strtoul(un, NULL, 10); dau = strtoul(un, NULL, 10);
dau *= 2; dau *= 2;
sprintf(tri, "%ld", dau); sprintf(tri, "%lu", dau);
pedwar = 0; pedwar = 0;
h = strlen(tri); h = strlen(tri);
@ -270,7 +271,7 @@ int msi_plessey_mod1010(struct zint_symbol *symbol, unsigned char source[], cons
dau = strtoul(un, NULL, 10); dau = strtoul(un, NULL, 10);
dau *= 2; dau *= 2;
sprintf(tri, "%ld", dau); sprintf(tri, "%lu", dau);
pedwar = 0; pedwar = 0;
h = strlen(tri); h = strlen(tri);
@ -428,7 +429,7 @@ int msi_plessey_mod1110(struct zint_symbol *symbol, unsigned char source[], cons
dau = strtoul(un, NULL, 10); dau = strtoul(un, NULL, 10);
dau *= 2; dau *= 2;
sprintf(tri, "%ld", dau); sprintf(tri, "%lu", dau);
pedwar = 0; pedwar = 0;
h = strlen(tri); h = strlen(tri);

View File

@ -76,7 +76,6 @@ int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
struct mainprog_info_type *graphic; struct mainprog_info_type *graphic;
png_structp png_ptr; png_structp png_ptr;
png_infop info_ptr; png_infop info_ptr;
unsigned char *image_data;
int i, row, column; int i, row, column;
int fgred, fggrn, fgblu, bgred, bggrn, bgblu; int fgred, fggrn, fgblu, bgred, bggrn, bgblu;
@ -172,7 +171,7 @@ int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
} }
} }
/* write row contents to file */ /* write row contents to file */
image_data = outdata; unsigned char *image_data = outdata;
png_write_row(png_ptr, image_data); png_write_row(png_ptr, image_data);
} }

View File

@ -40,8 +40,8 @@
#define SSET "0123456789ABCDEF" #define SSET "0123456789ABCDEF"
int ps_plot(struct zint_symbol *symbol) { int ps_plot(struct zint_symbol *symbol) {
int i, block_width, latch, r, this_row; int i, block_width, latch, r;
float textpos, large_bar_height, preset_height, row_height, row_posn; float textpos, large_bar_height, preset_height, row_height;
FILE *feps; FILE *feps;
int fgred, fggrn, fgblu, bgred, bggrn, bgblu; int fgred, fggrn, fgblu, bgred, bggrn, bgblu;
float red_ink, green_ink, blue_ink, red_paper, green_paper, blue_paper; float red_ink, green_ink, blue_ink, red_paper, green_paper, blue_paper;
@ -383,7 +383,7 @@ int ps_plot(struct zint_symbol *symbol) {
ey = my - 0.5 + yoffset; ey = my - 0.5 + yoffset;
fy = my + 0.5 + yoffset; fy = my + 0.5 + yoffset;
mx = 2.46 * i + 1.23 + (r & 1 ? 1.23 : 0); mx = 2.46 * i + 1.23 + ((r & 1) ? 1.23 : 0);
ax = mx + xoffset; ax = mx + xoffset;
bx = mx + 0.86 + xoffset; bx = mx + 0.86 + xoffset;
@ -404,13 +404,13 @@ int ps_plot(struct zint_symbol *symbol) {
int addon_latch = 0; int addon_latch = 0;
for (r = 0; r < symbol->rows; r++) { for (r = 0; r < symbol->rows; r++) {
this_row = symbol->rows - r - 1; /* invert r otherwise plots upside down */ int this_row = symbol->rows - r - 1; /* invert r otherwise plots upside down */
if (symbol->row_height[this_row] == 0) { if (symbol->row_height[this_row] == 0) {
row_height = large_bar_height; row_height = large_bar_height;
} else { } else {
row_height = symbol->row_height[this_row]; row_height = symbol->row_height[this_row];
} }
row_posn = 0; float row_posn = 0;
for (i = 0; i < r; i++) { for (i = 0; i < r; i++) {
if (symbol->row_height[symbol->rows - i - 1] == 0) { if (symbol->row_height[symbol->rows - i - 1] == 0) {
row_posn += large_bar_height; row_posn += large_bar_height;

View File

@ -149,8 +149,8 @@ static int tribus(const int version,const int a,const int b,const int c) {
/* Convert input data to a binary stream and add padding */ /* Convert input data to a binary stream and add padding */
static void qr_binary(int datastream[], const int version, const int target_binlen, const char mode[], const int jisdata[], const size_t length, const int gs1, const int eci, const int est_binlen,const int debug) { static void qr_binary(int datastream[], const int version, const int target_binlen, const char mode[], const int jisdata[], const size_t length, const int gs1, const int eci, const int est_binlen,const int debug) {
int position = 0; int position = 0;
int short_data_block_length, i; int i;
char data_block, padbits; char padbits;
int current_binlen, current_bytes; int current_binlen, current_bytes;
int toggle, percent; int toggle, percent;
@ -186,8 +186,8 @@ static void qr_binary(int datastream[], const int version, const int target_binl
percent = 0; percent = 0;
do { do {
data_block = mode[position]; char data_block = mode[position];
short_data_block_length = 0; int short_data_block_length = 0;
do { do {
short_data_block_length++; short_data_block_length++;
} while (((short_data_block_length + position) < length) } while (((short_data_block_length + position) < length)
@ -370,19 +370,19 @@ static void qr_binary(int datastream[], const int version, const int target_binl
i = 0; i = 0;
while (i < short_data_block_length) { while (i < short_data_block_length) {
int count; int count;
int first = 0, second = 0, third = 0, prod; int first = 0, prod;
first = posn(NEON, (char) jisdata[position + i]); first = posn(NEON, (char) jisdata[position + i]);
count = 1; count = 1;
prod = first; prod = first;
if (i + 1 < short_data_block_length && mode[position + i + 1] == 'N') { if (i + 1 < short_data_block_length && mode[position + i + 1] == 'N') {
second = posn(NEON, (char) jisdata[position + i + 1]); int second = posn(NEON, (char) jisdata[position + i + 1]);
count = 2; count = 2;
prod = (prod * 10) + second; prod = (prod * 10) + second;
if (i + 2 < short_data_block_length && mode[position + i + 2] == 'N') { if (i + 2 < short_data_block_length && mode[position + i + 2] == 'N') {
third = posn(NEON, (char) jisdata[position + i + 2]); int third = posn(NEON, (char) jisdata[position + i + 2]);
count = 3; count = 3;
prod = (prod * 10) + third; prod = (prod * 10) + third;
} }
@ -579,7 +579,6 @@ static void place_align(unsigned char grid[],const int size,int x,int y) {
static void setup_grid(unsigned char* grid,const int size,const int version) { static void setup_grid(unsigned char* grid,const int size,const int version) {
int i, toggle = 1; int i, toggle = 1;
int loopsize, x, y, xcoord, ycoord;
/* Add timing patterns */ /* Add timing patterns */
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
@ -616,11 +615,12 @@ static void setup_grid(unsigned char* grid,const int size,const int version) {
if (version != 1) { if (version != 1) {
/* Version 1 does not have alignment patterns */ /* Version 1 does not have alignment patterns */
loopsize = qr_align_loopsize[version - 1]; int loopsize = qr_align_loopsize[version - 1];
int x, y;
for (x = 0; x < loopsize; x++) { for (x = 0; x < loopsize; x++) {
for (y = 0; y < loopsize; y++) { for (y = 0; y < loopsize; y++) {
xcoord = qr_table_e1[((version - 2) * 7) + x]; int xcoord = qr_table_e1[((version - 2) * 7) + x];
ycoord = qr_table_e1[((version - 2) * 7) + y]; int ycoord = qr_table_e1[((version - 2) * 7) + y];
if (!(grid[(ycoord * size) + xcoord] & 0x10)) { if (!(grid[(ycoord * size) + xcoord] & 0x10)) {
place_align(grid, size, xcoord, ycoord); place_align(grid, size, xcoord, ycoord);
@ -666,13 +666,13 @@ static void populate_grid(unsigned char* grid,const int size,const int* datastre
int direction = 1; /* up */ int direction = 1; /* up */
int row = 0; /* right hand side */ int row = 0; /* right hand side */
int i, n, x, y; int i, n, y;
n = cw * 8; n = cw * 8;
y = size - 1; y = size - 1;
i = 0; i = 0;
do { do {
x = (size - 2) - (row * 2); int x = (size - 2) - (row * 2);
if (x < 6) if (x < 6)
x--; /* skip over vertical timing pattern */ x--; /* skip over vertical timing pattern */
@ -1005,24 +1005,24 @@ static void add_format_info_eval(unsigned char *eval,const int size,const int ec
seq = qr_annex_c[format]; seq = qr_annex_c[format];
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
eval[(i * size) + 8] = (seq >> i) & 0x01 ? (0x01 >> pattern) : 0x00; eval[(i * size) + 8] = ((seq >> i) & 0x01) ? (0x01 >> pattern) : 0x00;
} }
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
eval[(8 * size) + (size - i - 1)] = (seq >> i) & 0x01 ? (0x01 >> pattern) : 0x00; eval[(8 * size) + (size - i - 1)] = ((seq >> i) & 0x01) ? (0x01 >> pattern) : 0x00;
} }
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
eval[(8 * size) + (5 - i)] = (seq >> (i + 9)) & 0x01 ? (0x01 >> pattern) : 0x00; eval[(8 * size) + (5 - i)] = ((seq >> (i + 9)) & 0x01) ? (0x01 >> pattern) : 0x00;
} }
for (i = 0; i < 7; i++) { for (i = 0; i < 7; i++) {
eval[(((size - 7) + i) * size) + 8] = (seq >> (i + 8)) & 0x01 ? (0x01 >> pattern) : 0x00; eval[(((size - 7) + i) * size) + 8] = ((seq >> (i + 8)) & 0x01) ? (0x01 >> pattern) : 0x00;
} }
eval[(7 * size) + 8] = (seq >> 6) & 0x01 ? (0x01 >> pattern) : 0x00; eval[(7 * size) + 8] = ((seq >> 6) & 0x01) ? (0x01 >> pattern) : 0x00;
eval[(8 * size) + 8] = (seq >> 7) & 0x01 ? (0x01 >> pattern) : 0x00; eval[(8 * size) + 8] = ((seq >> 7) & 0x01) ? (0x01 >> pattern) : 0x00;
eval[(8 * size) + 7] = (seq >> 8) & 0x01 ? (0x01 >> pattern) : 0x00; eval[(8 * size) + 7] = ((seq >> 8) & 0x01) ? (0x01 >> pattern) : 0x00;
} }
static int apply_bitmask(unsigned char *grid,const int size,const int ecc_level) { static int apply_bitmask(unsigned char *grid,const int size,const int ecc_level) {
@ -1388,7 +1388,6 @@ static int getBinaryLength(const int version,char inputMode[],const int inputDat
int qr_code(struct zint_symbol *symbol, const unsigned char source[], size_t length) { int qr_code(struct zint_symbol *symbol, const unsigned char source[], size_t length) {
int i, j, est_binlen; int i, j, est_binlen;
int error_number,glyph;
int ecc_level, autosize, version, max_cw, target_binlen, blocks, size; int ecc_level, autosize, version, max_cw, target_binlen, blocks, size;
int bitmask, gs1; int bitmask, gs1;
int canShrink; int canShrink;
@ -1414,7 +1413,7 @@ int qr_code(struct zint_symbol *symbol, const unsigned char source[], size_t len
} }
} else { } else {
/* Convert Unicode input to Shift-JIS */ /* Convert Unicode input to Shift-JIS */
error_number = utf8toutf16(symbol, source, utfdata, &length); int error_number = utf8toutf16(symbol, source, utfdata, &length);
if (error_number != 0) { if (error_number != 0) {
return error_number; return error_number;
} }
@ -1424,7 +1423,7 @@ int qr_code(struct zint_symbol *symbol, const unsigned char source[], size_t len
jisdata[i] = utfdata[i]; jisdata[i] = utfdata[i];
} else { } else {
j = 0; j = 0;
glyph = 0; int glyph = 0;
do { do {
if (sjis_lookup[j * 2] == utfdata[i]) { if (sjis_lookup[j * 2] == utfdata[i]) {
glyph = sjis_lookup[(j * 2) + 1]; glyph = sjis_lookup[(j * 2) + 1];
@ -1636,8 +1635,7 @@ static int micro_qr_intermediate(char binary[], const int jisdata[], const char
/* Convert input data to an "intermediate stage" where data is binary encoded but /* Convert input data to an "intermediate stage" where data is binary encoded but
control information is not */ control information is not */
int position = 0; int position = 0;
int short_data_block_length, i; int i;
char data_block;
char buffer[2]; char buffer[2];
strcpy(binary, ""); strcpy(binary, "");
@ -1654,8 +1652,8 @@ static int micro_qr_intermediate(char binary[], const int jisdata[], const char
return ZINT_ERROR_TOO_LONG; return ZINT_ERROR_TOO_LONG;
} }
data_block = mode[position]; char data_block = mode[position];
short_data_block_length = 0; int short_data_block_length = 0;
do { do {
short_data_block_length++; short_data_block_length++;
} while (((short_data_block_length + position) < length) && (mode[position + short_data_block_length] == data_block)); } while (((short_data_block_length + position) < length) && (mode[position + short_data_block_length] == data_block));
@ -1759,14 +1757,14 @@ static int micro_qr_intermediate(char binary[], const int jisdata[], const char
i = 0; i = 0;
while (i < short_data_block_length) { while (i < short_data_block_length) {
int count; int count;
int first = 0, second = 0, prod; int first = 0, prod;
first = posn(RHODIUM, (char) jisdata[position + i]); first = posn(RHODIUM, (char) jisdata[position + i]);
count = 1; count = 1;
prod = first; prod = first;
if (i + 1 < short_data_block_length && mode[position + i + 1] == 'A') { if (i + 1 < short_data_block_length && mode[position + i + 1] == 'A') {
second = posn(RHODIUM, (char) jisdata[position + i + 1]); int second = posn(RHODIUM, (char) jisdata[position + i + 1]);
count = 2; count = 2;
prod = (first * 45) + second; prod = (first * 45) + second;
} }
@ -1807,20 +1805,20 @@ static int micro_qr_intermediate(char binary[], const int jisdata[], const char
i = 0; i = 0;
while (i < short_data_block_length) { while (i < short_data_block_length) {
int count; int count;
int first = 0, second = 0, third = 0, prod; int first = 0, prod;
first = posn(NEON, (char) jisdata[position + i]); first = posn(NEON, (char) jisdata[position + i]);
count = 1; count = 1;
prod = first; prod = first;
if (i + 1 < short_data_block_length && mode[position + i + 1] == 'N') { if (i + 1 < short_data_block_length && mode[position + i + 1] == 'N') {
second = posn(NEON, (char) jisdata[position + i + 1]); int second = posn(NEON, (char) jisdata[position + i + 1]);
count = 2; count = 2;
prod = (prod * 10) + second; prod = (prod * 10) + second;
} }
if (i + 2 < short_data_block_length && mode[position + i + 2] == 'N') { if (i + 2 < short_data_block_length && mode[position + i + 2] == 'N') {
third = posn(NEON, (char) jisdata[position + i + 2]); int third = posn(NEON, (char) jisdata[position + i + 2]);
count = 3; count = 3;
prod = (prod * 10) + third; prod = (prod * 10) + third;
} }
@ -1985,7 +1983,7 @@ static void microqr_expand_binary(const char binary_stream[], char full_stream[]
static void micro_qr_m1(char binary_data[]) { static void micro_qr_m1(char binary_data[]) {
int i, j, latch; int i, j, latch;
int bits_total, bits_left, remainder; int bits_total, bits_left;
int data_codewords, ecc_codewords; int data_codewords, ecc_codewords;
unsigned char data_blocks[4], ecc_blocks[3]; unsigned char data_blocks[4], ecc_blocks[3];
@ -2016,7 +2014,7 @@ static void micro_qr_m1(char binary_data[]) {
if (latch == 0) { if (latch == 0) {
/* Complete current byte */ /* Complete current byte */
remainder = 8 - (strlen(binary_data) % 8); int remainder = 8 - (strlen(binary_data) % 8);
if (remainder == 8) { if (remainder == 8) {
remainder = 0; remainder = 0;
} }
@ -2029,7 +2027,7 @@ static void micro_qr_m1(char binary_data[]) {
if (bits_left > 4) { if (bits_left > 4) {
remainder = (bits_left - 4) / 8; remainder = (bits_left - 4) / 8;
for (i = 0; i < remainder; i++) { for (i = 0; i < remainder; i++) {
strcat(binary_data, i & 1 ? "00010001" : "11101100"); strcat(binary_data, (i & 1) ? "00010001" : "11101100");
} }
} }
bin_append(0, 4, binary_data); bin_append(0, 4, binary_data);
@ -2068,7 +2066,7 @@ static void micro_qr_m1(char binary_data[]) {
static void micro_qr_m2(char binary_data[],const int ecc_mode) { static void micro_qr_m2(char binary_data[],const int ecc_mode) {
int i, j, latch; int i, j, latch;
int bits_total=0, bits_left, remainder; int bits_total=0, bits_left;
int data_codewords=0, ecc_codewords=0; int data_codewords=0, ecc_codewords=0;
unsigned char data_blocks[6], ecc_blocks[7]; unsigned char data_blocks[6], ecc_blocks[7];
@ -2095,7 +2093,7 @@ static void micro_qr_m2(char binary_data[],const int ecc_mode) {
if (latch == 0) { if (latch == 0) {
/* Complete current byte */ /* Complete current byte */
remainder = 8 - (strlen(binary_data) % 8); int remainder = 8 - (strlen(binary_data) % 8);
if (remainder == 8) { if (remainder == 8) {
remainder = 0; remainder = 0;
} }
@ -2107,7 +2105,7 @@ static void micro_qr_m2(char binary_data[],const int ecc_mode) {
bits_left = bits_total - (int)strlen(binary_data); bits_left = bits_total - (int)strlen(binary_data);
remainder = bits_left / 8; remainder = bits_left / 8;
for (i = 0; i < remainder; i++) { for (i = 0; i < remainder; i++) {
strcat(binary_data, i & 1 ? "00010001" : "11101100"); strcat(binary_data, (i & 1) ? "00010001" : "11101100");
} }
} }
@ -2148,7 +2146,7 @@ static void micro_qr_m2(char binary_data[],const int ecc_mode) {
static void micro_qr_m3(char binary_data[],const int ecc_mode) { static void micro_qr_m3(char binary_data[],const int ecc_mode) {
int i, j, latch; int i, j, latch;
int bits_total=0, bits_left, remainder; int bits_total=0, bits_left;
int data_codewords=0, ecc_codewords=0; int data_codewords=0, ecc_codewords=0;
unsigned char data_blocks[12], ecc_blocks[9]; unsigned char data_blocks[12], ecc_blocks[9];
@ -2186,7 +2184,7 @@ static void micro_qr_m3(char binary_data[],const int ecc_mode) {
if (latch == 0) { if (latch == 0) {
/* Complete current byte */ /* Complete current byte */
remainder = 8 - (strlen(binary_data) % 8); int remainder = 8 - (strlen(binary_data) % 8);
if (remainder == 8) { if (remainder == 8) {
remainder = 0; remainder = 0;
} }
@ -2199,7 +2197,7 @@ static void micro_qr_m3(char binary_data[],const int ecc_mode) {
if (bits_left > 4) { if (bits_left > 4) {
remainder = (bits_left - 4) / 8; remainder = (bits_left - 4) / 8;
for (i = 0; i < remainder; i++) { for (i = 0; i < remainder; i++) {
strcat(binary_data, i & 1 ? "00010001" : "11101100"); strcat(binary_data, (i & 1) ? "00010001" : "11101100");
} }
} }
bin_append(0, 4, binary_data); bin_append(0, 4, binary_data);
@ -2260,7 +2258,7 @@ static void micro_qr_m3(char binary_data[],const int ecc_mode) {
static void micro_qr_m4(char binary_data[],const int ecc_mode) { static void micro_qr_m4(char binary_data[],const int ecc_mode) {
int i, j, latch; int i, j, latch;
int bits_total=0, bits_left, remainder; int bits_total=0, bits_left;
int data_codewords=0, ecc_codewords=0; int data_codewords=0, ecc_codewords=0;
unsigned char data_blocks[17], ecc_blocks[15]; unsigned char data_blocks[17], ecc_blocks[15];
@ -2290,7 +2288,7 @@ static void micro_qr_m4(char binary_data[],const int ecc_mode) {
if (latch == 0) { if (latch == 0) {
/* Complete current byte */ /* Complete current byte */
remainder = 8 - (strlen(binary_data) % 8); int remainder = 8 - (strlen(binary_data) % 8);
if (remainder == 8) { if (remainder == 8) {
remainder = 0; remainder = 0;
} }
@ -2302,7 +2300,7 @@ static void micro_qr_m4(char binary_data[],const int ecc_mode) {
bits_left = bits_total - (int)strlen(binary_data); bits_left = bits_total - (int)strlen(binary_data);
remainder = bits_left / 8; remainder = bits_left / 8;
for (i = 0; i < remainder; i++) { for (i = 0; i < remainder; i++) {
strcat(binary_data, i & 1 ? "00010001" : "11101100"); strcat(binary_data, (i & 1) ? "00010001" : "11101100");
} }
} }
@ -2382,13 +2380,13 @@ static void micro_populate_grid(unsigned char* grid,const int size,const char fu
int direction = 1; /* up */ int direction = 1; /* up */
int row = 0; /* right hand side */ int row = 0; /* right hand side */
size_t n; size_t n;
int i,x, y; int i, y;
n = strlen(full_stream); n = strlen(full_stream);
y = size - 1; y = size - 1;
i = 0; i = 0;
do { do {
x = (size - 2) - (row * 2); int x = (size - 2) - (row * 2);
if (!(grid[(y * size) + (x + 1)] & 0xf0)) { if (!(grid[(y * size) + (x + 1)] & 0xf0)) {
if (full_stream[i] == '1') { if (full_stream[i] == '1') {
@ -2548,10 +2546,10 @@ static int micro_apply_bitmask(unsigned char *grid,const int size) {
int microqr(struct zint_symbol *symbol, const unsigned char source[], size_t length) { int microqr(struct zint_symbol *symbol, const unsigned char source[], size_t length) {
size_t i; size_t i;
int j,size; int j, size;
char binary_stream[200]; char binary_stream[200];
char full_stream[200]; char full_stream[200];
int utfdata[40],glyph; int utfdata[40];
int jisdata[40]; int jisdata[40];
char mode[40]; char mode[40];
@ -2589,7 +2587,7 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], size_t len
jisdata[i] = utfdata[i]; jisdata[i] = utfdata[i];
} else { } else {
j = 0; j = 0;
glyph = 0; int glyph = 0;
do { do {
if (sjis_lookup[j * 2] == utfdata[i]) { if (sjis_lookup[j * 2] == utfdata[i]) {
glyph = sjis_lookup[(j * 2) + 1]; glyph = sjis_lookup[(j * 2) + 1];

View File

@ -264,7 +264,7 @@ void draw_hexagon(char *pixelbuf, int image_width, char *scaled_hexagon, int hex
void draw_letter(char *pixelbuf, unsigned char letter, int xposn, int yposn, int textflags, int image_width, int image_height) { void draw_letter(char *pixelbuf, unsigned char letter, int xposn, int yposn, int textflags, int image_width, int image_height) {
/* Put a letter into a position */ /* Put a letter into a position */
int skip, x, y, glyph_no, max_x, max_y; int skip;
skip = 0; skip = 0;
@ -281,14 +281,17 @@ void draw_letter(char *pixelbuf, unsigned char letter, int xposn, int yposn, int
} }
if (skip == 0) { if (skip == 0) {
int glyph_no;
if (letter > 128) { if (letter > 128) {
glyph_no = letter - 66; glyph_no = letter - 66;
} else { } else {
glyph_no = letter - 33; glyph_no = letter - 33;
} }
int x, y;
switch (textflags) { switch (textflags) {
int max_x, max_y;
case 1: // small font 5x9 case 1: // small font 5x9
max_x = 5; max_x = 5;
max_y = 9; max_y = 9;
@ -407,14 +410,13 @@ void plot_hexline(char *scaled_hexagon, int hexagon_size, float start_x, float s
/* Draw a straight line from start to end */ /* Draw a straight line from start to end */
int i; int i;
float inc_x, inc_y; float inc_x, inc_y;
float this_x, this_y;
inc_x = (end_x - start_x) / hexagon_size; inc_x = (end_x - start_x) / hexagon_size;
inc_y = (end_y - start_y) / hexagon_size; inc_y = (end_y - start_y) / hexagon_size;
for (i = 0; i < hexagon_size; i++) { for (i = 0; i < hexagon_size; i++) {
this_x = start_x + ((float)i * inc_x); float this_x = start_x + ((float)i * inc_x);
this_y = start_y + ((float)i * inc_y); float this_y = start_y + ((float)i * inc_y);
if (((this_x >= 0) && (this_x < hexagon_size)) && ((this_y >= 0) && (this_y < hexagon_size))) { if (((this_x >= 0) && (this_x < hexagon_size)) && ((this_y >= 0) && (this_y < hexagon_size))) {
scaled_hexagon[(hexagon_size * (int)this_y) + (int)this_x] = '1'; scaled_hexagon[(hexagon_size * (int)this_y) + (int)this_x] = '1';
} }
@ -424,7 +426,6 @@ void plot_hexline(char *scaled_hexagon, int hexagon_size, float start_x, float s
void plot_hexagon(char *scaled_hexagon, int hexagon_size) { void plot_hexagon(char *scaled_hexagon, int hexagon_size) {
/* Create a hexagon shape and fill it */ /* Create a hexagon shape and fill it */
int line, i; int line, i;
char ink;
float x_offset[6]; float x_offset[6];
float y_offset[6]; float y_offset[6];
@ -461,7 +462,7 @@ void plot_hexagon(char *scaled_hexagon, int hexagon_size) {
/* Fill hexagon */ /* Fill hexagon */
for (line = 0; line < hexagon_size; line++) { for (line = 0; line < hexagon_size; line++) {
ink = '0'; char ink = '0';
for (i = 0; i < hexagon_size; i++) { for (i = 0; i < hexagon_size; i++) {
if (scaled_hexagon[(hexagon_size * line) + i] == '1') { if (scaled_hexagon[(hexagon_size * line) + i] == '1') {
if (i < (hexagon_size / 2)) { if (i < (hexagon_size / 2)) {
@ -480,7 +481,7 @@ void plot_hexagon(char *scaled_hexagon, int hexagon_size) {
int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, int data_type) { int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, int data_type) {
/* Plot a MaxiCode symbol with hexagons and bullseye */ /* Plot a MaxiCode symbol with hexagons and bullseye */
int i, row, column, xposn, yposn; int i, row, column, xposn;
int image_height, image_width; int image_height, image_width;
char *pixelbuf; char *pixelbuf;
int error_number; int error_number;
@ -521,7 +522,7 @@ int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, int data_
draw_bullseye(pixelbuf, image_width, image_height, (2 * xoffset), (2 * yoffset), scaler * 10); draw_bullseye(pixelbuf, image_width, image_height, (2 * xoffset), (2 * yoffset), scaler * 10);
for (row = 0; row < symbol->rows; row++) { for (row = 0; row < symbol->rows; row++) {
yposn = row * 9; int yposn = row * 9;
for (column = 0; column < symbol->width; column++) { for (column = 0; column < symbol->width; column++) {
xposn = column * 10; xposn = column * 10;
if (module_is_set(symbol, row, column)) { if (module_is_set(symbol, row, column)) {
@ -651,7 +652,7 @@ int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_t
int i, r, textoffset, yoffset, xoffset, latch, image_width, image_height; int i, r, textoffset, yoffset, xoffset, latch, image_width, image_height;
char *pixelbuf; char *pixelbuf;
int addon_latch = 0, textflags = 0; int addon_latch = 0, textflags = 0;
int this_row, block_width, plot_height, plot_yposn, textpos; int block_width, textpos;
float row_height, row_posn; float row_height, row_posn;
int error_number; int error_number;
int default_text_posn; int default_text_posn;
@ -812,16 +813,16 @@ int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_t
/* Plot the body of the symbol to the pixel buffer */ /* Plot the body of the symbol to the pixel buffer */
for (r = 0; r < symbol->rows; r++) { for (r = 0; r < symbol->rows; r++) {
this_row = symbol->rows - r - 1; /* invert r otherwise plots upside down */ int this_row = symbol->rows - r - 1; /* invert r otherwise plots upside down */
row_posn += row_height; row_posn += row_height;
plot_yposn = next_yposn; int plot_yposn = next_yposn;
if (symbol->row_height[this_row] == 0) { if (symbol->row_height[this_row] == 0) {
row_height = large_bar_height; row_height = large_bar_height;
} else { } else {
row_height = symbol->row_height[this_row]; row_height = symbol->row_height[this_row];
} }
next_yposn = (int) (row_posn + row_height); next_yposn = (int) (row_posn + row_height);
plot_height = next_yposn - plot_yposn; int plot_height = next_yposn - plot_yposn;
i = 0; i = 0;
if (module_is_set(symbol, this_row, 0)) { if (module_is_set(symbol, this_row, 0)) {

View File

@ -117,11 +117,11 @@ void rs_init_code(const int nsym, int index) {
} }
void rs_encode(const size_t len,const unsigned char *data, unsigned char *res) { void rs_encode(const size_t len,const unsigned char *data, unsigned char *res) {
int i, k, m; int i, k;
for (i = 0; i < rlen; i++) for (i = 0; i < rlen; i++)
res[i] = 0; res[i] = 0;
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
m = res[rlen - 1] ^ data[i]; int m = res[rlen - 1] ^ data[i];
for (k = rlen - 1; k > 0; k--) { for (k = rlen - 1; k > 0; k--) {
if (m && rspoly[k]) if (m && rspoly[k])
res[k] = (unsigned char) (res[k - 1] ^ alog[(logt[m] + logt[rspoly[k]]) % logmod]); res[k] = (unsigned char) (res[k - 1] ^ alog[(logt[m] + logt[rspoly[k]]) % logmod]);
@ -137,11 +137,11 @@ void rs_encode(const size_t len,const unsigned char *data, unsigned char *res) {
/* The same as above but for larger bitlengths - Aztec code compatible */ /* The same as above but for larger bitlengths - Aztec code compatible */
void rs_encode_long(const int len, const unsigned int *data, unsigned int *res) { void rs_encode_long(const int len, const unsigned int *data, unsigned int *res) {
int i, k, m; int i, k;
for (i = 0; i < rlen; i++) for (i = 0; i < rlen; i++)
res[i] = 0; res[i] = 0;
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
m = res[rlen - 1] ^ data[i]; int m = res[rlen - 1] ^ data[i];
for (k = rlen - 1; k > 0; k--) { for (k = rlen - 1; k > 0; k--) {
if (m && rspoly[k]) if (m && rspoly[k])
res[k] = res[k - 1] ^ alog[(logt[m] + logt[rspoly[k]]) % logmod]; res[k] = res[k - 1] ^ alog[(logt[m] + logt[rspoly[k]]) % logmod];

View File

@ -52,7 +52,7 @@ int render_plot_add_line(struct zint_symbol *symbol, struct zint_render_line *li
struct zint_render_ring *render_plot_create_ring(float x, float y, float radius, float line_width); struct zint_render_ring *render_plot_create_ring(float x, float y, float radius, float line_width);
int render_plot_add_ring(struct zint_symbol *symbol, struct zint_render_ring *ring, struct zint_render_ring **last_ring); int render_plot_add_ring(struct zint_symbol *symbol, struct zint_render_ring *ring, struct zint_render_ring **last_ring);
struct zint_render_hexagon *render_plot_create_hexagon(float x, float y); struct zint_render_hexagon *render_plot_create_hexagon(float x, float y);
int render_plot_add_hexagon(struct zint_symbol *symbol, struct zint_render_hexagon *ring, struct zint_render_hexagon **last_hexagon); int render_plot_add_hexagon(struct zint_symbol *symbol, struct zint_render_hexagon *hexagon, struct zint_render_hexagon **last_hexagon);
int render_plot_add_string(struct zint_symbol *symbol, unsigned char *text, float x, float y, float fsize, float width, struct zint_render_string **last_string); int render_plot_add_string(struct zint_symbol *symbol, unsigned char *text, float x, float y, float fsize, float width, struct zint_render_string **last_string);
@ -60,21 +60,20 @@ int render_plot(struct zint_symbol *symbol, const float width, const float heigh
struct zint_render *render; struct zint_render *render;
struct zint_render_line *line, *last_line = NULL; struct zint_render_line *line, *last_line = NULL;
struct zint_render_string *last_string = NULL; struct zint_render_string *last_string = NULL;
struct zint_render_ring *ring, *last_ring = NULL; struct zint_render_ring *last_ring = NULL;
struct zint_render_hexagon *hexagon, *last_hexagon = NULL; struct zint_render_hexagon *last_hexagon = NULL;
int i, r, block_width, latch, this_row; int i, r, latch;
float textpos, textwidth, large_bar_height, preset_height, row_height, row_posn = 0.0; float textpos, large_bar_height, preset_height, row_height, row_posn = 0.0;
// int error_number = 0; // int error_number = 0;
int text_offset, text_height, xoffset, yoffset, textdone, main_symbol_width_x, addon_width_x; int text_offset, text_height, xoffset, yoffset, textdone, main_symbol_width_x, addon_width_x;
char addon[6], textpart[10]; char addon[6];
int large_bar_count, symbol_lead_in, total_symbol_width_x, total_area_width_x; int large_bar_count, symbol_lead_in, total_symbol_width_x, total_area_width_x;
float addon_text_posn; float addon_text_posn;
float default_text_posn; float default_text_posn;
float scaler; float scaler;
const char *locale = NULL; const char *locale = NULL;
int hide_text = 0; int hide_text = 0;
float required_aspect;
float symbol_aspect = 1; float symbol_aspect = 1;
float x_dimension; float x_dimension;
int upceanflag = 0; int upceanflag = 0;
@ -225,7 +224,7 @@ int render_plot(struct zint_symbol *symbol, const float width, const float heigh
} }
if (large_bar_count == 0) { if (large_bar_count == 0) {
required_aspect = width / height; float required_aspect = width / height;
symbol_aspect = (total_symbol_width_x + (2 * xoffset)) / (preset_height + (2 * yoffset) + text_offset + text_height); symbol_aspect = (total_symbol_width_x + (2 * xoffset)) / (preset_height + (2 * yoffset) + text_offset + text_height);
symbol->height = (int) preset_height; symbol->height = (int) preset_height;
if (required_aspect > symbol_aspect) { if (required_aspect > symbol_aspect) {
@ -337,6 +336,7 @@ int render_plot(struct zint_symbol *symbol, const float width, const float heigh
render->height = 26.86 * scaler; render->height = 26.86 * scaler;
/* Central bullseye pattern */ /* Central bullseye pattern */
struct zint_render_ring *ring;
ring = render_plot_create_ring(13.64 * scaler, 13.43 * scaler, 0.85 * scaler, 0.67 * scaler); ring = render_plot_create_ring(13.64 * scaler, 13.43 * scaler, 0.85 * scaler, 0.67 * scaler);
render_plot_add_ring(symbol, ring, &last_ring); render_plot_add_ring(symbol, ring, &last_ring);
ring = render_plot_create_ring(13.64 * scaler, 13.43 * scaler, 2.20 * scaler, 0.67 * scaler); ring = render_plot_create_ring(13.64 * scaler, 13.43 * scaler, 2.20 * scaler, 0.67 * scaler);
@ -348,7 +348,7 @@ int render_plot(struct zint_symbol *symbol, const float width, const float heigh
for (r = 0; r < symbol->rows; r++) { for (r = 0; r < symbol->rows; r++) {
for (i = 0; i < symbol->width; i++) { for (i = 0; i < symbol->width; i++) {
if (module_is_set(symbol, r, i)) { if (module_is_set(symbol, r, i)) {
hexagon = render_plot_create_hexagon(((i * 0.88) + (r & 1 ? 1.76 : 1.32)) * scaler, ((r * 0.76) + 0.76) * scaler); struct zint_render_hexagon *hexagon = render_plot_create_hexagon(((i * 0.88) + ((r & 1) ? 1.76 : 1.32)) * scaler, ((r * 0.76) + 0.76) * scaler);
render_plot_add_hexagon(symbol, hexagon, &last_hexagon); render_plot_add_hexagon(symbol, hexagon, &last_hexagon);
} }
} }
@ -360,7 +360,7 @@ int render_plot(struct zint_symbol *symbol, const float width, const float heigh
int addon_latch = 0; int addon_latch = 0;
for (r = 0; r < symbol->rows; r++) { for (r = 0; r < symbol->rows; r++) {
this_row = r; int this_row = r;
if (symbol->row_height[this_row] == 0) { if (symbol->row_height[this_row] == 0) {
row_height = large_bar_height; row_height = large_bar_height;
} else { } else {
@ -384,7 +384,7 @@ int render_plot(struct zint_symbol *symbol, const float width, const float heigh
} }
do { do {
block_width = 0; int block_width = 0;
do { do {
block_width++; block_width++;
} while (module_is_set(symbol, this_row, i + block_width) == module_is_set(symbol, this_row, i)); } while (module_is_set(symbol, this_row, i + block_width) == module_is_set(symbol, this_row, i));
@ -419,6 +419,8 @@ int render_plot(struct zint_symbol *symbol, const float width, const float heigh
row_posn = (row_posn + large_bar_height) * scaler; row_posn = (row_posn + large_bar_height) * scaler;
if (!hide_text) { if (!hide_text) {
char textpart[10];
float textwidth;
if (upceanflag == 8) { if (upceanflag == 8) {
/* guard bar extensions and text formatting for EAN-8 */ /* guard bar extensions and text formatting for EAN-8 */
i = 0; i = 0;

View File

@ -164,8 +164,8 @@ int rss14(struct zint_symbol *symbol, unsigned char source[], int src_len) {
short int accum[112], left_reg[112], right_reg[112], x_reg[112], y_reg[112]; short int accum[112], left_reg[112], right_reg[112], x_reg[112], y_reg[112];
int data_character[4], data_group[4], v_odd[4], v_even[4]; int data_character[4], data_group[4], v_odd[4], v_even[4];
int data_widths[8][4], checksum, c_left, c_right, total_widths[46], writer; int data_widths[8][4], checksum, c_left, c_right, total_widths[46], writer;
char latch, hrt[15], temp[32]; char latch, temp[32];
int check_digit, count, separator_row; int separator_row;
separator_row = 0; separator_row = 0;
@ -486,8 +486,9 @@ int rss14(struct zint_symbol *symbol, unsigned char source[], int src_len) {
} }
symbol->rows = symbol->rows + 1; symbol->rows = symbol->rows + 1;
count = 0; int count = 0;
check_digit = 0; int check_digit = 0;
char hrt[15];
/* Calculate check digit from Annex A and place human readable text */ /* Calculate check digit from Annex A and place human readable text */
ustrcpy(symbol->text, (unsigned char*) "(01)"); ustrcpy(symbol->text, (unsigned char*) "(01)");
@ -1054,10 +1055,10 @@ int rsslimited(struct zint_symbol *symbol, unsigned char source[], int src_len)
/* Attempts to apply encoding rules from secions 7.2.5.5.1 to 7.2.5.5.3 /* Attempts to apply encoding rules from secions 7.2.5.5.1 to 7.2.5.5.3
* of ISO/IEC 24724:2006 */ * of ISO/IEC 24724:2006 */
int general_rules(char field[], char type[]) { int general_rules(char type[]) {
int block[2][200], block_count, i, j, k; int block[2][200], block_count, i, j, k;
char current, next, last; char current;
block_count = 0; block_count = 0;
@ -1066,7 +1067,7 @@ int general_rules(char field[], char type[]) {
for (i = 1; i < strlen(type); i++) { for (i = 1; i < strlen(type); i++) {
current = type[i]; current = type[i];
last = type[i - 1]; char last = type[i - 1];
if (current == last) { if (current == last) {
block[0][block_count] = block[0][block_count] + 1; block[0][block_count] = block[0][block_count] + 1;
@ -1081,7 +1082,7 @@ int general_rules(char field[], char type[]) {
for (i = 0; i < block_count; i++) { for (i = 0; i < block_count; i++) {
current = block[1][i]; current = block[1][i];
next = (block[1][i + 1] & 0xFF); char next = (block[1][i + 1] & 0xFF);
if ((current == ISOIEC) && (i != (block_count - 1))) { if ((current == ISOIEC) && (i != (block_count - 1))) {
if ((next == ANY_ENC) && (block[0][i + 1] >= 4)) { if ((next == ANY_ENC) && (block[0][i + 1] >= 4)) {
@ -1205,7 +1206,6 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
if (source[18] == '0') { if (source[18] == '0') {
/* (01) and (310x) */ /* (01) and (310x) */
char weight_str[7]; char weight_str[7];
float weight; /* In kilos */
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
weight_str[i] = source[20 + i]; weight_str[i] = source[20 + i];
@ -1219,6 +1219,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
if ((source[19] == '3') && (strlen(source) == 26)) { if ((source[19] == '3') && (strlen(source) == 26)) {
/* (01) and (3103) */ /* (01) and (3103) */
float weight; /* In kilos */
weight = atof(weight_str) / 1000.0; weight = atof(weight_str) / 1000.0;
if (weight <= 32.767) { if (weight <= 32.767) {
@ -1258,7 +1259,6 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
if (source[18] == '0') { if (source[18] == '0') {
/* (01) and (320x) */ /* (01) and (320x) */
char weight_str[7]; char weight_str[7];
float weight; /* In pounds */
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
weight_str[i] = source[20 + i]; weight_str[i] = source[20 + i];
@ -1271,6 +1271,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
if (((source[19] == '2') || (source[19] == '3')) && (strlen(source) == 26)) { if (((source[19] == '2') || (source[19] == '3')) && (strlen(source) == 26)) {
/* (01) and (3202)/(3203) */ /* (01) and (3202)/(3203) */
float weight; /* In pounds */
if (source[19] == '3') { if (source[19] == '3') {
weight = (float) (atof(weight_str) / 1000.0F); weight = (float) (atof(weight_str) / 1000.0F);
@ -1454,7 +1455,6 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
char group[4]; char group[4];
int group_val; int group_val;
char weight_str[8]; char weight_str[8];
char date_str[4];
for (i = 1; i < 5; i++) { for (i = 1; i < 5; i++) {
group[0] = source[(i * 3)]; group[0] = source[(i * 3)];
@ -1476,6 +1476,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
if (strlen(source) == 34) { if (strlen(source) == 34) {
/* Date information is included */ /* Date information is included */
char date_str[4];
date_str[0] = source[28]; date_str[0] = source[28];
date_str[1] = source[29]; date_str[1] = source[29];
date_str[2] = '\0'; date_str[2] = '\0';
@ -1592,7 +1593,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
} }
} }
latch = general_rules(general_field, general_field_type); latch = general_rules(general_field_type);
if (debug) printf("General field type: %s\n", general_field_type); if (debug) printf("General field type: %s\n", general_field_type);
last_mode = NUMERIC; last_mode = NUMERIC;
@ -1863,8 +1864,6 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len)
char substring[21][14], latch; char substring[21][14], latch;
int char_widths[21][8], checksum, check_widths[8], c_group; int char_widths[21][8], checksum, check_widths[8], c_group;
int check_char, c_odd, c_even, elements[235], pattern_width, reader, writer; int check_char, c_odd, c_even, elements[235], pattern_width, reader, writer;
int row, elements_in_sub, special_case_row, left_to_right;
int codeblocks, sub_elements[235], stack_rows, current_row, current_block;
int separator_row; int separator_row;
#ifndef _MSC_VER #ifndef _MSC_VER
char reduced[src_len + 1], binary_string[(7 * src_len) + 1]; char reduced[src_len + 1], binary_string[(7 * src_len) + 1];
@ -1958,7 +1957,7 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len)
elements in the data characters. */ elements in the data characters. */
checksum = 0; checksum = 0;
for (i = 0; i < data_chars; i++) { for (i = 0; i < data_chars; i++) {
row = weight_rows[(((data_chars - 2) / 2) * 21) + i]; int row = weight_rows[(((data_chars - 2) / 2) * 21) + i];
for (j = 0; j < 8; j++) { for (j = 0; j < 8; j++) {
checksum += (char_widths[i][j] * checksum_weight_exp[(row * 8) + j]); checksum += (char_widths[i][j] * checksum_weight_exp[(row * 8) + j]);
@ -2102,7 +2101,7 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len)
* [01]90614141999996[10]1234222222222221 * [01]90614141999996[10]1234222222222221
* Patch by Daniel Frede * Patch by Daniel Frede
*/ */
codeblocks = (data_chars + 1) / 2 + ((data_chars + 1) % 2); int codeblocks = (data_chars + 1) / 2 + ((data_chars + 1) % 2);
if ((symbol->option_2 < 1) || (symbol->option_2 > 10)) { if ((symbol->option_2 < 1) || (symbol->option_2 > 10)) {
@ -2115,22 +2114,23 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len)
symbol->option_2 = 2; symbol->option_2 = 2;
} }
stack_rows = codeblocks / symbol->option_2; int stack_rows = codeblocks / symbol->option_2;
if (codeblocks % symbol->option_2 > 0) { if (codeblocks % symbol->option_2 > 0) {
stack_rows++; stack_rows++;
} }
current_block = 0; int current_row, current_block = 0, left_to_right;
for (current_row = 1; current_row <= stack_rows; current_row++) { for (current_row = 1; current_row <= stack_rows; current_row++) {
int sub_elements[235];
for (i = 0; i < 235; i++) { for (i = 0; i < 235; i++) {
sub_elements[i] = 0; sub_elements[i] = 0;
} }
special_case_row = 0; int special_case_row = 0;
/* Row Start */ /* Row Start */
sub_elements[0] = 1; // left guard sub_elements[0] = 1; // left guard
sub_elements[1] = 1; sub_elements[1] = 1;
elements_in_sub = 2; int elements_in_sub = 2;
/* Row Data */ /* Row Data */
reader = 0; reader = 0;
@ -2139,7 +2139,7 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len)
((current_row == stack_rows) && (codeblocks != (current_row * symbol->option_2)) && ((current_row == stack_rows) && (codeblocks != (current_row * symbol->option_2)) &&
(((current_row * symbol->option_2) - codeblocks) & 1))) { (((current_row * symbol->option_2) - codeblocks) & 1))) {
/* left to right */ /* left to right */
left_to_right = 1; left_to_right = 1;
i = 2 + (current_block * 21); i = 2 + (current_block * 21);
for (j = 0; j < 21; j++) { for (j = 0; j < 21; j++) {
if ((i + j) < pattern_width) { if ((i + j) < pattern_width) {
@ -2167,7 +2167,7 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len)
sub_elements[elements_in_sub + 1] = 1; sub_elements[elements_in_sub + 1] = 1;
elements_in_sub += 2; elements_in_sub += 2;
latch = current_row & 1 ? '0' : '1'; latch = (current_row & 1) ? '0' : '1';
if ((current_row == stack_rows) && (codeblocks != (current_row * symbol->option_2)) && if ((current_row == stack_rows) && (codeblocks != (current_row * symbol->option_2)) &&
((current_row & 1) == 0) && ((symbol->option_2 & 1) == 0)) { ((current_row & 1) == 0) && ((symbol->option_2 & 1) == 0)) {

View File

@ -44,7 +44,7 @@
#define SSET "0123456789ABCDEF" #define SSET "0123456789ABCDEF"
int svg_plot(struct zint_symbol *symbol) { int svg_plot(struct zint_symbol *symbol) {
int i, block_width, latch, r, this_row; int i, block_width, latch, r;
float textpos, large_bar_height, preset_height, row_height, row_posn = 0.0; float textpos, large_bar_height, preset_height, row_height, row_posn = 0.0;
FILE *fsvg; FILE *fsvg;
int error_number = 0; int error_number = 0;
@ -306,7 +306,7 @@ int svg_plot(struct zint_symbol *symbol) {
int addon_latch = 0; int addon_latch = 0;
for (r = 0; r < symbol->rows; r++) { for (r = 0; r < symbol->rows; r++) {
this_row = r; int this_row = r;
if (symbol->row_height[this_row] == 0) { if (symbol->row_height[this_row] == 0) {
row_height = large_bar_height; row_height = large_bar_height;
} else { } else {

View File

@ -232,7 +232,7 @@ int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
ifd.y_resolution.type = 5; ifd.y_resolution.type = 5;
ifd.y_resolution.count = 1; ifd.y_resolution.count = 1;
ifd.y_resolution.offset = free_memory; ifd.y_resolution.offset = free_memory;
free_memory += 8; // free_memory += 8;
ifd.planar_config.tag = 0x11c; ifd.planar_config.tag = 0x11c;
ifd.planar_config.type = 3; ifd.planar_config.type = 3;

View File

@ -261,7 +261,7 @@ extern "C" {
ZINT_EXTERN void ZBarcode_Clear(struct zint_symbol *symbol); ZINT_EXTERN void ZBarcode_Clear(struct zint_symbol *symbol);
ZINT_EXTERN void ZBarcode_Delete(struct zint_symbol *symbol); ZINT_EXTERN void ZBarcode_Delete(struct zint_symbol *symbol);
ZINT_EXTERN int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *input, int length); ZINT_EXTERN int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int in_length);
ZINT_EXTERN int ZBarcode_Encode_File(struct zint_symbol *symbol, char *filename); ZINT_EXTERN int ZBarcode_Encode_File(struct zint_symbol *symbol, char *filename);
ZINT_EXTERN int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle); ZINT_EXTERN int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle);
ZINT_EXTERN int ZBarcode_Encode_and_Print(struct zint_symbol *symbol, unsigned char *input, int length, int rotate_angle); ZINT_EXTERN int ZBarcode_Encode_and_Print(struct zint_symbol *symbol, unsigned char *input, int length, int rotate_angle);

View File

@ -100,7 +100,7 @@ namespace Zint {
m_whitespace = m_zintSymbol->whitespace_width; m_whitespace = m_zintSymbol->whitespace_width;
} }
int QZint::symbol() { int QZint::symbol() const {
return m_symbol; return m_symbol;
} }
@ -112,7 +112,7 @@ namespace Zint {
m_input_mode = input_mode; m_input_mode = input_mode;
} }
QString QZint::text() { QString QZint::text() const {
return m_text; return m_text;
} }
@ -125,7 +125,7 @@ namespace Zint {
target_size_vert = height; target_size_vert = height;
} }
QString QZint::primaryMessage() { QString QZint::primaryMessage() const {
return m_primaryMessage; return m_primaryMessage;
} }
@ -135,7 +135,7 @@ namespace Zint {
int QZint::height() { int QZint::height() {
encode(); encode();
return (m_zintSymbol->height + (m_border != NO_BORDER) ? m_borderWidth * 2 : 0)*(m_zintSymbol->symbology == BARCODE_MAXICODE ? (maxi_width + 1) : 1); return (m_zintSymbol->height + (m_border != NO_BORDER ? m_borderWidth * 2 : 0)*(m_zintSymbol->symbology == BARCODE_MAXICODE ? (maxi_width + 1) : 1));
} }
void QZint::setHeight(int height) { void QZint::setHeight(int height) {
@ -152,10 +152,10 @@ namespace Zint {
int QZint::width() { int QZint::width() {
encode(); encode();
return (m_zintSymbol->width + (m_border == BOX) ? m_borderWidth * 2 : 0)*(m_zintSymbol->symbology == BARCODE_MAXICODE ? (maxi_width + 1) : 1); return (m_zintSymbol->width + (m_border == BOX ? m_borderWidth * 2 : 0)*(m_zintSymbol->symbology == BARCODE_MAXICODE ? (maxi_width + 1) : 1));
} }
float QZint::scale() { float QZint::scale() const {
return m_scale; return m_scale;
} }
@ -167,7 +167,7 @@ namespace Zint {
m_dot_size = dot_size; m_dot_size = dot_size;
} }
QColor QZint::fgColor() { QColor QZint::fgColor() const {
return m_fgColor; return m_fgColor;
} }
@ -175,7 +175,7 @@ namespace Zint {
m_fgColor = fgColor; m_fgColor = fgColor;
} }
QColor QZint::bgColor() { QColor QZint::bgColor() const {
return m_bgColor; return m_bgColor;
} }
@ -183,7 +183,7 @@ namespace Zint {
m_bgColor = bgColor; m_bgColor = bgColor;
} }
QZint::BorderType QZint::borderType() { QZint::BorderType QZint::borderType() const {
return m_border; return m_border;
} }
@ -191,7 +191,7 @@ namespace Zint {
m_border = border; m_border = border;
} }
int QZint::borderWidth() { int QZint::borderWidth() const {
return m_borderWidth; return m_borderWidth;
} }
@ -205,7 +205,7 @@ namespace Zint {
m_whitespace = whitespace; m_whitespace = whitespace;
} }
int QZint::pdf417CodeWords() { int QZint::pdf417CodeWords() const {
return m_pdf417CodeWords; return m_pdf417CodeWords;
} }
@ -213,7 +213,7 @@ namespace Zint {
m_pdf417CodeWords = pdf417CodeWords; m_pdf417CodeWords = pdf417CodeWords;
} }
int QZint::securityLevel() { int QZint::securityLevel() const {
return m_securityLevel; return m_securityLevel;
} }
@ -221,11 +221,11 @@ namespace Zint {
m_securityLevel = securityLevel; m_securityLevel = securityLevel;
} }
QString QZint::error_message() { QString QZint::error_message() const {
return m_lastError; return m_lastError;
} }
int QZint::mode() { int QZint::mode() const {
return m_securityLevel; return m_securityLevel;
} }
@ -286,7 +286,7 @@ namespace Zint {
} }
} }
int QZint::module_set(int y_coord, int x_coord) { int QZint::module_set(int y_coord, int x_coord) const {
int x_char, x_sub, result; int x_char, x_sub, result;
x_char = x_coord / 7; x_char = x_coord / 7;
@ -304,7 +304,7 @@ namespace Zint {
bool textdone; bool textdone;
int comp_offset = 0; int comp_offset = 0;
int xoffset = m_whitespace; int xoffset = m_whitespace;
int j, main_width = 0, addon_text_height = 0; int main_width = 0, addon_text_height = 0;
int yoffset = 0; int yoffset = 0;
encode(); encode();
@ -602,7 +602,7 @@ namespace Zint {
int block_width; int block_width;
bool latch = true; bool latch = true;
j = 0 + comp_offset; int j = 0 + comp_offset;
do { do {
block_width = 0; block_width = 0;
do { do {
@ -681,7 +681,7 @@ namespace Zint {
painter.restore(); painter.restore();
} }
const QString & QZint::lastError() { const QString & QZint::lastError() const {
return m_lastError; return m_lastError;
} }

View File

@ -36,13 +36,13 @@ public:
QZint(); QZint();
~QZint(); ~QZint();
int symbol(); int symbol() const;
void setSymbol(int symbol); void setSymbol(int symbol);
QString text(); QString text() const;
void setText(const QString & text); void setText(const QString & text);
QString primaryMessage(); QString primaryMessage() const;
void setPrimaryMessage(const QString & primaryMessage); void setPrimaryMessage(const QString & primaryMessage);
void setHeight(int height); void setHeight(int height);
@ -53,41 +53,41 @@ public:
void setOption3(int option); void setOption3(int option);
QColor fgColor(); QColor fgColor() const;
void setFgColor(const QColor & fgColor); void setFgColor(const QColor & fgColor);
QColor bgColor(); QColor bgColor() const;
void setBgColor(const QColor & bgColor); void setBgColor(const QColor & bgColor);
BorderType borderType(); BorderType borderType() const;
void setBorderType(BorderType border); void setBorderType(BorderType border);
int borderWidth(); int borderWidth() const;
void setBorderWidth(int boderWidth); void setBorderWidth(int boderWidth);
int pdf417CodeWords(); int pdf417CodeWords() const;
void setPdf417CodeWords(int pdf417CodeWords); void setPdf417CodeWords(int pdf417CodeWords);
int securityLevel(); int securityLevel() const;
void setSecurityLevel(int securityLevel); void setSecurityLevel(int securityLevel);
float scale(); float scale() const;
void setScale(float scale); void setScale(float scale);
void setDotSize(float dot_size); void setDotSize(float dot_size);
int mode(); int mode() const;
void setMode(int securityLevel); void setMode(int securityLevel);
void setInputMode(int input_mode); void setInputMode(int input_mode);
void setWhitespace(int whitespace); void setWhitespace(int whitespace);
QString error_message(); QString error_message() const;
void render(QPainter & painter, const QRectF & paintRect, AspectRatioMode mode=IgnoreAspectRatio); void render(QPainter & painter, const QRectF & paintRect, AspectRatioMode mode=IgnoreAspectRatio);
const QString & lastError(); const QString & lastError() const;
bool hasErrors(); bool hasErrors();
bool save_to_file(QString filename); bool save_to_file(QString filename);
@ -98,7 +98,7 @@ public:
private: private:
void encode(); void encode();
int module_set(int y_coord, int x_coord); int module_set(int y_coord, int x_coord) const;
private: private:
int m_symbol; int m_symbol;
@ -120,9 +120,9 @@ private:
float m_scale; float m_scale;
int m_option_3; int m_option_3;
bool m_hidetext; bool m_hidetext;
float m_dot_size; float m_dot_size;
int target_size_horiz; int target_size_horiz;
int target_size_vert; int target_size_vert;
}; };
} }
#endif #endif

View File

@ -330,7 +330,7 @@ EXPORT BOOL WINAPI DllEntryPoint (HINSTANCE hInstance,
#endif #endif
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Initialisation Procedures */ /* Initialisation Procedures */
EXPORT int Zint_Init (Tcl_Interp *Interp) EXPORT int Zint_Init (Tcl_Interp *interp)
{ {
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
#ifdef USE_TCL_STUBS #ifdef USE_TCL_STUBS
@ -365,7 +365,6 @@ static int Zint(ClientData unused, Tcl_Interp *interp, int objc,
Tcl_Obj *CONST objv[]) Tcl_Obj *CONST objv[])
{ {
/* Option list and indexes */ /* Option list and indexes */
char *subCmds[] = {"encode", "symbologies", "version", "help", NULL};
enum iCommand {iEncode, iSymbologies, iVersion, iHelp}; enum iCommand {iEncode, iSymbologies, iVersion, iHelp};
/* choice of option */ /* choice of option */
int Index; int Index;
@ -373,6 +372,7 @@ static int Zint(ClientData unused, Tcl_Interp *interp, int objc,
/* > Check if option argument is given and decode it */ /* > Check if option argument is given and decode it */
if (objc > 1) if (objc > 1)
{ {
char *subCmds[] = {"encode", "symbologies", "version", "help", NULL};
if(Tcl_GetIndexFromObj(interp, objv[1], (const char **) subCmds, if(Tcl_GetIndexFromObj(interp, objv[1], (const char **) subCmds,
"option", 0, &Index) "option", 0, &Index)
== TCL_ERROR) == TCL_ERROR)

View File

@ -1150,14 +1150,13 @@ getopt (int argc, char *const *argv, const char *optstring)
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
int c;
int digit_optind = 0; int digit_optind = 0;
while (1) while (1)
{ {
int this_option_optind = optind ? optind : 1; int this_option_optind = optind ? optind : 1;
c = getopt (argc, argv, "abc:d:0123456789"); int c = getopt (argc, argv, "abc:d:0123456789");
if (c == -1) if (c == -1)
break; break;

View File

@ -99,7 +99,6 @@ libc_hidden_def (getopt_long_only)
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
int c;
int digit_optind = 0; int digit_optind = 0;
while (1) while (1)
@ -117,7 +116,7 @@ main (int argc, char **argv)
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
c = getopt_long (argc, argv, "abc:d:0123456789", int c = getopt_long (argc, argv, "abc:d:0123456789",
long_options, &option_index); long_options, &option_index);
if (c == -1) if (c == -1)
break; break;

View File

@ -151,10 +151,10 @@ void show_eci(void) {
/* Verifies that a string only uses valid characters */ /* Verifies that a string only uses valid characters */
int validator(char test_string[], char source[]) { int validator(char test_string[], char source[]) {
unsigned int i, j, latch; unsigned int i, j;
for (i = 0; i < strlen(source); i++) { for (i = 0; i < strlen(source); i++) {
latch = 0; unsigned int latch = 0;
for (j = 0; j < strlen(test_string); j++) { for (j = 0; j < strlen(test_string); j++) {
if (source[i] == test_string[j]) { if (source[i] == test_string[j]) {
latch = 1; latch = 1;
@ -434,7 +434,6 @@ int batch_process(struct zint_symbol *symbol, char *filename, int mirror_mode, c
int main(int argc, char **argv) { int main(int argc, char **argv) {
struct zint_symbol *my_symbol; struct zint_symbol *my_symbol;
int c;
int error_number; int error_number;
int rotate_angle; int rotate_angle;
int generated; int generated;
@ -504,7 +503,7 @@ int main(int argc, char **argv) {
{"verbose", 0, 0, 0}, // Currently undocumented, output some debug info {"verbose", 0, 0, 0}, // Currently undocumented, output some debug info
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
c = getopt_long(argc, argv, "htb:w:d:o:i:rcmpe", long_options, &option_index); int c = getopt_long(argc, argv, "htb:w:d:o:i:rcmpe", long_options, &option_index);
if (c == -1) break; if (c == -1) break;
switch (c) { switch (c) {

View File

@ -36,7 +36,7 @@ DataWindow::DataWindow()
connect(btnOK, SIGNAL( clicked( bool )), SLOT(okay())); connect(btnOK, SIGNAL( clicked( bool )), SLOT(okay()));
} }
DataWindow::DataWindow(QString input) DataWindow::DataWindow(const QString &input)
{ {
setupUi(this); setupUi(this);
txtDataInput->setPlainText(input); txtDataInput->setPlainText(input);

View File

@ -28,7 +28,7 @@ class DataWindow : public QDialog, private Ui::DataDialog
public: public:
DataWindow(); DataWindow();
DataWindow(QString input); explicit DataWindow(const QString &input);
~DataWindow(); ~DataWindow();
int Valid; int Valid;
QString DataOutput; QString DataOutput;

View File

@ -81,7 +81,7 @@ void ExportWindow::process()
QString dataString; QString dataString;
QString suffix; QString suffix;
QString Feedback; QString Feedback;
int lines, i, j, inputpos, datalen; int lines, i, j, inputpos;
lines = output_data.count(QChar('\n'), Qt::CaseInsensitive); lines = output_data.count(QChar('\n'), Qt::CaseInsensitive);
inputpos = 0; inputpos = 0;
@ -110,7 +110,7 @@ void ExportWindow::process()
Feedback = ""; Feedback = "";
for(i = 0; i < lines; i++) { for(i = 0; i < lines; i++) {
datalen = 0; int datalen = 0;
for(j = inputpos; ((j < output_data.length()) && (output_data[j] != '\n') ); j++) { for(j = inputpos; ((j < output_data.length()) && (output_data[j] != '\n') ); j++) {
datalen++; datalen++;
} }
@ -119,12 +119,11 @@ void ExportWindow::process()
case 0: { /* Same as Data (URL Escaped) */ case 0: { /* Same as Data (URL Escaped) */
QString url_escaped; QString url_escaped;
int m; int m;
char name_char;
QChar name_qchar; QChar name_qchar;
for(m = 0; m < dataString.length(); m++) { for(m = 0; m < dataString.length(); m++) {
name_qchar = dataString[m]; name_qchar = dataString[m];
name_char = name_qchar.toLatin1(); char name_char = name_qchar.toLatin1();
switch(name_char) { switch(name_char) {
case '\\': url_escaped += "%5C"; break; case '\\': url_escaped += "%5C"; break;

View File

@ -75,7 +75,6 @@ QString SequenceWindow::apply_format(QString raw_number)
QString adjusted, reversed; QString adjusted, reversed;
QString format; QString format;
int format_len, input_len, i, inpos; int format_len, input_len, i, inpos;
char format_char;
QChar format_qchar; QChar format_qchar;
format = linFormat->text(); format = linFormat->text();
@ -86,7 +85,7 @@ QString SequenceWindow::apply_format(QString raw_number)
for(i = format_len; i > 0; i--) { for(i = format_len; i > 0; i--) {
format_qchar = format[i - 1]; format_qchar = format[i - 1];
format_char = format_qchar.toLatin1(); char format_char = format_qchar.toLatin1();
switch(format_char) { switch(format_char) {
case '#': case '#':
if (inpos > 0) { if (inpos > 0) {