summaryrefslogtreecommitdiff
path: root/src/libicalvcal/icalvcal.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libicalvcal/icalvcal.c')
-rw-r--r--src/libicalvcal/icalvcal.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/libicalvcal/icalvcal.c b/src/libicalvcal/icalvcal.c
index f495af2..4e88034 100644
--- a/src/libicalvcal/icalvcal.c
+++ b/src/libicalvcal/icalvcal.c
@@ -45,10 +45,15 @@
#include "icalvcal.h"
#include <string.h>
+#include <stddef.h> /* for ptrdiff_h */
-#ifdef WIN32
-#define snprintf _snprintf
-#define strcasecmp stricmp
+#if defined(_MSC_VER)
+#define snprintf _snprintf
+#define strcasecmp stricmp
+#endif
+
+#ifdef _WIN32_WCE
+#undef IGNORE
#endif
enum datatype {
@@ -167,14 +172,17 @@ icalcomponent* icalvcal_convert_with_defaults (VObject *object,
{
char* name = (char*)vObjectName(object);
- icalcomponent* container = icalcomponent_new(ICAL_XROOT_COMPONENT);
+ icalcomponent* container;
icalcomponent* root;
icalproperty *prop;
icalerror_check_arg_rz( (object!=0),"Object");
+ container = icalcomponent_new(ICAL_XROOT_COMPONENT);
+
/* The root object must be a VCALENDAR */
if(*name==0 || strcmp(name,VCCalProp) != 0){
+ icalcomponent_free(container);
return 0; /* HACK. Should return an error */
}
@@ -357,6 +365,7 @@ static int get_alarm_properties (icalcomponent *comp, VObject *object,
attach = icalattach_new_from_url (s);
attach_prop = icalproperty_new_attach (attach);
icalcomponent_add_property (comp, attach_prop);
+ icalattach_unref(attach);
/* We output a "application/binary" FMTTYPE for Procedure
alarms. */
@@ -468,6 +477,7 @@ static int get_alarm_properties (icalcomponent *comp, VObject *object,
fmttype_param = icalparameter_new_fmttype (defaults->alarm_audio_fmttype);
icalproperty_add_parameter (attach_prop, fmttype_param);
+ icalattach_unref(attach);
} else {
is_valid_alarm = 0;
}
@@ -526,7 +536,7 @@ static int get_alarm_properties (icalcomponent *comp, VObject *object,
/* Check for Gnome Calendar, which will just save a pathname. */
if (url && url[0] == '/') {
- int len;
+ size_t len;
char *new_url;
icalattach *new_attach;
@@ -541,6 +551,7 @@ static int get_alarm_properties (icalcomponent *comp, VObject *object,
free (new_url);
icalproperty_set_attach (attach_prop, new_attach);
+ icalattach_unref(attach);
} else {
is_valid_alarm = 0;
@@ -816,7 +827,7 @@ static char* rrule_parse_duration (char *s, struct icalrecurrencetype *recur,
} else if (*s >= '0' && *s <= '9') {
/* If it starts with a digit it must be the UNTIL date. */
char *e, buffer[20];
- int len;
+ ptrdiff_t len;
/* Find the end of the date. */
e = s;
@@ -859,7 +870,7 @@ static char* rrule_parse_duration (char *s, struct icalrecurrencetype *recur,
/* It must be followed by whitespace or the end of the string.
I'm not sure if anything else is allowed. */
- if (*s != '\0' && *s != ' ' && *s != '\t') {
+ if (s && *s != '\0' && *s != ' ' && *s != '\t') {
*error_message = "Invalid Duration";
return NULL;
}