aboutsummaryrefslogtreecommitdiffstats
path: root/camel/gmime-utils.c
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/gmime-utils.c
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/gmime-utils.c')
-rw-r--r--camel/gmime-utils.c23
1 files changed, 16 insertions, 7 deletions
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);