From f422693382524b11066ec4129ca9213effdb893a Mon Sep 17 00:00:00 2001 From: Sebastian Hammer Date: Tue, 20 Oct 1998 13:55:37 +0000 Subject: [PATCH] Fixed Scan bug in asn and client --- asn/proto.c | 25 +++++++++++++++++++++++-- client/client.c | 21 +++++---------------- include/proto.h | 16 +++++++++++++++- 3 files changed, 43 insertions(+), 19 deletions(-) diff --git a/asn/proto.c b/asn/proto.c index f65ad32..18c4bf7 100644 --- a/asn/proto.c +++ b/asn/proto.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: proto.c,v $ - * Revision 1.56 1998-08-19 16:10:04 adam + * Revision 1.57 1998-10-20 13:55:37 quinn + * Fixed Scan bug in asn and client + * + * Revision 1.56 1998/08/19 16:10:04 adam * Changed som member names of DeleteResultSetRequest/Response. * * Revision 1.55 1998/02/11 11:53:32 adam @@ -1202,6 +1205,8 @@ int z_Entry(ODR o, Z_Entry **p, int opt) return opt && odr_ok(o); } +#ifdef BUGGY_LISTENTRIES + int z_Entries(ODR o, Z_Entries **p, int opt) { if (o->direction == ODR_DECODE) @@ -1237,6 +1242,22 @@ int z_ListEntries(ODR o, Z_ListEntries **p, int opt) return opt && odr_ok(o); } +#endif + +int z_ListEntries (ODR o, Z_ListEntries **p, int opt) +{ + if (!odr_sequence_begin (o, p, sizeof(**p))) + return opt && odr_ok (o); + return + odr_implicit_settag (o, ODR_CONTEXT, 1) && + (odr_sequence_of(o, (Odr_fun) z_Entry, &(*p)->entries, + &(*p)->num_entries) || odr_ok(o)) && + odr_implicit_settag (o, ODR_CONTEXT, 2) && + (odr_sequence_of(o, (Odr_fun) z_DiagRec, &(*p)->nonsurrogateDiagnostics, + &(*p)->num_nonsurrogateDiagnostics) || odr_ok(o)) && + odr_sequence_end (o); +} + int z_ScanRequest(ODR o, Z_ScanRequest **p, int opt) { if (!odr_sequence_begin(o, p, sizeof(**p))) @@ -1270,7 +1291,7 @@ int z_ScanResponse(ODR o, Z_ScanResponse **p, int opt) odr_implicit(o, odr_integer, &(*p)->numberOfEntriesReturned, ODR_CONTEXT, 5, 0) && odr_implicit(o, odr_integer, &(*p)->positionOfTerm, ODR_CONTEXT, 6, 1)&& - odr_explicit(o, z_ListEntries, &(*p)->entries, ODR_CONTEXT, 7, 1) && + odr_implicit(o, z_ListEntries, &(*p)->entries, ODR_CONTEXT, 7, 1) && odr_implicit(o, odr_oid, &(*p)->attributeSet, ODR_CONTEXT, 8, 1) && z_OtherInformation(o, &(*p)->otherInfo, 1) && odr_sequence_end(o); diff --git a/client/client.c b/client/client.c index ad12a29..d813167 100644 --- a/client/client.c +++ b/client/client.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: client.c,v $ - * Revision 1.72 1998-10-20 13:23:15 quinn + * Revision 1.73 1998-10-20 13:55:43 quinn + * Fixed Scan bug in asn and client + * + * Revision 1.72 1998/10/20 13:23:15 quinn * changed preferred pos to 1 * * Revision 1.71 1998/10/20 13:21:43 adam @@ -1579,16 +1582,8 @@ void process_scanResponse(Z_ScanResponse *res) printf("Scan returned code %d\n", *res->scanStatus); if (!res->entries) return; -#ifdef ASN_COMPILED if ((entries = res->entries->entries)) num_entries = res->entries->num_entries; -#else - if (res->entries->which == Z_ListEntries_entries) - { - entries = res->entries->u.entries->entries; - num_entries = res->entries->u.entries->num_entries; - } -#endif for (i = 0; i < num_entries; i++) { int pos_term = res->positionOfTerm ? *res->positionOfTerm : -1; @@ -1600,15 +1595,9 @@ void process_scanResponse(Z_ScanResponse *res) else display_diagrecs(&entries[i]->u.surrogateDiagnostic, 1); } -#ifdef ASN_COMPILED if (res->entries->nonsurrogateDiagnostics) display_diagrecs (res->entries->nonsurrogateDiagnostics, res->entries->num_nonsurrogateDiagnostics); -#else - if (res->entries->which == Z_ListEntries_nonSurrogateDiagnostics) - display_diagrecs(&res->entries-> - u.nonSurrogateDiagnostics->diagRecs[0], 1); -#endif } void process_sortResponse(Z_SortResponse *res) @@ -1683,7 +1672,7 @@ int cmd_scan(char *arg) } if (*arg) { - if (send_scanrequest(arg, 1 20) < 0) + if (send_scanrequest(arg, 1, 20) < 0) return 0; } else diff --git a/include/proto.h b/include/proto.h index c476c9a..96ab94b 100644 --- a/include/proto.h +++ b/include/proto.h @@ -24,7 +24,10 @@ * OF THIS SOFTWARE. * * $Log: proto.h,v $ - * Revision 1.45 1998-08-19 16:10:07 adam + * Revision 1.46 1998-10-20 13:55:44 quinn + * Fixed Scan bug in asn and client + * + * Revision 1.45 1998/08/19 16:10:07 adam * Changed som member names of DeleteResultSetRequest/Response. * * Revision 1.44 1998/05/18 10:14:08 adam @@ -946,6 +949,8 @@ typedef struct Z_Entry } u; } Z_Entry; +#ifdef BUGGY_LISTENTRIES + typedef struct Z_Entries { int num_entries; @@ -964,6 +969,15 @@ typedef struct Z_ListEntries } u; } Z_ListEntries; +#endif + +typedef struct Z_ListEntries { + int num_entries; + Z_Entry **entries; /* OPT */ + int num_nonsurrogateDiagnostics; + Z_DiagRec **nonsurrogateDiagnostics; /* OPT */ +} Z_ListEntries; + typedef struct Z_ScanRequest { Z_ReferenceId *referenceId; /* OPTIONAL */ -- 1.7.10.4