--- libflatfile/MobileDB.cpp.orig 2003-06-19 19:37:46.000000000 -0400
+++ libflatfile/MobileDB.cpp 2007-07-10 06:33:33.000000000 -0400
if (field == 0xFF) break;
// Make sure that we don't go beyond the maximum number of fields.
- if (field >= getMaxNumOfFields())
+ if (field > getMaxNumOfFields()) // css: chaanged >= to >
throw PalmLib::error("maximum number of fields exceeded");
// Expand the fields vector if this field goes beyond the end
// Extract the field labels record.
recNum = find_metadata_index(pdb, CATEGORY_FIELD_LABELS);
mdb_record_t names = parse_record(pdb.getRecord(recNum));
- numFields = names.size();
+ // css: Fields must have names, so zero-length field labels indicate
+ // fields that should be trimmed from the size.
+ for (mdb_record_t::reverse_iterator p = names.rbegin(); p < names.rend(); ++p) {
+ numFields = names.size() - trim;
// Extract the data types record.
recNum = find_metadata_index(pdb, CATEGORY_DATA_TYPES);
for (i = 0; i < numFields; ++i) {
- appendField(names[i], Field::STRING);
+ // css: determine the field type
+ Field::FieldType fieldType;
+ case 'P': // phone number
+ case 'M': // email address
+ fieldType = PalmLib::FlatFile::Field::STRING;
+ fieldType = PalmLib::FlatFile::Field::INTEGER;
+ fieldType = PalmLib::FlatFile::Field::FLOAT;
+ fieldType = PalmLib::FlatFile::Field::BOOLEAN;
+ fieldType = PalmLib::FlatFile::Field::DATE;
+ fieldType = PalmLib::FlatFile::Field::TIME;
+ fieldType = PalmLib::FlatFile::Field::LIST;
+ fieldType = PalmLib::FlatFile::Field::LINK;