Skip to content

Commit

Permalink
mailbox.c: rename OFFSET_THRID to OFFSET_CID
Browse files Browse the repository at this point in the history
  • Loading branch information
ksmurchison committed Jan 27, 2025
1 parent 6b03edf commit 9113754
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions cunit/mailbox.testc
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ static void test_aligned_record_offsets(void)
CU_ASSERT_EQUAL(0, OFFSET_CACHE_CRC % alignof(r.cache_crc));
CU_ASSERT_EQUAL(0, OFFSET_CACHE_OFFSET % alignof(XXX_CACHE32_TYPE));
CU_ASSERT_EQUAL(0, OFFSET_CACHE_VERSION % alignof(XXX_CACHE32_TYPE));
CU_ASSERT_EQUAL(0, OFFSET_CID % alignof(r.cid));
CU_ASSERT_EQUAL(0, OFFSET_CREATEDMODSEQ % alignof(r.createdmodseq));
CU_ASSERT_EQUAL(0, OFFSET_GMTIME % alignof(r.gmtime));
CU_ASSERT_EQUAL(0, OFFSET_HEADER_SIZE % alignof(r.header_size));
Expand All @@ -134,7 +135,6 @@ static void test_aligned_record_offsets(void)
CU_ASSERT_EQUAL(0, OFFSET_SENTDATE % alignof(r.sentdate));
CU_ASSERT_EQUAL(0, OFFSET_SIZE % alignof(r.size));
CU_ASSERT_EQUAL(0, OFFSET_SYSTEM_FLAGS % alignof(r.system_flags));
CU_ASSERT_EQUAL(0, OFFSET_THRID % alignof(r.cid));
CU_ASSERT_EQUAL(0, OFFSET_UID % alignof(r.uid));
CU_ASSERT_EQUAL(0, OFFSET_USER_FLAGS % alignof(r.user_flags));
/* this list is sorted alphabetically, don't just append */
Expand Down Expand Up @@ -246,6 +246,7 @@ static void test_unique_record_offsets(void)
OFFSET(OFFSET_CACHE_CRC, sizeof(r.cache_crc)),
OFFSET(OFFSET_CACHE_OFFSET, sizeof(XXX_CACHE32_TYPE)),
OFFSET(OFFSET_CACHE_VERSION, sizeof(XXX_CACHE32_TYPE)),
OFFSET(OFFSET_CID, sizeof(r.cid)),
OFFSET(OFFSET_CREATEDMODSEQ, sizeof(r.createdmodseq)),
OFFSET(OFFSET_GMTIME, sizeof(r.gmtime)),
OFFSET(OFFSET_HEADER_SIZE, sizeof(r.header_size)),
Expand All @@ -258,7 +259,6 @@ static void test_unique_record_offsets(void)
OFFSET(OFFSET_SENTDATE, sizeof(r.sentdate)),
OFFSET(OFFSET_SIZE, sizeof(r.size)),
OFFSET(OFFSET_SYSTEM_FLAGS, sizeof(r.system_flags)),
OFFSET(OFFSET_THRID, sizeof(r.cid)),
OFFSET(OFFSET_UID, sizeof(r.uid)),
OFFSET(OFFSET_USER_FLAGS, sizeof(r.user_flags)),
/* this list is sorted alphabetically, don't just append */
Expand Down
8 changes: 4 additions & 4 deletions imap/mailbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -2086,7 +2086,7 @@ static int mailbox_buf_to_index_record(const char *buf, int version,
goto crc;
}

record->cid = ntohll(*(bit64 *)(buf+OFFSET_THRID));
record->cid = ntohll(*(bit64 *)(buf+OFFSET_CID));
if (version > 14) {
record->savedate = ntohl(*((bit32 *)(buf+PRE20_OFFSET_SAVEDATE)));
}
Expand Down Expand Up @@ -2120,7 +2120,7 @@ static int mailbox_buf_to_index_record(const char *buf, int version,
cache_version_field = ntohl(*((bit32 *)(buf+OFFSET_CACHE_VERSION)));
message_guid_import(&record->guid, buf+OFFSET_MESSAGE_GUID);
record->modseq = ntohll(*((bit64 *)(buf+OFFSET_MODSEQ)));
record->cid = ntohll(*(bit64 *)(buf+OFFSET_THRID));
record->cid = ntohll(*(bit64 *)(buf+OFFSET_CID));
record->createdmodseq = ntohll(*(bit64 *)(buf+OFFSET_CREATEDMODSEQ));
record->gmtime = ntohll(*((bit64 *)(buf+OFFSET_GMTIME)));
record->last_updated = ntohll(*((bit64 *)(buf+OFFSET_LAST_UPDATED)));
Expand Down Expand Up @@ -3270,7 +3270,7 @@ static bit32 mailbox_index_record_to_buf(struct index_record *record,
goto crc;
}

*((bit64 *)(buf+OFFSET_THRID)) = htonll(record->cid);
*((bit64 *)(buf+OFFSET_CID)) = htonll(record->cid);

/* version 16 added createdmodseq, pushing the CRCs down */
if (version < 16) {
Expand Down Expand Up @@ -3301,7 +3301,7 @@ static bit32 mailbox_index_record_to_buf(struct index_record *record,
*((bit32 *)(buf+OFFSET_CACHE_VERSION)) = htonl(cache_version_field);
message_guid_export(&record->guid, (char *)buf+OFFSET_MESSAGE_GUID);
*((bit64 *)(buf+OFFSET_MODSEQ)) = htonll(record->modseq);
*((bit64 *)(buf+OFFSET_THRID)) = htonll(record->cid);
*((bit64 *)(buf+OFFSET_CID)) = htonll(record->cid);
*((bit64 *)(buf+OFFSET_CREATEDMODSEQ)) = htonll(record->createdmodseq);
*((bit64 *)(buf+OFFSET_GMTIME)) = htonll(record->gmtime);
*((bit64 *)(buf+OFFSET_LAST_UPDATED)) = htonll(record->last_updated);
Expand Down
2 changes: 1 addition & 1 deletion imap/mailbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ struct mailbox_iter;
#define OFFSET_CACHE_VERSION 56
#define OFFSET_MESSAGE_GUID 60
#define OFFSET_MODSEQ 80 /* CONDSTORE (64-bit modseq) */
#define OFFSET_THRID 88 /* conversation id, added in v13 */
#define OFFSET_CID 88 /* conversation id, added in v13 */
#define OFFSET_CREATEDMODSEQ 96 /* modseq of creation time, added in v16 */
#define OFFSET_GMTIME 104 /* grew to 64-bit in v20 */
#define OFFSET_LAST_UPDATED 112 /* grew to 64-bit in v20 */
Expand Down

0 comments on commit 9113754

Please sign in to comment.