Diffstat (limited to 'noncore/apps/opie-reader/pdb.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/pdb.cpp | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/noncore/apps/opie-reader/pdb.cpp b/noncore/apps/opie-reader/pdb.cpp index dca67ff..39551cc 100644 --- a/noncore/apps/opie-reader/pdb.cpp +++ b/noncore/apps/opie-reader/pdb.cpp | |||
@@ -4,4 +4,28 @@ | |||
4 | #endif | 4 | #endif |
5 | 5 | ||
6 | #include "useqpe.h" | ||
7 | |||
8 | #ifdef USEQPE | ||
9 | void Cpdb::suspend() | ||
10 | { | ||
11 | CExpander::suspend(fin); | ||
12 | } | ||
13 | void Cpdb::unsuspend() | ||
14 | { | ||
15 | CExpander::unsuspend(fin); | ||
16 | } | ||
17 | #endif | ||
18 | |||
19 | Cpdb::~Cpdb() | ||
20 | { | ||
21 | if (fin != NULL) | ||
22 | { | ||
23 | #ifdef USEQPE | ||
24 | unsuspend(); | ||
25 | #endif | ||
26 | fclose(fin); | ||
27 | } | ||
28 | } | ||
29 | |||
6 | size_t Cpdb::recordpos(int n) | 30 | size_t Cpdb::recordpos(int n) |
7 | { | 31 | { |
@@ -33,9 +57,9 @@ void Cpdb::gotorecordnumber(int n) | |||
33 | } | 57 | } |
34 | 58 | ||
35 | bool Cpdb::openfile(const char *src) | 59 | bool Cpdb::openpdbfile(const char *src) |
36 | { | 60 | { |
61 | //qDebug("cpdb openfile:%s", src); | ||
37 | 62 | ||
38 | // printf("In openfile\n"); | 63 | // printf("In openfile\n"); |
39 | int ret = 0; | ||
40 | // printf("closing fin:%x\n",fin); | 64 | // printf("closing fin:%x\n",fin); |
41 | if (fin != NULL) fclose(fin); | 65 | if (fin != NULL) fclose(fin); |
@@ -50,6 +74,9 @@ bool Cpdb::openfile(const char *src) | |||
50 | // just holds the first few chars of the file | 74 | // just holds the first few chars of the file |
51 | //char buf[0x100]; | 75 | //char buf[0x100]; |
52 | fseek(fin,0,SEEK_END); | 76 | struct stat _stat; |
53 | file_length = ftell(fin); | 77 | stat(src,&_stat); |
78 | file_length = _stat.st_size; | ||
79 | // fseek(fin,0,SEEK_END); | ||
80 | // file_length = ftell(fin); | ||
54 | 81 | ||
55 | fseek(fin,0,SEEK_SET); | 82 | fseek(fin,0,SEEK_SET); |
@@ -57,4 +84,7 @@ bool Cpdb::openfile(const char *src) | |||
57 | fread(&head, 1, sizeof(head), fin); | 84 | fread(&head, 1, sizeof(head), fin); |
58 | 85 | ||
86 | qDebug("Database name:%s", head.name); | ||
87 | qDebug("Total number of records:%u", ntohs(head.recordList.numRecords)); | ||
88 | |||
59 | return true; | 89 | return true; |
60 | } | 90 | } |