mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-16 08:04:36 -04:00
Allow selection of GS1 mode on GS1 symbols
Because some symbols require GS1 data, selecting GS1 mode for them would result in GS1 parsing being done twice, corrupting the data. Fixes #165 reported by Gregory Van Vooren
This commit is contained in:
parent
eb3a004ace
commit
ff2ceea361
4 changed files with 45 additions and 64 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2008-2017 Robin Stuart <rstuart114@gmail.com>
|
||||
Copyright (C) 2008-2019 Robin Stuart <rstuart114@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
|
@ -1865,23 +1865,14 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
|||
int check_char, c_odd, c_even, elements[235], pattern_width, reader, writer;
|
||||
int separator_row;
|
||||
#ifndef _MSC_VER
|
||||
char reduced[src_len + 1], binary_string[(7 * src_len) + 1];
|
||||
char binary_string[(7 * src_len) + 1];
|
||||
#else
|
||||
char* reduced = (char*) _alloca(src_len + 1);
|
||||
char* binary_string = (char*) _alloca((7 * src_len) + 1);
|
||||
#endif
|
||||
|
||||
separator_row = 0;
|
||||
reader = 0;
|
||||
|
||||
if (symbol->input_mode != GS1_MODE) {
|
||||
/* GS1 data has not been verified yet */
|
||||
i = gs1_verify(symbol, source, src_len, reduced);
|
||||
if (i != 0) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
if ((symbol->symbology == BARCODE_RSS_EXP_CC) || (symbol->symbology == BARCODE_RSS_EXPSTACK_CC)) {
|
||||
/* make space for a composite separator pattern */
|
||||
separator_row = symbol->rows;
|
||||
|
@ -1897,7 +1888,7 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
|||
strcat(binary_string, "0");
|
||||
}
|
||||
|
||||
i = rss_binary_string(symbol, reduced, binary_string);
|
||||
i = rss_binary_string(symbol, (char *) source, binary_string);
|
||||
if (i != 0) {
|
||||
return i;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue