From: Adam Dickmeiss Date: Fri, 19 Oct 2012 09:42:28 +0000 (+0200) Subject: ZOOM C: don't trust recordPosition always X-Git-Tag: v4.2.43~2 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=d1901517142aca48c48ee87072cad5b5e0d9f6b4;p=yaz-moved-to-github.git ZOOM C: don't trust recordPosition always Some servers, such as IGI global's SRU service uses a recordPosition scheme starting from zero. First record's position should be one according to the standard. --- diff --git a/src/zoom-sru.c b/src/zoom-sru.c index 87de7c3..687ca83 100644 --- a/src/zoom-sru.c +++ b/src/zoom-sru.c @@ -313,7 +313,7 @@ static zoom_ret handle_srw_response(ZOOM_connection c, } for (i = 0; inum_records; i++) { - int pos; + int pos = *start + i; Z_SRW_record *sru_rec; Z_SRW_diagnostic *diag = 0; int num_diag; @@ -321,12 +321,10 @@ static zoom_ret handle_srw_response(ZOOM_connection c, Z_NamePlusRecord *npr = (Z_NamePlusRecord *) odr_malloc(c->odr_in, sizeof(Z_NamePlusRecord)); - /* recordPosition is 1 based */ + /* only trust recordPosition if >= calculated position */ if (res->records[i].recordPosition && - *res->records[i].recordPosition > 0) + *res->records[i].recordPosition >= pos + 1) pos = *res->records[i].recordPosition - 1; - else - pos = *start + i; sru_rec = &res->records[i];