oct->len = oct->size = status.st_size;
oct->buf = (unsigned char *) odr_malloc (out, oct->size);
- if (fread(oct->buf, 1, oct->size, inf) != oct->size)
+ if (fread(oct->buf, 1, oct->size, inf) != (size_t) oct->size)
{
printf("Incomplete read of file %s\n", fname);
}
return r;
}
-static Z_External *create_external_ILL_APDU(int which)
+static Z_External *create_external_ILL_APDU(void)
{
struct ill_get_ctl ctl;
ILL_APDU *ill_apdu;
{
printf("using ILL-request\n");
r->u.itemOrder->u.esRequest->notToKeep->itemRequest =
- create_external_ILL_APDU(ILL_APDU_ILL_Request);
+ create_external_ILL_APDU();
}
else if (!strcmp(type, "xml") || !strcmp(type, "3"))
{
int ber_decinteger(const unsigned char *buf, Odr_int *val, int max)
{
unsigned long long uval = 0;
- int len;
- size_t i;
+ int i, len;
int res;
const unsigned char *b = buf;
b += res;
if (*b & 0x80)
- for (i = 0; i < sizeof(uval) - len; i++)
+ for (i = 0; i < (int) sizeof(uval) - len; i++)
uval = (uval << 8) + 0xFF;
for (i = 0; i < len; i++)
uval = (uval << 8) + b[i];
/* lead is first of a list of qualifier aliaeses */
/* qualifier alias: q1 q2 ... */
char *qlist[10];
- int i = 0;
+ size_t i = 0;
qlist[i++] = lead_str;
while (1)
{
const char *cp2 = cp1;
- int len;
+ size_t len;
while (*cp2 && !strchr("\r\n", *cp2))
cp2++;
len = cp2 - cp1;
#if YAZ_HAVE_XML2
-static int ccl_xml_config_attr(CCL_bibset bibset, const char *default_set,
+static int ccl_xml_config_attr(const char *default_set,
WRBUF wrbuf,
const xmlNode *ptr,
const char **addinfo)
{
if (!xmlStrcmp(a_ptr->name, BAD_CAST "attr"))
{
- int r = ccl_xml_config_attr(bibset, default_set, wrbuf,
+ int r = ccl_xml_config_attr(default_set, wrbuf,
a_ptr, addinfo);
if (r)
return r;
int i;
while (*cp1 && *cp1 != ' ')
cp1++;
- if (cp1 - cp0 >= sizeof(buf))
+ if (cp1 - cp0 >= (ptrdiff_t) sizeof(buf))
break;
memcpy(buf, cp0, cp1 - cp0);
buf[cp1-cp0] = 0;
yaz_log(YLOG_FATAL|YLOG_ERRNO, "ftruncate");
exit(1);
}
- if (write(pid_fd, buf, strlen(buf)) != strlen(buf))
+ if (write(pid_fd, buf, strlen(buf)) != (int) strlen(buf))
{
yaz_log(YLOG_FATAL|YLOG_ERRNO, "write");
exit(1);
for (i = 0; i < v->num_triples; i++)
{
- printf("%*sclass=" ODR_INT_PRINTF ",type=" ODR_INT_PRINTF,
- level * 4, "", *v->triples[i]->zclass,
- *v->triples[i]->type);
+ wrbuf_printf(w, "%*sclass=" ODR_INT_PRINTF ",type=" ODR_INT_PRINTF,
+ level * 4, "", *v->triples[i]->zclass,
+ *v->triples[i]->type);
if (v->triples[i]->which == Z_Triple_internationalString)
- printf(",value=%s\n", v->triples[i]->value.internationalString);
+ wrbuf_printf(w, ",value=%s\n",
+ v->triples[i]->value.internationalString);
else
- printf("\n");
+ wrbuf_printf(w, "\n");
}
}
void yaz_display_grs1(WRBUF wrbuf, Z_GenericRecord *r, int flags)
{
- display_grs1 (wrbuf, r, 0);
+ display_grs1(wrbuf, r, 0);
}
/*
while (*cp)
{
char this_opt[42];
- int i, j;
+ size_t i, j;
if (*cp == ' ' || *cp == ',')
{
cp++;
yaz_apt_to_wrbuf(b, zapt);
}
-void wrbuf_diags(WRBUF b, int num_diagnostics,Z_DiagRec **diags)
+void wrbuf_diags(WRBUF b, int num_diagnostics, Z_DiagRec **diags)
{
/* we only dump the first diag - that keeps the log cleaner. */
wrbuf_printf(b," ERROR ");
if (!p)
return 0;
- for (argc = 0; *p ; argc++)
+ for (argc = 0; *p && argc < num ; argc++)
{
if (*p == '#') /* trailing comment */
break;
return 0;
}
-static void srw_bend_search(association *assoc, request *req,
+static void srw_bend_search(association *assoc,
Z_SRW_PDU *sr,
Z_SRW_PDU *res,
int *http_code)
}
}
-static char *srw_bend_explain_default(void *handle, bend_explain_rr *rr)
+static char *srw_bend_explain_default(bend_explain_rr *rr)
{
#if YAZ_HAVE_XML2
xmlNodePtr ptr = (xmlNode *) rr->server_node_ptr;
return 0;
}
-static void srw_bend_explain(association *assoc, request *req,
+static void srw_bend_explain(association *assoc,
Z_SRW_PDU *sr,
Z_SRW_explainResponse *srw_res,
int *http_code)
if (assoc->init->bend_explain)
(*assoc->init->bend_explain)(assoc->backend, &rr);
else
- srw_bend_explain_default(assoc->backend, &rr);
+ srw_bend_explain_default(&rr);
if (rr.explain_buf)
{
}
}
-static void srw_bend_scan(association *assoc, request *req,
+static void srw_bend_scan(association *assoc,
Z_SRW_PDU *sr,
Z_SRW_scanResponse *srw_res,
int *http_code)
}
-static void srw_bend_update(association *assoc, request *req,
+static void srw_bend_update(association *assoc,
Z_SRW_PDU *sr,
Z_SRW_updateResponse *srw_res,
int *http_code)
}
else
{
- srw_bend_search(assoc, req, sr, res, &http_code);
+ srw_bend_search(assoc, sr, res, &http_code);
}
if (http_code == 200)
soap_package->u.generic->p = res;
res->u.explain_response->diagnostics = diagnostic;
res->u.explain_response->num_diagnostics = num_diagnostic;
}
- srw_bend_explain(assoc, req, sr,
- res->u.explain_response, &http_code);
+ srw_bend_explain(assoc, sr, res->u.explain_response, &http_code);
if (http_code == 200)
soap_package->u.generic->p = res;
}
res->u.scan_response->diagnostics = diagnostic;
res->u.scan_response->num_diagnostics = num_diagnostic;
}
- srw_bend_scan(assoc, req, sr,
- res->u.scan_response, &http_code);
+ srw_bend_scan(assoc, sr, res->u.scan_response, &http_code);
if (http_code == 200)
soap_package->u.generic->p = res;
}
res->u.update_response->num_diagnostics = num_diagnostic;
}
yaz_log(YLOG_DEBUG, "num_diag = %d", res->u.update_response->num_diagnostics );
- srw_bend_update(assoc, req, sr,
- res->u.update_response, &http_code);
+ srw_bend_update(assoc, sr, res->u.update_response, &http_code);
if (http_code == 200)
soap_package->u.generic->p = res;
}
#include <yaz/odr.h>
#include <yaz/zgdu.h>
-int z_GDU (ODR o, Z_GDU **p, int opt, const char *name)
+int z_GDU(ODR o, Z_GDU **p, int opt, const char *name)
{
if (o->direction == ODR_DECODE) {
*p = (Z_GDU *) odr_malloc(o, sizeof(**p));
{
/* Use "from,to" or just "from" */
const char *cp = strchr(record_charset, ',');
- int clen = strlen(record_charset);
+ size_t clen = strlen(record_charset);
if (cp && cp[1])
{
strncpy( to, cp+1, sizeof(to)-1);
char charset[40];
char xpath[512];
const char *cp;
- int i;
+ size_t i;
Z_NamePlusRecord *npr;
if (len)
i++;
if (!strncmp(type_spec+i, "charset=", 8))
{
- int j = 0;
+ size_t j = 0;
i = i + 8; /* skip charset= */
for (j = 0; type_spec[i] && j < sizeof(charset)-1; i++, j++)
{
}
else if (!strncmp(type_spec+i, "xpath=", 6))
{
- int j = 0;
+ size_t j = 0;
i = i + 6;
for (j = 0; type_spec[i] && j < sizeof(xpath)-1; i++, j++)
xpath[j] = cp[i];
*disp_len = 0;
*occ = 0;
- if (pos >= noent || pos < 0)
+ if (pos >= noent)
return;
if (scan->scan_response)
{
size_t inbytesleft = strlen(buf);
const char *inp = buf;
int rounds = 0;
- for (rounds = 0; inbytesleft && rounds < sizeof(outbuf); rounds++)
+ for (rounds = 0; inbytesleft && rounds < (int) sizeof(outbuf); rounds++)
{
size_t outbytesleft = sizeof(outbuf);
char *outp = outbuf;
{
cp = (char *) nmem_malloc(n, j);
YAZ_CHECK(cp);
- if (sizeof(long) >= j)
+ if ((int) sizeof(long) >= j)
*(long*) cp = 123L;
#if HAVE_LONG_LONG
- if (sizeof(long long) >= j)
+ if ((int) sizeof(long long) >= j)
*(long long*) cp = 123L;
#endif
- if (sizeof(double) >= j)
+ if ((int) sizeof(double) >= j)
*(double*) cp = 12.2;
}
Yc_MySequence *t;
srand(123);
- for (i = 0; i<1000; i++)
+ for (i = 0; i < 1000; i++)
{
int j;
- for (j = 0; j<sizeof(buf); j++)
+ for (j = 0; j < (int) sizeof(buf); j++)
buf[j] = rand();
- for (j = 1; j<sizeof(buf); j++)
+ for (j = 1; j < (int) sizeof(buf); j++)
{
odr_setbuf(decode, buf, j, 0);
yc_MySequence(decode, &t, 0, 0);
xmlDocDumpMemory(doc, (xmlChar **) &buf_out, &len_out);
- if (len_out == strlen(expect_xml)
+ if (len_out == (int) strlen(expect_xml)
&& memcmp(buf_out, expect_xml, len_out) == 0)
{
Z_Query *query2 = 0;
return 0;
}
len = q->term->term->u.general->len;
- if (len >= sizeof(term))
+ if (len >= (int ) sizeof(term))
len = sizeof(term)-1;
memcpy(term, q->term->term->u.general->buf, len);
term[len] = '\0';