summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/Aportis.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-reader/Aportis.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-reader/Aportis.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/noncore/apps/opie-reader/Aportis.cpp b/noncore/apps/opie-reader/Aportis.cpp
index 353996c..37dcc99 100644
--- a/noncore/apps/opie-reader/Aportis.cpp
+++ b/noncore/apps/opie-reader/Aportis.cpp
@@ -51,12 +51,13 @@ CList<Bkmk>* Aportis::getbkmklist()
return NULL;
}
}
*/
if (bCompressed != 4) return NULL;
CList<Bkmk>* t = new CList<Bkmk>;
+ unsuspend();
size_t cur = ftell(fin);
for (int i = 0; i < nRecs2; i++)
{
DWORD dwPos;
fseek(fin, 0x56 + 8*i, SEEK_SET);
fread(&dwPos, 4, 1, fin);
@@ -243,12 +244,13 @@ int Aportis::getch()
{
if (bCompressed == 1)
{
if ((dwRecLen == 0) && !refreshbuffer()) return EOF;
else
{
+unsuspend();
int c = getc(fin);
dePeanut(c);
dwRecLen--;
currentpos++;
return c;
}
@@ -260,12 +262,13 @@ int Aportis::getch()
}
if ((dwRecLen == 0) && !refreshbuffer()) return EOF;
currentpos++;
int c;
// take a char from the input buffer
+unsuspend();
c = getc(fin);
dePeanut(c);
dwRecLen--;
// separate the char into zones: 0, 1...8, 9...0x7F, 0x80...0xBF, 0xC0...0xFF
// codes 1...8 mean copy that many chars; for accented chars & binary
@@ -317,13 +320,13 @@ int Aportis::getch()
}
unsigned int Aportis::GetBS(unsigned int bn)
{
DWORD dwPos;
WORD fs;
-
+unsuspend();
fseek(fin, 0x56 + 8*bn, SEEK_SET);
fread(&dwPos, 4, 1, fin);
dwPos = SwapLong(dwPos);
fseek(fin,dwPos,SEEK_SET);
// gotorecordnumber(bn+1);
@@ -340,12 +343,13 @@ unsigned int Aportis::GetBS(unsigned int bn)
}
unsigned int Aportis::locate()
{
if (bCompressed == 4)
{
+unsuspend();
size_t cur = ftell(fin);
unsigned int clen = 0;
for (unsigned int i = 0; i < currentrec-1; i++)
{
unsigned int bs = GetBS(i);
if (bs == 0) break;
@@ -398,12 +402,13 @@ bool Aportis::refreshbuffer()
{
dwRecLen = recordlength(currentrec+1);
gotorecordnumber(currentrec+1);
if (bCompressed == 4)
{
unsigned char t[3];
+ unsuspend();
fread(t,1,3,fin);
if (t[0] != 241)
{
printf("You shouldn't be here!\n");
return false;
}
@@ -427,12 +432,13 @@ bool Aportis::refreshbuffer()
}
#include <qimage.h>
QImage* Aportis::getPicture(unsigned long tgt)
{
+unsuspend();
unsigned short tgtrec = tgt+mobiimagerec;
if (tgtrec > nRecs2) return NULL;
size_t cur = ftell(fin);
unsigned short reclen = recordlength(tgtrec);
gotorecordnumber(tgtrec);
UInt8* imgbuffer = new UInt8[reclen];