From: Adam Dickmeiss Date: Wed, 11 Sep 2013 09:23:23 +0000 (+0200) Subject: Odr_oct updates - YAZ 4 and 5. X-Git-Tag: v1.3.62~3 X-Git-Url: http://git.indexdata.com/?a=commitdiff_plain;h=edeb7dc220cc1b66ae533ee4baba40b15732a4fd;p=metaproxy-moved-to-github.git Odr_oct updates - YAZ 4 and 5. --- diff --git a/src/filter_multi.cpp b/src/filter_multi.cpp index b1452c3..ca66168 100644 --- a/src/filter_multi.cpp +++ b/src/filter_multi.cpp @@ -957,15 +957,13 @@ Z_Entry *yf::Multi::ScanTermInfo::get_entry(ODR odr) t->byAttributes = 0; t->otherTermInfo = 0; t->globalOccurrences = odr_intdup(odr, m_count); - t->term = (Z_Term *) - odr_malloc(odr, sizeof(*t->term)); + t->term = (Z_Term *) odr_malloc(odr, sizeof(*t->term)); t->term->which = Z_Term_general; - Odr_oct *o; - t->term->u.general = o = (Odr_oct *)odr_malloc(odr, sizeof(Odr_oct)); - - o->len = o->size = m_norm_term.size(); - o->buf = (unsigned char *) odr_malloc(odr, o->len); - memcpy(o->buf, m_norm_term.c_str(), o->len); + t->term->u.general = odr_create_Odr_oct(odr, +#if YAZ_VERSIONL < 0x50000 + (unsigned char *) +#endif + m_norm_term.c_str(), m_norm_term.size()); return e; } diff --git a/src/util.cpp b/src/util.cpp index aef7caa..062c497 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -500,15 +500,9 @@ void mp_util::transfer_referenceId(ODR odr, const Z_APDU *src, Z_APDU *dst) if (src) { Z_ReferenceId **id_from = mp::util::get_referenceId(src); - if (id_from && *id_from && id_to) - { - *id_to = (Z_ReferenceId*) odr_malloc (odr, sizeof(**id_to)); - (*id_to)->size = (*id_to)->len = (*id_from)->len; - (*id_to)->buf = (unsigned char*) odr_malloc(odr, (*id_to)->len); - memcpy((*id_to)->buf, (*id_from)->buf, (*id_to)->len); - } - else if (id_to) - *id_to = 0; + if (id_from && *id_from) + *id_to = odr_create_Odr_oct(odr, (*id_from)->buf, + (*id_from)->len); } }