From: Adam Dickmeiss Date: Fri, 21 Apr 2006 10:28:06 +0000 (+0000) Subject: Added several type casts due to no portable way of doing printf of X-Git-Tag: YAZ.2.1.18~12 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=d57ade59211707b9bcfacc61039e446c9fa3f36f Added several type casts due to no portable way of doing printf of a size_t variable. --- diff --git a/client/client.c b/client/client.c index 74ca30f..1e7077f 100644 --- a/client/client.c +++ b/client/client.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2005, Index Data ApS * See the file LICENSE for details. * - * $Id: client.c,v 1.303 2006-03-31 09:51:21 adam Exp $ + * $Id: client.c,v 1.304 2006-04-21 10:28:06 adam Exp $ */ #include @@ -880,7 +880,7 @@ static void display_record(Z_External *r) if (!(*type->fun)(in, &rr, 0, 0)) { odr_perror(in, "Decoding constructed record."); - fprintf(stdout, "[Near %d]\n", odr_offset(in)); + fprintf(stdout, "[Near %ld]\n", (long) odr_offset(in)); fprintf(stdout, "Packet dump:\n---------\n"); odr_dumpBER(stdout, (char*)r->u.octet_aligned->buf, r->u.octet_aligned->len); @@ -1550,7 +1550,8 @@ static int send_searchRequest(const char *arg) const char *pqf_msg; size_t off; int code = yaz_pqf_error (pqf_parser, &pqf_msg, &off); - printf("%*s^\n", off+4, ""); + int ioff = off; + printf("%*s^\n", ioff+4, ""); printf("Prefix query error: %s (code %d)\n", pqf_msg, code); yaz_pqf_destroy (pqf_parser); @@ -2851,7 +2852,8 @@ int send_scanrequest(const char *query, int pp, int num, const char *term) const char *pqf_msg; size_t off; int code = yaz_pqf_error (pqf_parser, &pqf_msg, &off); - printf("%*s^\n", off+7, ""); + int ioff = off; + printf("%*s^\n", ioff+7, ""); printf("Prefix query error: %s (code %d)\n", pqf_msg, code); yaz_pqf_destroy (pqf_parser); return -1; @@ -3945,7 +3947,7 @@ void wait_and_handle_response(int one_response_only) { FILE *f = ber_file ? ber_file : stdout; odr_perror(in, "Decoding incoming APDU"); - fprintf(f, "[Near %d]\n", odr_offset(in)); + fprintf(f, "[Near %ld]\n", (long) odr_offset(in)); fprintf(f, "Packet dump:\n---------\n"); odr_dumpBER(f, netbuffer, res); fprintf(f, "---------\n"); @@ -4055,7 +4057,8 @@ int cmd_cclparse(const char* arg) rpn = ccl_find_str (bibset, arg, &error, &pos); if (error) { - printf ("%*s^ - ", 3+strlen(last_cmd)+1+pos, " "); + int ioff = 3+strlen(last_cmd)+1+pos; + printf ("%*s^ - ", ioff, " "); printf ("%s\n", ccl_err_msg (error)); } else diff --git a/src/nmem.c b/src/nmem.c index e2b2aa9..62c02e2 100644 --- a/src/nmem.c +++ b/src/nmem.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2005, Index Data ApS * See the file LICENSE for details. * - * $Id: nmem.c,v 1.21 2006-02-01 20:29:19 adam Exp $ + * $Id: nmem.c,v 1.22 2006-04-21 10:28:06 adam Exp $ */ /** @@ -239,7 +239,8 @@ static nmem_block *get_block(size_t size) if (get < size) get = size; if(log_level) - yaz_log (log_level, "nmem get_block alloc new block size=%d", get); + yaz_log (log_level, "nmem get_block alloc new block size=%ld", + (long) get); r = (nmem_block *)xmalloc(sizeof(*r)); r->buf = (char *)xmalloc(r->size = get); diff --git a/src/seshigh.c b/src/seshigh.c index f47c417..5ad7ef3 100644 --- a/src/seshigh.c +++ b/src/seshigh.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2005, Index Data ApS * See the file LICENSE for details. * - * $Id: seshigh.c,v 1.74 2006-04-05 12:05:36 mike Exp $ + * $Id: seshigh.c,v 1.75 2006-04-21 10:28:07 adam Exp $ */ /** * \file seshigh.c @@ -360,10 +360,10 @@ void ir_session(IOCHAN h, int event) if (!z_GDU(assoc->decode, &req->gdu_request, 0, 0)) { yaz_log(YLOG_WARN, "ODR error on incoming PDU: %s [element %s] " - "[near byte %d] ", + "[near byte %ld] ", odr_errmsg(odr_geterror(assoc->decode)), odr_getelement(assoc->decode), - odr_offset(assoc->decode)); + (long) odr_offset(assoc->decode)); if (assoc->decode->error != OHTTP) { yaz_log(YLOG_WARN, "PDU dump:"); @@ -775,8 +775,8 @@ static void srw_bend_search(association *assoc, request *req, const char *pqf_msg; size_t off; int code = yaz_pqf_error (pqf_parser, &pqf_msg, &off); - yaz_log(log_requestdetail, "Parse error %d %s near offset %d", - code, pqf_msg, off); + yaz_log(log_requestdetail, "Parse error %d %s near offset %ld", + code, pqf_msg, (long) off); srw_error = YAZ_SRW_QUERY_SYNTAX_ERROR; } @@ -2073,7 +2073,7 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb) assoc->init->implementation_name, odr_prepend(assoc->encode, "GFS", resp->implementationName)); - version = odr_strdup(assoc->encode, "$Revision: 1.74 $"); + version = odr_strdup(assoc->encode, "$Revision: 1.75 $"); if (strlen(version) > 10) /* check for unexpanded CVS strings */ version[strlen(version)-2] = '\0'; resp->implementationVersion = odr_prepend(assoc->encode, diff --git a/src/xmalloc.c b/src/xmalloc.c index 6ff7b4a..d48daa4 100644 --- a/src/xmalloc.c +++ b/src/xmalloc.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2005, Index Data ApS * All rights reserved. * - * $Id: xmalloc.c,v 1.6 2005-06-25 15:46:06 adam Exp $ + * $Id: xmalloc.c,v 1.7 2006-04-21 10:28:07 adam Exp $ */ /** * \file xmalloc.c @@ -258,11 +258,11 @@ void *xrealloc_f (void *o, size_t size, const char *file, int line) if(log_level) yaz_log (log_level, - "%s:%d: xrealloc(s=%d) %p -> %p", file, line, size, o, p); + "%s:%d: xrealloc(s=%ld) %p -> %p", file, line, (long) size, o, p); if (!p) { - yaz_log (YLOG_FATAL|YLOG_ERRNO, "Out of memory, realloc (%d bytes)", - size); + yaz_log (YLOG_FATAL|YLOG_ERRNO, "Out of memory, realloc (%ld bytes)", + (long) size); exit(1); } return p; @@ -279,11 +279,13 @@ void *xmalloc_f (size_t size, const char *file, int line) } if (log_level) - yaz_log (log_level, "%s:%d: xmalloc(s=%d) %p", file, line, size, p); + yaz_log (log_level, "%s:%d: xmalloc(s=%ld) %p", file, line, + (long) size, p); if (!p) { - yaz_log (YLOG_FATAL, "Out of memory - malloc (%d bytes)", size); + yaz_log (YLOG_FATAL, "Out of memory - malloc (%ld bytes)", + (long) size); exit (1); } return p; @@ -299,11 +301,13 @@ void *xcalloc_f (size_t nmemb, size_t size, const char *file, int line) } if (log_level) - yaz_log (log_level, "%s:%d: xcalloc(s=%d) %p", file, line, size, p); + yaz_log (log_level, "%s:%d: xcalloc(s=%ld) %p", file, line, + (long) size, p); if (!p) { - yaz_log (YLOG_FATAL, "Out of memory - calloc (%d, %d)", nmemb, size); + yaz_log (YLOG_FATAL, "Out of memory - calloc (%ld, %ld)", + (long) nmemb, (long) size); exit (1); } return p; @@ -319,7 +323,8 @@ char *xstrdup_f (const char *s, const char *file, int line) } if (log_level) - yaz_log (log_level, "%s:%d: xstrdup(s=%d) %p", file, line, strlen(s)+1, p); + yaz_log (log_level, "%s:%d: xstrdup(s=%ld) %p", file, line, + (long) strlen(s)+1, p); strcpy (p, s); return p; diff --git a/src/zoom-c.c b/src/zoom-c.c index 148b54e..c05e51c 100644 --- a/src/zoom-c.c +++ b/src/zoom-c.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2005, Index Data ApS * See the file LICENSE for details. * - * $Id: zoom-c.c,v 1.69 2006-04-19 10:05:03 adam Exp $ + * $Id: zoom-c.c,v 1.70 2006-04-21 10:28:07 adam Exp $ */ /** * \file zoom-c.c @@ -918,8 +918,8 @@ ZOOM_resultset_records (ZOOM_resultset r, ZOOM_record *recs, if (!r) return ; - yaz_log(log_api, "%p ZOOM_resultset_records r=%p start=%d count=%d", - r, r, start, count); + yaz_log(log_api, "%p ZOOM_resultset_records r=%p start=%ld count=%ld", + r, r, (long) start, (long) count); if (count && recs) force_present = 1; ZOOM_resultset_retrieve (r, force_present, start, count); @@ -1150,7 +1150,7 @@ static zoom_ret ZOOM_connection_send_init (ZOOM_connection c) ZOOM_options_get(c->options, "implementationName"), odr_prepend(c->odr_out, "ZOOM-C", ireq->implementationName)); - version = odr_strdup(c->odr_out, "$Revision: 1.69 $"); + version = odr_strdup(c->odr_out, "$Revision: 1.70 $"); if (strlen(version) > 10) /* check for unexpanded CVS strings */ version[strlen(version)-2] = '\0'; ireq->implementationVersion = odr_prepend(c->odr_out, diff --git a/util/marcdump.c b/util/marcdump.c index e056593..8014113 100644 --- a/util/marcdump.c +++ b/util/marcdump.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2006, Index Data ApS * See the file LICENSE for details. * - * $Id: marcdump.c,v 1.36 2006-04-19 10:05:04 adam Exp $ + * $Id: marcdump.c,v 1.37 2006-04-21 10:28:07 adam Exp $ */ #define _FILE_OFFSET_BITS 64 @@ -139,7 +139,8 @@ static void dump(const char *fname, const char *from, const char *to, if (r < 5) { if (r && print_offset && verbose) - printf ("\n", r); + printf ("\n", + (long) r); break; } while (*buf < '0' || *buf > '9') diff --git a/util/pqf2pqf.xsl b/util/pqf2pqf.xsl index 021117b..449f3e6 100644 --- a/util/pqf2pqf.xsl +++ b/util/pqf2pqf.xsl @@ -109,7 +109,7 @@ Notice that the selection rules can equally either be written 'attr/@type=7' or 'attr[@type=8]' with no difference -->