From: Adam Dickmeiss Date: Mon, 24 Nov 2008 09:07:10 +0000 (+0100) Subject: Got rid of a few warnings WRT signed/unsigned types X-Git-Tag: v3.0.40~34^2 X-Git-Url: http://sru.miketaylor.org.uk/?a=commitdiff_plain;h=3a36217ed64fc7c30c3c886d85d4f337fe2f9282;p=yaz-moved-to-github.git Got rid of a few warnings WRT signed/unsigned types --- diff --git a/client/client.c b/client/client.c index ac7380c..b5921ef 100644 --- a/client/client.c +++ b/client/client.c @@ -197,11 +197,12 @@ const char* query_type_as_string(QueryType q) } } -static void do_hex_dump(const char* buf, int len) +static void do_hex_dump(const char* buf, size_t len) { if (hex_dump) { - int i,x; + size_t i; + int x; for (i = 0; i < len ; i = i+16 ) { printf(" %4.4d ",i); @@ -590,7 +591,7 @@ static int parse_cmd_doc(const char **arg, ODR out, char **buf, int *len) } else if ((*arg)[0] == '<') { - long fsize; + size_t fsize; FILE *inf; const char *fname; const char *arg_start = ++(*arg); @@ -3914,7 +3915,7 @@ static void handle_srw_record(Z_SRW_record *rec) if (rec->recordData_buf && rec->recordData_len) { if (fwrite(rec->recordData_buf, 1, rec->recordData_len, stdout) != - rec->recordData_len) + (size_t) (rec->recordData_len)) { printf("write to stdout failed\n"); } diff --git a/client/fhistory.c b/client/fhistory.c index 2025939..3b286ea 100644 --- a/client/fhistory.c +++ b/client/fhistory.c @@ -76,7 +76,7 @@ int file_history_save(file_history_t fh) char* homedir = getenv("HOME"); char fname[1024]; int ret = 0; - int sz = wrbuf_len(fh->wr); + size_t sz = wrbuf_len(fh->wr); if (!sz) return 0; @@ -116,11 +116,11 @@ int file_history_save(file_history_t fh) int file_history_trav(file_history_t fh, void *client_data, void (*callback)(void *client_data, const char *line)) { - int off = 0; + size_t off = 0; while (off < wrbuf_len(fh->wr)) { - int i; + size_t i; for (i = off; i < wrbuf_len(fh->wr); i++) { if (wrbuf_buf(fh->wr)[i] == '\n') diff --git a/src/marcdisp.c b/src/marcdisp.c index 2f5f0d5..a11f9dc 100644 --- a/src/marcdisp.c +++ b/src/marcdisp.c @@ -1051,7 +1051,7 @@ static int marc_exec_leader(const char *leader_spec, char *leader, size_t size) no = sscanf(cp, "%d=%20[^,]%n", &pos, val, &no_read); if (no < 2 || no_read < 3) return -1; - if (pos < 0 || pos >= size) + if (pos < 0 || (size_t) pos >= size) return -1; if (*val == '\'') diff --git a/src/options.c b/src/options.c index 35f4e6f..ca9511f 100644 --- a/src/options.c +++ b/src/options.c @@ -20,7 +20,7 @@ static int arg_off = 0; int options (const char *desc, char **argv, int argc, char **arg) { const char *opt_buf = 0; - int i = 0; + size_t i = 0; int ch = 0; if (arg_no >= argc) @@ -55,7 +55,7 @@ int options (const char *desc, char **argv, int argc, char **arg) int type = 0; while (desc[i] == '{') { - int i0 = ++i; + size_t i0 = ++i; while (desc[i] && desc[i] != '}') i++; if (opt_buf && (i - i0) == strlen(opt_buf) && diff --git a/src/rpn2cql.c b/src/rpn2cql.c index 7a5b9ca..14afc9c 100644 --- a/src/rpn2cql.c +++ b/src/rpn2cql.c @@ -99,7 +99,7 @@ static int rpn2cql_simple(cql_transform_t ct, if (term) { - int i; + size_t i; int must_quote = 0; for (i = 0 ; i < lterm; i++) if (sterm[i] == ' ') diff --git a/src/seshigh.c b/src/seshigh.c index 97c9e04..9edcb2e 100644 --- a/src/seshigh.c +++ b/src/seshigh.c @@ -1657,7 +1657,7 @@ static int check_path(const char *path) return 1; } -static char *read_file(const char *fname, ODR o, int *sz) +static char *read_file(const char *fname, ODR o, size_t *sz) { char *buf; FILE *inf = fopen(fname, "rb"); diff --git a/zoom/zoomsh.c b/zoom/zoomsh.c index 2cbd6d4..d943abc 100644 --- a/zoom/zoomsh.c +++ b/zoom/zoomsh.c @@ -207,7 +207,7 @@ static void display_records(ZOOM_connection c, schema ? schema : "unknown"); if (render) { - if (fwrite(render, 1, len, stdout) != len) + if (fwrite(render, 1, len, stdout) != (size_t) len) { printf("write to stdout failed\n"); } @@ -215,7 +215,8 @@ static void display_records(ZOOM_connection c, printf("\n"); if (opac_render) { - if (fwrite(opac_render, 1, opac_len, stdout) != opac_len) + if (fwrite(opac_render, 1, opac_len, stdout) != (size_t) + opac_len) printf("write to stdout failed\n"); } } diff --git a/zoom/zoomtst5.c b/zoom/zoomtst5.c index 14ee88b..2e45dff 100644 --- a/zoom/zoomtst5.c +++ b/zoom/zoomtst5.c @@ -105,7 +105,7 @@ int main(int argc, char **argv) (db ? db : "unknown")); if (rec) { - if (fwrite (str, 1, len, stdout) != len) + if (fwrite (str, 1, len, stdout) != (size_t) len) printf("write to stdout failed\n"); } printf ("\n"); diff --git a/zoom/zoomtst6.c b/zoom/zoomtst6.c index cce5ea1..3215421 100644 --- a/zoom/zoomtst6.c +++ b/zoom/zoomtst6.c @@ -30,7 +30,7 @@ static void display_records (const char *tname, ZOOM_resultset r) printf ("%d %s\n", pos+1, (db ? db : "unknown")); if (render) { - if (fwrite (render, 1, len, stdout) != len) + if (fwrite (render, 1, len, stdout) != (size_t) len) printf("write to stdout failed\n"); } printf ("\n"); diff --git a/zoom/zoomtst7.c b/zoom/zoomtst7.c index 7ded3df..78d13e9 100644 --- a/zoom/zoomtst7.c +++ b/zoom/zoomtst7.c @@ -159,7 +159,7 @@ int main(int argc, char **argv) while (ZOOM_event (1, &z)) ; printf (" scan size = %ld\n", (long) ZOOM_scanset_size(scan)); - for (j = 0; j