Skip to content

Commit ad3ceb9

Browse files
committed
mailbox.[ch]: v20 - grow size and time fields to 64-bits
1 parent e6444e7 commit ad3ceb9

File tree

14 files changed

+386
-167
lines changed

14 files changed

+386
-167
lines changed

cassandane/Cassandane/Cyrus/Reconstruct.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ sub test_downgrade_upgrade
617617
$msg{A}->set_attribute(flags => ['\\Seen']);
618618
$self->check_messages(\%msg);
619619

620-
for my $version (12, 14, 16, 'max') {
620+
for my $version (12, 14, 16, 19, 'max') {
621621
xlog $self, "Set to version $version";
622622
$self->{instance}->run_command({ cyrus => 1 }, 'reconstruct', '-V', $version);
623623

cunit/mailbox.testc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,15 @@ static void test_aligned_record_offsets(void)
123123
CU_ASSERT_EQUAL(0, OFFSET_CACHE_OFFSET % alignof(XXX_CACHE32_TYPE));
124124
CU_ASSERT_EQUAL(0, OFFSET_CACHE_VERSION % alignof(XXX_CACHE32_TYPE));
125125
CU_ASSERT_EQUAL(0, OFFSET_CREATEDMODSEQ % alignof(r.createdmodseq));
126-
CU_ASSERT_EQUAL(0, OFFSET_GMTIME % alignof(XXX_TIME32_TYPE));
126+
CU_ASSERT_EQUAL(0, OFFSET_GMTIME % alignof(r.gmtime));
127127
CU_ASSERT_EQUAL(0, OFFSET_HEADER_SIZE % alignof(r.header_size));
128-
CU_ASSERT_EQUAL(0, OFFSET_INTERNALDATE % alignof(XXX_TIME32_TYPE));
129-
CU_ASSERT_EQUAL(0, OFFSET_LAST_UPDATED % alignof(XXX_TIME32_TYPE));
128+
CU_ASSERT_EQUAL(0, OFFSET_INTERNALDATE % alignof(r.internaldate));
129+
CU_ASSERT_EQUAL(0, OFFSET_LAST_UPDATED % alignof(r.last_updated));
130130
CU_ASSERT_EQUAL(0, OFFSET_MESSAGE_GUID % alignof(char)); /* r/w uses memcpy */
131131
CU_ASSERT_EQUAL(0, OFFSET_MODSEQ % alignof(r.modseq));
132132
CU_ASSERT_EQUAL(0, OFFSET_RECORD_CRC % alignof(uint32_t)); /* not in struct */
133-
CU_ASSERT_EQUAL(0, OFFSET_SAVEDATE % alignof(XXX_TIME32_TYPE));
134-
CU_ASSERT_EQUAL(0, OFFSET_SENTDATE % alignof(XXX_TIME32_TYPE));
133+
CU_ASSERT_EQUAL(0, OFFSET_SAVEDATE % alignof(r.savedate));
134+
CU_ASSERT_EQUAL(0, OFFSET_SENTDATE % alignof(r.sentdate));
135135
CU_ASSERT_EQUAL(0, OFFSET_SIZE % alignof(r.size));
136136
CU_ASSERT_EQUAL(0, OFFSET_SYSTEM_FLAGS % alignof(r.system_flags));
137137
CU_ASSERT_EQUAL(0, OFFSET_THRID % alignof(r.cid));
@@ -247,15 +247,15 @@ static void test_unique_record_offsets(void)
247247
OFFSET(OFFSET_CACHE_OFFSET, sizeof(XXX_CACHE32_TYPE)),
248248
OFFSET(OFFSET_CACHE_VERSION, sizeof(XXX_CACHE32_TYPE)),
249249
OFFSET(OFFSET_CREATEDMODSEQ, sizeof(r.createdmodseq)),
250-
OFFSET(OFFSET_GMTIME, sizeof(XXX_TIME32_TYPE)),
250+
OFFSET(OFFSET_GMTIME, sizeof(r.gmtime)),
251251
OFFSET(OFFSET_HEADER_SIZE, sizeof(r.header_size)),
252-
OFFSET(OFFSET_INTERNALDATE, sizeof(XXX_TIME32_TYPE)),
253-
OFFSET(OFFSET_LAST_UPDATED, sizeof(XXX_TIME32_TYPE)),
252+
OFFSET(OFFSET_INTERNALDATE, sizeof(r.internaldate)),
253+
OFFSET(OFFSET_LAST_UPDATED, sizeof(r.last_updated)),
254254
OFFSET(OFFSET_MESSAGE_GUID, MESSAGE_GUID_SIZE),
255255
OFFSET(OFFSET_MODSEQ, sizeof(r.modseq)),
256256
OFFSET(OFFSET_RECORD_CRC, sizeof(uint32_t)), /* not in struct */
257-
OFFSET(OFFSET_SAVEDATE, sizeof(XXX_TIME32_TYPE)),
258-
OFFSET(OFFSET_SENTDATE, sizeof(XXX_TIME32_TYPE)),
257+
OFFSET(OFFSET_SAVEDATE, sizeof(r.savedate)),
258+
OFFSET(OFFSET_SENTDATE, sizeof(r.sentdate)),
259259
OFFSET(OFFSET_SIZE, sizeof(r.size)),
260260
OFFSET(OFFSET_SYSTEM_FLAGS, sizeof(r.system_flags)),
261261
OFFSET(OFFSET_THRID, sizeof(r.cid)),

imap/backend.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,8 +1336,12 @@ EXPORTED int backend_version(struct backend *be)
13361336
return MAILBOX_MINOR_VERSION;
13371337
}
13381338
else if (major == 3) {
1339-
if (minor >= 10) {
1340-
/* all versions since 3.10 have been 19 so far */
1339+
if (minor >= 13) {
1340+
/* all versions since 3.13 have been 20 so far */
1341+
return 20;
1342+
}
1343+
else if (minor >= 10) {
1344+
/* version 3.10 - 3.12 were 19 */
13411345
return 19;
13421346
}
13431347
else if (minor >= 3) {

imap/http_dav.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1946,7 +1946,7 @@ int propfind_getlength(const xmlChar *name, xmlNsPtr ns,
19461946
buf_reset(&fctx->buf);
19471947

19481948
if (fctx->record) {
1949-
buf_printf(&fctx->buf, "%u",
1949+
buf_printf(&fctx->buf, UINT64_FMT,
19501950
fctx->record->size - fctx->record->header_size);
19511951
}
19521952

@@ -2974,7 +2974,7 @@ EXPORTED int propfind_quota(const xmlChar *name, xmlNsPtr ns,
29742974
}
29752975
else if (fctx->record) {
29762976
/* Bytes used by resource */
2977-
buf_printf(&fctx->buf, "%u", fctx->record->size);
2977+
buf_printf(&fctx->buf, UINT64_FMT, fctx->record->size);
29782978
}
29792979
else if (fctx->mailbox) {
29802980
/* Bytes used by calendar collection */

imap/index.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4485,7 +4485,7 @@ static int index_fetchreply(struct index_state *state, uint32_t msgno,
44854485
sepchar = ' ';
44864486
}
44874487
if (fetchitems & FETCH_SIZE) {
4488-
prot_printf(state->out, "%cRFC822.SIZE %u",
4488+
prot_printf(state->out, "%cRFC822.SIZE " UINT64_FMT,
44894489
sepchar, record.size);
44904490
sepchar = ' ';
44914491
}

imap/ipurge.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ static void print_record(struct mailbox *mailbox,
387387
const struct index_record *record)
388388
{
389389
printf("UID: %u\n", record->uid);
390-
printf("\tSize: %u\n", record->size);
390+
printf("\tSize: " UINT64_FMT "\n", record->size);
391391
printf("\tSent: %s", ctime(&record->sentdate));
392392
printf("\tRecv: %s", ctime(&record->internaldate));
393393

0 commit comments

Comments
 (0)