diff options
author | Miguel de Icaza <miguel@nuclecu.unam.mx> | 1998-04-15 14:37:34 +0800 |
---|---|---|
committer | Arturo Espinosa <unammx@src.gnome.org> | 1998-04-15 14:37:34 +0800 |
commit | ca50d9fad97731aefa9bca4075ba6f655c6e742e (patch) | |
tree | 3016f224fe4f7adbc2552273e1e95c4014b546c2 /calendar/cal-util/calobj.c | |
parent | 32c476890163a5489b655b56a26c79f451135a2c (diff) | |
download | gsoc2013-evolution-ca50d9fad97731aefa9bca4075ba6f655c6e742e.tar gsoc2013-evolution-ca50d9fad97731aefa9bca4075ba6f655c6e742e.tar.gz gsoc2013-evolution-ca50d9fad97731aefa9bca4075ba6f655c6e742e.tar.bz2 gsoc2013-evolution-ca50d9fad97731aefa9bca4075ba6f655c6e742e.tar.lz gsoc2013-evolution-ca50d9fad97731aefa9bca4075ba6f655c6e742e.tar.xz gsoc2013-evolution-ca50d9fad97731aefa9bca4075ba6f655c6e742e.tar.zst gsoc2013-evolution-ca50d9fad97731aefa9bca4075ba6f655c6e742e.zip |
Routine to destory rows array properly.
1998-04-15 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gncal-full-day.c (layout_kill_rows): Routine to destory rows
array properly.
* gncal-year-view.c (gncal_year_view_new): Add missing year in
call to strftime.
* calobj.c (ical_object_create_from_vobject): Fixed memory leaks
from the return values of versit's fakeCString.
svn path=/trunk/; revision=136
Diffstat (limited to 'calendar/cal-util/calobj.c')
-rw-r--r-- | calendar/cal-util/calobj.c | 99 |
1 files changed, 66 insertions, 33 deletions
diff --git a/calendar/cal-util/calobj.c b/calendar/cal-util/calobj.c index 237017a6f9..f02feaf7a1 100644 --- a/calendar/cal-util/calobj.c +++ b/calendar/cal-util/calobj.c @@ -383,7 +383,7 @@ load_recurrence (iCalObject *o, char *str) } #define is_a_prop_of(obj,prop) isAPropertyOf (obj,prop) -#define str_val(obj) fakeCString (vObjectUStringZValue (obj)) +#define str_val(obj) the_str = fakeCString (vObjectUStringZValue (obj)) #define has(obj,prop) (vo = isAPropertyOf (obj, prop)) /* FIXME: we need to load the recurrence properties */ @@ -394,6 +394,7 @@ ical_object_create_from_vobject (VObject *o, const char *object_name) iCalObject *ical; VObject *vo; VObjectIterator i; + char *the_str; ical = g_new0 (iCalObject, 1); @@ -405,97 +406,128 @@ ical_object_create_from_vobject (VObject *o, const char *object_name) return 0; /* uid */ - if (has (o, VCUniqueStringProp)) + if (has (o, VCUniqueStringProp)){ ical->uid = g_strdup (str_val (vo)); - + free (the_str); + } + /* seq */ - if (has (o, VCSequenceProp)) + if (has (o, VCSequenceProp)){ ical->seq = atoi (str_val (vo)); - else + free (the_str); + } else ical->seq = 0; /* dtstart */ - if (has (o, VCDTstartProp)) + if (has (o, VCDTstartProp)){ ical->dtstart = time_from_isodate (str_val (vo)); - else + free (the_str); + } else ical->dtstart = 0; /* dtend */ - if (has (o, VCDTendProp)) + if (has (o, VCDTendProp)){ ical->dtend = time_from_isodate (str_val (vo)); - else + free (the_str); + } else ical->dtend = 0; /* dcreated */ - if (has (o, VCDCreatedProp)) + if (has (o, VCDCreatedProp)){ ical->created = time_from_isodate (str_val (vo)); + free (the_str); + } /* completed */ - if (has (o, VCCompletedProp)) + if (has (o, VCCompletedProp)){ ical->completed = time_from_isodate (str_val (vo)); + free (the_str); + } /* last_mod */ - if (has (o, VCLastModifiedProp)) + if (has (o, VCLastModifiedProp)){ ical->last_mod = time_from_isodate (str_val (vo)); - else + free (the_str); + } else ical->last_mod = now; /* exdate */ - if (has (o, VCExpDateProp)) + if (has (o, VCExpDateProp)){ ical->exdate = set_date_list (str_val (vo)); + free (the_str); + } /* description/comment */ - if (has (o, VCDescriptionProp)) + if (has (o, VCDescriptionProp)){ ical->comment = g_strdup (str_val (vo)); + free (the_str); + } /* summary */ - if (has (o, VCSummaryProp)) + if (has (o, VCSummaryProp)){ ical->summary = g_strdup (str_val (vo)); - else + free (the_str); + } else ical->summary = g_strdup (""); /* status */ - if (has (o, VCStatusProp)) + if (has (o, VCStatusProp)){ ical->status = g_strdup (str_val (vo)); - else + free (the_str); + } else ical->status = g_strdup ("NEEDS ACTION"); - if (has (o, VCClassProp)) + if (has (o, VCClassProp)){ ical->class = g_strdup (str_val (vo)); - else + free (the_str); + } else ical->class = "PUBLIC"; /* categories */ - if (has (o, VCCategoriesProp)) + if (has (o, VCCategoriesProp)){ ical->categories = set_list (str_val (vo), ","); - + free (the_str); + } + /* resources */ - if (has (o, VCResourcesProp)) + if (has (o, VCResourcesProp)){ ical->resources = set_list (str_val (vo), ";"); + free (the_str); + } /* priority */ - if (has (o, VCPriorityProp)) + if (has (o, VCPriorityProp)){ ical->priority = atoi (str_val (vo)); - + free (the_str); + } + /* tranparency */ - if (has (o, VCTranspProp)) + if (has (o, VCTranspProp)){ ical->transp = atoi (str_val (vo)) ? ICAL_TRANSPARENT : ICAL_OPAQUE; + free (the_str); + } /* related */ - if (has (o, VCRelatedToProp)) + if (has (o, VCRelatedToProp)){ ical->related = set_list (str_val (vo), ";"); - + free (the_str); + } + /* attach */ initPropIterator (&i, o); while (moreIteration (&i)){ vo = nextVObject (&i); - if (strcmp (vObjectName (vo), VCAttachProp) == 0) + if (strcmp (vObjectName (vo), VCAttachProp) == 0){ ical->attach = g_list_prepend (ical->attach, g_strdup (str_val (vo))); + free (the_str); + } } /* url */ - if (has (o, VCURLProp)) + if (has (o, VCURLProp)){ ical->url = g_strdup (str_val (vo)); + free (the_str); + } /* FIXME: dalarm */ if (has (o, VCDAlarmProp)) @@ -514,12 +546,13 @@ ical_object_create_from_vobject (VObject *o, const char *object_name) ; /* FIXME: rrule */ - if (has (o, VCRRuleProp)) + if (has (o, VCRRuleProp)){ if (!load_recurrence (ical, str_val (vo))) { ical_object_destroy (ical); return NULL; } - + free (the_str); + } return ical; } |