1
0
mirror of https://github.com/woo-j/zint.git synced 2024-12-23 13:33:55 +03:00

warnings --

This commit is contained in:
taipanromania 2008-10-03 09:26:27 +00:00
parent 24576a15fc
commit b1b43da367
12 changed files with 81 additions and 67 deletions

View File

@ -49,7 +49,7 @@ void rs_error(char data_pattern[])
int reader, triple_writer;
char triple[31], inv_triple[31];
char result[5];
unsigned char result[5];
triple_writer = 0;
@ -85,7 +85,7 @@ void rs_error(char data_pattern[])
rs_init_gf(0x43);
rs_init_code(4, 1);
rs_encode(triple_writer, inv_triple, result);
rs_encode(triple_writer, (unsigned char*) inv_triple, result);
for(reader = 4; reader > 0; reader--)
{
@ -157,7 +157,7 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[])
dpid[loopey] = source[loopey];
}
dpid[8] = '\0';
errno = is_sane(NESET, dpid);
errno = is_sane(NESET, (unsigned char*)dpid);
if(errno == ERROR_INVALID_DATA) {
strcpy(symbol->errtxt, "error: invalid characters in DPID");
return errno;

View File

@ -104,7 +104,7 @@ int data_encode_blockf(unsigned char source[], int subset_selector[], int blockm
column_position = 0;
input_position = 0;
done = 0;
c = 0;
do {
done = 0;
/* 'done' ensures that the instructions are followed in the correct order for each input character */

View File

@ -69,7 +69,7 @@ int parunmodd(unsigned char llyth);
void grwp(int *indexliste);
void dxsmooth(int *indexliste);
void c16k_set_a(unsigned char source, int values[], int *bar_chars)
void c16k_set_a(unsigned char source, unsigned int values[], unsigned int *bar_chars)
{
if(source > 127) {
if(source < 160) {
@ -87,7 +87,7 @@ void c16k_set_a(unsigned char source, int values[], int *bar_chars)
(*bar_chars)++;
}
void c16k_set_b(unsigned char source, int values[], int *bar_chars)
void c16k_set_b(unsigned char source, unsigned int values[], unsigned int *bar_chars)
{
if(source > 127) {
values[(*bar_chars)] = source - 32 - 128;
@ -97,7 +97,7 @@ void c16k_set_b(unsigned char source, int values[], int *bar_chars)
(*bar_chars)++;
}
void c16k_set_c(unsigned char source_a, unsigned char source_b, int values[], int *bar_chars)
void c16k_set_c(unsigned char source_a, unsigned char source_b, unsigned int values[], unsigned int *bar_chars)
{
int weight;

View File

@ -45,9 +45,15 @@
#include "large.h"
#include "composite.h"
#include "pdf417.h"
#define UINT unsigned short
int general_rules(char field[], char type[]);
int eanx(struct zint_symbol *symbol, unsigned char source[]);
int ean_128(struct zint_symbol *symbol, unsigned char source[]);
int rss14(struct zint_symbol *symbol, unsigned char source[]);
int rsslimited(struct zint_symbol *symbol, unsigned char source[]);
int rssexpanded(struct zint_symbol *symbol, unsigned char source[]);
static UINT pwr928[69][7];
@ -117,7 +123,9 @@ int cc_a(struct zint_symbol *symbol, unsigned char source[], int cc_width)
UINT codeWords[28];
UINT bitStr[13];
char codebarre[100], pattern[580];
variant=0;
for(i = 0; i < 13; i++) { bitStr[i] = 0; }
for(i = 0; i < 28; i++) { codeWords[i] = 0; }
@ -701,7 +709,9 @@ int cc_binary_string(struct zint_symbol *symbol, unsigned char source[], char bi
alpha_pad = 0;
ai90_mode = 0;
*(ecc) = 0;
value = 0;
target_bitsize = 0;
if((source[0] == '1') && ((source[1] == '0') || (source[1] == '1') || (source[1] == '7')) && (ustrlen(source) > 8)) {
/* Source starts (10), (11) or (17) */
encoding_method = 2;
@ -1663,7 +1673,8 @@ int composite(struct zint_symbol *symbol, unsigned char source[])
{
int errno, cc_mode, cc_width, ecc_level;
int j, last_ai, ai_latch, i, k, separator_row;
char reduced[3000], binary_string[10 * ustrlen(source)], ai_string[4];
unsigned char reduced[3000];
char binary_string[10 * ustrlen(source)], ai_string[4];
struct zint_symbol *linear;
int top_shift, bottom_shift;
@ -1758,16 +1769,16 @@ int composite(struct zint_symbol *symbol, unsigned char source[])
}
switch(symbol->symbology) {
case BARCODE_EANX_CC: errno = eanx(linear, symbol->primary); break;
case BARCODE_EAN128_CC: errno = ean_128(linear, symbol->primary); break;
case BARCODE_RSS14_CC: errno = rss14(linear, symbol->primary); break;
case BARCODE_RSS_LTD_CC: errno = rsslimited(linear, symbol->primary); break;
case BARCODE_RSS_EXP_CC: errno = rssexpanded(linear, symbol->primary); break;
case BARCODE_UPCA_CC: errno = eanx(linear, symbol->primary); break;
case BARCODE_UPCE_CC: errno = eanx(linear, symbol->primary); break;
case BARCODE_RSS14STACK_CC: errno = rss14(linear, symbol->primary); break;
case BARCODE_RSS14_OMNI_CC: errno = rss14(linear, symbol->primary); break;
case BARCODE_RSS_EXPSTACK_CC: errno = rssexpanded(linear, symbol->primary); break;
case BARCODE_EANX_CC: errno = eanx(linear, (unsigned char *)symbol->primary); break;
case BARCODE_EAN128_CC: errno = ean_128(linear, (unsigned char *)symbol->primary); break;
case BARCODE_RSS14_CC: errno = rss14(linear, (unsigned char *)symbol->primary); break;
case BARCODE_RSS_LTD_CC: errno = rsslimited(linear, (unsigned char *)symbol->primary); break;
case BARCODE_RSS_EXP_CC: errno = rssexpanded(linear, (unsigned char *)symbol->primary); break;
case BARCODE_UPCA_CC: errno = eanx(linear, (unsigned char *)symbol->primary); break;
case BARCODE_UPCE_CC: errno = eanx(linear, (unsigned char *)symbol->primary); break;
case BARCODE_RSS14STACK_CC: errno = rss14(linear, (unsigned char *)symbol->primary); break;
case BARCODE_RSS14_OMNI_CC: errno = rss14(linear, (unsigned char *)symbol->primary); break;
case BARCODE_RSS_EXPSTACK_CC: errno = rssexpanded(linear, (unsigned char *)symbol->primary); break;
}
switch(symbol->symbology) {
@ -1816,7 +1827,7 @@ int composite(struct zint_symbol *symbol, unsigned char source[])
if(symbol->symbology != BARCODE_EAN128_CC) {
return ERROR_TOO_LONG;
} else {
cc_mode == 3;
cc_mode = 3;
}
}
}
@ -1830,9 +1841,9 @@ int composite(struct zint_symbol *symbol, unsigned char source[])
}
switch(cc_mode) { /* Note that ecc_level is only relevant to CC-C */
case 1: errno = cc_a(symbol, binary_string, cc_width); break;
case 2: errno = cc_b(symbol, binary_string, cc_width); break;
case 3: errno = cc_c(symbol, binary_string, cc_width, ecc_level); break;
case 1: errno = cc_a(symbol, (unsigned char*)binary_string, cc_width); break;
case 2: errno = cc_b(symbol, (unsigned char*)binary_string, cc_width); break;
case 3: errno = cc_c(symbol, (unsigned char*)binary_string, cc_width, ecc_level); break;
}
if(errno != 0) {

View File

@ -518,7 +518,7 @@ int imail(struct zint_symbol *symbol, unsigned char source[])
accum[103] = 0;
accum[102] = 0;
strcpy(byte_array, "");
memset(byte_array, 0, 13);
for(j = 0; j < 13; j++) {
i = 96 - (8 * j);
byte_array[j] = 0;

View File

@ -32,8 +32,8 @@ int maxi_codeword[144];
void maxi_do_primary_check( )
{
/* Handles error correction of primary message */
char data[15];
char results[15];
unsigned char data[15];
unsigned char results[15];
int j;
int datalen = 10;
int ecclen = 10;
@ -53,8 +53,8 @@ void maxi_do_primary_check( )
void maxi_do_secondary_chk_odd( int ecclen )
{
/* Handles error correction of odd characters in secondary */
char data[100];
char results[30];
unsigned char data[100];
unsigned char results[30];
int j;
int datalen = 68;
@ -77,8 +77,8 @@ void maxi_do_secondary_chk_odd( int ecclen )
void maxi_do_secondary_chk_even(int ecclen )
{
/* Handles error correction of even characters in secondary */
char data[100];
char results[30];
unsigned char data[100];
unsigned char results[30];
int j;
int datalen = 68;
@ -418,7 +418,7 @@ int maxi_text_process(int mode, unsigned char source[])
do {
if (set[i] == 6) {
/* Number compression */
char substring[10];
char substring[11];
int value;
for(j = 0; j < 10; j++) {
@ -517,7 +517,7 @@ void maxi_do_primary_3(char postcode[], int country, int service)
/* Format structured primary for Mode 3 */
int i;
to_upper(postcode);
to_upper((unsigned char*)postcode);
for(i = 0; i < strlen(postcode); i++) {
if((postcode[i] >= 65) && (postcode[i] <= 90)) {
/* (Capital) letters shifted to Code Set A values */

View File

@ -43,6 +43,21 @@
original Visual Basic source code file pdf417.frm
this code retains some original (French) procedure and variable names to ease conversion */
/* text mode processing tables */
static int asciix[95] = { 7, 8, 8, 4, 12, 4, 4, 8, 8, 8, 12, 4, 12, 12, 12, 12, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 12, 8, 8, 4, 8, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 8, 8, 8, 4, 8, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 8, 8, 8, 8 };
static int asciiy[95] = { 26, 10, 20, 15, 18, 21, 10, 28, 23, 24, 22, 20, 13, 16, 17, 19, 0, 1, 2, 3,
4, 5, 6, 7, 8, 9, 14, 0, 1, 23, 2, 25, 3, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 4, 5, 6, 24, 7, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 21, 27, 9 };
/* Automatic sizing table */
static int MicroAutosize[56] =
{ 4, 6, 7, 8, 10, 12, 13, 14, 16, 18, 19, 20, 24, 29, 30, 33, 34, 37, 39, 46, 54, 58, 70, 72, 82, 90, 108, 126,
1, 14, 2, 7, 3, 25, 8, 16, 5, 17, 9, 6, 10, 11, 28, 12, 19, 13, 29, 20, 30, 21, 22, 31, 23, 32, 33, 34
};
int liste[2][1000]; /* global - okay, so I got _almost_ everything local! */
@ -492,13 +507,13 @@ int pdf417(struct zint_symbol *symbol, unsigned char chaine[])
for(i = 0; i < indexliste; i++) {
switch(liste[1][i]) {
case TEX: /* 547 - text mode */
textprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i], i);
textprocess(chainemc, &mclength, (char*)chaine, indexchaine, liste[0][i], i);
break;
case BYT: /* 670 - octet stream mode */
byteprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i], i);
break;
case NUM: /* 712 - numeric mode */
numbprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i], i);
numbprocess(chainemc, &mclength, (char*)chaine, indexchaine, liste[0][i], i);
break;
}
indexchaine = indexchaine + liste[0][i];
@ -777,13 +792,13 @@ int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[])
for(i = 0; i < indexliste; i++) {
switch(liste[1][i]) {
case TEX: /* 547 - text mode */
textprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i], i);
textprocess(chainemc, &mclength, (char*)chaine, indexchaine, liste[0][i], i);
break;
case BYT: /* 670 - octet stream mode */
byteprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i], i);
break;
case NUM: /* 712 - numeric mode */
numbprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i], i);
numbprocess(chainemc, &mclength, (char*)chaine, indexchaine, liste[0][i], i);
break;
}
indexchaine = indexchaine + liste[0][i];

View File

@ -31,16 +31,6 @@
#define BRSET "ABCDEFabcdefghijklmnopqrstuvwxyz*+-"
/* text mode processing tables */
static int asciix[95] = { 7, 8, 8, 4, 12, 4, 4, 8, 8, 8, 12, 4, 12, 12, 12, 12, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 12, 8, 8, 4, 8, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 8, 8, 8, 4, 8, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 8, 8, 8, 8 };
static int asciiy[95] = { 26, 10, 20, 15, 18, 21, 10, 28, 23, 24, 22, 20, 13, 16, 17, 19, 0, 1, 2, 3,
4, 5, 6, 7, 8, 9, 14, 0, 1, 23, 2, 25, 3, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 4, 5, 6, 24, 7, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 21, 27, 9 };
/* PDF417 error correction coefficients from Grand Zebu */
static int coefrs[1022] = {
/* k = 2 */
@ -422,12 +412,6 @@ static int MicroVariants[170] =
0, 0, 0, 7, 7, 7, 7, 15, 15, 24, 34, 57, 84, 45, 70, 99, 115, 133, 154, 180, 212, 250, 294, 7, 45, 70, 99, 115, 133, 154, 180, 212, 250, 294 };
/* rows, columns, error codewords, k-offset */
/* Automatic sizing table */
static int MicroAutosize[56] =
{ 4, 6, 7, 8, 10, 12, 13, 14, 16, 18, 19, 20, 24, 29, 30, 33, 34, 37, 39, 46, 54, 58, 70, 72, 82, 90, 108, 126,
1, 14, 2, 7, 3, 25, 8, 16, 5, 17, 9, 6, 10, 11, 28, 12, 19, 13, 29, 20, 30, 21, 22, 31, 23, 32, 33, 34
};
/* following is Left RAP, Centre RAP, Right RAP and Start Cluster from ISO/IEC 24728:2006 tables 10, 11 and 12 */
static int RAPTable[136] =
{ 1, 8, 36, 19, 9, 25, 1, 1, 8, 36, 19, 9, 27, 1, 7, 15, 25, 37, 1, 1, 21, 15, 1, 47, 1, 7, 15, 25, 37, 1, 1, 21, 15, 1,

View File

@ -80,8 +80,8 @@ int png_to_file(struct zint_symbol *symbol, int image_height, int image_width, c
}
/* sort out colour options */
to_upper(symbol->fgcolour);
to_upper(symbol->bgcolour);
to_upper((unsigned char*)symbol->fgcolour);
to_upper((unsigned char*)symbol->bgcolour);
if(strlen(symbol->fgcolour) != 6) {
strcpy(symbol->errtxt, "error: malformed foreground colour target");
@ -91,12 +91,12 @@ int png_to_file(struct zint_symbol *symbol, int image_height, int image_width, c
strcpy(symbol->errtxt, "error: malformed background colour target");
return ERROR_INVALID_OPTION;
}
errno = is_sane(SSET, symbol->fgcolour);
errno = is_sane(SSET, (unsigned char*)symbol->fgcolour);
if (errno == ERROR_INVALID_DATA) {
strcpy(symbol->errtxt, "error: malformed foreground colour target");
return ERROR_INVALID_OPTION;
}
errno = is_sane(SSET, symbol->bgcolour);
errno = is_sane(SSET, (unsigned char*)symbol->bgcolour);
if (errno == ERROR_INVALID_DATA) {
strcpy(symbol->errtxt, "error: malformed background colour target");
return ERROR_INVALID_OPTION;
@ -350,12 +350,12 @@ void draw_letter(char *pixelbuf, unsigned char letter, int xposn, int yposn, int
}
}
void draw_string(char *pixbuf, unsigned char input_string[], int xposn, int yposn, int image_width, int image_height)
void draw_string(char *pixbuf, char input_string[], int xposn, int yposn, int image_width, int image_height)
{
/* Plot a string into the pixel buffer */
int i, string_length, string_left_hand;
string_length = ustrlen(input_string);
string_length = strlen(input_string);
string_left_hand = xposn - ((7 * string_length) / 2);
for(i = 0; i < string_length; i++) {
@ -424,7 +424,8 @@ int png_plot(struct zint_symbol *symbol, int rotate_angle)
strcpy(addon, "");
comp_offset = 0;
addon_text_posn = 0.0;
row_height = 0;
if (symbol->height == 0) {
symbol->height = 50;
}

View File

@ -43,6 +43,7 @@ int ps_plot(struct zint_symbol *symbol)
int large_bar_count, comp_offset;
float addon_text_posn;
row_height=0;
textdone = 0;
main_width = symbol->width;
strcpy(addon, "");
@ -56,8 +57,8 @@ int ps_plot(struct zint_symbol *symbol)
}
/* sort out colour options */
to_upper(symbol->fgcolour);
to_upper(symbol->bgcolour);
to_upper((unsigned char*)symbol->fgcolour);
to_upper((unsigned char*)symbol->bgcolour);
if(strlen(symbol->fgcolour) != 6) {
strcpy(symbol->errtxt, "error: malformed foreground colour target");
@ -67,12 +68,12 @@ int ps_plot(struct zint_symbol *symbol)
strcpy(symbol->errtxt, "error: malformed background colour target");
return ERROR_INVALID_OPTION;
}
error_number = is_sane(SSET, symbol->fgcolour);
error_number = is_sane(SSET, (unsigned char*)symbol->fgcolour);
if (error_number == ERROR_INVALID_DATA) {
strcpy(symbol->errtxt, "error: malformed foreground colour target");
return ERROR_INVALID_OPTION;
}
error_number = is_sane(SSET, symbol->bgcolour);
error_number = is_sane(SSET, (unsigned char*)symbol->bgcolour);
if (error_number == ERROR_INVALID_DATA) {
strcpy(symbol->errtxt, "error: malformed background colour target");
return ERROR_INVALID_OPTION;
@ -166,7 +167,7 @@ int ps_plot(struct zint_symbol *symbol)
yoffset = symbol->border_width;
/* Start writing the header */
fprintf(feps, "%!PS-Adobe-3.0 EPSF-3.0\n");
fprintf(feps, "%%!PS-Adobe-3.0 EPSF-3.0\n");
fprintf(feps, "%%%%Creator: Zint %s\n", ZINT_VERSION);
if(strlen(symbol->text) != 0) {
fprintf(feps, "%%%%Title: %s\n",symbol->text);

View File

@ -35,6 +35,8 @@ QRcode *encode(int security, int size, const unsigned char *intext)
QRencodeMode hint;
QRcode *code;
level=QR_ECLEVEL_L;
if(kanji) {
hint = QR_MODE_KANJI;
} else {
@ -58,7 +60,7 @@ QRcode *encode(int security, int size, const unsigned char *intext)
version = 0;
}
code = QRcode_encodeString(intext, version, level, hint, 1);
code = QRcode_encodeString((char*)intext, version, level, hint, 1);
return code;
}

View File

@ -321,7 +321,7 @@ int main(int argc, char **argv)
break;
case 'd': /* we have some data! */
error_number = data_process(my_symbol, optarg, rotate_angle);
error_number = data_process(my_symbol, (unsigned char*)optarg, rotate_angle);
if(error_number != 0) {
printf("%s\n", my_symbol->errtxt);
ZBarcode_Delete(my_symbol);