xmlStrcmp, xmlStrlen in a few places instead of strcmp/strlen.
* 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 <stdio.h>
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
/* 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:
*
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;
* 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 $
*/
/**
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:
* 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
wrbuf_puts (wrbuf, " <bibliographicRecord>\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, " </bibliographicRecord>\n");
}
wrbuf_puts (wrbuf, " <marcHoldingsRecord>\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, " </marcHoldingsRecord>\n");
}
* 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
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;
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,
* 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
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",
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))
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)
}
/* 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",
"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;
{
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;
}
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)
{
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);
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)
{
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)
* 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
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);
{
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;
}
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;
}
{
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;
}
*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;
}
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;
}
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)
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++;
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);
}
}
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)
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;
{
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);
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)
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);
}
}
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);
}
}
*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;
/* 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;
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;
;
}
}
- else if (!strcmp(method->name, "explainResponse"))
+ else if (!xmlStrcmp(method->name, BAD_CAST "explainResponse"))
{
Z_SRW_explainResponse *res;
xmlNodePtr ptr = method->children;
;
}
}
- else if (!strcmp(method->name, "scanRequest"))
+ else if (!xmlStrcmp(method->name, BAD_CAST "scanRequest"))
{
Z_SRW_scanRequest *req;
xmlNodePtr ptr = method->children;
;
}
}
- else if (!strcmp(method->name, "scanResponse"))
+ else if (!xmlStrcmp(method->name, BAD_CAST "scanResponse"))
{
Z_SRW_scanResponse *res;
xmlNodePtr ptr = method->children;
{
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)
{
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)
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);
}
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);
}
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);
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);
}
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);
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);
}
* 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
{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;
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)
* 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 $
*/
/**
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);
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
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)
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",
* 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
#include <yaz/yaz-util.h>
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
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",
* 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 <stdlib.h>
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);
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);
* 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 <stdlib.h>
{
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);
* 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
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]);
}