static int generate_crc32(void)
{
- static int crc = 0;
+ int crc = 0;
crc = crc32(crc, "madmutt.2007.05.13", m_strlen("madmutt.2007.05.13"));
#ifdef HAVE_LANGINFO_CODESET
/* store and restore things {{{ */
+static void dump_int(buffer_t *buf, int i)
+{
+ buffer_add(buf, &i, sizeof(i));
+}
+
static const void *restore_int(const char *d, int *i)
{
memcpy(i, d, sizeof(*i));
int size = 0;
if (m_strisempty(s)) {
- buffer_add(buf, &size, sizeof(size));
+ dump_int(buf, size);
return;
}
size = strlen(s) + 1;
- buffer_add(buf, &size, sizeof(size));
+ dump_int(buf, size);
buffer_add(buf, s, size);
}
{
int counter = 0, pos = buf->len;
- buffer_add(buf, &counter, sizeof(counter));
+ dump_int(buf, counter);
for (; a; a = a->next, counter++) {
dump_cstr(buf, a->personal);
dump_cstr(buf, a->mailbox);
- buffer_add(buf, &a->group, sizeof(a->group));
+ dump_int(buf, a->group);
}
memcpy(buf->data + pos, &counter, sizeof(counter));
int pos = buf->len;
int counter = 0;
- buffer_add(buf, &counter, sizeof(counter));
+ dump_int(buf, counter);
for (; l; l = l->next, counter++) {
dump_cstr(buf, l->data);
{
int pos = buf->len, counter = 0;
- buffer_add(buf, &counter, sizeof(counter));
+ dump_int(buf, counter);
for (; p; p = p->next, counter++) {
dump_cstr(buf, p->attribute);
dump_cstr(buf, e->subject);
n = e->real_subj ? e->real_subj - e->subject : -1;
- buffer_add(buf, &n, sizeof(n));
+ dump_int(buf, n);
dump_cstr(buf, e->message_id);
dump_cstr(buf, e->supersedes);
uid_validity = time(NULL);
}
buffer_add(res, &uid_validity, sizeof(uid_validity));
- buffer_add(res, &db->crc, sizeof(db->crc));
+ dump_int(res, db->crc);
buffer_add(res, h, sizeof(*h));
dump_envelope(res, h->env);