X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fzoom-c.c;h=ebedbde1c138482368c7c639b2ee7875130760df;hp=57c083cf2423fe6aacdefedbbc022fc5f5770075;hb=588dde23995415ad84f97e50194ef943fadce6a9;hpb=5a1156a0d8d50aa07af3eec75e939ed2065d3880 diff --git a/src/zoom-c.c b/src/zoom-c.c index 57c083c..ebedbde 100644 --- a/src/zoom-c.c +++ b/src/zoom-c.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2008 Index Data + * Copyright (C) 1995-2009 Index Data * See the file LICENSE for details. */ /** @@ -930,6 +930,7 @@ ZOOM_API(ZOOM_resultset) task->u.search.resultset = r; task->u.search.start = start; task->u.search.count = count; + task->u.search.recv_search_fired = 0; syntax = ZOOM_options_get(r->options, "preferredRecordSyntax"); task->u.search.syntax = syntax ? xstrdup(syntax) : 0; @@ -1361,7 +1362,6 @@ static zoom_ret ZOOM_connection_send_init(ZOOM_connection c) Z_InitRequest *ireq = apdu->u.initRequest; Z_IdAuthentication *auth = (Z_IdAuthentication *) odr_malloc(c->odr_out, sizeof(*auth)); - char *version; ODR_MASK_SET(ireq->options, Z_Options_search); ODR_MASK_SET(ireq->options, Z_Options_present); @@ -1374,11 +1374,10 @@ static zoom_ret ZOOM_connection_send_init(ZOOM_connection c) ODR_MASK_SET(ireq->protocolVersion, Z_ProtocolVersion_2); ODR_MASK_SET(ireq->protocolVersion, Z_ProtocolVersion_3); - /* Index Data's Z39.50 Implementor Id is 81 */ ireq->implementationId = odr_prepend(c->odr_out, ZOOM_options_get(c->options, "implementationId"), - odr_prepend(c->odr_out, "81", ireq->implementationId)); + ireq->implementationId); ireq->implementationName = odr_prepend(c->odr_out, @@ -1386,14 +1385,10 @@ 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.154 $"); - if (strlen(version) > 10) /* check for unexpanded CVS strings */ - version[strlen(version)-2] = '\0'; ireq->implementationVersion = odr_prepend(c->odr_out, ZOOM_options_get(c->options, "implementationVersion"), - odr_prepend(c->odr_out, &version[11], - ireq->implementationVersion)); + ireq->implementationVersion); *ireq->maximumRecordSize = c->maximum_record_size; *ireq->preferredMessageSize = c->preferred_message_size; @@ -2162,11 +2157,10 @@ ZOOM_API(const char *) charset); else if (r->which == Z_External_octet) { - int marc_decode_type = YAZ_MARC_MARCXML; if (yaz_oid_is_iso2709(oid)) { const char *ret_buf = marc_iconv_return( - rec, marc_decode_type, len, + rec, YAZ_MARC_MARCXML, len, (const char *) r->u.octet_aligned->buf, r->u.octet_aligned->len, charset); @@ -2188,16 +2182,30 @@ ZOOM_API(const char *) else if (!strcmp(type, "raw")) { Z_External *r = (Z_External *) npr->u.databaseRecord; + const Odr_oid *oid = r->direct_reference; if (r->which == Z_External_sutrs) { - if (len) *len = r->u.sutrs->len; - return (const char *) r->u.sutrs->buf; + return record_iconv_return(rec, len, + (const char *) r->u.sutrs->buf, + r->u.sutrs->len, + charset); } else if (r->which == Z_External_octet) { - if (len) *len = r->u.octet_aligned->len; - return (const char *) r->u.octet_aligned->buf; + if (yaz_oid_is_iso2709(oid) && *charset) + { + const char *ret_buf = marc_iconv_return( + rec, YAZ_MARC_ISO2709, len, + (const char *) r->u.octet_aligned->buf, + r->u.octet_aligned->len, + charset); + return ret_buf; + } + return record_iconv_return(rec, len, + (const char *) r->u.octet_aligned->buf, + r->u.octet_aligned->len, + charset); } else /* grs-1, explain, OPAC, ... */ { @@ -3995,9 +4003,12 @@ static zoom_ret handle_srw_response(ZOOM_connection c, syntax = c->tasks->u.search.syntax; elementSetName = c->tasks->u.search.elementSetName; - event = ZOOM_Event_create(ZOOM_EVENT_RECV_SEARCH); - ZOOM_connection_put_event(c, event); - + if (!c->tasks->u.search.recv_search_fired) + { + event = ZOOM_Event_create(ZOOM_EVENT_RECV_SEARCH); + ZOOM_connection_put_event(c, event); + c->tasks->u.search.recv_search_fired = 1; + } break; case ZOOM_TASK_RETRIEVE: resultset = c->tasks->u.retrieve.resultset; @@ -4682,6 +4693,7 @@ ZOOM_API(int) ZOOM_connection_get_timeout(ZOOM_connection c) /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab