author | llornkcor <llornkcor> | 2002-12-20 01:35:01 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-12-20 01:35:01 (UTC) |
commit | 876e1a4724a7bd75dc642e295de354241096e028 (patch) (side-by-side diff) | |
tree | a37c5dcc9d78e04bb6b859ab89d8cf81e6745087 /noncore/apps/opie-reader/pdb.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/pdb.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/pdb.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/noncore/apps/opie-reader/pdb.cpp b/noncore/apps/opie-reader/pdb.cpp index 68b904e..3054424 100644 --- a/noncore/apps/opie-reader/pdb.cpp +++ b/noncore/apps/opie-reader/pdb.cpp @@ -1,13 +1,16 @@ #include "pdb.h" +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> size_t Cpdb::recordpos(int n) { UInt16 mxn = ntohs(head.recordList.numRecords); if (n >= mxn) { return file_length; } else { size_t dataoffset = sizeof(DatabaseHdrType) - sizeof(UInt16); dataoffset += /*dataoffset%4 + */ sizeof(RecordListType) * n; @@ -37,21 +40,24 @@ bool Cpdb::openfile(const char *src) // printf("closing fin:%x\n",fin); if (fin != NULL) fclose(fin); // printf("opening fin\n"); fin = fopen(src,"rb"); if (fin==0) { return false; } // just holds the first few chars of the file // char buf[0x100]; - fseek(fin,0,SEEK_END); - file_length = ftell(fin); + struct stat buf; + stat(src, &buf); + file_length = buf.st_size; +// fseek(fin,0,SEEK_END); +// file_length = ftell(fin); - fseek(fin,0,SEEK_SET); +// fseek(fin,0,SEEK_SET); fread(&head, 1, sizeof(head), fin); return true; } |