X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fsrwutil.c;h=3a35a9555dd06bdc88da2e7c73dd81dc0410f77f;hb=3c287bc1d48ee6a1f300054c2cebd0ba312bd5b9;hp=b906ec9ea3419254c82533ce3aca8a42647f8b35;hpb=59aa88eb085c71e191802510804588a4f9edbe9b;p=yaz-moved-to-github.git diff --git a/src/srwutil.c b/src/srwutil.c index b906ec9..3a35a95 100644 --- a/src/srwutil.c +++ b/src/srwutil.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include "sru-p.h" @@ -45,7 +46,7 @@ Z_AttributeList *yaz_use_attribute_create(ODR o, const char *name) Z_AttributeElement ** elements; attributes->num_attributes = 1; elements = (Z_AttributeElement**) - odr_malloc (o, attributes->num_attributes * sizeof(*elements)); + odr_malloc(o, attributes->num_attributes * sizeof(*elements)); elements[0] = (Z_AttributeElement*) odr_malloc(o,sizeof(**elements)); elements[0]->attributeType = odr_intdup(o, 1); elements[0]->attributeSet = odr_nullval(); @@ -85,52 +86,6 @@ const char *yaz_element_attribute_value_get(xmlNodePtr ptr, } #endif -static int yaz_base64decode(const char *in, char *out) -{ - const char *map = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz0123456789+/"; - int olen = 0; - int len = strlen(in); - - while (len >= 4) - { - char i0, i1, i2, i3; - char *p; - - if (!(p = strchr(map, in[0]))) - return 0; - i0 = p - map; - len--; - if (!(p = strchr(map, in[1]))) - return 0; - i1 = p - map; - len--; - *(out++) = i0 << 2 | i1 >> 4; - olen++; - if (in[2] == '=') - break; - if (!(p = strchr(map, in[2]))) - return 0; - i2 = p - map; - len--; - *(out++) = i1 << 4 | i2 >> 2; - olen++; - if (in[3] == '=') - break; - if (!(p = strchr(map, in[3]))) - return 0; - i3 = p - map; - len--; - *(out++) = i2 << 6 | i3; - olen++; - - in += 4; - } - - *out = '\0'; - return olen; -} - int yaz_srw_check_content_type(Z_HTTP_Response *hres) { const char *content_type = z_HTTP_header_lookup(hres->headers, @@ -222,9 +177,9 @@ void yaz_add_srw_diagnostic_uri(ODR o, Z_SRW_diagnostic **d, const char *message, const char *details) { Z_SRW_diagnostic *d_new; - d_new = (Z_SRW_diagnostic *) odr_malloc (o, (*num + 1)* sizeof(**d)); + d_new = (Z_SRW_diagnostic *) odr_malloc(o, (*num + 1)* sizeof(**d)); if (*num) - memcpy (d_new, *d, *num *sizeof(**d)); + memcpy(d_new, *d, *num *sizeof(**d)); *d = d_new; yaz_mk_srw_diagnostic(o, *d + *num, uri, message, details); @@ -812,6 +767,7 @@ Z_SRW_PDU *yaz_srw_get_pdu(ODR o, int which, const char *version) sr->u.response->nextRecordPosition = 0; sr->u.response->extra_records = 0; sr->u.response->facetList = 0; + sr->u.response->suggestions = 0; break; case Z_SRW_explain_request: sr->u.explain_request = (Z_SRW_explainRequest *)