aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorbertrand <Bertrand.Guiheneuf@aful.org>1999-08-18 01:44:00 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>1999-08-18 01:44:00 +0800
commit08752e1b538c47f74714199eed76e9cda61c256f (patch)
tree225c875e5cdf011966498dd0540c75066609fe29 /camel
parent8efa5bea5494312b98c70c347cc7df84564eb86f (diff)
downloadgsoc2013-evolution-08752e1b538c47f74714199eed76e9cda61c256f.tar
gsoc2013-evolution-08752e1b538c47f74714199eed76e9cda61c256f.tar.gz
gsoc2013-evolution-08752e1b538c47f74714199eed76e9cda61c256f.tar.bz2
gsoc2013-evolution-08752e1b538c47f74714199eed76e9cda61c256f.tar.lz
gsoc2013-evolution-08752e1b538c47f74714199eed76e9cda61c256f.tar.xz
gsoc2013-evolution-08752e1b538c47f74714199eed76e9cda61c256f.tar.zst
gsoc2013-evolution-08752e1b538c47f74714199eed76e9cda61c256f.zip
return the number of bytes read. How can this have ever worked ?
1999-08-17 bertrand <Bertrand.Guiheneuf@aful.org> * camel/camel-stream.c (camel_stream_read): return the number of bytes read. How can this have ever worked ? (camel_stream_flush): don't return anything. * camel/gmime-utils.c (get_header_table_from_stream): mem leak fixed. + various other mem leaks. svn path=/trunk/; revision=1120
Diffstat (limited to 'camel')
-rw-r--r--camel/camel-multipart.c13
-rw-r--r--camel/camel-simple-data-wrapper.c2
-rw-r--r--camel/camel-stream-fs.c7
-rw-r--r--camel/camel-stream.c4
-rw-r--r--camel/gmime-content-field.c4
-rw-r--r--camel/gmime-utils.c23
-rw-r--r--camel/string-utils.c4
7 files changed, 37 insertions, 20 deletions
diff --git a/camel/camel-multipart.c b/camel/camel-multipart.c
index 17f79cdd97..205e33c54b 100644
--- a/camel/camel-multipart.c
+++ b/camel/camel-multipart.c
@@ -220,7 +220,7 @@ _remove_part_at (CamelMultipart *multipart, guint index)
if (!(multipart->parts)) {
CAMEL_LOG_FULL_DEBUG ("CamelMultipart::remove_part_at part list is void \n");
- return;
+ return NULL;
}
parts_list = multipart->parts;
@@ -337,7 +337,7 @@ _get_boundary (CamelMultipart *multipart)
CAMEL_LOG_FULL_DEBUG ("Entering CamelMultipart::_get_boundary\n");
if (!CAMEL_DATA_WRAPPER (multipart)->mime_type) {
CAMEL_LOG_WARNING ("CamelMultipart::_get_boundary CAMEL_DATA_WRAPPER (multipart)->mime_type is NULL\n");
- return;
+ return NULL;
}
boundary = gmime_content_field_get_parameter (CAMEL_DATA_WRAPPER (multipart)->mime_type, "boundary");
CAMEL_LOG_FULL_DEBUG ("Leaving CamelMultipart::_get_boundary\n");
@@ -415,7 +415,7 @@ _write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
static gboolean
_read_part (CamelStream *new_part_stream, CamelStream *stream, gchar *normal_boundary, gchar *end_boundary)
{
- gchar *new_line;
+ gchar *new_line = NULL;
gboolean end_of_part = FALSE;
gboolean last_part = FALSE;
gboolean first_line = TRUE;
@@ -436,10 +436,12 @@ _read_part (CamelStream *new_part_stream, CamelStream *stream, gchar *normal_bou
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);
+
CAMEL_LOG_FULL_DEBUG ("CamelMultipart:: Leaving _read_part\n");
return (last_part || (new_line == NULL));
}
@@ -466,7 +468,8 @@ _construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
/* 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);
- gtk_object_destroy (GTK_OBJECT (new_part_stream));
+ 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);
diff --git a/camel/camel-simple-data-wrapper.c b/camel/camel-simple-data-wrapper.c
index 99bd0b2075..cc7fc6bba7 100644
--- a/camel/camel-simple-data-wrapper.c
+++ b/camel/camel-simple-data-wrapper.c
@@ -159,7 +159,7 @@ _construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
g_byte_array_free (array, FALSE);
}
- array = g_byte_array_new();
+ array = g_byte_array_new ();
CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper::construct_from_stream new byte array address:%p\n", array);
simple_data_wrapper->byte_array = array;
nb_bytes_read = camel_stream_read (stream, tmp_buf, _CMSDW_TMP_BUF_SIZE);
diff --git a/camel/camel-stream-fs.c b/camel/camel-stream-fs.c
index 340a87606c..679ee83035 100644
--- a/camel/camel-stream-fs.c
+++ b/camel/camel-stream-fs.c
@@ -66,7 +66,7 @@ camel_stream_fs_class_init (CamelStreamFsClass *camel_stream_fs_class)
camel_stream_class->seek = _seek;
gtk_object_class->finalize = _finalize;
- gtk_object_class->finalize = _destroy;
+ gtk_object_class->destroy = _destroy;
}
@@ -111,6 +111,7 @@ _destroy (GtkObject *object)
CAMEL_LOG_FULL_DEBUG ( " Full error text is : %s\n", strerror(errno));
}
GTK_OBJECT_CLASS (parent_class)->destroy (object);
+ g_free (object);
CAMEL_LOG_FULL_DEBUG ("Leaving CamelStreamFs::destroy\n");
}
@@ -194,10 +195,12 @@ camel_stream_fs_new_with_fd (int fd)
static gint
_read (CamelStream *stream, gchar *buffer, gint n)
{
- int v;
+ gint v;
do {
v = read ( (CAMEL_STREAM_FS (stream))->fd, buffer, n);
} while (v == -1 && errno == EINTR);
+ if (v<0)
+ CAMEL_LOG_FULL_DEBUG ("CamelStreamFs::read v=%d\n", v);
return v;
}
diff --git a/camel/camel-stream.c b/camel/camel-stream.c
index b63a64ddb7..18ff5db8f5 100644
--- a/camel/camel-stream.c
+++ b/camel/camel-stream.c
@@ -104,7 +104,7 @@ camel_stream_get_type (void)
gint
camel_stream_read (CamelStream *stream, gchar *buffer, gint n)
{
- CS_CLASS (stream)->read (stream, buffer, n);
+ return CS_CLASS (stream)->read (stream, buffer, n);
}
/**
@@ -133,7 +133,7 @@ camel_stream_write (CamelStream *stream, const gchar *buffer, gint n)
void
camel_stream_flush (CamelStream *stream)
{
- return CS_CLASS (stream)->flush (stream);
+ CS_CLASS (stream)->flush (stream);
}
/**
diff --git a/camel/gmime-content-field.c b/camel/gmime-content-field.c
index 04b07b7626..a499ec6a9e 100644
--- a/camel/gmime-content-field.c
+++ b/camel/gmime-content-field.c
@@ -126,7 +126,7 @@ gmime_content_field_unref (GMimeContentField *content_field)
* or valid parameters name depend on the content type object. For example,
* gmime_content_field_set_parameter (cf, "charset", "us-ascii");
* will make sense for a "text/plain" content field but not for a
- * "image/gif". This routine does not check parameter validuty.
+ * "image/gif". This routine does not check parameter validity.
**/
void
gmime_content_field_set_parameter (GMimeContentField *content_field, const gchar *attribute, const gchar *value)
@@ -356,6 +356,8 @@ gmime_content_field_construct_from_string (GMimeContentField *content_field, con
CAMEL_LOG_TRACE ( "GMimeContentField::construct_from_string, Found mime parameter \"%s\"=\"%s\"\n", param_name, param_value);
string_trim (param_value, " \t", STRING_TRIM_STRIP_TRAILING | STRING_TRIM_STRIP_LEADING);
gmime_content_field_set_parameter (content_field, param_name, param_value);
+ g_free (param_name);
+ g_free (param_value);
i++;
first = i;
}
diff --git a/camel/gmime-utils.c b/camel/gmime-utils.c
index 24986d48a3..c9c17b62bd 100644
--- a/camel/gmime-utils.c
+++ b/camel/gmime-utils.c
@@ -113,6 +113,8 @@ _store_header_pair_from_string (GHashTable *header_table, gchar *header_line)
{
gchar dich_result;
gchar *header_name, *header_value;
+ gboolean key_exists;
+ gchar *old_header_name, *old_header_value;
CAMEL_LOG_FULL_DEBUG ( "_store_header_pair_from_string:: Entering\n");
g_assert (header_table);
@@ -121,15 +123,23 @@ _store_header_pair_from_string (GHashTable *header_table, gchar *header_line)
dich_result = string_dichotomy ( header_line, ':',
&header_name, &header_value,
STRING_DICHOTOMY_NONE);
- if (dich_result != 'o')
+ if (dich_result != 'o') {
CAMEL_LOG_WARNING (
"** WARNING **\n"
"store_header_pair_from_string : dichotomy result is '%c'\n"
"header line is :\n--\n%s\n--\n"
"** \n", dich_result, header_line);
- else {
+ if (header_name)
+ g_free (header_name);
+ if (header_value)
+ g_free (header_value);
+
+ } else {
string_trim (header_value, " \t",
STRING_TRIM_STRIP_LEADING | STRING_TRIM_STRIP_TRAILING);
+ key_exists = g_hash_table_lookup_extended (header_table, header_name, &old_header_name, &old_header_name);
+ if (key_exists)
+ printf ("-------- Key %s already exists /n", header_name);
g_hash_table_insert (header_table, header_name, header_value);
}
}
@@ -186,9 +196,8 @@ get_header_table_from_stream (CamelStream *stream)
}
default:
- if (!crlf) header_line = g_string_append_c (header_line, next_char);
-
-else end_of_header_line = TRUE;
+ if (!crlf) header_line = g_string_append_c (header_line, next_char);
+ else end_of_header_line = TRUE;
}
} else {
end_of_file=TRUE;
@@ -201,8 +210,8 @@ else end_of_header_line = TRUE;
} while ( !end_of_header_line );
if ( strlen(header_line->str) ) {
- str_header_line = g_strdup (header_line->str);
- _store_header_pair_from_string (header_table, str_header_line);
+ /* str_header_line = g_strdup (header_line->str); */
+ _store_header_pair_from_string (header_table, header_line->str);
}
g_string_free (header_line, FALSE);
diff --git a/camel/string-utils.c b/camel/string-utils.c
index b0d17aec5c..b1a6a5fe8a 100644
--- a/camel/string-utils.c
+++ b/camel/string-utils.c
@@ -136,11 +136,11 @@ string_dichotomy (const gchar *string, gchar sep, gchar **prefix, gchar **suffix
}
CAMEL_LOG_FULL_DEBUG ("string_dichotomy: separator found at :%d\n", sep_pos);
if (prefix) { /* return the prefix */
- *prefix = g_strndup(string+first,sep_pos-first);
+ *prefix = g_strndup (string+first,sep_pos-first);
CAMEL_LOG_FULL_DEBUG ( "string_dichotomy:: prefix:\"%s\"\n", *prefix);
}
if (suffix) { /* return the suffix */
- *suffix = g_strndup(string+sep_pos+1, last-sep_pos);
+ *suffix = g_strndup (string+sep_pos+1, last-sep_pos);
CAMEL_LOG_FULL_DEBUG ( "string_dichotomy:: suffix:\"%s\"\n", *suffix);
}