diff options
author | bertrand <Bertrand.Guiheneuf@aful.org> | 1999-08-29 23:57:47 +0800 |
---|---|---|
committer | Bertrand Guiheneuf <bertrand@src.gnome.org> | 1999-08-29 23:57:47 +0800 |
commit | 68a9dad22b742e3034eea24a57a0e7fad3356201 (patch) | |
tree | 852a65e1a2c0ab0a8d507bcdc8bba64bf2765be1 /camel | |
parent | e826255bf13255f2b5c626192de4fd10a3885b6f (diff) | |
download | gsoc2013-evolution-68a9dad22b742e3034eea24a57a0e7fad3356201.tar gsoc2013-evolution-68a9dad22b742e3034eea24a57a0e7fad3356201.tar.gz gsoc2013-evolution-68a9dad22b742e3034eea24a57a0e7fad3356201.tar.bz2 gsoc2013-evolution-68a9dad22b742e3034eea24a57a0e7fad3356201.tar.lz gsoc2013-evolution-68a9dad22b742e3034eea24a57a0e7fad3356201.tar.xz gsoc2013-evolution-68a9dad22b742e3034eea24a57a0e7fad3356201.tar.zst gsoc2013-evolution-68a9dad22b742e3034eea24a57a0e7fad3356201.zip |
text parameter declared const
1999-08-28 bertrand <Bertrand.Guiheneuf@aful.org>
* camel/camel-mime-part.c (camel_mime_part_set_text):
text parameter declared const
* camel/camel-mime-part-utils.c (camel_mime_part_store_stream_in_buffer):
actually test correctly nb_bytes_read_chunk is >0
* camel/gstring-util.c:
* camel/gmime-content-field.c:
* camel/providers/MH/camel-mh-folder.c:
* camel/camel-stream-fs.c:
include string.h
* camel/camel-stream-mem.c (_write): return
the numver of written bytes.
* camel/camel-stream-buffered-fs.c (_eos):
return sthg
* camel/camel-stream.c (default_camel_seek):
return something.
* Started to work on new recipient code.
* fixed various leaks.
svn path=/trunk/; revision=1146
Diffstat (limited to 'camel')
-rw-r--r-- | camel/camel-mime-part-utils.c | 23 | ||||
-rw-r--r-- | camel/camel-mime-part.c | 15 | ||||
-rw-r--r-- | camel/camel-mime-part.h | 2 | ||||
-rw-r--r-- | camel/camel-recipient.c | 112 | ||||
-rw-r--r-- | camel/camel-recipient.h | 55 | ||||
-rw-r--r-- | camel/camel-stream-buffered-fs.c | 3 | ||||
-rw-r--r-- | camel/camel-stream-fs.c | 3 | ||||
-rw-r--r-- | camel/camel-stream-mem.c | 5 | ||||
-rw-r--r-- | camel/camel-stream.c | 1 | ||||
-rw-r--r-- | camel/gmime-content-field.c | 2 | ||||
-rw-r--r-- | camel/gstring-util.c | 2 | ||||
-rw-r--r-- | camel/providers/MH/camel-mh-folder.c | 1 |
12 files changed, 206 insertions, 18 deletions
diff --git a/camel/camel-mime-part-utils.c b/camel/camel-mime-part-utils.c index 59ae49e595..7fbc3a30fb 100644 --- a/camel/camel-mime-part-utils.c +++ b/camel/camel-mime-part-utils.c @@ -39,10 +39,10 @@ camel_mime_part_construct_headers_from_stream (CamelMimePart *mime_part, Rfc822Header *cur_header; int i; - CAMEL_LOG_FULL_DEBUG ("CamelMimePart:: " + CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils:: " "Entering _construct_headers_from_stream\n"); g_assert (stream); - CAMEL_LOG_FULL_DEBUG ("CamelMimePart::construct_headers_from_stream " + CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::construct_headers_from_stream " "parsing headers\n"); /* * parse all header lines @@ -58,8 +58,8 @@ camel_mime_part_construct_headers_from_stream (CamelMimePart *mime_part, g_array_free (header_array, TRUE); - CAMEL_LOG_FULL_DEBUG ("CamelMimePart::construct_headers_from_stream " - "headers parsed \n"); + CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::construct_headers_from_stream " + "headers parsed. Leaving \n"); } } @@ -79,7 +79,7 @@ camel_mime_part_construct_content_from_stream (CamelMimePart *mime_part, /* * find content mime type */ - CAMEL_LOG_FULL_DEBUG ("CamelMimePart::construct_content_from_stream " + CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::construct_content_from_stream " "parsing content\n"); content_type = camel_mime_part_get_content_type (mime_part); @@ -91,7 +91,7 @@ camel_mime_part_construct_content_from_stream (CamelMimePart *mime_part, * using text/plain is the default */ if (!mime_type) { - CAMEL_LOG_FULL_DEBUG ("CamelMimePart::construct_content_from_stream " + CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::construct_content_from_stream " "content type field not found " "using default \"text/plain\"\n"); mime_type = g_strdup ("text/plain"); @@ -105,7 +105,7 @@ camel_mime_part_construct_content_from_stream (CamelMimePart *mime_part, content_object_type = data_wrapper_repository_get_data_wrapper_type (mime_type); - CAMEL_LOG_FULL_DEBUG ("CamelMimePart::construct_content_from_stream content" + CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::construct_content_from_stream content" " type object type used: %s\n", gtk_type_name (content_object_type)); @@ -124,10 +124,10 @@ camel_mime_part_construct_content_from_stream (CamelMimePart *mime_part, gtk_object_unref (GTK_OBJECT (content_object)); - CAMEL_LOG_FULL_DEBUG ("CamelMimePart::construct_from_stream " + CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::construct_from_stream " "content parsed\n"); - CAMEL_LOG_FULL_DEBUG ("CamelMimePart:: Leaving _construct_from_stream\n"); + CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils:: Leaving _construct_from_stream\n"); } @@ -141,6 +141,8 @@ camel_mime_part_store_stream_in_buffer (CamelMimePart *mime_part, GByteArray *buffer; #define STREAM_READ_CHUNK_SZ 100 + CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::store_stream_in_buffer entering\n"); + if (mime_part->temp_message_buffer == NULL) mime_part->temp_message_buffer = g_byte_array_new (); @@ -152,7 +154,7 @@ camel_mime_part_store_stream_in_buffer (CamelMimePart *mime_part, STREAM_READ_CHUNK_SZ); nb_bytes_read_total += nb_bytes_read_chunk; - while (nb_bytes_read_chunk) { + while (nb_bytes_read_chunk >0) { g_byte_array_set_size (buffer, nb_bytes_read_total + STREAM_READ_CHUNK_SZ); nb_bytes_read_chunk = camel_stream_read (stream, buffer->data + nb_bytes_read_total, @@ -161,5 +163,6 @@ camel_mime_part_store_stream_in_buffer (CamelMimePart *mime_part, } g_byte_array_set_size (buffer, nb_bytes_read_total); + CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::store_stream_in_buffer entering\n"); } diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c index 8f5255ccb4..c8acb5b4b9 100644 --- a/camel/camel-mime-part.c +++ b/camel/camel-mime-part.c @@ -575,11 +575,12 @@ _get_content_object (CamelMedium *medium) CamelMimePart *mime_part = CAMEL_MIME_PART (medium); CamelStream *stream; + CAMEL_LOG_FULL_DEBUG ("CamelMimePart::get_content_object entering\n"); /* * test if there is not pending content stored in the * temporary buffer */ - if ((!medium->content ) || (mime_part->temp_message_buffer)) { + if ((!medium->content ) && (mime_part->temp_message_buffer)) { stream = camel_stream_mem_new_with_buffer (mime_part->temp_message_buffer, CAMEL_STREAM_MEM_READ); camel_mime_part_construct_content_from_stream (mime_part, stream); @@ -587,8 +588,13 @@ _get_content_object (CamelMedium *medium) * Beware : this will destroy the temp buffer as well */ gtk_object_unref (GTK_OBJECT (stream)); + } else { + CAMEL_LOG_FULL_DEBUG ("CamelMimePart::get_content_object part has a pointer " + "to a content object as well as a temp buffer\n"); } - + + CAMEL_LOG_FULL_DEBUG ("CamelMimePart::get_content_object leaving\n"); + return parent_class->get_content_object (medium); } @@ -758,10 +764,11 @@ _construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) CamelMimePart *mime_part = CAMEL_MIME_PART (data_wrapper); + CAMEL_LOG_FULL_DEBUG ("CamelMimePart::construct_from_stream entering\n"); camel_mime_part_construct_headers_from_stream (mime_part, stream); camel_mime_part_store_stream_in_buffer (mime_part, stream); - CAMEL_LOG_FULL_DEBUG ("CamelMimePart:: Leaving _construct_from_stream\n"); + CAMEL_LOG_FULL_DEBUG ("CamelMimePart::construct_from_stream leaving\n"); } @@ -781,7 +788,7 @@ _construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) * **/ void -camel_mime_part_set_text (CamelMimePart *camel_mime_part, gchar *text) +camel_mime_part_set_text (CamelMimePart *camel_mime_part, const gchar *text) { CamelSimpleDataWrapper *simple_data_wrapper; CamelMedium *medium = CAMEL_MEDIUM (camel_mime_part); diff --git a/camel/camel-mime-part.h b/camel/camel-mime-part.h index 7d5b19c3aa..65159ed8da 100644 --- a/camel/camel-mime-part.h +++ b/camel/camel-mime-part.h @@ -125,7 +125,7 @@ const GList *camel_mime_part_get_header_lines (CamelMimePart *mime_part); GMimeContentField *camel_mime_part_get_content_type (CamelMimePart *mime_part); /* utility functions */ -void camel_mime_part_set_text (CamelMimePart *camel_mime_part, gchar *text); +void camel_mime_part_set_text (CamelMimePart *camel_mime_part, const gchar *text); diff --git a/camel/camel-recipient.c b/camel/camel-recipient.c new file mode 100644 index 0000000000..d9d5863680 --- /dev/null +++ b/camel/camel-recipient.c @@ -0,0 +1,112 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* camel-recipient.h : handle recipients (addresses) and recipiemt lists */ + +/* + * + * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> . + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ + + +#include "glib.h" +#include "hash-table-utils.h" + + +CamelRecipientTable * +camel_recipient_new () +{ + CamelRecipientTable *recipient_table; + + recipient_table = g_new0 (CamelRecipientTable, 1); + recipient_table->recipient_table = g_hash_table_new (g_strcase_cmp, g_strcase_hash); + recipient_table->ref_count = 1; + return recipient_table; +} + + +void +camel_recipient_ref (CamelRecipientTable *recipient_table) +{ + g_return_if_fail (recipient_table); + recipient_table->ref_count += 1; +} + + + +static void +_free_recipient_list (gpointer key, gpointer value, gpointer user_data) +{ + GList *recipient_list = (GList *)value; + gchar *recipient_name = (gchar *key); + + while (recipient_list) { + g_free (recipient_list->data); + recipient_list = recipient_list->next + } + + g_free (recipient_name); + +} + +void +camel_recipient_free (CamelRecipientTable *recipient_table) +{ + g_return_if_fail (recipient_table); + + /* free each recipient list */ + g_hash_table_foreach (recipient_table->recipient_table, _free_recipient_list); + g_hash_table_destroy (recipient_table->recipient_table); +} + + + + +void +camel_recipient_unref (CamelRecipientTable *recipient_table) +{ + g_return_if_fail (recipient_table); + recipient_table->ref_count -= 1; + if (recipient_table->ref_count <1) + camel_recipient_free (recipient_table); + +} + + + +void +camel_recipient_add (CamelRecipientTable *recipient_table, + const gchar *recipient_type, + const gchar *recipient) +{ + GList *recipients_list; + GList *existent_list; + + /* see if there is already a list for this recipient type */ + existent_list = (GList *)g_hash_table_lookup (recipient_table->recipient_table, recipient_type); + + + /* append the new recipient to the recipient list + if the existent_list is NULL, then a new GList is + automagically created */ + recipients_list = g_list_append (existent_list, (gpointer)recipient); + + if (!existent_list) /* if there was no recipient of this type create the section */ + g_hash_table_insert (mime_message->recipients, recipient_type, recipients_list); + else + g_free (recipient_type); + +} diff --git a/camel/camel-recipient.h b/camel/camel-recipient.h new file mode 100644 index 0000000000..a0d2317459 --- /dev/null +++ b/camel/camel-recipient.h @@ -0,0 +1,55 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* camel-recipient.h : handle recipients (addresses) and recipiemt lists */ + +/* + * + * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> . + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ + + + +#ifndef CAMEL_RECIPIENT_H +#define CAMEL_RECIPIENT_H 1 + + +#ifdef __cplusplus +extern "C" { +#pragma } +#endif /* __cplusplus }*/ + + + +typedef struct { + GHashTable *recipient_table; + gint ref_count; + +} CamelRecipient; + + + + + + + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* CAMEL_RECIPIENT_H */ + diff --git a/camel/camel-stream-buffered-fs.c b/camel/camel-stream-buffered-fs.c index ac22df7dee..1156a726d9 100644 --- a/camel/camel-stream-buffered-fs.c +++ b/camel/camel-stream-buffered-fs.c @@ -20,6 +20,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ + + #include <config.h> #include "camel-stream-buffered-fs.h" #include <sys/types.h> @@ -241,6 +243,7 @@ _available (CamelStream *stream) static gboolean _eos (CamelStream *stream) { + return FALSE; } diff --git a/camel/camel-stream-fs.c b/camel/camel-stream-fs.c index e540665dd3..d61d494c49 100644 --- a/camel/camel-stream-fs.c +++ b/camel/camel-stream-fs.c @@ -27,6 +27,7 @@ #include <sys/stat.h> #include <fcntl.h> #include <errno.h> +#include <string.h> #include "camel-log.h" static CamelStreamClass *parent_class=NULL; @@ -295,6 +296,7 @@ static gint _available (CamelStream *stream) { g_warning ("Not implemented yet"); + return -1; } @@ -310,6 +312,7 @@ static gboolean _eos (CamelStream *stream) { g_warning ("Not implemented yet"); + return FALSE; } diff --git a/camel/camel-stream-mem.c b/camel/camel-stream-mem.c index b659e4f30a..ddb7edd819 100644 --- a/camel/camel-stream-mem.c +++ b/camel/camel-stream-mem.c @@ -188,7 +188,8 @@ _write (CamelStream *stream, const gchar *buffer, gint n) g_return_val_if_fail (camel_stream_mem->position>=0, -1); camel_stream_mem->buffer = g_byte_array_append (camel_stream_mem->buffer, (const guint8 *)buffer, n); camel_stream_mem->position += n; - + + return n; } @@ -219,6 +220,7 @@ static gint _available (CamelStream *stream) { g_warning ("Not implemented yet"); + return -1; } @@ -234,6 +236,7 @@ static gboolean _eos (CamelStream *stream) { g_warning ("Not implemented yet"); + return FALSE; } diff --git a/camel/camel-stream.c b/camel/camel-stream.c index 2c0a85f5ff..9372e01700 100644 --- a/camel/camel-stream.c +++ b/camel/camel-stream.c @@ -46,6 +46,7 @@ static gint default_camel_seek (CamelStream *stream, gint offset, CamelStreamSeekPolicy policy) { /* nothing */ + return -1; } static void diff --git a/camel/gmime-content-field.c b/camel/gmime-content-field.c index a92fd63511..f39eeaa3d4 100644 --- a/camel/gmime-content-field.c +++ b/camel/gmime-content-field.c @@ -25,7 +25,7 @@ #include "gmime-content-field.h" #include "string-utils.h" #include "camel-log.h" - +#include <string.h> /** diff --git a/camel/gstring-util.c b/camel/gstring-util.c index 8b89d1d9b4..2ae6fd4732 100644 --- a/camel/gstring-util.c +++ b/camel/gstring-util.c @@ -26,7 +26,7 @@ #include <config.h> #include "gstring-util.h" #include "camel-log.h" - +#include <string.h> /** * g_string_equals : test if two string are equal diff --git a/camel/providers/MH/camel-mh-folder.c b/camel/providers/MH/camel-mh-folder.c index fe297c70a8..def449eae2 100644 --- a/camel/providers/MH/camel-mh-folder.c +++ b/camel/providers/MH/camel-mh-folder.c @@ -28,6 +28,7 @@ #include <fcntl.h> #include <dirent.h> #include <stdio.h> +#include <string.h> #include <errno.h> #include "camel-mh-folder.h" #include "camel-mh-store.h" |