summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-07-02 18:30:57 (UTC)
committer llornkcor <llornkcor>2002-07-02 18:30:57 (UTC)
commit2481ac4013794f95c53580f99b4b761142e4ee8f (patch) (unidiff)
tree4f8b61c5ab815d0d3e09d518d4cb2560d185a238
parentdf2935231cbc82bf03037453261bfcef1970de63 (diff)
downloadopie-2481ac4013794f95c53580f99b4b761142e4ee8f.zip
opie-2481ac4013794f95c53580f99b4b761142e4ee8f.tar.gz
opie-2481ac4013794f95c53580f99b4b761142e4ee8f.tar.bz2
changed zlib header includes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/ZText.h3
-rw-r--r--noncore/apps/opie-reader/ztxt.h27
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 @@
1#ifndef __Text_h 1#ifndef __Text_h
2#define __Text_h 2#define __Text_h
3#include <stdio.h> 3#include <stdio.h>
4#include <zlib.h> 4#include "zlib/zlib.h"
5//#include <zlib.h>
5#include <sys/stat.h> 6#include <sys/stat.h>
6 7
7#include "CExpander.h" 8#include "CExpander.h"
8 9
9class Text: public CExpander { 10class Text: public CExpander {
10 gzFile file; 11 gzFile file;
11 unsigned long fsize; 12 unsigned long fsize;
12public: 13public:
13 Text() : file(NULL) {}; 14 Text() : file(NULL) {};
14 virtual ~Text() 15 virtual ~Text()
15 { 16 {
16 if (file != NULL) gzclose(file); 17 if (file != NULL) gzclose(file);
17 } 18 }
18 virtual int openfile(const char *src) 19 virtual int openfile(const char *src)
19 { 20 {
20 if (file != NULL) gzclose(file); 21 if (file != NULL) gzclose(file);
21 struct stat _stat; 22 struct stat _stat;
22 stat(src,&_stat); 23 stat(src,&_stat);
23 fsize = _stat.st_size; 24 fsize = _stat.st_size;
24 return ((file = gzopen(src,"rb")) == NULL); 25 return ((file = gzopen(src,"rb")) == NULL);
25 } 26 }
26 virtual int getch() { return gzgetc(file); } 27 virtual int getch() { return gzgetc(file); }
27 virtual unsigned int locate() { return gztell(file); } 28 virtual unsigned int locate() { return gztell(file); }
28 virtual void locate(unsigned int n) { gzseek(file,n,SEEK_SET); } 29 virtual void locate(unsigned int n) { gzseek(file,n,SEEK_SET); }
29 virtual bool hasrandomaccess() { return true; } 30 virtual bool hasrandomaccess() { return true; }
30 virtual void sizes(unsigned long& _file, unsigned long& _text) 31 virtual void sizes(unsigned long& _file, unsigned long& _text)
31 { 32 {
32 _text = _file = fsize; 33 _text = _file = fsize;
33 } 34 }
34}; 35};
35#endif 36#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,102 +1,103 @@
1#ifndef __ztxt_h 1#ifndef __ztxt_h
2#define __ztxt_h 2#define __ztxt_h
3 3
4#include "CExpander.h" 4#include "CExpander.h"
5#include <zlib.h> 5#include "zlib/zlib.h"
6//#include <zlib.h>
6#include "pdb.h" 7#include "pdb.h"
7/* 8/*
8 * Stuff common to both Weasel Reader and makeztxt 9 * Stuff common to both Weasel Reader and makeztxt
9 * 10 *
10 * $Id$ 11 * $Id$
11 * 12 *
12 */ 13 */
13 14
14#ifndef _WEASEL_COMMON_H_ 15#ifndef _WEASEL_COMMON_H_
15#define _WEASEL_COMMON_H_ 1 16#define _WEASEL_COMMON_H_ 1
16 17
17 18
18/* Padding is no good */ 19/* Padding is no good */
19#if defined(__GNUC__) && defined(__UNIX__) 20#if defined(__GNUC__) && defined(__UNIX__)
20# pragma pack(2) 21# pragma pack(2)
21#endif 22#endif
22 23
23/* The default creator is Weasel Reader 'GPlm' */ 24/* The default creator is Weasel Reader 'GPlm' */
24#define GPLM_CREATOR_ID "GPlm" 25#define GPLM_CREATOR_ID "GPlm"
25/* Databases of type 'zTXT' */ 26/* Databases of type 'zTXT' */
26#define ZTXT_TYPE_ID "zTXT" 27#define ZTXT_TYPE_ID "zTXT"
27/* Size of one database record */ 28/* Size of one database record */
28#define RECORD_SIZE 8192 29#define RECORD_SIZE 8192
29/* Allow largest WBIT size for data. Lower with command line options 30/* Allow largest WBIT size for data. Lower with command line options
30 in makeztxt */ 31 in makeztxt */
31#define MAXWBITS 15 32#define MAXWBITS 15
32/* Max length for a bookmark/annotation title */ 33/* Max length for a bookmark/annotation title */
33#define MAX_BMRK_LENGTH 20 34#define MAX_BMRK_LENGTH 20
34 35
35 36
36/***************************************************** 37/*****************************************************
37 * This is the zTXT document header (record #0) * 38 * This is the zTXT document header (record #0) *
38 * ----zTXT version 1.42---- * 39 * ----zTXT version 1.42---- *
39 *****************************************************/ 40 *****************************************************/
40typedef struct zTXT_record0Type { 41typedef struct zTXT_record0Type {
41 UInt16 version; /* zTXT format version */ 42 UInt16 version; /* zTXT format version */
42 UInt16 numRecords; /* Number of data (TEXT) records */ 43 UInt16 numRecords; /* Number of data (TEXT) records */
43 UInt32 size; /* Size in bytes of uncomp. data */ 44 UInt32 size; /* Size in bytes of uncomp. data */
44 UInt16 recordSize; /* Size of a single data record */ 45 UInt16 recordSize; /* Size of a single data record */
45 UInt16 numBookmarks; /* Number of bookmarks in DB */ 46 UInt16 numBookmarks; /* Number of bookmarks in DB */
46 UInt16 bookmarkRecord; /* Record containing bookmarks */ 47 UInt16 bookmarkRecord; /* Record containing bookmarks */
47 UInt16 numAnnotations; /* Number of annotation records */ 48 UInt16 numAnnotations; /* Number of annotation records */
48 UInt16 annotationRecord; /* Record # of annotation index */ 49 UInt16 annotationRecord; /* Record # of annotation index */
49 UInt8 randomAccess; /* 1 if compressed w/Z_FULL_FLUSH */ 50 UInt8 randomAccess; /* 1 if compressed w/Z_FULL_FLUSH */
50 UInt8 padding[0x20 - 19]; /* Pad to a size of 0x20 bytes */ 51 UInt8 padding[0x20 - 19]; /* Pad to a size of 0x20 bytes */
51} zTXT_record0; 52} zTXT_record0;
52 53
53struct zTXTbkmk 54struct zTXTbkmk
54{ 55{
55 UInt32 offset; 56 UInt32 offset;
56 tchar title[MAX_BMRK_LENGTH]; 57 tchar title[MAX_BMRK_LENGTH];
57}; 58};
58 59
59#endif 60#endif
60 61
61 62
62const UInt32 ZTXT_ID = 0x5458547a; 63const UInt32 ZTXT_ID = 0x5458547a;
63 64
64class ztxt : public CExpander, Cpdb 65class ztxt : public CExpander, Cpdb
65{ 66{
66 bool bInit; 67 bool bInit;
67 UInt32 buffersize; 68 UInt32 buffersize;
68 UInt32 buffercontent; 69 UInt32 buffercontent;
69 UInt8* expandedtextbuffer; 70 UInt8* expandedtextbuffer;
70 UInt8* compressedtextbuffer; 71 UInt8* compressedtextbuffer;
71 z_stream zstream; 72 z_stream zstream;
72 size_t bufferpos; 73 size_t bufferpos;
73 UInt16 bufferrec; 74 UInt16 bufferrec;
74 zTXT_record0 hdr0; 75 zTXT_record0 hdr0;
75 size_t currentpos; 76 size_t currentpos;
76 void home(); 77 void home();
77 public: 78 public:
78 virtual void sizes(unsigned long& _file, unsigned long& _text) 79 virtual void sizes(unsigned long& _file, unsigned long& _text)
79 { 80 {
80 _file = file_length; 81 _file = file_length;
81 _text = ntohl(hdr0.size); 82 _text = ntohl(hdr0.size);
82 } 83 }
83 virtual bool hasrandomaccess() { return (hdr0.randomAccess != 0); } 84 virtual bool hasrandomaccess() { return (hdr0.randomAccess != 0); }
84 virtual ~ztxt() 85 virtual ~ztxt()
85 { 86 {
86 if (expandedtextbuffer != NULL) delete [] expandedtextbuffer; 87 if (expandedtextbuffer != NULL) delete [] expandedtextbuffer;
87 if (compressedtextbuffer != NULL) delete [] compressedtextbuffer; 88 if (compressedtextbuffer != NULL) delete [] compressedtextbuffer;
88 if (bInit) 89 if (bInit)
89 { 90 {
90 inflateEnd(&zstream); 91 inflateEnd(&zstream);
91 } 92 }
92 } 93 }
93 ztxt(); 94 ztxt();
94 virtual int openfile(const char *src); 95 virtual int openfile(const char *src);
95 virtual int getch(); 96 virtual int getch();
96 virtual unsigned int locate(); 97 virtual unsigned int locate();
97 virtual void locate(unsigned int n); 98 virtual void locate(unsigned int n);
98 virtual CList<Bkmk>* getbkmklist(); 99 virtual CList<Bkmk>* getbkmklist();
99}; 100};
100 101
101#endif 102#endif
102 103