From 774c155f12ee6473f38ece849a401dd8426178d3 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 30 Oct 1995 15:08:08 +0000 Subject: [PATCH] Bug fixes. --- index/kcompare.c | 21 +++++++++++++-------- index/zsets.c | 7 +++++-- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/index/kcompare.c b/index/kcompare.c index c32998e..b5b3b63 100644 --- a/index/kcompare.c +++ b/index/kcompare.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: kcompare.c,v $ - * Revision 1.13 1995-10-27 14:00:11 adam + * Revision 1.14 1995-10-30 15:08:08 adam + * Bug fixes. + * + * Revision 1.13 1995/10/27 14:00:11 adam * Implemented detection of database availability. * * Revision 1.12 1995/10/17 18:02:08 adam @@ -70,26 +73,28 @@ void key_logdump (int logmask, const void *p) int key_compare (const void *p1, const void *p2) { - const struct it_key *i1 = p1, *i2 = p2; - if (i1->sysno != i2->sysno) + struct it_key i1, i2; + memcpy (&i1, p1, sizeof(i1)); + memcpy (&i2, p2, sizeof(i2)); + if (i1.sysno != i2.sysno) { - if (i1->sysno > i2->sysno) + if (i1.sysno > i2.sysno) return 2; else return -2; } #if IT_KEY_HAVE_SEQNO - if (i1->seqno != i2->seqno) + if (i1.seqno != i2.seqno) { - if (i1->seqno > i2->seqno) + if (i1.seqno > i2.seqno) return 1; else return -1; } #else - if (i1->freq != i2->freq) + if (i1.freq != i2.freq) { - if (i1->freq > i2->freq) + if (i1.freq > i2.freq) return 1; else return -1; diff --git a/index/zsets.c b/index/zsets.c index f4f21e8..9cb1ca6 100644 --- a/index/zsets.c +++ b/index/zsets.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: zsets.c,v $ - * Revision 1.9 1995-10-17 18:02:14 adam + * Revision 1.10 1995-10-30 15:08:08 adam + * Bug fixes. + * + * Revision 1.9 1995/10/17 18:02:14 adam * New feature: databases. Implemented as prefix to words in dictionary. * * Revision 1.8 1995/10/10 13:59:25 adam @@ -101,11 +104,11 @@ ZServerSetSysno *resultSetSysnoGet (ZServerInfo *zi, const char *name, { psysno = key.sysno; position++; + assert (num_i < num); if (position == positions[num_i]) { sr[num_i].sysno = psysno; rset_score (rset, rfd, &sr[num_i].score); - num_i++; if (++num_i == num) break; } -- 1.7.10.4