projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ESMTP is utterly broken, and pulls OpenSSL.
[apps/madmutt.git]
/
lib-mx
/
hcache.c
diff --git
a/lib-mx/hcache.c
b/lib-mx/hcache.c
index
74ccb5d
..
e59e43a
100644
(file)
--- a/
lib-mx/hcache.c
+++ b/
lib-mx/hcache.c
@@
-52,13
+52,11
@@
static unsigned int crc32(unsigned int crc, const void *src, ssize_t len)
static int generate_crc32(void)
{
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"));
crc = crc32(crc, "madmutt.2007.05.13", m_strlen("madmutt.2007.05.13"));
-#ifdef HAVE_LANGINFO_CODESET
- crc = crc32(crc, MCharset.charset, m_strlen(MCharset.charset));
- crc = crc32(crc, "HAVE_LANGINFO_CODESET",
- m_strlen("HAVE_LANGINFO_CODESET"));
+#ifdef HAVE_LANGINFO_H
+ crc = crc32(crc, mod_cset.charset, m_strlen(mod_cset.charset));
#endif
crc = crc32(crc, "USE_POP", m_strlen("USE_POP"));
crc = crc32(crc, "MIXMASTER", m_strlen("MIXMASTER"));
#endif
crc = crc32(crc, "USE_POP", m_strlen("USE_POP"));
crc = crc32(crc, "MIXMASTER", m_strlen("MIXMASTER"));
@@
-97,6
+95,11
@@
mutt_hcache_per_folder(const char *path, const char *folder)
/* store and restore things {{{ */
/* 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));
static const void *restore_int(const char *d, int *i)
{
memcpy(i, d, sizeof(*i));
@@
-108,12
+111,12
@@
static void dump_cstr(buffer_t *buf, const char *s)
int size = 0;
if (m_strisempty(s)) {
int size = 0;
if (m_strisempty(s)) {
-
buffer_add(buf, &size, sizeof(size)
);
+
dump_int(buf, size
);
return;
}
size = strlen(s) + 1;
return;
}
size = strlen(s) + 1;
-
buffer_add(buf, &size, sizeof(size)
);
+
dump_int(buf, size
);
buffer_add(buf, s, size);
}
buffer_add(buf, s, size);
}
@@
-130,12
+133,12
@@
static void dump_address(buffer_t *buf, address_t *a)
{
int counter = 0, pos = buf->len;
{
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);
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));
}
memcpy(buf->data + pos, &counter, sizeof(counter));
@@
-164,7
+167,7
@@
static void dump_list(buffer_t *buf, string_list_t *l)
int pos = buf->len;
int counter = 0;
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);
for (; l; l = l->next, counter++) {
dump_cstr(buf, l->data);
@@
-193,7
+196,7
@@
static void dump_parameter(buffer_t *buf, parameter_t *p)
{
int pos = buf->len, counter = 0;
{
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);
for (; p; p = p->next, counter++) {
dump_cstr(buf, p->attribute);
@@
-266,7
+269,7
@@
static void dump_envelope(buffer_t *buf, ENVELOPE * e)
dump_cstr(buf, e->subject);
n = e->real_subj ? e->real_subj - e->subject : -1;
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);
dump_cstr(buf, e->message_id);
dump_cstr(buf, e->supersedes);
@@
-278,7
+281,6
@@
static void dump_envelope(buffer_t *buf, ENVELOPE * e)
dump_cstr(buf, e->newsgroups);
dump_cstr(buf, e->xref);
dump_cstr(buf, e->followup_to);
dump_cstr(buf, e->newsgroups);
dump_cstr(buf, e->xref);
dump_cstr(buf, e->followup_to);
- dump_cstr(buf, e->x_comment_to);
#endif
dump_list(buf, e->references);
#endif
dump_list(buf, e->references);
@@
-316,7
+318,6
@@
static const void *restore_envelope(const char *d, ENVELOPE *e)
d = restore_cstr(d, &e->newsgroups);
d = restore_cstr(d, &e->xref);
d = restore_cstr(d, &e->followup_to);
d = restore_cstr(d, &e->newsgroups);
d = restore_cstr(d, &e->xref);
d = restore_cstr(d, &e->followup_to);
- d = restore_cstr(d, &e->x_comment_to);
#endif
d = restore_list(d, &e->references);
#endif
d = restore_list(d, &e->references);
@@
-334,7
+335,7
@@
static buffer_t *mutt_hcache_dump(hcache_t *db, HEADER *h, long uid_validity)
uid_validity = time(NULL);
}
buffer_add(res, &uid_validity, sizeof(uid_validity));
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);
buffer_add(res, h, sizeof(*h));
dump_envelope(res, h->env);
@@
-429,7
+430,7
@@
void *mutt_hcache_fetch(hcache_t *db, const char *filename,
ssize_t (*keylen)(const char *fn))
{
char path[_POSIX_PATH_MAX];
ssize_t (*keylen)(const char *fn))
{
char path[_POSIX_PATH_MAX];
-
void
*data = NULL;
+
char
*data = NULL;
if (!db)
return NULL;
if (!db)
return NULL;