Fix mixed unix / windows EOL

This commit is contained in:
Boris Zentner 2017-10-23 21:34:31 +02:00 committed by Robin Stuart
parent 2372c16ba0
commit 45441a6da7
24 changed files with 278 additions and 255 deletions

View File

@ -215,7 +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; 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);
@ -355,3 +355,4 @@ int dpident(struct zint_symbol *symbol, unsigned char source[], int length) {
ustrcpy(symbol->text, (unsigned char*) localstr); ustrcpy(symbol->text, (unsigned char*) localstr);
return error_number; return error_number;
} }

View File

@ -145,7 +145,7 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt
strcpy(symbol->errtxt, "402: Invalid characters in data"); strcpy(symbol->errtxt, "402: Invalid characters in data");
return error_number; return error_number;
} }
} else { } else {
int zeroes; 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");
@ -253,3 +253,4 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt
return error_number; return error_number;
} }

View File

@ -223,8 +223,8 @@ static int Columns2Rows(CharacterSetTable *T, unsigned char *data, const size_t
/* >>> Loop until rowsCur<44 */ /* >>> Loop until rowsCur<44 */
do { do {
int charCur=0; int charCur=0;
int fOneLiner=1; /* First try one-Liner */ int fOneLiner=1; /* First try one-Liner */
memset(pSet,0,dataLength*sizeof(int)); memset(pSet,0,dataLength*sizeof(int));
rowsCur=0; rowsCur=0;
@ -466,7 +466,7 @@ static int Rows2Columns(CharacterSetTable *T, unsigned char *data, const size_t
testColumns = 1; testColumns = 1;
} }
for (;;) { for (;;) {
int errorCur; int errorCur;
pTestList[testListSize] = testColumns; pTestList[testListSize] = testColumns;
testListSize++; testListSize++;
@ -1004,3 +1004,4 @@ int codablock(struct zint_symbol *symbol,const unsigned char source[], const siz
} }
return 0; return 0;
} }

View File

@ -467,7 +467,7 @@ 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; int i;
/* Target reached - save the generated pattern */ /* Target reached - save the generated pattern */
strcpy(pattern, "11110"); strcpy(pattern, "11110");
for (i = 0; i < 11; i++) { for (i = 0; i < 11; i++) {
@ -589,3 +589,4 @@ int channel_code(struct zint_symbol *symbol, unsigned char source[], int length)
return error_number; return error_number;
} }

View File

@ -1404,7 +1404,7 @@ int code_one(struct zint_symbol *symbol, unsigned char source[], int length) {
unsigned int data[1500], ecc[600]; unsigned int data[1500], ecc[600];
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; int data_blocks;
for (i = 0; i < 1500; i++) { for (i = 0; i < 1500; i++) {
@ -1769,3 +1769,4 @@ int code_one(struct zint_symbol *symbol, unsigned char source[], int length) {
return 0; return 0;
} }

View File

@ -107,7 +107,7 @@ void grwp(int *indexliste) {
if (*(indexliste) > 1) { if (*(indexliste) > 1) {
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; 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];
@ -1086,3 +1086,4 @@ int ean_14(struct zint_symbol *symbol, unsigned char source[], int length) {
return error_number; return error_number;
} }

View File

@ -94,7 +94,7 @@ static void grwp16(unsigned int *indexliste) {
if (*(indexliste) > 1) { if (*(indexliste) > 1) {
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; 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];
@ -695,8 +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; unsigned int writer;
int flip_flop; int flip_flop;
strcpy(width_pattern, ""); strcpy(width_pattern, "");
strcat(width_pattern, C16KStartStop[C16KStartValues[current_row]]); strcat(width_pattern, C16KStartStop[C16KStartValues[current_row]]);
@ -733,3 +733,4 @@ int code16k(struct zint_symbol *symbol, unsigned char source[], const size_t len
} }

View File

@ -1004,7 +1004,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha
/* No date data */ /* No date data */
strcat(binary_string, "11"); strcat(binary_string, "11");
read_posn = 2; read_posn = 2;
} else { } else {
long int group_val; 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];
@ -1120,11 +1120,11 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha
test3 = 1; test3 = 1;
} }
if ((test1 != -1) && (test2 != 1) && (test3 == 0)) { if ((test1 != -1) && (test2 != 1) && (test3 == 0)) {
int next_ai_posn; int next_ai_posn;
char numeric_part[4]; char numeric_part[4];
int numeric_value; int numeric_value;
int table3_letter; int table3_letter;
/* Encodation method "11" can be used */ /* Encodation method "11" can be used */
strcat(binary_string, "11"); strcat(binary_string, "11");
@ -1873,3 +1873,4 @@ int composite(struct zint_symbol *symbol, unsigned char source[], int length) {
return error_number; return error_number;
} }

View File

@ -1240,7 +1240,7 @@ 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; unsigned char *grid;
NC = W - 2 * (W / FW); NC = W - 2 * (W / FW);
NR = H - 2 * (H / FH); NR = H - 2 * (H / FH);
@ -1297,7 +1297,7 @@ int data_matrix_200(struct zint_symbol *symbol,const unsigned char source[], con
symbol->rows = H; symbol->rows = H;
symbol->width = W; symbol->width = W;
return error_number; return error_number;
} }
@ -1315,3 +1315,4 @@ int dmatrix(struct zint_symbol *symbol, const unsigned char source[], const size
return error_number; return error_number;
} }

View File

@ -745,7 +745,7 @@ 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; float row_posn;
if (symbol->row_height[this_row] == 0) { if (symbol->row_height[this_row] == 0) {
@ -1222,3 +1222,4 @@ int emf_plot(struct zint_symbol *symbol) {
} }
return error_number; return error_number;
} }

View File

@ -841,7 +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; int data_size;
if (i < b1) { if (i < b1) {
block_size = n1; block_size = n1;
} else { } else {
@ -1207,3 +1207,4 @@ int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], size_t
return 0; return 0;
} }

View File

@ -1254,7 +1254,7 @@ 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; 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) {
@ -1570,3 +1570,4 @@ int han_xin(struct zint_symbol *symbol, const unsigned char source[], size_t len
return 0; return 0;
} }

View File

@ -621,8 +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 countrycode;
int service; 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);
} }
@ -733,3 +733,4 @@ int maxicode(struct zint_symbol *symbol, unsigned char local_source[], const int
return internal_error; return internal_error;
} }

View File

@ -280,7 +280,7 @@ 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; long int remainder;
codeword[i] = pharmacode / devisor; codeword[i] = pharmacode / devisor;
remainder = pharmacode % devisor; remainder = pharmacode % devisor;
pharmacode = remainder; pharmacode = remainder;
@ -305,3 +305,4 @@ int code32(struct zint_symbol *symbol, unsigned char source[], int length) {
return error_number; return error_number;
} }

View File

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

View File

@ -107,7 +107,7 @@ 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; 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];
j = i + 1; j = i + 1;
@ -427,7 +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; 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;
@ -439,7 +439,7 @@ void byteprocess(int *chainemc, int *mclength, unsigned char chaine[], int start
len = 0; len = 0;
while (len < length) { while (len < length) {
uint64_t total; 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 */ {
@ -497,7 +497,7 @@ 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 longueur;
int dumlength = 0; int dumlength = 0;
strcpy(chainemod, ""); strcpy(chainemod, "");
longueur = length - j; longueur = length - j;
@ -1288,3 +1288,4 @@ int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], const size_
return codeerr; return codeerr;
} }

View File

@ -154,7 +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; 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)) {
@ -189,3 +189,4 @@ int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
return 0; return 0;
} }
#endif /* NO_PNG */ #endif /* NO_PNG */

View File

@ -404,7 +404,7 @@ 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; 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;
@ -973,3 +973,4 @@ int ps_plot(struct zint_symbol *symbol) {
return error_number; return error_number;
} }

View File

@ -1422,7 +1422,7 @@ 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 {
int glyph = 0; int glyph = 0;
j = 0; j = 0;
do { do {
if (sjis_lookup[j * 2] == utfdata[i]) { if (sjis_lookup[j * 2] == utfdata[i]) {
@ -1648,8 +1648,8 @@ static int micro_qr_intermediate(char binary[], const int jisdata[], const char
} }
do { do {
char data_block; char data_block;
int short_data_block_length = 0; int short_data_block_length = 0;
if (strlen(binary) > 128) { if (strlen(binary) > 128) {
return ZINT_ERROR_TOO_LONG; return ZINT_ERROR_TOO_LONG;
} }
@ -2587,7 +2587,7 @@ 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 {
int glyph = 0; int glyph = 0;
j = 0; j = 0;
do { do {
if (sjis_lookup[j * 2] == utfdata[i]) { if (sjis_lookup[j * 2] == utfdata[i]) {
@ -2980,3 +2980,4 @@ int upnqr(struct zint_symbol *symbol, const unsigned char source[], size_t lengt
return 0; return 0;
} }

View File

@ -282,7 +282,7 @@ 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; int x, y;
if (letter > 128) { if (letter > 128) {
glyph_no = letter - 66; glyph_no = letter - 66;
} else { } else {
@ -816,8 +816,8 @@ 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_yposn;
int plot_height; 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;
plot_yposn = next_yposn; plot_yposn = next_yposn;
@ -1142,3 +1142,4 @@ int plot_raster(struct zint_symbol *symbol, int rotate_angle, int file_type) {
return error; return error;
} }

View File

@ -254,7 +254,7 @@ int render_plot(struct zint_symbol *symbol, float width, float height) {
else if (symbol->symbology == BARCODE_CODE49) { else if (symbol->symbology == BARCODE_CODE49) {
/* The minimum X-dimension of Code 49 is 0.191mm */ /* The minimum X-dimension of Code 49 is 0.191mm */
if (x_dimension < 0.191) { if (x_dimension < 0.191) {
float encoded_symbol_aspect; float encoded_symbol_aspect;
x_dimension = 0.191; x_dimension = 0.191;
width = 0.191 * GL_CONST * total_area_width_x; width = 0.191 * GL_CONST * total_area_width_x;
encoded_symbol_aspect = total_area_width_x; encoded_symbol_aspect = total_area_width_x;
@ -350,7 +350,7 @@ int render_plot(struct zint_symbol *symbol, float width, float height) {
if (symbol->symbology == BARCODE_MAXICODE) { if (symbol->symbology == BARCODE_MAXICODE) {
struct zint_render_ring *ring; 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;
@ -847,3 +847,4 @@ void render_free(struct zint_symbol *symbol) {
symbol->rendered = NULL; symbol->rendered = NULL;
} }
} }

View File

@ -428,9 +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 count;
int check_digit; int check_digit;
char hrt[15]; char hrt[15];
writer = 0; writer = 0;
latch = '0'; latch = '0';
for (i = 0; i < 46; i++) { for (i = 0; i < 46; i++) {
@ -1068,7 +1068,7 @@ 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; char last;
current = type[i]; current = type[i];
last = type[i - 1]; last = type[i - 1];
@ -1084,7 +1084,7 @@ 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; char next;
current = block[1][i]; current = block[1][i];
next = (block[1][i + 1] & 0xFF); next = (block[1][i + 1] & 0xFF);
@ -2099,8 +2099,8 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len)
} }
} else { } else {
int stack_rows; int stack_rows;
int current_row, current_block, left_to_right; 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
@ -2127,8 +2127,8 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len)
current_block = 0; 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 special_case_row = 0;
int elements_in_sub; 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;
@ -2312,3 +2312,4 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len)
return 0; return 0;
} }

View File

@ -42,11 +42,12 @@ typedef BYTE uint8_t;
typedef WORD uint16_t; typedef WORD uint16_t;
typedef DWORD uint32_t; typedef DWORD uint32_t;
typedef INT32 int32_t; typedef INT32 int32_t;
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
#endif /* STDINT_MSVC_H */ #endif /* STDINT_MSVC_H */

View File

@ -37,19 +37,19 @@
- Added Codablock F options "-rows". - Added Codablock F options "-rows".
- Adopted to new image format of zint - Adopted to new image format of zint
2016-10-14 2.5.2 HaO 2016-10-14 2.5.2 HaO
- Include the upstream reverted image format - Include the upstream reverted image format
2016-12-12 2.5.3 HaO 2016-12-12 2.5.3 HaO
- No changes here, take 2.5.1 framework files - No changes here, take 2.5.1 framework files
2017-05-12 2.6.0 HaO 2017-05-12 2.6.0 HaO
- No changes here, take 2.6 framework files - No changes here, take 2.6 framework files
2017-08-29 2.6.1 HaO 2017-08-29 2.6.1 HaO
- Framework 2.6.1 extensions - Framework 2.6.1 extensions
- EAN/UPC Codes with included check digit - EAN/UPC Codes with included check digit
- UPNQR Code - UPNQR Code
- Misspelled symbology: AztecRunes - Misspelled symbology: AztecRunes
2017-10-23 2.6.2 HaO 2017-10-23 2.6.2 HaO
- Framework 2.6.2 bugfixes - Framework 2.6.2 bugfixes
- Allow dll unload - Allow dll unload
*/ */
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
@ -99,7 +99,7 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* >>>> External Prototypes (exports) */ /* >>>> External Prototypes (exports) */
EXPORT int Zint_Init (Tcl_Interp *interp); EXPORT int Zint_Init (Tcl_Interp *interp);
EXPORT int Zint_Unload (Tcl_Interp *Interp, int Flags); EXPORT int Zint_Unload (Tcl_Interp *Interp, int Flags);
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* >>>> local prototypes */ /* >>>> local prototypes */
static int Zint(ClientData unused, Tcl_Interp *interp, int objc, static int Zint(ClientData unused, Tcl_Interp *interp, int objc,
@ -120,7 +120,7 @@ static char *s_code_list[] = {
"Ind2of5", "Ind2of5",
"Code39", "Code39",
"Code39Extended", "Code39Extended",
"EAN", "EAN",
"EAN+Check", "EAN+Check",
"GS1-128", "GS1-128",
"Codabar", "Codabar",
@ -135,10 +135,10 @@ static char *s_code_list[] = {
"GS1DataBarLimited", "GS1DataBarLimited",
"GS1DataBarExpanded", "GS1DataBarExpanded",
"Telepen", "Telepen",
"UPC-A", "UPC-A",
"UPC-A+Check", "UPC-A+Check",
"UPC-E", "UPC-E",
"UPC-E+Check", "UPC-E+Check",
"Postnet", "Postnet",
"MSIPlessey", "MSIPlessey",
"FIM", "FIM",
@ -183,8 +183,8 @@ static char *s_code_list[] = {
"HIBC-PDF", "HIBC-PDF",
"HIBC-MicroPDF", "HIBC-MicroPDF",
"HIBC-CodablockF", "HIBC-CodablockF",
"HIBCAztec", "HIBCAztec",
"DotCode", "DotCode",
"HanXin", "HanXin",
"AztecRunes", "AztecRunes",
"Code32", "Code32",
@ -213,7 +213,7 @@ static int s_code_number[] = {
BARCODE_C25IND, BARCODE_C25IND,
BARCODE_CODE39, BARCODE_CODE39,
BARCODE_EXCODE39, BARCODE_EXCODE39,
BARCODE_EANX, BARCODE_EANX,
BARCODE_EANX_CHK, BARCODE_EANX_CHK,
BARCODE_EAN128, BARCODE_EAN128,
BARCODE_CODABAR, BARCODE_CODABAR,
@ -228,10 +228,10 @@ static int s_code_number[] = {
BARCODE_RSS_LTD, BARCODE_RSS_LTD,
BARCODE_RSS_EXP, BARCODE_RSS_EXP,
BARCODE_TELEPEN, BARCODE_TELEPEN,
BARCODE_UPCA, BARCODE_UPCA,
BARCODE_UPCA_CHK, BARCODE_UPCA_CHK,
BARCODE_UPCE, BARCODE_UPCE,
BARCODE_UPCE_CHK, BARCODE_UPCE_CHK,
BARCODE_POSTNET, BARCODE_POSTNET,
BARCODE_MSI_PLESSEY, BARCODE_MSI_PLESSEY,
BARCODE_FIM, BARCODE_FIM,
@ -276,8 +276,8 @@ static int s_code_number[] = {
BARCODE_HIBC_PDF, BARCODE_HIBC_PDF,
BARCODE_HIBC_MICPDF, BARCODE_HIBC_MICPDF,
BARCODE_HIBC_BLOCKF, BARCODE_HIBC_BLOCKF,
BARCODE_HIBC_AZTEC, BARCODE_HIBC_AZTEC,
BARCODE_DOTCODE, BARCODE_DOTCODE,
BARCODE_HANXIN, BARCODE_HANXIN,
BARCODE_AZRUNE, BARCODE_AZRUNE,
BARCODE_CODE32, BARCODE_CODE32,
@ -305,8 +305,8 @@ static char help_message[] = "zint tcl(stub,obj) dll\n"
"(c) 2014-06-16 ELMICRON GmbH by Harald Oehlmann\n" "(c) 2014-06-16 ELMICRON GmbH by Harald Oehlmann\n"
" Generate barcode in tk images and in file output\n" " Generate barcode in tk images and in file output\n"
"Usage:\n" "Usage:\n"
" zint encode data photo option value...\n" " zint encode data photo option value...\n"
" data: data to encode in the symbol\n" " data: data to encode in the symbol\n"
" photo: a tcl photo image handle ('p' after 'image create photo p')\n" " photo: a tcl photo image handle ('p' after 'image create photo p')\n"
" Available options:\n" " Available options:\n"
" -bind bool: bars above/below the code, size set by -border\n" " -bind bool: bars above/below the code, size set by -border\n"
@ -376,14 +376,14 @@ EXPORT int Zint_Init (Tcl_Interp *interp)
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
return TCL_OK; return TCL_OK;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// >>>> Unload Procedures // >>>> Unload Procedures
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
EXPORT int Zint_Unload (Tcl_Interp *Interp, int Flags) EXPORT int Zint_Unload (Tcl_Interp *Interp, int Flags)
{ {
// Allow unload // Allow unload
return TCL_OK; return TCL_OK;
} }
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* >>>>> Called routine */ /* >>>>> Called routine */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
@ -851,3 +851,4 @@ static int Encode(Tcl_Interp *interp, int objc,
} }
return TCL_OK; return TCL_OK;
} }