back-merged

This commit is contained in:
oxygenic 2017-06-13 21:05:35 +02:00 committed by Robin Stuart
parent 6413351fd6
commit d8330f5d96
13 changed files with 37 additions and 34 deletions

View File

@ -115,7 +115,7 @@ int GetPossibleCharacterSet(unsigned char C)
* int CFollowing The number of characters encodable in CodeC if we
* start here.
*/
void CreateCharacterSetTable(CharacterSetTable T[], unsigned char *data, int dataLength)
static void CreateCharacterSetTable(CharacterSetTable T[], unsigned char *data,const size_t dataLength)
{
int charCur;
int runChar;
@ -205,7 +205,7 @@ int RemainingDigits(CharacterSetTable *T, int charCur,int emptyColumns)
* Return value Resulting row count
*/
int Columns2Rows(CharacterSetTable *T, unsigned char *data, int dataLength,
static int Columns2Rows(CharacterSetTable *T, unsigned char *data, const size_t dataLength,
int * pRows, int * pUseColumns, int * pSet, int * pFillings)
{
int useColumns; /* Usable Characters per line */
@ -430,7 +430,7 @@ int Columns2Rows(CharacterSetTable *T, unsigned char *data, int dataLength,
}
/* Find columns if row count is given.
*/
int Rows2Columns(CharacterSetTable *T, unsigned char *data, int dataLength,
static int Rows2Columns(CharacterSetTable *T, unsigned char *data, const size_t dataLength,
int * pRows, int * pUseColumns, int * pSet, int * pFillings)
{
int errorCur;
@ -630,8 +630,7 @@ void SumASCII(uchar **ppOutPos, int Sum, int CharacterSet)
/* Main function called by zint framework
*/
int codablock(struct zint_symbol *symbol,const unsigned char source[], const size_t length) {
int charCur;
int dataLength;
size_t charCur,dataLength;
int Error;
int rows, columns, useColumns;
int fillings;
@ -733,7 +732,7 @@ int codablock(struct zint_symbol *symbol,const unsigned char source[], const siz
Sum1=Sum2=0;
if (rows>1)
{
int charCur;
size_t charCur;
for (charCur=0 ; charCur<dataLength ; charCur++) {
Sum1=(Sum1 + (charCur%86+1)*data[charCur])%86;
Sum2=(Sum2 + (charCur%86)*data[charCur])%86;

View File

@ -59,7 +59,7 @@ char itoc(const int source) {
void bin_append(const int arg, const int length, char *binary) {
int i;
int start;
int posn = strlen(binary);
size_t posn = strlen(binary);
start = 0x01 << (length - 1);
@ -228,7 +228,7 @@ int is_extendable(const int symbology) {
return 0;
}
int istwodigits(const unsigned char source[], const int position) {
int istwodigits(const unsigned char source[], const size_t position) {
if ((source[position] >= '0') && (source[position] <= '9')) {
if ((source[position + 1] >= '0') && (source[position + 1] <= '9')) {
return 1;

View File

@ -64,7 +64,7 @@ extern "C" {
extern int posn(const char set_string[], const char data);
extern int module_is_set(const struct zint_symbol *symbol, const int y_coord, const int x_coord);
extern void set_module(struct zint_symbol *symbol, const int y_coord, const int x_coord);
extern int istwodigits(const unsigned char source[], const int position);
extern int istwodigits(const unsigned char source[], const size_t position);
extern int parunmodd(const unsigned char llyth);
extern void expand(struct zint_symbol *symbol, const char data[]);
extern void unset_module(struct zint_symbol *symbol, const int y_coord, const int x_coord);

View File

@ -150,7 +150,7 @@ static int cc_a(struct zint_symbol *symbol, char source[], int cc_width) {
codeWords[i] = 0;
}
bitlen = strlen(source);
bitlen = (int)strlen(source);
for (i = 0; i < 208; i++) {
local_source[i] = '0';

View File

@ -256,7 +256,7 @@ static void dminsert(char binary_string[], const int posn, const char newbit) {
binary_string[posn] = newbit;
}
static void insert_value(unsigned char binary_stream[], const int posn, const size_t streamlen, const int newbit) {
static void insert_value(unsigned char binary_stream[], const int posn, const int streamlen, const int newbit) {
int i;
for(i = (int)streamlen; i > posn; i--) {
@ -265,15 +265,15 @@ static void insert_value(unsigned char binary_stream[], const int posn, const si
binary_stream[posn] = (unsigned char) newbit;
}
static int p_r_6_2_1(const unsigned char inputData[], const int position, const size_t sourcelen) {
static int p_r_6_2_1(const unsigned char inputData[], const size_t position, const size_t sourcelen) {
/* Annex P section (r)(6)(ii)(I)
"If one of the three X12 terminator/separator characters first
occurs in the yet to be processed data before a non-X12 character..."
*/
size_t i;
int nonX12Position = 0;
int specialX12Position = 0;
size_t nonX12Position = 0;
size_t specialX12Position = 0;
int retval = 0;
for (i = position; i < sourcelen; i++) {

View File

@ -1203,13 +1203,15 @@ int dotcode(struct zint_symbol *symbol, const unsigned char source[], int length
int binary_finish = 0;
int debug = 0;
int padding_dots, is_first;
#ifdef _MSC_VER
unsigned char* masked_codeword_array;
#endif
#ifndef _MSC_VER
unsigned char codeword_array[length * 3];
#else
char* dot_stream;
char* dot_array;
unsigned char* masked_codeword_array;
unsigned char* codeword_array = (unsigned char *) _alloca(length * 3 * sizeof (unsigned char));
#endif /* _MSC_VER */

View File

@ -39,7 +39,7 @@
#endif
/* Convert Unicode to other character encodings */
int utf_to_eci(int eci, const unsigned char source[], unsigned char dest[], int *length) {
int utf_to_eci(const int eci, const unsigned char source[], unsigned char dest[], size_t *length) {
int glyph;
int bytelen;
int in_posn;
@ -288,7 +288,7 @@ int utf_to_eci(int eci, const unsigned char source[], unsigned char dest[], int
}
/* Find the lowest ECI mode which will encode a given set of Unicode text */
int get_best_eci(unsigned char source[], int length) {
int get_best_eci(unsigned char source[], size_t length) {
int eci = 3;
#ifndef _MSC_VER

View File

@ -65,7 +65,7 @@ int getsubmode(char input) {
/* Calculate the approximate length of the binary string */
static int calculate_binlength(char mode[], int source[], const size_t length, int eci) {
int i;
size_t i;
char lastmode = 't';
int est_binlen = 0;
int submode = 1;
@ -226,7 +226,7 @@ int isFourByte(int glyph, int glyph2) {
/* Calculate mode switching */
static void hx_define_mode(char mode[], int source[], const size_t length) {
int i;
size_t i;
char lastmode = 't';
int done;

View File

@ -172,7 +172,8 @@ short int islarger(short int accum[], short int reg[]) {
}
void binary_load(short int reg[], char data[], const size_t src_len) {
int read, i;
size_t read;
int i;
short int temp[112] = {0};
for (i = 0; i < 112; i++) {

View File

@ -145,8 +145,9 @@ void ZBarcode_Delete(struct zint_symbol *symbol) {
free(symbol);
}
extern int get_best_eci(unsigned char source[], int length); /* Calculate suitable ECI mode */
extern int utf_to_eci(int eci, const unsigned char source[], unsigned char dest[], int *length); /* Convert Unicode to other encodings */
extern int get_best_eci(unsigned char source[], size_t length); /* Calculate suitable ECI mode */
extern int utf_to_eci(const int eci, const unsigned char source[], unsigned char dest[], size_t *length); /* Convert Unicode to other encodings */
extern int eanx(struct zint_symbol *symbol, unsigned char source[], int length); /* EAN system barcodes */
extern int c39(struct zint_symbol *symbol, unsigned char source[], const size_t length); /* Code 3 from 9 (or Code 39) */
@ -203,7 +204,7 @@ extern int grid_matrix(struct zint_symbol *symbol, const unsigned char source[],
extern int han_xin(struct zint_symbol * symbol, const unsigned char source[], size_t length); /* Han Xin */
extern int dotcode(struct zint_symbol * symbol, const unsigned char source[], int length); /* DotCode */
extern int codablock(struct zint_symbol * symbol, const unsigned char source[], const size_t length); /* Codablock */
extern int upnqr(struct zint_symbol *symbol, const unsigned char source[], int length); /* UPNQR */
extern int upnqr(struct zint_symbol *symbol, const unsigned char source[], size_t length); /* UPNQR */
extern int qr_code(struct zint_symbol *symbol, const unsigned char source[], size_t length); /* Data Matrix (IEC16022) */
extern int dmatrix(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length); /* QR Code */
@ -615,7 +616,7 @@ static int extended_charset(struct zint_symbol *symbol, const unsigned char *sou
return error_number;
}
static int reduced_charset(struct zint_symbol *symbol, const unsigned char *source, int in_length) {
static int reduced_charset(struct zint_symbol *symbol, const unsigned char *source, size_t in_length) {
/* These are the "norm" standards which only support Latin-1 at most */
int error_number = 0;
@ -1049,7 +1050,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source,int
case BARCODE_MICROQR:
case BARCODE_GRIDMATRIX:
case BARCODE_HANXIN:
error_number = utf_to_eci(symbol->eci, source, local_source, &in_length);
error_number = utf_to_eci(symbol->eci, source, local_source, (size_t*)&in_length);
error_number = extended_charset(symbol, local_source, in_length);
break;
default:

View File

@ -42,7 +42,7 @@
#include <stdlib.h> /* abs */
#include <assert.h>
extern int utf_to_eci(int eci, const unsigned char source[], unsigned char dest[], int *length); /* Convert Unicode to other encodings */
extern int utf_to_eci(const int eci, const unsigned char source[], unsigned char dest[], size_t *length); /* Convert Unicode to other encodings */
/* Returns true if input glyph is in the Alphanumeric set */
static int in_alpha(const int glyph) {
@ -147,7 +147,7 @@ static int tribus(const int version,const int a,const int b,const int c) {
}
/* Convert input data to a binary stream and add padding */
static void qr_binary(int datastream[], const int version, const int target_binlen, const char mode[], const int jisdata[], const size_t length, const int gs1, const int eci, const int est_binlen, int debug) {
static void qr_binary(int datastream[], const int version, const int target_binlen, const char mode[], const int jisdata[], const size_t length, const int gs1, const int eci, const int est_binlen,const int debug) {
int position = 0;
int short_data_block_length, i;
char data_block, padbits;
@ -1313,7 +1313,7 @@ static void applyOptimisation(const int version,char inputMode[], const size_t i
free(blockMode);
}
static int blockLength(const int start,const char inputMode[],const size_t inputLength) {
static int blockLength(const size_t start,const char inputMode[],const size_t inputLength) {
/* Find the length of the block starting from 'start' */
size_t i;
int count;
@ -1648,7 +1648,7 @@ int qr_code(struct zint_symbol *symbol, const unsigned char source[], size_t len
/* NOTE: From this point forward concerns Micro QR Code only */
static int micro_qr_intermediate(char binary[], const int jisdata[], const char mode[], const size_t length, int *kanji_used, int *alphanum_used, int *byte_used, int debug) {
static int micro_qr_intermediate(char binary[], const int jisdata[], const char mode[], const size_t length, int *kanji_used, int *alphanum_used, int *byte_used,const int debug) {
/* Convert input data to an "intermediate stage" where data is binary encoded but
control information is not */
int position = 0;
@ -2888,7 +2888,7 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], size_t len
}
/* For UPNQR the symbol size and error correction capacity is fixed */
int upnqr(struct zint_symbol *symbol, const unsigned char source[], int length) {
int upnqr(struct zint_symbol *symbol, const unsigned char source[], size_t length) {
int i, j, est_binlen;
int ecc_level, version, target_binlen, blocks, size;
int bitmask, error_number;

View File

@ -135,7 +135,7 @@
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
<Link>
<AdditionalDependencies>libpng16d.lib;zlibd.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)zintd.dll</OutputFile>
<AdditionalLibraryDirectories>..\extern\libpng\lib\x86;..\extern\zlib\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries>libcmtd.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
@ -169,7 +169,7 @@
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
<Link>
<AdditionalDependencies>libpng16d.lib;zlibd.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>zlibd.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)zintd.dll</OutputFile>
<AdditionalLibraryDirectories>..\extern\libpng\lib\x64;..\extern\zlib\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries>libcmtd.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>