-rw-r--r-- | noncore/apps/opie-reader/ZText.h | 3 | ||||
-rw-r--r-- | noncore/apps/opie-reader/ztxt.h | 27 |
2 files changed, 16 insertions, 14 deletions
diff --git a/noncore/apps/opie-reader/ZText.h b/noncore/apps/opie-reader/ZText.h index 2848af7..4b1b96e 100644 --- a/noncore/apps/opie-reader/ZText.h +++ b/noncore/apps/opie-reader/ZText.h @@ -1,35 +1,36 @@ #ifndef __Text_h #define __Text_h #include <stdio.h> -#include <zlib.h> +#include "zlib/zlib.h" +//#include <zlib.h> #include <sys/stat.h> #include "CExpander.h" class Text: public CExpander { gzFile file; unsigned long fsize; public: Text() : file(NULL) {}; virtual ~Text() { if (file != NULL) gzclose(file); } virtual int openfile(const char *src) { if (file != NULL) gzclose(file); struct stat _stat; stat(src,&_stat); fsize = _stat.st_size; return ((file = gzopen(src,"rb")) == NULL); } virtual int getch() { return gzgetc(file); } virtual unsigned int locate() { return gztell(file); } virtual void locate(unsigned int n) { gzseek(file,n,SEEK_SET); } virtual bool hasrandomaccess() { return true; } virtual void sizes(unsigned long& _file, unsigned long& _text) { _text = _file = fsize; } }; #endif diff --git a/noncore/apps/opie-reader/ztxt.h b/noncore/apps/opie-reader/ztxt.h index b8ad29c..6352cfc 100644 --- a/noncore/apps/opie-reader/ztxt.h +++ b/noncore/apps/opie-reader/ztxt.h @@ -1,37 +1,38 @@ #ifndef __ztxt_h #define __ztxt_h #include "CExpander.h" -#include <zlib.h> +#include "zlib/zlib.h" +//#include <zlib.h> #include "pdb.h" /* * Stuff common to both Weasel Reader and makeztxt * * $Id$ * */ #ifndef _WEASEL_COMMON_H_ #define _WEASEL_COMMON_H_ 1 /* Padding is no good */ #if defined(__GNUC__) && defined(__UNIX__) # pragma pack(2) #endif /* The default creator is Weasel Reader 'GPlm' */ #define GPLM_CREATOR_ID "GPlm" /* Databases of type 'zTXT' */ #define ZTXT_TYPE_ID "zTXT" /* Size of one database record */ #define RECORD_SIZE 8192 /* Allow largest WBIT size for data. Lower with command line options in makeztxt */ #define MAXWBITS 15 /* Max length for a bookmark/annotation title */ #define MAX_BMRK_LENGTH 20 /***************************************************** * This is the zTXT document header (record #0) * @@ -47,56 +48,56 @@ typedef struct zTXT_record0Type { UInt16 numAnnotations; /* Number of annotation records */ UInt16 annotationRecord; /* Record # of annotation index */ UInt8 randomAccess; /* 1 if compressed w/Z_FULL_FLUSH */ UInt8 padding[0x20 - 19]; /* Pad to a size of 0x20 bytes */ } zTXT_record0; struct zTXTbkmk { UInt32 offset; tchar title[MAX_BMRK_LENGTH]; }; #endif const UInt32 ZTXT_ID = 0x5458547a; class ztxt : public CExpander, Cpdb { bool bInit; UInt32 buffersize; UInt32 buffercontent; UInt8* expandedtextbuffer; UInt8* compressedtextbuffer; z_stream zstream; size_t bufferpos; UInt16 bufferrec; zTXT_record0 hdr0; size_t currentpos; void home(); public: virtual void sizes(unsigned long& _file, unsigned long& _text) - { - _file = file_length; - _text = ntohl(hdr0.size); - } + { + _file = file_length; + _text = ntohl(hdr0.size); + } virtual bool hasrandomaccess() { return (hdr0.randomAccess != 0); } virtual ~ztxt() - { - if (expandedtextbuffer != NULL) delete [] expandedtextbuffer; - if (compressedtextbuffer != NULL) delete [] compressedtextbuffer; - if (bInit) - { - inflateEnd(&zstream); - } - } + { + if (expandedtextbuffer != NULL) delete [] expandedtextbuffer; + if (compressedtextbuffer != NULL) delete [] compressedtextbuffer; + if (bInit) + { + inflateEnd(&zstream); + } + } ztxt(); virtual int openfile(const char *src); virtual int getch(); virtual unsigned int locate(); virtual void locate(unsigned int n); virtual CList<Bkmk>* getbkmklist(); }; #endif |