code reworked

This commit is contained in:
openapc 2012-12-29 19:37:03 +01:00
parent f48d7ab6a6
commit bf2dbe7494
26 changed files with 284 additions and 499 deletions

View file

@ -3,20 +3,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2008 Robin Stuart <robin@zint.org.uk>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* The functions "getBit", "init928" and "encode928" are copyright BSI and are
@ -710,7 +696,7 @@ int cc_c(struct zint_symbol *symbol, char source[], int cc_width, int ecc_level)
int cc_binary_string(struct zint_symbol *symbol, const char source[], char binary_string[], int cc_mode, int *cc_width, int *ecc, int lin_width)
{ /* Handles all data encodation from section 5 of ISO/IEC 24723 */
int encoding_method, read_posn, d1, d2, value, alpha_pad;
int i, j, mask, ai_crop, ai_crop_posn, fnc1_latch;
int i, j, mask, ai_crop,fnc1_latch;
long int group_val;
int ai90_mode, latch, remainder, binary_length;
char date_str[4];
@ -725,7 +711,6 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
encoding_method = 1;
read_posn = 0;
ai_crop = 0;
ai_crop_posn = -1;
fnc1_latch = 0;
alpha_pad = 0;
ai90_mode = 0;
@ -910,13 +895,11 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
if((source[next_ai_posn + 1] == '2') && (source[next_ai_posn + 2] == '1')) {
/* AI 21 follows */
ai_crop = 1;
ai_crop_posn = next_ai_posn + 1;
}
if((source[next_ai_posn + 1] == '8') && (source[next_ai_posn + 2] == '0') && (source[next_ai_posn + 3] == '0') && (source[next_ai_posn + 4] == '4')) {
/* AI 8004 follows */
ai_crop = 2;
ai_crop_posn = next_ai_posn + 1;
}
}
@ -1740,7 +1723,7 @@ void add_leading_zeroes(struct zint_symbol *symbol)
int composite(struct zint_symbol *symbol, unsigned char source[], int length)
{
int error_number, cc_mode, cc_width, ecc_level;
int j, i, k, separator_row;
int j, i, k;
unsigned int rs = length + 1;
unsigned int bs = 20 * rs;
unsigned int pri_len;
@ -1755,7 +1738,6 @@ int composite(struct zint_symbol *symbol, unsigned char source[], int length)
int top_shift, bottom_shift;
error_number = 0;
separator_row = 0;
pri_len = strlen(symbol->primary);
if(pri_len == 0) {
strcpy(symbol->errtxt, "No primary (linear) message in 2D composite");