X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Frpnscan.c;h=242ab454eae83aa16db30e714f0938ff426a94ed;hb=951a16f58a1372353a1c85ef9e162ddbe84bbff6;hp=1e547214011050b734eca8a3cd35c478d1c22a35;hpb=3e4a78274a6cb7a99f3e90967ea30c830ffbf8c3;p=idzebra-moved-to-github.git diff --git a/index/rpnscan.c b/index/rpnscan.c index 1e54721..242ab45 100644 --- a/index/rpnscan.c +++ b/index/rpnscan.c @@ -1,4 +1,4 @@ -/* $Id: rpnscan.c,v 1.6 2007-03-19 21:50:39 adam Exp $ +/* $Id: rpnscan.c,v 1.10 2007-05-08 14:49:38 adam Exp $ Copyright (C) 1995-2007 Index Data ApS @@ -37,6 +37,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include #include +#include #define RPN_MAX_ORDS 32 @@ -242,7 +243,11 @@ static ZEBRA_RES rpn_scan_ver2(ZebraHandle zh, ODR stream, NMEM nmem, if (trans_scan_term(zh, zapt, termz+prefix_len, index_type) == ZEBRA_FAIL) + { + for (i = 0; i < ord_no; i++) + wrbuf_destroy(ar[i].term); return ZEBRA_FAIL; + } wrbuf_rewind(ar[i].term); wrbuf_puts(ar[i].term, termz + prefix_len); ar[i].isam_p = 0; @@ -360,6 +365,9 @@ static ZEBRA_RES rpn_scan_ver2(ZebraHandle zh, ODR stream, NMEM nmem, *list = glist; + for (i = 0; i < ord_no; i++) + wrbuf_destroy(ar[i].term); + return ZEBRA_OK; } @@ -376,7 +384,7 @@ struct scan_info { }; ZEBRA_RES rpn_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt, - oid_value attributeset, + const Odr_oid *attributeset, int num_bases, char **basenames, int *position, int *num_entries, ZebraScanEntry **list, int *is_partial, RSET limit_set) @@ -396,8 +404,8 @@ ZEBRA_RES rpn_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt, *list = 0; *is_partial = 0; - if (attributeset == VAL_NONE) - attributeset = VAL_BIB1; + if (!attributeset) + attributeset = yaz_oid_attset_bib_1; if (!limit_set) /* no limit set given already */ { @@ -415,7 +423,6 @@ ZEBRA_RES rpn_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt, if (termset_value_numeric != -2) { - sprintf(resname, "%d", termset_value_numeric); termset_name = resname; } @@ -423,11 +430,19 @@ ZEBRA_RES rpn_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt, termset_name = termset_value_string; limit_set = resultSetRef (zh, termset_name); + + if (!limit_set) + { + zebra_setError(zh, + YAZ_BIB1_SPECIFIED_RESULT_SET_DOES_NOT_EXIST, + termset_name); + return ZEBRA_FAIL; + } } } - yaz_log(YLOG_DEBUG, "position = %d, num = %d set=%d", - *position, *num_entries, attributeset); + yaz_log(YLOG_DEBUG, "position = %d, num = %d", + *position, *num_entries); if (zebra_maps_attr(zh->reg->zebra_maps, zapt, &index_type, &search_type, rank_type, &complete_flag, &sort_flag))