From 31cc0ae78a54f39e4976ed95ad4ab419799d1724 Mon Sep 17 00:00:00 2001 From: Boris Zentner Date: Mon, 23 Oct 2017 21:37:52 +0200 Subject: [PATCH] Remove spaces before EOL --- backend/2of5.c | 11 ++- backend/auspost.c | 13 +-- backend/aztec.c | 163 +++++++++++++++++---------------- backend/aztec.h | 11 ++- backend/bmp.c | 11 ++- backend/bmp.h | 17 ++-- backend/codablock.c | 5 +- backend/code.c | 11 ++- backend/code1.c | 27 +++--- backend/code1.h | 12 +-- backend/code128.c | 15 +-- backend/code49.c | 3 +- backend/common.c | 15 +-- backend/composite.c | 47 +++++----- backend/dmatrix.c | 17 ++-- backend/dmatrix.h | 11 ++- backend/dotcode.c | 47 +++++----- backend/eci.c | 11 ++- backend/eci.h | 11 ++- backend/emf.c | 133 ++++++++++++++------------- backend/emf.h | 55 +++++------ backend/gb18030.h | 12 +-- backend/gb2312.h | 11 ++- backend/gif.c | 12 +-- backend/gridmtx.c | 9 +- backend/gridmtx.h | 11 ++- backend/gs1.c | 13 +-- backend/hanxin.c | 61 ++++++------ backend/hanxin.h | 12 +-- backend/imail.c | 21 +++-- backend/large.c | 31 ++++--- backend/large.h | 11 ++- backend/library.c | 107 +++++++++++----------- backend/maxicode.c | 3 +- backend/medical.c | 11 ++- backend/ms_stdint.h | 21 +++-- backend/pcx.c | 11 ++- backend/pcx.h | 15 +-- backend/pdf417.c | 25 ++--- backend/plessey.c | 17 ++-- backend/png.c | 13 +-- backend/postal.c | 21 +++-- backend/ps.c | 3 +- backend/qr.c | 37 ++++---- backend/raster.c | 67 +++++++------- backend/reedsol.c | 19 ++-- backend/reedsol.h | 15 +-- backend/render.c | 21 +++-- backend/rss.c | 77 ++++++++-------- backend/rss.h | 11 ++- backend/sjis.h | 18 ++-- backend/stdint_msvc.h | 11 ++- backend/svg.c | 13 +-- backend/telepen.c | 11 ++- backend/tif.c | 80 ++++++++-------- backend/tif.h | 21 +++-- backend/upcean.c | 15 +-- backend/zint.h | 19 ++-- backend_qt/qzint.cpp | 19 ++-- backend_qt/qzint.h | 9 +- backend_tcl/zint.c | 3 +- frontend/main.c | 15 +-- frontend_qt/barcodeitem.h | 3 +- frontend_qt/datawindow.cpp | 14 +-- frontend_qt/exportwindow.cpp | 21 +++-- frontend_qt/main.cpp | 3 +- frontend_qt/mainwindow.cpp | 83 ++++++++--------- frontend_qt/mainwindow.h | 7 +- frontend_qt/sequencewindow.cpp | 35 +++---- frontend_qt/sequencewindow.h | 6 +- 70 files changed, 906 insertions(+), 844 deletions(-) diff --git a/backend/2of5.c b/backend/2of5.c index 9ea2b4a8..1781821a 100644 --- a/backend/2of5.c +++ b/backend/2of5.c @@ -8,14 +8,14 @@ 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. + 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. + 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. + 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 @@ -26,7 +26,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -356,3 +356,4 @@ int dpident(struct zint_symbol *symbol, unsigned char source[], int length) { return error_number; } + diff --git a/backend/auspost.c b/backend/auspost.c index 96fac8b0..b3f1cbcf 100644 --- a/backend/auspost.c +++ b/backend/auspost.c @@ -8,14 +8,14 @@ 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. + 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. + 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. + 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 @@ -26,8 +26,8 @@ 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. + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. */ #define GDSET "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz #" @@ -254,3 +254,4 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt } + diff --git a/backend/aztec.c b/backend/aztec.c index bc759ba0..d1d5b9ac 100644 --- a/backend/aztec.c +++ b/backend/aztec.c @@ -8,14 +8,14 @@ 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. + 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. + 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. + 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 @@ -26,7 +26,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -34,7 +34,7 @@ #include #include #ifdef _MSC_VER -#include +#include #endif #include "common.h" #include "aztec.h" @@ -46,7 +46,7 @@ static int count_doubles(const unsigned char source[], const int posn, const siz int c = 0; int i = posn; int cond = 1; - + do { if (((source[i] == '.') || (source[i] == ',')) && (source[i + 1] == ' ')) { c++; @@ -63,7 +63,7 @@ static int count_cr(unsigned char source[], int posn, int length) { int c = 0; int i = posn; int cond = 1; - + do { if (source[i] == 13) { c++; @@ -72,7 +72,7 @@ static int count_cr(unsigned char source[], int posn, int length) { } i++; } while ((i < length) && cond); - + return c; } @@ -80,7 +80,7 @@ static int count_dotcomma(unsigned char source[], int posn, int length) { int c = 0; int i = posn; int cond = 1; - + do { if ((source[i] == '.') || (source[i] == ',')) { c++; @@ -89,7 +89,7 @@ static int count_dotcomma(unsigned char source[], int posn, int length) { } i++; } while ((i < length) && cond); - + return c; } @@ -97,7 +97,7 @@ static int count_spaces(unsigned char source[], int posn, int length) { int c = 0; int i = posn; int cond = 1; - + do { if (source[i] == ' ') { c++; @@ -106,13 +106,13 @@ static int count_spaces(unsigned char source[], int posn, int length) { } i++; } while ((i < length) && cond); - + return c; } static char get_next_mode(char encode_mode[], const size_t src_len, const int posn) { int i = posn; - + do { i++; } while ((i < src_len) && (encode_mode[i] == encode_mode[posn])); @@ -124,7 +124,7 @@ static char get_next_mode(char encode_mode[], const size_t src_len, const int po } static int aztec_text_process(const unsigned char source[], const size_t src_len, char binary_string[], const int gs1, const int eci, const int debug) { - + char *encode_mode; int i, j; char current_mode; @@ -155,7 +155,7 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len encode_mode[i] = AztecModes[(int) source[i]]; } } - + // Deal first with letter combinations which can be combined to one codeword // Combinations are (CR LF) (. SP) (, SP) (: SP) in Punct mode current_mode = 'U'; @@ -165,17 +165,17 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len encode_mode[i] = 'P'; encode_mode[i + 1] = 'P'; } - + // Combination (: SP) should always be in Punct mode if ((source[i] == ':') && (source[i + 1] == ' ')) { encode_mode[i + 1] = 'P'; } - + // Combinations (. SP) and (, SP) sometimes use fewer bits in Digit mode if (((source[i] == '.') || (source[i] == ',')) && (source[i + 1] == ' ') && (encode_mode[i] == 'X')) { count = count_doubles(source, i, src_len); next_mode = get_next_mode(encode_mode, src_len, i); - + if (current_mode == 'U') { if ((next_mode == 'D') && (count <= 5)) { for (j = 0; j < (2 * count); j++) { @@ -183,7 +183,7 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len } } } - + if (current_mode == 'L') { if ((next_mode == 'U') && (count == 1)) { encode_mode[i] = 'D'; @@ -195,14 +195,14 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len } } } - + if (current_mode == 'M') { if ((next_mode == 'D') && (count == 1)) { encode_mode[i] = 'D'; encode_mode[i + 1] = 'D'; } } - + if (current_mode == 'D') { if ((next_mode != 'D') && (count <= 4)) { for (j = 0; j < (2 * count); j++) { @@ -215,19 +215,19 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len } } } - + // Default is Punct mode if (encode_mode[i] == 'X') { encode_mode[i] = 'P'; encode_mode[i + 1] = 'P'; } } - + if ((encode_mode[i] != 'X') && (encode_mode[i] != 'B')) { current_mode = encode_mode[i]; } } - + if (debug) { printf("First Pass:\n"); for (i = 0; i < src_len; i++) { @@ -235,7 +235,7 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len } printf("\n"); } - + // Reduce two letter combinations to one codeword marked as [abcd] in Punct mode i = 0; j = 0; @@ -263,28 +263,28 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len } j++; } while (i < src_len); - + reduced_length = j; - + current_mode = 'U'; for(i = 0; i < reduced_length; i++) { // Resolve Carriage Return (CR) which can be Punct or Mixed mode if (reduced_source[i] == 13) { count = count_cr(reduced_source, i, reduced_length); next_mode = get_next_mode(reduced_encode_mode, reduced_length, i); - + if ((current_mode == 'U') && ((next_mode == 'U') || (next_mode == 'B')) && (count == 1)) { reduced_encode_mode[i] = 'P'; } - + if ((current_mode == 'L') && ((next_mode == 'L') || (next_mode == 'B')) && (count == 1)) { reduced_encode_mode[i] = 'P'; } - + if ((current_mode == 'P') || (next_mode == 'P')) { reduced_encode_mode[i] = 'P'; } - + if (current_mode == 'D') { if (((next_mode == 'E') || (next_mode == 'U') || (next_mode == 'D') || (next_mode == 'B')) && (count <= 2)) { for (j = 0; j < count; j++) { @@ -295,24 +295,24 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len reduced_encode_mode[i] = 'P'; } } - + // Default is Mixed mode if (reduced_encode_mode[i] == 'X') { reduced_encode_mode[i] = 'M'; } } - + // Resolve full stop and comma which can be in Punct or Digit mode if ((reduced_source[i] == '.') || (reduced_source[i] == ',')) { count = count_dotcomma(reduced_source, i, reduced_length); next_mode = get_next_mode(reduced_encode_mode, reduced_length, i); - + if (current_mode == 'U') { if (((next_mode == 'U') || (next_mode == 'L') || (next_mode == 'M') || (next_mode == 'B')) && (count == 1)) { reduced_encode_mode[i] = 'P'; } } - + if (current_mode == 'L') { if ((next_mode == 'L') && (count <= 2)) { for (j = 0; j < count; j++) { @@ -323,7 +323,7 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len reduced_encode_mode[i] = 'P'; } } - + if (current_mode == 'M') { if (((next_mode == 'E') || (next_mode == 'U') || (next_mode == 'L') || (next_mode == 'M')) && (count <= 4)) { for (j = 0; j < count; j++) { @@ -336,24 +336,24 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len } } } - + if ((current_mode == 'P') && (next_mode != 'D') && (count <= 9)) { for (j = 0; j < count; j++) { reduced_encode_mode[i + j] = 'P'; } } - + // Default is Digit mode if (reduced_encode_mode[i] == 'X') { reduced_encode_mode[i] = 'D'; } } - + // Resolve Space (SP) which can be any mode except Punct if (reduced_source[i] == ' ') { count = count_spaces(reduced_source, i, reduced_length); next_mode = get_next_mode(reduced_encode_mode, reduced_length, i); - + if (current_mode == 'U') { if ((next_mode == 'E') && (count <= 5)) { for (j = 0; j < count; j++) { @@ -366,7 +366,7 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len } } } - + if (current_mode == 'L') { if ((next_mode == 'E') && (count <= 5)) { for (j = 0; j < count; j++) { @@ -387,116 +387,116 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len } } } - + if (current_mode == 'M') { if (((next_mode == 'E') || (next_mode == 'U')) && (count <= 9)) { for (j = 0; j < count; j++) { reduced_encode_mode[i + j] = 'M'; } } - + if (((next_mode == 'L') || (next_mode == 'B')) && (count <= 14)) { for (j = 0; j < count; j++) { reduced_encode_mode[i + j] = 'M'; } } - + if (((next_mode == 'M') || (next_mode == 'P')) && (count <= 19)) { for (j = 0; j < count; j++) { reduced_encode_mode[i + j] = 'M'; } } } - + if (current_mode == 'P') { if ((next_mode == 'E') && (count <= 5)) { for (j = 0; j < count; j++) { reduced_encode_mode[i + j] = 'U'; } } - + if (((next_mode == 'U') || (next_mode == 'L') || (next_mode == 'M') || (next_mode == 'P') || (next_mode == 'B')) && (count <= 9)) { for (j = 0; j < count; j++) { reduced_encode_mode[i + j] = 'U'; } } } - + // Default is Digit mode if (reduced_encode_mode[i] == 'X') { reduced_encode_mode[i] = 'D'; } } - + if (reduced_encode_mode[i] != 'B') { current_mode = reduced_encode_mode[i]; } } - + // Decide when to use P/S instead of P/L and U/S instead of U/L current_mode = 'U'; for(i = 0; i < reduced_length; i++) { - + if (reduced_encode_mode[i] != current_mode) { for (count = 0; ((i + count) <= reduced_length) && (reduced_encode_mode[i + count] == reduced_encode_mode[i]); count++); next_mode = get_next_mode(reduced_encode_mode, reduced_length, i); - + if (reduced_encode_mode[i] == 'P') { if ((current_mode == 'U') && (count <= 2)) { for (j = 0; j < count; j++) { reduced_encode_mode[i + j] = 'p'; } } - + if ((current_mode == 'L') && (next_mode != 'U') && (count <= 2)) { for (j = 0; j < count; j++) { reduced_encode_mode[i + j] = 'p'; } } - + if ((current_mode == 'L') && (next_mode == 'U') && (count == 1)) { reduced_encode_mode[i] = 'p'; } - + if ((current_mode == 'M') && (next_mode != 'M') && (count == 1)) { reduced_encode_mode[i] = 'p'; } - + if ((current_mode == 'M') && (next_mode == 'M') && (count <= 2)) { for (j = 0; j < count; j++) { reduced_encode_mode[i + j] = 'p'; } } - + if ((current_mode == 'D') && (next_mode != 'D') && (count <= 3)) { for (j = 0; j < count; j++) { reduced_encode_mode[i + j] = 'p'; } } - + if ((current_mode == 'D') && (next_mode == 'D') && (count <= 6)) { for (j = 0; j < count; j++) { reduced_encode_mode[i + j] = 'p'; } } } - + if (reduced_encode_mode[i] == 'U') { if ((current_mode == 'L') && ((next_mode == 'L') || (next_mode == 'M')) && (count <= 2)) { for (j = 0; j < count; j++) { reduced_encode_mode[i + j] = 'u'; } } - + if ((current_mode == 'L') && ((next_mode == 'E') || (next_mode == 'D') || (next_mode == 'B') || (next_mode == 'P')) && (count == 1)) { reduced_encode_mode[i] = 'u'; } - + if ((current_mode == 'D') && (next_mode == 'D') && (count == 1)) { reduced_encode_mode[i] = 'u'; } - + if ((current_mode == 'D') && (next_mode == 'P') && (count <= 2)) { for (j = 0; j < count; j++) { reduced_encode_mode[i + j] = 'u'; @@ -504,7 +504,7 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len } } } - + if ((reduced_encode_mode[i] != 'p') && (reduced_encode_mode[i] != 'u') && (reduced_encode_mode[i] != 'B')) { current_mode = reduced_encode_mode[i]; } @@ -520,9 +520,9 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len } printf("\n"); } - + strcpy(binary_string, ""); - + if (gs1) { bin_append(0, 5, binary_string); // P/S bin_append(0, 5, binary_string); // FLG(n) @@ -575,11 +575,11 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len current_mode = 'U'; for(i = 0; i < reduced_length; i++) { - + if (reduced_encode_mode[i] != 'B') { byte_mode = 0; } - + if ((reduced_encode_mode[i] != current_mode) && (!byte_mode)) { // Change mode if (current_mode == 'U') { @@ -605,7 +605,7 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len break; } } - + if (current_mode == 'L') { switch (reduced_encode_mode[i]) { case 'U': @@ -633,7 +633,7 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len break; } } - + if (current_mode == 'M') { switch (reduced_encode_mode[i]) { case 'U': @@ -657,7 +657,7 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len break; } } - + if (current_mode == 'P') { switch (reduced_encode_mode[i]) { case 'U': @@ -682,7 +682,7 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len break; } } - + if (current_mode == 'D') { switch (reduced_encode_mode[i]) { case 'U': @@ -714,7 +714,7 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len break; } } - + // Byte mode length descriptor if ((reduced_encode_mode[i] == 'B') && (!byte_mode)) { for (count = 0; ((i + count) < reduced_length) && (reduced_encode_mode[i + count] == 'B'); count++); @@ -746,7 +746,7 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len bin_append(AztecSymbolChar[(int) reduced_source[i]], 5, binary_string); } } - + if (reduced_encode_mode[i] == 'L') { if (reduced_source[i] == ' ') { bin_append(1, 5, binary_string); // SP @@ -754,7 +754,7 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len bin_append(AztecSymbolChar[(int) reduced_source[i]], 5, binary_string); } } - + if (reduced_encode_mode[i] == 'M') { if (reduced_source[i] == ' ') { bin_append(1, 5, binary_string); // SP @@ -764,7 +764,7 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len bin_append(AztecSymbolChar[(int) reduced_source[i]], 5, binary_string); } } - + if ((reduced_encode_mode[i] == 'P') || (reduced_encode_mode[i] == 'p')) { if (gs1 && (reduced_source[i] == '[')) { bin_append(0, 5, binary_string); // FLG(0) = FNC1 @@ -786,7 +786,7 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len bin_append(AztecSymbolChar[(int) reduced_source[i]], 5, binary_string); } } - + if (reduced_encode_mode[i] == 'D') { if (reduced_source[i] == ' ') { bin_append(1, 4, binary_string); // SP @@ -798,12 +798,12 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len bin_append(AztecSymbolChar[(int) reduced_source[i]], 4, binary_string); } } - + if (reduced_encode_mode[i] == 'B') { bin_append(reduced_source[i], 8, binary_string); } } - + if (debug) { printf("Binary String:\n"); printf("%s\n", binary_string); @@ -812,7 +812,7 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len free(encode_mode); free(reduced_source); free(reduced_encode_mode); - + return 0; } @@ -1358,7 +1358,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], const size_t lengt } } } - + switch (codeword_size) { case 6: rs_init_gf(0x43); @@ -1380,7 +1380,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], const size_t lengt bin_append(ecc_part[i], codeword_size, adjusted_string); } rs_free(); - + /* Invert the data so that actual data is on the outside and reed-solomon on the inside */ memset(bit_pattern, '0', 20045); @@ -1691,3 +1691,4 @@ int aztec_runes(struct zint_symbol *symbol, unsigned char source[], int length) return 0; } + diff --git a/backend/aztec.h b/backend/aztec.h index 87605685..69b55fc0 100644 --- a/backend/aztec.h +++ b/backend/aztec.h @@ -8,14 +8,14 @@ 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. + 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. + 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. + 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 @@ -26,7 +26,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -143,3 +143,4 @@ static const char AztecOffset[32] = { static const char AztecCompactOffset[4] = { 6, 4, 2, 0 }; + diff --git a/backend/bmp.c b/backend/bmp.c index 536bb4f4..69dd9551 100644 --- a/backend/bmp.c +++ b/backend/bmp.c @@ -8,14 +8,14 @@ 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. + 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. + 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. + 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 @@ -26,7 +26,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -145,3 +145,4 @@ int bmp_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) { free(bitmap); return 0; } + diff --git a/backend/bmp.h b/backend/bmp.h index ed88f864..3a6ab340 100644 --- a/backend/bmp.h +++ b/backend/bmp.h @@ -7,14 +7,14 @@ 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. + 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. + 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. + 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 @@ -25,7 +25,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -44,7 +44,7 @@ extern "C" { #endif #pragma pack (1) - + typedef struct bitmap_file_header { uint16_t header_field; uint32_t file_size; @@ -65,12 +65,13 @@ extern "C" { uint32_t colours; uint32_t important_colours; } bitmap_info_header_t; - + #pragma pack () - + #ifdef __cplusplus } #endif #endif /* BMP_H */ + diff --git a/backend/codablock.c b/backend/codablock.c index 74476f69..2f49ea28 100644 --- a/backend/codablock.c +++ b/backend/codablock.c @@ -994,14 +994,15 @@ int codablock(struct zint_symbol *symbol,const unsigned char source[], const siz expand(symbol, dest); symbol->row_height[r] = 10; } - + if (!(symbol->output_options & BARCODE_BIND)) { symbol->output_options += BARCODE_BIND; } - + if (symbol->border_width < 2) { symbol->border_width = 2; } return 0; } + diff --git a/backend/code.c b/backend/code.c index c26c7015..bdcb292e 100644 --- a/backend/code.c +++ b/backend/code.c @@ -8,14 +8,14 @@ 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. + 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. + 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. + 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 @@ -26,7 +26,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -590,3 +590,4 @@ int channel_code(struct zint_symbol *symbol, unsigned char source[], int length) return error_number; } + diff --git a/backend/code1.c b/backend/code1.c index 66b6ea4f..62b09a66 100644 --- a/backend/code1.c +++ b/backend/code1.c @@ -8,14 +8,14 @@ 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. + 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. + 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. + 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 @@ -26,7 +26,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -904,7 +904,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t /* Binary buffer is full - transfer to target */ if (target_count >= 1) { sub_target = 0; - + for (i = 0; i < 8; i++) { if (decimal_binary[i] == '1') { sub_target += 128 >> i; @@ -915,7 +915,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t } if (target_count >= 2) { sub_target = 0; - + for (i = 0; i < 8; i++) { if (decimal_binary[i + 8] == '1') { sub_target += 128 >> i; @@ -926,7 +926,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t } if (target_count == 3) { sub_target = 0; - + for (i = 0; i < 8; i++) { if (decimal_binary[i + 16] == '1') { sub_target += 128 >> i; @@ -1104,7 +1104,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t /* Binary buffer is full - transfer to target */ if (target_count >= 1) { sub_target = 0; - + for (i = 0; i < 8; i++) { if (decimal_binary[i] == '1') { sub_target += 128 >> i; @@ -1115,7 +1115,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t } if (target_count >= 2) { sub_target = 0; - + for (i = 0; i < 8; i++) { if (decimal_binary[i + 8] == '1') { sub_target += 128 >> i; @@ -1126,7 +1126,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t } if (target_count == 3) { sub_target = 0; - + for (i = 0; i < 8; i++) { if (decimal_binary[i + 16] == '1') { sub_target += 128 >> i; @@ -1161,7 +1161,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t strcpy(symbol->errtxt, "512: Input data too long"); return 0; } - /* + /* printf("targets:\n"); for(i = 0; i < tp; i++) { printf("[%d]", target[i]); @@ -1426,7 +1426,7 @@ int code_one(struct zint_symbol *symbol, unsigned char source[], int length) { if (symbol->option_2 > size) { size = symbol->option_2; } - + if ((symbol-> option_2 != 0) && (symbol->option_2 < size)) { strcpy(symbol->errtxt, "518: Input too long for selected symbol size"); return ZINT_ERROR_TOO_LONG; @@ -1770,3 +1770,4 @@ int code_one(struct zint_symbol *symbol, unsigned char source[], int length) { return 0; } + diff --git a/backend/code1.h b/backend/code1.h index e517544f..aaf48984 100644 --- a/backend/code1.h +++ b/backend/code1.h @@ -8,14 +8,14 @@ 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. + 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. + 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. + 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 @@ -26,7 +26,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -99,4 +99,4 @@ static const unsigned short int c1_grid_height[] = { #define C1_DECIMAL 3 #define C1_TEXT 4 #define C1_EDI 5 -#define C1_BYTE 6 \ No newline at end of file +#define C1_BYTE 6 diff --git a/backend/code128.c b/backend/code128.c index af976f0b..825390dc 100644 --- a/backend/code128.c +++ b/backend/code128.c @@ -9,14 +9,14 @@ 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. + 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. + 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. + 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 @@ -27,7 +27,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -35,7 +35,7 @@ #include #include #ifdef _MSC_VER -#include +#include #endif #include "common.h" #include "gs1.h" @@ -291,7 +291,7 @@ void c128_set_c(unsigned char source_a, unsigned char source_b, char dest[], int } /* Handle Code 128 and NVE-18 */ -int code_128(struct zint_symbol *symbol, unsigned char source[], const size_t length) { +int code_128(struct zint_symbol *symbol, unsigned char source[], const size_t length) { int i, j, k, values[170] = {0}, bar_characters, read, total_sum; int error_number, indexchaine, indexliste, f_state; size_t sourcelen; @@ -1087,3 +1087,4 @@ int ean_14(struct zint_symbol *symbol, unsigned char source[], int length) { return error_number; } + diff --git a/backend/code49.c b/backend/code49.c index 8ab92a64..4ffcdb35 100644 --- a/backend/code49.c +++ b/backend/code49.c @@ -325,7 +325,7 @@ int code_49(struct zint_symbol *symbol, unsigned char source[], const int length /* Expand into symbol */ symbol->row_height[i] = 10; - + for (j = 0; j < strlen(pattern); j++) { if (pattern[j] == '1') { set_module(symbol, i, j); @@ -343,3 +343,4 @@ int code_49(struct zint_symbol *symbol, unsigned char source[], const int length return 0; } + diff --git a/backend/common.c b/backend/common.c index b0d32728..020a07cc 100644 --- a/backend/common.c +++ b/backend/common.c @@ -56,9 +56,9 @@ void bin_append(const int arg, const int length, char *binary) { int i; int start; size_t posn = strlen(binary); - + start = 0x01 << (length - 1); - + for (i = 0; i < length; i++) { binary[posn + i] = '0'; if (arg & (start >> i)) { @@ -66,7 +66,7 @@ void bin_append(const int arg, const int length, char *binary) { } } binary[posn + length] = '\0'; - + return; } @@ -187,7 +187,7 @@ int is_stackable(const int symbology) { if (symbology < BARCODE_PDF417) { return 1; } - + switch (symbology) { case BARCODE_CODE128B: case BARCODE_ISBNX: @@ -300,15 +300,15 @@ void set_minimum_height(struct zint_symbol *symbol, const int min_height) { int fixed_height = 0; int zero_count = 0; int i; - + for (i = 0; i < symbol->rows; i++) { fixed_height += symbol->row_height[i]; - + if (symbol->row_height[i] == 0) { zero_count++; } } - + if (zero_count > 0) { if (((symbol->height - fixed_height) / zero_count) < min_height) { for (i = 0; i < symbol->rows; i++) { @@ -319,3 +319,4 @@ void set_minimum_height(struct zint_symbol *symbol, const int min_height) { } } } + diff --git a/backend/composite.c b/backend/composite.c index 7c9ca789..09b52e62 100644 --- a/backend/composite.c +++ b/backend/composite.c @@ -132,7 +132,7 @@ static int encode928(UINT bitString[], UINT codeWords[], int bitLng) { } /* CC-A 2D component */ -static int cc_a(struct zint_symbol *symbol, char source[], int cc_width) { +static int cc_a(struct zint_symbol *symbol, char source[], int cc_width) { int i, segment, bitlen, cwCnt, variant, rows; int k, offset, j, total, rsCodeWords[8]; int LeftRAPStart, RightRAPStart, CentreRAPStart, StartCluster; @@ -335,7 +335,7 @@ static int cc_a(struct zint_symbol *symbol, char source[], int cc_width) { } /* CC-B 2D component */ -static int cc_b(struct zint_symbol *symbol, char source[], int cc_width) { +static int cc_b(struct zint_symbol *symbol, char source[], int cc_width) { int length, i; #ifndef _MSC_VER unsigned char data_string[(strlen(source) / 8) + 3]; @@ -588,7 +588,7 @@ static int cc_b(struct zint_symbol *symbol, char source[], int cc_width) { } /* CC-C 2D component - byte compressed PDF417 */ -static int cc_c(struct zint_symbol *symbol, char source[], int cc_width, int ecc_level) { +static int cc_c(struct zint_symbol *symbol, char source[], int cc_width, int ecc_level) { int length, i, p; #ifndef _MSC_VER unsigned char data_string[(strlen(source) / 8) + 4]; @@ -730,7 +730,7 @@ static int cc_c(struct zint_symbol *symbol, char source[], int cc_width, int ecc static int calc_padding_cca(int binary_length, int cc_width) { int target_bitsize = 0; - + switch (cc_width) { case 2: if (binary_length <= 167) { @@ -790,13 +790,13 @@ static int calc_padding_cca(int binary_length, int cc_width) { } break; } - + return target_bitsize; } int calc_padding_ccb(int binary_length, int cc_width) { int target_bitsize = 0; - + switch (cc_width) { case 2: if (binary_length <= 336) { @@ -889,7 +889,7 @@ int calc_padding_ccb(int binary_length, int cc_width) { } break; } - + return target_bitsize; } @@ -944,7 +944,7 @@ int calc_padding_ccc(int binary_length, int *cc_width, int lin_width, int *ecc) } codewords_total = *(cc_width) * rows; - + if (codewords_total > 928) { // PDF_MAX return 0; } @@ -956,7 +956,7 @@ int calc_padding_ccc(int binary_length, int *cc_width, int lin_width, int *ecc) target_bytesize += target_codewords % 5; target_bitsize = 8 * target_bytesize; - + return target_bitsize; } @@ -1194,7 +1194,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha /* Encoding can be done according to 5.2.2 c) 2) */ /* five bit binary string representing value before letter */ bin_append(numeric_value, 5, binary_string); - + /* followed by four bit representation of letter from Table 3 */ bin_append(table3_letter, 4, binary_string); } else { @@ -1254,7 +1254,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha case '*': bin_append(58, 6, binary_string); break; - case ',': + case ',': bin_append(59, 6, binary_string); break; case '-': @@ -1437,7 +1437,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha case '*': bin_append(58, 6, binary_string); break; - case ',': + case ',': bin_append(59, 6, binary_string); break; case '-': @@ -1505,7 +1505,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha break; } } while (i + latch < (int) strlen(general_field)); - + binary_length = (int)strlen(binary_string); switch (cc_mode) { case 1: @@ -1518,7 +1518,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha target_bitsize = calc_padding_ccc(binary_length, cc_width, lin_width, ecc); break; } - + if (target_bitsize == 0) { strcpy(symbol->errtxt, "442: Input too long for selected 2d component"); return ZINT_ERROR_TOO_LONG; @@ -1556,7 +1556,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha target_bitsize = calc_padding_ccc(binary_length, cc_width, lin_width, ecc); break; } - + if (target_bitsize == 0) { strcpy(symbol->errtxt, "444: Input too long for selected 2d component"); return ZINT_ERROR_TOO_LONG; @@ -1590,14 +1590,14 @@ int linear_dummy_run(unsigned char *source, int length) { struct zint_symbol *dummy; int error_number; int linear_width; - + dummy = ZBarcode_Create(); dummy->symbology = BARCODE_EAN128_CC; dummy->option_1 = 3; error_number = ean_128(dummy, source, length); linear_width = dummy->width; ZBarcode_Delete(dummy); - + if (error_number == 0) { return linear_width; } else { @@ -1621,7 +1621,7 @@ int composite(struct zint_symbol *symbol, unsigned char source[], int length) { struct zint_symbol *linear; int top_shift, bottom_shift; int linear_width = 0; - + /* Perform sanity checks on input options first */ error_number = 0; pri_len = (int)strlen(symbol->primary); @@ -1634,7 +1634,7 @@ int composite(struct zint_symbol *symbol, unsigned char source[], int length) { strcpy(symbol->errtxt, "446: 2D component input data too long"); return ZINT_ERROR_TOO_LONG; } - + cc_mode = symbol->option_1; if ((cc_mode == 3) && (symbol->symbology != BARCODE_EAN128_CC)) { /* CC-C can only be used with a GS1-128 linear part */ @@ -1646,7 +1646,7 @@ int composite(struct zint_symbol *symbol, unsigned char source[], int length) { if (error_number != 0) { return error_number; } - + if (symbol->symbology == BARCODE_EAN128_CC) { /* Do a test run of encoding the linear component to establish its width */ linear_width = linear_dummy_run((unsigned char *) symbol->primary, pri_len); @@ -1691,7 +1691,7 @@ int composite(struct zint_symbol *symbol, unsigned char source[], int length) { case BARCODE_RSS_EXPSTACK_CC: cc_width = 4; break; } - + memset(binary_string, 0, bs); if (cc_mode < 1 || cc_mode > 3) { @@ -1738,10 +1738,10 @@ int composite(struct zint_symbol *symbol, unsigned char source[], int length) { if (error_number != 0) { return ZINT_ERROR_ENCODING_PROBLEM; } - + /* 2D component done, now calculate linear component */ linear = ZBarcode_Create(); /* Symbol contains the 2D component and Linear contains the rest */ - + linear->symbology = symbol->symbology; if (linear->symbology != BARCODE_EAN128_CC) { @@ -1874,3 +1874,4 @@ int composite(struct zint_symbol *symbol, unsigned char source[], int length) { return error_number; } + diff --git a/backend/dmatrix.c b/backend/dmatrix.c index 01ad1852..e588bfc0 100644 --- a/backend/dmatrix.c +++ b/backend/dmatrix.c @@ -223,7 +223,7 @@ static void ecc200(unsigned char *binary, const int bytes, const int datablock, /* Return true (1) if a character is valid in X12 set */ static int isX12(const int source) { - + switch(source) { case 13: // CR case 42: // * @@ -517,7 +517,7 @@ static int look_ahead_test(const unsigned char inputData[], const size_t sourcel best_scheme = DM_ASCII; } } - + sp++; } while (best_scheme == DM_NULL); // step (s) @@ -897,11 +897,11 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], next_mode = DM_ASCII; } else { int value = source[sp]; - + if (source[sp] >= 64) { // '@' value -= 64; } - + process_buffer[*process_p] = value; (*process_p)++; sp++; @@ -998,7 +998,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], static int dm200encode_remainder(unsigned char target[], int target_length, const unsigned char source[], const size_t inputlen, const int last_mode, const int process_buffer[], const int process_p, const int symbols_left) { int debug = 0; - + switch (last_mode) { case DM_C40: case DM_TEXT: @@ -1038,7 +1038,7 @@ static int dm200encode_remainder(unsigned char target[], int target_length, cons } else { target[target_length] = (254); target_length++; // Unlatch. - + if (process_p == 1) { target[target_length] = source[inputlen - 1] + 1; target_length++; @@ -1053,7 +1053,7 @@ static int dm200encode_remainder(unsigned char target[], int target_length, cons } break; - case DM_EDIFACT: + case DM_EDIFACT: if (symbols_left <= 2) // Unlatch not required! { if (process_p == 1) { @@ -1199,7 +1199,7 @@ int data_matrix_200(struct zint_symbol *symbol,const unsigned char source[], con // Now we know the symbol size we can handle the remaining data in the process buffer. symbols_left = matrixbytes[symbolsize] - binlen; binlen = dm200encode_remainder(binary, binlen, source, inputlen, last_mode, process_buffer, process_p, symbols_left); - + if (binlen > matrixbytes[symbolsize]) { strcpy(symbol->errtxt, "523: Data too long to fit in symbol"); return ZINT_ERROR_TOO_LONG; @@ -1316,3 +1316,4 @@ int dmatrix(struct zint_symbol *symbol, const unsigned char source[], const size return error_number; } + diff --git a/backend/dmatrix.h b/backend/dmatrix.h index 0295355d..6eb89a87 100644 --- a/backend/dmatrix.h +++ b/backend/dmatrix.h @@ -8,14 +8,14 @@ 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. + 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. + 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. + 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 @@ -26,7 +26,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -235,3 +235,4 @@ static const unsigned short int matrixrsblock[] = { #endif + diff --git a/backend/dotcode.c b/backend/dotcode.c index 187a1a83..828a44cf 100644 --- a/backend/dotcode.c +++ b/backend/dotcode.c @@ -8,14 +8,14 @@ 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. + 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. + 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. + 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 @@ -26,11 +26,11 @@ 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. + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. */ -/* +/* * Attempts to encode DotCode according to AIMD013 Rev 1.34a, dated Feb 19, 2009 */ @@ -85,7 +85,7 @@ static int clr_col(char *Dots, const int Hgt, const int Wid, const int x) { return 0; } } - + return 1; } @@ -96,7 +96,7 @@ static int clr_row(char *Dots, const int Hgt, const int Wid, const int y) { return 0; } } - + return 1; } @@ -148,7 +148,7 @@ const int score_array(char Dots[], int Hgt, int Wid) { } } } - + sum = 0; first = -1; last = -1; @@ -480,7 +480,7 @@ int dotcode_encode_message(struct zint_symbol *symbol, const unsigned char sourc a = (symbol->eci - 40) % 12769; b = ((symbol->eci - 40) - (12769 * a)) % 113; c = (symbol->eci - 40) - (12769 * a) - (113 * b); - + codeword_array[array_length] = a + 40; array_length++; codeword_array[array_length] = b; @@ -498,7 +498,7 @@ int dotcode_encode_message(struct zint_symbol *symbol, const unsigned char sourc array_length++; encoding_mode = 'A'; } - + if (source[input_position] == 28) { codeword_array[array_length] = 101; // Latch A array_length++; @@ -506,7 +506,7 @@ int dotcode_encode_message(struct zint_symbol *symbol, const unsigned char sourc array_length++; encoding_mode = 'A'; } - + if (source[input_position] == 29) { codeword_array[array_length] = 101; // Latch A array_length++; @@ -514,7 +514,7 @@ int dotcode_encode_message(struct zint_symbol *symbol, const unsigned char sourc array_length++; encoding_mode = 'A'; } - + if (source[input_position] == 30) { codeword_array[array_length] = 101; // Latch A array_length++; @@ -522,7 +522,7 @@ int dotcode_encode_message(struct zint_symbol *symbol, const unsigned char sourc array_length++; encoding_mode = 'A'; } - + do { int done = 0; /* Step A */ @@ -743,17 +743,17 @@ int dotcode_encode_message(struct zint_symbol *symbol, const unsigned char sourc } } else { if (datum_b(source, input_position, length)) { - + if ((source[input_position] >= 32) && (source[input_position] <= 127)) { codeword_array[array_length] = source[input_position] - 32; done = 1; - + } else if (source[input_position] == 13) { /* CR/LF */ codeword_array[array_length] = 96; input_position++; done = 1; - + } else if (input_position != 0) { /* HT, FS, GS and RS in the first data position would be interpreted as a macro (see table 2) */ switch(source[input_position]) { @@ -772,7 +772,7 @@ int dotcode_encode_message(struct zint_symbol *symbol, const unsigned char sourc } done = 1; } - + if (done == 1) { array_length++; input_position++; @@ -1080,8 +1080,8 @@ static size_t make_dotstream(unsigned char masked_array[], int array_length, cha return strlen(dot_stream); } -/* Determines if a given dot is a reserved corner dot - * to be used by one of the last six bits +/* Determines if a given dot is a reserved corner dot + * to be used by one of the last six bits */ int is_corner(int column, int row, int width, int height) { int corner = 0; @@ -1214,7 +1214,7 @@ int dotcode(struct zint_symbol *symbol, const unsigned char source[], int length char* dot_array; unsigned char* codeword_array = (unsigned char *) _alloca(length * 3 * sizeof (unsigned char)); #endif /* _MSC_VER */ - + if (symbol->eci > 811799) { strcpy(symbol->errtxt, "525: Invalid ECI"); return ZINT_ERROR_INVALID_OPTION; @@ -1285,7 +1285,7 @@ int dotcode(struct zint_symbol *symbol, const unsigned char source[], int length strcpy(symbol->errtxt, "526: Specified symbol size is too large"); return ZINT_ERROR_INVALID_OPTION; } - + if ((height < 5) || (width < 5)) { strcpy(symbol->errtxt, "527: Specified symbol size has a dimension which is too small"); return ZINT_ERROR_INVALID_OPTION; @@ -1466,3 +1466,4 @@ int dotcode(struct zint_symbol *symbol, const unsigned char source[], int length return 0; } + diff --git a/backend/eci.c b/backend/eci.c index 5063cb4b..c31eed78 100644 --- a/backend/eci.c +++ b/backend/eci.c @@ -7,14 +7,14 @@ 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. + 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. + 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. + 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 @@ -25,7 +25,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -305,3 +305,4 @@ int get_best_eci(unsigned char source[], size_t length) { return 26; // If all of these fail, use Unicode! } + diff --git a/backend/eci.h b/backend/eci.h index 380dd6ab..54c48f87 100644 --- a/backend/eci.h +++ b/backend/eci.h @@ -7,14 +7,14 @@ 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. + 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. + 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. + 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 @@ -25,7 +25,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -250,3 +250,4 @@ static const unsigned short int windows_1256[] = { #endif /* ECI_H */ + diff --git a/backend/emf.c b/backend/emf.c index cf40548a..c5944fe6 100644 --- a/backend/emf.c +++ b/backend/emf.c @@ -7,14 +7,14 @@ 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. + 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. + 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. + 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 @@ -25,7 +25,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -45,8 +45,8 @@ int count_rectangles(struct zint_symbol *symbol) { int rectangles = 0; - - if ((symbol->symbology != BARCODE_MAXICODE) && + + if ((symbol->symbology != BARCODE_MAXICODE) && ((symbol->output_options & BARCODE_DOTTY_MODE) == 0)) { int this_row; for(this_row = 0; this_row < symbol->rows; this_row++) { @@ -63,13 +63,13 @@ int count_rectangles(struct zint_symbol *symbol) { } } } - + return rectangles; } int count_circles(struct zint_symbol *symbol) { int circles = 0; - + if ((symbol->symbology != BARCODE_MAXICODE) && ((symbol->output_options & BARCODE_DOTTY_MODE) != 0)) { int this_row; @@ -82,13 +82,13 @@ int count_circles(struct zint_symbol *symbol) { } } } - + return circles; } int count_hexagons(struct zint_symbol *symbol) { int hexagons = 0; - + if (symbol->symbology == BARCODE_MAXICODE) { int this_row; for(this_row = 0; this_row < symbol->rows; this_row++) { @@ -100,14 +100,14 @@ int count_hexagons(struct zint_symbol *symbol) { } } } - + return hexagons; } void utfle_copy(unsigned char *output, unsigned char *input, int length) { int i; int o; - + /* Convert UTF-8 to UTF-16LE - only needs to handle characters <= U+00FF */ i = 0; o = 0; @@ -156,7 +156,7 @@ int emf_plot(struct zint_symbol *symbol) { unsigned char regz[7]; unsigned char output_buffer[12]; uint32_t dx; - + emr_header_t emr_header; emr_eof_t emr_eof; emr_createbrushindirect_t emr_createbrushindirect_fg; @@ -174,7 +174,7 @@ int emf_plot(struct zint_symbol *symbol) { emr_selectobject_t emr_selectobject_font_big; box_t box; - + #ifndef _MSC_VER unsigned char local_text[bump_up(ustrlen(symbol->text) + 1)]; unsigned char string_buffer[2 * bump_up(ustrlen(symbol->text) + 1)]; @@ -187,7 +187,7 @@ int emf_plot(struct zint_symbol *symbol) { local_text = (unsigned char*) _alloca(bump_up(ustrlen(symbol->text) + 1) * sizeof (unsigned char)); string_buffer = (unsigned char*) _alloca(2 * bump_up(ustrlen(symbol->text) + 1) * sizeof (unsigned char)); #endif - + row_height = 0; textdone = 0; comp_offset = 0; @@ -203,7 +203,7 @@ int emf_plot(struct zint_symbol *symbol) { regy[i] = '\0'; regz[i] = '\0'; } - + if (symbol->show_hrt != 0) { /* Copy text from symbol */ ustrcpy(local_text, symbol->text); @@ -234,7 +234,7 @@ int emf_plot(struct zint_symbol *symbol) { break; } } - + /* sort out colour options */ to_upper((unsigned char*) symbol->fgcolour); to_upper((unsigned char*) symbol->bgcolour); @@ -243,19 +243,19 @@ int emf_plot(struct zint_symbol *symbol) { strcpy(symbol->errtxt, "641: Malformed foreground colour target"); return ZINT_ERROR_INVALID_OPTION; } - + if (strlen(symbol->bgcolour) != 6) { strcpy(symbol->errtxt, "642: Malformed background colour target"); return ZINT_ERROR_INVALID_OPTION; } - + 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]); - + if (symbol->height == 0) { symbol->height = 50; } @@ -306,7 +306,7 @@ int emf_plot(struct zint_symbol *symbol) { } upcean = 1; } - + if (ustrlen(local_text) != 0) { textoffset = 9; } else { @@ -314,7 +314,7 @@ int emf_plot(struct zint_symbol *symbol) { } xoffset = symbol->border_width + symbol->whitespace_width; yoffset = symbol->border_width; - + rectangle_count = count_rectangles(symbol); circle_count = count_circles(symbol); hexagon_count = count_hexagons(symbol); @@ -330,7 +330,7 @@ int emf_plot(struct zint_symbol *symbol) { circle = (emr_ellipse_t*) _alloca(circle_count*sizeof(emr_ellipse_t)); hexagon = (emr_polygon_t*) _alloca(hexagon_count*sizeof(emr_polygon_t)); #endif - + /* Header */ emr_header.type = 0x00000001; // EMR_HEADER emr_header.size = 88; // Assuming no additional data in header @@ -373,7 +373,7 @@ int emf_plot(struct zint_symbol *symbol) { emr_createbrushindirect_fg.log_brush.brush_hatch = 0; // ignored bytecount += 24; recordcount++; - + emr_createbrushindirect_bg.type = 0x00000027; // EMR_CREATEBRUSHINDIRECT emr_createbrushindirect_bg.size = 24; emr_createbrushindirect_bg.ih_brush = 2; @@ -385,13 +385,13 @@ int emf_plot(struct zint_symbol *symbol) { emr_createbrushindirect_bg.log_brush.brush_hatch = 0; // ignored bytecount += 24; recordcount++; - + emr_selectobject_fgbrush.type = 0x00000025; // EMR_SELECTOBJECT emr_selectobject_fgbrush.size = 12; emr_selectobject_fgbrush.ih_object = 1; bytecount += 12; recordcount++; - + emr_selectobject_bgbrush.type = 0x00000025; // EMR_SELECTOBJECT emr_selectobject_bgbrush.size = 12; emr_selectobject_bgbrush.ih_object = 2; @@ -411,13 +411,13 @@ int emf_plot(struct zint_symbol *symbol) { emr_createpen.log_pen.color_ref.reserved = 0; bytecount += 28; recordcount++; - + emr_selectobject_pen.type = 0x00000025; // EMR_SELECTOBJECT emr_selectobject_pen.size = 12; emr_selectobject_pen.ih_object = 3; bytecount += 12; recordcount++; - + /* Create font records */ if ((symbol->show_hrt != 0) && (ustrlen(local_text) != 0)) { emr_extcreatefontindirectw.type = 0x00000052; // EMR_EXTCREATEFONTINDIRECTW @@ -443,8 +443,8 @@ int emf_plot(struct zint_symbol *symbol) { emr_selectobject_font.type = 0x00000025; // EMR_SELECTOBJECT emr_selectobject_font.size = 12; - emr_selectobject_font.ih_object = 4; - + emr_selectobject_font.ih_object = 4; + if (!((symbol->symbology == BARCODE_EANX) || (symbol->symbology == BARCODE_EANX_CC) || (symbol->symbology == BARCODE_ISBNX))) { bytecount += 104; recordcount++; @@ -482,7 +482,7 @@ int emf_plot(struct zint_symbol *symbol) { emr_selectobject_font_big.type = 0x00000025; // EMR_SELECTOBJECT emr_selectobject_font_big.size = 12; - emr_selectobject_font_big.ih_object = 5; + emr_selectobject_font_big.ih_object = 5; bytecount += 12; recordcount++; } @@ -521,7 +521,7 @@ int emf_plot(struct zint_symbol *symbol) { for (i = (latch + 1); i <= ustrlen(local_text); i++) { regz[i - (latch + 1)] = local_text[i]; } - } + } local_text[4] = '\0'; } @@ -600,12 +600,12 @@ int emf_plot(struct zint_symbol *symbol) { utfle_copy(string_buffer, local_text, ustrlen(local_text)); bytecount += 76 + (6 * bump_up(ustrlen(local_text) + 1)); recordcount++; - + emr_exttextoutw[1].w_emr_text.chars = ustrlen(regw); emr_exttextoutw[2].w_emr_text.chars = ustrlen(regx); emr_exttextoutw[3].w_emr_text.chars = ustrlen(regy); emr_exttextoutw[4].w_emr_text.chars = ustrlen(regz); - + if ((symbol->symbology == BARCODE_EANX) || (symbol->symbology == BARCODE_EANX_CC) || (symbol->symbology == BARCODE_ISBNX)) { if (latch > 8) { /* EAN-13 */ @@ -670,7 +670,7 @@ int emf_plot(struct zint_symbol *symbol) { bytecount += (3 * 112) + 12; recordcount += 4; } - + if ((symbol->symbology == BARCODE_UPCE) || (symbol->symbology == BARCODE_UPCE_CC)) { emr_exttextoutw[0].w_emr_text.reference.x = (xoffset - 7) * scaler; emr_exttextoutw[0].w_emr_text.reference.y = emr_header.emf_header.bounds.bottom - (9 * scaler);; @@ -702,7 +702,7 @@ int emf_plot(struct zint_symbol *symbol) { background.box.bottom = emr_header.emf_header.bounds.bottom; bytecount += 24; recordcount++; - + /* Make bind and box rectangles if needed */ if ((symbol->output_options & BARCODE_BIND) || (symbol->output_options & BARCODE_BOX)) { box.top.type = 0x0000002b; // EMR_RECTANGLE; @@ -713,7 +713,7 @@ int emf_plot(struct zint_symbol *symbol) { box.top.box.right = emr_header.emf_header.bounds.right - (symbol->border_width * scaler); bytecount += 24; recordcount++; - + box.bottom.type = 0x0000002b; // EMR_RECTANGLE; box.bottom.size = 24; box.bottom.box.top = emr_header.emf_header.bounds.bottom - ((symbol->border_width + textoffset) * scaler); @@ -722,7 +722,7 @@ int emf_plot(struct zint_symbol *symbol) { box.bottom.box.right = emr_header.emf_header.bounds.right - (symbol->border_width * scaler); bytecount += 24; recordcount++; - + if (symbol->output_options & BARCODE_BOX) { box.left.type = 0x0000002b; // EMR_RECTANGLE; box.left.size = 24; @@ -732,7 +732,7 @@ int emf_plot(struct zint_symbol *symbol) { box.left.box.right = symbol->border_width * scaler; bytecount += 24; recordcount++; - + box.right.type = 0x0000002b; // EMR_RECTANGLE; box.right.size = 24; box.right.box.top = 0; @@ -787,13 +787,13 @@ int emf_plot(struct zint_symbol *symbol) { } else { latch = 0; } - + do { block_width = 0; do { block_width++; } while (module_is_set(symbol, this_row, i + block_width) == module_is_set(symbol, this_row, i)); - + if (latch == 1) { /* a bar */ rectangle[this_rectangle].type = 0x0000002b; // EMR_RECTANGLE; @@ -860,7 +860,7 @@ int emf_plot(struct zint_symbol *symbol) { rectangle[this_rectangle].box.bottom += (5 * scaler); } } - + if (((symbol->symbology == BARCODE_UPCE) && (symbol->rows == 1)) || (symbol->symbology == BARCODE_UPCE_CC)) { /* guard bar extensions for UPCE */ switch (i) { @@ -879,7 +879,7 @@ int emf_plot(struct zint_symbol *symbol) { } } } - + this_rectangle++; latch = 0; } else { @@ -887,14 +887,14 @@ int emf_plot(struct zint_symbol *symbol) { latch = 1; } - + i += block_width; } while (i < symbol->width); } } else { float ax, ay, bx, by, cx, cy, dx, dy, ex, ey, fx, fy, mx, my; /* Maxicode, use hexagons */ - + /* Calculate bullseye */ for(i = 0; i < 6; i++) { bullseye[i].type = 0x0000002a; // EMR_ELLIPSE @@ -924,14 +924,14 @@ int emf_plot(struct zint_symbol *symbol) { bullseye[5].box.bottom = (35.60 + 1.43) * scaler; bullseye[5].box.left = (35.76 - 1.43) * scaler; bullseye[5].box.right = (35.76 + 1.43) * scaler; - + /* Plot hexagons */ for(i = 0; i < symbol->width; i++) { if(module_is_set(symbol, this_row, i)) { hexagon[this_hexagon].type = 0x00000003; // EMR_POLYGON hexagon[this_hexagon].size = 76; hexagon[this_hexagon].count = 6; - + my = this_row * 2.135 + 1.43; ay = my + 1.0 + yoffset; by = my + 0.5 + yoffset; @@ -950,7 +950,7 @@ int emf_plot(struct zint_symbol *symbol) { dx = mx + xoffset; ex = mx - 0.86 + xoffset; fx = mx - 0.86 + xoffset; - + hexagon[this_hexagon].a_points_a.x = ax * scaler; hexagon[this_hexagon].a_points_a.y = ay * scaler; hexagon[this_hexagon].a_points_b.x = bx * scaler; @@ -963,7 +963,7 @@ int emf_plot(struct zint_symbol *symbol) { hexagon[this_hexagon].a_points_e.y = ey * scaler; hexagon[this_hexagon].a_points_f.x = fx * scaler; hexagon[this_hexagon].a_points_f.y = fy * scaler; - + hexagon[this_hexagon].bounds.top = hexagon[this_hexagon].a_points_d.y; hexagon[this_hexagon].bounds.bottom = hexagon[this_hexagon].a_points_a.y; hexagon[this_hexagon].bounds.left = hexagon[this_hexagon].a_points_e.x; @@ -975,7 +975,7 @@ int emf_plot(struct zint_symbol *symbol) { } } } - + if (symbol->output_options & BARCODE_BIND) { if ((symbol->rows > 1) && (is_stackable(symbol->symbology) == 1)) { /* row binding */ @@ -984,7 +984,7 @@ int emf_plot(struct zint_symbol *symbol) { row_binding[i - 1].size = 24; row_binding[i - 1].box.top = ((i * row_height) + yoffset - 1) * scaler; row_binding[i - 1].box.bottom = row_binding[i - 1].box.top + (2 * scaler); - + if (symbol->symbology != BARCODE_CODABLOCKF) { row_binding[i - 1].box.left = xoffset * scaler; row_binding[i - 1].box.right = emr_header.emf_header.bounds.right - (xoffset * scaler); @@ -1006,11 +1006,11 @@ int emf_plot(struct zint_symbol *symbol) { emr_eof.size_last = emr_eof.size; bytecount += 18; recordcount++; - + /* Put final counts in header */ emr_header.emf_header.bytes = bytecount; emr_header.emf_header.records = recordcount; - + /* Send EMF data to file */ if (symbol->output_options & BARCODE_STDOUT) { emf_file = stdout; @@ -1021,21 +1021,21 @@ int emf_plot(struct zint_symbol *symbol) { strcpy(symbol->errtxt, "640: Could not open output file"); return ZINT_ERROR_FILE_ACCESS; } - + fwrite(&emr_header, sizeof(emr_header_t), 1, emf_file); - + fwrite(&emr_createbrushindirect_fg, sizeof(emr_createbrushindirect_t), 1, emf_file); fwrite(&emr_createbrushindirect_bg, sizeof(emr_createbrushindirect_t), 1, emf_file); fwrite(&emr_createpen, sizeof(emr_createpen_t), 1, emf_file); - + if ((symbol->show_hrt != 0) && (ustrlen(local_text) != 0)) { fwrite(&emr_extcreatefontindirectw, sizeof(emr_extcreatefontindirectw_t), 1, emf_file); } - + fwrite(&emr_selectobject_bgbrush, sizeof(emr_selectobject_t), 1, emf_file); fwrite(&emr_selectobject_pen, sizeof(emr_selectobject_t), 1, emf_file); fwrite(&background, sizeof(emr_rectangle_t), 1, emf_file); - + fwrite(&emr_selectobject_fgbrush, sizeof(emr_selectobject_t), 1, emf_file); for (i = 0; i < rectangle_count; i++) { @@ -1055,8 +1055,8 @@ int emf_plot(struct zint_symbol *symbol) { fwrite(&box.left, sizeof(emr_rectangle_t), 1, emf_file); fwrite(&box.right, sizeof(emr_rectangle_t), 1, emf_file); } - } - + } + if (symbol->output_options & BARCODE_BIND) { if ((symbol->rows > 1) && (is_stackable(symbol->symbology) == 1)) { for(i = 0; i < symbol->rows - 1; i++) { @@ -1064,7 +1064,7 @@ int emf_plot(struct zint_symbol *symbol) { } } } - + if(symbol->symbology == BARCODE_MAXICODE) { fwrite(&bullseye[0], sizeof(emr_ellipse_t), 1, emf_file); fwrite(&emr_selectobject_bgbrush, sizeof(emr_selectobject_t), 1, emf_file); @@ -1078,7 +1078,7 @@ int emf_plot(struct zint_symbol *symbol) { fwrite(&emr_selectobject_bgbrush, sizeof(emr_selectobject_t), 1, emf_file); fwrite(&bullseye[5], sizeof(emr_ellipse_t), 1, emf_file); } - + if ((symbol->show_hrt != 0) && (ustrlen(local_text) != 0)) { if ((symbol->symbology == BARCODE_EANX) || (symbol->symbology == BARCODE_EANX_CC) || (symbol->symbology == BARCODE_ISBNX)) { if (ustrlen(regx) != 0) { @@ -1171,7 +1171,7 @@ int emf_plot(struct zint_symbol *symbol) { } textdone = 1; } - + if (((symbol->symbology == BARCODE_UPCE) && (symbol->rows == 1)) || (symbol->symbology == BARCODE_UPCE_CC)) { fwrite(&emr_selectobject_font, sizeof(emr_selectobject_t), 1, emf_file); fwrite(&emr_exttextoutw[0], sizeof(emr_exttextoutw_t), 1, emf_file); @@ -1212,9 +1212,9 @@ int emf_plot(struct zint_symbol *symbol) { } } } - + fwrite(&emr_eof, sizeof(emr_eof_t), 1, emf_file); - + if (symbol->output_options & BARCODE_STDOUT) { fflush(emf_file); } else { @@ -1223,3 +1223,4 @@ int emf_plot(struct zint_symbol *symbol) { return error_number; } + diff --git a/backend/emf.h b/backend/emf.h index da68522a..ffd4521f 100644 --- a/backend/emf.h +++ b/backend/emf.h @@ -7,14 +7,14 @@ 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. + 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. + 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. + 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 @@ -25,7 +25,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -42,45 +42,45 @@ extern "C" { #else #include #endif - + #pragma pack(1) - + typedef struct rect_l { int32_t left; int32_t top; int32_t right; int32_t bottom; } rect_l_t; - + typedef struct size_l { uint32_t cx; uint32_t cy; } size_l_t; - + typedef struct point_l { int32_t x; int32_t y; } point_l_t; - + typedef struct color_ref { uint8_t red; uint8_t green; uint8_t blue; uint8_t reserved; } color_ref_t; - + typedef struct log_brush_ex { uint32_t brush_style; color_ref_t color; uint32_t brush_hatch; } log_brush_ex_t; - + typedef struct log_pen { uint32_t pen_style; point_l_t width; color_ref_t color_ref; } log_pen_t; - + typedef struct log_font { int32_t height; int32_t width; @@ -97,7 +97,7 @@ extern "C" { uint8_t pitch_and_family; unsigned char facename[64]; } log_font_t; - + typedef struct emr_text { point_l_t reference; uint32_t chars; @@ -106,7 +106,7 @@ extern "C" { rect_l_t rectangle; uint32_t off_dx; } emr_text_t; - + typedef struct emf_header { rect_l_t bounds; rect_l_t frame; @@ -122,45 +122,45 @@ extern "C" { size_l_t device; size_l_t millimeters; } emf_header_t; - + typedef struct emr_header { uint32_t type; uint32_t size; emf_header_t emf_header; } emr_header_t; - + typedef struct emr_createbrushindirect { uint32_t type; uint32_t size; uint32_t ih_brush; log_brush_ex_t log_brush; } emr_createbrushindirect_t; - + typedef struct emr_createpen { uint32_t type; uint32_t size; uint32_t ih_pen; log_pen_t log_pen; } emr_createpen_t; - + typedef struct emr_selectobject { uint32_t type; uint32_t size; uint32_t ih_object; } emr_selectobject_t; - + typedef struct emr_rectangle { uint32_t type; uint32_t size; rect_l_t box; } emr_rectangle_t; - + typedef struct emr_ellipse { uint32_t type; uint32_t size; rect_l_t box; } emr_ellipse_t; - + typedef struct emr_polygon { uint32_t type; uint32_t size; @@ -173,14 +173,14 @@ extern "C" { point_l_t a_points_e; point_l_t a_points_f; } emr_polygon_t; - + typedef struct emr_extcreatefontindirectw { uint32_t type; uint32_t size; uint32_t ih_fonts; log_font_t elw; } emr_extcreatefontindirectw_t; - + typedef struct emr_exttextoutw { uint32_t type; uint32_t size; @@ -190,7 +190,7 @@ extern "C" { float ey_scale; emr_text_t w_emr_text; } emr_exttextoutw_t; - + typedef struct emr_eof { uint32_t type; uint32_t size; @@ -198,14 +198,14 @@ extern "C" { uint32_t off_pal_entries; uint32_t size_last; } emr_eof_t; - + typedef struct box { emr_rectangle_t top; emr_rectangle_t bottom; emr_rectangle_t left; emr_rectangle_t right; } box_t; - + #pragma pack() #ifdef __cplusplus @@ -214,3 +214,4 @@ extern "C" { #endif /* EMF_H */ + diff --git a/backend/gb18030.h b/backend/gb18030.h index 131aab96..5cdd5ea2 100644 --- a/backend/gb18030.h +++ b/backend/gb18030.h @@ -7,14 +7,14 @@ 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. + 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. + 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. + 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 @@ -25,7 +25,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -23321,4 +23321,4 @@ static const unsigned short int gb18030_fourbyte_lookup[] = { 0xFFDD, 0x8431, 0xA231, 0xFFDE, 0x8431, 0xA232, 0xFFDF, 0x8431, 0xA233 -}; \ No newline at end of file +}; diff --git a/backend/gb2312.h b/backend/gb2312.h index 56cc4b20..909748fc 100644 --- a/backend/gb2312.h +++ b/backend/gb2312.h @@ -7,14 +7,14 @@ 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. + 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. + 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. + 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 @@ -25,7 +25,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -7476,3 +7476,4 @@ static const unsigned short int gb2312_lookup[] = { 0xFFE3, 0xA3FE, 0xFFE5, 0xA3A4 }; + diff --git a/backend/gif.c b/backend/gif.c index 99aabf95..c02aefe0 100644 --- a/backend/gif.c +++ b/backend/gif.c @@ -8,14 +8,14 @@ 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. + 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. + 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. + 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 @@ -26,7 +26,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -399,4 +399,4 @@ int gif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) { fclose(gif_file); return 0; -} \ No newline at end of file +} diff --git a/backend/gridmtx.c b/backend/gridmtx.c index 81a08e46..3590805e 100644 --- a/backend/gridmtx.c +++ b/backend/gridmtx.c @@ -315,7 +315,7 @@ static int seek_forward(int gbdata[], const size_t length, const size_t position /* Add the length indicator for byte encoded blocks */ static void add_byte_count(char binary[], const size_t byte_count_posn, const int byte_count) { int p; - + for (p = 0; p < 8; p++) { if (byte_count & (0x100 >> p)) { binary[byte_count_posn + p] = '0'; @@ -365,7 +365,7 @@ static int gm_encode(int gbdata[], const size_t length, char binary[],const int if (reader) { bin_append(10, 4, binary); /* FNC3 - Reader Initialisation */ } - + if (eci != 3) { /* ECI assignment according to Table 8 */ bin_append(12, 4, binary); /* ECI */ @@ -732,7 +732,7 @@ static int gm_encode(int gbdata[], const size_t length, char binary[],const int if (debug) { printf("[%d] ", glyph); } - + bin_append(glyph, 5, binary); } else { /* Shift Mode character */ @@ -1054,7 +1054,7 @@ int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], size_t } if (symbol->output_options & READER_INIT) reader = 1; - + if (symbol->eci > 811799) { strcpy(symbol->errtxt, "533: Invalid ECI"); return ZINT_ERROR_INVALID_OPTION; @@ -1208,3 +1208,4 @@ int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], size_t return 0; } + diff --git a/backend/gridmtx.h b/backend/gridmtx.h index 51534889..b7f70abb 100644 --- a/backend/gridmtx.h +++ b/backend/gridmtx.h @@ -7,14 +7,14 @@ 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. + 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. + 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. + 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 @@ -25,7 +25,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -182,3 +182,4 @@ static const unsigned short int gm_macro_matrix[] = { 703, 600, 599, 598, 597, 596, 595, 594, 593, 592, 591, 590, 589, 588, 587, 586, 585, 584, 583, 582, 581, 580, 579, 578, 577, 576, 675, 702, 701, 700, 699, 698, 697, 696, 695, 694, 693, 692, 691, 690, 689, 688, 687, 686, 685, 684, 683, 682, 681, 680, 679, 678, 677, 676, }; + diff --git a/backend/gs1.c b/backend/gs1.c index 547fba4b..6a74dfd6 100644 --- a/backend/gs1.c +++ b/backend/gs1.c @@ -8,14 +8,14 @@ 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. + 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. + 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. + 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 @@ -26,7 +26,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -34,7 +34,7 @@ #include #include #ifdef _MSC_VER -#include +#include #endif #include "common.h" #include "gs1.h" @@ -356,3 +356,4 @@ int ugs1_verify(struct zint_symbol *symbol, const unsigned char source[], const strcpy(symbol->errtxt, "261: ugs1_verify overflow"); return ZINT_ERROR_INVALID_DATA; } + diff --git a/backend/hanxin.c b/backend/hanxin.c index e2c4a026..2bb1f810 100644 --- a/backend/hanxin.c +++ b/backend/hanxin.c @@ -47,19 +47,19 @@ /* Find which submode to use for a text character */ int getsubmode(char input) { int submode = 2; - + if ((input >= '0') && (input <= '9')) { submode = 1; } - + if ((input >= 'A') && (input <= 'Z')) { submode = 1; } - + if ((input >= 'a') && (input <= 'z')) { submode = 1; } - + return submode; } @@ -69,11 +69,11 @@ static int calculate_binlength(char mode[], int source[], const size_t length, i char lastmode = 't'; int est_binlen = 0; int submode = 1; - + if (eci != 3) { est_binlen += 12; } - + i = 0; do { switch (mode[i]) { @@ -220,7 +220,7 @@ int isFourByte(int glyph, int glyph2) { } } } - + return valid; } @@ -232,25 +232,25 @@ static void hx_define_mode(char mode[], int source[], const size_t length) { i = 0; do { int done = 0; - + if (isRegion1(source[i])) { mode[i] = '1'; done = 1; i++; } - + if ((done == 0) && (isRegion2(source[i]))) { mode[i] = '2'; done = 1; i++; } - + if ((done == 0) && (isDoubleByte(source[i]))) { mode[i] = 'd'; done = 1; i++; } - + if ((done == 0) && (i < length - 1)) { if (isFourByte(source[i], source[i + 1])) { mode[i] = 'f'; @@ -288,42 +288,42 @@ static void hx_define_mode(char mode[], int source[], const size_t length) { /* Convert Text 1 sub-mode character to encoding value, as given in table 3 */ int lookup_text1(char input) { int encoding_value = 0; - + if ((input >= '0') && (input <= '9')) { encoding_value = input - '0'; } - + if ((input >= 'A') && (input <= 'Z')) { encoding_value = input - 'A' + 10; } - + if ((input >= 'a') && (input <= 'z')) { encoding_value = input - 'a' + 36; } - + return encoding_value; } /* Convert Text 2 sub-mode character to encoding value, as given in table 4 */ int lookup_text2(char input) { int encoding_value = 0; - + if ((input >= 0) && (input <= 27)) { encoding_value = input; } - + if ((input >= ' ') && (input <= '/')) { encoding_value = input - ' ' + 28; } - + if ((input >= '[') && (input <= 96)) { encoding_value = input - '[' + 51; } - + if ((input >= '{') && (input <= 127)) { encoding_value = input - '{' + 57; } - + return encoding_value; } @@ -657,7 +657,7 @@ void hx_place_finder_top_left(unsigned char* grid, int size) { int xp, yp; int x = 0, y = 0; char finder[] = {0x7F, 0x40, 0x5F, 0x50, 0x57, 0x57, 0x57}; - + for (xp = 0; xp < 7; xp++) { for (yp = 0; yp < 7; yp++) { if (finder[yp] & 0x40 >> xp) { @@ -942,7 +942,7 @@ void hx_add_ecc(unsigned char fullstream[], unsigned char datastream[], int vers void make_picket_fence(unsigned char fullstream[], unsigned char picket_fence[], int streamsize) { int i, start; int output_position = 0; - + for (start = 0; start < 13; start++) { for (i = start; i < streamsize; i += 13) { if (i < streamsize) { @@ -1217,7 +1217,7 @@ int hx_apply_bitmask(unsigned char *grid, int size) { } } } - + return best_pattern; } @@ -1265,14 +1265,14 @@ int han_xin(struct zint_symbol *symbol, const unsigned char source[], size_t len for (i = 0; i < length; i++) { int done = 0; gbdata[posn] = 0; - + /* Single byte characters in range U+0000 -> U+007F */ if (utfdata[i] <= 0x7f) { gbdata[posn] = utfdata[i]; posn++; done = 1; } - + /* Two bytes characters in GB-2312 */ if (done == 0) { j = 0; @@ -1285,7 +1285,7 @@ int han_xin(struct zint_symbol *symbol, const unsigned char source[], size_t len j++; } while ((j < 7445) && (done == 0)); } - + /* Two byte characters in GB-18030 */ if (done == 0) { j = 0; @@ -1312,13 +1312,13 @@ int han_xin(struct zint_symbol *symbol, const unsigned char source[], size_t len j++; } while ((j < 6793) && (done == 0)); } - + /* Supplementary planes U+10000 -> U+1FFFF */ if (done == 0) { if (utfdata[i] >= 0x10000 && utfdata[i] < 0x110000) { /* algorithm from libiconv-1.15\lib\gb18030.h */ int j, r3, r2, r1, r0; - + j = utfdata[i] - 0x10000; r3 = (j % 10) + 0x30; j = j / 10; r2 = (j % 126) + 0x81; j = j / 126; @@ -1330,7 +1330,7 @@ int han_xin(struct zint_symbol *symbol, const unsigned char source[], size_t len done = 1; } } - + /* Character not found */ if (done == 0) { strcpy(symbol->errtxt, "540: Unknown character in input data"); @@ -1407,7 +1407,7 @@ int han_xin(struct zint_symbol *symbol, const unsigned char source[], size_t len if (symbol->option_2 > version) { version = symbol->option_2; } - + if ((symbol->option_2 != 0) && (symbol->option_2 < version)) { strcpy(symbol->errtxt, "542: Input too long for selected symbol size"); return ZINT_ERROR_TOO_LONG; @@ -1571,3 +1571,4 @@ int han_xin(struct zint_symbol *symbol, const unsigned char source[], size_t len return 0; } + diff --git a/backend/hanxin.h b/backend/hanxin.h index 1ad46851..a5258d7a 100644 --- a/backend/hanxin.h +++ b/backend/hanxin.h @@ -8,14 +8,14 @@ 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. + 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. + 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. + 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 @@ -26,7 +26,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -457,4 +457,4 @@ static const unsigned short int hx_table_d1[] = { 3, 45, 22, 55, 47, 20, 0, 0, 0, 2, 26, 26, 62, 33, 28, 0, 0, 0, 79, 18, 28, 4, 33, 30, 0, 0, 0 -}; \ No newline at end of file +}; diff --git a/backend/imail.c b/backend/imail.c index 54892825..c3bd90c1 100644 --- a/backend/imail.c +++ b/backend/imail.c @@ -327,7 +327,7 @@ int imail(struct zint_symbol *symbol, unsigned char source[], int length) { for (i = 0; i < 112; i++) { x_reg[i] = 0; } - + for (i = 0; i < 4; i++) { if (ctoi(zip[read]) & (0x01 << i)) x_reg[i] = 1; } @@ -368,11 +368,11 @@ int imail(struct zint_symbol *symbol, unsigned char source[], int length) { for (i = 0; i < 9; i++) { binary_add(accum, y_reg); } - + for (i = 0; i < 112; i++) { y_reg[i] = 0; } - + for (i = 0; i < 4; i++) { if (ctoi(zip_adder[read]) & (0x01 << i)) y_reg[i] = 1; } @@ -392,11 +392,11 @@ int imail(struct zint_symbol *symbol, unsigned char source[], int length) { for (i = 0; i < 9; i++) { binary_add(accum, y_reg); } - + for (i = 0; i < 112; i++) { y_reg[i] = 0; } - + /* add first digit of tracker */ for (i = 0; i < 4; i++) { if (ctoi(tracker[0]) & (0x01 << i)) y_reg[i] = 1; @@ -412,7 +412,7 @@ int imail(struct zint_symbol *symbol, unsigned char source[], int length) { for (i = 0; i < 4; i++) { binary_add(accum, y_reg); } - + for (i = 0; i < 112; i++) { y_reg[i] = 0; } @@ -435,15 +435,15 @@ int imail(struct zint_symbol *symbol, unsigned char source[], int length) { for (i = 0; i < 9; i++) { binary_add(accum, y_reg); } - + for (i = 0; i < 112; i++) { y_reg[i] = 0; } - + for (i = 0; i < 4; i++) { if (ctoi(tracker[read]) & (0x01 << i)) y_reg[i] = 1; } - + binary_add(accum, y_reg); } @@ -552,7 +552,7 @@ int imail(struct zint_symbol *symbol, unsigned char source[], int length) { characters[i] = AppxD_II[codeword[i] - 1287]; } } - + for (i = 0; i < 10; i++) { if (usps_crc & (1 << i)) { characters[i] = 0x1FFF - characters[i]; @@ -603,3 +603,4 @@ int imail(struct zint_symbol *symbol, unsigned char source[], int length) { symbol->width = read - 1; return error_number; } + diff --git a/backend/large.c b/backend/large.c index 79ff4871..b7211a40 100644 --- a/backend/large.c +++ b/backend/large.c @@ -8,14 +8,14 @@ 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. + 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. + 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. + 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 @@ -26,7 +26,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -41,49 +41,49 @@ void binary_add(short int accumulator[], short int input_buffer[]) { /* Binary a for (i = 0; i < 112; i++) { int done = 0; - if (((input_buffer[i] == 0) && (accumulator[i] == 0)) + if (((input_buffer[i] == 0) && (accumulator[i] == 0)) && ((carry == 0) && (done == 0))) { accumulator[i] = 0; carry = 0; done = 1; } - if (((input_buffer[i] == 0) && (accumulator[i] == 0)) + if (((input_buffer[i] == 0) && (accumulator[i] == 0)) && ((carry == 1) && (done == 0))) { accumulator[i] = 1; carry = 0; done = 1; } - if (((input_buffer[i] == 0) && (accumulator[i] == 1)) + if (((input_buffer[i] == 0) && (accumulator[i] == 1)) && ((carry == 0) && (done == 0))) { accumulator[i] = 1; carry = 0; done = 1; } - if (((input_buffer[i] == 0) && (accumulator[i] == 1)) + if (((input_buffer[i] == 0) && (accumulator[i] == 1)) && ((carry == 1) && (done == 0))) { accumulator[i] = 0; carry = 1; done = 1; } - if (((input_buffer[i] == 1) && (accumulator[i] == 0)) + if (((input_buffer[i] == 1) && (accumulator[i] == 0)) && ((carry == 0) && (done == 0))) { accumulator[i] = 1; carry = 0; done = 1; } - if (((input_buffer[i] == 1) && (accumulator[i] == 0)) + if (((input_buffer[i] == 1) && (accumulator[i] == 0)) && ((carry == 1) && (done == 0))) { accumulator[i] = 0; carry = 1; done = 1; } - if (((input_buffer[i] == 1) && (accumulator[i] == 1)) + if (((input_buffer[i] == 1) && (accumulator[i] == 1)) && ((carry == 0) && (done == 0))) { accumulator[i] = 0; carry = 1; done = 1; } - if (((input_buffer[i] == 1) && (accumulator[i] == 1)) + if (((input_buffer[i] == 1) && (accumulator[i] == 1)) && ((carry == 1) && (done == 0))) { accumulator[i] = 1; carry = 1; @@ -92,7 +92,7 @@ void binary_add(short int accumulator[], short int input_buffer[]) { /* Binary a } } -void binary_subtract(short int accumulator[], short int input_buffer[]) { +void binary_subtract(short int accumulator[], short int input_buffer[]) { /* 2's compliment subtraction */ /* take input_buffer from accumulator and put answer in accumulator */ int i; @@ -180,7 +180,7 @@ void binary_load(short int reg[], char data[], const size_t src_len) { for (i = 0; i < 112; i++) { temp[i] = 0; } - + for (i = 0; i < 4; i++) { if (ctoi(data[read]) & (0x01 << i)) temp[i] = 1; } @@ -189,3 +189,4 @@ void binary_load(short int reg[], char data[], const size_t src_len) { } } + diff --git a/backend/large.h b/backend/large.h index c8b6e14b..4a8e69be 100644 --- a/backend/large.h +++ b/backend/large.h @@ -8,14 +8,14 @@ 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. + 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. + 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. + 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 @@ -26,7 +26,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef __LARGE_H @@ -48,3 +48,4 @@ extern short int islarger(short int accum[], short int reg[]); #endif /* __cplusplus */ #endif /* __LARGE_H */ + diff --git a/backend/library.c b/backend/library.c index e7a898b5..7ee64cf7 100644 --- a/backend/library.c +++ b/backend/library.c @@ -7,14 +7,14 @@ 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. + 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. + 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. + 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 @@ -25,7 +25,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -34,7 +34,7 @@ #include #include #ifdef _MSC_VER -#include +#include #endif #include "common.h" #include "gs1.h" @@ -351,20 +351,20 @@ static void check_row_heights(struct zint_symbol *symbol) { int i; int preset_height = 0; int large_bar_height = 0; - + for (i = 0; i < symbol->rows; i++) { preset_height += symbol->row_height[i]; if (symbol->row_height[i] == 0) { large_bar_count++; } } - + if (large_bar_count == 0) { symbol->height = preset_height; } else { large_bar_height = (symbol->height - preset_height) / large_bar_count; } - + if (large_bar_height < 5) { for (i = 0; i < symbol->rows; i++) { if (symbol->row_height[i] == 0) { @@ -637,11 +637,11 @@ static int reduced_charset(struct zint_symbol *symbol, const unsigned char *sour break; case BARCODE_DPIDENT: error_number = dpident(symbol, preprocessed, in_length); break; - case BARCODE_UPCA: + case BARCODE_UPCA: case BARCODE_UPCA_CHK: - case BARCODE_UPCE: + case BARCODE_UPCE: case BARCODE_UPCE_CHK: - case BARCODE_EANX: + case BARCODE_EANX: case BARCODE_EANX_CHK: error_number = eanx(symbol, preprocessed, in_length); break; @@ -660,7 +660,7 @@ static int reduced_charset(struct zint_symbol *symbol, const unsigned char *sour case BARCODE_LOGMARS: error_number = c39(symbol, preprocessed, in_length); break; case BARCODE_CODE128: - case BARCODE_CODE128B: + case BARCODE_CODE128B: error_number = code_128(symbol, preprocessed, in_length); break; case BARCODE_NVE18: error_number = nve_18(symbol, preprocessed, in_length); @@ -690,7 +690,7 @@ static int reduced_charset(struct zint_symbol *symbol, const unsigned char *sour case BARCODE_RM4SCC: error_number = royal_plot(symbol, preprocessed, in_length); break; case BARCODE_AUSPOST: - case BARCODE_AUSREPLY: + case BARCODE_AUSREPLY: case BARCODE_AUSROUTE: case BARCODE_AUSREDIRECT: error_number = australia_post(symbol, preprocessed, in_length); @@ -704,26 +704,26 @@ static int reduced_charset(struct zint_symbol *symbol, const unsigned char *sour case BARCODE_ISBNX: error_number = eanx(symbol, preprocessed, in_length); break; case BARCODE_RSS14: - case BARCODE_RSS14STACK: - case BARCODE_RSS14STACK_OMNI: + case BARCODE_RSS14STACK: + case BARCODE_RSS14STACK_OMNI: error_number = rss14(symbol, preprocessed, in_length); break; case BARCODE_RSS_LTD: error_number = rsslimited(symbol, preprocessed, in_length); break; - case BARCODE_RSS_EXP: - case BARCODE_RSS_EXPSTACK: + case BARCODE_RSS_EXP: + case BARCODE_RSS_EXPSTACK: error_number = rssexpanded(symbol, preprocessed, in_length); break; - case BARCODE_EANX_CC: - case BARCODE_EAN128_CC: - case BARCODE_RSS14_CC: - case BARCODE_RSS_LTD_CC: - case BARCODE_RSS_EXP_CC: - case BARCODE_UPCA_CC: - case BARCODE_UPCE_CC: - case BARCODE_RSS14STACK_CC: - case BARCODE_RSS14_OMNI_CC: - case BARCODE_RSS_EXPSTACK_CC: + case BARCODE_EANX_CC: + case BARCODE_EAN128_CC: + case BARCODE_RSS14_CC: + case BARCODE_RSS_LTD_CC: + case BARCODE_RSS_EXP_CC: + case BARCODE_UPCA_CC: + case BARCODE_UPCE_CC: + case BARCODE_RSS14STACK_CC: + case BARCODE_RSS14_OMNI_CC: + case BARCODE_RSS_EXPSTACK_CC: error_number = composite(symbol, preprocessed, in_length); break; case BARCODE_KIX: error_number = kix_code(symbol, preprocessed, in_length); @@ -739,14 +739,14 @@ static int reduced_charset(struct zint_symbol *symbol, const unsigned char *sour break; case BARCODE_KOREAPOST: error_number = korea_post(symbol, preprocessed, in_length); break; - case BARCODE_HIBC_128: - case BARCODE_HIBC_39: - case BARCODE_HIBC_DM: - case BARCODE_HIBC_QR: - case BARCODE_HIBC_PDF: - case BARCODE_HIBC_MICPDF: - case BARCODE_HIBC_AZTEC: - case BARCODE_HIBC_BLOCKF: + case BARCODE_HIBC_128: + case BARCODE_HIBC_39: + case BARCODE_HIBC_DM: + case BARCODE_HIBC_QR: + case BARCODE_HIBC_PDF: + case BARCODE_HIBC_MICPDF: + case BARCODE_HIBC_AZTEC: + case BARCODE_HIBC_BLOCKF: error_number = hibc(symbol, preprocessed, in_length); break; case BARCODE_JAPANPOST: error_number = japan_post(symbol, preprocessed, in_length); @@ -759,8 +759,8 @@ static int reduced_charset(struct zint_symbol *symbol, const unsigned char *sour break; case BARCODE_DATAMATRIX: error_number = dmatrix(symbol, preprocessed, in_length); break; - case BARCODE_PDF417: - case BARCODE_PDF417TRUNC: + case BARCODE_PDF417: + case BARCODE_PDF417TRUNC: error_number = pdf417enc(symbol, preprocessed, in_length); break; case BARCODE_MICROPDF417: error_number = micro_pdf417(symbol, preprocessed, in_length); @@ -774,13 +774,13 @@ static int reduced_charset(struct zint_symbol *symbol, const unsigned char *sour case BARCODE_CODABLOCKF: error_number = codablock(symbol, preprocessed, in_length); break; } - + return error_number; } void strip_bom(unsigned char *source, int *input_length) { int i; - + if (*input_length > 3) { if((source[0] == 0xef) && (source[1] == 0xbb) && (source[2] == 0xbf)) { /* BOM at start of input data, strip in accordance with RFC 3629 */ @@ -875,7 +875,7 @@ int escape_char_process(struct zint_symbol *symbol, unsigned char *input_string, memcpy(input_string, escaped_string, out_posn); *length = out_posn; - + error_number = 0; return error_number; @@ -887,7 +887,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int unsigned char* local_source; #endif error_number = 0; - + if (in_length == 0) { in_length = (int)ustrlen(source); } @@ -900,7 +900,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int if (strcmp(symbol->outfile, "") == 0) { #ifdef NO_PNG strcpy(symbol->outfile, "out.gif"); -#else +#else strcpy(symbol->outfile, "out.png"); #endif } @@ -1078,7 +1078,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int memcpy(local_source, source, in_length); local_source[in_length] = '\0'; } - + if (symbol->input_mode &= ESCAPE_MODE) { error_number = escape_char_process(symbol, local_source, &in_length); if (error_number != 0) { @@ -1086,19 +1086,19 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int } symbol->input_mode -= ESCAPE_MODE; } - + if ((symbol->input_mode < 0) || (symbol->input_mode > 2)) { symbol->input_mode = DATA_MODE; } - + if ((symbol->eci != 3) && (symbol->eci != 26)) { symbol->input_mode = DATA_MODE; } - + if (symbol->input_mode == UNICODE_MODE) { strip_bom(local_source, &in_length); } - + if ((symbol->dot_size < 0.01) || (symbol->dot_size > 20.0)) { strcpy(symbol->errtxt, "221: Invalid dot size"); return ZINT_ERROR_INVALID_OPTION; @@ -1116,12 +1116,12 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int error_number = reduced_charset(symbol, local_source, in_length); break; } - + if ((error_number == ZINT_ERROR_INVALID_DATA) && (supports_eci(symbol->symbology) && (symbol->input_mode == UNICODE_MODE))) { /* Try another ECI mode */ symbol->eci = get_best_eci(local_source, in_length); - + error_number = ZINT_WARN_USES_ECI; strcpy(symbol->errtxt, "222: Encoded data includes ECI codes"); //printf("Data will encode with ECI %d\n", symbol->eci); @@ -1138,7 +1138,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int error_number = reduced_charset(symbol, local_source, in_length); break; } - + } if (error_number == 0) { @@ -1154,11 +1154,11 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int error_number = error_buffer; } error_tag(symbol->errtxt, error_number); - + if (error_number <= 5) { check_row_heights(symbol); } - + return error_number; } @@ -1391,3 +1391,4 @@ int ZBarcode_Render(struct zint_symbol *symbol, const float width, const float h int ZBarcode_Version() { return (ZINT_VERSION_MAJOR * 10000) + (ZINT_VERSION_MINOR * 100) + ZINT_VERSION_RELEASE; } + diff --git a/backend/maxicode.c b/backend/maxicode.c index be68d985..362433c5 100644 --- a/backend/maxicode.c +++ b/backend/maxicode.c @@ -489,7 +489,7 @@ int maxi_text_process(int mode, unsigned char source[], int length, int eci) { length += 5; } } - + if (((mode == 2) || (mode == 3)) && (length > 84)) { return ZINT_ERROR_TOO_LONG; } @@ -734,3 +734,4 @@ int maxicode(struct zint_symbol *symbol, unsigned char local_source[], const int return internal_error; } + diff --git a/backend/medical.c b/backend/medical.c index 860c96bd..8092633f 100644 --- a/backend/medical.c +++ b/backend/medical.c @@ -8,14 +8,14 @@ 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. + 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. + 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. + 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 @@ -26,7 +26,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -306,3 +306,4 @@ int code32(struct zint_symbol *symbol, unsigned char source[], int length) { return error_number; } + diff --git a/backend/ms_stdint.h b/backend/ms_stdint.h index 76987ab6..f1374504 100644 --- a/backend/ms_stdint.h +++ b/backend/ms_stdint.h @@ -1,32 +1,32 @@ // ISO C9x compliant stdint.h for Microsoft Visual Studio -// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 -// +// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 +// // Copyright (c) 2006-2008 Alexander Chemeris -// +// // 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. The name of the author may be used to endorse or promote products // derived from this software without specific prior written permission. -// +// // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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, +// 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. -// +// /////////////////////////////////////////////////////////////////////////////// /* @(#) $Id: ms_stdint.h,v 1.1 2009/09/19 08:16:21 hooper114 Exp $ */ @@ -49,7 +49,7 @@ // error C2733: second C linkage of overloaded function 'wmemchr' not allowed #if (_MSC_VER < 1300) && defined(__cplusplus) extern "C++" { -#endif +#endif # include #if (_MSC_VER < 1300) && defined(__cplusplus) } @@ -232,3 +232,4 @@ typedef uint64_t uintmax_t; #endif // _MSC_STDINT_H_ ] + diff --git a/backend/pcx.c b/backend/pcx.c index 20c58467..4505a53b 100644 --- a/backend/pcx.c +++ b/backend/pcx.c @@ -8,14 +8,14 @@ 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. + 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. + 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. + 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 @@ -26,7 +26,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -170,3 +170,4 @@ int pcx_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) { return 0; } + diff --git a/backend/pcx.h b/backend/pcx.h index 4497cc2e..9915e83c 100644 --- a/backend/pcx.h +++ b/backend/pcx.h @@ -7,14 +7,14 @@ 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. + 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. + 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. + 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 @@ -25,7 +25,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -44,7 +44,7 @@ extern "C" { #endif #pragma pack (1) - + typedef struct pcx_header { uint8_t manufacturer; uint8_t version; @@ -67,10 +67,11 @@ extern "C" { } pcx_header_t; #pragma pack () - + #ifdef __cplusplus } #endif #endif /* PCX_H */ + diff --git a/backend/pdf417.c b/backend/pdf417.c index 2ec380ed..62eb4cd6 100644 --- a/backend/pdf417.c +++ b/backend/pdf417.c @@ -601,12 +601,12 @@ static int pdf417(struct zint_symbol *symbol, unsigned char chaine[], const size /* 541 - now compress the data */ indexchaine = 0; mclength = 0; - + if (symbol->output_options & READER_INIT) { chainemc[mclength] = 921; /* Reader Initialisation */ mclength++; } - + if (symbol->eci != 3) { /* Encoding ECI assignment number, according to Table 8 */ if (symbol->eci <= 899) { @@ -630,12 +630,12 @@ static int pdf417(struct zint_symbol *symbol, unsigned char chaine[], const size mclength++; } } - + if (symbol->eci > 811799) { strcpy(symbol->errtxt, "472: Invalid ECI"); return ZINT_ERROR_INVALID_OPTION; } - + for (i = 0; i < indexliste; i++) { switch (liste[1][i]) { case TEX: /* 547 - text mode */ @@ -798,21 +798,21 @@ static int pdf417(struct zint_symbol *symbol, unsigned char chaine[], const size bin_append(pdf_bitpattern[offset + dummy[j]], 16, pattern); strcat(pattern, "0"); } - + if (symbol->symbology != BARCODE_PDF417TRUNC) { bin_append(pdf_bitpattern[offset + dummy[j]], 16, pattern); strcat(pattern, "0"); bin_append(0x3FA29, 18, pattern); /* Row Stop */ } - + for (loop = 0; loop < strlen(pattern); loop++) { if (pattern[loop] == '1') { set_module(symbol, i, loop); } } - + symbol->row_height[i] = 3; - + } symbol->rows = (mclength / symbol->option_2); symbol->width =(int)strlen(pattern); @@ -930,17 +930,17 @@ int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], const size_ /* 541 - now compress the data */ indexchaine = 0; mclength = 0; - + if (symbol->output_options & READER_INIT) { chainemc[mclength] = 921; /* Reader Initialisation */ mclength++; } - + if (symbol->eci > 811799) { strcpy(symbol->errtxt, "473: Invalid ECI"); return ZINT_ERROR_INVALID_OPTION; } - + if (symbol->eci != 3) { /* Encoding ECI assignment number, according to Table 8 */ if (symbol->eci <= 899) { @@ -964,7 +964,7 @@ int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], const size_ mclength++; } } - + for (i = 0; i < indexliste; i++) { switch (liste[1][i]) { case TEX: /* 547 - text mode */ @@ -1289,3 +1289,4 @@ int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], const size_ return codeerr; } + diff --git a/backend/plessey.c b/backend/plessey.c index 68ed2007..83278cb1 100644 --- a/backend/plessey.c +++ b/backend/plessey.c @@ -8,14 +8,14 @@ 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. + 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. + 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. + 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 @@ -26,7 +26,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -49,7 +49,7 @@ static const char *MSITable[10] = { }; /* Not MSI/Plessey but the older Plessey standard */ -int plessey(struct zint_symbol *symbol, unsigned char source[], const size_t length) { +int plessey(struct zint_symbol *symbol, unsigned char source[], const size_t length) { unsigned int i; unsigned char *checkptr; @@ -111,7 +111,7 @@ int plessey(struct zint_symbol *symbol, unsigned char source[], const size_t len } /* Plain MSI Plessey - does not calculate any check character */ -int msi_plessey(struct zint_symbol *symbol, unsigned char source[], const size_t length) { +int msi_plessey(struct zint_symbol *symbol, unsigned char source[], const size_t length) { size_t i; char dest[512]; /* 2 + 55 * 8 + 3 + 1 ~ 512 */ @@ -307,7 +307,7 @@ int msi_plessey_mod1010(struct zint_symbol *symbol, unsigned char source[], cons return error_number; } -/* Calculate a Modulo 11 check digit using the system discussed on Wikipedia - +/* Calculate a Modulo 11 check digit using the system discussed on Wikipedia - see http://en.wikipedia.org/wiki/Talk:MSI_Barcode */ int msi_plessey_mod11(struct zint_symbol *symbol, unsigned char source[], const unsigned int src_len) { /* uses the IBM weight system */ @@ -491,3 +491,4 @@ int msi_handle(struct zint_symbol *symbol, unsigned char source[], int length) { return error_number; } + diff --git a/backend/png.c b/backend/png.c index bd47c8a3..62ccf2f0 100644 --- a/backend/png.c +++ b/backend/png.c @@ -8,14 +8,14 @@ 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. + 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. + 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. + 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 @@ -26,7 +26,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -86,7 +86,7 @@ int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) { #endif graphic = &wpng_info; - + graphic->width = symbol->bitmap_width; graphic->height = symbol->bitmap_height; @@ -190,3 +190,4 @@ int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) { } #endif /* NO_PNG */ + diff --git a/backend/postal.c b/backend/postal.c index 1a8844b9..241ecd9a 100644 --- a/backend/postal.c +++ b/backend/postal.c @@ -1,6 +1,6 @@ /* postal.c - Handles PostNet, PLANET, FIM. RM4SCC and Flattermarken */ -/* +/* libzint - the open source barcode library Copyright (C) 2008-2017 Robin Stuart Including bug fixes by Bryan Hatton @@ -9,14 +9,14 @@ 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. + 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. + 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. + 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 @@ -27,7 +27,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -35,7 +35,7 @@ #include #include #ifdef _MSC_VER -#include +#include #endif #include "common.h" @@ -351,7 +351,7 @@ int royal_plot(struct zint_symbol *symbol, unsigned char source[], int length) { return error_number; } /*check = */rm4scc((char*) source, (unsigned char*) height_pattern, length); - + writer = 0; h = strlen(height_pattern); for (loopey = 0; loopey < h; loopey++) { @@ -398,7 +398,7 @@ int kix_code(struct zint_symbol *symbol, unsigned char source[], int length) { } strcpy(localstr, (char *) source); - + /* Encode data */ for (i = 0; i < length; i++) { lookup(KRSET, RoyalTable, localstr[i], height_pattern); @@ -526,7 +526,7 @@ int japan_post(struct zint_symbol *symbol, unsigned char source[], int length) { strcpy(symbol->errtxt, "496: Input too long"); return ZINT_ERROR_TOO_LONG; } - + inter_posn = 0; error_number = 0; @@ -619,3 +619,4 @@ int japan_post(struct zint_symbol *symbol, unsigned char source[], int length) { return error_number; } + diff --git a/backend/ps.c b/backend/ps.c index 0e7af594..bdfae1cc 100644 --- a/backend/ps.c +++ b/backend/ps.c @@ -59,7 +59,7 @@ int ps_plot(struct zint_symbol *symbol) { unsigned char local_text[ustrlen(symbol->text) + 1]; #else unsigned char* local_text = (unsigned char*) malloc(ustrlen(symbol->text) + 1); -#endif +#endif row_height = 0; textdone = 0; @@ -974,3 +974,4 @@ int ps_plot(struct zint_symbol *symbol) { return error_number; } + diff --git a/backend/qr.c b/backend/qr.c index f2944065..932b6281 100644 --- a/backend/qr.c +++ b/backend/qr.c @@ -164,7 +164,7 @@ static void qr_binary(int datastream[], const int version, const int target_binl if (gs1) { strcat(binary, "0101"); /* FNC1 */ } - + if (eci != 3) { strcat(binary, "0111"); /* ECI (Table 4) */ if (eci <= 127) { @@ -210,15 +210,15 @@ static void qr_binary(int datastream[], const int version, const int target_binl for (i = 0; i < short_data_block_length; i++) { int jis = jisdata[position + i]; int prod; - + if (jis >= 0x8140 && jis <= 0x9ffc) jis -= 0x8140; - + else if (jis >= 0xe040 && jis <= 0xebbf) jis -= 0xc140; - + prod = ((jis >> 8) * 0xc0) + (jis & 0xff); - + bin_append(prod, 13, binary); if (debug) { @@ -547,7 +547,7 @@ static void add_ecc(int fullstream[],const int datastream[],const int version,co static void place_finder(unsigned char grid[],const int size,const int x,const int y) { int xp, yp; char finder[] = {0x7F, 0x41, 0x5D, 0x5D, 0x5D, 0x41, 0x7F}; - + for (xp = 0; xp < 7; xp++) { for (yp = 0; yp < 7; yp++) { if (finder[yp] & 0x40 >> xp) { @@ -1327,7 +1327,7 @@ static int getBinaryLength(const int version,char inputMode[],const int inputDat if (gs1 == 1) { count += 4; } - + if (eci != 3) { count += 12; } @@ -1545,7 +1545,7 @@ int qr_code(struct zint_symbol *symbol, const unsigned char source[], size_t len version = symbol->option_2; est_binlen = getBinaryLength(symbol->option_2, mode, jisdata, length, gs1, symbol->eci); } - + if (symbol->option_2 < version) { strcpy(symbol->errtxt, "569: Input too long for selected symbol size"); return ZINT_ERROR_TOO_LONG; @@ -1679,13 +1679,13 @@ static int micro_qr_intermediate(char binary[], const int jisdata[], const char for (i = 0; i < short_data_block_length; i++) { int jis = jisdata[position + i]; int prod; - + if (jis >= 0x8140 && jis <= 0x9ffc) jis -= 0x8140; - + else if (jis >= 0xe040 && jis <= 0xebbf) jis -= 0xc140; - + prod = ((jis >> 8) * 0xc0) + (jis & 0xff); bin_append(prod, 13, binary); @@ -2123,7 +2123,7 @@ static void micro_qr_m2(char binary_data[],const int ecc_mode) { /* Copy data into codewords */ for (i = 0; i < data_codewords; i++) { data_blocks[i] = 0; - + for (j = 0; j < 8; j++) { if (binary_data[(i * 8) + j] == '1') { data_blocks[i] += 0x80 >> j; @@ -2217,7 +2217,7 @@ static void micro_qr_m3(char binary_data[],const int ecc_mode) { /* Copy data into codewords */ for (i = 0; i < (data_codewords - 1); i++) { data_blocks[i] = 0; - + for (j = 0; j < 8; j++) { if (binary_data[(i * 8) + j] == '1') { data_blocks[i] += 0x80 >> j; @@ -2322,7 +2322,7 @@ static void micro_qr_m4(char binary_data[],const int ecc_mode) { /* Copy data into codewords */ for (i = 0; i < data_codewords; i++) { data_blocks[i] = 0; - + for (j = 0; j < 8; j++) { if (binary_data[(i * 8) + j] == '1') { data_blocks[i] += 0x80 >> j; @@ -2886,7 +2886,7 @@ int upnqr(struct zint_symbol *symbol, const unsigned char source[], size_t lengt int* jisdata = (int *) _alloca((length + 1) * sizeof (int)); char* mode = (char *) _alloca(length + 1); #endif - + #ifndef _MSC_VER unsigned char preprocessed[length + 1]; #else @@ -2920,7 +2920,7 @@ int upnqr(struct zint_symbol *symbol, const unsigned char source[], size_t lengt symbol->eci = 4; est_binlen = getBinaryLength(15, mode, jisdata, length, 0, symbol->eci); - + ecc_level = LEVEL_M; if (est_binlen > 3320) { @@ -2959,13 +2959,13 @@ int upnqr(struct zint_symbol *symbol, const unsigned char source[], size_t lengt setup_grid(grid, size, version); populate_grid(grid, size, fullstream, qr_total_codewords[version - 1]); - + add_version_info(grid, size, version); bitmask = apply_bitmask(grid, size, ecc_level); add_format_info(grid, size, ecc_level, bitmask); - + symbol->width = size; symbol->rows = size; @@ -2981,3 +2981,4 @@ int upnqr(struct zint_symbol *symbol, const unsigned char source[], size_t lengt return 0; } + diff --git a/backend/raster.c b/backend/raster.c index 1eee4fdf..82ce3c41 100644 --- a/backend/raster.c +++ b/backend/raster.c @@ -8,14 +8,14 @@ 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. + 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. + 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. + 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 @@ -26,7 +26,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -40,7 +40,7 @@ #include "common.h" #ifdef _MSC_VER -#include +#include #endif /* _MSC_VER */ #include "font.h" /* Font for human readable text */ @@ -59,16 +59,16 @@ void buffer_plot(struct zint_symbol *symbol, char *pixelbuf) { /* Place pixelbuffer into symbol */ int fgred, fggrn, fgblu, bgred, bggrn, bgblu; int row, column, i; - + symbol->bitmap = (char *) malloc(symbol->bitmap_width * symbol->bitmap_height * 3); - + 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]); - + for (row = 0; row < symbol->bitmap_height; row++) { for (column = 0; column < symbol->bitmap_width; column++) { i = ((row * symbol->bitmap_width) + column) * 3; @@ -92,9 +92,9 @@ void buffer_plot(struct zint_symbol *symbol, char *pixelbuf) { int save_raster_image_to_file(struct zint_symbol *symbol, int image_height, int image_width, char *pixelbuf, int rotate_angle, int image_type) { int error_number; int row, column; - + char *rotated_pixbuf; - + if (!(rotated_pixbuf = (char *) malloc(image_width * image_height))) { strcpy(symbol->errtxt, "650: Insufficient memory for pixel buffer"); return ZINT_ERROR_ENCODING_PROBLEM; @@ -112,7 +112,7 @@ int save_raster_image_to_file(struct zint_symbol *symbol, int image_height, int symbol->bitmap_height = image_width; break; } - + /* sort out colour options */ to_upper((unsigned char*) symbol->fgcolour); to_upper((unsigned char*) symbol->bgcolour); @@ -139,7 +139,7 @@ int save_raster_image_to_file(struct zint_symbol *symbol, int image_height, int free(rotated_pixbuf); return ZINT_ERROR_INVALID_OPTION; } - + /* Rotate image before plotting */ switch (rotate_angle) { case 0: /* Plot the right way up */ @@ -175,7 +175,7 @@ int save_raster_image_to_file(struct zint_symbol *symbol, int image_height, int } break; } - + switch (image_type) { case OUT_BUFFER: buffer_plot(symbol, rotated_pixbuf); @@ -225,7 +225,7 @@ void draw_bar(char *pixelbuf, int xpos, int xlen, int ypos, int ylen, int image_ void draw_circle(char *pixelbuf, int image_width, int image_height, int x0, int y0, float radius, char fill) { int x, y; int radius_i = (int) radius; - + for (y = -radius_i; y <= radius_i; y++) { for (x = -radius_i; x <= radius_i; x++) { if ((x * x) + (y * y) <= (radius_i * radius_i)) { @@ -240,7 +240,7 @@ void draw_circle(char *pixelbuf, int image_width, int image_height, int x0, int void draw_bullseye(char *pixelbuf, int image_width, int image_height, int cx, int cy, int scaler) { /* Central bullseye in Maxicode symbols */ - + draw_circle(pixelbuf, image_width, image_height, cx, cy, (int)(4.571 * scaler) + 1, '1'); draw_circle(pixelbuf, image_width, image_height, cx, cy, (int)(3.779 * scaler) + 1, '0'); draw_circle(pixelbuf, image_width, image_height, cx, cy, (int)(2.988 * scaler) + 1, '1'); @@ -252,7 +252,7 @@ void draw_bullseye(char *pixelbuf, int image_width, int image_height, int cx, in void draw_hexagon(char *pixelbuf, int image_width, char *scaled_hexagon, int hexagon_size, int xposn, int yposn) { /* Put a hexagon into the pixel buffer */ int i, j; - + for (i = 0; i < hexagon_size; i++) { for (j = 0; j < hexagon_size; j++) { if (scaled_hexagon[(i * hexagon_size) + j] == '1') { @@ -410,10 +410,10 @@ void plot_hexline(char *scaled_hexagon, int hexagon_size, float start_x, float s /* Draw a straight line from start to end */ int i; float inc_x, inc_y; - + inc_x = (end_x - start_x) / hexagon_size; inc_y = (end_y - start_y) / hexagon_size; - + for (i = 0; i < hexagon_size; i++) { float this_x = start_x + ((float)i * inc_x); float this_y = start_y + ((float)i * inc_y); @@ -426,26 +426,26 @@ void plot_hexline(char *scaled_hexagon, int hexagon_size, float start_x, float s void plot_hexagon(char *scaled_hexagon, int hexagon_size) { /* Create a hexagon shape and fill it */ int line, i; - + float x_offset[6]; float y_offset[6]; float start_x, start_y; float end_x, end_y; - + x_offset[0] = 0.0; x_offset[1] = 0.86; x_offset[2] = 0.86; x_offset[3] = 0.0; x_offset[4] = -0.86; x_offset[5] = -0.86; - + y_offset[0] = 1.0; y_offset[1] = 0.5; y_offset[2] = -0.5; y_offset[3] = -1.0; y_offset[4] = -0.5; y_offset[5] = 0.5; - + /* Plot hexagon outline */ for (line = 0; line < 5; line++) { start_x = ((float)hexagon_size / 2.0) + (((float)hexagon_size / 2.0) * x_offset[line]); @@ -459,7 +459,7 @@ void plot_hexagon(char *scaled_hexagon, int hexagon_size) { end_x = ((float)hexagon_size / 2.0) + (((float)hexagon_size / 2.0) * x_offset[0]); end_y = ((float)hexagon_size / 2.0) + (((float)hexagon_size / 2.0) * y_offset[0]); plot_hexline(scaled_hexagon, hexagon_size, start_x, start_y, end_x, end_y); - + /* Fill hexagon */ for (line = 0; line < hexagon_size; line++) { char ink = '0'; @@ -471,7 +471,7 @@ void plot_hexagon(char *scaled_hexagon, int hexagon_size) { ink = '0'; } } - + if (ink == '1') { scaled_hexagon[(hexagon_size * line) + i] = ink; } @@ -489,7 +489,7 @@ int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, int data_ float scaler = symbol->scale; char *scaled_hexagon; int hexagon_size; - + xoffset = symbol->border_width + symbol->whitespace_width; yoffset = symbol->border_width; image_width = (300 + (2 * xoffset * 2)) * scaler; @@ -503,9 +503,9 @@ int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, int data_ *(pixelbuf + i) = '0'; } } - + hexagon_size = (int)scaler * 10; - + if (!(scaled_hexagon = (char *) malloc(hexagon_size * hexagon_size))) { strcpy(symbol->errtxt, "656: Insufficient memory for pixel buffer"); free(scaled_hexagon); @@ -516,7 +516,7 @@ int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, int data_ *(scaled_hexagon + i) = '0'; } } - + plot_hexagon(scaled_hexagon, hexagon_size); for (row = 0; row < symbol->rows; row++) { @@ -535,12 +535,12 @@ int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, int data_ } } } - + draw_bullseye(pixelbuf, image_width, image_height, (int)(((14.5 * 10.0) + (2.0 * xoffset)) * scaler), (int)(((16.5 * 9.0) + (2.0 * yoffset)) * scaler), scaler * 10); - + // Virtual hexagon //draw_hexagon(pixelbuf, image_width, scaled_hexagon, hexagon_size, ((14 * 10) + (2 * xoffset)) * scaler, ((16 * 9) + (2 * yoffset)) * scaler); - + if ((symbol->output_options & BARCODE_BOX) || (symbol->output_options & BARCODE_BIND)) { /* boundary bars */ draw_bar(pixelbuf, 0, image_width, 0, symbol->border_width * 2, image_width, image_height); @@ -1128,7 +1128,7 @@ int plot_raster(struct zint_symbol *symbol, int rotate_angle, int file_type) { if (file_type == OUT_PNG_FILE) { return ZINT_ERROR_INVALID_OPTION; } -#endif /* NO_PNG */ +#endif /* NO_PNG */ if (symbol->output_options & BARCODE_DOTTY_MODE) { error = plot_raster_dotty(symbol, rotate_angle, file_type); @@ -1143,3 +1143,4 @@ int plot_raster(struct zint_symbol *symbol, int rotate_angle, int file_type) { return error; } + diff --git a/backend/reedsol.c b/backend/reedsol.c index e0d55052..53b4e565 100644 --- a/backend/reedsol.c +++ b/backend/reedsol.c @@ -1,20 +1,20 @@ -/** - +/** + This is a simple Reed-Solomon encoder (C) Cliff Hones 2004 - + 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. + 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. + 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. + 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 @@ -25,8 +25,8 @@ 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. + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. */ // It is not written with high efficiency in mind, so is probably @@ -162,3 +162,4 @@ void rs_free(void) { free(rspoly); rspoly = NULL; } + diff --git a/backend/reedsol.h b/backend/reedsol.h index 24e336e6..73630f18 100644 --- a/backend/reedsol.h +++ b/backend/reedsol.h @@ -1,20 +1,20 @@ -/* +/* This is a simple Reed-Solomon encoder (C) Cliff Hones 2004 - + 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. + 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. + 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. + 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 @@ -25,7 +25,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -48,3 +48,4 @@ extern void rs_encode_long(const int len,const unsigned int *data, unsigned int #endif /* __cplusplus */ #endif /* __REEDSOL_H */ + diff --git a/backend/render.c b/backend/render.c index ce10ccc2..410454a1 100644 --- a/backend/render.c +++ b/backend/render.c @@ -1,5 +1,5 @@ -/* - * render.c - Generic Rendered Format +/* + * render.c - Generic Rendered Format * * Initiall written by Sam Lown for use in gLabels. Converts encoded * data into a generic internal structure of lines and characters @@ -14,14 +14,14 @@ 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. + 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. + 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. + 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 @@ -32,7 +32,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -101,7 +101,7 @@ int render_plot(struct zint_symbol *symbol, float width, float height) { addon_width_x = 0; /* - * Determine if there will be any addon texts and text height + * Determine if there will be any addon texts and text height */ latch = 0; r = 0; @@ -688,7 +688,7 @@ int render_plot(struct zint_symbol *symbol, float width, float height) { } /* - * Create a new line with its memory allocated ready for adding to the + * Create a new line with its memory allocated ready for adding to the * rendered structure. * * This is much quicker than writing out each line manually (in some cases!) @@ -709,7 +709,7 @@ struct zint_render_line *render_plot_create_line(float x, float y, float width, } /* - * Add the line to the current rendering and update the last line's + * Add the line to the current rendering and update the last line's * next value. */ int render_plot_add_line(struct zint_symbol *symbol, struct zint_render_line *line, struct zint_render_line **last_line) { @@ -848,3 +848,4 @@ void render_free(struct zint_symbol *symbol) { } } + diff --git a/backend/rss.c b/backend/rss.c index f67b8193..5ce6216f 100644 --- a/backend/rss.c +++ b/backend/rss.c @@ -8,14 +8,14 @@ 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. + 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. + 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. + 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 @@ -26,25 +26,25 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* The functions "combins" and "getRSSwidths" are copyright BSI and are released with permission under the following terms: - + "Copyright subsists in all BSI publications. BSI also holds the copyright, in the UK, of the international standardisation bodies. Except as permitted under the Copyright, Designs and Patents Act 1988 no extract may be reproduced, stored in a retrieval system or transmitted in any form or by any means - electronic, photocopying, recording or otherwise - without prior written permission from BSI. - + "This does not preclude the free use, in the course of implementing the standard, of necessary details such as symbols, and size, type or grade designations. If these details are to be used for any other purpose than implementation then the prior written permission of BSI must be obtained." - + The date of publication for these functions is 30 November 2006 */ @@ -52,7 +52,7 @@ /* Note: This code reflects the symbol names as used in ISO/IEC 24724:2006. These names * were updated in ISO/IEC 24724:2011 as follows: - * + * * RSS-14 > GS1 DataBar Omnidirectional * RSS-14 Truncated > GS1 DataBar Truncated * RSS-14 Stacked > GS1 DataBar Stacked @@ -66,7 +66,7 @@ #include #include #ifdef _MSC_VER -#include +#include #endif #include "common.h" #include "large.h" @@ -517,7 +517,7 @@ int rss14(struct zint_symbol *symbol, unsigned char source[], int src_len) { hrt[13] = itoc(check_digit); strcat((char*) symbol->text, hrt); - + set_minimum_height(symbol, 14); // Minimum height is 14X for truncated symbol } @@ -721,7 +721,7 @@ int rss14(struct zint_symbol *symbol, unsigned char source[], int src_len) { } } symbol->rows = symbol->rows + 1; - + set_minimum_height(symbol, 33); } @@ -1049,7 +1049,7 @@ int rsslimited(struct zint_symbol *symbol, unsigned char source[], int src_len) hrt[14] = '\0'; strcat((char*) symbol->text, hrt); - + set_minimum_height(symbol, 10); return error_number; @@ -1422,12 +1422,12 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str bin_append(atoi(weight_str), 15, binary_string); } } - + if ((encoding_method == 5) || (encoding_method == 6)) { /* Encoding method "01100" - variable measure item and price */ /* Encoding method "01101" - variable measure item and price with ISO 4217 Currency Code */ - + char group[4]; for (i = 1; i < 5; i++) { @@ -1435,15 +1435,15 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str group[1] = source[(i * 3) + 1]; group[2] = source[(i * 3) + 2]; group[3] = '\0'; - + bin_append(atoi(group), 10, binary_string); } bin_append(source[19] - '0', 2, binary_string); - + if (encoding_method == 6) { char currency_str[5]; - + for (i = 0; i < 3; i++) { currency_str[i] = source[20 + i]; } @@ -1465,7 +1465,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str group[1] = source[(i * 3) + 1]; group[2] = source[(i * 3) + 2]; group[3] = '\0'; - + bin_append(atoi(group), 10, binary_string); } @@ -1475,7 +1475,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str weight_str[i + 1] = source[21 + i]; } weight_str[6] = '\0'; - + bin_append(atoi(weight_str), 20, binary_string); if (strlen(source) == 34) { @@ -1665,12 +1665,12 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str } last_mode = ALPHA; - + if (general_field[i] == '[') { bin_append(15, 5, binary_string); last_mode = NUMERIC; } /* FNC1/Numeric latch */ - + if (general_field[i] == '*') bin_append(58, 6, binary_string); /* asterisk */ if (general_field[i] == ',') bin_append(59, 6, binary_string); /* comma */ if (general_field[i] == '-') bin_append(60, 6, binary_string); /* minus or hyphen */ @@ -1704,12 +1704,12 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str bin_append(general_field[i] - 7, 7, binary_string); } last_mode = ISOIEC; - + if (general_field[i] == '[') { bin_append(15, 5, binary_string); last_mode = NUMERIC; } /* FNC1/Numeric latch */ - + if (general_field[i] == '!') bin_append(232, 8, binary_string); /* exclamation mark */ if (general_field[i] == 34) bin_append(233, 8, binary_string); /* quotation mark */ if (general_field[i] == 37) bin_append(234, 8, binary_string); /* percent sign */ @@ -1744,29 +1744,29 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str remainder = 0; } symbol_characters = ((strlen(binary_string) + remainder) / 12) + 1; - + if ((symbol->symbology == BARCODE_RSS_EXPSTACK) || (symbol->symbology == BARCODE_RSS_EXPSTACK_CC)) { characters_per_row = symbol->option_2 * 2; - + if ((characters_per_row < 2) || (characters_per_row > 20)) { characters_per_row = 4; } - + if ((symbol_characters % characters_per_row) == 1) { symbol_characters++; } - + if (symbol_characters < 4) { symbol_characters = 4; } } - + if (symbol_characters < 3) { symbol_characters = 3; } - + remainder = (12 * (symbol_characters - 1)) - strlen(binary_string); - + if (latch == 1) { /* There is still one more numeric digit to encode */ if (debug) printf("Adding extra (odd) numeric digit\n"); @@ -1811,7 +1811,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str } remainder = (12 * (symbol_characters - 1)) - strlen(binary_string); - + if (debug) printf("Resultant binary = %s\n", binary_string); if (debug) printf("\tLength: %d\n", (int) strlen(binary_string)); } @@ -1835,7 +1835,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str padstring[remainder] = '\0'; strcat(binary_string, padstring); - + /* Patch variable length symbol bit field */ d1 = symbol_characters & 1; @@ -2035,13 +2035,13 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len) if ((symbol->symbology == BARCODE_RSS_EXP) || (symbol->symbology == BARCODE_RSS_EXP_CC)) { /* Copy elements into symbol */ - + elements[0] = 1; // left guard elements[1] = 1; - + elements[pattern_width - 2] = 1; // right guard elements[pattern_width - 1] = 1; - + writer = 0; latch = '0'; for (i = 0; i < pattern_width; i++) { @@ -2154,7 +2154,7 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len) } elements_in_sub++; } - } else { + } else { /* right to left */ left_to_right = 0; i = 2 + (((current_row * symbol->option_2) - reader - 1) * 21); @@ -2303,7 +2303,7 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len) } } - + for (i = 0; i < symbol->rows; i++) { if (symbol->row_height[i] == 0) { symbol->row_height[i] = 34; @@ -2313,3 +2313,4 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len) return 0; } + diff --git a/backend/rss.h b/backend/rss.h index ae47d999..d8fcdc25 100644 --- a/backend/rss.h +++ b/backend/rss.h @@ -8,14 +8,14 @@ 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. + 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. + 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. + 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 @@ -26,7 +26,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -296,3 +296,4 @@ static const char weight_rows[210] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 17, 18, 19, 20, 21, 22, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 13, 14, 11, 12, 17, 18, 15, 16, 21, 22, 19, 20 }; + diff --git a/backend/sjis.h b/backend/sjis.h index 629d3e16..749e0362 100644 --- a/backend/sjis.h +++ b/backend/sjis.h @@ -7,14 +7,14 @@ 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. + 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. + 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. + 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 @@ -25,13 +25,13 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* Derived from : ## Shift_JIS (JIS X 0208:1997 Appendix 1) vs Unicode mapping table -## +## ## Date: 06 Mar 2002 06:01:22 GMT ## License: ## Copyright (C) 2001 earthian@tama.or.jp, All Rights Reserved. @@ -207,7 +207,7 @@ static const unsigned short int sjis_lookup[] = { 0x222C, 0x81E8, // DOUBLE INTEGRAL 0x2234, 0x8188, // THEREFORE 0x2235, 0x81E6, // BECAUSE - 0x223D, 0x81E4, // REVERSED TILDE + 0x223D, 0x81E4, // REVERSED TILDE 0x2252, 0x81E0, // APPROXIMATELY EQUAL TO OR THE IMAGE OF 0x2260, 0x8182, // NOT EQUAL TO 0x2261, 0x81DF, // IDENTICAL TO @@ -6881,6 +6881,6 @@ static const unsigned short int sjis_lookup[] = { 0xFF5B, 0x816F, // FULLWIDTH LEFT CURLY BRACKET 0xFF5C, 0x8162, // FULLWIDTH VERTICAL LINE 0xFF5D, 0x8170, // FULLWIDTH RIGHT CURLY BRACKET - 0xFFE3, 0x8150, // FULLWIDTH MACRON + 0xFFE3, 0x8150, // FULLWIDTH MACRON 0xFFE5, 0x818F // FULLWIDTH YEN SIGN -}; \ No newline at end of file +}; diff --git a/backend/stdint_msvc.h b/backend/stdint_msvc.h index 0b3800a1..2d7c82d6 100644 --- a/backend/stdint_msvc.h +++ b/backend/stdint_msvc.h @@ -7,14 +7,14 @@ 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. + 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. + 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. + 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 @@ -25,7 +25,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -51,3 +51,4 @@ typedef INT32 int32_t; #endif /* STDINT_MSVC_H */ + diff --git a/backend/svg.c b/backend/svg.c index a36584b1..2eb29025 100644 --- a/backend/svg.c +++ b/backend/svg.c @@ -8,14 +8,14 @@ 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. + 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. + 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. + 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 @@ -26,7 +26,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -212,7 +212,7 @@ int svg_plot(struct zint_symbol *symbol) { local_text[i] = ' '; } } - + if (ustrlen(local_text) != 0) { textoffset = 9; } else { @@ -677,3 +677,4 @@ int svg_plot(struct zint_symbol *symbol) { return error_number; } + diff --git a/backend/telepen.c b/backend/telepen.c index f82c4d49..1f4be8d7 100644 --- a/backend/telepen.c +++ b/backend/telepen.c @@ -8,14 +8,14 @@ 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. + 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. + 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. + 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 @@ -26,7 +26,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -165,3 +165,4 @@ int telepen_num(struct zint_symbol *symbol, unsigned char source[], const size_t ustrcpy(symbol->text, temp); return error_number; } + diff --git a/backend/tif.c b/backend/tif.c index 901b47c8..70dc498c 100644 --- a/backend/tif.c +++ b/backend/tif.c @@ -8,14 +8,14 @@ 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. + 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. + 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. + 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 @@ -26,7 +26,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -61,19 +61,19 @@ int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) { uint32_t* strip_offset; uint32_t* strip_bytes; #endif - + tiff_header_t header; tiff_ifd_t ifd; uint16_t temp; uint32_t temp32; - + 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]); - + rows_per_strip = 8192 / (symbol->bitmap_width * 3); if (rows_per_strip == 0) { rows_per_strip = 1; @@ -83,7 +83,7 @@ int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) { if ((symbol->bitmap_height % rows_per_strip) != 0) { strip_count++; } - + #ifndef _MSC_VER uint32_t strip_offset[strip_count]; uint32_t strip_bytes[strip_count]; @@ -92,7 +92,7 @@ int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) { strip_bytes = (uint32_t*) _alloca(strip_count * sizeof(uint32_t)); #endif free_memory = 8; - + for(i = 0; i < strip_count; i++) { strip_offset[i] = free_memory; if (i != (strip_count - 1)) { @@ -109,7 +109,7 @@ int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) { free_memory++; } } - + if (free_memory > 0xffff0000) { #ifdef _MSC_VER free(strip_offset); @@ -134,15 +134,15 @@ int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) { return ZINT_ERROR_FILE_ACCESS; } } - + /* Header */ header.byte_order = 0x4949; header.identity = 42; header.offset = free_memory; - + fwrite(&header, sizeof(tiff_header_t), 1, tif_file); free_memory += sizeof(tiff_ifd_t); - + /* Pixel data */ for (row = 0; row < symbol->bitmap_height; row++) { for (column = 0; column < symbol->bitmap_width; column++) { @@ -164,126 +164,126 @@ int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) { } } } - - /* Image File Directory */ + + /* Image File Directory */ ifd.entries = 14; ifd.offset = 0; - + ifd.new_subset.tag = 0xfe; ifd.new_subset.type = 4; ifd.new_subset.count = 1; ifd.new_subset.offset = 0; - + ifd.image_width.tag = 0x0100; ifd.image_width.type = 3; // SHORT ifd.image_width.count = 1; ifd.image_width.offset = symbol->bitmap_width; - + ifd.image_length.tag = 0x0101; ifd.image_length.type = 3; // SHORT ifd.image_length.count = 1; ifd.image_length.offset = symbol->bitmap_height; - + ifd.bits_per_sample.tag = 0x0102; ifd.bits_per_sample.type = 3; // SHORT ifd.bits_per_sample.count = 3; ifd.bits_per_sample.offset = free_memory; free_memory += 6; - + ifd.compression.tag = 0x0103; ifd.compression.type = 3; ifd.compression.count = 1; ifd.compression.offset = 1; // Uncompressed - + ifd.photometric.tag = 0x0106; ifd.photometric.type = 3; // SHORT ifd.photometric.count = 1; ifd.photometric.offset = 2; // RGB Model - + ifd.strip_offsets.tag = 0x0111; ifd.strip_offsets.type = 4; // LONG ifd.strip_offsets.count = strip_count; ifd.strip_offsets.offset = free_memory; free_memory += strip_count * 4; - + ifd.samples_per_pixel.tag = 0x0115; ifd.samples_per_pixel.type = 3; ifd.samples_per_pixel.count = 1; ifd.samples_per_pixel.offset = 3; - + ifd.rows_per_strip.tag = 0x0116; ifd.rows_per_strip.type = 4; ifd.rows_per_strip.count = 1; ifd.rows_per_strip.offset = rows_per_strip; - + ifd.strip_byte_counts.tag = 0x0117; ifd.strip_byte_counts.type = 4; ifd.strip_byte_counts.count = strip_count; ifd.strip_byte_counts.offset = free_memory; free_memory += strip_count * 4; - + ifd.x_resolution.tag = 0x011a; ifd.x_resolution.type = 5; ifd.x_resolution.count = 1; ifd.x_resolution.offset = free_memory; free_memory += 8; - + ifd.y_resolution.tag = 0x011b; ifd.y_resolution.type = 5; ifd.y_resolution.count = 1; ifd.y_resolution.offset = free_memory; // free_memory += 8; - + ifd.planar_config.tag = 0x11c; ifd.planar_config.type = 3; ifd.planar_config.count = 1; ifd.planar_config.offset = 1; - + ifd.resolution_unit.tag = 0x0128; ifd.resolution_unit.type = 3; ifd.resolution_unit.count = 1; ifd.resolution_unit.offset = 2; // Inches - + fwrite(&ifd, sizeof(tiff_ifd_t), 1, tif_file); - + /* Bits per sample */ temp = 8; fwrite(&temp, 2, 1, tif_file); // Red Bytes fwrite(&temp, 2, 1, tif_file); // Green Bytes fwrite(&temp, 2, 1, tif_file); // Blue Bytes - + /* Strip offsets */ for(i = 0; i < strip_count; i++) { fwrite(&strip_offset[i], 4, 1, tif_file); } - + /* Strip byte lengths */ for(i = 0; i < strip_count; i++) { fwrite(&strip_bytes[i], 4, 1, tif_file); } - + /* X Resolution */ temp32 = 72; fwrite(&temp32, 4, 1, tif_file); temp32 = 1; fwrite(&temp32, 4, 1, tif_file); - + /* Y Resolution */ temp32 = 72; fwrite(&temp32, 4, 1, tif_file); temp32 = 1; fwrite(&temp32, 4, 1, tif_file); - + if (symbol->output_options & BARCODE_STDOUT) { fflush(tif_file); } else { fclose(tif_file); } - + #ifdef _MSC_VER free(strip_offset); free(strip_bytes); #endif - + return 0; -} \ No newline at end of file +} diff --git a/backend/tif.h b/backend/tif.h index 76f19607..3e3c4596 100644 --- a/backend/tif.h +++ b/backend/tif.h @@ -8,14 +8,14 @@ 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. + 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. + 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. + 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 @@ -26,7 +26,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef TIF_H @@ -35,7 +35,7 @@ #ifdef __cplusplus extern "C" { #endif - + #ifdef _MSC_VER #include #include "stdint_msvc.h" @@ -44,20 +44,20 @@ extern "C" { #endif #pragma pack(1) - + typedef struct tiff_header { uint16_t byte_order; uint16_t identity; uint32_t offset; } tiff_header_t; - + typedef struct tiff_tag { uint16_t tag; uint16_t type; uint32_t count; uint32_t offset; } tiff_tag_t; - + typedef struct tiff_ifd { uint16_t entries; tiff_tag_t new_subset; @@ -76,7 +76,7 @@ extern "C" { tiff_tag_t resolution_unit; uint32_t offset; } tiff_ifd_t; - + #pragma pack() #ifdef __cplusplus @@ -85,3 +85,4 @@ extern "C" { #endif /* TIF_H */ + diff --git a/backend/upcean.c b/backend/upcean.c index d11343c9..6701a2ab 100644 --- a/backend/upcean.c +++ b/backend/upcean.c @@ -130,7 +130,7 @@ int upca(struct zint_symbol *symbol, unsigned char source[], char dest[]) { strcpy(gtin, (char*) source); length = strlen(gtin); - + if (length == 11) { gtin[length] = upc_check(gtin); gtin[length + 1] = '\0'; @@ -393,7 +393,7 @@ int ean13(struct zint_symbol *symbol, unsigned char source[], char dest[]) { /* Add the appropriate check digit */ length = strlen(gtin); - + if (length == 12) { gtin[length] = ean_check(gtin); gtin[length + 1] = '\0'; @@ -444,7 +444,7 @@ int ean8(struct zint_symbol *symbol, unsigned char source[], char dest[]) { strcpy(gtin, (char*) source); length = strlen(gtin); - + if (length == 7) { gtin[length] = upc_check(gtin); gtin[length + 1] = '\0'; @@ -458,7 +458,7 @@ int ean8(struct zint_symbol *symbol, unsigned char source[], char dest[]) { } upca_draw(gtin, dest); ustrcpy(symbol->text, (unsigned char*) gtin); - + return 0; } @@ -796,7 +796,7 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len) { case 7: case 8: error_number = ean8(symbol, first_part, (char*) dest); break; - case 12: + case 12: case 13: error_number = ean13(symbol, first_part, (char*) dest); break; default: strcpy(symbol->errtxt, "286: Invalid length input"); @@ -891,11 +891,11 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len) { error_number = isbn(symbol, first_part, ustrlen(first_part), (char*) dest); break; } - + if (error_number > 4) { return error_number; } - + switch (ustrlen(second_part)) { case 0: break; case 2: @@ -934,3 +934,4 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len) { return 0; } + diff --git a/backend/zint.h b/backend/zint.h index 6450e7f9..6a8fa1c7 100644 --- a/backend/zint.h +++ b/backend/zint.h @@ -7,14 +7,14 @@ 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. + 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. + 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. + 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 @@ -25,7 +25,7 @@ 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 + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -102,7 +102,7 @@ extern "C" { #define ZINT_VERSION_MAJOR 2 #define ZINT_VERSION_MINOR 6 #define ZINT_VERSION_RELEASE 2 - + /* Tbarcode 7 codes */ #define BARCODE_CODE11 1 #define BARCODE_C25MATRIX 2 @@ -180,7 +180,7 @@ extern "C" { #define BARCODE_HIBC_MICPDF 108 #define BARCODE_HIBC_BLOCKF 110 #define BARCODE_HIBC_AZTEC 112 - + /* Tbarcode 10 codes */ #define BARCODE_DOTCODE 115 #define BARCODE_HANXIN 116 @@ -236,7 +236,7 @@ extern "C" { #define ZINT_ERROR_ENCODING_PROBLEM 9 #define ZINT_ERROR_FILE_ACCESS 10 #define ZINT_ERROR_MEMORY 11 - + // Raster file types #define OUT_BUFFER 0 #define OUT_PNG_FILE 100 @@ -255,7 +255,7 @@ extern "C" { #define ZINT_EXTERN extern #endif #else -#define ZINT_EXTERN extern +#define ZINT_EXTERN extern #endif ZINT_EXTERN struct zint_symbol *ZBarcode_Create(void); @@ -282,3 +282,4 @@ extern "C" { #endif /* __cplusplus */ #endif /* ZINT_H */ + diff --git a/backend_qt/qzint.cpp b/backend_qt/qzint.cpp index a42c9d07..b438346c 100644 --- a/backend_qt/qzint.cpp +++ b/backend_qt/qzint.cpp @@ -119,7 +119,7 @@ namespace Zint { void QZint::setText(const QString & text) { m_text = text; } - + void QZint::setTargetSize(int width, int height) { target_size_horiz = width; target_size_vert = height; @@ -162,7 +162,7 @@ namespace Zint { void QZint::setScale(float scale) { m_scale = scale; } - + void QZint::setDotSize(float dot_size) { m_dot_size = dot_size; } @@ -306,15 +306,15 @@ namespace Zint { int xoffset = m_whitespace; int main_width = 0, addon_text_height = 0; int yoffset = 0; - + encode(); - + QString caption = QString::fromUtf8((const char *) m_zintSymbol->text, -1); QFont fontSmall(fontstyle); fontSmall.setPixelSize(fontPixelSizeSmall); QFont fontLarge(fontstyle); fontLarge.setPixelSize(fontPixelSizeLarge); - + if (m_lastError.length()) { fontLarge.setPointSize(14); painter.setFont(fontLarge); @@ -324,7 +324,7 @@ namespace Zint { painter.save(); painter.setClipRect(paintRect, Qt::IntersectClip); - + qreal xtr = paintRect.x(); qreal ytr = paintRect.y(); @@ -369,7 +369,7 @@ namespace Zint { textoffset = 0; } gwidth += m_zintSymbol->whitespace_width * 2; - + if (paintRect.width() / gwidth < paintRect.height() / gheight) { ysf = xsf = (qreal) paintRect.width() / gwidth; ytr += (qreal) (paintRect.height() - gheight * ysf) / 2; @@ -384,7 +384,7 @@ namespace Zint { painter.scale(xsf, ysf); QPen p; - + p.setColor(m_fgColor); p.setWidth(m_borderWidth); painter.setPen(p); @@ -526,7 +526,7 @@ namespace Zint { } } /* Add row binding */ - if (((m_zintSymbol->symbology == BARCODE_CODE16K) + if (((m_zintSymbol->symbology == BARCODE_CODE16K) || (m_zintSymbol->symbology == BARCODE_CODE49)) && (row != 0)) { painter.fillRect(0, y - 1, m_zintSymbol->width, 2, QBrush(m_fgColor)); } @@ -690,3 +690,4 @@ namespace Zint { } } + diff --git a/backend_qt/qzint.h b/backend_qt/qzint.h index 85bfbd1c..48331a8d 100644 --- a/backend_qt/qzint.h +++ b/backend_qt/qzint.h @@ -50,7 +50,7 @@ public: void setWidth(int width); int width(); - + void setOption3(int option); QColor fgColor() const; @@ -73,7 +73,7 @@ public: float scale() const; void setScale(float scale); - + void setDotSize(float dot_size); int mode() const; @@ -91,9 +91,9 @@ public: bool hasErrors(); bool save_to_file(QString filename); - + void setHideText(bool hide); - + void setTargetSize(int width, int height); private: @@ -126,3 +126,4 @@ private: }; } #endif + diff --git a/backend_tcl/zint.c b/backend_tcl/zint.c index 6fcdfdbf..443e8d15 100644 --- a/backend_tcl/zint.c +++ b/backend_tcl/zint.c @@ -44,7 +44,7 @@ - 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 +- EAN/UPC Codes with included check digit - UPNQR Code - Misspelled symbology: AztecRunes 2017-10-23 2.6.2 HaO @@ -852,3 +852,4 @@ static int Encode(Tcl_Interp *interp, int objc, return TCL_OK; } + diff --git a/frontend/main.c b/frontend/main.c index d71bcd13..befa7a0d 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -170,7 +170,7 @@ int validator(char test_string[], char source[]) { } /* Converts an integer value to its hexadecimal character */ -static char itoc(int source) { +static char itoc(int source) { if ((source >= 0) && (source <= 9)) { return ('0' + source); } else { @@ -179,7 +179,7 @@ static char itoc(int source) { } /* Concatinates dest[] with the contents of source[], copying /0 as well */ -static void concat(char dest[], char source[]) { +static void concat(char dest[], char source[]) { unsigned int i, j, n; j = strlen(dest); @@ -200,7 +200,7 @@ int batch_process(struct zint_symbol *symbol, char *filename, int mirror_mode, c char format_string[127], reversed_string[127], format_char; int format_len, i; char adjusted[2]; - + memset(buffer, 0, sizeof (unsigned char) * 7100); memset(format_string, 0, sizeof (unsigned char) * 127); if (symbol->outfile[0] == '\0') { @@ -239,7 +239,7 @@ int batch_process(struct zint_symbol *symbol, char *filename, int mirror_mode, c posn--; buffer[posn] = '\0'; } - + if (mirror_mode == 0) { inpos = 0; local_line_count = line_count; @@ -321,11 +321,11 @@ int batch_process(struct zint_symbol *symbol, char *filename, int mirror_mode, c } } } - + /* Add file extension */ output_file[i] = '.'; output_file[i + 1] = '\0'; - + strcat(output_file, filetype); } @@ -643,7 +643,7 @@ int main(int argc, char **argv) { case 't': types(); break; - + case 'e': show_eci(); break; @@ -766,3 +766,4 @@ int main(int argc, char **argv) { return error_number; } + diff --git a/frontend_qt/barcodeitem.h b/frontend_qt/barcodeitem.h index 3c5225b6..13b5e78b 100644 --- a/frontend_qt/barcodeitem.h +++ b/frontend_qt/barcodeitem.h @@ -35,10 +35,11 @@ public: private: int w, h; - + public: mutable Zint::QZint bc; Zint::QZint::AspectRatioMode ar; }; #endif + diff --git a/frontend_qt/datawindow.cpp b/frontend_qt/datawindow.cpp index e6255ddc..4be91c42 100644 --- a/frontend_qt/datawindow.cpp +++ b/frontend_qt/datawindow.cpp @@ -41,7 +41,7 @@ DataWindow::DataWindow(const QString &input) setupUi(this); txtDataInput->setPlainText(input); txtDataInput->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); - + connect(btnCancel, SIGNAL( clicked( bool )), SLOT(quit_now())); connect(btnReset, SIGNAL( clicked( bool )), SLOT(clear_data())); connect(btnOK, SIGNAL( clicked( bool )), SLOT(okay())); @@ -81,7 +81,7 @@ void DataWindow::from_file() open_dialog.setWindowTitle("Open File"); open_dialog.setDirectory(settings.value("studio/default_dir", QDir::toNativeSeparators(QDir::homePath())).toString()); - + if (open_dialog.exec()) { filename = open_dialog.selectedFiles().at(0); } else { @@ -93,14 +93,14 @@ void DataWindow::from_file() QMessageBox::critical(this, tr("Open Error"), tr("Could not open selected file.")); return; } - + outstream = file.readAll(); /* Allow some non-printing (control) characters to be read from file by converting them to escape sequences */ escape_string.clear(); escape_string.append(QString(outstream)); - + escape_string.replace((QChar)'\\', (QString)"\\\\", Qt::CaseInsensitive); escape_string.replace((QChar)0x04, (QString)"\\E", Qt::CaseInsensitive); /* End of Transmission */ escape_string.replace((QChar)'\a', (QString)"\\a", Qt::CaseInsensitive); /* Bell */ @@ -112,9 +112,9 @@ void DataWindow::from_file() escape_string.replace((QChar)0x1b, (QString)"\\e", Qt::CaseInsensitive); /* Escape */ escape_string.replace((QChar)0x1d, (QString)"\\G", Qt::CaseInsensitive); /* Group Separator */ escape_string.replace((QChar)0x1e, (QString)"\\R", Qt::CaseInsensitive); /* Record Separator */ - + txtDataInput->setPlainText(QString(escape_string)); file.close(); - + settings.setValue("studio/default_dir", filename.mid(0, filename.lastIndexOf(QDir::separator()))); -} \ No newline at end of file +} diff --git a/frontend_qt/exportwindow.cpp b/frontend_qt/exportwindow.cpp index 3956e26f..12ac3e8b 100644 --- a/frontend_qt/exportwindow.cpp +++ b/frontend_qt/exportwindow.cpp @@ -35,7 +35,7 @@ ExportWindow::ExportWindow() linPrefix->setText(settings.value("studio/export/file_prefix", "bcs_").toString()); cmbFileName->setCurrentIndex(settings.value("studio/export/name_format", 0).toInt()); cmbFileFormat->setCurrentIndex(settings.value("studio/export/filetype", 0).toInt()); - + connect(btnCancel, SIGNAL( clicked( bool )), SLOT(quit_now())); connect(btnOK, SIGNAL( clicked( bool )), SLOT(process())); connect(btnDestPath, SIGNAL( clicked( bool )), SLOT(get_directory())); @@ -82,10 +82,10 @@ void ExportWindow::process() QString suffix; QString Feedback; int lines, i, j, inputpos; - + lines = output_data.count(QChar('\n'), Qt::CaseInsensitive); inputpos = 0; - + switch(cmbFileFormat->currentIndex()) { #ifdef NO_PNG case 0: suffix = ".eps"; break; @@ -108,7 +108,7 @@ void ExportWindow::process() } txtFeedback->clear(); Feedback = ""; - + for(i = 0; i < lines; i++) { int datalen = 0; for(j = inputpos; ((j < output_data.length()) && (output_data[j] != '\n') ); j++) { @@ -120,11 +120,11 @@ void ExportWindow::process() QString url_escaped; int m; QChar name_qchar; - + for(m = 0; m < dataString.length(); m++) { name_qchar = dataString[m]; char name_char = name_qchar.toLatin1(); - + switch(name_char) { case '\\': url_escaped += "%5C"; break; case '/': url_escaped += "%2F"; break; @@ -145,18 +145,18 @@ void ExportWindow::process() case 1: { /* Formatted Serial Number */ QString biggest, this_val, outnumber; int number_size, val_size, m; - + biggest = QString::number(lines + 1); number_size = biggest.length(); this_val = QString::number(i + 1); val_size = this_val.length(); - + for(m = 0; m < (number_size - val_size); m++) { outnumber += QChar('0'); } - + outnumber += this_val; - + fileName = linDestPath->text() + QDir::separator() + linPrefix->text() + outnumber + suffix; } break; @@ -176,3 +176,4 @@ void ExportWindow::process() inputpos += datalen + 1; } } + diff --git a/frontend_qt/main.cpp b/frontend_qt/main.cpp index 9d017bbe..1990cde6 100644 --- a/frontend_qt/main.cpp +++ b/frontend_qt/main.cpp @@ -21,8 +21,9 @@ int main(int argc, char *argv[]) { Q_INIT_RESOURCE(resources); QApplication app(argc, argv); - + MainWindow w; w.show(); return app.exec(); } + diff --git a/frontend_qt/mainwindow.cpp b/frontend_qt/mainwindow.cpp index 3bc6eb6a..ace69705 100644 --- a/frontend_qt/mainwindow.cpp +++ b/frontend_qt/mainwindow.cpp @@ -36,11 +36,11 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl) : QWidget(parent, fl),m_optionWidget(0) { - + QCoreApplication::setOrganizationName("zint"); QCoreApplication::setOrganizationDomain("zint.org.uk"); QCoreApplication::setApplicationName("Barcode Studio"); - + QSettings settings; char bstyle_text[][50] = { @@ -65,7 +65,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl) "Code 39 (ISO 16388)", "Code 39 Extended", "Code 49", - "Code 93", + "Code 93", "Code One", "Data Matrix (ISO 16022)", "Deutsche Post Identcode", @@ -80,9 +80,9 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl) "GS1 DataBar Expanded Omnidirectional", "GS1 DataBar Expanded Stacked Omnidirectional", "GS1 DataBar Limited", - "GS1 DataBar Omnidirectional", + "GS1 DataBar Omnidirectional", "GS1 DataBar Stacked", - "GS1 DataBar Stacked Omnidirectional", + "GS1 DataBar Stacked Omnidirectional", "Han Xin (Chinese Sensible) Code", "ITF-14", "International Standard Book Number (ISBN)", @@ -110,15 +110,15 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl) "Universal Product Code (UPC-E)", "USPS Intelligent Mail" }; - + /* createActions(); createMenus(); */ - + scene = new QGraphicsScene(this); - + setupUi(this); view->setScene(scene); - + m_fgcolor=qRgb(settings.value("studio/ink/red", 0).toInt(), settings.value("studio/ink/green", 0).toInt(), settings.value("studio/ink/blue", 0).toInt()); @@ -166,7 +166,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl) MainWindow::~MainWindow() { QSettings settings; - + settings.setValue("studio/symbology", bstyle->currentIndex()); settings.setValue("studio/ink/red", m_fgcolor.red()); settings.setValue("studio/ink/green", m_fgcolor.green()); @@ -206,7 +206,7 @@ bool MainWindow::save() save_dialog.setAcceptMode(QFileDialog::AcceptSave); save_dialog.setWindowTitle("Save Barcode Image"); save_dialog.setDirectory(settings.value("studio/default_dir", QDir::toNativeSeparators(QDir::homePath())).toString()); - + #ifdef NO_PNG suffix = settings.value("studio/default_suffix", "gif").toString(); save_dialog.setNameFilter(tr("Encapsulated Post Script (*.eps);;Graphics Interchange Format (*.gif);;Scalable Vector Graphic (*.svg);;Windows Bitmap (*.bmp);;ZSoft PC Painter Image (*.pcx);;Extended Metafile (*.emf);;Tagged Image File Format (*.tif)")); @@ -214,7 +214,7 @@ bool MainWindow::save() suffix = settings.value("studio/default_suffix", "png").toString(); save_dialog.setNameFilter(tr("Portable Network Graphic (*.png);;Encapsulated Post Script (*.eps);;Graphics Interchange Format (*.gif);;Scalable Vector Graphic (*.svg);;Windows Bitmap (*.bmp);;ZSoft PC Painter Image (*.pcx);;Extended Metafile (*.emf);;Tagged Image File Format (*.tif)")); #endif - + if (QString::compare(suffix, "png", Qt::CaseInsensitive) == 0) save_dialog.selectNameFilter("Portable Network Graphic (*.png)"); if (QString::compare(suffix, "eps", Qt::CaseInsensitive) == 0) @@ -231,7 +231,7 @@ bool MainWindow::save() save_dialog.selectNameFilter("Extended Metafile (*.emf)"); if (QString::compare(suffix, "tif", Qt::CaseInsensitive) == 0) save_dialog.selectNameFilter("Tagged Image File Format (*.tif)"); - + if (save_dialog.exec()) { filename = save_dialog.selectedFiles().at(0); if ((filename.lastIndexOf(".") == -1) || (filename.lastIndexOf(".") < (filename.length() - 5))) { @@ -250,7 +250,7 @@ bool MainWindow::save() QMessageBox::critical(this,tr("Save Error"),m_bc.bc.error_message()); return false; } - + settings.setValue("studio/default_dir", filename.mid(0, filename.lastIndexOf(QDir::separator()))); settings.setValue("studio/default_suffix", suffix); return true; @@ -391,7 +391,7 @@ void MainWindow::change_options() connect(m_optionWidget->findChild("radC128CSup"), SIGNAL(clicked( bool )), SLOT(update_preview())); connect(m_optionWidget->findChild("radC128EAN"), SIGNAL(clicked( bool )), SLOT(update_preview())); connect(m_optionWidget->findChild("radC128HIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); - } + } else chkComposite->setText(tr("Add 2D Component")); @@ -479,16 +479,16 @@ void MainWindow::change_options() connect(m_optionWidget->findChild("radC39Stand"), SIGNAL(clicked( bool )), SLOT(update_preview())); connect(m_optionWidget->findChild("radC39Check"), SIGNAL(clicked( bool )), SLOT(update_preview())); connect(m_optionWidget->findChild("radC39HIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); - if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_EXCODE39) + if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_EXCODE39) { - if(m_optionWidget->findChild("radC39HIBC")->isChecked() == true) + if(m_optionWidget->findChild("radC39HIBC")->isChecked() == true) { m_optionWidget->findChild("radC39HIBC")->setChecked(false); m_optionWidget->findChild("radC39Stand")->setChecked(true); } m_optionWidget->findChild("radC39HIBC")->setEnabled(false); - } - else + } + else m_optionWidget->findChild("radC39HIBC")->setEnabled(true); } @@ -502,7 +502,7 @@ void MainWindow::change_options() tabMain->insertTab(1,m_optionWidget,tr("Code 16K")); connect(m_optionWidget->findChild("radC16kStand"), SIGNAL(toggled( bool )), SLOT(update_preview())); } - + if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_CODABLOCKF) { QFile file (":/grpCodablockF.ui"); @@ -517,7 +517,7 @@ void MainWindow::change_options() connect(m_optionWidget->findChild("cmbCbfWidth"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(m_optionWidget->findChild("cmbCbfHeight"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); } - + if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_DATAMATRIX) { QFile file(":/grpDM.ui"); @@ -533,7 +533,7 @@ void MainWindow::change_options() connect(m_optionWidget->findChild("chkDMRectangle"), SIGNAL(stateChanged( int )), SLOT(update_preview())); connect(m_optionWidget->findChild("chkDMRE"), SIGNAL(stateChanged( int )), SLOT(update_preview())); } - + if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_QRCODE) { QFile file(":/grpQR.ui"); @@ -551,7 +551,7 @@ void MainWindow::change_options() connect(m_optionWidget->findChild("radQRGS1"), SIGNAL(clicked( bool )), SLOT(update_preview())); connect(m_optionWidget->findChild("radQRHIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); } - + if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_HANXIN) { QFile file (":/grpHX.ui"); @@ -581,7 +581,7 @@ void MainWindow::change_options() connect(m_optionWidget->findChild("cmbMQRSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(m_optionWidget->findChild("cmbMQRECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); } - + if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_GRIDMATRIX) { QFile file(":/grpGrid.ui"); @@ -609,7 +609,7 @@ void MainWindow::change_options() connect(m_optionWidget->findChild("cmbMaxiMode"), SIGNAL(currentIndexChanged( int )), SLOT(maxi_primary())); connect(m_optionWidget->findChild("txtMaxiPrimary"), SIGNAL(textChanged( const QString& )), SLOT(update_preview())); } - + if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_CHANNEL) { QFile file(":/grpChannel.ui"); @@ -620,7 +620,7 @@ void MainWindow::change_options() tabMain->insertTab(1,m_optionWidget,tr("Channel Code")); connect(m_optionWidget->findChild("cmbChannel"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); } - + if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_CODEONE) { QFile file(":/grpCodeOne.ui"); @@ -643,7 +643,7 @@ void MainWindow::change_options() tabMain->insertTab(1,m_optionWidget,tr("Code 49")); connect(m_optionWidget->findChild("radC49GS1"), SIGNAL(toggled( bool )), SLOT(update_preview())); } - + if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_RSS_EXPSTACK) { QFile file(":/grpDBExtend.ui"); @@ -679,7 +679,7 @@ void MainWindow::change_options() void MainWindow::composite_enable() { - if(chkComposite->isChecked() == true) + if(chkComposite->isChecked() == true) { lblCompType->setEnabled(true); cmbCompType->setEnabled(true); @@ -722,7 +722,7 @@ void MainWindow::update_preview() { int width = view->geometry().width(); int height = view->geometry().height(); - + //m_bc.ar=(Zint::QZint::AspectRatioMode)1; if(chkComposite->isChecked() == true) { m_bc.bc.setPrimaryMessage(txtData->text()); @@ -747,9 +747,9 @@ void MainWindow::update_preview() if(m_optionWidget->findChild("radC128CSup")->isChecked()) m_bc.bc.setSymbol(BARCODE_CODE128B); - if(m_optionWidget->findChild("radC128EAN")->isChecked()) + if(m_optionWidget->findChild("radC128EAN")->isChecked()) { - if(chkComposite->isChecked()) + if(chkComposite->isChecked()) m_bc.bc.setSymbol(BARCODE_EAN128_CC); else m_bc.bc.setSymbol(BARCODE_EAN128); @@ -820,7 +820,7 @@ void MainWindow::update_preview() m_bc.bc.setSymbol(BARCODE_RSS_EXPSTACK_CC); else m_bc.bc.setSymbol(BARCODE_RSS_EXPSTACK); - + if(m_optionWidget->findChild("cmbCols")->currentIndex() != 0) m_bc.bc.setWidth(m_optionWidget->findChild("cmbCols")->currentIndex()); break; @@ -908,7 +908,7 @@ void MainWindow::update_preview() if(m_optionWidget->findChild("radCbfSetHeight")->isChecked()) m_bc.bc.setSecurityLevel(m_optionWidget->findChild("cmbCbfHeight")->currentIndex() + 1); break; - + case BARCODE_DATAMATRIX: m_bc.bc.setSecurityLevel(1); if(m_optionWidget->findChild("radDM200HIBC")->isChecked()) @@ -929,7 +929,7 @@ void MainWindow::update_preview() m_bc.bc.setOption3(0); } break; - + case BARCODE_QRCODE: if(m_optionWidget->findChild("radQRHIBC")->isChecked()) m_bc.bc.setSymbol(BARCODE_HIBC_QR); @@ -938,7 +938,7 @@ void MainWindow::update_preview() if(m_optionWidget->findChild("radQRGS1")->isChecked()) m_bc.bc.setInputMode(GS1_MODE); - + if(m_optionWidget->findChild("radQRSize")->isChecked()) m_bc.bc.setWidth(m_optionWidget->findChild("cmbQRSize")->currentIndex() + 1); @@ -954,7 +954,7 @@ void MainWindow::update_preview() if(m_optionWidget->findChild("radMQRECC")->isChecked()) m_bc.bc.setSecurityLevel(m_optionWidget->findChild("cmbMQRECC")->currentIndex() + 1); break; - + case BARCODE_GRIDMATRIX: m_bc.bc.setSymbol(BARCODE_GRIDMATRIX); if(m_optionWidget->findChild("radGridSize")->isChecked()) @@ -977,25 +977,25 @@ void MainWindow::update_preview() case BARCODE_CHANNEL: m_bc.bc.setSymbol(BARCODE_CHANNEL); - if(m_optionWidget->findChild("cmbChannel")->currentIndex() == 0) + if(m_optionWidget->findChild("cmbChannel")->currentIndex() == 0) m_bc.bc.setWidth(0); else m_bc.bc.setWidth(m_optionWidget->findChild("cmbChannel")->currentIndex() + 2); break; - + case BARCODE_CODEONE: m_bc.bc.setSymbol(BARCODE_CODEONE); if(m_optionWidget->findChild("radC1GS1")->isChecked()) m_bc.bc.setInputMode(GS1_MODE); m_bc.bc.setWidth(m_optionWidget->findChild("cmbC1Size")->currentIndex()); break; - + case BARCODE_CODE49: m_bc.bc.setSymbol(BARCODE_CODE49); if(m_optionWidget->findChild("radC49GS1")->isChecked()) m_bc.bc.setInputMode(GS1_MODE); break; - + case BARCODE_HANXIN: m_bc.bc.setSymbol(BARCODE_HANXIN); if(m_optionWidget->findChild("radHXSize")->isChecked()) @@ -1004,7 +1004,7 @@ void MainWindow::update_preview() if(m_optionWidget->findChild("radHXECC")->isChecked()) m_bc.bc.setSecurityLevel(m_optionWidget->findChild("cmbHXECC")->currentIndex() + 1); break; - + default: m_bc.bc.setSymbol(metaObject()->enumerator(0).value(bstyle->currentIndex())); break; @@ -1024,3 +1024,4 @@ void MainWindow::update_preview() scene->setSceneRect(0, 0, width - 10, height - 10); scene->update(); } + diff --git a/frontend_qt/mainwindow.h b/frontend_qt/mainwindow.h index e00e3693..7ce617a9 100644 --- a/frontend_qt/mainwindow.h +++ b/frontend_qt/mainwindow.h @@ -75,7 +75,7 @@ public: RSS_EXP =31, RSS_EXPSTACK =81, RSS_LTD =30, - RSS14 =29, + RSS14 =29, RSS14STACK =79, RSS14STACK_OMNI =80, HANXIN =116, @@ -123,7 +123,7 @@ public slots: protected: void resizeEvent(QResizeEvent *event); - + private slots: bool save(); void about(); @@ -140,7 +140,7 @@ private: QColor m_fgcolor,m_bgcolor; BarcodeItem m_bc; - QWidget *m_optionWidget; + QWidget *m_optionWidget; QGraphicsScene *scene; /* QMenu *fileMenu; QMenu *helpMenu; @@ -151,3 +151,4 @@ private: #endif + diff --git a/frontend_qt/sequencewindow.cpp b/frontend_qt/sequencewindow.cpp index 4789cfa9..70db763d 100644 --- a/frontend_qt/sequencewindow.cpp +++ b/frontend_qt/sequencewindow.cpp @@ -33,12 +33,12 @@ SequenceWindow::SequenceWindow() setupUi(this); QSettings settings; QValidator *intvalid = new QIntValidator(this); - + linStartVal->setText(settings.value("studio/sequence/start_value", "1").toString()); linEndVal->setText(settings.value("studio/sequence/end_value", "10").toString()); linIncVal->setText(settings.value("studio/sequence/increment", "1").toString()); linFormat->setText(settings.value("studio/sequence/format", "$$$$$$").toString()); - + linStartVal->setValidator(intvalid); linEndVal->setValidator(intvalid); linIncVal->setValidator(intvalid); @@ -53,7 +53,7 @@ SequenceWindow::SequenceWindow() SequenceWindow::~SequenceWindow() { QSettings settings; - + settings.setValue("studio/sequence/start_value", linStartVal->text()); settings.setValue("studio/sequence/end_value", linEndVal->text()); settings.setValue("studio/sequence/increment", linIncVal->text()); @@ -76,13 +76,13 @@ QString SequenceWindow::apply_format(QString raw_number) QString format; int format_len, input_len, i, inpos; QChar format_qchar; - + format = linFormat->text(); input_len = raw_number.length(); format_len = format.length(); - + inpos = input_len; - + for(i = format_len; i > 0; i--) { format_qchar = format[i - 1]; char format_char = format_qchar.toLatin1(); @@ -116,11 +116,11 @@ QString SequenceWindow::apply_format(QString raw_number) break; } } - + for(i = format_len; i > 0; i--) { reversed += adjusted[i - 1]; } - + return reversed; } @@ -129,32 +129,32 @@ void SequenceWindow::create_sequence() QString startval, endval, incval, part, outputtext; int start, stop, step, i; bool ok; - + startval = linStartVal->text(); endval = linEndVal->text(); incval = linIncVal->text(); start = startval.toInt(&ok, 10); stop = endval.toInt(&ok, 10); step = incval.toInt(&ok, 10); - + if((stop <= start) || (step <= 0)) { QMessageBox::critical(this, tr("Sequence Error"), tr("One or more of the input values is incorrect.")); return; } - + for(i = start; i <= stop; i += step) { part = apply_format(QString::number(i, 10)); part += '\n'; outputtext += part; } - + txtPreview->setPlainText(outputtext); } void SequenceWindow::check_generate() { QString preview_copy; - + preview_copy = txtPreview->toPlainText(); if(preview_copy.isEmpty()) { btnExport->setEnabled(false); @@ -170,16 +170,16 @@ void SequenceWindow::import() QString filename; QFile file; QByteArray outstream; - + import_dialog.setWindowTitle("Import File"); import_dialog.setDirectory(settings.value("studio/default_dir", QDir::toNativeSeparators(QDir::homePath())).toString()); - + if (import_dialog.exec()) { filename = import_dialog.selectedFiles().at(0); } else { return; } - + file.setFileName(filename); if(!file.open(QIODevice::ReadOnly | QIODevice::Text)) { QMessageBox::critical(this, tr("Open Error"), tr("Could not open selected file.")); @@ -190,7 +190,7 @@ void SequenceWindow::import() txtPreview->setPlainText(QString(outstream)); file.close(); - + settings.setValue("studio/default_dir", filename.mid(0, filename.lastIndexOf(QDir::separator()))); } @@ -201,3 +201,4 @@ void SequenceWindow::generate_sequence() dlg.output_data = txtPreview->toPlainText(); dlg.exec(); } + diff --git a/frontend_qt/sequencewindow.h b/frontend_qt/sequencewindow.h index a8cc6988..153bd447 100644 --- a/frontend_qt/sequencewindow.h +++ b/frontend_qt/sequencewindow.h @@ -31,10 +31,10 @@ public: SequenceWindow(); ~SequenceWindow(); BarcodeItem *barcode; - + private: QString apply_format(QString raw_number); - + private slots: void quit_now(); void reset_preview(); @@ -44,4 +44,4 @@ private slots: void generate_sequence(); }; -#endif \ No newline at end of file +#endif