[evolution-patches] Patch for camel-mime-part.c
- From: Vivek Jain <jvivek novell com>
- To: evolution-patches gnome org
- Subject: [evolution-patches] Patch for camel-mime-part.c
- Date: Mon, 17 Oct 2005 14:40:58 +0530
hi,
I am attaching a patch which adds g_return 's at appropriate places in
camel-mime-part.c.
These interfaces (_get functions basically) need to check for the valid
object before accessing any data member of this struct. This will help
in making application more stable by handling the cases when caller did
not care to check for the validity. The patch does that.
Please let me know if it looks ok.
Thanks,
Vivek Jain
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/ChangeLog,v
retrieving revision 1.2485
diff -u -p -r1.2485 ChangeLog
--- ChangeLog 11 Oct 2005 10:52:00 -0000 1.2485
+++ ChangeLog 17 Oct 2005 08:42:38 -0000
@@ -1,3 +1,17 @@
+2005-10-17 Vivek Jain <jvivek novell com>
+
+ * camel-mime-part.c :
+
+ (camel_mime_part_get_content_type)
+ (camel_mime_part_get_content_languages)
+ (camel_mime_part_get_content_location)
+ (camel_mime_part_get_content_id)
+ (camel_mime_part_get_content_MD5)
+ (camel_mime_part_get_filename)
+ (camel_mime_part_get_description):
+ Added g_return to validate the structure before we access
+ its members.
+
2005-10-11 Vivek Jain <jvivek novell com>
** See bug #318508
Index: camel-mime-part.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/camel-mime-part.c,v
retrieving revision 1.170
diff -u -p -r1.170 camel-mime-part.c
--- camel-mime-part.c 15 Sep 2005 17:35:45 -0000 1.170
+++ camel-mime-part.c 17 Oct 2005 08:42:39 -0000
@@ -360,6 +360,8 @@ camel_mime_part_set_description (CamelMi
const char *
camel_mime_part_get_description (CamelMimePart *mime_part)
{
+ g_return_val_if_fail (CAMEL_MIME_PART (mime_part), NULL);
+
return mime_part->description;
}
@@ -416,6 +418,8 @@ camel_mime_part_set_disposition (CamelMi
const char *
camel_mime_part_get_disposition (CamelMimePart *mime_part)
{
+ g_return_val_if_fail (CAMEL_MIME_PART (mime_part), NULL);
+
if (mime_part->disposition)
return mime_part->disposition->disposition;
else
@@ -465,12 +469,14 @@ camel_mime_part_set_filename (CamelMimeP
const char *
camel_mime_part_get_filename (CamelMimePart *mime_part)
{
+ g_return_val_if_fail (CAMEL_MIME_PART (mime_part), NULL);
+
if (mime_part->disposition) {
const char *name = camel_header_param (mime_part->disposition->params, "filename");
if (name)
return name;
}
-
+
return camel_content_type_param (((CamelDataWrapper *) mime_part)->mime_type, "name");
}
@@ -512,6 +518,8 @@ camel_mime_part_set_content_id (CamelMim
const char *
camel_mime_part_get_content_id (CamelMimePart *mime_part)
{
+ g_return_val_if_fail (CAMEL_MIME_PART (mime_part), NULL);
+
return mime_part->content_id;
}
@@ -542,6 +550,8 @@ camel_mime_part_set_content_MD5 (CamelMi
const char *
camel_mime_part_get_content_MD5 (CamelMimePart *mime_part)
{
+ g_return_val_if_fail (CAMEL_MIME_PART (mime_part), NULL);
+
return mime_part->content_MD5;
}
@@ -574,6 +584,8 @@ camel_mime_part_set_content_location (Ca
const char *
camel_mime_part_get_content_location (CamelMimePart *mime_part)
{
+ g_return_val_if_fail (CAMEL_MIME_PART (mime_part), NULL);
+
return mime_part->content_location;
}
@@ -646,6 +658,8 @@ camel_mime_part_set_content_languages (C
const GList *
camel_mime_part_get_content_languages (CamelMimePart *mime_part)
{
+ g_return_val_if_fail (CAMEL_MIME_PART (mime_part), NULL);
+
return mime_part->content_languages;
}
@@ -680,6 +694,8 @@ camel_mime_part_set_content_type (CamelM
CamelContentType *
camel_mime_part_get_content_type (CamelMimePart *mime_part)
{
+ g_return_val_if_fail (CAMEL_MIME_PART (mime_part), NULL);
+
return ((CamelDataWrapper *) mime_part)->mime_type;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]