Link Here
|
2 |
--- a/PATCHES |
2 |
--- a/PATCHES |
3 |
+++ b/PATCHES |
3 |
+++ b/PATCHES |
4 |
@@ -0,0 +1 @@ |
4 |
@@ -0,0 +1 @@ |
5 |
+patch-1.5.6.tg.hcache.10 |
5 |
+patch-1.5.6.tg.hcache.11 |
6 |
diff -Nru a/configure.in b/configure.in |
6 |
diff -Nru a/configure.in b/configure.in |
7 |
--- a/configure.in 2004-08-18 09:43:09 +02:00 |
7 |
--- a/configure.in 2004-08-18 09:43:09 +02:00 |
8 |
+++ b/configure.in 2004-10-14 07:21:52 +02:00 |
8 |
+++ b/configure.in 2004-10-14 07:21:52 +02:00 |
Link Here
|
131 |
WHERE char *MhUnseen; |
131 |
WHERE char *MhUnseen; |
132 |
diff -Nru a/hcache.c b/hcache.c |
132 |
diff -Nru a/hcache.c b/hcache.c |
133 |
--- /dev/null Wed Dec 31 16:00:00 196900 |
133 |
--- /dev/null Wed Dec 31 16:00:00 196900 |
134 |
+++ b/hcache.c 2004-09-28 19:57:45 +02:00 |
134 |
+++ b/hcache.c 2004-11-09 00:09:22 +01:00 |
135 |
@@ -0,0 +1,856 @@ |
135 |
@@ -0,0 +1,880 @@ |
136 |
+/* |
136 |
+/* |
137 |
+ * Copyright (C) 2004 Thomas Glanzmann <sithglan@stud.uni-erlangen.de> |
137 |
+ * Copyright (C) 2004 Thomas Glanzmann <sithglan@stud.uni-erlangen.de> |
138 |
+ * Copyright (C) 2004 Tobias Werth <sitowert@stud.uni-erlangen.de> |
138 |
+ * Copyright (C) 2004 Tobias Werth <sitowert@stud.uni-erlangen.de> |
Link Here
|
200 |
+ unsigned long long uid_validity; |
200 |
+ unsigned long long uid_validity; |
201 |
+} validate; |
201 |
+} validate; |
202 |
+ |
202 |
+ |
|
|
203 |
+static void * |
204 |
+lazy_malloc(size_t siz) |
205 |
+{ |
206 |
+ if (0 < siz && siz < 4096) { |
207 |
+ siz = 4096; |
208 |
+ } |
209 |
+ |
210 |
+ return safe_malloc(siz); |
211 |
+} |
212 |
+ |
213 |
+static void |
214 |
+lazy_realloc(void *ptr, size_t siz) |
215 |
+{ |
216 |
+ void **p = (void **)ptr; |
217 |
+ |
218 |
+ if ( p != NULL |
219 |
+ && 0 < siz |
220 |
+ && siz < 4096) { |
221 |
+ return; |
222 |
+ } |
223 |
+ |
224 |
+ safe_realloc(ptr, siz); |
225 |
+} |
226 |
+ |
203 |
+static unsigned char * |
227 |
+static unsigned char * |
204 |
+dump_int(unsigned int i, unsigned char *d, int *off) |
228 |
+dump_int(unsigned int i, unsigned char *d, int *off) |
205 |
+{ |
229 |
+{ |
206 |
+ safe_realloc(&d, *off + sizeof(int)); |
230 |
+ lazy_realloc(&d, *off + sizeof(int)); |
207 |
+ memcpy(d + *off, &i, sizeof(int)); |
231 |
+ memcpy(d + *off, &i, sizeof(int)); |
208 |
+ (*off) += sizeof(int); |
232 |
+ (*off) += sizeof(int); |
209 |
+ |
233 |
+ |
Link Here
|
230 |
+ |
254 |
+ |
231 |
+ size = mutt_strlen(c) + 1; |
255 |
+ size = mutt_strlen(c) + 1; |
232 |
+ d = dump_int(size, d, off); |
256 |
+ d = dump_int(size, d, off); |
233 |
+ safe_realloc(&d, *off + size); |
257 |
+ lazy_realloc(&d, *off + size); |
234 |
+ memcpy(d + *off, c, size); |
258 |
+ memcpy(d + *off, c, size); |
235 |
+ *off += size; |
259 |
+ *off += size; |
236 |
+ |
260 |
+ |
Link Here
|
247 |
+ } |
271 |
+ } |
248 |
+ |
272 |
+ |
249 |
+ d = dump_int(size, d, off); |
273 |
+ d = dump_int(size, d, off); |
250 |
+ safe_realloc(&d, *off + size); |
274 |
+ lazy_realloc(&d, *off + size); |
251 |
+ memcpy(d + *off, c, size); |
275 |
+ memcpy(d + *off, c, size); |
252 |
+ *off += size; |
276 |
+ *off += size; |
253 |
+ |
277 |
+ |
Link Here
|
430 |
+static unsigned char * |
454 |
+static unsigned char * |
431 |
+dump_body(BODY *c, unsigned char *d, int *off) |
455 |
+dump_body(BODY *c, unsigned char *d, int *off) |
432 |
+{ |
456 |
+{ |
433 |
+ safe_realloc(&d, *off + sizeof(BODY)); |
457 |
+ lazy_realloc(&d, *off + sizeof(BODY)); |
434 |
+ memcpy(d + *off, c, sizeof(BODY)); |
458 |
+ memcpy(d + *off, c, sizeof(BODY)); |
435 |
+ *off += sizeof(BODY); |
459 |
+ *off += sizeof(BODY); |
436 |
+ |
460 |
+ |
Link Here
|
542 |
+{ |
566 |
+{ |
543 |
+ int crc = 0; |
567 |
+ int crc = 0; |
544 |
+ |
568 |
+ |
545 |
+ crc = crc32(crc, (unsigned char const *) "sithglan@stud.uni-erlangen.de[sithglan]|hcache.c|20040928175752|08278", mutt_strlen("sithglan@stud.uni-erlangen.de[sithglan]|hcache.c|20040928175752|08278")); |
569 |
+ crc = crc32(crc, (unsigned char const *) "sithglan@stud.uni-erlangen.de[sithglan]|hcache.c|20041108231548|29613", mutt_strlen("sithglan@stud.uni-erlangen.de[sithglan]|hcache.c|20041108231548|29613")); |
546 |
+ |
570 |
+ |
547 |
+#if HAVE_LANGINFO_CODESET |
571 |
+#if HAVE_LANGINFO_CODESET |
548 |
+ crc = crc32(crc, (unsigned char const *) Charset, mutt_strlen(Charset)); |
572 |
+ crc = crc32(crc, (unsigned char const *) Charset, mutt_strlen(Charset)); |
Link Here
|
629 |
+ unsigned char *d = NULL; |
653 |
+ unsigned char *d = NULL; |
630 |
+ *off = 0; |
654 |
+ *off = 0; |
631 |
+ |
655 |
+ |
632 |
+ d = safe_malloc(sizeof(validate)); |
656 |
+ d = lazy_malloc(sizeof(validate)); |
633 |
+ |
657 |
+ |
634 |
+ if (uid_validity) { |
658 |
+ if (uid_validity) { |
635 |
+ memcpy(d, &uid_validity, sizeof(long long)); |
659 |
+ memcpy(d, &uid_validity, sizeof(long long)); |
Link Here
|
642 |
+ |
666 |
+ |
643 |
+ d = dump_int(db->crc, d, off); |
667 |
+ d = dump_int(db->crc, d, off); |
644 |
+ |
668 |
+ |
645 |
+ safe_realloc(&d, *off + sizeof(HEADER)); |
669 |
+ lazy_realloc(&d, *off + sizeof(HEADER)); |
646 |
+ memcpy(d + *off, h, sizeof(HEADER)); |
670 |
+ memcpy(d + *off, h, sizeof(HEADER)); |
647 |
+ *off += sizeof(HEADER); |
671 |
+ *off += sizeof(HEADER); |
648 |
+ |
672 |
+ |