[gmime] fixed consistency issues and removed bloat



commit 8bac10e0c8262c0d873c080856a4935c5c781855
Author: Jeffrey Stedfast <fejj gnome org>
Date:   Sun Apr 26 09:43:53 2009 -0400

    fixed consistency issues and removed bloat
    
    2009-04-26  Jeffrey Stedfast  <fejj novell com>
    
    	* gmime/gmime-multipart-encrypted.c: Removed stub virtual method
    	overloads that did nothing but call the base class'
    	implementation.
    
    	* gmime/gmime-multipart-signed.c: Same.
    
    	* gmime/gmime-message-part.c (message_part_prepend_header):
    	Protect against setting Content-MD5 header since this is not
    	allowed.
    	(message_part_append_header): Same.
    	(message_part_get_header): Don't bother checking that the
    	requested header begins with "Content-", just pass it along to our
    	base class implementation to worry about.
    	(message_part_remove_header): Same.
    
    	* gmime/gmime-message-partial.c (message_partial_get_header):
    	Same.
    	(message_partial_remove_header): Here too.
    
    	* gmime/gmime-part.c (mime_part_remove_header): Same.
---
 ChangeLog                         |   23 ++++++++++++
 gmime/gmime-message-part.c        |   21 +++++------
 gmime/gmime-message-partial.c     |    8 ----
 gmime/gmime-multipart-encrypted.c |   68 -------------------------------------
 gmime/gmime-multipart-signed.c    |   68 -------------------------------------
 gmime/gmime-part.c                |    5 ---
 6 files changed, 32 insertions(+), 161 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2a0f71b..e886da3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2009-04-26  Jeffrey Stedfast  <fejj novell com>
+
+	* gmime/gmime-multipart-encrypted.c: Removed stub virtual method
+	overloads that did nothing but call the base class'
+	implementation.
+
+	* gmime/gmime-multipart-signed.c: Same.
+
+	* gmime/gmime-message-part.c (message_part_prepend_header):
+	Protect against setting Content-MD5 header since this is not
+	allowed.
+	(message_part_append_header): Same.
+	(message_part_get_header): Don't bother checking that the
+	requested header begins with "Content-", just pass it along to our
+	base class implementation to worry about.
+	(message_part_remove_header): Same.
+
+	* gmime/gmime-message-partial.c (message_partial_get_header):
+	Same.
+	(message_partial_remove_header): Here too.
+
+	* gmime/gmime-part.c (mime_part_remove_header): Same.
+
 2009-04-25  Jeffrey Stedfast  <fejj novell com>
 
 	* gmime/gmime-message-partial.c (g_mime_message_partial_split_message):
diff --git a/gmime/gmime-message-part.c b/gmime/gmime-message-part.c
index 0664b85..1dfba0f 100644
--- a/gmime/gmime-message-part.c
+++ b/gmime/gmime-message-part.c
@@ -125,6 +125,10 @@ g_mime_message_part_finalize (GObject *object)
 static void
 message_part_prepend_header (GMimeObject *object, const char *header, const char *value)
 {
+	/* RFC 1864 states that you cannot set a Content-MD5 on a message part */
+	if (!g_ascii_strcasecmp ("Content-MD5", header))
+		return;
+	
 	/* Make sure that the header is a Content-* header, else it
            doesn't belong on a message part */
 	if (!g_ascii_strncasecmp ("Content-", header, 8))
@@ -134,6 +138,10 @@ message_part_prepend_header (GMimeObject *object, const char *header, const char
 static void
 message_part_append_header (GMimeObject *object, const char *header, const char *value)
 {
+	/* RFC 1864 states that you cannot set a Content-MD5 on a message part */
+	if (!g_ascii_strcasecmp ("Content-MD5", header))
+		return;
+	
 	/* Make sure that the header is a Content-* header, else it
            doesn't belong on a message part */
 	if (!g_ascii_strncasecmp ("Content-", header, 8))
@@ -156,29 +164,18 @@ message_part_set_header (GMimeObject *object, const char *header, const char *va
 static const char *
 message_part_get_header (GMimeObject *object, const char *header)
 {
-	/* Make sure that the header is a Content-* header, else it
-           doesn't belong on a message part */
-	if (!g_ascii_strncasecmp ("Content-", header, 8))
-		return GMIME_OBJECT_CLASS (parent_class)->get_header (object, header);
-	else
-		return NULL;
+	return GMIME_OBJECT_CLASS (parent_class)->get_header (object, header);
 }
 
 static gboolean
 message_part_remove_header (GMimeObject *object, const char *header)
 {
-	/* Make sure that the header is a Content-* header, else it
-           doesn't belong on a message part */
-	if (g_ascii_strncasecmp ("Content-", header, 8) != 0)
-		return FALSE;
-	
 	return GMIME_OBJECT_CLASS (parent_class)->remove_header (object, header);
 }
 
 static void
 message_part_set_content_type (GMimeObject *object, GMimeContentType *content_type)
 {
-	/* nothing special here... */
 	GMIME_OBJECT_CLASS (parent_class)->set_content_type (object, content_type);
 }
 
diff --git a/gmime/gmime-message-partial.c b/gmime/gmime-message-partial.c
index c54c70e..1283b8d 100644
--- a/gmime/gmime-message-partial.c
+++ b/gmime/gmime-message-partial.c
@@ -153,20 +153,12 @@ message_partial_set_header (GMimeObject *object, const char *header, const char
 static const char *
 message_partial_get_header (GMimeObject *object, const char *header)
 {
-	/* RFC 1864 states that you cannot set a Content-MD5 on a message part */
-	if (!g_ascii_strcasecmp ("Content-MD5", header))
-		return NULL;
-	
 	return GMIME_OBJECT_CLASS (parent_class)->get_header (object, header);
 }
 
 static gboolean
 message_partial_remove_header (GMimeObject *object, const char *header)
 {
-	/* RFC 1864 states that you cannot set a Content-MD5 on a message part */
-	if (!g_ascii_strcasecmp ("Content-MD5", header))
-		return FALSE;
-	
 	return GMIME_OBJECT_CLASS (parent_class)->remove_header (object, header);
 }
 
diff --git a/gmime/gmime-multipart-encrypted.c b/gmime/gmime-multipart-encrypted.c
index c4e41d0..cb0e7de 100644
--- a/gmime/gmime-multipart-encrypted.c
+++ b/gmime/gmime-multipart-encrypted.c
@@ -57,16 +57,6 @@ static void g_mime_multipart_encrypted_class_init (GMimeMultipartEncryptedClass
 static void g_mime_multipart_encrypted_init (GMimeMultipartEncrypted *mps, GMimeMultipartEncryptedClass *klass);
 static void g_mime_multipart_encrypted_finalize (GObject *object);
 
-/* GMimeObject class methods */
-static void multipart_encrypted_prepend_header (GMimeObject *object, const char *header, const char *value);
-static void multipart_encrypted_append_header (GMimeObject *object, const char *header, const char *value);
-static void multipart_encrypted_set_header (GMimeObject *object, const char *header, const char *value);
-static const char *multipart_encrypted_get_header (GMimeObject *object, const char *header);
-static gboolean multipart_encrypted_remove_header (GMimeObject *object, const char *header);
-static void multipart_encrypted_set_content_type (GMimeObject *object, GMimeContentType *content_type);
-static char *multipart_encrypted_get_headers (GMimeObject *object);
-static ssize_t multipart_encrypted_write_to_stream (GMimeObject *object, GMimeStream *stream);
-
 
 static GMimeMultipartClass *parent_class = NULL;
 
@@ -99,21 +89,11 @@ g_mime_multipart_encrypted_get_type (void)
 static void
 g_mime_multipart_encrypted_class_init (GMimeMultipartEncryptedClass *klass)
 {
-	GMimeObjectClass *object_class = GMIME_OBJECT_CLASS (klass);
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 	
 	parent_class = g_type_class_ref (GMIME_TYPE_MULTIPART);
 	
 	gobject_class->finalize = g_mime_multipart_encrypted_finalize;
-	
-	object_class->prepend_header = multipart_encrypted_prepend_header;
-	object_class->append_header = multipart_encrypted_append_header;
-	object_class->remove_header = multipart_encrypted_remove_header;
-	object_class->set_header = multipart_encrypted_set_header;
-	object_class->get_header = multipart_encrypted_get_header;
-	object_class->set_content_type = multipart_encrypted_set_content_type;
-	object_class->get_headers = multipart_encrypted_get_headers;
-	object_class->write_to_stream = multipart_encrypted_write_to_stream;
 }
 
 static void
@@ -137,54 +117,6 @@ g_mime_multipart_encrypted_finalize (GObject *object)
 	G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
-static void
-multipart_encrypted_prepend_header (GMimeObject *object, const char *header, const char *value)
-{
-	GMIME_OBJECT_CLASS (parent_class)->prepend_header (object, header, value);
-}
-
-static void
-multipart_encrypted_append_header (GMimeObject *object, const char *header, const char *value)
-{
-	GMIME_OBJECT_CLASS (parent_class)->append_header (object, header, value);
-}
-
-static void
-multipart_encrypted_set_header (GMimeObject *object, const char *header, const char *value)
-{
-	GMIME_OBJECT_CLASS (parent_class)->set_header (object, header, value);
-}
-
-static const char *
-multipart_encrypted_get_header (GMimeObject *object, const char *header)
-{
-	return GMIME_OBJECT_CLASS (parent_class)->get_header (object, header);
-}
-
-static gboolean
-multipart_encrypted_remove_header (GMimeObject *object, const char *header)
-{
-	return GMIME_OBJECT_CLASS (parent_class)->remove_header (object, header);
-}
-
-static void
-multipart_encrypted_set_content_type (GMimeObject *object, GMimeContentType *content_type)
-{
-	GMIME_OBJECT_CLASS (parent_class)->set_content_type (object, content_type);
-}
-
-static char *
-multipart_encrypted_get_headers (GMimeObject *object)
-{
-	return GMIME_OBJECT_CLASS (parent_class)->get_headers (object);
-}
-
-static ssize_t
-multipart_encrypted_write_to_stream (GMimeObject *object, GMimeStream *stream)
-{
-	return GMIME_OBJECT_CLASS (parent_class)->write_to_stream (object, stream);
-}
-
 
 /**
  * g_mime_multipart_encrypted_new:
diff --git a/gmime/gmime-multipart-signed.c b/gmime/gmime-multipart-signed.c
index 16e5963..851865f 100644
--- a/gmime/gmime-multipart-signed.c
+++ b/gmime/gmime-multipart-signed.c
@@ -57,16 +57,6 @@ static void g_mime_multipart_signed_class_init (GMimeMultipartSignedClass *klass
 static void g_mime_multipart_signed_init (GMimeMultipartSigned *mps, GMimeMultipartSignedClass *klass);
 static void g_mime_multipart_signed_finalize (GObject *object);
 
-/* GMimeObject class methods */
-static void multipart_signed_prepend_header (GMimeObject *object, const char *header, const char *value);
-static void multipart_signed_append_header (GMimeObject *object, const char *header, const char *value);
-static void multipart_signed_set_header (GMimeObject *object, const char *header, const char *value);
-static const char *multipart_signed_get_header (GMimeObject *object, const char *header);
-static gboolean multipart_signed_remove_header (GMimeObject *object, const char *header);
-static void multipart_signed_set_content_type (GMimeObject *object, GMimeContentType *content_type);
-static char *multipart_signed_get_headers (GMimeObject *object);
-static ssize_t multipart_signed_write_to_stream (GMimeObject *object, GMimeStream *stream);
-
 
 static GMimeMultipartClass *parent_class = NULL;
 
@@ -99,21 +89,11 @@ g_mime_multipart_signed_get_type (void)
 static void
 g_mime_multipart_signed_class_init (GMimeMultipartSignedClass *klass)
 {
-	GMimeObjectClass *object_class = GMIME_OBJECT_CLASS (klass);
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 	
 	parent_class = g_type_class_ref (GMIME_TYPE_MULTIPART);
 	
 	gobject_class->finalize = g_mime_multipart_signed_finalize;
-	
-	object_class->prepend_header = multipart_signed_prepend_header;
-	object_class->append_header = multipart_signed_append_header;
-	object_class->remove_header = multipart_signed_remove_header;
-	object_class->set_header = multipart_signed_set_header;
-	object_class->get_header = multipart_signed_get_header;
-	object_class->set_content_type = multipart_signed_set_content_type;
-	object_class->get_headers = multipart_signed_get_headers;
-	object_class->write_to_stream = multipart_signed_write_to_stream;
 }
 
 static void
@@ -128,54 +108,6 @@ g_mime_multipart_signed_finalize (GObject *object)
 	G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
-static void
-multipart_signed_prepend_header (GMimeObject *object, const char *header, const char *value)
-{
-	GMIME_OBJECT_CLASS (parent_class)->prepend_header (object, header, value);
-}
-
-static void
-multipart_signed_append_header (GMimeObject *object, const char *header, const char *value)
-{
-	GMIME_OBJECT_CLASS (parent_class)->append_header (object, header, value);
-}
-
-static void
-multipart_signed_set_header (GMimeObject *object, const char *header, const char *value)
-{
-	GMIME_OBJECT_CLASS (parent_class)->set_header (object, header, value);
-}
-
-static const char *
-multipart_signed_get_header (GMimeObject *object, const char *header)
-{
-	return GMIME_OBJECT_CLASS (parent_class)->get_header (object, header);
-}
-
-static gboolean
-multipart_signed_remove_header (GMimeObject *object, const char *header)
-{
-	return GMIME_OBJECT_CLASS (parent_class)->remove_header (object, header);
-}
-
-static void
-multipart_signed_set_content_type (GMimeObject *object, GMimeContentType *content_type)
-{
-	GMIME_OBJECT_CLASS (parent_class)->set_content_type (object, content_type);
-}
-
-static char *
-multipart_signed_get_headers (GMimeObject *object)
-{
-	return GMIME_OBJECT_CLASS (parent_class)->get_headers (object);
-}
-
-static ssize_t
-multipart_signed_write_to_stream (GMimeObject *object, GMimeStream *stream)
-{
-	return GMIME_OBJECT_CLASS (parent_class)->write_to_stream (object, stream);
-}
-
 
 /**
  * g_mime_multipart_signed_new:
diff --git a/gmime/gmime-part.c b/gmime/gmime-part.c
index b8aa370..502b31a 100644
--- a/gmime/gmime-part.c
+++ b/gmime/gmime-part.c
@@ -257,11 +257,6 @@ mime_part_remove_header (GMimeObject *object, const char *header)
 	GMimePart *mime_part = (GMimePart *) object;
 	guint i;
 	
-	/* Make sure that the header is a Content-* header, else it
-	   doesn't belong on a mime part */
-	if (g_ascii_strncasecmp ("Content-", header, 8) != 0)
-		return FALSE;
-	
 	for (i = 0; i < G_N_ELEMENTS (content_headers); i++) {
 		if (!g_ascii_strcasecmp (content_headers[i], header))
 			break;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]