diff options
author | bertrand <Bertrand.Guiheneuf@aful.org> | 2000-02-17 02:04:40 +0800 |
---|---|---|
committer | Bertrand Guiheneuf <bertrand@src.gnome.org> | 2000-02-17 02:04:40 +0800 |
commit | 7f04720b1efe9baea8770813e85cb17cd600d077 (patch) | |
tree | a4749e3ecc075439dddf3928584a88b8d11d3e76 /camel | |
parent | d2239da3e7758ed99263b6623ab258561e10994d (diff) | |
download | gsoc2013-evolution-7f04720b1efe9baea8770813e85cb17cd600d077.tar gsoc2013-evolution-7f04720b1efe9baea8770813e85cb17cd600d077.tar.gz gsoc2013-evolution-7f04720b1efe9baea8770813e85cb17cd600d077.tar.bz2 gsoc2013-evolution-7f04720b1efe9baea8770813e85cb17cd600d077.tar.lz gsoc2013-evolution-7f04720b1efe9baea8770813e85cb17cd600d077.tar.xz gsoc2013-evolution-7f04720b1efe9baea8770813e85cb17cd600d077.tar.zst gsoc2013-evolution-7f04720b1efe9baea8770813e85cb17cd600d077.zip |
don't seek the begining of the substream. (_eos): fix eos condition
2000-02-16 bertrand <Bertrand.Guiheneuf@aful.org>
* camel/camel-seekable-substream.c (_set_bounds): don't
seek the begining of the substream.
(_eos): fix eos condition testing.
(_finalize): unref parent stream
(_init_with_seekable_stream_and_bounds): ref parent stream
* camel/gstring-util.c (g_string_equal_for_hash):
(g_string_equal_for_glist): return type is int.
* camel/camel.h:
* camel/camel.c (camel_init): use (void)
instead of ().
A lot of other small changes to make the set_input_stream
scheme work. It actually works.
svn path=/trunk/; revision=1798
Diffstat (limited to 'camel')
-rw-r--r-- | camel/camel-folder-pt-proxy.c | 1 | ||||
-rw-r--r-- | camel/camel-folder-pt-proxy.h | 2 | ||||
-rw-r--r-- | camel/camel-mime-body-part.c | 4 | ||||
-rw-r--r-- | camel/camel-mime-body-part.h | 8 | ||||
-rw-r--r-- | camel/camel-mime-part-utils.c | 1 | ||||
-rw-r--r-- | camel/camel-mime-part.c | 3 | ||||
-rw-r--r-- | camel/camel-multipart.c | 200 | ||||
-rw-r--r-- | camel/camel-multipart.h | 30 | ||||
-rw-r--r-- | camel/camel-seekable-substream.c | 25 | ||||
-rw-r--r-- | camel/camel-store.h | 29 | ||||
-rw-r--r-- | camel/camel-stream-fs.c | 6 | ||||
-rw-r--r-- | camel/camel-thread-proxy.c | 6 | ||||
-rw-r--r-- | camel/camel-thread-proxy.h | 2 | ||||
-rw-r--r-- | camel/camel.c | 2 | ||||
-rw-r--r-- | camel/camel.h | 2 | ||||
-rw-r--r-- | camel/gstring-util.c | 2 | ||||
-rw-r--r-- | camel/providers/mbox/Makefile.am | 1 | ||||
-rw-r--r-- | camel/string-utils.c | 1 |
18 files changed, 129 insertions, 196 deletions
diff --git a/camel/camel-folder-pt-proxy.c b/camel/camel-folder-pt-proxy.c index 3e620666f5..27e89438c3 100644 --- a/camel/camel-folder-pt-proxy.c +++ b/camel/camel-folder-pt-proxy.c @@ -234,7 +234,6 @@ _finalize (GtkObject *object) { CamelFolder *camel_folder = CAMEL_FOLDER (object); CamelFolderPtProxy *camel_folder_pt_proxy = CAMEL_FOLDER_PT_PROXY (camel_folder); - GList *message_node; CAMEL_LOG_FULL_DEBUG ("Entering CamelFolderPtProxy::finalize\n"); diff --git a/camel/camel-folder-pt-proxy.h b/camel/camel-folder-pt-proxy.h index 35c0965f45..189d486a85 100644 --- a/camel/camel-folder-pt-proxy.h +++ b/camel/camel-folder-pt-proxy.h @@ -83,6 +83,8 @@ typedef struct { } CamelFolderPtProxyClass; +GtkType camel_folder_pt_proxy_get_type (void); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/camel/camel-mime-body-part.c b/camel/camel-mime-body-part.c index 3f3c2cb4a2..ffc8314d1f 100644 --- a/camel/camel-mime-body-part.c +++ b/camel/camel-mime-body-part.c @@ -43,7 +43,6 @@ static CamelMimePartClass *parent_class=NULL; static void camel_mime_body_part_class_init (CamelMimeBodyPartClass *camel_mime_body_part_class) { - CamelMimePartClass *camel_mime_part_class = CAMEL_MIME_PART_CLASS (camel_mime_body_part_class); parent_class = gtk_type_class (camel_mime_part_get_type ()); /* virtual method definition */ @@ -54,7 +53,6 @@ camel_mime_body_part_class_init (CamelMimeBodyPartClass *camel_mime_body_part_cl static void camel_mime_body_part_init (gpointer object, gpointer klass) { - CamelMimeBodyPart *camel_mime_body_part = CAMEL_MIME_BODY_PART (object); camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (object), "mime/body-part"); } @@ -86,7 +84,7 @@ camel_mime_body_part_get_type (void) } CamelMimeBodyPart * -camel_mime_body_part_new () +camel_mime_body_part_new (void) { CamelMimeBodyPart *mime_body_part; CAMEL_LOG_FULL_DEBUG ("CamelMimeBodyPart:: Entering new()\n"); diff --git a/camel/camel-mime-body-part.h b/camel/camel-mime-body-part.h index d2ae4908fb..740ab64520 100644 --- a/camel/camel-mime-body-part.h +++ b/camel/camel-mime-body-part.h @@ -61,7 +61,8 @@ typedef struct { CamelMimePartClass parent_class; /* Virtual methods */ - void (*set_parent) (CamelMimeBodyPart *mime_body_part, CamelMultipart *multipart); + void (*set_parent) (CamelMimeBodyPart *mime_body_part, + CamelMultipart *multipart); const CamelMultipart * (*get_parent) (CamelMimeBodyPart *mime_body_part); } CamelMimeBodyPartClass; @@ -72,8 +73,9 @@ GtkType camel_mime_body_part_get_type (void); /* public methods */ -CamelMimeBodyPart *camel_mime_body_part_new (); -void camel_mime_body_part_set_parent (CamelMimeBodyPart *mime_body_part, CamelMultipart *multipart); +CamelMimeBodyPart * camel_mime_body_part_new (void); +void camel_mime_body_part_set_parent (CamelMimeBodyPart *mime_body_part, + CamelMultipart *multipart); const CamelMultipart *camel_mime_body_part_get_parent (CamelMimeBodyPart *mime_body_part); diff --git a/camel/camel-mime-part-utils.c b/camel/camel-mime-part-utils.c index 427132df75..6a06bc3bce 100644 --- a/camel/camel-mime-part-utils.c +++ b/camel/camel-mime-part-utils.c @@ -87,6 +87,7 @@ camel_mime_part_construct_content_from_stream (CamelMimePart *mime_part, GtkType content_object_type; CamelDataWrapper *content_object = NULL; + /* * find content mime type */ diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c index 0328ac8115..2e52f8312f 100644 --- a/camel/camel-mime-part.c +++ b/camel/camel-mime-part.c @@ -818,7 +818,7 @@ _set_input_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) guint32 content_stream_inf_bound; - CAMEL_LOG_FULL_DEBUG ("CamelMimePart::construct_from_stream entering\n"); + CAMEL_LOG_FULL_DEBUG ("CamelMimePart::set_input_stream entering\n"); g_assert (CAMEL_IS_SEEKABLE_STREAM (stream)); seekable_stream = CAMEL_SEEKABLE_STREAM (stream); @@ -831,6 +831,7 @@ _set_input_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) camel_seekable_substream_new_with_seekable_stream_and_bounds (seekable_stream, content_stream_inf_bound, -1); + CAMEL_LOG_FULL_DEBUG ("CamelMimePart::set_input_stream leaving\n"); } diff --git a/camel/camel-multipart.c b/camel/camel-multipart.c index 948a68e387..0a2f488f31 100644 --- a/camel/camel-multipart.c +++ b/camel/camel-multipart.c @@ -26,30 +26,44 @@ */ #include <config.h> -#include "camel-multipart.h" #include "camel-log.h" #include "gmime-content-field.h" #include "gmime-utils.h" #include "camel-stream-mem.h" +#include "camel-seekable-substream.h" +#include "camel-multipart.h" -static void _add_part (CamelMultipart *multipart, CamelMimeBodyPart *part); -static void _add_part_at (CamelMultipart *multipart, CamelMimeBodyPart *part, guint index); -static void _remove_part (CamelMultipart *multipart, CamelMimeBodyPart *part); -static CamelMimeBodyPart *_remove_part_at (CamelMultipart *multipart, guint index); -static CamelMimeBodyPart *_get_part (CamelMultipart *multipart, guint index); -static guint _get_number (CamelMultipart *multipart); -static void _set_parent (CamelMultipart *multipart, CamelMimePart *parent); -static CamelMimePart *_get_parent (CamelMultipart *multipart); -static void _set_boundary (CamelMultipart *multipart, gchar *boundary); -static const gchar *_get_boundary (CamelMultipart *multipart); -static void _write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream); -static void _construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream); -static void _finalize (GtkObject *object); +static void _add_part (CamelMultipart *multipart, + CamelMimeBodyPart *part); +static void _add_part_at (CamelMultipart *multipart, + CamelMimeBodyPart *part, + guint index); +static void _remove_part (CamelMultipart *multipart, + CamelMimeBodyPart *part); +static CamelMimeBodyPart * _remove_part_at (CamelMultipart *multipart, + guint index); +static CamelMimeBodyPart * _get_part (CamelMultipart *multipart, + guint index); +static guint _get_number (CamelMultipart *multipart); +static void _set_parent (CamelMultipart *multipart, + CamelMimePart *parent); +static CamelMimePart * _get_parent (CamelMultipart *multipart); +static void _set_boundary (CamelMultipart *multipart, + gchar *boundary); +static const gchar * _get_boundary (CamelMultipart *multipart); +static void _write_to_stream (CamelDataWrapper *data_wrapper, + CamelStream *stream); +static void _set_input_stream (CamelDataWrapper *data_wrapper, + CamelStream *stream); + +static void _finalize (GtkObject *object); static CamelDataWrapperClass *parent_class=NULL; + + /* Returns the class for a CamelMultipart */ #define CMP_CLASS(so) CAMEL_MULTIPART_CLASS (GTK_OBJECT(so)->klass) @@ -79,7 +93,7 @@ camel_multipart_class_init (CamelMultipartClass *camel_multipart_class) /* virtual method overload */ camel_data_wrapper_class->write_to_stream = _write_to_stream; - camel_data_wrapper_class->construct_from_stream = _construct_from_stream; + camel_data_wrapper_class->set_input_stream = _set_input_stream; gtk_object_class->finalize = _finalize; } @@ -150,8 +164,9 @@ _finalize (GtkObject *object) } -CamelMultipart * -camel_multipart_new () + +CamelMultipart * +camel_multipart_new (void) { CamelMultipart *multipart; CAMEL_LOG_FULL_DEBUG ("CamelMultipart:: Entering new()\n"); @@ -177,7 +192,7 @@ void camel_multipart_add_part (CamelMultipart *multipart, CamelMimeBodyPart *part) { CMP_CLASS (multipart)->add_part (multipart, part); -} +} static void @@ -401,117 +416,6 @@ _write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) -/** - * _read_part: read one part in a multipart environement. - * @new_part_stream: stream to add the part to - * @stream: the stream to read the lines from. - * @normal_boundary: end of part bundary. - * @end_boundary: end of multipart boundary. - * - * This routine is a bit special: RFC 2046 says that, in a multipart - * environment, the last crlf before a boundary belongs to the boundary. - * Thus, if there is no blank line before the boundary, the last crlf - * of the last line of the part is removed. - * - * Return value: true if the last boundary element has been found or if no more data was available from the stream, flase otherwise - **/ - -static gboolean -_read_part (CamelStream *new_part_stream, CamelStream *stream, gchar *normal_boundary, gchar *end_boundary) -{ - gchar *new_line = NULL; - gboolean end_of_part = FALSE; - gboolean last_part = FALSE; - gboolean first_line = TRUE; - - /* Note for future enhancements */ - /* RFC 2046 precises that when parsing the content of a multipart - * element, the program should not think it will find the last boundary, - * and in particular, the message could have been damaged during - * transport, the parsing should still be OK */ - CAMEL_LOG_FULL_DEBUG ("CamelMultipart:: Entering _read_part\n"); - - new_line = gmime_read_line_from_stream (stream); - while (new_line && !end_of_part && !last_part) { - end_of_part = (strcmp (new_line, normal_boundary) == 0); - last_part = (strcmp (new_line, end_boundary) == 0); - if (!end_of_part && !last_part) { - if (first_line) { - first_line = FALSE; - camel_stream_write_string (new_part_stream, new_line); - } else camel_stream_write_strings (new_part_stream, "\n", new_line, NULL); - g_free (new_line); - new_line = gmime_read_line_from_stream (stream); - } - } - - if (new_line) g_free (new_line); - else last_part = TRUE; - - CAMEL_LOG_FULL_DEBUG ("CamelMultipart:: Leaving _read_part\n"); - return (last_part); -} - -static void -_construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) -{ - CamelMultipart *multipart = CAMEL_MULTIPART (data_wrapper); - const gchar *boundary; - gchar *real_boundary_line; - gchar *end_boundary_line; - CamelStream *new_part_stream; - gboolean end_of_multipart; - CamelMimeBodyPart *body_part; - - CAMEL_LOG_FULL_DEBUG ("Entering CamelMultipart::_construct_from_stream\n"); - boundary = camel_multipart_get_boundary (multipart); - g_return_if_fail (boundary); - - real_boundary_line = g_strdup_printf ("--%s", boundary); - end_boundary_line = g_strdup_printf ("--%s--", boundary); - - - /* read the prefix if any */ - new_part_stream = camel_stream_mem_new (CAMEL_STREAM_MEM_RW); - end_of_multipart = _read_part (new_part_stream, stream, real_boundary_line, end_boundary_line); - CAMEL_LOG_FULL_DEBUG ("CamelMultipart::construct_from_stream freeing new_part_stream:%p\n", new_part_stream); - gtk_object_unref (GTK_OBJECT (new_part_stream)); - if (multipart->preface) g_free (multipart->preface); - - /* if ( (new_part->str)[0] != '\0') multipart->preface = g_strdup (new_part->str); */ - - /* read all the real parts */ - while (!end_of_multipart) { - CAMEL_LOG_FULL_DEBUG ("CamelMultipart::construct_from_stream, detected a new part\n"); - new_part_stream = camel_stream_mem_new (CAMEL_STREAM_MEM_RW); - body_part = camel_mime_body_part_new (); - - end_of_multipart = _read_part ( new_part_stream, stream, real_boundary_line, end_boundary_line); - camel_seekable_stream_seek (new_part_stream, 0, CAMEL_STREAM_SET); - camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (body_part), new_part_stream); - camel_multipart_add_part (multipart, body_part); - gtk_object_destroy (GTK_OBJECT (new_part_stream)); - - } - - /* g_string_assign (new_part, ""); */ - /* _read_part (new_part, stream, real_boundary_line, end_boundary_line); */ - - if (multipart->postface) g_free (multipart->postface); - /* if ( (new_part->str)[0] != '\0') multipart->postface = g_strdup (new_part->str); */ - - /* g_string_free (new_part, TRUE); */ - - g_free (real_boundary_line); - g_free (end_boundary_line); - CAMEL_LOG_FULL_DEBUG ("Leaving CamelMultipart::_construct_from_stream\n"); -} - - - - - - @@ -543,7 +447,6 @@ _localize_part (CamelStream *stream, gchar *new_line = NULL; gboolean end_of_part = FALSE; gboolean last_part = FALSE; - gboolean first_line = TRUE; guint32 last_position; /* Note for future enhancements */ @@ -553,8 +456,11 @@ _localize_part (CamelStream *stream, * transport, the parsing should still be OK */ CAMEL_LOG_FULL_DEBUG ("CamelMultipart:: Entering _localize_part\n"); - last_position = camel_seekable_stream_get_current_position (stream); + g_assert (CAMEL_IS_SEEKABLE_STREAM (stream)); + + last_position = camel_seekable_stream_get_current_position (CAMEL_SEEKABLE_STREAM (stream)); new_line = gmime_read_line_from_stream (stream); + while (new_line && !end_of_part && !last_part) { end_of_part = (strcmp (new_line, normal_boundary) == 0); last_part = (strcmp (new_line, end_boundary) == 0); @@ -562,7 +468,9 @@ _localize_part (CamelStream *stream, g_free (new_line); - last_position = camel_seekable_stream_get_current_position (stream); + last_position = + camel_seekable_stream_get_current_position (CAMEL_SEEKABLE_STREAM (stream)); + new_line = gmime_read_line_from_stream (stream); } } @@ -570,7 +478,7 @@ _localize_part (CamelStream *stream, if (new_line) g_free (new_line); else last_part = TRUE; - *end_position = last_position + *end_position = last_position; CAMEL_LOG_FULL_DEBUG ("CamelMultipart:: Leaving _localize_part\n"); return (last_part); @@ -583,16 +491,18 @@ static void _set_input_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) { CamelMultipart *multipart = CAMEL_MULTIPART (data_wrapper); + CamelSeekableStream *seekable_stream = CAMEL_SEEKABLE_STREAM (stream); const gchar *boundary; gchar *real_boundary_line; gchar *end_boundary_line; - CamelStream *new_part_stream; gboolean end_of_multipart; CamelMimeBodyPart *body_part; guint32 part_begining, part_end; CamelSeekableSubstream *body_part_input_stream; + guint32 saved_stream_pos; + - CAMEL_LOG_FULL_DEBUG ("Entering CamelMultipart::_construct_from_stream\n"); + CAMEL_LOG_FULL_DEBUG ("Entering CamelMultipart::_set_input_stream\n"); boundary = camel_multipart_get_boundary (multipart); g_return_if_fail (boundary); @@ -612,9 +522,9 @@ _set_input_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) /* read all the real parts */ while (!end_of_multipart) { /* determine the position of the begining of the part */ - part_begining = camel_seekable_stream_get_current_position (stream); + part_begining = camel_seekable_stream_get_current_position (seekable_stream); - CAMEL_LOG_FULL_DEBUG ("CamelMultipart::construct_from_stream, detected a new part\n"); + CAMEL_LOG_FULL_DEBUG ("CamelMultipart::set_input_stream, detected a new part\n"); body_part = camel_mime_body_part_new (); end_of_multipart = _localize_part (stream, @@ -625,8 +535,18 @@ _set_input_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) camel_seekable_substream_new_with_seekable_stream_and_bounds (seekable_stream, part_begining, part_end); - - camel_data_wrapper_set_input_stream (CAMEL_DATA_WRAPPER (body_part), body_part_input_stream); + + /* the seekable substream may change the position of the stream + so we must save it before calling set_input_stream */ + saved_stream_pos = camel_seekable_stream_get_current_position (seekable_stream); + + camel_data_wrapper_set_input_stream (CAMEL_DATA_WRAPPER (body_part), + CAMEL_STREAM (body_part_input_stream)); + + /* restore the stream position */ + camel_seekable_stream_seek (seekable_stream, saved_stream_pos, CAMEL_STREAM_SET); + + /* add the body part to the multipart object */ camel_multipart_add_part (multipart, body_part); } @@ -641,5 +561,5 @@ _set_input_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) g_free (real_boundary_line); g_free (end_boundary_line); - CAMEL_LOG_FULL_DEBUG ("Leaving CamelMultipart::_construct_from_stream\n"); + CAMEL_LOG_FULL_DEBUG ("Leaving CamelMultipart::_set_input_stream\n"); } diff --git a/camel/camel-multipart.h b/camel/camel-multipart.h index 905bc82927..50b64b3ae0 100644 --- a/camel/camel-multipart.h +++ b/camel/camel-multipart.h @@ -84,17 +84,25 @@ GtkType camel_multipart_get_type (void); /* public methods */ -CamelMultipart *camel_multipart_new (); -void camel_multipart_add_part (CamelMultipart *multipart, CamelMimeBodyPart *part); -void camel_multipart_add_part_at (CamelMultipart *multipart, CamelMimeBodyPart *part, guint index); -void camel_multipart_remove_part (CamelMultipart *multipart, CamelMimeBodyPart *part); -CamelMimeBodyPart *camel_multipart_remove_part_at (CamelMultipart *multipart, guint index); -CamelMimeBodyPart *camel_multipart_get_part (CamelMultipart *multipart, guint index); -guint camel_multipart_get_number (CamelMultipart *multipart); -void camel_multipart_set_parent (CamelMultipart *multipart, CamelMimePart *parent); -CamelMimePart *camel_multipart_get_parent (CamelMultipart *multipart); -void camel_multipart_set_boundary (CamelMultipart *multipart, gchar *boundary); -const gchar *camel_multipart_get_boundary (CamelMultipart *multipart); +CamelMultipart * camel_multipart_new (void); +void camel_multipart_add_part (CamelMultipart *multipart, + CamelMimeBodyPart *part); +void camel_multipart_add_part_at (CamelMultipart *multipart, + CamelMimeBodyPart *part, + guint index); +void camel_multipart_remove_part (CamelMultipart *multipart, + CamelMimeBodyPart *part); +CamelMimeBodyPart * camel_multipart_remove_part_at (CamelMultipart *multipart, + guint index); +CamelMimeBodyPart * camel_multipart_get_part (CamelMultipart *multipart, + guint index); +guint camel_multipart_get_number (CamelMultipart *multipart); +void camel_multipart_set_parent (CamelMultipart *multipart, + CamelMimePart *parent); +CamelMimePart * camel_multipart_get_parent (CamelMultipart *multipart); +void camel_multipart_set_boundary (CamelMultipart *multipart, + gchar *boundary); +const gchar * camel_multipart_get_boundary (CamelMultipart *multipart); diff --git a/camel/camel-seekable-substream.c b/camel/camel-seekable-substream.c index 6777eeb12d..6d59d8994c 100644 --- a/camel/camel-seekable-substream.c +++ b/camel/camel-seekable-substream.c @@ -142,11 +142,14 @@ _destroy (GtkObject *object) static void _finalize (GtkObject *object) { - - + CamelSeekableStream *seekable_stream; CAMEL_LOG_FULL_DEBUG ("Entering CamelSeekableSubstream::finalize\n"); - /* does nothing for the moment */ + seekable_stream = CAMEL_SEEKABLE_STREAM (object); + + if (seekable_stream->parent_stream) + gtk_object_unref (seekable_stream->parent_stream); + GTK_OBJECT_CLASS (parent_class)->finalize (object); CAMEL_LOG_FULL_DEBUG ("Leaving CamelSeekableSubstream::finalize\n"); } @@ -165,8 +168,6 @@ _set_bounds (CamelSeekableSubstream *seekable_substream, guint32 inf_bound, gint seekable_substream->inf_bound = inf_bound; seekable_substream->sup_bound = sup_bound; - /* go to the first position */ - camel_seekable_stream_seek (seekable_substream->parent_stream, inf_bound, SEEK_SET); seekable_substream->cur_pos = 0; @@ -194,7 +195,8 @@ _init_with_seekable_stream_and_bounds (CamelSeekableSubstream *seekable_substre /* store the parent stream */ seekable_substream->parent_stream = parent_stream; - + gtk_object_ref (parent_stream); + /* set the bound of the substream */ _set_bounds (seekable_substream, inf_bound, sup_bound); } @@ -245,7 +247,6 @@ _read (CamelStream *stream, gchar *buffer, gint n) g_assert (stream); g_assert (seekable_substream->parent_stream); - g_assert (seekable_substream->open); @@ -300,14 +301,7 @@ _read (CamelStream *stream, gchar *buffer, gint n) seekable_stream->cur_pos += v; -#if 0 - /* restore the parent position */ - camel_seekable_stream_seek (seekable_substream->parent_stream, - parent_stream_current_position, - CAMEL_STREAM_SET); - -#endif /* return the number of bytes read */ return v; } @@ -384,11 +378,10 @@ _eos (CamelStream *stream) gboolean eos; g_assert (stream); - g_assert (seekable_substream->open); if (seekable_substream->sup_bound != -1) { substream_len = seekable_substream->sup_bound - seekable_substream->inf_bound; - eos = ( seekable_stream->cur_pos > substream_len); + eos = ( seekable_stream->cur_pos >= substream_len); } else { eos = camel_stream_eos (CAMEL_STREAM (seekable_substream->parent_stream)); } diff --git a/camel/camel-store.h b/camel/camel-store.h index 89ad29161b..60254b3a27 100644 --- a/camel/camel-store.h +++ b/camel/camel-store.h @@ -63,12 +63,21 @@ struct _CamelStore typedef struct { CamelServiceClass parent_class; - void (*init) (CamelStore *store, CamelSession *session, const gchar *url_name, CamelException *ex); - void (*set_separator) (CamelStore *store, gchar sep, CamelException *ex); - gchar (*get_separator) (CamelStore *store, CamelException *ex); - CamelFolder * (*get_folder) (CamelStore *store, const gchar *folder_name, CamelException *ex); - CamelFolder * (*get_root_folder) (CamelStore *store, CamelException *ex); - CamelFolder * (*get_default_folder) (CamelStore *store, CamelException *ex); + void (*init) (CamelStore *store, + CamelSession *session, + const gchar *url_name, + CamelException *ex); + void (*set_separator) (CamelStore *store, gchar sep, + CamelException *ex); + gchar (*get_separator) (CamelStore *store, + CamelException *ex); + CamelFolder * (*get_folder) (CamelStore *store, + const gchar *folder_name, + CamelException *ex); + CamelFolder * (*get_root_folder) (CamelStore *store, + CamelException *ex); + CamelFolder * (*get_default_folder) (CamelStore *store, + CamelException *ex); } CamelStoreClass; @@ -78,10 +87,10 @@ typedef struct { /* Standard Gtk function */ GtkType camel_store_get_type (void); -void camel_store_init (CamelStore *store, CamelSession *session, const gchar *url_name, CamelException *ex); -CamelFolder *camel_store_get_folder (CamelStore *store, const gchar *folder_name, CamelException *ex); -gchar camel_store_get_separator (CamelStore *store, CamelException *ex); -CamelSession *camel_store_get_session (CamelStore *store, CamelException *ex); +void camel_store_init (CamelStore *store, CamelSession *session, const gchar *url_name, CamelException *ex); +CamelFolder * camel_store_get_folder (CamelStore *store, const gchar *folder_name, CamelException *ex); +gchar camel_store_get_separator (CamelStore *store, CamelException *ex); +CamelSession * camel_store_get_session (CamelStore *store, CamelException *ex); #ifdef __cplusplus } diff --git a/camel/camel-stream-fs.c b/camel/camel-stream-fs.c index 6c50282e33..d6ba5fba13 100644 --- a/camel/camel-stream-fs.c +++ b/camel/camel-stream-fs.c @@ -481,11 +481,12 @@ _seek (CamelSeekableStream *stream, gint offset, CamelStreamSeekPolicy policy) gint real_offset; CamelStreamFs *stream_fs = CAMEL_STREAM_FS (stream); +#if 0 /* because we don't know what is going to happen, we set the eof stream to false so that a reread can occur */ stream_fs->eof = FALSE; - +#endif switch (policy) { case CAMEL_STREAM_SET: real_offset = MAX (stream_fs->inf_bound + offset, stream_fs->inf_bound); @@ -525,7 +526,10 @@ _seek (CamelSeekableStream *stream, gint offset, CamelStreamSeekPolicy policy) + printf ("***** Seeking : real_offset=%d, whence=%d\n", real_offset, whence); return_position = lseek (stream_fs->fd, real_offset, whence) - stream_fs->inf_bound; + printf ("*** *** *** *** ***\n"); + CAMEL_SEEKABLE_STREAM (stream)->cur_pos = return_position; diff --git a/camel/camel-thread-proxy.c b/camel/camel-thread-proxy.c index 70079d3baf..53fda08bab 100644 --- a/camel/camel-thread-proxy.c +++ b/camel/camel-thread-proxy.c @@ -72,7 +72,7 @@ _init_notify_system (CamelThreadProxy *proxy); * Return value: The newly created proxy object **/ CamelThreadProxy * -camel_thread_proxy_new () +camel_thread_proxy_new (void) { CamelThreadProxy *proxy; @@ -137,7 +137,6 @@ camel_thread_proxy_free (CamelThreadProxy *proxy) void _op_run_free_and_notify (CamelOp *op) { - gboolean error; CamelThreadProxy *th_proxy; CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::_op_run_free_and_notify\n"); @@ -163,7 +162,6 @@ _run_next_op_in_thread (CamelThreadProxy *proxy) { CamelOp *op; CamelOpQueue *server_op_queue; - CamelThreadProxy *th_proxy; pthread_t thread; CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::_run_next_op_in_thread\n"); @@ -260,7 +258,6 @@ _run_next_cb (CamelThreadProxy *proxy) { CamelOp *op; CamelOpQueue *client_op_queue; - CamelThreadProxy *th_proxy; CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::_run_next_cb\n"); client_op_queue = proxy->client_op_queue; @@ -476,7 +473,6 @@ camel_thread_proxy_add_signals (CamelThreadProxy *proxy, GtkObject *real_object, char *signal_to_proxy[]) { - GtkType camel_folder_type; guint i; CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::camel_thread_proxy_init_signals\n"); diff --git a/camel/camel-thread-proxy.h b/camel/camel-thread-proxy.h index 9ce7f0e11b..a82a19c87f 100644 --- a/camel/camel-thread-proxy.h +++ b/camel/camel-thread-proxy.h @@ -69,7 +69,7 @@ typedef struct { } CamelThreadProxy; -CamelThreadProxy *camel_thread_proxy_new (); +CamelThreadProxy *camel_thread_proxy_new (void); void camel_thread_proxy_free (CamelThreadProxy *proxy); void camel_thread_proxy_push_op (CamelThreadProxy *proxy, CamelOp *op); diff --git a/camel/camel.c b/camel/camel.c index febdb2d2bb..63a5698801 100644 --- a/camel/camel.c +++ b/camel/camel.c @@ -27,7 +27,7 @@ #include "camel.h" gint -camel_init() +camel_init(void) { diff --git a/camel/camel.h b/camel/camel.h index b3ee0dcf03..92099cd0f8 100644 --- a/camel/camel.h +++ b/camel/camel.h @@ -62,7 +62,7 @@ extern "C" { #include <camel/string-utils.h> #include <camel/url-util.h> -gint camel_init (); +gint camel_init (void); #ifdef __cplusplus } diff --git a/camel/gstring-util.c b/camel/gstring-util.c index 9794696c95..eb89c2aa28 100644 --- a/camel/gstring-util.c +++ b/camel/gstring-util.c @@ -210,11 +210,13 @@ g_string_append_g_string(GString *dest_string, GString *other_string) * * Return value: **/ +gint g_string_equal_for_hash (gconstpointer v, gconstpointer v2) { return strcmp ( ((const GString*)v)->str, ((const GString*)v2)->str) == 0; } +gint g_string_equal_for_glist (gconstpointer v, gconstpointer v2) { return !strcmp ( ((const GString*)v)->str, ((const GString*)v2)->str) == 0; diff --git a/camel/providers/mbox/Makefile.am b/camel/providers/mbox/Makefile.am index c89d38db94..c258f3d747 100644 --- a/camel/providers/mbox/Makefile.am +++ b/camel/providers/mbox/Makefile.am @@ -4,7 +4,6 @@ SUBDIRS = libcamelmboxincludedir = $(includedir)/camel -providerdir = $(libdir)/evolution/camel-providers/$(VERSION) provider_LTLIBRARIES = libcamelmbox.la diff --git a/camel/string-utils.c b/camel/string-utils.c index 7cd9e97af0..757a907190 100644 --- a/camel/string-utils.c +++ b/camel/string-utils.c @@ -65,7 +65,6 @@ gchar string_dichotomy (const gchar *string, gchar sep, gchar **prefix, gchar **suffix, StringDichotomyOption options) { - gchar *tmp_str; gint sep_pos, first, last, len; g_assert (string); |