author | pohly <pohly> | 2004-08-24 20:52:45 (UTC) |
---|---|---|
committer | pohly <pohly> | 2004-08-24 20:52:45 (UTC) |
commit | 73253e93327cf4ef0932de1b4afb56af22a0f37e (patch) (unidiff) | |
tree | 1c9a7a6dd3341e036a894d348a3372525d29acec /noncore/apps/opie-reader/ztxt.cpp | |
parent | e90847c784c48bd21bf8768cb38edb853b832697 (diff) | |
download | opie-73253e93327cf4ef0932de1b4afb56af22a0f37e.zip opie-73253e93327cf4ef0932de1b4afb56af22a0f37e.tar.gz opie-73253e93327cf4ef0932de1b4afb56af22a0f37e.tar.bz2 |
updated source to opie-reader 0.7g
Diffstat (limited to 'noncore/apps/opie-reader/ztxt.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/ztxt.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/noncore/apps/opie-reader/ztxt.cpp b/noncore/apps/opie-reader/ztxt.cpp index 8091d32..79c5fa4 100644 --- a/noncore/apps/opie-reader/ztxt.cpp +++ b/noncore/apps/opie-reader/ztxt.cpp | |||
@@ -1,18 +1,19 @@ | |||
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 | #include "static.h" | ||
6 | 7 | ||
7 | ztxt::ztxt() : bInit(false), expandedtextbuffer(NULL), compressedtextbuffer(NULL) { /*printf("constructing:%x\n",fin);*/ } | 8 | ztxt::ztxt() : bInit(false), expandedtextbuffer(NULL), compressedtextbuffer(NULL) { /*printf("constructing:%x\n",fin);*/ } |
8 | 9 | ||
9 | 10 | ||
10 | int ztxt::OpenFile(const char *src) | 11 | int ztxt::OpenFile(const char *src) |
11 | { | 12 | { |
12 | if (!Cpdb::openfile(src)) | 13 | if (!Cpdb::openpdbfile(src)) |
13 | { | 14 | { |
14 | return -1; | 15 | return -1; |
15 | } | 16 | } |
16 | 17 | ||
17 | //printf("Okay %u\n", 4); | 18 | //printf("Okay %u\n", 4); |
18 | 19 | ||
@@ -151,11 +152,23 @@ CList<Bkmk>* ztxt::getbkmklist() | |||
151 | gotorecordnumber(recno); | 152 | gotorecordnumber(recno); |
152 | for (int i = 0; i < ntohs(hdr0.numBookmarks); i++) | 153 | for (int i = 0; i < ntohs(hdr0.numBookmarks); i++) |
153 | { | 154 | { |
154 | zTXTbkmk bkmk; | 155 | zTXTbkmk bkmk; |
155 | if (fread(&bkmk, sizeof(bkmk), 1, fin) != 1) break; | 156 | if (fread(&bkmk, sizeof(bkmk), 1, fin) != 1) break; |
156 | // printf("Bookmark number:%d:%.20s\n", i, bkmk.title); | 157 | // printf("Bookmark number:%d:%.20s\n", i, bkmk.title); |
157 | t->push_back(Bkmk(bkmk.title, NULL, ntohl(bkmk.offset))); | 158 | tchar title[MAX_BMRK_LENGTH]; |
159 | for (int j = 0; j < MAX_BMRK_LENGTH; j++) | ||
160 | { | ||
161 | title[j] = bkmk.title[j]; | ||
162 | } | ||
163 | t->push_back(Bkmk(title, NULL, ntohl(bkmk.offset))); | ||
158 | } | 164 | } |
159 | fseek(fin, cur, SEEK_SET); | 165 | fseek(fin, cur, SEEK_SET); |
160 | return t; | 166 | return t; |
161 | } | 167 | } |
168 | |||
169 | #ifndef __STATIC | ||
170 | extern "C" | ||
171 | { | ||
172 | CExpander* newcodec() { return new ztxt; } | ||
173 | } | ||
174 | #endif | ||