Diffstat (limited to 'noncore/apps/opie-reader/Aportis.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/Aportis.cpp | 8 |
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 @@ -49,16 +49,17 @@ CList<Bkmk>* Aportis::getbkmklist() else { 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); dwPos = SwapLong(dwPos); fseek(fin,dwPos,SEEK_SET); @@ -241,16 +242,17 @@ int Aportis::OpenFile(const char *src) int Aportis::getch() { if (bCompressed == 1) { if ((dwRecLen == 0) && !refreshbuffer()) return EOF; else { +unsuspend(); int c = getc(fin); dePeanut(c); dwRecLen--; currentpos++; return c; } } if (outptr != cbptr) @@ -258,16 +260,17 @@ int Aportis::getch() currentpos++; return (circbuf[outptr = (outptr + 1) % 2048]); } 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 if (c == 0) { @@ -315,17 +318,17 @@ int Aportis::getch() return circbuf[outptr = (outptr+1)%2048]; } } 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); unsigned char ch; fread(&ch,1,1,fin); @@ -338,16 +341,17 @@ unsigned int Aportis::GetBS(unsigned int bn) fs = 0; return fs; } 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; clen += bs; } @@ -396,16 +400,17 @@ bool Aportis::refreshbuffer() { if (currentrec < nRecs) { 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; } dwRecLen -= 3; } @@ -425,16 +430,17 @@ bool Aportis::refreshbuffer() return false; } } #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]; fread(imgbuffer, 1, reclen, fin); QByteArray arr; |