129 for (loop1 = 0; loop1 < 2; loop1++) {
158 *start = *size = *buffnum = 0;
162 testmt = ((
idxfp[0]) ? 1:2);
166 if (
compfp[testmt-1]->getFd() < 1)
170 if (newOffset == idxoff) {
171 if (
compfp[testmt-1]->read(&ulBuffNum, 4) != 4) {
172 fprintf(stderr,
"Error reading ulBuffNum\n");
178 if (
compfp[testmt-1]->read(&ulVerseStart, 4) < 2)
180 fprintf(stderr,
"Error reading ulVerseStart\n");
183 if (
compfp[testmt-1]->read(&usVerseSize, 2) < 2)
185 fprintf(stderr,
"Error reading usVerseSize\n");
212 testmt = ((
idxfp[0]) ? 1:2);
216 if (
compfp[testmt-1]->getFd() < 1)
223 if (
idxfp[testmt-1]->seek(ulBuffNum*12,
SEEK_SET)!=(long) ulBuffNum*12)
225 fprintf(stderr,
"Error seeking compressed file index\n");
228 if (
idxfp[testmt-1]->read(&ulCompOffset, 4)<4)
230 fprintf(stderr,
"Error reading ulCompOffset\n");
233 if (
idxfp[testmt-1]->read(&ulCompSize, 4)<4)
235 fprintf(stderr,
"Error reading ulCompSize\n");
238 if (
idxfp[testmt-1]->read(&ulUnCompSize, 4)<4)
240 fprintf(stderr,
"Error reading ulUnCompSize\n");
248 if (
textfp[testmt-1]->seek(ulCompOffset,
SEEK_SET)!=(
long)ulCompOffset)
250 fprintf(stderr,
"Error: could not seek to right place in compressed text\n");
254 pcCompText.
setSize(ulCompSize+5);
256 if (
textfp[testmt-1]->read(pcCompText.
getRawData(), ulCompSize)<(
long)ulCompSize) {
257 fprintf(stderr,
"Error reading compressed text\n");
260 pcCompText.
setSize(ulCompSize);
263 unsigned long bufSize = ulCompSize;
271 unsigned long len = 0;
273 cacheBuf = (
char *)calloc(len + 1, 1);
301 len = (len < 0) ? strlen(buf) : len;
303 testmt = ((
idxfp[0]) ? 1:2);
309 cacheBuf = (
char *)calloc(len + 1, 1);
325 start = outBufIdx = 0;
355 unsigned long tmpSize;
357 outzsize = zsize = (
SW_u32)tmpSize;
362 outzsize = zsize = (
SW_u32)tmpSize;
403 testmt = ((
idxfp[1]) ? 1:2);
429 char *buf =
new char [ strlen (ipath) + 20 ];
438 if ((path[strlen(path)-1] ==
'/') || (path[strlen(path)-1] ==
'\\'))
439 path[strlen(path)-1] = 0;
444 if (fd->
getFd() < 1)
goto erroropen1;
450 if (fd->
getFd() < 1)
goto erroropen1;
456 if (fd->
getFd() < 1)
goto erroropen1;
462 if (fd->
getFd() < 1)
goto erroropen1;
468 if (fd->
getFd() < 1)
goto erroropen1;
473 if (fd2->
getFd() < 1)
goto erroropen2;
483 if (fd->
write(&offset, 4) != 4)
goto writefailure;
484 if (fd->
write(&offset, 4) != 4)
goto writefailure;
485 if (fd->
write(&size, 2) != 2)
goto writefailure;
488 if (fd2->
write(&offset, 4) != 4)
goto writefailure;
489 if (fd2->
write(&offset, 4) != 4)
goto writefailure;
490 if (fd2->
write(&size, 2) != 2)
goto writefailure;
493 fd2->
write(&offset, 4);
494 fd2->
write(&offset, 4);
495 fd2->
write(&size, 2);
void doSetText(char testmt, long idxoff, const char *buf, long len=0)
void setFillByte(char ch)
#define SWORD_NAMESPACE_START
long seek(long offset, int whence)
FileDesc * open(const char *path, int mode, bool tryDowngrade)
static unsigned int RDONLY
unsigned int cacheBufSize
virtual void setCompressedBuf(unsigned long *len, char *buf=0)
virtual char * getCompressedBuf(unsigned long *len=0)
void zReadText(char testmt, long start, unsigned short size, unsigned long buffnum, SWBuf &buf) const
long write(const void *buf, long count)
virtual char * getUncompressedBuf(unsigned long *len=0)
SWORD_NAMESPACE_START char * stdstr(char **ipstr, const char *istr, unsigned int memPadFactor=1)
virtual void setUncompressedBuf(const char *buf=0, unsigned long *len=0)
void close(FileDesc *file)
virtual void setIntros(bool val)
const char * c_str() const
virtual void setVersificationSystem(const char *name)
static int removeFile(const char *fName)
zVerse(const char *ipath, int fileMode=-1, int blockType=CHAPTERBLOCKS, SWCompress *icomp=0)
void findOffset(char testmt, long idxoff, long *start, unsigned short *size, unsigned long *buffnum) const
static char createModule(const char *path, int blockBound, const char *v11n="KJV")
virtual void rawZFilter(SWBuf &buf, char direction=0) const
static unsigned int CREAT
static unsigned int IWRITE
static unsigned int WRONLY
long read(void *buf, long count)
static unsigned int IREAD
static const char uniqueIndexID[]
#define SWORD_NAMESPACE_END
SWBuf & setFormatted(const char *format,...)
void doLinkEntry(char testmt, long destidxoff, long srcidxoff)
void setSize(unsigned long len)
virtual char getTestament() const
static FileMgr * getSystemFileMgr()