Fix a bunch of serious small bugs.

2000-02-28  NotZed  <NotZed@HelixCode.com>

        * camel-mime-part.c (_parse_header_pair): Dont free this either.

        * camel-medium.c (_remove_header): Ugh, dont free the header
        before we actually remove it.
        (_add_header): Ugh, dont free hashtable entries which may be
        duplicated (hash_insert _will_ reference that memory).

        * string-utils.c (string_trim): Trimming a 0-length string is not
        an error.

        * camel-mime-message.c (_parse_header_pair): Fixed very broken
        memory handling of header_name/value.

        * providers/mbox/camel-mbox-utils.c (camel_mbox_write_xev):
        Initialise end_of_last_message always.
        (camel_mbox_copy_file_chunk): Stop trying to read if we run out of
        data, rather than looping forever.

        * providers/mbox/camel-mbox-folder.c (_init): Set search cap on.
        (_open): Call parent class to perform open.  Remove folder-open
        check to parent instead.
        (_create): open takes a creation mask, dont use umask to try and
        set the open mode.
        (_delete): Dont bother checking folder==NULL, its already been
        checked on the external interface (changed to an assertion, this
        would have to be a camel bug).
        (_delete_messages): Likewise.
        (_create): Ditto.
        (_init): Dont go and clear all the paths and shit that the parent
        open just setup for us.
        (_delete_messages): Get rid of more umask stuff.
        (_append_message): Make sure we pass file mode to open with create.
        (_append_message): Cleaned up some indenting to make it readable.

svn path=/trunk/; revision=1985
This commit is contained in:
NotZed
2000-02-28 23:26:13 +00:00
committed by Michael Zucci
parent bbbee6ba11
commit f81ae069e4
8 changed files with 74 additions and 87 deletions

View File

@ -150,11 +150,15 @@ _add_header (CamelMedium *medium, gchar *header_name, gchar *header_value)
header_exists = g_hash_table_lookup_extended (medium->headers, header_name,
(gpointer *) &old_header_name,
(gpointer *) &old_header_value);
/* ghashtables actually dont duplicate key pointers on existing fields,
just remove the old one first always (avoiding this assumption) */
if (header_exists) {
g_hash_table_remove (medium->headers, old_header_name);
#if 1
g_free (old_header_name);
g_free (old_header_value);
#endif
}
g_hash_table_insert (medium->headers, g_strdup (header_name),
g_strdup (header_value));
}
@ -182,12 +186,11 @@ _remove_header (CamelMedium *medium, const gchar *header_name)
(gpointer *) &old_header_name,
(gpointer *) &old_header_value);
if (header_exists) {
g_hash_table_remove (medium->headers, header_name);
g_free (old_header_name);
g_free (old_header_value);
}
g_hash_table_remove (medium->headers, header_name);
}
void