diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-09-19 09:00:23 +0000 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-09-19 09:00:23 +0000 |
commit | 1b3b8c410b2b630f5423f6cf9edb1e12cd8d4ead (patch) | |
tree | 22dfacbb84a42616349c92283517fb7087597c61 | |
parent | 98e7fa7bd7d827e6d49439924e49e91bbfb87b5e (diff) | |
download | gmime-1b3b8c410b2b630f5423f6cf9edb1e12cd8d4ead.tar.gz |
Reset the position offset. Doh!
2001-09-19 Jeffrey Stedfast <fejj@ximian.com>
* gmime-stream-fs.c (stream_reset): Reset the position offset. Doh!
* gmime-stream.c (g_mime_stream_write_to_stream): Don't increment
total if no bytes were read/written.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | gmime-data-wrapper.c | 1 | ||||
-rw-r--r-- | gmime-parser.c | 2 | ||||
-rw-r--r-- | gmime-part.c | 16 | ||||
-rw-r--r-- | gmime-stream-fs.c | 2 | ||||
-rw-r--r-- | gmime-stream.c | 4 | ||||
-rw-r--r-- | gmime/gmime-data-wrapper.c | 1 | ||||
-rw-r--r-- | gmime/gmime-parser.c | 2 | ||||
-rw-r--r-- | gmime/gmime-part.c | 16 | ||||
-rw-r--r-- | gmime/gmime-stream-fs.c | 2 | ||||
-rw-r--r-- | gmime/gmime-stream.c | 4 |
11 files changed, 39 insertions, 16 deletions
@@ -1,5 +1,10 @@ 2001-09-19 Jeffrey Stedfast <fejj@ximian.com> + * gmime-stream-fs.c (stream_reset): Reset the position offset. Doh! + + * gmime-stream.c (g_mime_stream_write_to_stream): Don't increment + total if no bytes were read/written. + * gmime-stream-filter.c (stream_substream): Copy over the filters. * gmime-part.c (g_mime_part_verify_content_md5): Updated. diff --git a/gmime-data-wrapper.c b/gmime-data-wrapper.c index 61cc0d76..985e17fd 100644 --- a/gmime-data-wrapper.c +++ b/gmime-data-wrapper.c @@ -169,6 +169,7 @@ g_mime_data_wrapper_write_to_stream (GMimeDataWrapper *wrapper, GMimeStream *str ssize_t written; g_return_val_if_fail (wrapper != NULL, -1); + g_return_val_if_fail (stream != NULL, -1); g_return_val_if_fail (wrapper->stream != NULL, -1); filtered_stream = g_mime_stream_filter_new_with_stream (wrapper->stream); diff --git a/gmime-parser.c b/gmime-parser.c index b1553166..7af5649f 100644 --- a/gmime-parser.c +++ b/gmime-parser.c @@ -367,7 +367,7 @@ g_mime_parser_construct_part_internal (GMimeStream *stream, GMimeStreamMem *mem) /* from here to the end is the content */ if (inptr < inend) { - for (inptr++; inptr < inend && isspace ((int)*inptr); inptr++); + for (inptr++; inptr < inend && isspace ((unsigned) *inptr); inptr++); len = inend - inptr; content = inptr; diff --git a/gmime-part.c b/gmime-part.c index c1dd7f13..8cebe8d3 100644 --- a/gmime-part.c +++ b/gmime-part.c @@ -241,14 +241,14 @@ g_mime_part_set_content_md5 (GMimePart *mime_part, const char *content_md5) if (content_md5) { mime_part->content_md5 = g_strdup (content_md5); - } else if (mime_part->content->stream) { + } else if (mime_part->content && mime_part->content->stream) { char digest[16], b64digest[32]; int len, state, save; GMimeStream *stream; GByteArray *buf; stream = mime_part->content->stream; - if (stream && (!GMIME_IS_STREAM_MEM (stream) || NEEDS_DECODING (mime_part->content->encoding))) { + if (!GMIME_IS_STREAM_MEM (stream) || NEEDS_DECODING (mime_part->content->encoding)) { stream = g_mime_stream_mem_new (); g_mime_data_wrapper_write_to_stream (mime_part->content, stream); } else { @@ -295,7 +295,10 @@ g_mime_part_verify_content_md5 (GMimePart *mime_part) g_return_val_if_fail (mime_part->content_md5 != NULL, FALSE); stream = mime_part->content->stream; - if (stream && (!GMIME_IS_STREAM_MEM (stream) || NEEDS_DECODING (mime_part->content->encoding))) { + if (!stream) + return FALSE; + + if (!GMIME_IS_STREAM_MEM (stream) || NEEDS_DECODING (mime_part->content->encoding)) { stream = g_mime_stream_mem_new (); g_mime_data_wrapper_write_to_stream (mime_part->content, stream); } else { @@ -867,11 +870,13 @@ g_mime_part_get_content (const GMimePart *mime_part, guint *len) g_return_val_if_fail (mime_part != NULL, NULL); - if (!mime_part->content || !mime_part->content->stream) + if (!mime_part->content || !mime_part->content->stream) { + g_warning ("no content set on this mime part"); return NULL; + } stream = mime_part->content->stream; - if (stream && (!GMIME_IS_STREAM_MEM (stream) || NEEDS_DECODING (mime_part->content->encoding))) { + if (!GMIME_IS_STREAM_MEM (stream) || NEEDS_DECODING (mime_part->content->encoding)) { /* Decode and cache this mime part's contents... */ GMimeStream *cache; @@ -1027,6 +1032,7 @@ write_content (GMimePart *part, GMimeStream *stream) } written = g_mime_data_wrapper_write_to_stream (part->content, filtered_stream); + g_mime_stream_flush (filtered_stream); g_mime_stream_unref (filtered_stream); /* this is just so that I get a warning on fail... */ diff --git a/gmime-stream-fs.c b/gmime-stream-fs.c index 92f0748d..ba3fd37e 100644 --- a/gmime-stream-fs.c +++ b/gmime-stream-fs.c @@ -158,6 +158,8 @@ stream_reset (GMimeStream *stream) if (ret != -1) fstream->eos = FALSE; + stream->position = stream->bound_start; + return ret; } diff --git a/gmime-stream.c b/gmime-stream.c index 178992b2..ee3229c5 100644 --- a/gmime-stream.c +++ b/gmime-stream.c @@ -380,9 +380,9 @@ g_mime_stream_write_to_stream (GMimeStream *src, GMimeStream *dest) nwritten += len; } + + total += nwritten; } - - total += nwritten; } return total; diff --git a/gmime/gmime-data-wrapper.c b/gmime/gmime-data-wrapper.c index 61cc0d76..985e17fd 100644 --- a/gmime/gmime-data-wrapper.c +++ b/gmime/gmime-data-wrapper.c @@ -169,6 +169,7 @@ g_mime_data_wrapper_write_to_stream (GMimeDataWrapper *wrapper, GMimeStream *str ssize_t written; g_return_val_if_fail (wrapper != NULL, -1); + g_return_val_if_fail (stream != NULL, -1); g_return_val_if_fail (wrapper->stream != NULL, -1); filtered_stream = g_mime_stream_filter_new_with_stream (wrapper->stream); diff --git a/gmime/gmime-parser.c b/gmime/gmime-parser.c index b1553166..7af5649f 100644 --- a/gmime/gmime-parser.c +++ b/gmime/gmime-parser.c @@ -367,7 +367,7 @@ g_mime_parser_construct_part_internal (GMimeStream *stream, GMimeStreamMem *mem) /* from here to the end is the content */ if (inptr < inend) { - for (inptr++; inptr < inend && isspace ((int)*inptr); inptr++); + for (inptr++; inptr < inend && isspace ((unsigned) *inptr); inptr++); len = inend - inptr; content = inptr; diff --git a/gmime/gmime-part.c b/gmime/gmime-part.c index c1dd7f13..8cebe8d3 100644 --- a/gmime/gmime-part.c +++ b/gmime/gmime-part.c @@ -241,14 +241,14 @@ g_mime_part_set_content_md5 (GMimePart *mime_part, const char *content_md5) if (content_md5) { mime_part->content_md5 = g_strdup (content_md5); - } else if (mime_part->content->stream) { + } else if (mime_part->content && mime_part->content->stream) { char digest[16], b64digest[32]; int len, state, save; GMimeStream *stream; GByteArray *buf; stream = mime_part->content->stream; - if (stream && (!GMIME_IS_STREAM_MEM (stream) || NEEDS_DECODING (mime_part->content->encoding))) { + if (!GMIME_IS_STREAM_MEM (stream) || NEEDS_DECODING (mime_part->content->encoding)) { stream = g_mime_stream_mem_new (); g_mime_data_wrapper_write_to_stream (mime_part->content, stream); } else { @@ -295,7 +295,10 @@ g_mime_part_verify_content_md5 (GMimePart *mime_part) g_return_val_if_fail (mime_part->content_md5 != NULL, FALSE); stream = mime_part->content->stream; - if (stream && (!GMIME_IS_STREAM_MEM (stream) || NEEDS_DECODING (mime_part->content->encoding))) { + if (!stream) + return FALSE; + + if (!GMIME_IS_STREAM_MEM (stream) || NEEDS_DECODING (mime_part->content->encoding)) { stream = g_mime_stream_mem_new (); g_mime_data_wrapper_write_to_stream (mime_part->content, stream); } else { @@ -867,11 +870,13 @@ g_mime_part_get_content (const GMimePart *mime_part, guint *len) g_return_val_if_fail (mime_part != NULL, NULL); - if (!mime_part->content || !mime_part->content->stream) + if (!mime_part->content || !mime_part->content->stream) { + g_warning ("no content set on this mime part"); return NULL; + } stream = mime_part->content->stream; - if (stream && (!GMIME_IS_STREAM_MEM (stream) || NEEDS_DECODING (mime_part->content->encoding))) { + if (!GMIME_IS_STREAM_MEM (stream) || NEEDS_DECODING (mime_part->content->encoding)) { /* Decode and cache this mime part's contents... */ GMimeStream *cache; @@ -1027,6 +1032,7 @@ write_content (GMimePart *part, GMimeStream *stream) } written = g_mime_data_wrapper_write_to_stream (part->content, filtered_stream); + g_mime_stream_flush (filtered_stream); g_mime_stream_unref (filtered_stream); /* this is just so that I get a warning on fail... */ diff --git a/gmime/gmime-stream-fs.c b/gmime/gmime-stream-fs.c index 92f0748d..ba3fd37e 100644 --- a/gmime/gmime-stream-fs.c +++ b/gmime/gmime-stream-fs.c @@ -158,6 +158,8 @@ stream_reset (GMimeStream *stream) if (ret != -1) fstream->eos = FALSE; + stream->position = stream->bound_start; + return ret; } diff --git a/gmime/gmime-stream.c b/gmime/gmime-stream.c index 178992b2..ee3229c5 100644 --- a/gmime/gmime-stream.c +++ b/gmime/gmime-stream.c @@ -380,9 +380,9 @@ g_mime_stream_write_to_stream (GMimeStream *src, GMimeStream *dest) nwritten += len; } + + total += nwritten; } - - total += nwritten; } return total; |