1
0
mirror of https://git.code.sf.net/p/zint/code synced 2026-01-10 13:36:02 +00:00

synchronized with master

This commit is contained in:
tgotic
2011-05-04 21:48:06 +02:00
parent 534bc69609
commit 891570299c
20 changed files with 159 additions and 135 deletions

View File

@@ -36,6 +36,10 @@ static char *C25IndustTable[10] = {"1111313111", "3111111131", "1131111131", "31
static char *C25InterTable[10] = {"11331", "31113", "13113", "33111", "11313", "31311", "13311", "11133",
"31131", "13131"};
static inline char check_digit(unsigned int count)
{
return itoc((10 - (count % 10)) % 10);
}
int matrix_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length)
{ /* Code 2 of 5 Standard (Code 2 of 5 Matrix) */
@@ -235,7 +239,7 @@ int interleaved_two_of_five(struct zint_symbol *symbol, unsigned char source[],
int itf14(struct zint_symbol *symbol, unsigned char source[], int length)
{
int i, error_number, zeroes;
unsigned int count, check_digit;
unsigned int count;
char localstr[16];
error_number = 0;
@@ -269,9 +273,7 @@ int itf14(struct zint_symbol *symbol, unsigned char source[], int length)
count += 2 * ctoi(localstr[i]);
}
}
check_digit = 10 - (count%10);
if (check_digit == 10) { check_digit = 0; }
localstr[13] = itoc(check_digit);
localstr[13] = check_digit(count);
localstr[14] = '\0';
error_number = interleaved_two_of_five(symbol, (unsigned char *)localstr, strlen(localstr));
ustrcpy(symbol->text, (unsigned char*)localstr);
@@ -281,7 +283,7 @@ int itf14(struct zint_symbol *symbol, unsigned char source[], int length)
int dpleit(struct zint_symbol *symbol, unsigned char source[], int length)
{ /* Deutshe Post Leitcode */
int i, error_number;
unsigned int count, check_digit;
unsigned int count;
char localstr[16];
int zeroes;
@@ -310,9 +312,7 @@ int dpleit(struct zint_symbol *symbol, unsigned char source[], int length)
count += 5 * ctoi(localstr[i]);
}
}
check_digit = 10 - (count%10);
if (check_digit == 10) { check_digit = 0; }
localstr[13] = itoc(check_digit);
localstr[13] = check_digit(count);
localstr[14] = '\0';
error_number = interleaved_two_of_five(symbol, (unsigned char *)localstr, strlen(localstr));
ustrcpy(symbol->text, (unsigned char*)localstr);
@@ -322,7 +322,7 @@ int dpleit(struct zint_symbol *symbol, unsigned char source[], int length)
int dpident(struct zint_symbol *symbol, unsigned char source[], int length)
{ /* Deutsche Post Identcode */
int i, error_number, zeroes;
unsigned int count, check_digit;
unsigned int count;
char localstr[16];
count = 0;
@@ -349,9 +349,7 @@ int dpident(struct zint_symbol *symbol, unsigned char source[], int length)
count += 5 * ctoi(localstr[i]);
}
}
check_digit = 10 - (count%10);
if (check_digit == 10) { check_digit = 0; }
localstr[11] = itoc(check_digit);
localstr[11] = check_digit(count);
localstr[12] = '\0';
error_number = interleaved_two_of_five(symbol, (unsigned char *)localstr, strlen(localstr));
ustrcpy(symbol->text, (unsigned char*)localstr);

View File

@@ -43,39 +43,24 @@ static char *AusBarTable[64] = {"000", "001", "002", "003", "010", "011", "012",
#include "common.h"
#include "reedsol.h"
static inline char convert_pattern(char data, int shift)
{
return (data - '0') << shift;
}
void rs_error(char data_pattern[])
{
/* Adds Reed-Solomon error correction to auspost */
int reader, triple_writer;
int reader, triple_writer = 0;
char triple[31], inv_triple[31];
unsigned char result[5];
triple_writer = 0;
for(reader = 2; reader < strlen(data_pattern); reader+= 3)
{
triple[triple_writer] = 0;
switch(data_pattern[reader])
for(reader = 2; reader < strlen(data_pattern); reader += 3, triple_writer++)
{
case '1': triple[triple_writer] += 16; break;
case '2': triple[triple_writer] += 32; break;
case '3': triple[triple_writer] += 48; break;
}
switch(data_pattern[reader + 1])
{
case '1': triple[triple_writer] += 4; break;
case '2': triple[triple_writer] += 8; break;
case '3': triple[triple_writer] += 12; break;
}
switch(data_pattern[reader + 2])
{
case '1': triple[triple_writer] += 1; break;
case '2': triple[triple_writer] += 2; break;
case '3': triple[triple_writer] += 3; break;
}
triple_writer++;
triple[triple_writer] = convert_pattern(data_pattern[reader], 4)
+ convert_pattern(data_pattern[reader + 1], 2)
+ convert_pattern(data_pattern[reader + 2], 0);
}
for(reader = 0; reader < triple_writer; reader++)
@@ -113,23 +98,35 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt
char data_pattern[200];
char fcc[3] = { 0 };
char dpid[10];
char localstr[30];
char localstr[30] = { 0 };
error_number = 0;
strcpy(localstr, "");
/* Do all of the length checking first to avoid stack smashing */
if(symbol->symbology == BARCODE_AUSPOST) {
/* Format control code (FCC) */
switch(length)
{
case 8: strcpy(fcc, "11"); break;
case 13: strcpy(fcc, "59"); break;
case 16: strcpy(fcc, "59"); error_number = is_sane(NEON, source, length); break;
case 18: strcpy(fcc, "62"); break;
case 23: strcpy(fcc, "62"); error_number = is_sane(NEON, source, length); break;
default: strcpy(symbol->errtxt, "Auspost input is wrong length");
return ZERROR_TOO_LONG;
case 8:
strcpy(fcc, "11");
break;
case 13:
strcpy(fcc, "59");
break;
case 16:
strcpy(fcc, "59");
error_number = is_sane(NEON, source, length);
break;
case 18:
strcpy(fcc, "62");
break;
case 23:
strcpy(fcc, "62");
error_number = is_sane(NEON, source, length);
break;
default:
strcpy(symbol->errtxt, "Auspost input is wrong length");
return ZERROR_TOO_LONG;
break;
}
if(error_number == ZERROR_INVALID_DATA) {
@@ -150,7 +147,6 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt
/* Add leading zeros as required */
zeroes = 8 - length;
memset(localstr, '0', zeroes);
localstr[8] = '\0';
}
concat(localstr, (char*)source);
@@ -195,7 +191,7 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt
lookup(GDSET, AusCTable, localstr[reader], data_pattern);
}
}
if((h == 16) || (h == 23)) {
else if((h == 16) || (h == 23)) {
for(reader = 8; reader < h; reader++) {
lookup(NEON, AusNTable, localstr[reader], data_pattern);
}

View File

@@ -1200,29 +1200,8 @@ int code_one(struct zint_symbol *symbol, unsigned char source[], int length)
data_blocks = c1_blocks[size - 1];
/*
Section 2.2.5.1 states:
"The polynomial arithmetic... is calculated using bit-wise modulo 2 arithmetic
and byte-wise modulo 100101101 arithmetic (this is a Galois Field of 2^8 with
100101101 representing the field's prime modulus polynomial:
x^8 + x^5 + x^3 + x^2 + 1)."
This is the same as Data Matrix (ISO/IEC 16022) however the calculations in Appendix F
of the Code One specification do not agree with those in Annex E of ISO/IEC 16022.
For example Code One Appendix F states:
"The polynomial divisor for generating ten check characters for Version T-16
and Version A is:
g(x)=x^10 + 136x^9 + 141x^8 + 113x^7 + 76x^6 + 218x^5 + 43x^4 + 85x^3
+ 182x^2 + 31x + 52."
Whereas ISO/IEC 16022 Annex E states:
"The polynomial divisor for generating 10 check characters is:
g(x)=x^10 + 61x^9 + 110x^8 + 255x^7 + 116x^6 + 248x^5 + 223x^4 + 166x^3
+ 185x^2 + 24x + 28."
For this code I have assumed that ISO/IEC 16022 is correct and the USS Code One
specifications are incorrect
*/
rs_init_gf(0x12d);
rs_init_code(c1_ecc_blocks[size - 1], 1);
rs_init_code(c1_ecc_blocks[size - 1], 0);
for(i = 0; i < data_blocks; i++) {
for(j = 0; j < c1_data_blocks[size - 1]; j++) {

View File

@@ -775,7 +775,7 @@ void add_tail(unsigned char target[], int tp, int tail_length, int last_mode)
int data_matrix_200(struct zint_symbol *symbol, unsigned char source[], int length)
{
int i, skew = 0;
int inputlen, i, skew = 0;
unsigned char binary[2200];
int binlen;
int symbolsize, optionsize, calcsize;
@@ -783,6 +783,7 @@ int data_matrix_200(struct zint_symbol *symbol, unsigned char source[], int leng
int H, W, FH, FW, datablock, bytes, rsblock;
int last_mode;
unsigned char *grid = 0;
inputlen = length;
binlen = dm200encode(symbol, source, binary, &last_mode, length);

View File

@@ -602,6 +602,9 @@ int maxicode(struct zint_symbol *symbol, unsigned char source[], int length)
}
if((mode == 2) || (mode == 3)) { /* Modes 2 and 3 need data in symbol->primary */
if(lp == 0){ /* Mode set manually means lp doesn't get set */
lp = strlen(symbol->primary);
}
if(lp != 15) {
strcpy(symbol->errtxt, "Invalid Primary String");
return ZERROR_INVALID_DATA;

61
debian/changelog vendored
View File

@@ -1,3 +1,64 @@
zint (2.4.1) unstable; urgency=low
* Update and review of files required by Debian including changelog.
-- Robin Stuart <robin@zint.org.uk> Sat, 02 Oct 2010 09:26:00 +0000
zint (2.4) unstable; urgency=low
* Built extensions to the API for integrating with glabels thanks
to Sam Lown and Jim Evins.
* Added code optimisation and input from stdin thanks to Ismael
Luceno.
* Reinstated escape character input.
* Simplification of Barcode Studio.
-- Robin Stuart <robin@zint.org.uk> Sat, 02 Oct 2010 05:00:00 +0000
zint (2.3.2) unstable; urgency=low
* Corrected many bugs in GS1 DataBar Extended thanks to the careful
study of the code by Pablo Orduña at the PIRAmIDE project.
* Similarly corrected some bugs in Maxicode thanks to Monica Swanson
at Source Technologies.
* Also minor bugfixes for ISBN and Aztec Code, and added some small
features like a --square option in the CLI.
-- Robin Stuart <robin@zint.org.uk> Sat, 02 Oct 2010 04:00:00 +0000
zint (2.3.1) unstable; urgency=low
* Removed Codablock-F.
* Redesigned scale function so that human readable text and Maxicode
symbols can be scaled consistently.
* Corrected encoding bugs with Code 128/Code 16k and Data Matrix ECC
050.
* Added --notext option to CLI.
-- Robin Stuart <robin@zint.org.uk> Sat, 02 Oct 2010 03:00:00 +0000
zint (2.3) unstable; urgency=low
* Fixed problems with Micro QR Code and rebuilt QR Code support
removing dependence on libqrencode.
* Improved Kanji character support for QR Code and Micro QR Code
which now auto-detects and automatically converts to Shift-JIS.
* Added Grid Matrix symbology with Kanji character support and
automatic conversion to GB 2312.
* Removed no_qr compile option.
* Advanced Barcode Studio version number to match library version
number.
-- Robin Stuart <robin@zint.org.uk> Sat, 02 Oct 2010 02:00:00 +0000
zint (2.2.2) unstable; urgency=low
* A beta release previewing the new API structure.
* Better NULL character support with "nullchar" value removed.
* Added loading from file and sequence dialogs in Barcode Studio.
-- Robin Stuart <robin@zint.org.uk> Sat, 02 Oct 2010 01:00:00 +0000
zint (2.2.1-1) unstable; urgency=low
* fix .so version

73
debian/control vendored
View File

@@ -1,64 +1,43 @@
Source: zint
Section: libs
Priority: extra
Maintainer: BogDan Vatra <bogdan@licentia.eu>
Build-Depends: cdbs, debhelper (>= 7), cmake, libpng12-dev, libqrencode-dev, libqt4-dev
Standards-Version: 3.8.1
Maintainer: Robin Stuart <robin@zint.org.uk>
Build-Depends: cdbs, debhelper (>= 7), cmake, libpng12-dev, libqt4-dev
Standards-Version: 3.9.1
Homepage: http://www.zint.org.uk/
Package: libzint
Package: zint
Section: libs
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Zint is an Open Source barcode encoding and image generating library for Linux.
It currently features:
Over 50 symbologies including many not available in any other open source package.
Unicode translation for symbologies which support Latin-1 and Shift-JIS character sets.
Full GS1 support including data verification and automated insertion of FNC1 characters.
Support for encoding binary data including NULL (ASCII 0) characters.
Health Industry Barcode (HIBC) encoding capabilities.
Depends: libpng12-dev
Description: A library for encoding data in barcode symbols.
Zint is an Open Source barcode encoding and image generating library.
It currently features support for over 50 symbologies including
QR Code, Data Matrix, Aztec Code, Code 128, UPC/EAN, HIBC, GS1 DataBar and many others.
Also included are Unicode translation for symbologies which support Latin-1 and Kanji character sets,
full GS1 data support including verification and automated insertion of FNC1 characters and
support for encoding binary data including NULL (ASCII 0) characters.
Package: libzint-dbg
Section: libs
Architecture: any
Priority: extra
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Debugging symbols for Zint library.
This package contains debugging files used to investigate problems with
Zint binaries and libraries.
Package: libzint-dev
Package: zint-devel
Section: libdevel
Architecture: any
Depends: libzint (= ${binary:Version})
Description: Zint development files.
This package contains development files for zint.
Depends: zint (= ${binary:Version})
Description: Zint development files
This package contains development files for the Zint barcode encoding
library.
Package: libqzint
Package: zint-qt
Section: libs
Architecture: any
Depends: libzint (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Qt wrapper over Zint library
This package contains Qt wrapper over Zint library.
Depends: zint (= ${binary:Version}), libqt4-dev
Description: Zint Barcode Studio.
This package contains Zint Barcode Studio, a QT frontend for the Zint
barcode encoding library.
Package: libqzint-dev
Package: zint-qt-devel
Section: libdevel
Architecture: any
Depends: libqzint (= ${binary:Version}), libzint-dev (= ${source:Version})
Depends: zint (= ${binary:Version}), zint-qt (= ${source:Version}), libqt4-dev
Description: QZint development files.
This package contains development files for the Qt wrapper over Zint library..
Package: zintfrontend
Section: libs
Architecture: any
Depends: libzint (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Zint console frontend.
This package contains a console frontend.
Package: qzintfrontend
Section: libs
Architecture: any
Depends: libzint (= ${binary:Version}), libqzint (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Zint QT frontend.
This package contains an easy to use QT frontend.
This package contains development files for the Qt wrapper over the Zint
library.

5
debian/copyright vendored
View File

@@ -1,6 +1,7 @@
This package was debianized by:
BogDan Vatra <bogdan@licentia.eu> on Sat, 11 Apr 2009 23:45:53 +0300
Modified by Robin Stuart <robin@zint.org.uk> on Sat, 02 Oct 2010 11:40:00 +0000
It was downloaded from:
@@ -12,7 +13,7 @@ Upstream Author(s):
Copyright:
<Copyright (C) 2006-2009 Robin Stuart>
<Copyright (C) 2006-2010 Robin Stuart>
License:
@@ -34,6 +35,6 @@ Public License version 3 can be found in `/usr/share/common-licenses/GPL-3'.
The Debian packaging is:
Copyright (C) 2009 BogDan Vatra <bogdan@licentia.eu>
Copyright (C) 2010 Robin Stuart <robin@zint.org.uk>
and is licensed under the GPL version 3, see above.

View File

@@ -1,3 +0,0 @@
usr/include/zint.h
usr/lib/libzint.so
usr/share/cmake-2.6/Modules/FindZint.cmake

View File

@@ -1 +0,0 @@
usr/bin/zint-qt

2
debian/zint-devel.install vendored Normal file
View File

@@ -0,0 +1,2 @@
usr/include/zint.h
usr/lib/libzint.so

View File

@@ -1 +1,2 @@
usr/lib/libQZint.so.*
usr/bin/zint-qt

View File

@@ -1 +1,2 @@
usr/lib/libzint.so.*
usr/bin/zint

View File

@@ -1 +0,0 @@
usr/bin/zint

View File

@@ -1,3 +0,0 @@
Documentation has now been removed from the Zint package in
preference of the online documentation at:
http://www.zint.org.uk

View File

@@ -208,7 +208,7 @@ int batch_process(struct zint_symbol *symbol, char *filename)
char adjusted[2] = { 0 };
if(symbol->outfile[0] == '\0') {
strcpy(format_string, "$$$$$.png");
strcpy(format_string, "~~~~~.png");
} else {
if(strlen(symbol->outfile) < FILENAME_MAX) {
strcpy(format_string, symbol->outfile);
@@ -268,7 +268,7 @@ int batch_process(struct zint_symbol *symbol, char *filename)
adjusted[0] = ' ';
}
break;
case '$':
case '~':
if (inpos > 0) {
adjusted[0] = reverse_number[inpos - 1];
inpos--;
@@ -276,7 +276,7 @@ int batch_process(struct zint_symbol *symbol, char *filename)
adjusted[0] = '0';
}
break;
case '*':
case '@':
if (inpos > 0) {
adjusted[0] = reverse_number[inpos - 1];
inpos--;
@@ -585,6 +585,7 @@ int main(int argc, char **argv)
case 'o':
strncpy(my_symbol->outfile, optarg, FILENAME_MAX - 1);
my_symbol->outfile[FILENAME_MAX - 1] = 0;
break;
case 'r':

View File

@@ -163,10 +163,11 @@ bool MainWindow::save()
void MainWindow::about()
{
QMessageBox::about(this, tr("About Zint"),
tr("<h2>Zint Barcode Studio 2.4.1</h2>"
tr("<h2>Zint Barcode Studio 2.4.2</h2>"
"<p>A free barcode generator"
"<p>Visit the Zint Project Homepage at www.zint.org.uk for more information."
"<p>Copyright &copy; 2010 Robin Stuart.<br>"
"<p>Instruction manual is available from Sourceforge:"
"<p>http://www.sourceforge.net/projects/zint"
"<p>Copyright &copy; 2011 Robin Stuart.<br>"
"Qt4 code by BogDan Vatra, MS Windows port by \"tgotic\".<br>"
"With thanks to Norbert Szab&oacute;, and Robert Elliott."
"<p>Released under the GNU General Public License ver. 3 or later.<br>"

View File

@@ -12,7 +12,7 @@
<file>grpC128.ui</file>
<file>grpChannel.ui</file>
<file>grpCodeOne.ui</file>
<file>grpDBExtend.ui</file>
<file>grpDBExtend.ui</file>
<file>grpDM.ui</file>
<file>grpGrid.ui</file>
<file>grpMaxicode.ui</file>

8
readme
View File

@@ -50,6 +50,14 @@ Simplified GUI. Addition of "render" functions provides an API for
glabels. Corrections to 4-state codes. Simplification in QR code. Added
--dump option and support for reading from stdin.
Version 2.4.1:
Contains bugfixes for Data Matrix and QR Code. Add option to produce multiple
files from the command line. Add option to change font size in PNG images.
Tidy up information for creating Debian packages and for compiling on MS
Visual Studio. Correct bug preventing compilation without PNG support.
Version 2.4.2:
Fix bugs in batch processing - this now works from the command line.
CONTACT ME
----------