[sword-cvs] sword/src/modules/texts/rawtext rawtext.cpp,1.60,1.61
sword@www.crosswire.org
sword@www.crosswire.org
Tue, 25 Feb 2003 20:23:46 -0700
Update of /usr/local/cvsroot/sword/src/modules/texts/rawtext
In directory www:/tmp/cvs-serv30129/src/modules/texts/rawtext
Modified Files:
rawtext.cpp
Log Message:
no message
Index: rawtext.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/texts/rawtext/rawtext.cpp,v
retrieving revision 1.60
retrieving revision 1.61
diff -C2 -d -r1.60 -r1.61
*** rawtext.cpp 27 Jan 2003 03:23:26 -0000 1.60
--- rawtext.cpp 26 Feb 2003 03:23:44 -0000 1.61
***************
*** 118,148 ****
*/
! char *RawText::getRawEntry() {
long start = 0;
unsigned short size = 0;
VerseKey &key = getVerseKey();
! findoffset(key.Testament(), key.Index(), &start, &size);
entrySize = size; // support getEntrySize call
! unsigned long newsize = (size + 2) * FILTERPAD;
! if (newsize > entrybufallocsize) {
! if (entrybuf)
! delete [] entrybuf;
! entrybuf = new char [ newsize ];
! entrybufallocsize = newsize;
! }
! *entrybuf = 0;
!
! readtext(key.Testament(), start, (size + 2), entrybuf);
! entrybuf[size] = 0;
! rawFilter(entrybuf, size, 0); // hack, decipher
! rawFilter(entrybuf, size*FILTERPAD, &key);
if (!isUnicode())
! preptext(entrybuf);
! return entrybuf;
}
--- 118,139 ----
*/
! SWBuf &RawText::getRawEntryBuf() {
long start = 0;
unsigned short size = 0;
VerseKey &key = getVerseKey();
! findOffset(key.Testament(), key.Index(), &start, &size);
entrySize = size; // support getEntrySize call
! entryBuf = "";
! readText(key.Testament(), start, size, entryBuf);
! rawFilter(entryBuf, 0); // hack, decipher
! rawFilter(entryBuf, &key);
if (!isUnicode())
! prepText(entryBuf);
! return entryBuf;
}
***************
*** 336,340 ****
unsigned short size;
char *idxbuf = 0;
! char *datbuf = 0;
list <long> indexes;
list <long> indexes2;
--- 327,331 ----
unsigned short size;
char *idxbuf = 0;
! SWBuf datBuf;
list <long> indexes;
list <long> indexes2;
***************
*** 381,388 ****
// find our word in the database and jump ahead _away_
! error = fastSearch[j]->findoffset(words[i], &start, &size, away);
// get the word from the database
! fastSearch[j]->getidxbufdat(start, &idxbuf);
// check to see if it starts with our target word
--- 372,379 ----
// find our word in the database and jump ahead _away_
! error = fastSearch[j]->findOffset(words[i], &start, &size, away);
// get the word from the database
! fastSearch[j]->getIDXBufDat(start, &idxbuf);
// check to see if it starts with our target word
***************
*** 395,400 ****
free(idxbuf);
idxbuf = 0;
! datbuf = 0;
! fastSearch[j]->readtext(start, &size, &idxbuf, &datbuf);
// we know that the data consists of sizof(long)
--- 386,391 ----
free(idxbuf);
idxbuf = 0;
! datBuf = "";
! fastSearch[j]->readText(start, &size, &idxbuf, datBuf);
// we know that the data consists of sizof(long)
***************
*** 403,408 ****
//
// iterate thru each of these module positions
! long *keyindex = (long *)datbuf;
! while (keyindex < (long *)(datbuf + size - (strlen(idxbuf) + 1))) {
if (i) { // if we're not on our first word
--- 394,399 ----
//
// iterate thru each of these module positions
! long *keyindex = (long *)datBuf.getRawData();
! while (keyindex < (long *)(datBuf.getRawData() + size - (strlen(idxbuf) + 1))) {
if (i) { // if we're not on our first word
***************
*** 416,420 ****
keyindex++;
}
- free(datbuf);
}
else error = 1; // no more matches
--- 407,410 ----
***************
*** 481,485 ****
void RawText::setEntry(const char *inbuf, long len) {
VerseKey &key = getVerseKey();
! settext(key.Testament(), key.Index(), inbuf, len);
}
--- 471,475 ----
void RawText::setEntry(const char *inbuf, long len) {
VerseKey &key = getVerseKey();
! doSetText(key.Testament(), key.Index(), inbuf, len);
}
***************
*** 498,502 ****
srckey = new VerseKey(inkey);
! linkentry(destkey.Testament(), destkey.Index(), srckey->Index());
if (inkey != srckey) // free our key if we created a VerseKey
--- 488,492 ----
srckey = new VerseKey(inkey);
! doLinkEntry(destkey.Testament(), destkey.Index(), srckey->Index());
if (inkey != srckey) // free our key if we created a VerseKey
***************
*** 513,517 ****
void RawText::deleteEntry() {
VerseKey &key = getVerseKey();
! settext(key.Testament(), key.Index(), "");
}
--- 503,507 ----
void RawText::deleteEntry() {
VerseKey &key = getVerseKey();
! doSetText(key.Testament(), key.Index(), "");
}
***************
*** 529,533 ****
VerseKey *tmpkey = &getVerseKey();
! findoffset(tmpkey->Testament(), tmpkey->Index(), &start, &size);
SWKey lastgood = *tmpkey;
--- 519,523 ----
VerseKey *tmpkey = &getVerseKey();
! findOffset(tmpkey->Testament(), tmpkey->Index(), &start, &size);
SWKey lastgood = *tmpkey;
***************
*** 544,548 ****
}
long index = tmpkey->Index();
! findoffset(tmpkey->Testament(), index, &start, &size);
if (
(((laststart != start) || (lastsize != size)) // we're a different entry
--- 534,538 ----
}
long index = tmpkey->Index();
! findOffset(tmpkey->Testament(), index, &start, &size);
if (
(((laststart != start) || (lastsize != size)) // we're a different entry