mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Fix mixed unix / windows EOL
This commit is contained in:
parent
2372c16ba0
commit
45441a6da7
@ -215,7 +215,7 @@ int interleaved_two_of_five(struct zint_symbol *symbol, const unsigned char sour
|
||||
strcpy(dest, "1111");
|
||||
|
||||
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 */
|
||||
strcpy(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);
|
||||
return error_number;
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt
|
||||
strcpy(symbol->errtxt, "402: Invalid characters in data");
|
||||
return error_number;
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
int zeroes;
|
||||
if (length > 8) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -223,8 +223,8 @@ static int Columns2Rows(CharacterSetTable *T, unsigned char *data, const size_t
|
||||
|
||||
/* >>> Loop until rowsCur<44 */
|
||||
do {
|
||||
int charCur=0;
|
||||
int fOneLiner=1; /* First try one-Liner */
|
||||
int charCur=0;
|
||||
int fOneLiner=1; /* First try one-Liner */
|
||||
memset(pSet,0,dataLength*sizeof(int));
|
||||
rowsCur=0;
|
||||
|
||||
@ -466,7 +466,7 @@ static int Rows2Columns(CharacterSetTable *T, unsigned char *data, const size_t
|
||||
testColumns = 1;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
for (;;) {
|
||||
int errorCur;
|
||||
pTestList[testListSize] = testColumns;
|
||||
testListSize++;
|
||||
@ -1004,3 +1004,4 @@ int codablock(struct zint_symbol *symbol,const unsigned char source[], const siz
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -467,7 +467,7 @@ int c93(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
void CheckCharacter() {
|
||||
|
||||
if (value == target_value) {
|
||||
int i;
|
||||
int i;
|
||||
/* Target reached - save the generated pattern */
|
||||
strcpy(pattern, "11110");
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -1404,7 +1404,7 @@ int code_one(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
unsigned int data[1500], ecc[600];
|
||||
unsigned int sub_data[190], sub_ecc[75];
|
||||
unsigned int stream[2100];
|
||||
int data_length;
|
||||
int data_length;
|
||||
int data_blocks;
|
||||
|
||||
for (i = 0; i < 1500; i++) {
|
||||
@ -1769,3 +1769,4 @@ int code_one(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ void grwp(int *indexliste) {
|
||||
if (*(indexliste) > 1) {
|
||||
int i = 1;
|
||||
while (i < *(indexliste)) {
|
||||
if (list[1][i - 1] == list[1][i]) {
|
||||
if (list[1][i - 1] == list[1][i]) {
|
||||
int j;
|
||||
/* bring together */
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ static void grwp16(unsigned int *indexliste) {
|
||||
if (*(indexliste) > 1) {
|
||||
int i = 1;
|
||||
while(i < (int)*(indexliste)) {
|
||||
if (list[1][i - 1] == list[1][i]) {
|
||||
if (list[1][i - 1] == list[1][i]) {
|
||||
int j;
|
||||
/* bring together */
|
||||
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;
|
||||
|
||||
for (current_row = 0; current_row < rows_needed; current_row++) {
|
||||
unsigned int writer;
|
||||
int flip_flop;
|
||||
unsigned int writer;
|
||||
int flip_flop;
|
||||
|
||||
strcpy(width_pattern, "");
|
||||
strcat(width_pattern, C16KStartStop[C16KStartValues[current_row]]);
|
||||
@ -733,3 +733,4 @@ int code16k(struct zint_symbol *symbol, unsigned char source[], const size_t len
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1004,7 +1004,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha
|
||||
/* No date data */
|
||||
strcat(binary_string, "11");
|
||||
read_posn = 2;
|
||||
} else {
|
||||
} else {
|
||||
long int group_val;
|
||||
/* Production Date (11) or Expiration Date (17) */
|
||||
char date_str[4];
|
||||
@ -1120,11 +1120,11 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha
|
||||
test3 = 1;
|
||||
}
|
||||
|
||||
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;
|
||||
char numeric_part[4];
|
||||
int numeric_value;
|
||||
int table3_letter;
|
||||
/* Encodation method "11" can be used */
|
||||
strcat(binary_string, "11");
|
||||
|
||||
@ -1873,3 +1873,4 @@ int composite(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
|
||||
return error_number;
|
||||
}
|
||||
|
||||
|
@ -1240,7 +1240,7 @@ int data_matrix_200(struct zint_symbol *symbol,const unsigned char source[], con
|
||||
}
|
||||
#endif
|
||||
{ // placement
|
||||
int x, y, NC, NR, *places;
|
||||
int x, y, NC, NR, *places;
|
||||
unsigned char *grid;
|
||||
NC = W - 2 * (W / FW);
|
||||
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->width = W;
|
||||
|
||||
|
||||
return error_number;
|
||||
}
|
||||
|
||||
@ -1315,3 +1315,4 @@ int dmatrix(struct zint_symbol *symbol, const unsigned char source[], const size
|
||||
|
||||
return error_number;
|
||||
}
|
||||
|
||||
|
@ -745,7 +745,7 @@ int emf_plot(struct zint_symbol *symbol) {
|
||||
}
|
||||
|
||||
/* 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) {
|
||||
@ -1222,3 +1222,4 @@ int emf_plot(struct zint_symbol *symbol) {
|
||||
}
|
||||
return error_number;
|
||||
}
|
||||
|
||||
|
@ -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 */
|
||||
wp = 0;
|
||||
for (i = 0; i < (b1 + b2); i++) {
|
||||
int data_size;
|
||||
int data_size;
|
||||
if (i < b1) {
|
||||
block_size = n1;
|
||||
} else {
|
||||
@ -1207,3 +1207,4 @@ int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], size_t
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1254,7 +1254,7 @@ int han_xin(struct zint_symbol *symbol, const unsigned char source[], size_t len
|
||||
gbdata[i] = (int) source[i];
|
||||
}
|
||||
} else {
|
||||
int posn;
|
||||
int posn;
|
||||
/* Convert Unicode input to GB-18030 */
|
||||
int error_number = utf8toutf16(symbol, source, utfdata, &length);
|
||||
if (error_number != 0) {
|
||||
@ -1570,3 +1570,4 @@ int han_xin(struct zint_symbol *symbol, const unsigned char source[], size_t len
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -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 */
|
||||
int countrycode;
|
||||
int service;
|
||||
int countrycode;
|
||||
int service;
|
||||
if (lp == 0) { /* Mode set manually means lp doesn't get set */
|
||||
lp = strlen(symbol->primary);
|
||||
}
|
||||
@ -733,3 +733,4 @@ int maxicode(struct zint_symbol *symbol, unsigned char local_source[], const int
|
||||
|
||||
return internal_error;
|
||||
}
|
||||
|
||||
|
@ -280,7 +280,7 @@ int code32(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
/* Convert from decimal to base-32 */
|
||||
devisor = 33554432;
|
||||
for (i = 5; i >= 0; i--) {
|
||||
long int remainder;
|
||||
long int remainder;
|
||||
codeword[i] = pharmacode / devisor;
|
||||
remainder = pharmacode % devisor;
|
||||
pharmacode = remainder;
|
||||
@ -305,3 +305,4 @@ int code32(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
|
||||
return error_number;
|
||||
}
|
||||
|
||||
|
344
backend/pcx.c
344
backend/pcx.c
@ -1,172 +1,172 @@
|
||||
/* pcx.c - Handles output to ZSoft PCX file */
|
||||
|
||||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2009-2017 Robin Stuart <rstuart114@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
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
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
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
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "common.h"
|
||||
#include "pcx.h" /* PCX header structure */
|
||||
#include <math.h>
|
||||
#ifdef _MSC_VER
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#define SSET "0123456789ABCDEF"
|
||||
|
||||
int pcx_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
||||
int fgred, fggrn, fgblu, bgred, bggrn, bgblu;
|
||||
int row, column, i, colour;
|
||||
int run_count;
|
||||
FILE *pcx_file;
|
||||
pcx_header_t header;
|
||||
#ifdef _MSC_VER
|
||||
unsigned char* rle_row;
|
||||
#endif
|
||||
|
||||
#ifndef _MSC_VER
|
||||
unsigned char rle_row[symbol->bitmap_width];
|
||||
#else
|
||||
rle_row = (unsigned char *) _alloca((symbol->bitmap_width * 6) * sizeof (unsigned char));
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
fgred = (16 * ctoi(symbol->fgcolour[0])) + ctoi(symbol->fgcolour[1]);
|
||||
fggrn = (16 * ctoi(symbol->fgcolour[2])) + ctoi(symbol->fgcolour[3]);
|
||||
fgblu = (16 * ctoi(symbol->fgcolour[4])) + ctoi(symbol->fgcolour[5]);
|
||||
bgred = (16 * ctoi(symbol->bgcolour[0])) + ctoi(symbol->bgcolour[1]);
|
||||
bggrn = (16 * ctoi(symbol->bgcolour[2])) + ctoi(symbol->bgcolour[3]);
|
||||
bgblu = (16 * ctoi(symbol->bgcolour[4])) + ctoi(symbol->bgcolour[5]);
|
||||
|
||||
|
||||
header.manufacturer = 10; // ZSoft
|
||||
header.version = 5; // Version 3.0
|
||||
header.encoding = 1; // Run length encoding
|
||||
header.bits_per_pixel = 8;
|
||||
header.window_xmin = 0;
|
||||
header.window_ymin = 0;
|
||||
header.window_xmax = symbol->bitmap_width - 1;
|
||||
header.window_ymax = symbol->bitmap_height - 1;
|
||||
header.horiz_dpi = 300;
|
||||
header.vert_dpi = 300;
|
||||
|
||||
for (i = 0; i < 48; i++) {
|
||||
header.colourmap[i] = 0x00;
|
||||
}
|
||||
|
||||
header.reserved = 0;
|
||||
header.number_of_planes = 3;
|
||||
|
||||
if (symbol->bitmap_width % 2) {
|
||||
header.bytes_per_line = symbol->bitmap_width + 1;
|
||||
} else {
|
||||
header.bytes_per_line = symbol->bitmap_width;
|
||||
}
|
||||
|
||||
header.palette_info = 1; // Colour
|
||||
header.horiz_screen_size = 0;
|
||||
header.vert_screen_size = 0;
|
||||
|
||||
for (i = 0; i < 54; i++) {
|
||||
header.filler[i] = 0x00;
|
||||
}
|
||||
|
||||
/* Open output file in binary mode */
|
||||
if (symbol->output_options & BARCODE_STDOUT) {
|
||||
#ifdef _MSC_VER
|
||||
if (-1 == _setmode(_fileno(stdout), _O_BINARY)) {
|
||||
strcpy(symbol->errtxt, "620: Can't open output file");
|
||||
return ZINT_ERROR_FILE_ACCESS;
|
||||
}
|
||||
#endif
|
||||
pcx_file = stdout;
|
||||
} else {
|
||||
if (!(pcx_file = fopen(symbol->outfile, "wb"))) {
|
||||
strcpy(symbol->errtxt, "621: Can't open output file");
|
||||
return ZINT_ERROR_FILE_ACCESS;
|
||||
}
|
||||
}
|
||||
|
||||
fwrite(&header, sizeof (pcx_header_t), 1, pcx_file);
|
||||
|
||||
for (row = 0; row < symbol->bitmap_height; row++) {
|
||||
for (colour = 0; colour < 3; colour++) {
|
||||
for (column = 0; column < symbol->bitmap_width; column++) {
|
||||
switch (colour) {
|
||||
case 0:
|
||||
if (pixelbuf[(row * symbol->bitmap_width) + column] == '1') {
|
||||
rle_row[column] = fgred;
|
||||
} else {
|
||||
rle_row[column] = bgred;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (pixelbuf[(row * symbol->bitmap_width) + column] == '1') {
|
||||
rle_row[column] = fggrn;
|
||||
} else {
|
||||
rle_row[column] = bggrn;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (pixelbuf[(row * symbol->bitmap_width) + column] == '1') {
|
||||
rle_row[column] = fgblu;
|
||||
} else {
|
||||
rle_row[column] = bgblu;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
run_count = 1;
|
||||
for (column = 1; column < symbol->bitmap_width; column++) {
|
||||
if ((rle_row[column - 1] == rle_row[column]) && (run_count < 63)) {
|
||||
run_count++;
|
||||
} else {
|
||||
run_count += 0xc0;
|
||||
fputc(run_count, pcx_file);
|
||||
fputc(rle_row[column - 1], pcx_file);
|
||||
run_count = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (run_count > 1) {
|
||||
run_count += 0xc0;
|
||||
fputc(run_count, pcx_file);
|
||||
fputc(rle_row[column - 1], pcx_file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose(pcx_file);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* pcx.c - Handles output to ZSoft PCX file */
|
||||
|
||||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2009-2017 Robin Stuart <rstuart114@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
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
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
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
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "common.h"
|
||||
#include "pcx.h" /* PCX header structure */
|
||||
#include <math.h>
|
||||
#ifdef _MSC_VER
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#define SSET "0123456789ABCDEF"
|
||||
|
||||
int pcx_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
||||
int fgred, fggrn, fgblu, bgred, bggrn, bgblu;
|
||||
int row, column, i, colour;
|
||||
int run_count;
|
||||
FILE *pcx_file;
|
||||
pcx_header_t header;
|
||||
#ifdef _MSC_VER
|
||||
unsigned char* rle_row;
|
||||
#endif
|
||||
|
||||
#ifndef _MSC_VER
|
||||
unsigned char rle_row[symbol->bitmap_width];
|
||||
#else
|
||||
rle_row = (unsigned char *) _alloca((symbol->bitmap_width * 6) * sizeof (unsigned char));
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
fgred = (16 * ctoi(symbol->fgcolour[0])) + ctoi(symbol->fgcolour[1]);
|
||||
fggrn = (16 * ctoi(symbol->fgcolour[2])) + ctoi(symbol->fgcolour[3]);
|
||||
fgblu = (16 * ctoi(symbol->fgcolour[4])) + ctoi(symbol->fgcolour[5]);
|
||||
bgred = (16 * ctoi(symbol->bgcolour[0])) + ctoi(symbol->bgcolour[1]);
|
||||
bggrn = (16 * ctoi(symbol->bgcolour[2])) + ctoi(symbol->bgcolour[3]);
|
||||
bgblu = (16 * ctoi(symbol->bgcolour[4])) + ctoi(symbol->bgcolour[5]);
|
||||
|
||||
|
||||
header.manufacturer = 10; // ZSoft
|
||||
header.version = 5; // Version 3.0
|
||||
header.encoding = 1; // Run length encoding
|
||||
header.bits_per_pixel = 8;
|
||||
header.window_xmin = 0;
|
||||
header.window_ymin = 0;
|
||||
header.window_xmax = symbol->bitmap_width - 1;
|
||||
header.window_ymax = symbol->bitmap_height - 1;
|
||||
header.horiz_dpi = 300;
|
||||
header.vert_dpi = 300;
|
||||
|
||||
for (i = 0; i < 48; i++) {
|
||||
header.colourmap[i] = 0x00;
|
||||
}
|
||||
|
||||
header.reserved = 0;
|
||||
header.number_of_planes = 3;
|
||||
|
||||
if (symbol->bitmap_width % 2) {
|
||||
header.bytes_per_line = symbol->bitmap_width + 1;
|
||||
} else {
|
||||
header.bytes_per_line = symbol->bitmap_width;
|
||||
}
|
||||
|
||||
header.palette_info = 1; // Colour
|
||||
header.horiz_screen_size = 0;
|
||||
header.vert_screen_size = 0;
|
||||
|
||||
for (i = 0; i < 54; i++) {
|
||||
header.filler[i] = 0x00;
|
||||
}
|
||||
|
||||
/* Open output file in binary mode */
|
||||
if (symbol->output_options & BARCODE_STDOUT) {
|
||||
#ifdef _MSC_VER
|
||||
if (-1 == _setmode(_fileno(stdout), _O_BINARY)) {
|
||||
strcpy(symbol->errtxt, "620: Can't open output file");
|
||||
return ZINT_ERROR_FILE_ACCESS;
|
||||
}
|
||||
#endif
|
||||
pcx_file = stdout;
|
||||
} else {
|
||||
if (!(pcx_file = fopen(symbol->outfile, "wb"))) {
|
||||
strcpy(symbol->errtxt, "621: Can't open output file");
|
||||
return ZINT_ERROR_FILE_ACCESS;
|
||||
}
|
||||
}
|
||||
|
||||
fwrite(&header, sizeof (pcx_header_t), 1, pcx_file);
|
||||
|
||||
for (row = 0; row < symbol->bitmap_height; row++) {
|
||||
for (colour = 0; colour < 3; colour++) {
|
||||
for (column = 0; column < symbol->bitmap_width; column++) {
|
||||
switch (colour) {
|
||||
case 0:
|
||||
if (pixelbuf[(row * symbol->bitmap_width) + column] == '1') {
|
||||
rle_row[column] = fgred;
|
||||
} else {
|
||||
rle_row[column] = bgred;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (pixelbuf[(row * symbol->bitmap_width) + column] == '1') {
|
||||
rle_row[column] = fggrn;
|
||||
} else {
|
||||
rle_row[column] = bggrn;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (pixelbuf[(row * symbol->bitmap_width) + column] == '1') {
|
||||
rle_row[column] = fgblu;
|
||||
} else {
|
||||
rle_row[column] = bgblu;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
run_count = 1;
|
||||
for (column = 1; column < symbol->bitmap_width; column++) {
|
||||
if ((rle_row[column - 1] == rle_row[column]) && (run_count < 63)) {
|
||||
run_count++;
|
||||
} else {
|
||||
run_count += 0xc0;
|
||||
fputc(run_count, pcx_file);
|
||||
fputc(rle_row[column - 1], pcx_file);
|
||||
run_count = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (run_count > 1) {
|
||||
run_count += 0xc0;
|
||||
fputc(run_count, pcx_file);
|
||||
fputc(rle_row[column - 1], pcx_file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose(pcx_file);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ void regroupe(int *indexliste) {
|
||||
int i = 1;
|
||||
while (i < *(indexliste)) {
|
||||
if (liste[1][i - 1] == liste[1][i]) {
|
||||
int j;
|
||||
int j;
|
||||
/* bring together */
|
||||
liste[0][i - 1] = liste[0][i - 1] + liste[0][i];
|
||||
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]);
|
||||
}
|
||||
} else {
|
||||
int len;
|
||||
int len;
|
||||
/* select the switch for multiple of 6 bytes */
|
||||
if (length % 6 == 0) {
|
||||
chainemc[(*mclength)++] = 924;
|
||||
@ -439,7 +439,7 @@ void byteprocess(int *chainemc, int *mclength, unsigned char chaine[], int start
|
||||
|
||||
len = 0;
|
||||
|
||||
while (len < length) {
|
||||
while (len < length) {
|
||||
uint64_t total;
|
||||
unsigned int chunkLen = length - len;
|
||||
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;
|
||||
while (j < length) {
|
||||
int longueur;
|
||||
int longueur;
|
||||
int dumlength = 0;
|
||||
strcpy(chainemod, "");
|
||||
longueur = length - j;
|
||||
@ -1288,3 +1288,4 @@ int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], const size_
|
||||
|
||||
return codeerr;
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
||||
|
||||
/* Pixel Plotting */
|
||||
for (row = 0; row < symbol->bitmap_height; row++) {
|
||||
unsigned char *image_data;
|
||||
unsigned char *image_data;
|
||||
for (column = 0; column < symbol->bitmap_width; column++) {
|
||||
i = column * 3;
|
||||
switch (*(pixelbuf + (symbol->bitmap_width * row) + column)) {
|
||||
@ -189,3 +189,4 @@ int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
||||
return 0;
|
||||
}
|
||||
#endif /* NO_PNG */
|
||||
|
||||
|
@ -404,7 +404,7 @@ int ps_plot(struct zint_symbol *symbol) {
|
||||
int addon_latch = 0;
|
||||
|
||||
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 */
|
||||
if (symbol->row_height[this_row] == 0) {
|
||||
row_height = large_bar_height;
|
||||
@ -973,3 +973,4 @@ int ps_plot(struct zint_symbol *symbol) {
|
||||
|
||||
return error_number;
|
||||
}
|
||||
|
||||
|
@ -1422,7 +1422,7 @@ int qr_code(struct zint_symbol *symbol, const unsigned char source[], size_t len
|
||||
if (utfdata[i] <= 0xff) {
|
||||
jisdata[i] = utfdata[i];
|
||||
} else {
|
||||
int glyph = 0;
|
||||
int glyph = 0;
|
||||
j = 0;
|
||||
do {
|
||||
if (sjis_lookup[j * 2] == utfdata[i]) {
|
||||
@ -1648,8 +1648,8 @@ static int micro_qr_intermediate(char binary[], const int jisdata[], const char
|
||||
}
|
||||
|
||||
do {
|
||||
char data_block;
|
||||
int short_data_block_length = 0;
|
||||
char data_block;
|
||||
int short_data_block_length = 0;
|
||||
if (strlen(binary) > 128) {
|
||||
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) {
|
||||
jisdata[i] = utfdata[i];
|
||||
} else {
|
||||
int glyph = 0;
|
||||
int glyph = 0;
|
||||
j = 0;
|
||||
do {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ void draw_letter(char *pixelbuf, unsigned char letter, int xposn, int yposn, int
|
||||
|
||||
if (skip == 0) {
|
||||
int glyph_no;
|
||||
int x, y;
|
||||
int x, y;
|
||||
if (letter > 128) {
|
||||
glyph_no = letter - 66;
|
||||
} 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 */
|
||||
for (r = 0; r < symbol->rows; r++) {
|
||||
int plot_yposn;
|
||||
int plot_height;
|
||||
int plot_yposn;
|
||||
int plot_height;
|
||||
int this_row = symbol->rows - r - 1; /* invert r otherwise plots upside down */
|
||||
row_posn += row_height;
|
||||
plot_yposn = next_yposn;
|
||||
@ -1142,3 +1142,4 @@ int plot_raster(struct zint_symbol *symbol, int rotate_angle, int file_type) {
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,7 @@ int render_plot(struct zint_symbol *symbol, float width, float height) {
|
||||
else if (symbol->symbology == BARCODE_CODE49) {
|
||||
/* The minimum X-dimension of Code 49 is 0.191mm */
|
||||
if (x_dimension < 0.191) {
|
||||
float encoded_symbol_aspect;
|
||||
float encoded_symbol_aspect;
|
||||
x_dimension = 0.191;
|
||||
width = 0.191 * GL_CONST * 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) {
|
||||
struct zint_render_ring *ring;
|
||||
struct zint_render_ring *ring;
|
||||
/* Maxicode is a fixed size */
|
||||
scaler = GL_CONST; /* Converts from millimeters to the scale used by glabels */
|
||||
render->width = 28.16 * scaler;
|
||||
@ -847,3 +847,4 @@ void render_free(struct zint_symbol *symbol) {
|
||||
symbol->rendered = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -428,9 +428,9 @@ int rss14(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
||||
|
||||
/* Put this data into the symbol */
|
||||
if ((symbol->symbology == BARCODE_RSS14) || (symbol->symbology == BARCODE_RSS14_CC)) {
|
||||
int count;
|
||||
int check_digit;
|
||||
char hrt[15];
|
||||
int count;
|
||||
int check_digit;
|
||||
char hrt[15];
|
||||
writer = 0;
|
||||
latch = '0';
|
||||
for (i = 0; i < 46; i++) {
|
||||
@ -1068,7 +1068,7 @@ int general_rules(char type[]) {
|
||||
block[1][block_count] = type[0];
|
||||
|
||||
for (i = 1; i < strlen(type); i++) {
|
||||
char last;
|
||||
char last;
|
||||
current = type[i];
|
||||
last = type[i - 1];
|
||||
|
||||
@ -1084,7 +1084,7 @@ int general_rules(char type[]) {
|
||||
block_count++;
|
||||
|
||||
for (i = 0; i < block_count; i++) {
|
||||
char next;
|
||||
char next;
|
||||
current = block[1][i];
|
||||
next = (block[1][i + 1] & 0xFF);
|
||||
|
||||
@ -2099,8 +2099,8 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
||||
}
|
||||
|
||||
} else {
|
||||
int stack_rows;
|
||||
int current_row, current_block, left_to_right;
|
||||
int stack_rows;
|
||||
int current_row, current_block, left_to_right;
|
||||
/* RSS Expanded Stacked */
|
||||
|
||||
/* 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;
|
||||
for (current_row = 1; current_row <= stack_rows; current_row++) {
|
||||
int special_case_row = 0;
|
||||
int elements_in_sub;
|
||||
int special_case_row = 0;
|
||||
int elements_in_sub;
|
||||
int sub_elements[235];
|
||||
for (i = 0; i < 235; i++) {
|
||||
sub_elements[i] = 0;
|
||||
@ -2312,3 +2312,4 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -42,11 +42,12 @@ typedef BYTE uint8_t;
|
||||
typedef WORD uint16_t;
|
||||
typedef DWORD uint32_t;
|
||||
typedef INT32 int32_t;
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* STDINT_MSVC_H */
|
||||
|
||||
|
@ -37,19 +37,19 @@
|
||||
- Added Codablock F options "-rows".
|
||||
- Adopted to new image format of zint
|
||||
2016-10-14 2.5.2 HaO
|
||||
- Include the upstream reverted image format
|
||||
2016-12-12 2.5.3 HaO
|
||||
- No changes here, take 2.5.1 framework files
|
||||
2017-05-12 2.6.0 HaO
|
||||
- Include the upstream reverted image format
|
||||
2016-12-12 2.5.3 HaO
|
||||
- No changes here, take 2.5.1 framework files
|
||||
2017-05-12 2.6.0 HaO
|
||||
- No changes here, take 2.6 framework files
|
||||
2017-08-29 2.6.1 HaO
|
||||
- Framework 2.6.1 extensions
|
||||
- EAN/UPC Codes with included check digit
|
||||
- UPNQR Code
|
||||
- Misspelled symbology: AztecRunes
|
||||
2017-10-23 2.6.2 HaO
|
||||
- Framework 2.6.2 bugfixes
|
||||
- Allow dll unload
|
||||
2017-08-29 2.6.1 HaO
|
||||
- Framework 2.6.1 extensions
|
||||
- EAN/UPC Codes with included check digit
|
||||
- UPNQR Code
|
||||
- Misspelled symbology: AztecRunes
|
||||
2017-10-23 2.6.2 HaO
|
||||
- Framework 2.6.2 bugfixes
|
||||
- Allow dll unload
|
||||
*/
|
||||
|
||||
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
|
||||
@ -99,7 +99,7 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* >>>> External Prototypes (exports) */
|
||||
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 */
|
||||
static int Zint(ClientData unused, Tcl_Interp *interp, int objc,
|
||||
@ -120,7 +120,7 @@ static char *s_code_list[] = {
|
||||
"Ind2of5",
|
||||
"Code39",
|
||||
"Code39Extended",
|
||||
"EAN",
|
||||
"EAN",
|
||||
"EAN+Check",
|
||||
"GS1-128",
|
||||
"Codabar",
|
||||
@ -135,10 +135,10 @@ static char *s_code_list[] = {
|
||||
"GS1DataBarLimited",
|
||||
"GS1DataBarExpanded",
|
||||
"Telepen",
|
||||
"UPC-A",
|
||||
"UPC-A",
|
||||
"UPC-A+Check",
|
||||
"UPC-E",
|
||||
"UPC-E+Check",
|
||||
"UPC-E+Check",
|
||||
"Postnet",
|
||||
"MSIPlessey",
|
||||
"FIM",
|
||||
@ -183,8 +183,8 @@ static char *s_code_list[] = {
|
||||
"HIBC-PDF",
|
||||
"HIBC-MicroPDF",
|
||||
"HIBC-CodablockF",
|
||||
"HIBCAztec",
|
||||
"DotCode",
|
||||
"HIBCAztec",
|
||||
"DotCode",
|
||||
"HanXin",
|
||||
"AztecRunes",
|
||||
"Code32",
|
||||
@ -213,7 +213,7 @@ static int s_code_number[] = {
|
||||
BARCODE_C25IND,
|
||||
BARCODE_CODE39,
|
||||
BARCODE_EXCODE39,
|
||||
BARCODE_EANX,
|
||||
BARCODE_EANX,
|
||||
BARCODE_EANX_CHK,
|
||||
BARCODE_EAN128,
|
||||
BARCODE_CODABAR,
|
||||
@ -228,10 +228,10 @@ static int s_code_number[] = {
|
||||
BARCODE_RSS_LTD,
|
||||
BARCODE_RSS_EXP,
|
||||
BARCODE_TELEPEN,
|
||||
BARCODE_UPCA,
|
||||
BARCODE_UPCA,
|
||||
BARCODE_UPCA_CHK,
|
||||
BARCODE_UPCE,
|
||||
BARCODE_UPCE_CHK,
|
||||
BARCODE_UPCE_CHK,
|
||||
BARCODE_POSTNET,
|
||||
BARCODE_MSI_PLESSEY,
|
||||
BARCODE_FIM,
|
||||
@ -276,8 +276,8 @@ static int s_code_number[] = {
|
||||
BARCODE_HIBC_PDF,
|
||||
BARCODE_HIBC_MICPDF,
|
||||
BARCODE_HIBC_BLOCKF,
|
||||
BARCODE_HIBC_AZTEC,
|
||||
BARCODE_DOTCODE,
|
||||
BARCODE_HIBC_AZTEC,
|
||||
BARCODE_DOTCODE,
|
||||
BARCODE_HANXIN,
|
||||
BARCODE_AZRUNE,
|
||||
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"
|
||||
" Generate barcode in tk images and in file output\n"
|
||||
"Usage:\n"
|
||||
" zint encode data photo option value...\n"
|
||||
" data: data to encode in the symbol\n"
|
||||
" zint encode data photo option value...\n"
|
||||
" data: data to encode in the symbol\n"
|
||||
" photo: a tcl photo image handle ('p' after 'image create photo p')\n"
|
||||
" Available options:\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;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
// >>>> Unload Procedures
|
||||
//------------------------------------------------------------------------------
|
||||
EXPORT int Zint_Unload (Tcl_Interp *Interp, int Flags)
|
||||
{
|
||||
// Allow unload
|
||||
return TCL_OK;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
// >>>> Unload Procedures
|
||||
//------------------------------------------------------------------------------
|
||||
EXPORT int Zint_Unload (Tcl_Interp *Interp, int Flags)
|
||||
{
|
||||
// Allow unload
|
||||
return TCL_OK;
|
||||
}
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* >>>>> Called routine */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
@ -851,3 +851,4 @@ static int Encode(Tcl_Interp *interp, int objc,
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user