From: Adam Dickmeiss Date: Sun, 6 May 2007 20:12:19 +0000 (+0000) Subject: Code updates which makes things compile as C++. Mostly type casts were X-Git-Tag: YAZ.3.0.2~13 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=fe507b6b15788a3a8e58063d9dae52532a5229a5;p=yaz-moved-to-github.git Code updates which makes things compile as C++. Mostly type casts were added. But the exercise also revealed places where YAZ_BEGIN_CDEC was omitted. --- diff --git a/client/client.c b/client/client.c index a6b7865..20697e3 100644 --- a/client/client.c +++ b/client/client.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: client.c,v 1.336 2007-05-03 08:04:10 adam Exp $ + * $Id: client.c,v 1.337 2007-05-06 20:12:19 adam Exp $ */ /** \file client.c * \brief yaz-client program @@ -173,7 +173,7 @@ int rl_attempted_completion_over = 0; #define AVOID_MARC_DECODE 1 #define maxOtherInfosSupported 10 -struct { +struct eoi { int oid[OID_SIZE]; char* value; } extraOtherInfos[maxOtherInfosSupported]; @@ -624,7 +624,7 @@ static int parse_cmd_doc(const char **arg, ODR out, char **buf, return 0; } *len = fsize; - *buf = odr_malloc(out, fsize); + *buf = (char *) odr_malloc(out, fsize); if (fread(*buf, 1, fsize, inf) != fsize) { printf("Unable to read %s\n", fname); @@ -1260,7 +1260,7 @@ static int send_srw(Z_SRW_PDU *sr) Z_GDU *gdu; char *path = 0; - path = odr_malloc(out, 2+strlen(databaseNames[0])); + path = (char *) odr_malloc(out, 2+strlen(databaseNames[0])); *path = '/'; strcpy(path+1, databaseNames[0]); @@ -3728,7 +3728,8 @@ static void initialize(void) /* If this fails, no problem: we detect cqltrans == 0 later */ #if HAVE_READLINE_READLINE_H - rl_attempted_completion_function = (CPPFunction*)readline_completer; + rl_attempted_completion_function = + (char **(*)(const char *, int, int)) readline_completer; #endif for(i = 0; i < maxOtherInfosSupported; ++i) { extraOtherInfos[i].oid[0] = -1; @@ -3863,7 +3864,7 @@ static void http_response(Z_HTTP_Response *hres) soap_handlers); if (!ret && soap_package->which == Z_SOAP_generic) { - 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(sr->u.response); else if (sr->which == Z_SRW_explain_response) diff --git a/client/fhistory.c b/client/fhistory.c index 7fb5f3f..0094fd0 100644 --- a/client/fhistory.c +++ b/client/fhistory.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: fhistory.c,v 1.3 2007-03-19 22:17:41 adam Exp $ + * $Id: fhistory.c,v 1.4 2007-05-06 20:12:19 adam Exp $ */ /** \file fhistory.c * \brief file history implementation @@ -26,7 +26,7 @@ struct file_history { file_history_t file_history_new() { - file_history_t fh = xmalloc(sizeof(*fh)); + file_history_t fh = (file_history_t) xmalloc(sizeof(*fh)); fh->wr = wrbuf_alloc(); return fh; } diff --git a/include/yaz/oid_db.h b/include/yaz/oid_db.h index ca75db7..73e765a 100644 --- a/include/yaz/oid_db.h +++ b/include/yaz/oid_db.h @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* $Id: oid_db.h,v 1.5 2007-04-16 21:53:08 adam Exp $ */ +/* $Id: oid_db.h,v 1.6 2007-05-06 20:12:20 adam Exp $ */ /** * \file oid_db.h @@ -142,12 +142,12 @@ struct yaz_oid_entry { char *name; }; +YAZ_END_CDECL + #define Z3950_PREFIX 1, 2, 840, 10003 #include -YAZ_END_CDECL - #endif /* * Local variables: diff --git a/include/yaz/xmlquery.h b/include/yaz/xmlquery.h index fc6e7db..67abce0 100644 --- a/include/yaz/xmlquery.h +++ b/include/yaz/xmlquery.h @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* $Id: xmlquery.h,v 1.9 2007-01-03 08:42:14 adam Exp $ */ +/* $Id: xmlquery.h,v 1.10 2007-05-06 20:12:20 adam Exp $ */ /** \file xmlquery.h \brief Query / XML conversions @@ -42,8 +42,8 @@ YAZ_BEGIN_CDECL YAZ_EXPORT void yaz_query2xml(const Z_Query *q, xmlDocPtr *docp); YAZ_EXPORT void yaz_rpnquery2xml(const Z_RPNQuery *rpn, xmlDocPtr *docp); -YAZ_EXPORT void yaz_xml2query(const void *xmlnodep, Z_Query **query, ODR odr, - int *error_code, const char **addinfo); +YAZ_EXPORT void yaz_xml2query(const xmlNode *xmlnodep, Z_Query **query, + ODR odr, int *error_code, const char **addinfo); YAZ_END_CDECL diff --git a/src/ccl_stop_words.c b/src/ccl_stop_words.c index 6a36e92..1a67411 100644 --- a/src/ccl_stop_words.c +++ b/src/ccl_stop_words.c @@ -69,14 +69,15 @@ static void append_removed_item(ccl_stop_words_t csw, const char *qname, const char *t, size_t len) { - struct ccl_stop_info *csi = nmem_malloc(csw->nmem, sizeof(*csi)); + struct ccl_stop_info *csi = (struct ccl_stop_info *) + nmem_malloc(csw->nmem, sizeof(*csi)); struct ccl_stop_info **csip = &csw->removed_items; if (qname) csi->qualname = nmem_strdup(csw->nmem, qname); else csi->qualname = 0; - csi->term = nmem_malloc(csw->nmem, len+1); + csi->term = (char *) nmem_malloc(csw->nmem, len+1); memcpy(csi->term, t, len); csi->term[len] = '\0'; csi->next = 0; @@ -90,7 +91,7 @@ static void append_removed_item(ccl_stop_words_t csw, ccl_stop_words_t ccl_stop_words_create(void) { NMEM nmem = nmem_create(); - ccl_stop_words_t csw = xmalloc(sizeof(*csw)); + ccl_stop_words_t csw = (ccl_stop_words_t) xmalloc(sizeof(*csw)); csw->nmem = nmem; csw->removed_items = 0; csw->blank_chars = xstrdup(" \r\n\t"); diff --git a/src/cclqual.c b/src/cclqual.c index a62ebb1..f771013 100644 --- a/src/cclqual.c +++ b/src/cclqual.c @@ -48,7 +48,7 @@ /* CCL qualifiers * Europagate, 1995 * - * $Id: cclqual.c,v 1.11 2007-05-01 12:54:44 adam Exp $ + * $Id: cclqual.c,v 1.12 2007-05-06 20:12:20 adam Exp $ * * Old Europagate Log: * @@ -153,7 +153,7 @@ void ccl_qual_add_special_ar(CCL_bibset bibset, const char *n, void ccl_qual_add_special(CCL_bibset bibset, const char *n, const char *cp) { size_t no = 2; - char **vlist = xmalloc(no * sizeof(*vlist)); + char **vlist = (char **) xmalloc(no * sizeof(*vlist)); yaz_tok_cfg_t yt = yaz_tok_cfg_create(); int t; size_t i = 0; @@ -166,7 +166,7 @@ void ccl_qual_add_special(CCL_bibset bibset, const char *n, const char *cp) while (t == YAZ_TOK_STRING) { if (i >= no-1) - vlist = xrealloc(vlist, (no = no * 2) * sizeof(*vlist)); + vlist = (char **) xrealloc(vlist, (no = no * 2) * sizeof(*vlist)); vlist[i++] = xstrdup(yaz_tok_parse_string(tp)); t = yaz_tok_move(tp); } diff --git a/src/ccltoken.c b/src/ccltoken.c index e4e2b5c..edf5d34 100644 --- a/src/ccltoken.c +++ b/src/ccltoken.c @@ -48,7 +48,7 @@ /* CCL - lexical analysis * Europagate, 1995 * - * $Id: ccltoken.c,v 1.13 2007-05-01 12:54:44 adam Exp $ + * $Id: ccltoken.c,v 1.14 2007-05-06 20:12:20 adam Exp $ * * Old Europagate Log: * @@ -288,7 +288,7 @@ void ccl_token_del(struct ccl_token *list) static const char **create_ar(const char *v1, const char *v2) { - const char **a = xmalloc(3 * sizeof(*a)); + const char **a = (const char **) xmalloc(3 * sizeof(*a)); a[0] = xstrdup(v1); if (v2) { diff --git a/src/elementset.c b/src/elementset.c index 8e2bf9a..3e453d5 100644 --- a/src/elementset.c +++ b/src/elementset.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: elementset.c,v 1.3 2007-01-03 08:42:15 adam Exp $ + * $Id: elementset.c,v 1.4 2007-05-06 20:12:20 adam Exp $ */ /** * \file elementset.c @@ -33,10 +33,12 @@ const char *yaz_get_esn(Z_RecordComposition *comp) void yaz_set_esn(Z_RecordComposition **comp_p, const char *esn, NMEM nmem) { - Z_RecordComposition *comp = nmem_malloc(nmem, sizeof(*comp)); + Z_RecordComposition *comp = (Z_RecordComposition *) + nmem_malloc(nmem, sizeof(*comp)); comp->which = Z_RecordComp_simple; - comp->u.simple = nmem_malloc(nmem, sizeof(*comp->u.simple)); + comp->u.simple = (Z_ElementSetNames *) + nmem_malloc(nmem, sizeof(*comp->u.simple)); comp->u.simple->which = Z_ElementSetNames_generic; comp->u.simple->u.generic = nmem_strdup(nmem, esn); *comp_p = comp; diff --git a/src/http.c b/src/http.c index 12e7c66..42b32ed 100644 --- a/src/http.c +++ b/src/http.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: http.c,v 1.1 2007-01-11 10:55:57 adam Exp $ + * $Id: http.c,v 1.2 2007-05-06 20:12:20 adam Exp $ */ /** @@ -159,7 +159,8 @@ void z_HTTP_header_add_content_type(ODR o, Z_HTTP_Header **hp, const char *l = "Content-Type"; if (charset) { - char *ctype = odr_malloc(o, strlen(content_type)+strlen(charset) + 15); + char *ctype = (char *) + odr_malloc(o, strlen(content_type)+strlen(charset) + 15); sprintf(ctype, "%s; charset=%s", content_type, charset); z_HTTP_header_add(o, hp, l, ctype); } diff --git a/src/log.c b/src/log.c index ab74836..ab87c32 100644 --- a/src/log.c +++ b/src/log.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: log.c,v 1.50 2007-04-17 20:26:18 adam Exp $ + * $Id: log.c,v 1.51 2007-05-06 20:12:20 adam Exp $ */ /** @@ -505,7 +505,7 @@ static int define_module_bit(const char *name) } mask_names[i].mask = next_log_bit; next_log_bit = next_log_bit<<1; - mask_names[i].name = malloc(strlen(name)+1); + mask_names[i].name = (char *) malloc(strlen(name)+1); strcpy(mask_names[i].name, name); mask_names[i+1].name = NULL; mask_names[i+1].mask = 0; diff --git a/src/logrpn.c b/src/logrpn.c index fa9a2ea..085b311 100644 --- a/src/logrpn.c +++ b/src/logrpn.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * All rights reserved. * - * $Id: logrpn.c,v 1.16 2007-04-12 13:52:57 adam Exp $ + * $Id: logrpn.c,v 1.17 2007-05-06 20:12:20 adam Exp $ */ /** @@ -396,25 +396,6 @@ void yaz_log_zquery (Z_Query *q) yaz_log_zquery_level(YLOG_LOG, q); } -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 (diags[0]->which != Z_DiagRec_defaultFormat) - wrbuf_printf(b,"(diag not in default format?)"); - else - { - Z_DefaultDiagFormat *e=diags[0]->u.defaultFormat; - if (e->condition) - wrbuf_printf(b, "%d ",*e->condition); - else - wrbuf_printf(b, "?? "); - if ((e->which==Z_DefaultDiagFormat_v2Addinfo) && (e->u.v2Addinfo)) - wrbuf_printf(b,"%s ",e->u.v2Addinfo); - else if ((e->which==Z_DefaultDiagFormat_v3Addinfo) && (e->u.v3Addinfo)) - wrbuf_printf(b,"%s ",e->u.v3Addinfo); - } -} /* * Local variables: * c-basic-offset: 4 diff --git a/src/marc_read_xml.c b/src/marc_read_xml.c index ce9cc7d..caf5a55 100644 --- a/src/marc_read_xml.c +++ b/src/marc_read_xml.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: marc_read_xml.c,v 1.2 2007-01-03 08:42:15 adam Exp $ + * $Id: marc_read_xml.c,v 1.3 2007-05-06 20:12:20 adam Exp $ */ /** @@ -74,7 +74,7 @@ int yaz_marc_read_xml_subfields(yaz_marc_t mt, const xmlNode *ptr) for (p = ptr->children; p ; p = p->next) if (p->type == XML_TEXT_NODE) ctrl_data_len += strlen((const char *)p->content); - ctrl_data_buf = nmem_malloc(nmem, ctrl_data_len+1); + ctrl_data_buf = (char *) nmem_malloc(nmem, ctrl_data_len+1); strcpy(ctrl_data_buf, (const char *)ptr_code->content); for (p = ptr->children; p ; p = p->next) if (p->type == XML_TEXT_NODE) diff --git a/src/marcdisp.c b/src/marcdisp.c index 33ec6f9..bde5fd0 100644 --- a/src/marcdisp.c +++ b/src/marcdisp.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: marcdisp.c,v 1.49 2007-03-20 21:37:32 adam Exp $ + * $Id: marcdisp.c,v 1.50 2007-05-06 20:12:20 adam Exp $ */ /** @@ -137,7 +137,8 @@ static int marc_exec_leader(const char *leader_spec, char *leader, static struct yaz_marc_node *yaz_marc_add_node(yaz_marc_t mt) { - struct yaz_marc_node *n = nmem_malloc(mt->nmem, sizeof(*n)); + struct yaz_marc_node *n = (struct yaz_marc_node *) + nmem_malloc(mt->nmem, sizeof(*n)); n->next = 0; *mt->nodes_pp = n; mt->nodes_pp = &n->next; @@ -256,7 +257,8 @@ void yaz_marc_add_subfield(yaz_marc_t mt, if (mt->subfield_pp) { - struct yaz_marc_subfield *n = nmem_malloc(mt->nmem, sizeof(*n)); + struct yaz_marc_subfield *n = (struct yaz_marc_subfield *) + nmem_malloc(mt->nmem, sizeof(*n)); n->code_data = nmem_strdupn(mt->nmem, code_data, code_data_len); n->next = 0; /* mark subfield_pp to point to this one, so we append here next */ diff --git a/src/mime.c b/src/mime.c index a081f53..67c7b8f 100644 --- a/src/mime.c +++ b/src/mime.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: mime.c,v 1.3 2007-01-03 08:42:15 adam Exp $ + * $Id: mime.c,v 1.4 2007-05-06 20:12:20 adam Exp $ */ /** \file mime.c @@ -32,7 +32,7 @@ struct yaz_mime_info { yaz_mime_types yaz_mime_types_create() { - yaz_mime_types p = xmalloc(sizeof(*p)); + yaz_mime_types p = (yaz_mime_types) xmalloc(sizeof(*p)); p->table = 0; return p; } @@ -40,7 +40,7 @@ yaz_mime_types yaz_mime_types_create() void yaz_mime_types_add(yaz_mime_types t, const char *suffix, const char *mime_type) { - struct yaz_mime_entry *e = xmalloc(sizeof(*e)); + struct yaz_mime_entry *e = (struct yaz_mime_entry *) xmalloc(sizeof(*e)); e->mime_type = xstrdup(mime_type); e->suffix = xstrdup(suffix); e->next = t->table; diff --git a/src/nmemsdup.c b/src/nmemsdup.c index 016676c..95f182c 100644 --- a/src/nmemsdup.c +++ b/src/nmemsdup.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: nmemsdup.c,v 1.10 2007-01-03 08:42:15 adam Exp $ + * $Id: nmemsdup.c,v 1.11 2007-05-06 20:12:20 adam Exp $ */ /** @@ -15,10 +15,7 @@ #endif #include -#include -#if YAZ_HAVE_XML2 -#include -#endif +#include char *nmem_strdup (NMEM mem, const char *src) { @@ -73,7 +70,7 @@ void nmem_strsplit(NMEM nmem, const char *delim, const char *dstr, else { size_t i = 0; - *darray = nmem_malloc(nmem, *num * sizeof(**darray)); + *darray = (char **) nmem_malloc(nmem, *num * sizeof(**darray)); for (cp = dstr; *cp; ) { const char *cp0; diff --git a/src/odr_mem.c b/src/odr_mem.c index efbda89..6a2ef68 100644 --- a/src/odr_mem.c +++ b/src/odr_mem.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: odr_mem.c,v 1.10 2007-04-12 13:52:57 adam Exp $ + * $Id: odr_mem.c,v 1.11 2007-05-06 20:12:20 adam Exp $ */ /** * \file odr_mem.c @@ -57,7 +57,7 @@ int odr_total(ODR o) Odr_oct *odr_create_Odr_oct(ODR o, const unsigned char *buf, int sz) { Odr_oct *p = (Odr_oct *) odr_malloc(o, sizeof(Odr_oct)); - p->buf = odr_malloc(o, sz); + p->buf = (unsigned char *) odr_malloc(o, sz); memcpy(p->buf, buf, sz); p->size = sz; p->len = sz; diff --git a/src/oid_db.c b/src/oid_db.c index 850b2a7..f1ec588 100644 --- a/src/oid_db.c +++ b/src/oid_db.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: oid_db.c,v 1.6 2007-04-18 08:08:02 adam Exp $ + * $Id: oid_db.c,v 1.7 2007-05-06 20:12:20 adam Exp $ */ /** @@ -127,14 +127,15 @@ int yaz_oid_add(yaz_oid_db_t oid_db, int oclass, const char *name, while (oid_db->next) oid_db = oid_db->next; - oid_db->next = xmalloc(sizeof(*oid_db->next)); + oid_db->next = (struct yaz_oid_db *) xmalloc(sizeof(*oid_db->next)); oid_db = oid_db->next; oid_db->next = 0; oid_db->xmalloced = 1; - oid_db->entries = ent = xmalloc(2 * sizeof(*ent)); + oid_db->entries = ent = (struct yaz_oid_entry *) xmalloc(2 * sizeof(*ent)); - alloc_oid = xmalloc(sizeof(*alloc_oid) * (oid_oidlen(new_oid)+1)); + alloc_oid = (int *) + xmalloc(sizeof(*alloc_oid) * (oid_oidlen(new_oid)+1)); oid_oidcpy(alloc_oid, new_oid); ent[0].oid = alloc_oid; ent[0].name = xstrdup(name); @@ -150,7 +151,7 @@ int yaz_oid_add(yaz_oid_db_t oid_db, int oclass, const char *name, yaz_oid_db_t yaz_oid_db_new(void) { - yaz_oid_db_t p = xmalloc(sizeof(*p)); + yaz_oid_db_t p = (yaz_oid_db_t) xmalloc(sizeof(*p)); p->entries = 0; p->next = 0; p->xmalloced = 1; diff --git a/src/oidtoc.tcl b/src/oidtoc.tcl index 7ef102c..2651328 100644 --- a/src/oidtoc.tcl +++ b/src/oidtoc.tcl @@ -2,7 +2,7 @@ # Copyright (c) Index Data 2006-2007 # See the file LICENSE for details. # -# $Id: oidtoc.tcl,v 1.3 2007-04-24 12:55:15 adam Exp $ +# $Id: oidtoc.tcl,v 1.4 2007-05-06 20:12:20 adam Exp $ # # Converts a CSV file with Object identifiers to C @@ -65,7 +65,7 @@ proc oid_to_c {srcdir input cname hname} { set lname [string map {- _ . _ { } _ ( {} ) {}} $lname] set prefix [string tolower [lindex $oid 0]] - puts -nonewline $cfile "YAZ_EXPORT const int yaz_oid_${prefix}_${lname}\[\] = \{" + puts -nonewline $cfile "YAZ_EXPORT extern const int yaz_oid_${prefix}_${lname}\[\] = \{" puts -nonewline $cfile [string map {. ,} [lindex $oid 1]] puts $cfile ",-1\};" diff --git a/src/querytowrbuf.c b/src/querytowrbuf.c index 64b2ddc..56aa42b 100644 --- a/src/querytowrbuf.c +++ b/src/querytowrbuf.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * All rights reserved. * - * $Id: querytowrbuf.c,v 1.9 2007-04-12 13:52:57 adam Exp $ + * $Id: querytowrbuf.c,v 1.10 2007-05-06 20:12:20 adam Exp $ */ /** \file querytowrbuf.c @@ -232,6 +232,26 @@ void yaz_scan_to_wrbuf(WRBUF b, const Z_AttributesPlusTerm *zapt, yaz_apt_to_wrbuf(b, zapt); } +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 (diags[0]->which != Z_DiagRec_defaultFormat) + wrbuf_printf(b,"(diag not in default format?)"); + else + { + Z_DefaultDiagFormat *e=diags[0]->u.defaultFormat; + if (e->condition) + wrbuf_printf(b, "%d ",*e->condition); + else + wrbuf_printf(b, "?? "); + if ((e->which==Z_DefaultDiagFormat_v2Addinfo) && (e->u.v2Addinfo)) + wrbuf_printf(b,"%s ",e->u.v2Addinfo); + else if ((e->which==Z_DefaultDiagFormat_v3Addinfo) && (e->u.v3Addinfo)) + wrbuf_printf(b,"%s ",e->u.v3Addinfo); + } +} + /* * Local variables: * c-basic-offset: 4 diff --git a/src/record_conv.c b/src/record_conv.c index 27381fa..524171e 100644 --- a/src/record_conv.c +++ b/src/record_conv.c @@ -2,7 +2,7 @@ * Copyright (C) 2005-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: record_conv.c,v 1.15 2007-03-19 14:40:07 adam Exp $ + * $Id: record_conv.c,v 1.16 2007-05-06 20:12:20 adam Exp $ */ /** * \file record_conv.c @@ -107,7 +107,7 @@ static void yaz_record_conv_reset(yaz_record_conv_t p) yaz_record_conv_t yaz_record_conv_create() { - yaz_record_conv_t p = xmalloc(sizeof(*p)); + yaz_record_conv_t p = (yaz_record_conv_t) xmalloc(sizeof(*p)); p->nmem = nmem_create(); p->wr_error = wrbuf_alloc(); p->rules = 0; @@ -136,7 +136,8 @@ void yaz_record_conv_destroy(yaz_record_conv_t p) static struct yaz_record_conv_rule *add_rule(yaz_record_conv_t p, enum YAZ_RECORD_CONV_RULE type) { - struct yaz_record_conv_rule *r = nmem_malloc(p->nmem, sizeof(*r)); + struct yaz_record_conv_rule *r = (struct yaz_record_conv_rule *) + nmem_malloc(p->nmem, sizeof(*r)); r->which = type; r->next = 0; *p->rules_p = r; diff --git a/src/retrieval.c b/src/retrieval.c index 4ee7ad1..329f45e 100644 --- a/src/retrieval.c +++ b/src/retrieval.c @@ -2,7 +2,7 @@ * Copyright (C) 2005-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: retrieval.c,v 1.19 2007-04-12 20:47:28 adam Exp $ + * $Id: retrieval.c,v 1.20 2007-05-06 20:12:20 adam Exp $ */ /** * \file retrieval.c @@ -73,7 +73,7 @@ static void yaz_retrieval_reset(yaz_retrieval_t p); yaz_retrieval_t yaz_retrieval_create() { - yaz_retrieval_t p = xmalloc(sizeof(*p)); + yaz_retrieval_t p = (yaz_retrieval_t) xmalloc(sizeof(*p)); p->odr = odr_createmem(ODR_ENCODE); p->nmem = odr_getmem(p->odr); p->wr_error = wrbuf_alloc(); @@ -113,7 +113,8 @@ static int conf_retrieval(yaz_retrieval_t p, const xmlNode *ptr) { struct _xmlAttr *attr; - struct yaz_retrieval_elem *el = nmem_malloc(p->nmem, sizeof(*el)); + struct yaz_retrieval_elem *el = (struct yaz_retrieval_elem *) + nmem_malloc(p->nmem, sizeof(*el)); el->syntax = 0; el->identifier = 0; diff --git a/src/seshigh.c b/src/seshigh.c index bad7a31..4b8b89e 100644 --- a/src/seshigh.c +++ b/src/seshigh.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: seshigh.c,v 1.117 2007-05-02 12:36:34 adam Exp $ + * $Id: seshigh.c,v 1.118 2007-05-06 20:12:20 adam Exp $ */ /** * \file seshigh.c @@ -534,14 +534,15 @@ static int srw_bend_init(association *assoc, Z_SRW_diagnostic **d, int *num, Z_S if (sr->username) { - Z_IdAuthentication *auth = odr_malloc(assoc->decode, sizeof(*auth)); + Z_IdAuthentication *auth = (Z_IdAuthentication *) + odr_malloc(assoc->decode, sizeof(*auth)); int len; len = strlen(sr->username) + 1; if (sr->password) len += strlen(sr->password) + 2; auth->which = Z_IdAuthentication_open; - auth->u.open = odr_malloc(assoc->decode, len); + auth->u.open = (char *) odr_malloc(assoc->decode, len); strcpy(auth->u.open, sr->username); if (sr->password && *sr->password) { @@ -654,7 +655,7 @@ static int retrieve_fetch(association *assoc, bend_fetch_rr *rr) else { rr->len = wrbuf_len(output_record); - rr->record = odr_malloc(rr->stream, rr->len); + rr->record = (char *) odr_malloc(rr->stream, rr->len); memcpy(rr->record, wrbuf_buf(output_record), rr->len); } wrbuf_destroy(output_record); @@ -742,7 +743,7 @@ static int srw_bend_fetch(association *assoc, int pos, if (rr.errstring) len += strlen(rr.errstring); - record->recordData_buf = odr_malloc(o, len); + record->recordData_buf = (char *) odr_malloc(o, len); sprintf(record->recordData_buf, "\n" @@ -1151,7 +1152,7 @@ static void srw_bend_search(association *assoc, request *req, static char *srw_bend_explain_default(void *handle, bend_explain_rr *rr) { #if YAZ_HAVE_XML2 - xmlNodePtr ptr = rr->server_node_ptr; + xmlNodePtr ptr = (xmlNode *) rr->server_node_ptr; if (!ptr) return 0; for (ptr = ptr->children; ptr; ptr = ptr->next) @@ -1267,8 +1268,9 @@ static void srw_bend_scan(association *assoc, request *req, if (bsrr->num_entries > 0) { int i; - bsrr->entries = odr_malloc(assoc->decode, sizeof(*bsrr->entries) * - bsrr->num_entries); + bsrr->entries = (struct scan_entry *) + odr_malloc(assoc->decode, sizeof(*bsrr->entries) * + bsrr->num_entries); for (i = 0; inum_entries; i++) { bsrr->entries[i].term = 0; @@ -1300,7 +1302,8 @@ static void srw_bend_scan(association *assoc, request *req, int srw_error; bsrr->scanClause = 0; bsrr->attributeset = 0; - bsrr->term = odr_malloc(assoc->decode, sizeof(*bsrr->term)); + bsrr->term = (Z_AttributesPlusTerm *) + odr_malloc(assoc->decode, sizeof(*bsrr->term)); srw_error = cql2pqf_scan(assoc->encode, srw_req->scanClause.cql, assoc->server->cql_transform, @@ -1671,7 +1674,7 @@ static char *read_file(const char *fname, ODR o, int *sz) fseek(inf, 0L, SEEK_END); *sz = ftell(inf); rewind(inf); - buf = odr_malloc(o, *sz); + buf = (char *) odr_malloc(o, *sz); fread(buf, 1, *sz, inf); fclose(inf); return buf; @@ -2219,7 +2222,8 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb) else { /* no backend. return error */ - binitres = odr_malloc(assoc->encode, sizeof(*binitres)); + binitres = (bend_initresult *) + odr_malloc(assoc->encode, sizeof(*binitres)); binitres->errstring = 0; binitres->errcode = YAZ_BIB1_PERMANENT_SYSTEM_ERROR; iochan_settimeout(assoc->client_chan, 10); @@ -2354,7 +2358,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.117 $"); + version = odr_strdup(assoc->encode, "$Revision: 1.118 $"); if (strlen(version) > 10) /* check for unexpanded CVS strings */ version[strlen(version)-2] = '\0'; resp->implementationVersion = odr_prepend(assoc->encode, @@ -3021,8 +3025,9 @@ static Z_APDU *process_scanRequest(association *assoc, request *reqb, int *fd) if (bsrr->num_entries > 0) { int i; - bsrr->entries = odr_malloc(assoc->decode, sizeof(*bsrr->entries) * - bsrr->num_entries); + bsrr->entries = (struct scan_entry *) + odr_malloc(assoc->decode, sizeof(*bsrr->entries) * + bsrr->num_entries); for (i = 0; inum_entries; i++) { bsrr->entries[i].term = 0; diff --git a/src/soap.c b/src/soap.c index 5a3b442..3b47dcf 100644 --- a/src/soap.c +++ b/src/soap.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: soap.c,v 1.17 2007-01-03 08:42:15 adam Exp $ + * $Id: soap.c,v 1.18 2007-05-06 20:12:20 adam Exp $ */ /** * \file soap.c @@ -264,7 +264,7 @@ int z_soap_codec_enc_xsl(ODR o, Z_SOAP **pp, } if (stylesheet) { - char *content = odr_malloc(o, strlen(stylesheet) + 40); + char *content = (char *) odr_malloc(o, strlen(stylesheet) + 40); xmlNodePtr pi, ptr = xmlDocGetRootElement(doc); sprintf(content, "type=\"text/xsl\" href=\"%s\"", stylesheet); diff --git a/src/srw.c b/src/srw.c index 6cda0cc..0b907ee 100644 --- a/src/srw.c +++ b/src/srw.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: srw.c,v 1.54 2007-01-03 08:42:15 adam Exp $ + * $Id: srw.c,v 1.55 2007-05-06 20:12:20 adam Exp $ */ /** * \file srw.c @@ -150,7 +150,7 @@ static int match_xsd_XML_n(xmlNodePtr ptr, const char *elem, ODR o, xmlFreeNode(tmp); - *val = odr_malloc(o, buf->use+1); + *val = (char *) odr_malloc(o, buf->use+1); memcpy (*val, buf->content, buf->use); (*val)[buf->use] = '\0'; diff --git a/src/srwutil.c b/src/srwutil.c index c7ae1c2..2c87b83 100644 --- a/src/srwutil.c +++ b/src/srwutil.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: srwutil.c,v 1.55 2007-01-03 08:42:15 adam Exp $ + * $Id: srwutil.c,v 1.56 2007-05-06 20:12:20 adam Exp $ */ /** * \file srwutil.c @@ -47,7 +47,7 @@ static void yaz_array_to_uri_ex(char **path, ODR o, char **name, char **value, size_t i, szp = 0, sz = extra_args ? 1+strlen(extra_args) : 1; for(i = 0; name[i]; i++) sz += strlen(name[i]) + 3 + strlen(value[i]) * 3; - *path = odr_malloc(o, sz); + *path = (char *) odr_malloc(o, sz); for(i = 0; name[i]; i++) { @@ -98,8 +98,8 @@ int yaz_uri_array(const char *path, ODR o, char ***name, char ***val) cp++; no++; } - *name = odr_malloc(o, no * sizeof(char*)); - *val = odr_malloc(o, no * sizeof(char*)); + *name = (char **) odr_malloc(o, no * sizeof(char*)); + *val = (char **) odr_malloc(o, no * sizeof(char*)); for (no = 0; *path; no++) { @@ -109,7 +109,7 @@ int yaz_uri_array(const char *path, ODR o, char ***name, char ***val) if (!p1) break; - (*name)[no] = odr_malloc(o, (p1-path)+1); + (*name)[no] = (char *) odr_malloc(o, (p1-path)+1); memcpy((*name)[no], path, p1-path); (*name)[no][p1-path] = '\0'; @@ -117,7 +117,7 @@ int yaz_uri_array(const char *path, ODR o, char ***name, char ***val) p1 = strchr(path, '&'); if (!p1) p1 = strlen(path) + path; - (*val)[no] = ret = odr_malloc(o, p1 - path + 1); + (*val)[no] = ret = (char *) odr_malloc(o, p1 - path + 1); while (*path && *path != '&') { if (*path == '+') @@ -632,10 +632,11 @@ int yaz_sru_decode(Z_HTTP_Request *hreq, Z_SRW_PDU **srw_pdu, sr->u.request->database = db; - (*soap_package) = odr_malloc(decode, sizeof(**soap_package)); + (*soap_package) = (Z_SOAP *) + odr_malloc(decode, sizeof(**soap_package)); (*soap_package)->which = Z_SOAP_generic; - (*soap_package)->u.generic = + (*soap_package)->u.generic = (Z_SOAP_Generic *) odr_malloc(decode, sizeof(*(*soap_package)->u.generic)); (*soap_package)->u.generic->p = sr; @@ -660,10 +661,11 @@ int yaz_sru_decode(Z_HTTP_Request *hreq, Z_SRW_PDU **srw_pdu, sr->u.explain_request->stylesheet = stylesheet; - (*soap_package) = odr_malloc(decode, sizeof(**soap_package)); + (*soap_package) = (Z_SOAP *) + odr_malloc(decode, sizeof(**soap_package)); (*soap_package)->which = Z_SOAP_generic; - (*soap_package)->u.generic = + (*soap_package)->u.generic = (Z_SOAP_Generic *) odr_malloc(decode, sizeof(*(*soap_package)->u.generic)); (*soap_package)->u.generic->p = sr; @@ -712,10 +714,11 @@ int yaz_sru_decode(Z_HTTP_Request *hreq, Z_SRW_PDU **srw_pdu, sr->u.scan_request->stylesheet = stylesheet; - (*soap_package) = odr_malloc(decode, sizeof(**soap_package)); + (*soap_package) = (Z_SOAP *) + odr_malloc(decode, sizeof(**soap_package)); (*soap_package)->which = Z_SOAP_generic; - (*soap_package)->u.generic = + (*soap_package)->u.generic = (Z_SOAP_Generic *) odr_malloc(decode, sizeof(*(*soap_package)->u.generic)); (*soap_package)->u.generic->p = sr; @@ -740,10 +743,11 @@ int yaz_sru_decode(Z_HTTP_Request *hreq, Z_SRW_PDU **srw_pdu, sr->u.explain_request->stylesheet = stylesheet; - (*soap_package) = odr_malloc(decode, sizeof(**soap_package)); + (*soap_package) = (Z_SOAP *) + odr_malloc(decode, sizeof(**soap_package)); (*soap_package)->which = Z_SOAP_generic; - (*soap_package)->u.generic = + (*soap_package)->u.generic = (Z_SOAP_Generic *) odr_malloc(decode, sizeof(*(*soap_package)->u.generic)); (*soap_package)->u.generic->p = sr; @@ -1109,7 +1113,7 @@ static void add_val_int(ODR o, char **name, char **value, int *i, if (val) { name[*i] = a_name; - value[*i] = odr_malloc(o, 30); + value[*i] = (char *) odr_malloc(o, 30); sprintf(value[*i], "%d", *val); (*i)++; } @@ -1228,9 +1232,10 @@ int yaz_sru_get_encode(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, hreq->method = "GET"; - path = odr_malloc(encode, strlen(hreq->path) + strlen(uri_args) + 4 - +(srw_pdu->extra_args ? strlen(srw_pdu->extra_args) : 0) - ); + path = (char *) + odr_malloc(encode, strlen(hreq->path) + strlen(uri_args) + 4 + +(srw_pdu->extra_args ? strlen(srw_pdu->extra_args) : 0)); + sprintf(path, "%s?%s", hreq->path, uri_args); hreq->path = path; diff --git a/src/statserv.c b/src/statserv.c index 83dd422..7d108d7 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.48 2007-05-02 11:53:25 adam Exp $ + * $Id: statserv.c,v 1.49 2007-05-06 20:12:20 adam Exp $ */ /** @@ -183,7 +183,7 @@ static char *nmem_dup_xml_content(NMEM n, xmlNodePtr ptr) len += xmlStrlen(p->content); } /* now allocate for the string */ - str = nmem_malloc(n, len); + str = (unsigned char *) nmem_malloc(n, len); *str = '\0'; /* so we can use strcat */ for (p = ptr; p; p = p->next) { @@ -212,7 +212,8 @@ static char *nmem_dup_xml_content(NMEM n, xmlNodePtr ptr) static struct gfs_server * gfs_server_new(void) { - struct gfs_server *n = nmem_malloc(gfs_nmem, sizeof(*n)); + struct gfs_server *n = (struct gfs_server *) + nmem_malloc(gfs_nmem, sizeof(*n)); memcpy(&n->cb, &control_block, sizeof(control_block)); n->next = 0; n->host = 0; @@ -231,7 +232,8 @@ static struct gfs_server * gfs_server_new(void) static struct gfs_listen * gfs_listen_new(const char *id, const char *address) { - struct gfs_listen *n = nmem_malloc(gfs_nmem, sizeof(*n)); + struct gfs_listen *n = (struct gfs_listen *) + nmem_malloc(gfs_nmem, sizeof(*n)); if (id) n->id = nmem_strdup(gfs_nmem, id); else @@ -432,7 +434,7 @@ static void xml_config_read(void) else if (!strcmp((const char *) ptr->name, "stylesheet")) { char *s = nmem_dup_xml_content(gfs_nmem, ptr->children); - gfs->stylesheet = + gfs->stylesheet = (char *) nmem_malloc(gfs_nmem, strlen(s) + 2); sprintf(gfs->stylesheet, "/%s", s); } @@ -981,7 +983,7 @@ static void *new_session (void *vp) association *newas; IOCHAN new_chan; COMSTACK new_line = (COMSTACK) vp; - IOCHAN parent_chan = new_line->user; + IOCHAN parent_chan = (IOCHAN) new_line->user; unsigned cs_get_mask, cs_accept_mask, mask = ((new_line->io_pending & CS_WANT_WRITE) ? EVENT_OUTPUT : 0) | @@ -1153,7 +1155,8 @@ statserv_options_block *statserv_getcontrol(void) return &control_block; #elif YAZ_POSIX_THREADS if (init_control_tls) - return pthread_getspecific(current_control_tls); + return (statserv_options_block *) + pthread_getspecific(current_control_tls); else return &control_block; #else diff --git a/src/timing.c b/src/timing.c index 0486eb8..3b653af 100644 --- a/src/timing.c +++ b/src/timing.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: timing.c,v 1.4 2007-01-05 14:05:24 adam Exp $ + * $Id: timing.c,v 1.5 2007-05-06 20:12:20 adam Exp $ */ /** @@ -47,7 +47,7 @@ struct yaz_timing { yaz_timing_t yaz_timing_create(void) { - yaz_timing_t t = xmalloc(sizeof(*t)); + yaz_timing_t t = (yaz_timing_t) xmalloc(sizeof(*t)); yaz_timing_start(t); return t; } diff --git a/src/tokenizer.c b/src/tokenizer.c index e13465f..5d28ccb 100644 --- a/src/tokenizer.c +++ b/src/tokenizer.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: tokenizer.c,v 1.2 2007-04-27 10:09:45 adam Exp $ + * $Id: tokenizer.c,v 1.3 2007-05-06 20:12:20 adam Exp $ */ /** @@ -44,7 +44,7 @@ void yaz_tok_cfg_single_tokens(yaz_tok_cfg_t t, const char *simple) yaz_tok_cfg_t yaz_tok_cfg_create(void) { - yaz_tok_cfg_t t = xmalloc(sizeof(*t)); + yaz_tok_cfg_t t = (yaz_tok_cfg_t) xmalloc(sizeof(*t)); t->white_space = xstrdup(" \t\r\n"); t->single_tokens = xstrdup(""); t->quote_tokens_begin = xstrdup("\""); @@ -103,7 +103,7 @@ yaz_tok_parse_t yaz_tok_parse_create(yaz_tok_cfg_t t, yaz_tok_get_byte_t h, void *vp) { - yaz_tok_parse_t tp = xmalloc(sizeof(*tp)); + yaz_tok_parse_t tp = (yaz_tok_parse_t) xmalloc(sizeof(*tp)); tp->cfg = t; tp->cfg->ref_count++; diff --git a/src/xmlquery.c b/src/xmlquery.c index 0d03939..b3a3f84 100644 --- a/src/xmlquery.c +++ b/src/xmlquery.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * All rights reserved. * - * $Id: xmlquery.c,v 1.14 2007-04-13 09:55:21 adam Exp $ + * $Id: xmlquery.c,v 1.15 2007-05-06 20:12:20 adam Exp $ */ /** \file xmlquery.c @@ -669,7 +669,7 @@ void yaz_xml2query_rpnstructure(const xmlNode *ptr, Z_RPNStructure **zs, *zs = (Z_RPNStructure *) odr_malloc(odr, sizeof(Z_RPNStructure)); if (!xmlStrcmp(ptr->name, BAD_CAST "operator")) { - Z_Complex *zc = odr_malloc(odr, sizeof(Z_Complex)); + Z_Complex *zc = (Z_Complex *) odr_malloc(odr, sizeof(Z_Complex)); (*zs)->which = Z_RPNStructure_complex; (*zs)->u.complex = zc; @@ -780,7 +780,7 @@ static void yaz_xml2query_(const xmlNode *ptr, Z_Query **query, ODR odr, } } -void yaz_xml2query(const void *xmlnodep, Z_Query **query, ODR odr, +void yaz_xml2query(const xmlNode *xmlnodep, Z_Query **query, ODR odr, int *error_code, const char **addinfo) { yaz_xml2query_(xmlnodep, query, odr, error_code, addinfo); diff --git a/src/zget.c b/src/zget.c index b88e70a..156bfd9 100644 --- a/src/zget.c +++ b/src/zget.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: zget.c,v 1.14 2007-04-16 21:53:09 adam Exp $ + * $Id: zget.c,v 1.15 2007-05-06 20:12:20 adam Exp $ */ /** * \file zget.c @@ -562,7 +562,7 @@ Z_External *zget_init_diagnostics(ODR odr, int error, const char *addinfo) x->direct_reference = odr_oiddup(odr, yaz_oid_userinfo_userinfo_1); x->which = Z_External_userInfo1; - u = odr_malloc(odr, sizeof *u); + u = (Z_OtherInformation *) odr_malloc(odr, sizeof *u); x->u.userInfo1 = u; u->num_elements = 1; u->list = (Z_OtherInformationUnit**) odr_malloc(odr, sizeof *u->list); @@ -603,7 +603,7 @@ Z_External *zget_init_diagnostics_octet(ODR odr, int error, int octet_len; ODR encode; - u = odr_malloc(odr, sizeof *u); + u = (Z_OtherInformation *) odr_malloc(odr, sizeof *u); u->num_elements = 1; u->list = (Z_OtherInformationUnit**) odr_malloc(odr, sizeof *u->list); u->list[0] = (Z_OtherInformationUnit*) odr_malloc(odr, sizeof *u->list[0]); @@ -642,7 +642,7 @@ Z_External *zget_init_diagnostics_octet(ODR odr, int error, x->direct_reference = odr_oiddup(odr, yaz_oid_userinfo_userinfo_1); x->which = Z_External_octet; x->u.octet_aligned = (Odr_oct *) odr_malloc(odr, sizeof(Odr_oct)); - x->u.octet_aligned->buf = odr_malloc(odr, octet_len); + x->u.octet_aligned->buf = (unsigned char *) odr_malloc(odr, octet_len); memcpy(x->u.octet_aligned->buf, octet_buf, octet_len); x->u.octet_aligned->len = octet_len; diff --git a/src/zoom-c.c b/src/zoom-c.c index 612cc77..4d55399 100644 --- a/src/zoom-c.c +++ b/src/zoom-c.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: zoom-c.c,v 1.128 2007-05-05 11:55:22 adam Exp $ + * $Id: zoom-c.c,v 1.129 2007-05-06 20:12:20 adam Exp $ */ /** * \file zoom-c.c @@ -1341,7 +1341,7 @@ static zoom_ret ZOOM_connection_send_init(ZOOM_connection c) odr_prepend(c->odr_out, "ZOOM-C", ireq->implementationName)); - version = odr_strdup(c->odr_out, "$Revision: 1.128 $"); + version = odr_strdup(c->odr_out, "$Revision: 1.129 $"); if (strlen(version) > 10) /* check for unexpanded CVS strings */ version[strlen(version)-2] = '\0'; ireq->implementationVersion = @@ -3486,7 +3486,7 @@ static void interpret_otherinformation_field(ZOOM_connection c, static void set_init_option(const char *name, void *clientData) { - ZOOM_connection c = clientData; + ZOOM_connection c = (ZOOM_connection) clientData; char buf[80]; sprintf(buf, "init_opt_%.70s", name); @@ -4116,7 +4116,7 @@ ZOOM_API(int) static void cql2pqf_wrbuf_puts(const char *buf, void *client_data) { - WRBUF wrbuf = client_data; + WRBUF wrbuf = (WRBUF) client_data; wrbuf_puts(wrbuf, buf); } diff --git a/src/zoom-socket.c b/src/zoom-socket.c index fc1df84..5950baa 100644 --- a/src/zoom-socket.c +++ b/src/zoom-socket.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: zoom-socket.c,v 1.3 2007-02-28 11:14:56 mike Exp $ + * $Id: zoom-socket.c,v 1.4 2007-05-06 20:12:20 adam Exp $ */ /** * \file zoom-socket.c @@ -136,8 +136,9 @@ ZOOM_API(int) ZOOM_API(int) ZOOM_event_sys_poll(int no, ZOOM_connection *cs) { - struct pollfd *pollfds = xmalloc(no * sizeof *pollfds); - ZOOM_connection *poll_cs = xmalloc(no * sizeof *poll_cs); + struct pollfd *pollfds = (struct pollfd *) xmalloc(no * sizeof *pollfds); + ZOOM_connection *poll_cs = (ZOOM_connection *) + xmalloc(no * sizeof *poll_cs); int i, r; int nfds = 0; int timeout = 30; diff --git a/util/srwtst.c b/util/srwtst.c index f293620..31a362e 100644 --- a/util/srwtst.c +++ b/util/srwtst.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: srwtst.c,v 1.7 2007-04-17 20:26:18 adam Exp $ + * $Id: srwtst.c,v 1.8 2007-05-06 20:12:20 adam Exp $ */ #include @@ -49,7 +49,7 @@ int main(int argc, char **argv) if (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_request) { Z_SRW_searchRetrieveRequest *req = sr->u.request; diff --git a/util/yaz-illclient.c b/util/yaz-illclient.c index 62d7026..45238a3 100644 --- a/util/yaz-illclient.c +++ b/util/yaz-illclient.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2006, Index Data ApS * See the file LICENSE for details. * - * $Id: yaz-illclient.c,v 1.5 2007-04-25 16:51:47 heikki Exp $ + * $Id: yaz-illclient.c,v 1.6 2007-05-06 20:12:20 adam Exp $ */ /* WARNING - This is work in progress - not at all ready */ @@ -79,7 +79,7 @@ struct prog_args { /* Call-back to be called for every field in the ill-request */ /* It can set values to any field, perhaps from the prog_args */ const char *get_ill_element(void *clientData, const char *element) { - struct prog_args *args = clientData; + struct prog_args *args = (struct prog_args *) clientData; struct nameval *nv=args->namevals; char *ret=0; if (!nv) @@ -119,7 +119,7 @@ const char *get_ill_element(void *clientData, const char *element) { /** \brief parse a parameter string */ /* string is like 'name=value' */ struct nameval *parse_nameval( char *arg ) { - struct nameval *nv = xmalloc(sizeof(*nv)); + struct nameval *nv = (struct nameval *) xmalloc(sizeof(*nv)); char *p=arg; int len; if (!p || !*p) @@ -129,7 +129,7 @@ struct nameval *parse_nameval( char *arg ) { len = p - arg; if (!len) return 0; - nv->name = xmalloc(len+1); + nv->name = (char *) xmalloc(len+1); strncpy(nv->name, arg, len); nv->name[len]='\0'; if (*p == '=' ) @@ -201,7 +201,7 @@ void parseargs( int argc, char * argv[], struct prog_args *args) { int ret; char *arg; char *prog=*argv; - char *version="$Id: yaz-illclient.c,v 1.5 2007-04-25 16:51:47 heikki Exp $"; /* from cvs */ + char *version="$Id: yaz-illclient.c,v 1.6 2007-05-06 20:12:20 adam Exp $"; /* from cvs */ struct nameval *nv; /* default values */ @@ -303,19 +303,19 @@ COMSTACK connect_to( char *hostaddr ){ /* * * * * * * * * * * * * * * */ /* Makes a Z39.50-like prompt package with username and password */ Z_PromptObject1 *makeprompt(struct prog_args *args, ODR odr) { - Z_PromptObject1 *p = odr_malloc(odr, sizeof(*p) ); - Z_ResponseUnit1 *ru = odr_malloc(odr, sizeof(*ru) ); + Z_PromptObject1 *p = (Z_PromptObject1 *) odr_malloc(odr, sizeof(*p) ); + Z_ResponseUnit1 *ru = (Z_ResponseUnit1 *) odr_malloc(odr, sizeof(*ru) ); p->which=Z_PromptObject1_response; - p->u.response = odr_malloc(odr, sizeof(*(p->u.response)) ); + p->u.response = (Z_Response1*) odr_malloc(odr, sizeof(*(p->u.response)) ); p->u.response->num=2; - p->u.response->elements=odr_malloc(odr, + p->u.response->elements= (Z_ResponseUnit1 **) odr_malloc(odr, p->u.response->num*sizeof(*(p->u.response->elements)) ); /* user id, aka "oclc authorization number" */ p->u.response->elements[0] = ru; - ru->promptId = odr_malloc(odr, sizeof(*(ru->promptId) )); + ru->promptId = (Z_PromptId *) odr_malloc(odr, sizeof(*(ru->promptId) )); ru->promptId->which = Z_PromptId_enumeratedPrompt; - ru->promptId->u.enumeratedPrompt = + ru->promptId->u.enumeratedPrompt = (Z_PromptIdEnumeratedPrompt *) odr_malloc(odr, sizeof(*(ru->promptId->u.enumeratedPrompt) )); ru->promptId->u.enumeratedPrompt->type = odr_intdup(odr,Z_PromptIdEnumeratedPrompt_userId); @@ -323,11 +323,11 @@ Z_PromptObject1 *makeprompt(struct prog_args *args, ODR odr) { ru->which = Z_ResponseUnit1_string ; ru->u.string = odr_strdup(odr, args->auth_userid); /* password */ - ru = odr_malloc(odr, sizeof(*ru) ); + ru = (Z_ResponseUnit1 *) odr_malloc(odr, sizeof(*ru) ); p->u.response->elements[1] = ru; - ru->promptId = odr_malloc(odr, sizeof(*(ru->promptId) )); + ru->promptId = (Z_PromptId *) odr_malloc(odr, sizeof(*(ru->promptId) )); ru->promptId->which = Z_PromptId_enumeratedPrompt; - ru->promptId->u.enumeratedPrompt = + ru->promptId->u.enumeratedPrompt = (Z_PromptIdEnumeratedPrompt *) odr_malloc(odr, sizeof(*(ru->promptId->u.enumeratedPrompt) )); ru->promptId->u.enumeratedPrompt->type = odr_intdup(odr,Z_PromptIdEnumeratedPrompt_password); @@ -340,11 +340,11 @@ Z_PromptObject1 *makeprompt(struct prog_args *args, ODR odr) { ILL_Extension *makepromptextension(struct prog_args *args, ODR odr) { ODR odr_ext = odr_createmem(ODR_ENCODE); ODR odr_prt = odr_createmem(ODR_PRINT); - ILL_Extension *e = odr_malloc(odr, sizeof(*e)); + ILL_Extension *e = (ILL_Extension *) odr_malloc(odr, sizeof(*e)); Z_PromptObject1 *p = makeprompt(args,odr_ext); char * buf; int siz; - Z_External *ext = odr_malloc(odr, sizeof(*ext)); + Z_External *ext = (Z_External *) odr_malloc(odr, sizeof(*ext)); ext->direct_reference = odr_getoidbystr(odr,"1.2.840.10003.8.1"); ext->indirect_reference=0; ext->descriptor=0; @@ -358,8 +358,9 @@ ILL_Extension *makepromptextension(struct prog_args *args, ODR odr) { z_PromptObject1(odr_prt, &p, 0,0 ); /*!*/ buf= odr_getbuf(odr_ext,&siz,0); - ext->u.single_ASN1_type=odr_malloc(odr,sizeof(*ext->u.single_ASN1_type)); - ext->u.single_ASN1_type->buf= odr_malloc(odr, siz); + ext->u.single_ASN1_type=(Odr_any *) + odr_malloc(odr,sizeof(*ext->u.single_ASN1_type)); + ext->u.single_ASN1_type->buf= (unsigned char *) odr_malloc(odr, siz); memcpy(ext->u.single_ASN1_type->buf,buf, siz ); ext->u.single_ASN1_type->len = ext->u.single_ASN1_type->size = siz; odr_reset(odr_ext); @@ -367,7 +368,7 @@ ILL_Extension *makepromptextension(struct prog_args *args, ODR odr) { e->identifier = odr_intdup(odr,1); e->critical = odr_intdup(odr,0); - e->item=odr_malloc(odr,sizeof(*e->item)); + e->item = (Odr_any *) odr_malloc(odr,sizeof(*e->item)); if ( ! z_External(odr_ext, &ext,0,0) ) { yaz_log(YLOG_FATAL,"Encoding of z_External failed "); exit (6); @@ -375,7 +376,7 @@ ILL_Extension *makepromptextension(struct prog_args *args, ODR odr) { printf("External: \n"); z_External(odr_prt, &ext,0,0); /*!*/ buf= odr_getbuf(odr_ext,&siz,0); - e->item->buf= odr_malloc(odr, siz); + e->item->buf= (unsigned char *) odr_malloc(odr, siz); memcpy(e->item->buf,buf, siz ); e->item->len = e->item->size = siz; @@ -389,11 +390,12 @@ ILL_Extension *makeoclcextension(struct prog_args *args, ODR odr) { /* fields. Here we just null them all out */ ODR odr_ext = odr_createmem(ODR_ENCODE); ODR odr_prt = odr_createmem(ODR_PRINT); - ILL_Extension *e = odr_malloc(odr, sizeof(*e)); - ILL_OCLCILLRequestExtension *oc = odr_malloc(odr_ext, sizeof(*oc)); + ILL_Extension *e = (ILL_Extension *) odr_malloc(odr, sizeof(*e)); + ILL_OCLCILLRequestExtension *oc = (ILL_OCLCILLRequestExtension *) + odr_malloc(odr_ext, sizeof(*oc)); char * buf; int siz; - Z_External *ext = odr_malloc(odr, sizeof(*ext)); + Z_External *ext = (Z_External *) odr_malloc(odr, sizeof(*ext)); oc->clientDepartment = 0; oc->paymentMethod = 0; oc->uniformTitle = 0; @@ -415,8 +417,9 @@ ILL_Extension *makeoclcextension(struct prog_args *args, ODR odr) { ill_OCLCILLRequestExtension(odr_prt, &oc, 0,0 ); /*!*/ buf= odr_getbuf(odr_ext,&siz,0); - ext->u.single_ASN1_type=odr_malloc(odr,sizeof(*ext->u.single_ASN1_type)); - ext->u.single_ASN1_type->buf= odr_malloc(odr, siz); + ext->u.single_ASN1_type = (Odr_any*) + odr_malloc(odr,sizeof(*ext->u.single_ASN1_type)); + ext->u.single_ASN1_type->buf = (unsigned char *) odr_malloc(odr, siz); memcpy(ext->u.single_ASN1_type->buf,buf, siz ); ext->u.single_ASN1_type->len = ext->u.single_ASN1_type->size = siz; odr_reset(odr_ext); @@ -424,7 +427,7 @@ ILL_Extension *makeoclcextension(struct prog_args *args, ODR odr) { e->identifier = odr_intdup(odr,1); e->critical = odr_intdup(odr,0); - e->item=odr_malloc(odr,sizeof(*e->item)); + e->item = (Odr_any *) odr_malloc(odr,sizeof(*e->item)); if ( ! z_External(odr_ext, &ext,0,0) ) { yaz_log(YLOG_FATAL,"Encoding of z_External failed "); exit (6); @@ -432,8 +435,8 @@ ILL_Extension *makeoclcextension(struct prog_args *args, ODR odr) { printf("External: \n"); z_External(odr_prt, &ext,0,0); /*!*/ buf= odr_getbuf(odr_ext,&siz,0); - e->item->buf= odr_malloc(odr, siz); - memcpy(e->item->buf,buf, siz ); + e->item->buf= (unsigned char *) odr_malloc(odr, siz); + memcpy(e->item->buf, buf, siz); e->item->len = e->item->size = siz; odr_destroy(odr_prt); @@ -450,12 +453,12 @@ ILL_APDU *createrequest( struct prog_args *args, ODR odr) { ctl.odr = odr; ctl.clientData = args; ctl.f = get_ill_element; - apdu = odr_malloc( odr, sizeof(*apdu) ); + apdu = (ILL_APDU *) odr_malloc( odr, sizeof(*apdu) ); apdu->which=ILL_APDU_ILL_Request; req = ill_get_ILLRequest(&ctl, "ill", 0); apdu->u.illRequest=req; req->num_iLL_request_extensions=2; - req->iLL_request_extensions= + req->iLL_request_extensions = (ILL_Extension **) odr_malloc(odr, req->num_iLL_request_extensions*sizeof(*req->iLL_request_extensions)); req->iLL_request_extensions[0]=makepromptextension(args,odr); req->iLL_request_extensions[1]=makeoclcextension(args,odr); diff --git a/util/yaz-xmlquery.c b/util/yaz-xmlquery.c index 4cc8196..c4c9a4d 100644 --- a/util/yaz-xmlquery.c +++ b/util/yaz-xmlquery.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: yaz-xmlquery.c,v 1.8 2007-03-19 22:17:41 adam Exp $ + * $Id: yaz-xmlquery.c,v 1.9 2007-05-06 20:12:20 adam Exp $ */ #include @@ -143,7 +143,7 @@ void xmlfiletopqf(const char *xmlfile) exit(1); } rewind(f); - xmlstr = xmalloc(sz+1); + xmlstr = (char *) xmalloc(sz+1); xmlstr[sz] = '\0'; fread(xmlstr, sz, 1, f); fclose(f); diff --git a/ziffy/ziffy.c b/ziffy/ziffy.c index 31bdee1..64e2bc4 100644 --- a/ziffy/ziffy.c +++ b/ziffy/ziffy.c @@ -404,12 +404,12 @@ int main (int argc, char * argv []) if (filter) { strcat (filter, " "); - filter = realloc (filter, roomsize); + filter = (char *) realloc (filter, roomsize); strcat (filter, argv [optind ++]); } else { - filter = malloc (roomsize); + filter = (char *) malloc (roomsize); strcpy (filter, argv [optind ++]); } } diff --git a/zoom/zoom-benchmark.c b/zoom/zoom-benchmark.c index 8e54c0a..03e7c2b 100644 --- a/zoom/zoom-benchmark.c +++ b/zoom/zoom-benchmark.c @@ -1,5 +1,5 @@ /* - * $Id: zoom-benchmark.c,v 1.18 2007-01-04 14:44:34 marc Exp $ + * $Id: zoom-benchmark.c,v 1.19 2007-05-06 20:12:21 adam Exp $ * * Asynchronous multi-target client doing search and piggyback retrieval */ @@ -300,11 +300,11 @@ int main(int argc, char **argv) read_params(argc, argv, ¶meters); - z = xmalloc(sizeof(*z) * parameters.concurrent); - r = xmalloc(sizeof(*r) * parameters.concurrent); - elc = xmalloc(sizeof(*elc) * parameters.concurrent * parameters.repeat); - els = xmalloc(sizeof(*els) - * parameters.concurrent * parameters.repeat * 10); + z = (ZOOM_connection *) xmalloc(sizeof(*z) * parameters.concurrent); + r = (ZOOM_resultset *) xmalloc(sizeof(*r) * parameters.concurrent); + elc = (int *) xmalloc(sizeof(*elc) * parameters.concurrent * parameters.repeat); + els = (event_line_t *) xmalloc( + sizeof(*els) * parameters.concurrent * parameters.repeat * 10); o = ZOOM_options_create(); /* async mode */ diff --git a/zoom/zoom-bug-641.c b/zoom/zoom-bug-641.c index d8afa4d..1009a34 100644 --- a/zoom/zoom-bug-641.c +++ b/zoom/zoom-bug-641.c @@ -1,4 +1,4 @@ -/* $Id: zoom-bug-641.c,v 1.2 2007-01-03 08:42:17 adam Exp $ */ +/* $Id: zoom-bug-641.c,v 1.3 2007-05-06 20:12:21 adam Exp $ */ /** \file zoom-bug641.c \brief Program to illustrate bug 641 @@ -49,7 +49,7 @@ int main(int argc, char **argv) } size = statbuf.st_size; printf("size=%lu\n", (unsigned long) size); - buf = xmalloc(size+1); + buf = (char *) xmalloc(size+1); while ((n = read(fd, &buf[offset], size)) < size) { if (n < 0) { perror("read"); diff --git a/ztest/read-marc.c b/ztest/read-marc.c index 82abe54..9388048 100644 --- a/ztest/read-marc.c +++ b/ztest/read-marc.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: read-marc.c,v 1.9 2007-03-19 14:40:08 adam Exp $ + * $Id: read-marc.c,v 1.10 2007-05-06 20:12:22 adam Exp $ */ /* @@ -1614,7 +1614,7 @@ char *dummy_xml_record (int num, ODR odr) len = yaz_marc_decode_buf (mt, rec, -1, &result, &rlen); if (len > 1) { - rec = odr_malloc(odr, rlen+1); + rec = (char *) odr_malloc(odr, rlen+1); memcpy(rec, result, rlen); rec[rlen] = '\0'; }