From: Adam Dickmeiss Date: Sat, 2 Oct 2004 13:28:26 +0000 (+0000) Subject: Added several type casts for C++ compile X-Git-Tag: YAZ.2.0.28~39 X-Git-Url: http://sru.miketaylor.org.uk/?a=commitdiff_plain;h=dd7de5f04a0de631f98ad9c4774f2111a85388e5;p=yaz-moved-to-github.git Added several type casts for C++ compile --- diff --git a/src/cclqfile.c b/src/cclqfile.c index 0a618cb..1c53725 100644 --- a/src/cclqfile.c +++ b/src/cclqfile.c @@ -44,7 +44,7 @@ /* CCL qualifiers * Europagate, 1995 * - * $Id: cclqfile.c,v 1.4 2004-09-29 20:37:50 adam Exp $ + * $Id: cclqfile.c,v 1.5 2004-10-02 13:28:26 adam Exp $ * * Old Europagate Log: * @@ -188,7 +188,7 @@ void ccl_qual_field (CCL_bibset bibset, const char *cp, const char *qual_name) len = split - qual_value; else len = strlen(qual_value); - svalue_ar[pair_no] = xmalloc(len+1); + svalue_ar[pair_no] = (char *) xmalloc(len+1); memcpy(svalue_ar[pair_no], qual_value, len); svalue_ar[pair_no][len] = '\0'; } diff --git a/src/ccltoken.c b/src/ccltoken.c index 06ff2a7..11273b3 100644 --- a/src/ccltoken.c +++ b/src/ccltoken.c @@ -44,7 +44,7 @@ /* CCL - lexical analysis * Europagate, 1995 * - * $Id: ccltoken.c,v 1.3 2004-09-29 20:37:50 adam Exp $ + * $Id: ccltoken.c,v 1.4 2004-10-02 13:28:26 adam Exp $ * * Old Europagate Log: * @@ -201,7 +201,7 @@ struct ccl_token *ccl_token_simple (const char *command) struct ccl_token *ccl_parser_tokenize (CCL_parser cclp, const char *command) { const char *aliases; - const unsigned char *cp = command; + const unsigned char *cp = (const unsigned char *) command; struct ccl_token *first = NULL; struct ccl_token *last = NULL; @@ -226,7 +226,7 @@ struct ccl_token *ccl_parser_tokenize (CCL_parser cclp, const char *command) last = last->next; } last->next = NULL; - last->name = cp; + last->name = (const char *) cp; last->len = 1; switch (*cp++) { @@ -267,7 +267,7 @@ struct ccl_token *ccl_parser_tokenize (CCL_parser cclp, const char *command) break; case '\"': last->kind = CCL_TOK_TERM; - last->name = cp; + last->name = (const char *) cp; last->len = 0; while (*cp && *cp != '\"') { diff --git a/src/cql.y b/src/cql.y index 8b3d3ee..91dbf7c 100644 --- a/src/cql.y +++ b/src/cql.y @@ -1,4 +1,4 @@ -/* $Id: cql.y,v 1.4 2004-03-17 18:31:11 adam Exp $ +/* $Id: cql.y,v 1.5 2004-10-02 13:28:26 adam Exp $ Copyright (C) 2002-2004 Index Data Aps @@ -187,7 +187,8 @@ static void putb(YYSTYPE *lval, CQL_parser cp, int c) { if (lval->len+1 >= lval->size) { - char *nb = nmem_malloc(cp->nmem, (lval->size = lval->len * 2 + 20)); + char *nb = (char *) + nmem_malloc(cp->nmem, (lval->size = lval->len * 2 + 20)); memcpy (nb, lval->buf, lval->len); lval->buf = nb; } @@ -205,7 +206,7 @@ int yylex(YYSTYPE *lval, void *vp) lval->rel = 0; lval->len = 0; lval->size = 10; - lval->buf = nmem_malloc(cp->nmem, lval->size); + lval->buf = (char *) nmem_malloc(cp->nmem, lval->size); lval->buf[0] = '\0'; do { diff --git a/src/cqltransform.c b/src/cqltransform.c index 00305f7..6ceeb63 100644 --- a/src/cqltransform.c +++ b/src/cqltransform.c @@ -1,4 +1,4 @@ -/* $Id: cqltransform.c,v 1.9 2004-05-25 14:06:15 adam Exp $ +/* $Id: cqltransform.c,v 1.10 2004-10-02 13:28:26 adam Exp $ Copyright (C) 2002-2004 Index Data Aps @@ -208,14 +208,14 @@ int cql_pr_attr(cql_transform_t ct, const char *category, * characters starting at `term', or a null pointer of there are * none -- like memchr(). */ -static char *wcchar(const char *term, int length) +static const char *wcchar(const char *term, int length) { - char *best = 0; - char *current; + const char *best = 0; + const char *current; char *whichp; for (whichp = "*?"; *whichp != '\0'; whichp++) { - current = memchr(term, *whichp, length); + current = (const char *) memchr(term, *whichp, length); if (current != 0 && (best == 0 || current < best)) best = current; } @@ -302,7 +302,7 @@ void emit_term(cql_transform_t ct, char *mem; cql_pr_attr(ct, "truncation", "z3958", 0, pr, client_data, 28); - mem = xmalloc(length+1); + mem = (char *) xmalloc(length+1); for (i = 0; i < length; i++) { if (term[i] == '*') mem[i] = '?'; else if (term[i] == '?') mem[i] = '#'; diff --git a/src/odr.c b/src/odr.c index 65ad86d..ea7a7f3 100644 --- a/src/odr.c +++ b/src/odr.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2004, Index Data * See the file LICENSE for details. * - * $Id: odr.c,v 1.6 2004-10-01 13:16:18 adam Exp $ + * $Id: odr.c,v 1.7 2004-10-02 13:28:26 adam Exp $ * */ #if HAVE_CONFIG_H @@ -145,7 +145,7 @@ void odr_set_stream(ODR o, void *handle, const char *buf, int len), void (*stream_close)(void *handle)) { - o->print = handle; + o->print = (FILE*) handle; o->op->stream_write = stream_write; o->op->stream_close = stream_close; } diff --git a/src/odr_oct.c b/src/odr_oct.c index 27b5927..a3bd2a4 100644 --- a/src/odr_oct.c +++ b/src/odr_oct.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2004, Index Data * See the file LICENSE for details. * - * $Id: odr_oct.c,v 1.4 2004-08-13 08:59:07 adam Exp $ + * $Id: odr_oct.c,v 1.5 2004-10-02 13:28:26 adam Exp $ */ #if HAVE_CONFIG_H #include @@ -36,7 +36,7 @@ int odr_octetstring(ODR o, Odr_oct **p, int opt, const char *name) odr_printf(o, "OCTETSTRING(len=%d) ", (*p)->len); o->op->stream_write(o, o->print, ODR_OCTETSTRING, - (*p)->buf, (*p)->len); + (char*) (*p)->buf, (*p)->len); odr_printf(o, "\n"); return 1; } diff --git a/src/soap.c b/src/soap.c index 5eb176f..d2f38f8 100644 --- a/src/soap.c +++ b/src/soap.c @@ -2,7 +2,7 @@ * Copyright (c) 2002-2004, Index Data. * See the file LICENSE for details. * - * $Id: soap.c,v 1.7 2004-01-14 00:15:56 adam Exp $ + * $Id: soap.c,v 1.8 2004-10-02 13:28:26 adam Exp $ */ #include @@ -109,7 +109,7 @@ int z_soap_codec_enc_xsl(ODR o, Z_SOAP **pp, ptr = ptr->children; p->which = Z_SOAP_fault; - p->u.fault = odr_malloc(o, sizeof(*p->u.fault)); + p->u.fault = (Z_SOAP_Fault *) odr_malloc(o, sizeof(*p->u.fault)); p->u.fault->fault_code = 0; p->u.fault->fault_string = 0; p->u.fault->details = 0; @@ -148,7 +148,8 @@ int z_soap_codec_enc_xsl(ODR o, Z_SOAP **pp, else { p->which = Z_SOAP_generic; - p->u.generic = odr_malloc(o, sizeof(*p->u.generic)); + p->u.generic = (Z_SOAP_Generic *) + odr_malloc(o, sizeof(*p->u.generic)); p->u.generic->no = i; p->u.generic->ns = handlers[i].ns; p->u.generic->p = handler_data; diff --git a/src/srw.c b/src/srw.c index 10b9b69..afba33b 100644 --- a/src/srw.c +++ b/src/srw.c @@ -2,7 +2,7 @@ * Copyright (c) 2002-2004, Index Data. * See the file LICENSE for details. * - * $Id: srw.c,v 1.25 2004-03-17 18:43:35 adam Exp $ + * $Id: srw.c,v 1.26 2004-10-02 13:28:26 adam Exp $ */ #include @@ -243,7 +243,7 @@ static int yaz_srw_records(ODR o, xmlNodePtr pptr, Z_SRW_record **recs, } if (!*num) return 1; - *recs = odr_malloc(o, *num * sizeof(**recs)); + *recs = (Z_SRW_record *) odr_malloc(o, *num * sizeof(**recs)); for (i = 0, ptr = pptr->children; ptr; ptr = ptr->next) { if (ptr->type == XML_ELEMENT_NODE && @@ -282,7 +282,7 @@ static int yaz_srw_diagnostics(ODR o, xmlNodePtr pptr, Z_SRW_diagnostic **recs, } if (!*num) return 1; - *recs = odr_malloc(o, *num * sizeof(**recs)); + *recs = (Z_SRW_diagnostic *) odr_malloc(o, *num * sizeof(**recs)); for (i = 0; i < *num; i++) { (*recs)[i].uri = 0; @@ -387,7 +387,7 @@ static int yaz_srw_terms(ODR o, xmlNodePtr pptr, Z_SRW_scanTerm **terms, } if (!*num) return 1; - *terms = odr_malloc(o, *num * sizeof(**terms)); + *terms = (Z_SRW_scanTerm *) odr_malloc(o, *num * sizeof(**terms)); for (i = 0, ptr = pptr->children; ptr; ptr = ptr->next, i++) { if (ptr->type == XML_ELEMENT_NODE && @@ -410,7 +410,7 @@ static int yaz_srw_terms(ODR o, xmlNodePtr pptr, Z_SRW_scanTerm **terms, int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data, void *client_data, const char *ns) { - xmlNodePtr pptr = vptr; + xmlNodePtr pptr = (xmlNodePtr) vptr; if (o->direction == ODR_DECODE) { Z_SRW_PDU **p = handler_data; @@ -424,7 +424,7 @@ int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data, if (method->type != XML_ELEMENT_NODE) return -1; - *p = odr_malloc(o, sizeof(**p)); + *p = (Z_SRW_PDU *) odr_malloc(o, sizeof(**p)); (*p)->srw_version = odr_strdup(o, "1.1"); if (!strcmp(method->name, "searchRetrieveRequest")) @@ -433,7 +433,8 @@ int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data, Z_SRW_searchRetrieveRequest *req; (*p)->which = Z_SRW_searchRetrieve_request; - req = (*p)->u.request = odr_malloc(o, sizeof(*req)); + req = (*p)->u.request = (Z_SRW_searchRetrieveRequest *) + odr_malloc(o, sizeof(*req)); req->query_type = Z_SRW_query_type_cql; req->query.cql = 0; req->sort_type = Z_SRW_sort_type_none; @@ -497,7 +498,8 @@ int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data, Z_SRW_searchRetrieveResponse *res; (*p)->which = Z_SRW_searchRetrieve_response; - res = (*p)->u.response = odr_malloc(o, sizeof(*res)); + res = (*p)->u.response = (Z_SRW_searchRetrieveResponse *) + odr_malloc(o, sizeof(*res)); res->numberOfRecords = 0; res->resultSetId = 0; @@ -541,7 +543,8 @@ int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data, xmlNodePtr ptr = method->children; (*p)->which = Z_SRW_explain_request; - req = (*p)->u.explain_request = odr_malloc(o, sizeof(*req)); + req = (*p)->u.explain_request = (Z_SRW_explainRequest *) + odr_malloc(o, sizeof(*req)); req->recordPacking = 0; req->database = 0; req->stylesheet = 0; @@ -567,7 +570,8 @@ int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data, xmlNodePtr ptr = method->children; (*p)->which = Z_SRW_explain_response; - res = (*p)->u.explain_response = odr_malloc(o, sizeof(*res)); + res = (*p)->u.explain_response = (Z_SRW_explainResponse*) + odr_malloc(o, sizeof(*res)); res->diagnostics = 0; res->num_diagnostics = 0; @@ -591,7 +595,8 @@ int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data, xmlNodePtr ptr = method->children; (*p)->which = Z_SRW_scan_request; - req = (*p)->u.scan_request = odr_malloc(o, sizeof(*req)); + req = (*p)->u.scan_request = (Z_SRW_scanRequest *) + odr_malloc(o, sizeof(*req)); req->database = 0; req->scanClause = 0; req->stylesheet = 0; @@ -626,7 +631,8 @@ int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data, xmlNodePtr ptr = method->children; (*p)->which = Z_SRW_scan_response; - res = (*p)->u.scan_response = odr_malloc(o, sizeof(*res)); + res = (*p)->u.scan_response = (Z_SRW_scanResponse *) + odr_malloc(o, sizeof(*res)); res->terms = 0; res->num_terms = 0; res->diagnostics = 0; diff --git a/src/srwutil.c b/src/srwutil.c index 47af178..513ae89 100644 --- a/src/srwutil.c +++ b/src/srwutil.c @@ -2,7 +2,7 @@ * Copyright (c) 2002-2004, Index Data. * See the file LICENSE for details. * - * $Id: srwutil.c,v 1.15 2004-03-24 10:14:24 adam Exp $ + * $Id: srwutil.c,v 1.16 2004-10-02 13:28:26 adam Exp $ */ #include @@ -98,7 +98,7 @@ char *yaz_uri_val(const char *path, const char *name, ODR o) p1 = strchr(path, '&'); if (!p1) p1 = strlen(path) + path; - ret = odr_malloc(o, p1 - path + 1); + ret = (char *) odr_malloc(o, p1 - path + 1); while (*path && *path != '&') { if (*path == '+') @@ -460,7 +460,7 @@ int yaz_sru_decode(Z_HTTP_Request *hreq, Z_SRW_PDU **srw_pdu, Z_SRW_PDU *yaz_srw_get(ODR o, int which) { - Z_SRW_PDU *sr = odr_malloc(o, sizeof(*o)); + Z_SRW_PDU *sr = (Z_SRW_PDU *) odr_malloc(o, sizeof(*o)); sr->srw_version = odr_strdup(o, "1.1"); sr->which = which; diff --git a/src/zoom-c.c b/src/zoom-c.c index 38846b0..2b51aa1 100644 --- a/src/zoom-c.c +++ b/src/zoom-c.c @@ -2,7 +2,7 @@ * Copyright (c) 2000-2004, Index Data * See the file LICENSE for details. * - * $Id: zoom-c.c,v 1.29 2004-08-02 10:06:34 adam Exp $ + * $Id: zoom-c.c,v 1.30 2004-10-02 13:28:26 adam Exp $ * * ZOOM layer for C, connections, result sets, queries. */ @@ -104,7 +104,7 @@ static void set_dset_error (ZOOM_connection c, int error, } if (addinfo && addinfo2) { - c->addinfo = xmalloc(strlen(addinfo) + strlen(addinfo2) + 2); + c->addinfo = (char*) xmalloc(strlen(addinfo) + strlen(addinfo2) + 2); strcpy(c->addinfo, addinfo); strcat(c->addinfo, addinfo2); } @@ -819,7 +819,7 @@ static zoom_ret do_connect (ZOOM_connection c) c->proto = PROTO_HTTP; cs_get_host_args(c->host_port, &path); xfree(c->path); - c->path = xmalloc(strlen(path)+2); + c->path = (char*) xmalloc(strlen(path)+2); c->path[0] = '/'; strcpy (c->path+1, path); #else @@ -1001,7 +1001,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.29 $"); + version = odr_strdup(c->odr_out, "$Revision: 1.30 $"); if (strlen(version) > 10) /* check for unexpanded CVS strings */ version[strlen(version)-2] = '\0'; ireq->implementationVersion = odr_prepend(c->odr_out, @@ -1092,7 +1092,7 @@ static zoom_ret send_srw (ZOOM_connection c, Z_SRW_PDU *sr) }; ODR o = odr_createmem(ODR_ENCODE); int ret; - Z_SOAP *p = odr_malloc(o, sizeof(*p)); + Z_SOAP *p = (Z_SOAP*) odr_malloc(o, sizeof(*p)); Z_GDU *gdu; ZOOM_Event event; @@ -1114,7 +1114,7 @@ static zoom_ret send_srw (ZOOM_connection c, Z_SRW_PDU *sr) if (cp0 && cp1) { - char *h = odr_malloc(c->odr_out, cp1 - cp0 + 1); + char *h = (char*) odr_malloc(c->odr_out, cp1 - cp0 + 1); memcpy (h, cp0, cp1 - cp0); h[cp1-cp0] = '\0'; z_HTTP_header_add(c->odr_out, &gdu->u.HTTP_Request->headers, @@ -1133,7 +1133,7 @@ static zoom_ret send_srw (ZOOM_connection c, Z_SRW_PDU *sr) z_HTTP_header_add(c->odr_out, &gdu->u.HTTP_Request->headers, "SOAPAction", "\"\""); p->which = Z_SOAP_generic; - p->u.generic = odr_malloc(o, sizeof(*p->u.generic)); + p->u.generic = (Z_SOAP_Generic *) odr_malloc(o, sizeof(*p->u.generic)); p->u.generic->no = 0; p->u.generic->ns = 0; p->u.generic->p = sr; @@ -1665,7 +1665,8 @@ ZOOM_record_get (ZOOM_record rec, const char *type_spec, int *len) } if (r->which == Z_External_sutrs) return record_iconv_return(rec, len, - r->u.sutrs->buf, r->u.sutrs->len, + (char*) r->u.sutrs->buf, + r->u.sutrs->len, charset); else if (r->which == Z_External_octet) { @@ -2613,7 +2614,7 @@ static Z_APDU *create_update_package(ZOOM_package p) odr_malloc (p->odr_out, sizeof(Odr_oct)); notToKeep->elements[0]->u.opaque->size = notToKeep->elements[0]->u.opaque->len = strlen(recordIdOpaque); - notToKeep->elements[0]->u.opaque->buf = + notToKeep->elements[0]->u.opaque->buf = (unsigned char*) odr_strdup(p->odr_out, recordIdOpaque); } else if (recordIdNumber) @@ -3030,7 +3031,7 @@ static void handle_srw_response(ZOOM_connection c, npr->u.databaseRecord->which = Z_External_octet; npr->u.databaseRecord->u.octet_aligned = (Odr_oct *) odr_malloc(c->odr_in, sizeof(Odr_oct)); - npr->u.databaseRecord->u.octet_aligned->buf = + npr->u.databaseRecord->u.octet_aligned->buf = (unsigned char*) res->records[i].recordData_buf; npr->u.databaseRecord->u.octet_aligned->len = npr->u.databaseRecord->u.octet_aligned->size = @@ -3082,7 +3083,7 @@ static void handle_http(ZOOM_connection c, Z_HTTP_Response *hres) if (!ret && soap_package->which == Z_SOAP_generic && soap_package->u.generic->no == 0) { - Z_SRW_PDU *sr = soap_package->u.generic->p; + Z_SRW_PDU *sr = (Z_SRW_PDU*) soap_package->u.generic->p; if (sr->which == Z_SRW_searchRetrieve_response) handle_srw_response(c, sr->u.response); else