#include <stdlib.h>
#include <string.h>
#include <ctype.h>
-#include <yaz/cql.h>
+#include <yaz/rpn2cql.h>
#include <yaz/xmalloc.h>
#include <yaz/diagsrw.h>
#include <yaz/tokenizer.h>
const char *value_str = 0;
/* attset type=value OR type=value */
- elem = nmem_malloc(ct->nmem, sizeof(*elem));
+ elem = (Z_AttributeElement *) nmem_malloc(ct->nmem, sizeof(*elem));
elem->attributeSet = 0;
ae[ae_num] = elem;
wrbuf_puts(ct->w, yaz_tok_parse_string(tp));
}
else
{
- Z_ComplexAttribute *ca = nmem_malloc(ct->nmem, sizeof(*ca));
+ Z_ComplexAttribute *ca = (Z_ComplexAttribute *)
+ nmem_malloc(ct->nmem, sizeof(*ca));
elem->which = Z_AttributeValue_complex;
elem->value.complex = ca;
ca->num_list = 1;
(*pp)->attr_list.attributes = 0;
else
{
- (*pp)->attr_list.attributes =
+ (*pp)->attr_list.attributes = (Z_AttributeElement **)
nmem_malloc(ct->nmem,
ae_num * sizeof(Z_AttributeElement *));
memcpy((*pp)->attr_list.attributes, ae,
unsigned char *inp,
size_t inbytesleft, size_t *no_read)
{
- struct decoder_data *data = d->data;
+ struct decoder_data *data = (struct decoder_data *) d->data;
unsigned long x;
if (data->comb_offset < data->comb_size)
{
unsigned char *inp,
size_t inbytesleft, size_t *no_read)
{
- struct decoder_data *data = d->data;
+ struct decoder_data *data = (struct decoder_data *) d->data;
unsigned long x = read_marc8(cd, d, inp, inbytesleft, no_read);
if (x && data->comb_size == 1)
{
unsigned char *inp,
size_t inbytesleft, size_t *no_read)
{
- struct decoder_data *data = d->data;
+ struct decoder_data *data = (struct decoder_data *) d->data;
data->g0_mode = 'B';
data->g1_mode = 'E';
data->comb_offset = data->comb_size = 0;
void destroy_marc8(yaz_iconv_decoder_t d)
{
- struct decoder_data *data = d->data;
+ struct decoder_data *data = (struct decoder_data *) d->data;
xfree(data);
}
else
return 0;
{
- struct decoder_data *data = xmalloc(sizeof(*data));
+ struct decoder_data *data = (struct decoder_data *)
+ xmalloc(sizeof(*data));
d->data = data;
d->init_handle = init_marc8;
d->destroy_handle = destroy_marc8;
unsigned long x,
char **outbuf, size_t *outbytesleft)
{
- struct encoder_data *w = e->data;
+ struct encoder_data *w = (struct encoder_data *) e->data;
/* list of two char unicode sequence that, when combined, are
equivalent to single unicode chars that can be represented in
ISO-8859-1/Latin-1.
static size_t flush_iso_8859_1(yaz_iconv_t cd, yaz_iconv_encoder_t e,
char **outbuf, size_t *outbytesleft)
{
- struct encoder_data *w = e->data;
+ struct encoder_data *w = (struct encoder_data *) e->data;
if (w->compose_char)
{
unsigned char *outp = (unsigned char *) *outbuf;
void init_iso_8859_1(yaz_iconv_encoder_t e)
{
- struct encoder_data *w = e->data;
+ struct encoder_data *w = (struct encoder_data *) e->data;
w->compose_char = 0;
}
{
if (!yaz_matchstr(tocode, "iso88591"))
{
- struct encoder_data *data = xmalloc(sizeof(*data));
+ struct encoder_data *data = (struct encoder_data *)
+ xmalloc(sizeof(*data));
e->data = data;
e->write_handle = write_iso_8859_1;
e->flush_handle = flush_iso_8859_1;
static void init_marc8(yaz_iconv_encoder_t w)
{
- struct encoder_data *data = w->data;
+ struct encoder_data *data = (struct encoder_data *) w->data;
data->write_marc8_second_half_char = 0;
data->write_marc8_last = 0;
data->write_marc8_ncr = 0;
static size_t flush_marc8(yaz_iconv_t cd, yaz_iconv_encoder_t en,
char **outbuf, size_t *outbytesleft)
{
- struct encoder_data *w = en->data;
+ struct encoder_data *w = (struct encoder_data *) en->data;
size_t r = flush_combos(cd, w, outbuf, outbytesleft);
if (r)
return r;
unsigned long x,
char **outbuf, size_t *outbytesleft)
{
- return yaz_write_marc8_generic(cd, e->data, x, outbuf, outbytesleft, 0);
+ return yaz_write_marc8_generic(cd, (struct encoder_data *) e->data,
+ x, outbuf, outbytesleft, 0);
}
static size_t write_marc8_lossy(yaz_iconv_t cd, yaz_iconv_encoder_t e,
unsigned long x,
char **outbuf, size_t *outbytesleft)
{
- return yaz_write_marc8_generic(cd, e->data, x, outbuf, outbytesleft, 1);
+ return yaz_write_marc8_generic(cd, (struct encoder_data *) e->data,
+ x, outbuf, outbytesleft, 1);
}
static size_t write_marc8_lossless(yaz_iconv_t cd, yaz_iconv_encoder_t e,
unsigned long x,
char **outbuf, size_t *outbytesleft)
{
- return yaz_write_marc8_generic(cd, e->data, x, outbuf, outbytesleft, 2);
+ return yaz_write_marc8_generic(cd, (struct encoder_data *) e->data,
+ x, outbuf, outbytesleft, 2);
}
static void destroy_marc8(yaz_iconv_encoder_t e)
return 0;
{
- struct encoder_data *data = xmalloc(sizeof(*data));
+ struct encoder_data *data = (struct encoder_data *)
+ xmalloc(sizeof(*data));
e->data = data;
e->destroy_handle = destroy_marc8;
e->flush_handle = flush_marc8;
yaz_sc_t yaz_sc_create(const char *service_name, const char *display_name)
{
- yaz_sc_t s = xmalloc(sizeof(*s));
+ yaz_sc_t s = (yaz_sc_t) xmalloc(sizeof(*s));
s->service_name = service_name ? xstrdup(service_name) : 0;
s->display_name = display_name ? xstrdup(display_name) : 0;
Z_SRW_extra_arg **l = &extra_args;
while (*l)
l = &(*l)->next;
- *l = odr_malloc(decode, sizeof(**l));
+ *l = (Z_SRW_extra_arg *) odr_malloc(decode, sizeof(**l));
(*l)->name = odr_strdup(decode, n);
(*l)->value = odr_strdup(decode, v);
(*l)->next = 0;
while (*name)
{
- *ea = odr_malloc(odr, sizeof(**ea));
+ *ea = (Z_SRW_extra_arg *) odr_malloc(odr, sizeof(**ea));
(*ea)->name = *name;
(*ea)->value = *val;
ea = &(*ea)->next;
static void tcpip_create_cred(COMSTACK cs)
{
tcpip_state *sp = (tcpip_state *) cs->cprivate;
- sp->cred_ptr = xmalloc(sizeof(*sp->cred_ptr));
+ sp->cred_ptr = (struct tcpip_cred_ptr *) xmalloc(sizeof(*sp->cred_ptr));
sp->cred_ptr->ref = 1;
gnutls_certificate_allocate_credentials(&sp->cred_ptr->xcred);
}
for (j = 1; j<500; j++)
{
- cp = nmem_malloc(n, j);
+ cp = (char *) nmem_malloc(n, j);
YAZ_CHECK(cp);
if (sizeof(long) >= j)
*(long*) cp = 123L;
for (j = 2000; j<20000; j+= 2000)
{
- cp = nmem_malloc(n, j);
+ cp = (char *) nmem_malloc(n, j);
YAZ_CHECK(cp);
}
nmem_destroy(n);
int ret;
char *ber_buf;
int ber_len;
- Yc_MySequence *s = odr_malloc(encode, sizeof(*s));
+ Yc_MySequence *s = (Yc_MySequence *) odr_malloc(encode, sizeof(*s));
Yc_MySequence *t;
YAZ_CHECK(s);
s->first = odr_intdup(encode, 12345);
- s->second = odr_malloc(encode, sizeof(*s->second));
+ s->second = (Odr_oct *) odr_malloc(encode, sizeof(*s->second));
s->second->buf = (unsigned char *) "hello";
s->second->len = 5;
s->second->size = 0;
void tst_MySequence2(ODR encode, ODR decode)
{
int ret;
- Yc_MySequence *s = odr_malloc(encode, sizeof(*s));
+ Yc_MySequence *s = (Yc_MySequence *) odr_malloc(encode, sizeof(*s));
YAZ_CHECK(s);
s->first = 0; /* deliberately miss this .. */
- s->second = odr_malloc(encode, sizeof(*s->second));
+ s->second = (Odr_oct *) odr_malloc(encode, sizeof(*s->second));
s->second->buf = (unsigned char *) "hello";
s->second->len = 5;
s->second->size = 0;
{0, 0, 0}
};
Z_SRW_PDU *sr = yaz_srw_get(o, Z_SRW_searchRetrieve_request);
- Z_SOAP *p = odr_malloc(o, sizeof(*p));
+ Z_SOAP *p = (Z_SOAP *) odr_malloc(o, sizeof(*p));
YAZ_CHECK(o);
YAZ_CHECK(sr);
#endif
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;
{
Z_OPACRecord *rec;
int i;
- rec = odr_malloc(odr, sizeof(*rec));
+ rec = (Z_OPACRecord *) odr_malloc(odr, sizeof(*rec));
rec->bibliographicRecord =
z_ext_record_usmarc(odr, marc_input, strlen(marc_input));
rec->num_holdingsData = 1;
- rec->holdingsData = odr_malloc(odr, sizeof(*rec->holdingsData));
+ rec->holdingsData = (Z_HoldingsRecord **)
+ odr_malloc(odr, sizeof(*rec->holdingsData));
for (i = 0; i < rec->num_holdingsData; i++)
{
- Z_HoldingsRecord *hr = odr_malloc(odr, sizeof(*hr));
- Z_HoldingsAndCircData *hc = odr_malloc(odr, sizeof(*hc));
+ Z_HoldingsRecord *hr = (Z_HoldingsRecord *)
+ odr_malloc(odr, sizeof(*hr));
+ Z_HoldingsAndCircData *hc = (Z_HoldingsAndCircData *)
+ odr_malloc(odr, sizeof(*hc));
rec->holdingsData[i] = hr;
hr->which = Z_HoldingsRecord_holdingsAndCirc;
hc->volumes = 0;
hc->num_circulationData = 1;
- hc->circulationData = odr_malloc(odr,
- sizeof(*hc->circulationData));
- hc->circulationData[0] = odr_malloc(odr,
- sizeof(**hc->circulationData));
+ hc->circulationData = (Z_CircRecord **)
+ odr_malloc(odr, sizeof(*hc->circulationData));
+ hc->circulationData[0] = (Z_CircRecord *)
+ odr_malloc(odr, sizeof(**hc->circulationData));
hc->circulationData[0]->availableNow = odr_intdup(odr, 1);
hc->circulationData[0]->availablityDate = 0;