Diffstat (limited to 'noncore/apps/opie-reader/ztxt.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/ztxt.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/noncore/apps/opie-reader/ztxt.cpp b/noncore/apps/opie-reader/ztxt.cpp index 35db05e..e04eaa0 100644 --- a/noncore/apps/opie-reader/ztxt.cpp +++ b/noncore/apps/opie-reader/ztxt.cpp @@ -54,32 +54,33 @@ int ztxt::getch() } currentpos++; return expandedtextbuffer[bufferpos++]; } unsigned int ztxt::locate() { return currentpos; } void ztxt::locate(unsigned int n) { if (hasrandomaccess()) { + unsuspend(); bufferrec = n / ntohs(hdr0.recordSize) + 1; if (bufferrec == 1) { inflateEnd(&zstream); } size_t reclen = recordlength(bufferrec); if (reclen == 0) return; gotorecordnumber(bufferrec); fread(compressedtextbuffer, reclen, sizeof(char), fin); zstream.next_in = compressedtextbuffer; zstream.next_out = expandedtextbuffer; zstream.avail_out = buffersize; zstream.avail_in = reclen; if (bufferrec == 1) @@ -94,32 +95,33 @@ void ztxt::locate(unsigned int n) int ret = inflate(&zstream, Z_SYNC_FLUSH); buffercontent = buffersize - zstream.avail_out; bufferpos = 0; currentpos = n - n % ntohs(hdr0.recordSize); while (currentpos < n) getch(); } else { home(); while (currentpos < n && getch() != EOF); } } void ztxt::home() { +unsuspend(); if (bInit) { inflateEnd(&zstream); } bInit = true; size_t reclen = recordlength(1); gotorecordnumber(1); fread(compressedtextbuffer, reclen, sizeof(char), fin); zstream.next_in = compressedtextbuffer; zstream.next_out = expandedtextbuffer; zstream.avail_out = buffersize; zstream.avail_in = reclen; zstream.zalloc = Z_NULL; zstream.zfree = Z_NULL; @@ -134,32 +136,33 @@ void ztxt::home() bufferpos = 0; bufferrec = 1; currentpos = 0; buffercontent = buffersize - zstream.avail_out; // printf("buffercontent:%u\n", buffercontent); } CList<Bkmk>* ztxt::getbkmklist() { UInt16 recno = ntohs(hdr0.bookmarkRecord); // printf("Bookmarks - record %d contains %d\n", recno, ntohs(hdr0.numBookmarks)); if (recno == 0) return NULL; CList<Bkmk>* t = new CList<Bkmk>; + unsuspend(); size_t cur = ftell(fin); gotorecordnumber(recno); for (int i = 0; i < ntohs(hdr0.numBookmarks); i++) { zTXTbkmk bkmk; if (fread(&bkmk, sizeof(bkmk), 1, fin) != 1) break; // printf("Bookmark number:%d:%.20s\n", i, bkmk.title); tchar title[MAX_BMRK_LENGTH]; for (int j = 0; j < MAX_BMRK_LENGTH; j++) { title[j] = bkmk.title[j]; } t->push_back(Bkmk(title, NULL, ntohl(bkmk.offset))); } fseek(fin, cur, SEEK_SET); return t; |