From 2e6fb6a109de5214d45747d77ab5a9d96634c222 Mon Sep 17 00:00:00 2001 From: oxy Date: Mon, 24 Jul 2017 09:57:29 +0200 Subject: [PATCH] compile error fixed --- backend/aztec.c | 18 +++++++++++++----- backend/aztec.h | 2 +- backend/gridmtx.c | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/backend/aztec.c b/backend/aztec.c index 1099fb87..c5e1e3ed 100644 --- a/backend/aztec.c +++ b/backend/aztec.c @@ -42,7 +42,7 @@ static int AztecMap[22801]; -static int count_doubles(const unsigned char source[], int posn, const size_t src_len) { +static int count_doubles(const unsigned char source[], const int posn, const size_t src_len) { int c = 0; int i = posn; int cond = 1; @@ -110,7 +110,7 @@ static int count_spaces(char source[], int posn, int length) { return c; } -static char get_next_mode(char encode_mode[], const size_t src_len, int posn) { +static char get_next_mode(char encode_mode[], const size_t src_len, const int posn) { int i = posn; do { @@ -125,16 +125,24 @@ static char get_next_mode(char encode_mode[], const size_t src_len, int posn) { 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[src_len]; + char *encode_mode; int i, j; char current_mode; int count; char next_mode; - char reduced_source[src_len]; - char reduced_encode_mode[src_len]; + char *reduced_source; + char *reduced_encode_mode; int reduced_length; int byte_mode = 0; + encode_mode=(char*)alloca(src_len); + reduced_source=(char*)alloca(src_len); + reduced_encode_mode=(char*)alloca(src_len); + + if ((!encode_mode) || + (!reduced_source) || + (!reduced_encode_mode)) return -1; + for (i = 0; i < src_len; i++) { if (source[i] > 128) { encode_mode[i] = 'B'; diff --git a/backend/aztec.h b/backend/aztec.h index 2f93a8ee..c8efc249 100644 --- a/backend/aztec.h +++ b/backend/aztec.h @@ -79,7 +79,7 @@ static const int AztecSymbolChar[128] = { 25, 26, 27, 29, 25, 30, 26, 27 }; -static const char AztecModes[128] = "BMMMMMMMMMMMMXBBBBBBBBBBBBBMMMMMXPPPPPPPPPPPXPXPDDDDDDDDDDPPPPPPMUUUUUUUUUUUUUUUUUUUUUUUUUUPMPMMMLLLLLLLLLLLLLLLLLLLLLLLLLLPMPMM"; +static const char AztecModes[129] = "BMMMMMMMMMMMMXBBBBBBBBBBBBBMMMMMXPPPPPPPPPPPXPXPDDDDDDDDDDPPPPPPMUUUUUUUUUUUUUUUUUUUUUUUUUUPMPMMMLLLLLLLLLLLLLLLLLLLLLLLLLLPMPMM"; static const unsigned short int AztecSizes[32] = { /* Codewords per symbol */ diff --git a/backend/gridmtx.c b/backend/gridmtx.c index 8be12c18..5d23f7ad 100644 --- a/backend/gridmtx.c +++ b/backend/gridmtx.c @@ -343,7 +343,7 @@ void add_shift_char(char binary[], int shifty) { bin_append(glyph, 6, binary); } -static int gm_encode(int gbdata[], const size_t length, char binary[], int reader, int eci, int debug) { +static int gm_encode(int gbdata[], const size_t length, char binary[],const int reader,const int eci, int debug) { /* Create a binary stream representation of the input data. 7 sets are defined - Chinese characters, Numerals, Lower case letters, Upper case letters, Mixed numerals and latters, Control characters and 8-bit binary data */