Sunday, May 01, 2005

Palm DBs

Once upon a time, I used to use some tools for putting things into and out of the Palm DB database format, so I thought I'd take another look.

The most recent version looks to be 0.3.3, but that hasn't been modified since 2002, so it looks like I'm on my own. Thanks to the magic of autoconf, a large fraction of the build works straight out of the box, but there's a couple of tweaks needed:

  • modifying */Makefile to add the -Wno-long-double option
  • modifying flatfile/Makefile to set STATIC=yes so that it builds a static library rather than a shared library (looks like another chunk of code that needs the --work-properly option).

Of course, now that I've built it, it doesn't work—it claims my PDB files are corrupt. After a bit of debugging, the problem seems to be that it thinks there's a zero length record at the end of the file. One quick and dirty hack to libflatfile/DB.cpp coming up:

*** old/DB.cpp  Sun May  1 12:41:29 2005
--- new/DB.cpp  Sun May  1 12:43:45 2005
*** 450,455 ****
--- 450,456 ----
          PalmLib::Record record = pdb.getRecord(i);
          Record rec;
+         if (record.size() == 0) continue;
              std::vector ptrs;
              std::vector sizes;
              parse_record(record, ptrs, sizes);
(in the main loop in PalmLib::FlatFile::DB::DB) ...and all seems to work.


Post a Comment

<< Home