From: Adam Dickmeiss Date: Mon, 22 Aug 2005 20:34:21 +0000 (+0000) Subject: More type casts for char signed/unsigned and xmlChar. Using X-Git-Tag: YAZXF2.1.4.2.2.release~4 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=43a7aff23f364fd3fac6e9746c53cda01be13738;p=yaz-moved-to-github.git More type casts for char signed/unsigned and xmlChar. Using xmlStrcmp, xmlStrlen in a few places instead of strcmp/strlen. --- diff --git a/client/client.c b/client/client.c index 09d68f5..6cad6d8 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.294 2005-07-22 06:23:14 adam Exp $ + * $Id: client.c,v 1.295 2005-08-22 20:34:21 adam Exp $ */ #include @@ -406,7 +406,7 @@ static int process_initResponse(Z_InitResponse *res) if (oid->value == VAL_OCLCUI) { Z_OCLC_UserInformation *oclc_ui; ODR decode = odr_createmem(ODR_DECODE); - odr_setbuf(decode, sat->buf, sat->len, 0); + odr_setbuf(decode, (char *) sat->buf, sat->len, 0); if (!z_OCLC_UserInformation(decode, &oclc_ui, 0, 0)) printf ("Bad OCLC UserInformation:\n"); else diff --git a/src/ccltoken.c b/src/ccltoken.c index 6eb1466..1288071 100644 --- a/src/ccltoken.c +++ b/src/ccltoken.c @@ -48,7 +48,7 @@ /* CCL - lexical analysis * Europagate, 1995 * - * $Id: ccltoken.c,v 1.8 2005-06-25 15:46:03 adam Exp $ + * $Id: ccltoken.c,v 1.9 2005-08-22 20:34:21 adam Exp $ * * Old Europagate Log: * @@ -165,7 +165,7 @@ struct ccl_token *ccl_parser_tokenize (CCL_parser cclp, const char *command) last->next->prev = last; last = last->next; } - last->ws_prefix_buf = cp0; + last->ws_prefix_buf = (const char *) cp0; last->ws_prefix_len = cp - cp0; last->next = NULL; last->name = (const char *) cp; diff --git a/src/logrpn.c b/src/logrpn.c index 39e9893..3da47d3 100644 --- a/src/logrpn.c +++ b/src/logrpn.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2005, Index Data ApS * All rights reserved. * - * $Id: logrpn.c,v 1.11 2005-06-25 15:46:04 adam Exp $ + * $Id: logrpn.c,v 1.12 2005-08-22 20:34:21 adam Exp $ */ /** @@ -417,7 +417,7 @@ static void wrbuf_apt(WRBUF b, Z_AttributesPlusTerm *zapt) switch (zapt->term->which) { case Z_Term_general: - wrbuf_term(b, zapt->term->u.general->buf, + wrbuf_term(b, (const char *)zapt->term->u.general->buf, zapt->term->u.general->len); break; case Z_Term_characterString: diff --git a/src/opacdisp.c b/src/opacdisp.c index cfa9efe..17902d9 100644 --- a/src/opacdisp.c +++ b/src/opacdisp.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2005, Index Data ApS * See the file LICENSE for details. * - * $Id: opacdisp.c,v 1.7 2005-06-25 15:46:04 adam Exp $ + * $Id: opacdisp.c,v 1.8 2005-08-22 20:34:21 adam Exp $ */ /** * \file opacdisp.c @@ -61,7 +61,7 @@ void yaz_opac_decode_wrbuf(yaz_marc_t mt, Z_OPACRecord *r, WRBUF wrbuf) wrbuf_puts (wrbuf, " \n"); if (ext->which == Z_External_octet) - yaz_marc_decode_wrbuf(mt, ext->u.octet_aligned->buf, + yaz_marc_decode_wrbuf(mt, (const char *) ext->u.octet_aligned->buf, ext->u.octet_aligned->len, wrbuf); wrbuf_puts (wrbuf, " \n"); } @@ -78,7 +78,8 @@ void yaz_opac_decode_wrbuf(yaz_marc_t mt, Z_OPACRecord *r, WRBUF wrbuf) wrbuf_puts (wrbuf, " \n"); if (ext->which == Z_External_octet) - yaz_marc_decode_wrbuf(mt, ext->u.octet_aligned->buf, + yaz_marc_decode_wrbuf(mt, (const char *) + ext->u.octet_aligned->buf, ext->u.octet_aligned->len, wrbuf); wrbuf_puts (wrbuf, " \n"); } diff --git a/src/seshigh.c b/src/seshigh.c index e28b63a..711d7fe 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.58 2005-06-25 15:46:05 adam Exp $ + * $Id: seshigh.c,v 1.59 2005-08-22 20:34:21 adam Exp $ */ /** * \file seshigh.c @@ -930,7 +930,7 @@ static char *srw_bend_explain_default(void *handle, bend_explain_rr *rr) if (!strcmp((const char *) ptr->name, "explain")) { int len; - xmlDocPtr doc = xmlNewDoc("1.0"); + xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0"); xmlChar *buf_out; char *content; @@ -1764,7 +1764,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.58 $"); + version = odr_strdup(assoc->encode, "$Revision: 1.59 $"); if (strlen(version) > 10) /* check for unexpanded CVS strings */ version[strlen(version)-2] = '\0'; resp->implementationVersion = odr_prepend(assoc->encode, diff --git a/src/soap.c b/src/soap.c index 68ebb95..5bbc9cc 100644 --- a/src/soap.c +++ b/src/soap.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2005, Index Data ApS * See the file LICENSE for details. * - * $Id: soap.c,v 1.11 2005-06-25 15:46:05 adam Exp $ + * $Id: soap.c,v 1.12 2005-08-22 20:34:21 adam Exp $ */ /** * \file soap.c @@ -44,10 +44,11 @@ int z_soap_codec_enc_xsl(ODR o, Z_SOAP **pp, if (!doc) return z_soap_error(o, p, "SOAP-ENV:Client", "Bad XML Document", 0); + /* check that root node is Envelope */ ptr = xmlDocGetRootElement(doc); if (!ptr || ptr->type != XML_ELEMENT_NODE || - strcmp(ptr->name, "Envelope") || !ptr->ns) + xmlStrcmp(ptr->name, BAD_CAST "Envelope") || !ptr->ns) { xmlFreeDoc(doc); return z_soap_error(o, p, "SOAP-ENV:Client", @@ -56,7 +57,7 @@ int z_soap_codec_enc_xsl(ODR o, Z_SOAP **pp, else { /* determine SOAP version */ - const char * ns_envelope = ptr->ns->href; + const char * ns_envelope = (const char *) ptr->ns->href; if (!strcmp(ns_envelope, soap_v1_1)) p->ns = soap_v1_1; else if (!strcmp(ns_envelope, soap_v1_2)) @@ -72,8 +73,8 @@ int z_soap_codec_enc_xsl(ODR o, Z_SOAP **pp, while(ptr && ptr->type == XML_TEXT_NODE) ptr = ptr->next; if (ptr && ptr->type == XML_ELEMENT_NODE && - !strcmp(ptr->ns->href, p->ns) && - !strcmp(ptr->name, "Header")) + !xmlStrcmp(ptr->ns->href, BAD_CAST p->ns) && + !xmlStrcmp(ptr->name, BAD_CAST "Header")) { ptr = ptr->next; while(ptr && ptr->type == XML_TEXT_NODE) @@ -81,13 +82,13 @@ int z_soap_codec_enc_xsl(ODR o, Z_SOAP **pp, } /* check that Body is present */ if (!ptr || ptr->type != XML_ELEMENT_NODE || - strcmp(ptr->name, "Body")) + xmlStrcmp(ptr->name, BAD_CAST "Body")) { xmlFreeDoc(doc); return z_soap_error(o, p, "SOAP-ENV:Client", "SOAP Body element not found", 0); } - if (strcmp(ptr->ns->href, p->ns)) + if (xmlStrcmp(ptr->ns->href, BAD_CAST p->ns)) { xmlFreeDoc(doc); return z_soap_error(o, p, "SOAP-ENV:Client", @@ -110,8 +111,8 @@ int z_soap_codec_enc_xsl(ODR o, Z_SOAP **pp, "SOAP No namespace for content", 0); } /* check for fault package */ - if (!strcmp(ptr->ns->href, p->ns) - && !strcmp(ptr->name, "Fault") && ptr->children) + if (!xmlStrcmp(ptr->ns->href, BAD_CAST p->ns) + && !xmlStrcmp(ptr->name, BAD_CAST "Fault") && ptr->children) { ptr = ptr->children; @@ -124,15 +125,18 @@ int z_soap_codec_enc_xsl(ODR o, Z_SOAP **pp, { if (ptr->children && ptr->children->type == XML_TEXT_NODE) { - if (!strcmp(ptr->name, "faultcode")) + if (!xmlStrcmp(ptr->name, BAD_CAST "faultcode")) p->u.fault->fault_code = - odr_strdup(o, ptr->children->content); - if (!strcmp(ptr->name, "faultstring")) + odr_strdup(o, (const char *) + ptr->children->content); + if (!xmlStrcmp(ptr->name, BAD_CAST "faultstring")) p->u.fault->fault_string = - odr_strdup(o, ptr->children->content); - if (!strcmp(ptr->name, "details")) + odr_strdup(o, (const char *) + ptr->children->content); + if (!xmlStrcmp(ptr->name, BAD_CAST "details")) p->u.fault->details = - odr_strdup(o, ptr->children->content); + odr_strdup(o, (const char *) + ptr->children->content); } ptr = ptr->next; } @@ -141,7 +145,7 @@ int z_soap_codec_enc_xsl(ODR o, Z_SOAP **pp, else { for (i = 0; handlers[i].ns; i++) - if (!strcmp(ptr->ns->href, handlers[i].ns)) + if (!xmlStrcmp(ptr->ns->href, BAD_CAST handlers[i].ns)) break; if (handlers[i].ns) { @@ -165,7 +169,8 @@ int z_soap_codec_enc_xsl(ODR o, Z_SOAP **pp, else { ret = z_soap_error(o, p, "SOAP-ENV:Client", - "No handler for NS", ptr->ns->href); + "No handler for NS", + (const char *)ptr->ns->href); } } xmlFreeDoc(doc); @@ -177,23 +182,29 @@ int z_soap_codec_enc_xsl(ODR o, Z_SOAP **pp, xmlNsPtr ns_env; xmlNodePtr envelope_ptr, body_ptr; - xmlDocPtr doc = xmlNewDoc("1.0"); + xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0"); - envelope_ptr = xmlNewNode(0, "Envelope"); - ns_env = xmlNewNs(envelope_ptr, p->ns, "SOAP-ENV"); + envelope_ptr = xmlNewNode(0, BAD_CAST "Envelope"); + ns_env = xmlNewNs(envelope_ptr, BAD_CAST p->ns, + BAD_CAST "SOAP-ENV"); xmlSetNs(envelope_ptr, ns_env); - body_ptr = xmlNewChild(envelope_ptr, ns_env, "Body", 0); + body_ptr = xmlNewChild(envelope_ptr, ns_env, BAD_CAST "Body", + 0); xmlDocSetRootElement(doc, envelope_ptr); if (p->which == Z_SOAP_fault || p->which == Z_SOAP_error) { Z_SOAP_Fault *f = p->u.fault; - xmlNodePtr fault_ptr = xmlNewChild(body_ptr, ns_env, "Fault", 0); - xmlNewChild(fault_ptr, ns_env, "faultcode", f->fault_code); - xmlNewChild(fault_ptr, ns_env, "faultstring", f->fault_string); + xmlNodePtr fault_ptr = xmlNewChild(body_ptr, ns_env, + BAD_CAST "Fault", 0); + xmlNewChild(fault_ptr, ns_env, BAD_CAST "faultcode", + BAD_CAST f->fault_code); + xmlNewChild(fault_ptr, ns_env, BAD_CAST "faultstring", + BAD_CAST f->fault_string); if (f->details) - xmlNewChild(fault_ptr, ns_env, "details", f->details); + xmlNewChild(fault_ptr, ns_env, BAD_CAST "details", + BAD_CAST f->details); } else if (p->which == Z_SOAP_generic) { @@ -220,7 +231,8 @@ int z_soap_codec_enc_xsl(ODR o, Z_SOAP **pp, xmlNodePtr pi, ptr = xmlDocGetRootElement(doc); sprintf(content, "type=\"text/xsl\" href=\"%s\"", stylesheet); - pi = xmlNewPI("xml-stylesheet", content); + pi = xmlNewPI(BAD_CAST "xml-stylesheet", + BAD_CAST content); xmlAddPrevSibling(ptr, pi); } if (1) diff --git a/src/srw.c b/src/srw.c index 1165999..3c77116 100644 --- a/src/srw.c +++ b/src/srw.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2005, Index Data ApS * See the file LICENSE for details. * - * $Id: srw.c,v 1.35 2005-06-25 15:46:05 adam Exp $ + * $Id: srw.c,v 1.36 2005-08-22 20:34:21 adam Exp $ */ /** * \file srw.c @@ -22,7 +22,7 @@ static void add_XML_n(xmlNodePtr ptr, const char *elem, char *val, int len) xmlDocPtr doc = xmlParseMemory(val,len); if (doc) { - xmlNodePtr c = xmlNewChild(ptr, 0, elem, 0); + xmlNodePtr c = xmlNewChild(ptr, 0, BAD_CAST elem, 0); xmlNodePtr t = xmlDocGetRootElement(doc); xmlAddChild(c, xmlCopyNode(t,1)); xmlFreeDoc(doc); @@ -35,8 +35,8 @@ xmlNodePtr add_xsd_string_n(xmlNodePtr ptr, const char *elem, const char *val, { if (val) { - xmlNodePtr c = xmlNewChild(ptr, 0, elem, 0); - xmlNodePtr t = xmlNewTextLen(val, len); + xmlNodePtr c = xmlNewChild(ptr, 0, BAD_CAST elem, 0); + xmlNodePtr t = xmlNewTextLen(BAD_CAST val, len); xmlAddChild(c, t); return t; } @@ -46,7 +46,8 @@ xmlNodePtr add_xsd_string_n(xmlNodePtr ptr, const char *elem, const char *val, xmlNodePtr add_xsd_string(xmlNodePtr ptr, const char *elem, const char *val) { if (val) - return xmlNewTextChild(ptr, 0, elem, val); + return xmlNewTextChild(ptr, 0, BAD_CAST elem, + BAD_CAST val); return 0; } @@ -56,13 +57,13 @@ static void add_xsd_integer(xmlNodePtr ptr, const char *elem, const int *val) { char str[30]; sprintf(str, "%d", *val); - xmlNewTextChild(ptr, 0, elem, str); + xmlNewTextChild(ptr, 0, BAD_CAST elem, BAD_CAST str); } } static int match_element(xmlNodePtr ptr, const char *elem) { - if (ptr->type == XML_ELEMENT_NODE && !strcmp(ptr->name, elem)) + if (ptr->type == XML_ELEMENT_NODE && !xmlStrcmp(ptr->name, BAD_CAST elem)) return 1; return 0; } @@ -99,9 +100,9 @@ static int match_xsd_string_n(xmlNodePtr ptr, const char *elem, ODR o, *val = ""; return 1; } - *val = odr_strdup(o, ptr->content); + *val = odr_strdup(o, (const char *) ptr->content); if (len) - *len = strlen(ptr->content); + *len = xmlStrlen(ptr->content); return 1; } @@ -166,7 +167,7 @@ static int match_xsd_integer(xmlNodePtr ptr, const char *elem, ODR o, int **val) ptr = ptr->children; if (!ptr || ptr->type != XML_TEXT_NODE) return 0; - *val = odr_intdup(o, atoi(ptr->content)); + *val = odr_intdup(o, atoi((const char *) ptr->content)); return 1; } @@ -245,7 +246,7 @@ static int yaz_srw_records(ODR o, xmlNodePtr pptr, Z_SRW_record **recs, for (ptr = pptr->children; ptr; ptr = ptr->next) { if (ptr->type == XML_ELEMENT_NODE && - !strcmp(ptr->name, "record")) + !xmlStrcmp(ptr->name, BAD_CAST "record")) (*num)++; } if (!*num) @@ -254,7 +255,7 @@ static int yaz_srw_records(ODR o, xmlNodePtr pptr, Z_SRW_record **recs, for (i = 0, ptr = pptr->children; ptr; ptr = ptr->next) { if (ptr->type == XML_ELEMENT_NODE && - !strcmp(ptr->name, "record")) + !xmlStrcmp(ptr->name, BAD_CAST "record")) { yaz_srw_record(o, ptr, (*recs)+i, client_data, ns); i++; @@ -266,7 +267,8 @@ static int yaz_srw_records(ODR o, xmlNodePtr pptr, Z_SRW_record **recs, int i; for (i = 0; i < *num; i++) { - xmlNodePtr rptr = xmlNewChild(pptr, 0, "record", 0); + xmlNodePtr rptr = xmlNewChild(pptr, 0, BAD_CAST "record", + 0); yaz_srw_record(o, rptr, (*recs)+i, client_data, ns); } } @@ -284,7 +286,7 @@ static int yaz_srw_diagnostics(ODR o, xmlNodePtr pptr, Z_SRW_diagnostic **recs, for (ptr = pptr->children; ptr; ptr = ptr->next) { if (ptr->type == XML_ELEMENT_NODE && - !strcmp(ptr->name, "diagnostic")) + !xmlStrcmp(ptr->name, BAD_CAST "diagnostic")) (*num)++; } if (!*num) @@ -299,7 +301,7 @@ static int yaz_srw_diagnostics(ODR o, xmlNodePtr pptr, Z_SRW_diagnostic **recs, for (i = 0, ptr = pptr->children; ptr; ptr = ptr->next) { if (ptr->type == XML_ELEMENT_NODE && - !strcmp(ptr->name, "diagnostic")) + !xmlStrcmp(ptr->name, BAD_CAST "diagnostic")) { xmlNodePtr rptr; (*recs)[i].uri = 0; @@ -325,11 +327,13 @@ static int yaz_srw_diagnostics(ODR o, xmlNodePtr pptr, Z_SRW_diagnostic **recs, { int i; xmlNsPtr ns_diag = - xmlNewNs(pptr, "http://www.loc.gov/zing/srw/diagnostic/", 0); + xmlNewNs(pptr, BAD_CAST + "http://www.loc.gov/zing/srw/diagnostic/", 0); for (i = 0; i < *num; i++) { const char *std_diag = "info:srw/diagnostic/1/"; - xmlNodePtr rptr = xmlNewChild(pptr, ns_diag, "diagnostic", 0); + xmlNodePtr rptr = xmlNewChild(pptr, ns_diag, + BAD_CAST "diagnostic", 0); add_xsd_string(rptr, "uri", (*recs)[i].uri); if ((*recs)[i].message) add_xsd_string(rptr, "message", (*recs)[i].message); @@ -394,7 +398,7 @@ static int yaz_srw_terms(ODR o, xmlNodePtr pptr, Z_SRW_scanTerm **terms, for (ptr = pptr->children; ptr; ptr = ptr->next) { if (ptr->type == XML_ELEMENT_NODE && - !strcmp(ptr->name, "term")) + !xmlStrcmp(ptr->name, BAD_CAST "term")) (*num)++; } if (!*num) @@ -403,7 +407,7 @@ static int yaz_srw_terms(ODR o, xmlNodePtr pptr, Z_SRW_scanTerm **terms, for (i = 0, ptr = pptr->children; ptr; ptr = ptr->next, i++) { if (ptr->type == XML_ELEMENT_NODE && - !strcmp(ptr->name, "term")) + !xmlStrcmp(ptr->name, BAD_CAST "term")) yaz_srw_term(o, ptr, (*terms)+i, client_data, ns); } } @@ -412,7 +416,7 @@ static int yaz_srw_terms(ODR o, xmlNodePtr pptr, Z_SRW_scanTerm **terms, int i; for (i = 0; i < *num; i++) { - xmlNodePtr rptr = xmlNewChild(pptr, 0, "term", 0); + xmlNodePtr rptr = xmlNewChild(pptr, 0, BAD_CAST "term", 0); yaz_srw_term(o, rptr, (*terms)+i, client_data, ns); } } @@ -439,7 +443,7 @@ int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data, *p = (Z_SRW_PDU *) odr_malloc(o, sizeof(**p)); (*p)->srw_version = odr_strdup(o, "1.1"); - if (!strcmp(method->name, "searchRetrieveRequest")) + if (!xmlStrcmp(method->name, BAD_CAST "searchRetrieveRequest")) { xmlNodePtr ptr = method->children; Z_SRW_searchRetrieveRequest *req; @@ -504,7 +508,7 @@ int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data, /* missing is xQuery, xSortKeys .. */ } } - else if (!strcmp(method->name, "searchRetrieveResponse")) + else if (!xmlStrcmp(method->name, BAD_CAST "searchRetrieveResponse")) { xmlNodePtr ptr = method->children; Z_SRW_searchRetrieveResponse *res; @@ -549,7 +553,7 @@ int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data, client_data, ns); } } - else if (!strcmp(method->name, "explainRequest")) + else if (!xmlStrcmp(method->name, BAD_CAST "explainRequest")) { Z_SRW_explainRequest *req; xmlNodePtr ptr = method->children; @@ -576,7 +580,7 @@ int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data, ; } } - else if (!strcmp(method->name, "explainResponse")) + else if (!xmlStrcmp(method->name, BAD_CAST "explainResponse")) { Z_SRW_explainResponse *res; xmlNodePtr ptr = method->children; @@ -605,7 +609,7 @@ int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data, ; } } - else if (!strcmp(method->name, "scanRequest")) + else if (!xmlStrcmp(method->name, BAD_CAST "scanRequest")) { Z_SRW_scanRequest *req; xmlNodePtr ptr = method->children; @@ -647,7 +651,7 @@ int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data, ; } } - else if (!strcmp(method->name, "scanResponse")) + else if (!xmlStrcmp(method->name, BAD_CAST "scanResponse")) { Z_SRW_scanResponse *res; xmlNodePtr ptr = method->children; @@ -690,8 +694,8 @@ int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data, { Z_SRW_searchRetrieveRequest *req = (*p)->u.request; xmlNodePtr ptr = xmlNewChild(pptr, 0, - "searchRetrieveRequest", 0); - ns_srw = xmlNewNs(ptr, ns, "zs"); + BAD_CAST "searchRetrieveRequest", 0); + ns_srw = xmlNewNs(ptr, BAD_CAST ns, BAD_CAST "zs"); xmlSetNs(ptr, ns_srw); if ((*p)->srw_version) @@ -732,8 +736,8 @@ int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data, { Z_SRW_searchRetrieveResponse *res = (*p)->u.response; xmlNodePtr ptr = xmlNewChild(pptr, 0, - "searchRetrieveResponse", 0); - ns_srw = xmlNewNs(ptr, ns, "zs"); + BAD_CAST "searchRetrieveResponse", 0); + ns_srw = xmlNewNs(ptr, BAD_CAST ns, BAD_CAST "zs"); xmlSetNs(ptr, ns_srw); if ((*p)->srw_version) @@ -743,7 +747,7 @@ int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data, add_xsd_integer(ptr, "resultSetIdleTime", res->resultSetIdleTime); if (res->num_records) { - xmlNodePtr rptr = xmlNewChild(ptr, 0, "records", 0); + xmlNodePtr rptr = xmlNewChild(ptr, 0, BAD_CAST "records", 0); yaz_srw_records(o, rptr, &res->records, &res->num_records, client_data, ns); } @@ -751,7 +755,8 @@ int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data, res->nextRecordPosition); if (res->num_diagnostics) { - xmlNodePtr rptr = xmlNewChild(ptr, 0, "diagnostics", 0); + xmlNodePtr rptr = xmlNewChild(ptr, 0, BAD_CAST "diagnostics", + 0); yaz_srw_diagnostics(o, rptr, &res->diagnostics, &res->num_diagnostics, client_data, ns); } @@ -759,8 +764,9 @@ int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data, else if ((*p)->which == Z_SRW_explain_request) { Z_SRW_explainRequest *req = (*p)->u.explain_request; - xmlNodePtr ptr = xmlNewChild(pptr, 0, "explainRequest", 0); - ns_srw = xmlNewNs(ptr, ns, "zs"); + xmlNodePtr ptr = xmlNewChild(pptr, 0, BAD_CAST "explainRequest", + 0); + ns_srw = xmlNewNs(ptr, BAD_CAST ns, BAD_CAST "zs"); xmlSetNs(ptr, ns_srw); add_xsd_string(ptr, "version", (*p)->srw_version); @@ -771,19 +777,21 @@ int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data, else if ((*p)->which == Z_SRW_explain_response) { Z_SRW_explainResponse *res = (*p)->u.explain_response; - xmlNodePtr ptr = xmlNewChild(pptr, 0, "explainResponse", 0); - ns_srw = xmlNewNs(ptr, ns, "zs"); + xmlNodePtr ptr = xmlNewChild(pptr, 0, BAD_CAST "explainResponse", + 0); + ns_srw = xmlNewNs(ptr, BAD_CAST ns, BAD_CAST "zs"); xmlSetNs(ptr, ns_srw); add_xsd_string(ptr, "version", (*p)->srw_version); if (1) { - xmlNodePtr ptr1 = xmlNewChild(ptr, 0, "record", 0); + xmlNodePtr ptr1 = xmlNewChild(ptr, 0, BAD_CAST "record", 0); yaz_srw_record(o, ptr1, &res->record, client_data, ns); } if (res->num_diagnostics) { - xmlNodePtr rptr = xmlNewChild(ptr, 0, "diagnostics", 0); + xmlNodePtr rptr = xmlNewChild(ptr, 0, BAD_CAST "diagnostics", + 0); yaz_srw_diagnostics(o, rptr, &res->diagnostics, &res->num_diagnostics, client_data, ns); } @@ -791,8 +799,8 @@ int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data, else if ((*p)->which == Z_SRW_scan_request) { Z_SRW_scanRequest *req = (*p)->u.scan_request; - xmlNodePtr ptr = xmlNewChild(pptr, 0, "scanRequest", 0); - ns_srw = xmlNewNs(ptr, ns, "zs"); + xmlNodePtr ptr = xmlNewChild(pptr, 0, BAD_CAST "scanRequest", 0); + ns_srw = xmlNewNs(ptr, BAD_CAST ns, BAD_CAST "zs"); xmlSetNs(ptr, ns_srw); add_xsd_string(ptr, "version", (*p)->srw_version); @@ -813,21 +821,22 @@ int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data, else if ((*p)->which == Z_SRW_scan_response) { Z_SRW_scanResponse *res = (*p)->u.scan_response; - xmlNodePtr ptr = xmlNewChild(pptr, 0, "scanResponse", 0); - ns_srw = xmlNewNs(ptr, ns, "zs"); + xmlNodePtr ptr = xmlNewChild(pptr, 0, BAD_CAST "scanResponse", 0); + ns_srw = xmlNewNs(ptr, BAD_CAST ns, BAD_CAST "zs"); xmlSetNs(ptr, ns_srw); add_xsd_string(ptr, "version", (*p)->srw_version); if (res->num_terms) { - xmlNodePtr rptr = xmlNewChild(ptr, 0, "terms", 0); + xmlNodePtr rptr = xmlNewChild(ptr, 0, BAD_CAST "terms", 0); yaz_srw_terms(o, rptr, &res->terms, &res->num_terms, client_data, ns); } if (res->num_diagnostics) { - xmlNodePtr rptr = xmlNewChild(ptr, 0, "diagnostics", 0); + xmlNodePtr rptr = xmlNewChild(ptr, 0, BAD_CAST "diagnostics", + 0); yaz_srw_diagnostics(o, rptr, &res->diagnostics, &res->num_diagnostics, client_data, ns); } diff --git a/src/srwutil.c b/src/srwutil.c index 168d7b5..b2fc44d 100644 --- a/src/srwutil.c +++ b/src/srwutil.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2005, Index Data ApS * See the file LICENSE for details. * - * $Id: srwutil.c,v 1.28 2005-06-25 15:46:05 adam Exp $ + * $Id: srwutil.c,v 1.29 2005-08-22 20:34:21 adam Exp $ */ /** * \file srwutil.c @@ -251,7 +251,8 @@ int yaz_sru_decode(Z_HTTP_Request *hreq, Z_SRW_PDU **srw_pdu, {0, 0, 0} }; #endif - if (!strcmp(hreq->method, "GET")) + if (!strcmp(hreq->method, "GET") || + !strcmp(hreq->method, "POST") ) { char *db = "Default"; const char *p0 = hreq->path, *p1; @@ -289,6 +290,8 @@ int yaz_sru_decode(Z_HTTP_Request *hreq, Z_SRW_PDU **srw_pdu, memcpy (db, p0, p1 - p0); db[p1 - p0] = '\0'; } + if (!strcmp(hreq->method, "POST")) + p1 = hreq->content_buf; yaz_uri_array(p1, decode, &uri_name, &uri_val); #if HAVE_XML2 if (uri_name) diff --git a/src/statserv.c b/src/statserv.c index 968141c..95643f4 100644 --- a/src/statserv.c +++ b/src/statserv.c @@ -5,7 +5,7 @@ * NT threaded server code by * Chas Woodfield, Fretwell Downing Informatics. * - * $Id: statserv.c,v 1.31 2005-06-25 15:46:05 adam Exp $ + * $Id: statserv.c,v 1.32 2005-08-22 20:34:21 adam Exp $ */ /** @@ -173,13 +173,13 @@ static char *nmem_dup_xml_content(NMEM n, xmlNodePtr ptr) unsigned char *cp; xmlNodePtr p; int len = 1; /* start with 1, because of trailing 0 */ - char *str; + unsigned char *str; int first = 1; /* whitespace lead flag .. */ /* determine length */ for (p = ptr; p; p = p->next) { if (p->type == XML_TEXT_NODE) - len += strlen(p->content); + len += xmlStrlen(p->content); } /* now allocate for the string */ str = nmem_malloc(n, len); @@ -196,16 +196,16 @@ static char *nmem_dup_xml_content(NMEM n, xmlNodePtr ptr) if (*cp) first = 0; /* reset if we got non-whitespace out */ } - strcat(str, cp); /* append */ + strcat((char *)str, (const char *)cp); /* append */ } } /* remove trailing whitespace */ - cp = strlen(str) + str; - while ((char*) cp != str && isspace(cp[-1])) + cp = strlen((const char *)str) + str; + while (cp != str && isspace(cp[-1])) cp--; *cp = '\0'; /* return resulting string */ - return str; + return (char *) str; } #endif @@ -340,7 +340,7 @@ static void xml_config_read() const char *address = nmem_dup_xml_content(gfs_nmem, ptr->children); for ( ; attr; attr = attr->next) - if (!strcmp(attr->name, "id") + if (!xmlStrcmp(attr->name, BAD_CAST "id") && attr->children && attr->children->type == XML_TEXT_NODE) id = nmem_dup_xml_content(gfs_nmem, attr->children); if (address) @@ -358,11 +358,12 @@ static void xml_config_read() const char *id = 0; for ( ; attr; attr = attr->next) - if (!strcmp(attr->name, "listenref") && attr->children && - attr->children->type == XML_TEXT_NODE) + if (!xmlStrcmp(attr->name, BAD_CAST "listenref") + && attr->children && attr->children->type == XML_TEXT_NODE) listenref = nmem_dup_xml_content(gfs_nmem, attr->children); - else if (!strcmp(attr->name, "id") && attr->children && - attr->children->type == XML_TEXT_NODE) + else if (!xmlStrcmp(attr->name, BAD_CAST "id") + && attr->children + && attr->children->type == XML_TEXT_NODE) id = nmem_dup_xml_content(gfs_nmem, attr->children); else yaz_log(YLOG_WARN, "Unknown attribute '%s' for server", diff --git a/test/tsticonv.c b/test/tsticonv.c index b7e9704..c4e75d7 100644 --- a/test/tsticonv.c +++ b/test/tsticonv.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2005, Index Data ApS * See the file LICENSE for details. * - * $Id: tsticonv.c,v 1.10 2005-06-25 15:46:07 adam Exp $ + * $Id: tsticonv.c,v 1.11 2005-08-22 20:34:23 adam Exp $ */ #if HAVE_CONFIG_H @@ -17,8 +17,8 @@ #include static int compare_buffers(char *msg, int no, - int expect_len, const unsigned char *expect_buf, - int got_len, const unsigned char *got_buf) + int expect_len, const char *expect_buf, + int got_len, const char *got_buf) { int i; if (expect_len == got_len @@ -108,9 +108,9 @@ static void tst_marc8_to_iso_8859_1() static void tst_marc8_to_ucs4b() { static struct { - const unsigned char *marc8_b; + const char *marc8_b; int len; - const unsigned char *ucs4_b; + const char *ucs4_b; } ar[] = { { "\033$1" "\x21\x2B\x3B" /* FF1F */ "\033(B" "o", diff --git a/test/tstodr.c b/test/tstodr.c index 33d366b..1106c90 100644 --- a/test/tstodr.c +++ b/test/tstodr.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2005, Index Data ApS * See the file LICENSE for details. * - * $Id: tstodr.c,v 1.6 2005-06-25 15:46:07 adam Exp $ + * $Id: tstodr.c,v 1.7 2005-08-22 20:34:23 adam Exp $ * */ #include @@ -22,7 +22,7 @@ void tst_MySequence1(ODR encode, ODR decode) s->first = odr_intdup(encode, 12345); s->second = odr_malloc(encode, sizeof(*s->second)); - s->second->buf = "hello"; + s->second->buf = (unsigned char *) "hello"; s->second->len = 5; s->second->size = 0; s->third = odr_intdup(encode, 1); @@ -71,7 +71,7 @@ void tst_MySequence2(ODR encode, ODR decode) s->first = 0; /* deliberately miss this .. */ s->second = odr_malloc(encode, sizeof(*s->second)); - s->second->buf = "hello"; + s->second->buf = (unsigned char *) "hello"; s->second->len = 5; s->second->size = 0; s->third = odr_intdup(encode, 1); diff --git a/test/tstsoap1.c b/test/tstsoap1.c index 5018678..6e6833a 100644 --- a/test/tstsoap1.c +++ b/test/tstsoap1.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2005, Index Data ApS * See the file LICENSE for details. * - * $Id: tstsoap1.c,v 1.3 2005-06-25 15:46:07 adam Exp $ + * $Id: tstsoap1.c,v 1.4 2005-08-22 20:34:23 adam Exp $ */ #include @@ -19,15 +19,15 @@ int main(int argc, char **argv) { xmlChar *buf_out; int len_out; - xmlDocPtr doc = xmlNewDoc("1.0"); + xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0"); #if 0 const char *val = "jordbær"; /* makes xmlDocDumpMemory hang .. */ #else const char *val = "jordbaer"; /* OK */ #endif - xmlNodePtr top = xmlNewNode(0, "top"); + xmlNodePtr top = xmlNewNode(0, BAD_CAST "top"); - xmlNewTextChild(top, 0, "sub", val); + xmlNewTextChild(top, 0, BAD_CAST "sub", BAD_CAST val); xmlDocSetRootElement(doc, top); xmlDocDumpMemory(doc, &buf_out, &len_out); diff --git a/util/marcdump.c b/util/marcdump.c index 0c38835..8b082a3 100644 --- a/util/marcdump.c +++ b/util/marcdump.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2005, Index Data ApS * See the file LICENSE for details. * - * $Id: marcdump.c,v 1.32 2005-06-25 15:46:07 adam Exp $ + * $Id: marcdump.c,v 1.33 2005-08-22 20:34:23 adam Exp $ */ #define _FILE_OFFSET_BITS 64 @@ -269,7 +269,7 @@ int main (int argc, char **argv) xpathCtx = xmlXPathNewContext(doc); for (i = 0; xpathExpr[i]; i++) { - xpathObj = xmlXPathEvalExpression(xpathExpr[i], xpathCtx); + xpathObj = xmlXPathEvalExpression(BAD_CAST xpathExpr[i], xpathCtx); if(xpathObj == NULL) { fprintf(stderr,"Error: unable to evaluate xpath expression \"%s\"\n", xpathExpr[i]); }