diff options
Diffstat (limited to 'src/modules/lexdict/zld')
-rw-r--r-- | src/modules/lexdict/zld/zld.cpp | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/src/modules/lexdict/zld/zld.cpp b/src/modules/lexdict/zld/zld.cpp index 71919d4..5bc0852 100644 --- a/src/modules/lexdict/zld/zld.cpp +++ b/src/modules/lexdict/zld/zld.cpp @@ -3,7 +3,7 @@ * zld.cpp - code for class 'zLD'- a module that reads zlib compressed * lexicon and dictionary files * - * $Id: zld.cpp 2980 2013-09-14 21:51:47Z scribe $ + * $Id: zld.cpp 3515 2017-11-01 11:38:09Z scribe $ * * Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -90,7 +90,7 @@ char zLD::getEntry(long away) const { rawFilter(entryBuf, key); - entrySize = size; // support getEntrySize call + entrySize = (int)size; // support getEntrySize call if (!key->isPersist()) // If we have our own key *key = idxbuf; // reset it to entry index buffer @@ -144,12 +144,26 @@ void zLD::increment(int steps) { void zLD::setEntry(const char *inbuf, long len) { - setText(*key, inbuf, len); + char *buf = new char [ strlen(*key) + 6 ]; + strcpy(buf, *key); + + if (strongsPadding) strongsPad(buf); + + setText(buf, inbuf, len); + + delete [] buf; } void zLD::linkEntry(const SWKey *inkey) { - zStr::linkEntry(*key, *inkey); + char *buf = new char [ strlen(*key) + 6 ]; + strcpy(buf, *key); + + if (strongsPadding) strongsPad(buf); + + zStr::linkEntry(buf, *inkey); + + delete [] buf; } @@ -160,13 +174,20 @@ void zLD::linkEntry(const SWKey *inkey) { */ void zLD::deleteEntry() { - setText(*key, ""); + char *buf = new char [ strlen(*key) + 6 ]; + strcpy(buf, *key); + + if (strongsPadding) strongsPad(buf); + + setText(buf, ""); + + delete [] buf; } long zLD::getEntryCount() const { - if (idxfd < 0) return 0; + if (!idxfd || idxfd->getFd() < 0) return 0; return idxfd->seek(0, SEEK_END) / IDXENTRYSIZE; } |