diff options
Diffstat (limited to 'src/modules/comments/hrefcom/hrefcom.cpp')
-rw-r--r-- | src/modules/comments/hrefcom/hrefcom.cpp | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/src/modules/comments/hrefcom/hrefcom.cpp b/src/modules/comments/hrefcom/hrefcom.cpp index a80e5b6..42b2745 100644 --- a/src/modules/comments/hrefcom/hrefcom.cpp +++ b/src/modules/comments/hrefcom/hrefcom.cpp @@ -15,11 +15,11 @@ #include <unistd.h> #endif -#include <string.h> #include <utilfuns.h> #include <rawverse.h> #include <hrefcom.h> +SWORD_NAMESPACE_START /****************************************************************************** * HREFCom Constructor - Initializes data for instance of HREFCom @@ -55,10 +55,9 @@ HREFCom::~HREFCom() * RET: string buffer with verse */ -char *HREFCom::getRawEntry() { +SWBuf &HREFCom::getRawEntryBuf() { long start; unsigned short size; - char *tmpbuf; VerseKey *key = 0; #ifndef _WIN32_WCE @@ -72,26 +71,20 @@ char *HREFCom::getRawEntry() { if (!key) key = new VerseKey(this->key); - findoffset(key->Testament(), key->Index(), &start, &size); + findOffset(key->Testament(), key->Index(), &start, &size); entrySize = size; // support getEntrySize call - unsigned long newsize = ((size + 2) + strlen(prefix)) * FILTERPAD; - if (newsize > entrybufallocsize) { - if (entrybuf) - delete [] entrybuf; - entrybuf = new char [ newsize ]; - entrybufallocsize = newsize; - } - tmpbuf = new char [ size + 10 ]; - - gettext(key->Testament(), start, size + 2, tmpbuf); - sprintf(entrybuf, "%s%s", prefix, tmpbuf); - preptext(entrybuf); + SWBuf tmpbuf; - delete [] tmpbuf; + readText(key->Testament(), start, size, tmpbuf); + entryBuf = prefix; + entryBuf += tmpbuf.c_str(); + prepText(entryBuf); if (key != this->key) delete key; - return entrybuf; + return entryBuf; } + +SWORD_NAMESPACE_END |