[sword-cvs] sword/src/modules/comments/rawfiles rawfiles.cpp,1.25,1.26
sword@www.crosswire.org
sword@www.crosswire.org
Mon, 24 Feb 2003 21:12:49 -0700
Update of /usr/local/cvsroot/sword/src/modules/comments/rawfiles
In directory www:/tmp/cvs-serv2325/src/modules/comments/rawfiles
Modified Files:
rawfiles.cpp
Log Message:
no message
Index: rawfiles.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/comments/rawfiles/rawfiles.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** rawfiles.cpp 1 Oct 2002 19:52:40 -0000 1.25
--- rawfiles.cpp 25 Feb 2003 04:12:47 -0000 1.26
***************
*** 57,61 ****
*/
! char *RawFiles::getRawEntry() {
FileDesc *datafile;
long start = 0;
--- 57,61 ----
*/
! SWBuf &RawFiles::getRawEntryBuf() {
FileDesc *datafile;
long start = 0;
***************
*** 75,114 ****
key = new VerseKey(this->key);
! findoffset(key->Testament(), key->Index(), &start, &size);
!
! if (entrybuf)
! delete [] entrybuf;
if (size) {
! tmpbuf = new char [ (size + 2) + strlen(path) + 5 ];
! sprintf(tmpbuf,"%s/",path);
! readtext(key->Testament(), start, (size + 2), tmpbuf+strlen(tmpbuf));
! datafile = FileMgr::systemFileMgr.open(tmpbuf, O_RDONLY|O_BINARY);
! delete [] tmpbuf;
if (datafile->getFd() > 0) {
size = lseek(datafile->getFd(), 0, SEEK_END);
! entrybuf = new char [ size * FILTERPAD ];
! memset(entrybuf, 0, size * FILTERPAD);
lseek(datafile->getFd(), 0, SEEK_SET);
! read(datafile->getFd(), entrybuf, size);
// preptext(entrybuf);
}
- else {
- entrybuf = new char [2];
- entrybuf[0] = 0;
- entrybuf[1] = 0;
- }
FileMgr::systemFileMgr.close(datafile);
}
- else {
- entrybuf = new char [2];
- entrybuf[0] = 0;
- entrybuf[1] = 0;
- }
if (key != this->key)
delete key;
! return entrybuf;
}
--- 75,105 ----
key = new VerseKey(this->key);
! findOffset(key->Testament(), key->Index(), &start, &size);
+ entryBuf = "";
if (size) {
! SWBuf tmpbuf = path;
! tmpbuf += '/';
! readText(key->Testament(), start, size, entryBuf);
! tmpbuf += entryBuf;
! entryBuf = "";
! datafile = FileMgr::systemFileMgr.open(tmpbuf.c_str(), O_RDONLY|O_BINARY);
if (datafile->getFd() > 0) {
size = lseek(datafile->getFd(), 0, SEEK_END);
! char *tmpBuf = new char [ size + 1 ];
! memset(tmpBuf, 0, size + 1);
lseek(datafile->getFd(), 0, SEEK_SET);
! read(datafile->getFd(), tmpBuf, size);
! entryBuf = tmpBuf;
! delete [] tmpBuf;
// preptext(entrybuf);
}
FileMgr::systemFileMgr.close(datafile);
}
if (key != this->key)
delete key;
! return entryBuf;
}
***************
*** 134,148 ****
key = new VerseKey(this->key);
! findoffset(key->Testament(), key->Index(), &start, &size);
if (size) {
tmpbuf = new char [ (size + 3) + strlen(path) + 1 ];
sprintf(tmpbuf, "%s/", path);
! readtext(key->Testament(), start, (size + 2), tmpbuf+strlen(tmpbuf));
}
else {
tmpbuf = new char [ 16 + strlen(path) + 1 ];
! sprintf(tmpbuf, "%s/%s", path, getnextfilename());
! settext(key->Testament(), key->Index(), tmpbuf+strlen(path)+1);
}
datafile = FileMgr::systemFileMgr.open(tmpbuf, O_CREAT|O_WRONLY|O_BINARY|O_TRUNC);
--- 125,139 ----
key = new VerseKey(this->key);
! findOffset(key->Testament(), key->Index(), &start, &size);
if (size) {
tmpbuf = new char [ (size + 3) + strlen(path) + 1 ];
sprintf(tmpbuf, "%s/", path);
! readText(key->Testament(), start, (size + 2), tmpbuf+strlen(tmpbuf));
}
else {
tmpbuf = new char [ 16 + strlen(path) + 1 ];
! sprintf(tmpbuf, "%s/%s", path, getNextFilename());
! doSetText(key->Testament(), key->Index(), tmpbuf+strlen(path)+1);
}
datafile = FileMgr::systemFileMgr.open(tmpbuf, O_CREAT|O_WRONLY|O_BINARY|O_TRUNC);
***************
*** 179,187 ****
key = new VerseKey(this->key);
! findoffset(key->Testament(), key->Index(), &start, &size);
if (size) {
tmpbuf = new char [ size + 2];
! readtext(key->Testament(), start, size + 2, tmpbuf);
if (key != inkey)
--- 170,178 ----
key = new VerseKey(this->key);
! findOffset(key->Testament(), key->Index(), &start, &size);
if (size) {
tmpbuf = new char [ size + 2];
! readText(key->Testament(), start, size + 2, tmpbuf);
if (key != inkey)
***************
*** 195,199 ****
if (!key)
key = new VerseKey(this->key);
! settext(key->Testament(), key->Index(), tmpbuf);
}
--- 186,190 ----
if (!key)
key = new VerseKey(this->key);
! doSetText(key->Testament(), key->Index(), tmpbuf);
}
***************
*** 224,228 ****
key = new VerseKey(this->key);
! settext(key->Testament(), key->Index(), "");
if (key != this->key)
--- 215,219 ----
key = new VerseKey(this->key);
! doSetText(key->Testament(), key->Index(), "");
if (key != this->key)
***************
*** 232,236 ****
/******************************************************************************
! * RawFiles::getnextfilename - generates a valid filename in which to store
* an entry
*
--- 223,227 ----
/******************************************************************************
! * RawFiles::getNextfilename - generates a valid filename in which to store
* an entry
*
***************
*** 238,242 ****
*/
! char *RawFiles::getnextfilename() {
static char incfile[255];
long number;
--- 229,233 ----
*/
! char *RawFiles::getNextFilename() {
static char incfile[255];
long number;