summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/ZText.h
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-reader/ZText.h') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-reader/ZText.h39
1 files changed, 28 insertions, 11 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 @@
#include <stdio.h>
-#include "zlib/zlib.h"
+#include <zlib.h>
#include <sys/stat.h>
-
+#include "useqpe.h"
#include "CExpander.h"
@@ -12,4 +12,5 @@ class Text: public CExpander {
public:
- virtual void suspend()
+ void suspend()
{
+#ifdef USEQPE
bSuspended = true;
@@ -19,5 +20,7 @@ public:
sustime = time(NULL);
+#endif
}
- virtual void unsuspend()
+ void unsuspend()
{
+#ifdef USEQPE
if (bSuspended)
@@ -40,2 +43,3 @@ public:
}
+#endif
}
@@ -46,3 +50,3 @@ public:
}
- virtual int OpenFile(const char *src)
+ int OpenFile(const char *src)
{
@@ -54,11 +58,24 @@ public:
}
- 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)
+ int getch() { return gzgetc(file); }
+ unsigned int locate() { return gztell(file); }
+ void locate(unsigned int n) { gzseek(file,n,SEEK_SET); }
+ bool hasrandomaccess() { return true; }
+ void sizes(unsigned long& _file, unsigned long& _text)
{
_text = _file = fsize;
+ FILE* f = fopen(fname, "rb");
+ if (f != NULL)
+ {
+ unsigned char mn[2];
+ fread(mn, 1, 2, f);
+ if ((mn[0] == 31) && (mn[1] == 139))
+ {
+ int tmp = sizeof(_text);
+ fseek(f,-tmp,SEEK_END);
+ fread(&_text, sizeof(_text), 1, f);
+ }
+ fclose(f);
+ }
}
- virtual MarkupType PreferredMarkup()
+ MarkupType PreferredMarkup()
{