127 for (loop1 = 0; loop1 < 2; loop1++) {
156 *start = *size = *buffnum = 0;
160 testmt = ((
idxfp[0]) ? 1:2);
164 if (
compfp[testmt-1]->getFd() < 1)
168 if (newOffset == idxoff) {
169 if (
compfp[testmt-1]->read(&ulBuffNum, 4) != 4) {
170 fprintf(stderr,
"Error reading ulBuffNum\n");
176 if (
compfp[testmt-1]->read(&ulVerseStart, 4) < 4)
178 fprintf(stderr,
"Error reading ulVerseStart\n");
181 if (
compfp[testmt-1]->read(&usVerseSize, 4) < 4)
183 fprintf(stderr,
"Error reading usVerseSize\n");
210 testmt = ((
idxfp[0]) ? 1:2);
214 if (
compfp[testmt-1]->getFd() < 1)
221 if (
idxfp[testmt-1]->seek(ulBuffNum*12,
SEEK_SET)!=(long) ulBuffNum*12)
223 fprintf(stderr,
"Error seeking compressed file index\n");
226 if (
idxfp[testmt-1]->read(&ulCompOffset, 4)<4)
228 fprintf(stderr,
"Error reading ulCompOffset\n");
231 if (
idxfp[testmt-1]->read(&ulCompSize, 4)<4)
233 fprintf(stderr,
"Error reading ulCompSize\n");
236 if (
idxfp[testmt-1]->read(&ulUnCompSize, 4)<4)
238 fprintf(stderr,
"Error reading ulUnCompSize\n");
246 if (
textfp[testmt-1]->seek(ulCompOffset,
SEEK_SET)!=(
long)ulCompOffset)
248 fprintf(stderr,
"Error: could not seek to right place in compressed text\n");
252 pcCompText.
setSize(ulCompSize+5);
254 if (
textfp[testmt-1]->read(pcCompText.
getRawData(), ulCompSize)<(
long)ulCompSize) {
255 fprintf(stderr,
"Error reading compressed text\n");
258 pcCompText.
setSize(ulCompSize);
261 unsigned long bufSize = ulCompSize;
269 unsigned long len = 0;
271 cacheBuf = (
char *)calloc(len + 1, 1);
299 len = (len < 0) ? strlen(buf) : len;
301 testmt = ((
idxfp[0]) ? 1:2);
307 cacheBuf = (
char *)calloc(len + 1, 1);
323 start = outBufIdx = 0;
349 unsigned long tmpSize;
351 outzsize = zsize = (
SW_u32)tmpSize;
356 outzsize = zsize = (
SW_u32)tmpSize;
397 testmt = ((
idxfp[1]) ? 1:2);
423 char *buf =
new char [ strlen (ipath) + 20 ];
432 if ((path[strlen(path)-1] ==
'/') || (path[strlen(path)-1] ==
'\\'))
433 path[strlen(path)-1] = 0;
438 if (fd->
getFd() < 1)
goto erroropen1;
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;
467 if (fd2->
getFd() < 1)
goto erroropen2;
477 if (fd->
write(&offset, 4) != 4)
goto writefailure;
478 if (fd->
write(&offset, 4) != 4)
goto writefailure;
479 if (fd->
write(&size, 4) != 4)
goto writefailure;
482 if (fd2->
write(&offset, 4) != 4)
goto writefailure;
483 if (fd2->
write(&offset, 4) != 4)
goto writefailure;
484 if (fd2->
write(&size, 4) != 4)
goto writefailure;
487 fd2->
write(&offset, 4);
488 fd2->
write(&offset, 4);
489 fd2->
write(&size, 4);
void setFillByte(char ch)
virtual void rawZFilter(SWBuf &buf, char direction=0) const
void findOffset(char testmt, long idxoff, long *start, unsigned long *size, unsigned long *buffnum) const
#define SWORD_NAMESPACE_START
long seek(long offset, int whence)
FileDesc * open(const char *path, int mode, bool tryDowngrade)
static unsigned int RDONLY
virtual void setCompressedBuf(unsigned long *len, char *buf=0)
virtual char * getCompressedBuf(unsigned long *len=0)
void doSetText(char testmt, long idxoff, const char *buf, long len=0)
static char createModule(const char *path, int blockBound, const char *v11n="KJV")
void doLinkEntry(char testmt, long destidxoff, long srcidxoff)
long write(const void *buf, long count)
virtual char * getUncompressedBuf(unsigned long *len=0)
zVerse4(const char *ipath, int fileMode=-1, int blockType=CHAPTERBLOCKS, SWCompress *icomp=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)
void zReadText(char testmt, long start, unsigned long size, unsigned long buffnum, SWBuf &buf) const
const char * c_str() const
virtual void setVersificationSystem(const char *name)
static int removeFile(const char *fName)
static unsigned int CREAT
unsigned int cacheBufSize
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 setSize(unsigned long len)
virtual char getTestament() const
static FileMgr * getSystemFileMgr()