diff -urN jpilot-0.99.4.orig/libplugin.c jpilot-0.99.4/libplugin.c --- jpilot-0.99.4.orig/libplugin.c Tue Jan 14 22:13:42 2003 +++ jpilot-0.99.4/libplugin.c Tue Jan 28 22:43:20 2003 @@ -462,7 +462,7 @@ jp_logf(JP_LOG_WARN, "Error opening %s\n", PDB_name); return -1; } - num = fread(&rdbh, sizeof(RawDBHeader), 1, in); + num = fread(&rdbh, 78 /* sizeof(RawDBHeader) */, 1, in); if (num != 1) { if (ferror(in)) { jp_logf(JP_LOG_WARN, "Error reading %s\n", PDB_name); @@ -723,7 +723,7 @@ return -1; } /*Read the database header */ - num = fread(&rdbh, sizeof(RawDBHeader), 1, in); + num = fread(&rdbh, 78 /* sizeof(RawDBHeader) */, 1, in); if (num != 1) { if (ferror(in)) { jp_logf(JP_LOG_WARN, "Error reading %s\n", PDB_name); diff -urN jpilot-0.99.4.orig/libplugin.h jpilot-0.99.4/libplugin.h --- jpilot-0.99.4.orig/libplugin.h Tue Jan 14 22:13:42 2003 +++ jpilot-0.99.4/libplugin.h Tue Jan 28 21:25:19 2003 @@ -72,38 +72,38 @@ } mem_rec_header; typedef struct { - unsigned char db_name[32]; - unsigned char flags[2]; - unsigned char version[2]; - unsigned char creation_time[4]; - unsigned char modification_time[4]; - unsigned char backup_time[4]; - unsigned char modification_number[4]; - unsigned char app_info_offset[4]; - unsigned char sort_info_offset[4]; - unsigned char type[4];/*Database ID */ - unsigned char creator_id[4];/*Application ID */ - unsigned char unique_id_seed[4]; - unsigned char next_record_list_id[4]; - unsigned char number_of_records[2]; -} RawDBHeader; + unsigned char db_name[32] __attribute((packed)); + unsigned char flags[2] __attribute((packed)); + unsigned char version[2] __attribute((packed)); + unsigned char creation_time[4] __attribute((packed)); + unsigned char modification_time[4] __attribute((packed)); + unsigned char backup_time[4] __attribute((packed)); + unsigned char modification_number[4] __attribute((packed)); + unsigned char app_info_offset[4] __attribute((packed)); + unsigned char sort_info_offset[4] __attribute((packed)); + unsigned char type[4] __attribute((packed));/*Database ID */ + unsigned char creator_id[4] __attribute((packed));/*Application ID */ + unsigned char unique_id_seed[4] __attribute((packed)); + unsigned char next_record_list_id[4] __attribute((packed)); + unsigned char number_of_records[2] __attribute((packed)); +} RawDBHeader __attribute((packed)); typedef struct { - char db_name[32]; - unsigned int flags; - unsigned int version; - time_t creation_time; - time_t modification_time; - time_t backup_time; - unsigned int modification_number; - unsigned int app_info_offset; - unsigned int sort_info_offset; - char type[5];/*Database ID */ - char creator_id[5];/*Application ID */ - char unique_id_seed[5]; - unsigned int next_record_list_id; - unsigned int number_of_records; -} DBHeader; + char db_name[32] __attribute((packed)); + unsigned int flags __attribute((packed)); + unsigned int version __attribute((packed)); + time_t creation_time __attribute((packed)); + time_t modification_time __attribute((packed)); + time_t backup_time __attribute((packed)); + unsigned int modification_number __attribute((packed)); + unsigned int app_info_offset __attribute((packed)); + unsigned int sort_info_offset __attribute((packed)); + char type[5] __attribute((packed));/*Database ID */ + char creator_id[5] __attribute((packed));/*Application ID */ + char unique_id_seed[5] __attribute((packed)); + unsigned int next_record_list_id __attribute((packed)); + unsigned int number_of_records __attribute((packed)); +} DBHeader __attribute((packed)); int get_next_unique_pc_id(unsigned int *next_unique_id); diff -urN jpilot-0.99.4.orig/utils.c jpilot-0.99.4/utils.c --- jpilot-0.99.4.orig/utils.c Tue Jan 14 22:13:42 2003 +++ jpilot-0.99.4/utils.c Tue Jan 28 22:32:54 2003 @@ -1719,7 +1719,7 @@ fseek(in, 0, SEEK_SET); - fread(&rdbh, sizeof(RawDBHeader), 1, in); + fread(&rdbh, 78 /* sizeof(RawDBHeader) */, 1, in); if (feof(in)) { jp_logf(JP_LOG_WARN, "Error reading file in get_app_info_size\n"); return -1; @@ -1765,7 +1765,7 @@ jp_logf(JP_LOG_WARN, "Error opening %s\n", PDB_name); return -1; } - num = fread(&rdbh, sizeof(RawDBHeader), 1, in); + num = fread(&rdbh, 78 /* sizeof(RawDBHeader) */, 1, in); if (num != 1) { if (ferror(in)) { jp_logf(JP_LOG_WARN, "Error reading %s 1\n", PDB_name);