aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camel/ChangeLog5
-rw-r--r--camel/camel-mime-part-utils.c17
-rw-r--r--camel/camel-stream-filter.c15
3 files changed, 23 insertions, 14 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index f641d8236c..9e983fc53d 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,8 @@
+2002-07-19 Not Zed <NotZed@Ximian.com>
+
+ * camel-mime-part-utils.c (convert_buffer): Changed to use a
+ different length calculator.
+
2002-07-17 Jeffrey Stedfast <fejj@ximian.com>
* camel-lock.c: Add the appropriate #include for the _() macro.
diff --git a/camel/camel-mime-part-utils.c b/camel/camel-mime-part-utils.c
index a76de32f0d..bf4d434b34 100644
--- a/camel/camel-mime-part-utils.c
+++ b/camel/camel-mime-part-utils.c
@@ -51,7 +51,8 @@
#include "camel-html-parser.h"
#include "camel-charset-map.h"
-#define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))*/
+#define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))
+ #include <stdio.h>*/
/* example: <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> */
@@ -113,7 +114,9 @@ convert_buffer (GByteArray *in, const char *to, const char *from)
if (in->len == 0)
return g_byte_array_new();
- d(printf("converting buffer from %s to %s: '%.*s'\n", from, to, (int)in->len, in->data));
+ d(printf("converting buffer from %s to %s:\n", from, to));
+ d(fwrite(in->data, 1, (int)in->len, stdout));
+ d(printf("\n"));
cd = e_iconv_open(to, from);
if (cd == (iconv_t) -1) {
@@ -144,7 +147,7 @@ convert_buffer (GByteArray *in, const char *to, const char *from)
* We just need to grow our outbuffer and try again.
*/
- converted = outlen - outleft;
+ converted = outbuf - (char *)out->data;
if (errno == E2BIG) {
outlen += inleft * 2 + 16;
out = g_byte_array_set_size (out, outlen);
@@ -164,9 +167,13 @@ convert_buffer (GByteArray *in, const char *to, const char *from)
e_iconv (cd, NULL, NULL, &outbuf, &outleft);
/* now set the true length on the GByteArray */
- converted = outlen - outleft;
+ converted = outbuf - (char *)out->data;
g_byte_array_set_size (out, converted);
-
+
+ d(printf("converted data:\n"));
+ d(fwrite(out->data, 1, (int)out->len, stdout));
+ d(printf("\n"));
+
e_iconv_close (cd);
return out;
diff --git a/camel/camel-stream-filter.c b/camel/camel-stream-filter.c
index bcb572278d..febfb04e24 100644
--- a/camel/camel-stream-filter.c
+++ b/camel/camel-stream-filter.c
@@ -242,7 +242,7 @@ do_read (CamelStream *stream, char *buffer, size_t n)
p->filtered = p->buffer;
p->filteredlen = size;
- d(printf ("\n\nOriginal content: '"));
+ d(printf ("\n\nOriginal content (%s): '", ((CamelObject *)filter->source)->klass->name));
d(fwrite(p->filtered, sizeof(char), p->filteredlen, stdout));
d(printf("'\n"));
@@ -251,8 +251,7 @@ do_read (CamelStream *stream, char *buffer, size_t n)
&p->filtered, &p->filteredlen, &presize);
g_check(p->realbuffer);
- d(printf ("Filtered content (%s): '",
- camel_type_to_name(((CamelObject *)f->filter)->s.type)));
+ d(printf ("Filtered content (%s): '", ((CamelObject *)f->filter)->klass->name));
d(fwrite(p->filtered, sizeof(char), p->filteredlen, stdout));
d(printf("'\n"));
@@ -286,7 +285,7 @@ do_write (CamelStream *stream, const char *buf, size_t n)
p->last_was_read = FALSE;
- d(printf ("\n\nWriting: Original content: '"));
+ d(printf ("\n\nWriting: Original content (%s): '", ((CamelObject *)filter->source)->klass->name));
d(fwrite(buffer, sizeof(char), len, stdout));
d(printf("'\n"));
@@ -299,8 +298,7 @@ do_write (CamelStream *stream, const char *buf, size_t n)
g_check(p->realbuffer);
- d(printf ("Filtered content (%s): '",
- camel_type_to_name(((CamelObject *)f->filter)->s.type)));
+ d(printf ("Filtered content (%s): '", ((CamelObject *)f->filter)->klass->name));
d(fwrite(buffer, sizeof(char), len, stdout));
d(printf("'\n"));
@@ -335,15 +333,14 @@ do_flush (CamelStream *stream)
presize = 0;
f = p->filters;
- d(printf ("\n\nFlushing: Original content: '"));
+ d(printf ("\n\nFlushing: Original content (%s): '", ((CamelObject *)filter->source)->klass->name));
d(fwrite(buffer, sizeof(char), len, stdout));
d(printf("'\n"));
while (f) {
camel_mime_filter_complete(f->filter, buffer, len, presize, &buffer, &len, &presize);
- d(printf ("Filtered content (%s): '",
- camel_type_to_name(((CamelObject *)f->filter)->s.type)));
+ d(printf ("Filtered content (%s): '", ((CamelObject *)f->filter)->klass->name));
d(fwrite(buffer, sizeof(char), len, stdout));
d(printf("'\n"));