author | llornkcor <llornkcor> | 2002-12-20 01:35:01 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-12-20 01:35:01 (UTC) |
commit | 876e1a4724a7bd75dc642e295de354241096e028 (patch) (unidiff) | |
tree | a37c5dcc9d78e04bb6b859ab89d8cf81e6745087 /noncore/apps/opie-reader/ztxt.cpp | |
parent | 5fd6636ba3d94b48dd543887316c47c5388a43c2 (diff) | |
download | opie-876e1a4724a7bd75dc642e295de354241096e028.zip opie-876e1a4724a7bd75dc642e295de354241096e028.tar.gz opie-876e1a4724a7bd75dc642e295de354241096e028.tar.bz2 |
update - sorry it took so long. hope this works correctly
Diffstat (limited to 'noncore/apps/opie-reader/ztxt.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/ztxt.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/opie-reader/ztxt.cpp b/noncore/apps/opie-reader/ztxt.cpp index 289b13a..8091d32 100644 --- a/noncore/apps/opie-reader/ztxt.cpp +++ b/noncore/apps/opie-reader/ztxt.cpp | |||
@@ -1,58 +1,58 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include <string.h> | 2 | #include <string.h> |
3 | #include "ztxt.h" | 3 | #include "ztxt.h" |
4 | #include "my_list.h" | 4 | #include "my_list.h" |
5 | #include "Bkmks.h" | 5 | #include "Bkmks.h" |
6 | 6 | ||
7 | ztxt::ztxt() : bInit(false), expandedtextbuffer(NULL), compressedtextbuffer(NULL) { /*printf("constructing:%x\n",fin);*/ } | 7 | ztxt::ztxt() : bInit(false), expandedtextbuffer(NULL), compressedtextbuffer(NULL) { /*printf("constructing:%x\n",fin);*/ } |
8 | 8 | ||
9 | 9 | ||
10 | int ztxt::openfile(const char *src) | 10 | int ztxt::OpenFile(const char *src) |
11 | { | 11 | { |
12 | if (!Cpdb::openfile(src)) | 12 | if (!Cpdb::openfile(src)) |
13 | { | 13 | { |
14 | return -1; | 14 | return -1; |
15 | } | 15 | } |
16 | 16 | ||
17 | //printf("Okay %u\n", 4); | 17 | //printf("Okay %u\n", 4); |
18 | 18 | ||
19 | if (head.type != ZTXT_ID) return -1; | 19 | if (head.type != ZTXT_ID) return -1; |
20 | 20 | ||
21 | gotorecordnumber(0); | 21 | gotorecordnumber(0); |
22 | fread(&hdr0, 1, sizeof(hdr0), fin); | 22 | fread(&hdr0, 1, sizeof(hdr0), fin); |
23 | //printf("Okay %u\n", 5); | 23 | //printf("Okay %u\n", 5); |
24 | buffersize = ntohl(hdr0.size); | 24 | buffersize = ntohl(hdr0.size); |
25 | compressedtextbuffer = new UInt8[buffersize]; | 25 | compressedtextbuffer = new UInt8[buffersize]; |
26 | expandedtextbuffer = new UInt8[buffersize]; | 26 | expandedtextbuffer = new UInt8[buffersize]; |
27 | //printf("Okay %u\n", 6); | 27 | //printf("Okay %u\n", 6); |
28 | 28 | ||
29 | home(); | 29 | home(); |
30 | //printf("Okay %u\n", 7); | 30 | //printf("Okay %u\n", 7); |
31 | 31 | ||
32 | // printf("Returning 0\n"); | 32 | // printf("Returning 0\n"); |
33 | 33 | ||
34 | return 0; | 34 | return 0; |
35 | } | 35 | } |
36 | 36 | ||
37 | int ztxt::getch() | 37 | int ztxt::getch() |
38 | { | 38 | { |
39 | if (bufferpos >= buffercontent) | 39 | if (bufferpos >= buffercontent) |
40 | { | 40 | { |
41 | size_t reclen = recordlength(++bufferrec); | 41 | size_t reclen = recordlength(++bufferrec); |
42 | if (reclen == 0) return -1; | 42 | if (reclen == 0) return -1; |
43 | gotorecordnumber(bufferrec); | 43 | gotorecordnumber(bufferrec); |
44 | fread(compressedtextbuffer, reclen, sizeof(char), fin); | 44 | fread(compressedtextbuffer, reclen, sizeof(char), fin); |
45 | 45 | ||
46 | zstream.next_in = compressedtextbuffer; | 46 | zstream.next_in = compressedtextbuffer; |
47 | zstream.next_out = expandedtextbuffer; | 47 | zstream.next_out = expandedtextbuffer; |
48 | zstream.avail_out = buffersize; | 48 | zstream.avail_out = buffersize; |
49 | zstream.avail_in = reclen; | 49 | zstream.avail_in = reclen; |
50 | 50 | ||
51 | int ret = inflate(&zstream, Z_SYNC_FLUSH); | 51 | int ret = inflate(&zstream, Z_SYNC_FLUSH); |
52 | buffercontent = buffersize - zstream.avail_out; | 52 | buffercontent = buffersize - zstream.avail_out; |
53 | bufferpos = 0; | 53 | bufferpos = 0; |
54 | 54 | ||
55 | } | 55 | } |
56 | currentpos++; | 56 | currentpos++; |
57 | return expandedtextbuffer[bufferpos++]; | 57 | return expandedtextbuffer[bufferpos++]; |
58 | } | 58 | } |