Make compile with MS-VC6

This commit is contained in:
Harald Oehlmann 2017-10-16 19:26:54 +02:00
parent bfb183e5df
commit f83e5b1501
22 changed files with 98 additions and 64 deletions

View File

@ -215,6 +215,7 @@ int interleaved_two_of_five(struct zint_symbol *symbol, const unsigned char sour
strcpy(dest, "1111"); strcpy(dest, "1111");
for (i = 0; i < length; i += 2) { for (i = 0; i < length; i += 2) {
int k = 0;
/* look up the bars and the spaces and put them in two strings */ /* look up the bars and the spaces and put them in two strings */
strcpy(bars, ""); strcpy(bars, "");
lookup(NEON, C25InterTable, temp[i], bars); lookup(NEON, C25InterTable, temp[i], bars);
@ -222,7 +223,6 @@ 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 */
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

@ -146,6 +146,7 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt
return error_number; return error_number;
} }
} else { } else {
int zeroes;
if (length > 8) { if (length > 8) {
strcpy(symbol->errtxt, "403: Auspost input is too long"); strcpy(symbol->errtxt, "403: Auspost input is too long");
return ZINT_ERROR_TOO_LONG; return ZINT_ERROR_TOO_LONG;
@ -160,7 +161,7 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt
} }
/* Add leading zeros as required */ /* Add leading zeros as required */
int zeroes = 8 - length; zeroes = 8 - length;
memset(localstr, '0', zeroes); memset(localstr, '0', zeroes);
localstr[8] = '\0'; localstr[8] = '\0';
} }

View File

@ -223,10 +223,10 @@ 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));
int charCur=0; int charCur=0;
rowsCur=0;
int fOneLiner=1; /* First try one-Liner */ int fOneLiner=1; /* First try one-Liner */
memset(pSet,0,dataLength*sizeof(int));
rowsCur=0;
/* >>> Line and OneLiner-try Loop */ /* >>> Line and OneLiner-try Loop */
do{ do{
@ -467,10 +467,11 @@ static int Rows2Columns(CharacterSetTable *T, unsigned char *data, const size_t
} }
for (;;) { for (;;) {
int errorCur;
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 */
int errorCur = Columns2Rows(T, data, dataLength, &rowsCur, &useColumns, pSet, &fillings); 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) {

View File

@ -467,9 +467,9 @@ int c93(struct zint_symbol *symbol, unsigned char source[], int length) {
void CheckCharacter() { void CheckCharacter() {
if (value == target_value) { if (value == target_value) {
int i;
/* 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]; char part[3];
part[0] = itoc(S[i]); part[0] = itoc(S[i]);

View File

@ -1405,6 +1405,7 @@ int code_one(struct zint_symbol *symbol, unsigned char source[], int length) {
unsigned int sub_data[190], sub_ecc[75]; unsigned int sub_data[190], sub_ecc[75];
unsigned int stream[2100]; unsigned int stream[2100];
int data_length; int data_length;
int data_blocks;
for (i = 0; i < 1500; i++) { for (i = 0; i < 1500; i++) {
data[i] = 0; data[i] = 0;
@ -1444,7 +1445,7 @@ int code_one(struct zint_symbol *symbol, unsigned char source[], int length) {
sub_ecc[i] = 0; sub_ecc[i] = 0;
} }
int data_blocks = c1_blocks[size - 1]; 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

@ -108,9 +108,10 @@ void grwp(int *indexliste) {
int 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]) {
int j;
/* 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];
int j = i + 1; j = i + 1;
/* decreace the list */ /* decreace the list */
while (j < *(indexliste)) { while (j < *(indexliste)) {

View File

@ -95,9 +95,10 @@ static void grwp16(unsigned int *indexliste) {
int 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]) {
int j;
/* 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];
int j = i + 1; j = i + 1;
/* decreace the list */ /* decreace the list */
while(j < (int)*(indexliste)) { while(j < (int)*(indexliste)) {
@ -694,6 +695,8 @@ int code16k(struct zint_symbol *symbol, unsigned char source[], const size_t len
bar_characters += 2; bar_characters += 2;
for (current_row = 0; current_row < rows_needed; current_row++) { for (current_row = 0; current_row < rows_needed; current_row++) {
unsigned int writer;
int flip_flop;
strcpy(width_pattern, ""); strcpy(width_pattern, "");
strcat(width_pattern, C16KStartStop[C16KStartValues[current_row]]); strcat(width_pattern, C16KStartStop[C16KStartValues[current_row]]);
@ -704,8 +707,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 */
unsigned int writer = 0; writer = 0;
int flip_flop = 1; 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

@ -1005,12 +1005,13 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha
strcat(binary_string, "11"); strcat(binary_string, "11");
read_posn = 2; read_posn = 2;
} else { } else {
long int group_val;
/* Production Date (11) or Expiration Date (17) */ /* Production Date (11) or Expiration Date (17) */
char date_str[4]; 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';
long int group_val = atoi(date_str) * 384; 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];
@ -1120,6 +1121,10 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha
} }
if ((test1 != -1) && (test2 != 1) && (test3 == 0)) { if ((test1 != -1) && (test2 != 1) && (test3 == 0)) {
int next_ai_posn;
char numeric_part[4];
int numeric_value;
int table3_letter;
/* Encodation method "11" can be used */ /* Encodation method "11" can be used */
strcat(binary_string, "11"); strcat(binary_string, "11");
@ -1145,7 +1150,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha
} }
} }
int next_ai_posn = 2 + (int)strlen(ninety); 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 */
@ -1169,7 +1174,6 @@ 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 {
@ -1179,9 +1183,9 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha
numeric_part[i] = '\0'; numeric_part[i] = '\0';
} }
int numeric_value = atoi(numeric_part); numeric_value = atoi(numeric_part);
int table3_letter = -1; 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

@ -1241,11 +1241,12 @@ int data_matrix_200(struct zint_symbol *symbol,const unsigned char source[], con
#endif #endif
{ // placement { // placement
int x, y, NC, NR, *places; int x, y, NC, NR, *places;
unsigned char *grid;
NC = W - 2 * (W / FW); NC = W - 2 * (W / FW);
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);
unsigned char *grid = (unsigned char*) malloc(W * H); 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

@ -744,13 +744,14 @@ int emf_plot(struct zint_symbol *symbol) {
/* Make image rectangles, circles, hexagons */ /* Make image rectangles, circles, hexagons */
for (this_row = 0; this_row < symbol->rows; this_row++) { for (this_row = 0; this_row < symbol->rows; this_row++) {
float row_posn;
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];
} }
float row_posn = 0; 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

@ -841,6 +841,7 @@ static void gm_add_ecc(const char binary[], const size_t data_posn, const int la
/* Split the data into blocks */ /* Split the data into blocks */
wp = 0; wp = 0;
for (i = 0; i < (b1 + b2); i++) { for (i = 0; i < (b1 + b2); i++) {
int data_size;
if (i < b1) { if (i < b1) {
block_size = n1; block_size = n1;
} else { } else {
@ -851,7 +852,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;
} }
int data_size = block_size - ecc_size; 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);*/

View File

@ -1254,13 +1254,14 @@ int han_xin(struct zint_symbol *symbol, const unsigned char source[], size_t len
gbdata[i] = (int) source[i]; gbdata[i] = (int) source[i];
} }
} else { } else {
int posn;
/* Convert Unicode input to GB-18030 */ /* Convert Unicode input to GB-18030 */
int 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;
} }
int posn = 0; posn = 0;
for (i = 0; i < length; i++) { for (i = 0; i < length; i++) {
int done = 0; int done = 0;
gbdata[posn] = 0; gbdata[posn] = 0;

View File

@ -621,6 +621,8 @@ int maxicode(struct zint_symbol *symbol, unsigned char local_source[], const int
} }
if ((mode == 2) || (mode == 3)) { /* Modes 2 and 3 need data in symbol->primary */ if ((mode == 2) || (mode == 3)) { /* Modes 2 and 3 need data in symbol->primary */
int countrycode;
int service;
if (lp == 0) { /* Mode set manually means lp doesn't get set */ if (lp == 0) { /* Mode set manually means lp doesn't get set */
lp = strlen(symbol->primary); lp = strlen(symbol->primary);
} }
@ -659,8 +661,8 @@ int maxicode(struct zint_symbol *symbol, unsigned char local_source[], const int
servicestr[2] = symbol->primary[14]; servicestr[2] = symbol->primary[14];
servicestr[3] = '\0'; servicestr[3] = '\0';
int countrycode = atoi(countrystr); countrycode = atoi(countrystr);
int service = atoi(servicestr); 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

@ -280,8 +280,9 @@ int code32(struct zint_symbol *symbol, unsigned char source[], int length) {
/* Convert from decimal to base-32 */ /* Convert from decimal to base-32 */
devisor = 33554432; devisor = 33554432;
for (i = 5; i >= 0; i--) { for (i = 5; i >= 0; i--) {
long int remainder;
codeword[i] = pharmacode / devisor; codeword[i] = pharmacode / devisor;
long int remainder = pharmacode % devisor; remainder = pharmacode % devisor;
pharmacode = remainder; pharmacode = remainder;
devisor /= 32; devisor /= 32;
} }

View File

@ -107,9 +107,10 @@ void regroupe(int *indexliste) {
int 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]) {
int j;
/* 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];
int j = i + 1; j = i + 1;
/* decreace the list */ /* decreace the list */
while (j < *(indexliste)) { while (j < *(indexliste)) {
@ -426,6 +427,7 @@ void byteprocess(int *chainemc, int *mclength, unsigned char chaine[], int start
printf("913 %d\n", chainemc[*mclength - 1]); printf("913 %d\n", chainemc[*mclength - 1]);
} }
} else { } else {
int len;
/* select the switch for multiple of 6 bytes */ /* select the switch for multiple of 6 bytes */
if (length % 6 == 0) { if (length % 6 == 0) {
chainemc[(*mclength)++] = 924; chainemc[(*mclength)++] = 924;
@ -435,17 +437,18 @@ void byteprocess(int *chainemc, int *mclength, unsigned char chaine[], int start
if (debug) printf("901 "); if (debug) printf("901 ");
} }
int len = 0; len = 0;
while (len < length) { while (len < length) {
uint64_t total;
unsigned int 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
uint64_t total = 0; total = 0;
#else #else
uint64_t total = 0ULL; total = 0ULL;
#endif #endif
while (chunkLen--) { while (chunkLen--) {
@ -494,9 +497,10 @@ void numbprocess(int *chainemc, int *mclength, char chaine[], int start, int len
j = 0; j = 0;
while (j < length) { while (j < length) {
int longueur;
int dumlength = 0; int dumlength = 0;
strcpy(chainemod, ""); strcpy(chainemod, "");
int longueur = length - j; longueur = length - j;
if (longueur > 44) { if (longueur > 44) {
longueur = 44; longueur = 44;
} }

View File

@ -154,6 +154,7 @@ int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
/* Pixel Plotting */ /* Pixel Plotting */
for (row = 0; row < symbol->bitmap_height; row++) { for (row = 0; row < symbol->bitmap_height; row++) {
unsigned char *image_data;
for (column = 0; column < symbol->bitmap_width; column++) { for (column = 0; column < symbol->bitmap_width; column++) {
i = column * 3; i = column * 3;
switch (*(pixelbuf + (symbol->bitmap_width * row) + column)) { switch (*(pixelbuf + (symbol->bitmap_width * row) + column)) {
@ -171,7 +172,7 @@ int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
} }
} }
/* write row contents to file */ /* write row contents to file */
unsigned char *image_data = outdata; image_data = outdata;
png_write_row(png_ptr, image_data); png_write_row(png_ptr, image_data);
} }

View File

@ -404,13 +404,14 @@ 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++) {
float row_posn;
int 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];
} }
float row_posn = 0; 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

@ -1422,8 +1422,8 @@ int qr_code(struct zint_symbol *symbol, const unsigned char source[], size_t len
if (utfdata[i] <= 0xff) { if (utfdata[i] <= 0xff) {
jisdata[i] = utfdata[i]; jisdata[i] = utfdata[i];
} else { } else {
j = 0;
int glyph = 0; int glyph = 0;
j = 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];
@ -1648,12 +1648,13 @@ static int micro_qr_intermediate(char binary[], const int jisdata[], const char
} }
do { do {
char data_block;
int short_data_block_length = 0;
if (strlen(binary) > 128) { if (strlen(binary) > 128) {
return ZINT_ERROR_TOO_LONG; return ZINT_ERROR_TOO_LONG;
} }
char data_block = mode[position]; data_block = mode[position];
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));
@ -2586,8 +2587,8 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], size_t len
if (utfdata[i] <= 0xff) { if (utfdata[i] <= 0xff) {
jisdata[i] = utfdata[i]; jisdata[i] = utfdata[i];
} else { } else {
j = 0;
int glyph = 0; int glyph = 0;
j = 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

@ -282,13 +282,13 @@ void draw_letter(char *pixelbuf, unsigned char letter, int xposn, int yposn, int
if (skip == 0) { if (skip == 0) {
int glyph_no; int glyph_no;
int x, y;
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; int max_x, max_y;
@ -816,16 +816,18 @@ 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++) {
int plot_yposn;
int plot_height;
int 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;
int plot_yposn = next_yposn; 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);
int plot_height = next_yposn - plot_yposn; 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

@ -330,13 +330,13 @@ int render_plot(struct zint_symbol *symbol, const float width, const float heigh
} }
if (symbol->symbology == BARCODE_MAXICODE) { if (symbol->symbology == BARCODE_MAXICODE) {
struct zint_render_ring *ring;
/* Maxicode is a fixed size */ /* Maxicode is a fixed size */
scaler = GL_CONST; /* Converts from millimeters to the scale used by glabels */ scaler = GL_CONST; /* Converts from millimeters to the scale used by glabels */
render->width = 28.16 * scaler; render->width = 28.16 * scaler;
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);

View File

@ -428,6 +428,9 @@ int rss14(struct zint_symbol *symbol, unsigned char source[], int src_len) {
/* Put this data into the symbol */ /* Put this data into the symbol */
if ((symbol->symbology == BARCODE_RSS14) || (symbol->symbology == BARCODE_RSS14_CC)) { if ((symbol->symbology == BARCODE_RSS14) || (symbol->symbology == BARCODE_RSS14_CC)) {
int count;
int check_digit;
char hrt[15];
writer = 0; writer = 0;
latch = '0'; latch = '0';
for (i = 0; i < 46; i++) { for (i = 0; i < 46; i++) {
@ -486,9 +489,8 @@ int rss14(struct zint_symbol *symbol, unsigned char source[], int src_len) {
} }
symbol->rows = symbol->rows + 1; symbol->rows = symbol->rows + 1;
int count = 0; count = 0;
int check_digit = 0; 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)");
@ -1066,8 +1068,9 @@ int general_rules(char type[]) {
block[1][block_count] = type[0]; block[1][block_count] = type[0];
for (i = 1; i < strlen(type); i++) { for (i = 1; i < strlen(type); i++) {
char last;
current = type[i]; current = type[i];
char last = type[i - 1]; 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,8 +1084,9 @@ int general_rules(char type[]) {
block_count++; block_count++;
for (i = 0; i < block_count; i++) { for (i = 0; i < block_count; i++) {
char next;
current = block[1][i]; current = block[1][i];
char next = (block[1][i + 1] & 0xFF); 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)) {
@ -2095,6 +2099,8 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len)
} }
} else { } else {
int stack_rows;
int current_row, current_block, left_to_right;
/* RSS Expanded Stacked */ /* RSS Expanded Stacked */
/* Bug corrected: Character missing for message /* Bug corrected: Character missing for message
@ -2114,23 +2120,24 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len)
symbol->option_2 = 2; symbol->option_2 = 2;
} }
int stack_rows = codeblocks / symbol->option_2; stack_rows = codeblocks / symbol->option_2;
if (codeblocks % symbol->option_2 > 0) { if (codeblocks % symbol->option_2 > 0) {
stack_rows++; stack_rows++;
} }
int current_row, current_block = 0, left_to_right; current_block = 0;
for (current_row = 1; current_row <= stack_rows; current_row++) { for (current_row = 1; current_row <= stack_rows; current_row++) {
int special_case_row = 0;
int elements_in_sub;
int sub_elements[235]; int sub_elements[235];
for (i = 0; i < 235; i++) { for (i = 0; i < 235; i++) {
sub_elements[i] = 0; sub_elements[i] = 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;
int elements_in_sub = 2; elements_in_sub = 2;
/* Row Data */ /* Row Data */
reader = 0; reader = 0;

View File

@ -347,26 +347,26 @@ EXPORT int Zint_Init (Tcl_Interp *interp)
{ {
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
#ifdef USE_TCL_STUBS #ifdef USE_TCL_STUBS
if (Tcl_InitStubs(Interp, "8.1", 0) == NULL) if (Tcl_InitStubs(interp, "8.1", 0) == NULL)
#else #else
if (Tcl_PkgRequire(Interp, "Tcl", "8.1", 0) == NULL) if (Tcl_PkgRequire(interp, "Tcl", "8.1", 0) == NULL)
#endif #endif
{ {
return TCL_ERROR; return TCL_ERROR;
} }
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
#ifdef USE_TK_STUBS #ifdef USE_TK_STUBS
if (Tk_InitStubs(Interp, "8.1", 0) == NULL) if (Tk_InitStubs(interp, "8.1", 0) == NULL)
#else #else
if (Tcl_PkgRequire(Interp, "Tk", "8.1", 0) == NULL) if (Tcl_PkgRequire(interp, "Tk", "8.1", 0) == NULL)
#endif #endif
{ {
return TCL_ERROR; return TCL_ERROR;
} }
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
Tcl_CreateObjCommand(Interp, "zint", Zint, (ClientData)NULL, Tcl_CreateObjCommand(interp, "zint", Zint, (ClientData)NULL,
(Tcl_CmdDeleteProc *)NULL); (Tcl_CmdDeleteProc *)NULL);
Tcl_PkgProvide (Interp, "zint", version_string); Tcl_PkgProvide (interp, "zint", version_string);
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
return TCL_OK; return TCL_OK;
} }