aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2018-09-17 14:12:30 +0300
committerSergey Poznyakoff <gray@gnu.org>2018-09-17 14:12:30 +0300
commit30b92fe184a0356557ea40a756f308c0281aa0bc (patch)
tree639be52bcdbe0dc05663283fb792ee8ab5c41d7e
parent1c5e14432740e8af3a42e5e83a396e82221499ad (diff)
downloaddico-30b92fe184a0356557ea40a756f308c0281aa0bc.tar.gz
dico-30b92fe184a0356557ea40a756f308c0281aa0bc.tar.bz2
dictorg: bugfix
* modules/dict.org/dictorg.c (uniq_comp): Fix comparison. (common_match): Give the third argument to compare. * modules/dict.org/Makefile.am (dictorg_la_SOURCES): Remove data.c * modules/dict.org/data.c: Remove unused file.
-rw-r--r--modules/dict.org/Makefile.am1
-rw-r--r--modules/dict.org/data.c42
-rw-r--r--modules/dict.org/dictorg.c18
3 files changed, 4 insertions, 57 deletions
diff --git a/modules/dict.org/Makefile.am b/modules/dict.org/Makefile.am
index af54a3a..a991605 100644
--- a/modules/dict.org/Makefile.am
+++ b/modules/dict.org/Makefile.am
@@ -20,7 +20,6 @@ mod_LTLIBRARIES=dictorg.la
dictorg_la_SOURCES = \
crc.c\
- data.c\
dictorg.c\
dictstr.c
diff --git a/modules/dict.org/data.c b/modules/dict.org/data.c
deleted file mode 100644
index 1288b80..0000000
--- a/modules/dict.org/data.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* This file is part of GNU Dico.
- Copyright (C) 2008-2018 Sergey Poznyakoff
-
- GNU Dico is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- GNU Dico is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNU Dico. If not, see <http://www.gnu.org/licenses/>. */
-
-#include "dictorg.h"
-#include <zlib.h>
-
-struct dictorg_data {
- int type;
- const char *filename;
- z_stream zStream;
- int initialized;
-
- int headerLength;
- int method;
- int flags;
- time_t mtime;
- int extraFlags;
- int os;
- int version;
- int chunkLength;
- int chunkCount;
- int *chunks;
- unsigned long *offsets; /* Sum-scan of chunks. */
- const char *origFilename;
- const char *comment;
- unsigned long crc;
- unsigned long length;
- unsigned long compressedLength;
-};
diff --git a/modules/dict.org/dictorg.c b/modules/dict.org/dictorg.c
index bec219a..c00514d 100644
--- a/modules/dict.org/dictorg.c
+++ b/modules/dict.org/dictorg.c
@@ -625,19 +625,9 @@ uniq_comp(const void *a, const void *b, void *closure)
const struct index_entry *epa = a;
const struct index_entry *epb = b;
struct dictdb *db = closure;
-
- /* Entries differ if their headwords differ */
- if (headword_compare(epa->word, epb->word, db))
- return 1;
- /* Otherwise, if neither entry has the original headword, they
- are equal */
- if (!epa->orig && !epb->orig)
- return 0;
- /* If only one original headword is present, entries differ */
- if (!epa->orig || !epb->orig)
- return 1;
- /* We have both original headwords. Compare them to decide. */
- return headword_compare(epa->orig, epb->orig, db);
+ /* Prefer original headword over the indexed one. */
+ return headword_compare(epa->orig ? epa->orig : epa->word,
+ epb->orig ? epb->orig : epb->word, db);
}
static int
@@ -667,7 +657,7 @@ common_match(struct dictdb *db, const char *word,
dico_list_set_flags(res->list, DICO_LIST_COMPARE_TAIL);
}
for (; ep < db->index + db->numwords
- && compare(&x, ep, NULL) == 0; ep++)
+ && compare(&x, ep, db) == 0; ep++)
if (!RESERVED_WORD(db, ep->word))
dico_list_append(res->list, ep);
res->compare_count = compare_count;

Return to:

Send suggestions and report system problems to the System administrator.