Diffstat (limited to 'noncore/apps/opie-reader/ZText.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/ZText.h | 45 |
1 files changed, 31 insertions, 14 deletions
diff --git a/noncore/apps/opie-reader/ZText.h b/noncore/apps/opie-reader/ZText.h index 22d3733..ab81a5e 100644 --- a/noncore/apps/opie-reader/ZText.h +++ b/noncore/apps/opie-reader/ZText.h | |||
@@ -3,5 +3,5 @@ | |||
3 | #include <stdio.h> | 3 | #include <stdio.h> |
4 | #include "zlib/zlib.h" | 4 | #include <zlib.h> |
5 | #include <sys/stat.h> | 5 | #include <sys/stat.h> |
6 | 6 | #include "useqpe.h" | |
7 | #include "CExpander.h" | 7 | #include "CExpander.h" |
@@ -12,4 +12,5 @@ class Text: public CExpander { | |||
12 | public: | 12 | public: |
13 | virtual void suspend() | 13 | void suspend() |
14 | { | 14 | { |
15 | #ifdef USEQPE | ||
15 | bSuspended = true; | 16 | bSuspended = true; |
@@ -18,6 +19,8 @@ public: | |||
18 | file = NULL; | 19 | file = NULL; |
19 | sustime = time(NULL); | 20 | sustime = time(NULL); |
21 | #endif | ||
20 | } | 22 | } |
21 | virtual void unsuspend() | 23 | void unsuspend() |
22 | { | 24 | { |
25 | #ifdef USEQPE | ||
23 | if (bSuspended) | 26 | if (bSuspended) |
@@ -39,3 +42,4 @@ public: | |||
39 | suspos = gzseek(file, suspos, SEEK_SET); | 42 | suspos = gzseek(file, suspos, SEEK_SET); |
40 | } | 43 | } |
44 | #endif | ||
41 | } | 45 | } |
@@ -46,3 +50,3 @@ public: | |||
46 | } | 50 | } |
47 | virtual int OpenFile(const char *src) | 51 | int OpenFile(const char *src) |
48 | { | 52 | { |
@@ -54,11 +58,24 @@ public: | |||
54 | } | 58 | } |
55 | virtual int getch() { return gzgetc(file); } | 59 | int getch() { return gzgetc(file); } |
56 | virtual unsigned int locate() { return gztell(file); } | 60 | unsigned int locate() { return gztell(file); } |
57 | virtual void locate(unsigned int n) { gzseek(file,n,SEEK_SET); } | 61 | void locate(unsigned int n) { gzseek(file,n,SEEK_SET); } |
58 | virtual bool hasrandomaccess() { return true; } | 62 | bool hasrandomaccess() { return true; } |
59 | virtual void sizes(unsigned long& _file, unsigned long& _text) | 63 | void sizes(unsigned long& _file, unsigned long& _text) |
60 | { | 64 | { |
61 | _text = _file = fsize; | 65 | _text = _file = fsize; |
66 | FILE* f = fopen(fname, "rb"); | ||
67 | if (f != NULL) | ||
68 | { | ||
69 | unsigned char mn[2]; | ||
70 | fread(mn, 1, 2, f); | ||
71 | if ((mn[0] == 31) && (mn[1] == 139)) | ||
72 | { | ||
73 | int tmp = sizeof(_text); | ||
74 | fseek(f,-tmp,SEEK_END); | ||
75 | fread(&_text, sizeof(_text), 1, f); | ||
76 | } | ||
77 | fclose(f); | ||
78 | } | ||
62 | } | 79 | } |
63 | virtual MarkupType PreferredMarkup() | 80 | MarkupType PreferredMarkup() |
64 | { | 81 | { |