From 4f01ac0677ecdc5b979de6c8ab39f828f110bba2 Mon Sep 17 00:00:00 2001 From: alexhudson Date: Sun, 19 Jul 2009 13:24:54 +0000 Subject: [PATCH] Make bongocal compile strictly, try to fix some of the bugs in the library... --- include/bongocal-raw.h | 2 +- include/bongoutil.h | 14 ++++--- include/xpl.h | 8 ++++ src/libs/bongoutil/lists.c | 28 ++++++++++++++ src/libs/cal/CMakeLists.txt | 3 ++ src/libs/cal/bongo-cal-instance.c | 16 ++++---- src/libs/cal/bongo-cal-object.c | 4 +- src/libs/cal/bongo-cal-recur.c | 61 ++++++++++++++++++------------- src/libs/cal/bongo-cal-time.c | 6 +-- src/libs/cal/bongo-cal-timezone.c | 31 +++++++++------- src/libs/cal/cal-convert.c | 52 +++++++++++++++++++++----- 11 files changed, 158 insertions(+), 67 deletions(-) diff --git a/include/bongocal-raw.h b/include/bongocal-raw.h index 294b7d1..2ba3c96 100644 --- a/include/bongocal-raw.h +++ b/include/bongocal-raw.h @@ -23,7 +23,7 @@ #define BONGOCAL_RAW_H #include -#include +#include #include XPL_BEGIN_C_LINKAGE diff --git a/include/bongoutil.h b/include/bongoutil.h index 7650378..7084aa8 100644 --- a/include/bongoutil.h +++ b/include/bongoutil.h @@ -316,14 +316,15 @@ typedef struct _BongoList BongoList; typedef struct _BongoSList BongoSList; struct _BongoList { - void *data; - BongoList *next; - BongoList *prev; + void *data; + + BongoList *next; + BongoList *prev; }; struct _BongoSList { - void *data; - BongoSList *next; + void *data; + BongoSList *next; }; BongoList *BongoListCopy(BongoList *list); @@ -346,6 +347,9 @@ void BongoSListFreeDeep(BongoSList *slist); int BongoSListLength(BongoSList *slist); BongoSList *BongoSListDelete(BongoSList *list, void *data, BOOL deep); +void *BongoListIntToVoid (int val); +int BongoListVoidToInt (void * ptr); + /** end lists.c **/ /** begin array.c **/ diff --git a/include/xpl.h b/include/xpl.h index b63c2a5..4e8ce66 100644 --- a/include/xpl.h +++ b/include/xpl.h @@ -22,6 +22,14 @@ #ifndef XPL_H #define XPL_H +// this define should be used to mark function parameters that are currently +// unused but ought to be used / will be used in the future. +#define UNUSED_PARAMETER(x) if(x) {} + +// this define should be used to mark function parameters that are unused +// and possibly should be removed. +#define UNUSED_PARAMETER_REFACTOR(x) if(x) {} + #include "xplutil.h" #include "xplthread.h" #include "xplservice.h" diff --git a/src/libs/bongoutil/lists.c b/src/libs/bongoutil/lists.c index 7a496ff..044aa44 100644 --- a/src/libs/bongoutil/lists.c +++ b/src/libs/bongoutil/lists.c @@ -375,3 +375,31 @@ BongoListDelete(BongoList *list, void *data, BOOL deep) return result; } + +// dodgy conversion routines to allow ints to be stored in lists +typedef union { + void *ptr; + int i; +} _bongo_list_conversion; + +void * +BongoListIntToVoid (int val) +{ + _bongo_list_conversion conv; + + memset(&conv, 0, sizeof(_bongo_list_conversion)); + + conv.i = val; + return conv.ptr; +} + +int +BongoListVoidToInt (void * ptr) +{ + _bongo_list_conversion conv; + + memset(&conv, 0, sizeof(_bongo_list_conversion)); + + conv.ptr = ptr; + return conv.i; +} diff --git a/src/libs/cal/CMakeLists.txt b/src/libs/cal/CMakeLists.txt index 782fa05..ab5474c 100644 --- a/src/libs/cal/CMakeLists.txt +++ b/src/libs/cal/CMakeLists.txt @@ -1,3 +1,5 @@ +StrictCompile() + add_library(bongocal SHARED bongo-cal-object.c bongo-cal-instance.c @@ -19,6 +21,7 @@ add_library(bongocal SHARED target_link_libraries(bongocal bongoxpl + bongoutil bongomemmgr ${LIBICAL_LIBRARIES} ) diff --git a/src/libs/cal/bongo-cal-instance.c b/src/libs/cal/bongo-cal-instance.c index 3fe2c1c..d107f62 100644 --- a/src/libs/cal/bongo-cal-instance.c +++ b/src/libs/cal/bongo-cal-instance.c @@ -239,7 +239,7 @@ WriteLocalizedTime(BongoCalTime t, BongoCalTimezone *tz) } static BOOL -ReadPeriod(BongoCalInstance *inst, BongoJsonObject *obj, BongoCalPeriod *period) +ReadPeriod(BongoJsonObject *obj, BongoCalPeriod *period) { const char *value; BongoJsonObject *jsonValue; @@ -302,7 +302,7 @@ IntArrayToList(GArray *array, int min, int max) int intVal; if (BongoJsonArrayGetInt(array, i, &intVal) == BONGO_JSON_OK) { if (intVal >= min && intVal <= max) { - ret = BongoListPrepend(ret, (char *)(intVal)); + ret = BongoListPrepend(ret, BongoListIntToVoid(intVal)); } } } @@ -327,8 +327,8 @@ DayArrayToList(GArray *array) day = GetWeekday(end); if (ord >= -53 && ord <= 53) { - ret = BongoListPrepend(ret, (char *)(day)); - ret = BongoListPrepend(ret, (char *)(ord)); + ret = BongoListPrepend(ret, BongoListIntToVoid(day)); + ret = BongoListPrepend(ret, BongoListIntToVoid(ord)); } } } @@ -337,7 +337,7 @@ DayArrayToList(GArray *array) } static BOOL -ReadRecur(BongoCalInstance *inst, BongoJsonObject *obj, BongoCalRule *recur) +ReadRecur(BongoJsonObject *obj, BongoCalRule *recur) { GArray *arrayVal; const char *stringVal; @@ -394,7 +394,7 @@ ReadRecur(BongoCalInstance *inst, BongoJsonObject *obj, BongoCalRule *recur) recur->bymonth = IntArrayToList(arrayVal, 1, 12); for (l = recur->bymonth; l != NULL; l = l->next) { - l->data = ((int)(l->data)) - 1; + l->data--; } } @@ -601,7 +601,7 @@ CacheRDates(BongoCalInstance *inst, const char *key, BongoSList **dates) if (period) { rdate->type = BONGO_CAL_RDATE_PERIOD; - ReadPeriod(inst, obj, &rdate->value.period); + ReadPeriod(obj, &rdate->value.period); } else { rdate->type = BONGO_CAL_RDATE_DATETIME; ReadTime(inst, obj, &rdate->value.time); @@ -634,7 +634,7 @@ CacheRRules(BongoCalInstance *inst, const char *key, BongoSList **rules) r = MemNew0(BongoCalRule, 1); - ReadRecur(inst, obj, r); + ReadRecur(obj, r); *rules = BongoSListPrepend(*rules, r); } diff --git a/src/libs/cal/bongo-cal-object.c b/src/libs/cal/bongo-cal-object.c index f9e1167..166e3ca 100644 --- a/src/libs/cal/bongo-cal-object.c +++ b/src/libs/cal/bongo-cal-object.c @@ -20,8 +20,9 @@ ****************************************************************************/ #include +#include #include -#include +#include #include #include "bongo-cal-private.h" @@ -653,6 +654,7 @@ BongoCalOccurrence BongoCalObjectPrimaryOccurrence(BongoCalObject *cal, BongoCalTimezone *defaultTz) { + UNUSED_PARAMETER_REFACTOR(defaultTz) if (cal->instances->len > 0) { /* This needs to have some logic to find the primary instance, rather than the first instance. However, for now we're diff --git a/src/libs/cal/bongo-cal-recur.c b/src/libs/cal/bongo-cal-recur.c index 43d741b..dd03f9f 100644 --- a/src/libs/cal/bongo-cal-recur.c +++ b/src/libs/cal/bongo-cal-recur.c @@ -925,6 +925,7 @@ GenerateInstancesForChunk (BongoCalInstance *inst, BongoCalTime startt, endt; BOOL cbStatus = TRUE, ruleFinished, finished = TRUE; + UNUSED_PARAMETER(convertEndDate) DPRINT ("In GenerateInstancesForChunk rrules: %p %p %llud" " %i/%i/%i %02i:%02i:%02i - %i/%i/%i %02i:%02i:%02i\n", @@ -987,6 +988,7 @@ GenerateInstancesForChunk (BongoCalInstance *inst, BongoCalRDate *p; BongoCalTime *cdt; CalObjRecurrenceDate rdate; + CalObjTime *new_cot; p = elem->data; if (p->type == BONGO_CAL_RDATE_DATETIME) { @@ -1031,9 +1033,9 @@ GenerateInstancesForChunk (BongoCalInstance *inst, g_array_append_val(rdatePeriods, rdate); } - DPRINT("adding an rdate\n"); - - g_array_append_val(occs, cotime); + new_cot = MemNew(CalObjTime, 1); + memcpy(new_cot, &cotime, sizeof(CalObjTime)); + g_array_append_val(occs, new_cot); } /* Expand each of the exception rules. */ @@ -1115,7 +1117,7 @@ GenerateInstancesForChunk (BongoCalInstance *inst, for (i = 0; i < occs->len; i++) { /* Convert each CalObjTime into a start & end time, and check it is within the bounds of the event & interval. */ - occ = &g_array_index(occs, CalObjTime, i); + occ = g_array_index(occs, CalObjTime *, i); DPRINT ("Checking occurrence: %s\n", CalObjTimeToString (occ)); @@ -1703,7 +1705,7 @@ CalObjInitializeRecurData (RecurData *recurData, /* Create an array of months from bymonths for fast lookup. */ elem = recur->bymonth; while (elem) { - month = (int) (elem->data); + month = BongoListVoidToInt(elem->data); recurData->months[month] = 1; elem = elem->next; } @@ -1713,7 +1715,7 @@ CalObjInitializeRecurData (RecurData *recurData, element there corresponds to the last day of the year. */ elem = recur->byyearday; while (elem) { - yearday = (int) (elem->data); + yearday = BongoListVoidToInt(elem->data); if (yearday >= 0) recurData->yeardays[yearday] = 1; else @@ -1726,7 +1728,7 @@ CalObjInitializeRecurData (RecurData *recurData, element there corresponds to the last day of the month. */ elem = recur->bymonthday; while (elem) { - monthday = (int) (elem->data); + monthday = BongoListVoidToInt(elem->data); if (monthday >= 0) recurData->monthdays[monthday] = 1; else @@ -1737,10 +1739,10 @@ CalObjInitializeRecurData (RecurData *recurData, /* Create an array of weekdays from byday for fast lookup. */ elem = recur->byday; while (elem) { - weekday = (int) (elem->data); + weekday = BongoListVoidToInt(elem->data); elem = elem->next; /* The week number is not used when filtering. */ - week_num = (int) (elem->data); + week_num = BongoListVoidToInt(elem->data); elem = elem->next; recurData->weekdays[weekday] = 1; @@ -1749,7 +1751,7 @@ CalObjInitializeRecurData (RecurData *recurData, /* Create an array of hours from byhour for fast lookup. */ elem = recur->byhour; while (elem) { - hour = (int) (elem->data); + hour = BongoListVoidToInt(elem->data); recurData->hours[hour] = 1; elem = elem->next; } @@ -1757,7 +1759,7 @@ CalObjInitializeRecurData (RecurData *recurData, /* Create an array of minutes from byminutes for fast lookup. */ elem = recur->byminute; while (elem) { - minute = (int) (elem->data); + minute = BongoListVoidToInt(elem->data); recurData->minutes[minute] = 1; elem = elem->next; } @@ -1765,7 +1767,7 @@ CalObjInitializeRecurData (RecurData *recurData, /* Create an array of seconds from byseconds for fast lookup. */ elem = recur->bysecond; while (elem) { - second = (int) (elem->data); + second = BongoListVoidToInt(elem->data); recurData->seconds[second] = 1; elem = elem->next; } @@ -1958,7 +1960,7 @@ CalObjBySetPosFilter (BongoCalRule *recur, element from occs to new_occs. */ len = occs->len; while (elem) { - pos = (int) (elem->data); + pos = BongoListVoidToInt(elem->data); /* Negative values count back from the end of the array. */ if (pos < 0) @@ -2486,7 +2488,7 @@ CalObjByMonthExpand (RecurData *recurData, elem = recurData->recur->bymonth; while (elem) { /* NOTE: The day may now be invalid, e.g. 31st Feb. */ - occ->month = (int) (elem->data); + occ->month = BongoListVoidToInt(elem->data); g_array_append_val(new_occs, occ); elem = elem->next; } @@ -2567,7 +2569,7 @@ CalObjByWeeknoExpand (RecurData *recurData, new occurrence for each one. */ elem = recurData->recur->byweekno; while (elem) { - weekno = (int) (elem->data); + weekno = BongoListVoidToInt(elem->data); if (weekno > 0) { cotime = year_start_cotime; CalObjTimeAddDays (&cotime, @@ -2638,7 +2640,7 @@ CalObjByYeardayExpand (RecurData *recurData, new occurrence for each one. */ elem = recurData->recur->byyearday; while (elem) { - dayno = (int) (elem->data); + dayno = BongoListVoidToInt(elem->data); if (dayno > 0) { cotime = year_start_cotime; CalObjTimeAddDays (&cotime, dayno - 1); @@ -2732,7 +2734,7 @@ CalObjBymonthdayExpand (RecurData *recurData, new occurrence for each one. */ elem = recurData->recur->bymonthday; while (elem) { - dayno = (int) (elem->data); + dayno = BongoListVoidToInt(elem->data); if (dayno > 0) { cotime = month_start_cotime; CalObjTimeAddDays (&cotime, dayno - 1); @@ -2817,9 +2819,9 @@ CalObjByDayExpandYearly (RecurData *recurData, elem = recurData->recur->byday; while (elem) { - weekday = (int) (elem->data); + weekday = BongoListVoidToInt(elem->data); elem = elem->next; - week_num = (int) (elem->data); + week_num = BongoListVoidToInt(elem->data); elem = elem->next; year = occ->year; @@ -2895,9 +2897,9 @@ CalObjByDayExpandMonthly (RecurData *recurData, elem = recurData->recur->byday; while (elem) { - weekday = (int) (elem->data); + weekday = BongoListVoidToInt(elem->data); elem = elem->next; - week_num = (int) (elem->data); + week_num = BongoListVoidToInt(elem->data); elem = elem->next; year = occ->year; @@ -2984,7 +2986,7 @@ CalObjByDayExpandWeekly (RecurData *recurData, elem = recurData->recur->byday; while (elem) { - weekday = (int) (elem->data); + weekday = BongoListVoidToInt(elem->data); DPRINT("weekday is %d\n", weekday); elem = elem->next; @@ -2992,7 +2994,7 @@ CalObjByDayExpandWeekly (RecurData *recurData, /* FIXME: Currently we just ignore this, but maybe we should skip all elements where week_num != 0. The spec isn't clear about this. */ - week_num = (int) (elem->data); + week_num = BongoListVoidToInt(elem->data); DPRINT("week num is %d\n", week_num); elem = elem->next; @@ -3073,7 +3075,7 @@ CalObjByhourExpand (RecurData *recurData, elem = recurData->recur->byhour; while (elem) { - occ->hour = (int) (elem->data); + occ->hour = BongoListVoidToInt(elem->data); g_array_append_val(new_occs, occ); elem = elem->next; } @@ -3140,7 +3142,7 @@ CalObjByminuteExpand (RecurData *recurData, elem = recurData->recur->byminute; while (elem) { - occ->minute = (int) (elem->data); + occ->minute = BongoListVoidToInt(elem->data); g_array_append_val(new_occs, occ); elem = elem->next; } @@ -3207,7 +3209,7 @@ CalObjBysecondExpand (RecurData *recurData, elem = recurData->recur->bysecond; while (elem) { - occ->second = (int) (elem->data); + occ->second = BongoListVoidToInt(elem->data); g_array_append_val(new_occs, occ); elem = elem->next; } @@ -3688,6 +3690,8 @@ BongoCalRecurEnsureRuleEndDate (BongoCalInstance *comp, { BongoCalRecurEnsureEndDateData cbData; + UNUSED_PARAMETER_REFACTOR(exception) + /* If the rule doesn't use COUNT just return. */ if (recur->count == 0) { return FALSE; @@ -3729,6 +3733,11 @@ BongoCalRecurEnsureRuleEndDateCb (BongoCalInstance *inst, { BongoCalRecurEnsureEndDateData *cbData; + // these parameters are required by the prototype for the callback + // if we want to remove them, we need to refactor the callback + UNUSED_PARAMETER(inst) + UNUSED_PARAMETER(instanceEnd) + cbData = (BongoCalRecurEnsureEndDateData*) data; printf("GOT INSTANCE %d\n", cbData->instances); diff --git a/src/libs/cal/bongo-cal-time.c b/src/libs/cal/bongo-cal-time.c index a893852..9cab7aa 100644 --- a/src/libs/cal/bongo-cal-time.c +++ b/src/libs/cal/bongo-cal-time.c @@ -51,8 +51,8 @@ static int NumLeap(int64_t y1, int64_t y2) { return (y2/4 - y1/4) - (y2/100 - y1/100) + (y2/400 - y1/400); } -static const BongoCalTime emptyTime = { 0, 0, 0, 0, 0, 0, 0, TRUE}; -static const BongoCalDuration emptyDuration = { 0, }; +static const BongoCalTime emptyTime = { 0, 0, 0, 0, 0, 0, 0, TRUE, NULL, NULL}; +static const BongoCalDuration emptyDuration = { 0, 0, 0, 0, 0, 0}; static const unsigned int daysInMonth[12] = {31,28,31,30,31,30,31,31,30,31,30,31}; static const unsigned int daysInYear[2][14] = { @@ -662,7 +662,7 @@ BongoCalTimeGetDayOfYear(BongoCalTime t) BongoCalDuration BongoCalDurationParseIcal(const char *str) { - BongoCalDuration d = {0, }; + BongoCalDuration d = {0, 0, 0, 0, 0, 0}; int len; BOOL beginFlag = FALSE; BOOL timeFlag = FALSE; diff --git a/src/libs/cal/bongo-cal-timezone.c b/src/libs/cal/bongo-cal-timezone.c index feb5300..f5a4e41 100644 --- a/src/libs/cal/bongo-cal-timezone.c +++ b/src/libs/cal/bongo-cal-timezone.c @@ -63,7 +63,7 @@ typedef struct { int isDaylight; } TimezoneChange; -BongoCalTimezone utcTz = { BONGO_CAL_TIMEZONE_OFFSET, "UTC", 0 }; +BongoCalTimezone utcTz = { BONGO_CAL_TIMEZONE_OFFSET, "UTC", 0, NULL, NULL, NULL, 0, 0 }; static int timezonesInitialized = FALSE; static BongoHashtable *systemTimezones = NULL; @@ -165,19 +165,18 @@ BongoCalTimezoneGetSystem(const char *tzid) void BongoCalTimezoneFree(BongoCalTimezone *tz, BOOL freeJson) { - if (tz == &utcTz) { - return; - } + if (tz == &utcTz) return; - if (tz->tzid) { - MemFree(tz->tzid); - } - - if (tz->changes) { - g_array_free(tz->changes, TRUE); - } + if (tz->tzid) + MemFree(tz->tzid); - MemFree(tz); + if (tz->changes) + g_array_free(tz->changes, TRUE); + + if (freeJson) + BongoJsonObjectFree(tz->json); + + MemFree(tz); } BongoCalTime @@ -356,8 +355,9 @@ ReadChanges(BongoCalTimezone *tz) for (i = 0; i < changes->len; i++) { BongoJsonObject *jsonInst = NULL; if (BongoJsonArrayGetObject(changes, i, &jsonInst) == BONGO_JSON_OK) { - BongoCalInstance calInst = {0, }; + BongoCalInstance calInst; + memset(&calInst, 0, sizeof(BongoCalInstance)); BongoCalInstanceInit(&calInst, tz->cal, jsonInst); AddOccurrence(tz, BongoCalInstanceGetOccurrence(&calInst), TRUE); @@ -378,6 +378,8 @@ ExpandCb(BongoCalInstance *inst, { BongoCalOccurrence occ; BongoCalTimezone *tz = datap; + + UNUSED_PARAMETER_REFACTOR(instanceEnd) occ.start = BongoCalTimeNewFromUint64(instanceStart, FALSE, BongoCalTimezoneGetUtc()); occ.end = BongoCalTimeNewFromUint64(instanceStart, FALSE, BongoCalTimezoneGetUtc()); @@ -429,8 +431,9 @@ BongoCalTimezoneExpand(BongoCalTimezone *tz, BongoCalTime start, BongoCalTime en for (i = 0; i < changes->len; i++) { BongoJsonObject *jsonInst = NULL; if (BongoJsonArrayGetObject(changes, i, &jsonInst) == BONGO_JSON_OK) { - BongoCalInstance calInst = {0, }; + BongoCalInstance calInst; + memset(&calInst, 0, sizeof(BongoCalInstance)); BongoCalInstanceInit(&calInst, tz->cal, jsonInst); /* Add the original instances */ diff --git a/src/libs/cal/cal-convert.c b/src/libs/cal/cal-convert.c index faf7838..e6b584d 100644 --- a/src/libs/cal/cal-convert.c +++ b/src/libs/cal/cal-convert.c @@ -406,7 +406,9 @@ JsonParametersToIcal(BongoJsonObject *obj, icalproperty *prop) static void IcalValueToJsonString(icalproperty *prop, BongoJsonObject *obj, icalvalue_kind kind) { - BongoJsonObjectPutString(obj, "value", icalproperty_get_value_as_string(prop)); + UNUSED_PARAMETER_REFACTOR(kind) + + BongoJsonObjectPutString(obj, "value", icalproperty_get_value_as_string(prop)); } static void @@ -424,6 +426,8 @@ IcalValueToJsonText(icalproperty *prop, BongoJsonObject *obj, icalvalue_kind kin { icalvalue *value; + UNUSED_PARAMETER_REFACTOR(kind) + value = icalproperty_get_value(prop); BongoJsonObjectPutString(obj, "value", icalvalue_get_text(value)); } @@ -432,6 +436,7 @@ static void JsonValueToIcalText(BongoJsonObject *obj, icalproperty *prop, icalvalue_kind kind) { const char *val; + UNUSED_PARAMETER_REFACTOR(kind) if (BongoJsonObjectGetString(obj, "value", &val) == BONGO_JSON_OK) { icalvalue *value; @@ -444,6 +449,7 @@ JsonValueToIcalText(BongoJsonObject *obj, icalproperty *prop, icalvalue_kind kin static void IcalValueToJsonBool(icalproperty *prop, BongoJsonObject *obj, icalvalue_kind kind) { + UNUSED_PARAMETER_REFACTOR(kind) BongoJsonObjectPutBool(obj, "value", icalvalue_get_boolean(icalproperty_get_value(prop))); } @@ -451,7 +457,8 @@ static void JsonValueToIcalBool(BongoJsonObject *obj, icalproperty *prop, icalvalue_kind kind) { BOOL val; - + UNUSED_PARAMETER_REFACTOR(kind) + if (BongoJsonObjectGetBool(obj, "value", &val) == BONGO_JSON_OK) { icalproperty_set_value(prop, icalvalue_new_boolean(val)); } @@ -460,6 +467,7 @@ JsonValueToIcalBool(BongoJsonObject *obj, icalproperty *prop, icalvalue_kind kin static void IcalValueToJsonDate(icalproperty *prop, BongoJsonObject *obj, icalvalue_kind kind) { + UNUSED_PARAMETER_REFACTOR(kind) /* FIXME: treating dates as strings? */ BongoJsonObjectPutString(obj, "value", icalproperty_get_value_as_string(prop)); } @@ -468,7 +476,7 @@ static void JsonValueToIcalDate(BongoJsonObject *obj, icalproperty *prop, icalvalue_kind kind) { const char *val; - + UNUSED_PARAMETER_REFACTOR(kind) /* FIXME: treating dates as strings? */ if (BongoJsonObjectGetString(obj, "value", &val) == BONGO_JSON_OK) { @@ -479,6 +487,7 @@ JsonValueToIcalDate(BongoJsonObject *obj, icalproperty *prop, icalvalue_kind kin static void IcalValueToJsonDateTime(icalproperty *prop, BongoJsonObject *obj, icalvalue_kind kind) { + UNUSED_PARAMETER_REFACTOR(kind) /* FIXME: treating datetimes as strings? */ BongoJsonObjectPutString(obj, "value", icalproperty_get_value_as_string(prop)); } @@ -487,7 +496,8 @@ static void JsonValueToIcalDateTime(BongoJsonObject *obj, icalproperty *prop, icalvalue_kind kind) { const char *val; - + UNUSED_PARAMETER_REFACTOR(kind) + /* FIXME: treating dates as strings? */ if (BongoJsonObjectGetString(obj, "value", &val) == BONGO_JSON_OK) { @@ -498,6 +508,7 @@ JsonValueToIcalDateTime(BongoJsonObject *obj, icalproperty *prop, icalvalue_kind static void IcalValueToJsonDuration(icalproperty *prop, BongoJsonObject *obj, icalvalue_kind kind) { + UNUSED_PARAMETER_REFACTOR(kind) /* FIXME: treating dates as strings? */ BongoJsonObjectPutString(obj, "value", icalproperty_get_value_as_string(prop)); } @@ -506,7 +517,8 @@ static void JsonValueToIcalDuration(BongoJsonObject *obj, icalproperty *prop, icalvalue_kind kind) { const char *val; - + UNUSED_PARAMETER_REFACTOR(kind) + /* FIXME: treating dates as strings? */ if (BongoJsonObjectGetString(obj, "value", &val) == BONGO_JSON_OK) { @@ -517,6 +529,7 @@ JsonValueToIcalDuration(BongoJsonObject *obj, icalproperty *prop, icalvalue_kind static void IcalValueToJsonFloat(icalproperty *prop, BongoJsonObject *obj, icalvalue_kind kind) { + UNUSED_PARAMETER_REFACTOR(kind) BongoJsonObjectPutDouble(obj, "value", icalvalue_get_float(icalproperty_get_value(prop))); } @@ -524,7 +537,8 @@ static void JsonValueToIcalFloat(BongoJsonObject *obj, icalproperty *prop, icalvalue_kind kind) { double val; - + UNUSED_PARAMETER_REFACTOR(kind) + /* FIXME: treating dates as strings? */ if (BongoJsonObjectGetDouble(obj, "value", &val) == BONGO_JSON_OK) { @@ -535,6 +549,7 @@ JsonValueToIcalFloat(BongoJsonObject *obj, icalproperty *prop, icalvalue_kind ki static void IcalValueToJsonInt(icalproperty *prop, BongoJsonObject *obj, icalvalue_kind kind) { + UNUSED_PARAMETER_REFACTOR(kind) BongoJsonObjectPutInt(obj, "value", icalvalue_get_integer(icalproperty_get_value(prop))); } @@ -542,7 +557,8 @@ static void JsonValueToIcalInt(BongoJsonObject *obj, icalproperty *prop, icalvalue_kind kind) { int val; - + UNUSED_PARAMETER_REFACTOR(kind) + /* FIXME: treating dates as strings? */ if (BongoJsonObjectGetInt(obj, "value", &val) == BONGO_JSON_OK) { @@ -556,6 +572,8 @@ IcalValueToJsonPeriod(icalproperty *prop, BongoJsonObject *obj, icalvalue_kind k struct icalperiodtype period; BongoJsonObject *value; + UNUSED_PARAMETER_REFACTOR(kind) + value = BongoJsonObjectNew(); period = icalvalue_get_period(icalproperty_get_value(prop)); @@ -578,6 +596,8 @@ JsonValueToIcalPeriod(BongoJsonObject *obj, icalproperty *prop, icalvalue_kind k struct icalperiodtype period; BongoJsonObject *jsonValue; + UNUSED_PARAMETER_REFACTOR(kind) + if (BongoJsonObjectGetObject(obj, "value", &jsonValue) != BONGO_JSON_OK) { return; } @@ -818,7 +838,7 @@ IcalRecurArgToJson(BongoJsonObject *obj, char *key, char *value) if (prop) { prop->toJson(prop->jsonKey, value, obj); } else { -#warning X- bits not implemented + // FIXME X- bits not implemented } } static void @@ -830,6 +850,8 @@ IcalValueToJsonRecur(icalproperty *prop, BongoJsonObject *obj, icalvalue_kind ki char *p2; BongoJsonObject *jsonValue; + UNUSED_PARAMETER_REFACTOR(kind) + jsonValue = BongoJsonObjectNew(); propval = MemStrdup(icalproperty_get_value_as_string(prop)); @@ -875,6 +897,8 @@ JsonValueToIcalRecur(BongoJsonObject *obj, icalproperty *prop, icalvalue_kind ki BOOL first = TRUE; BongoJsonObject *jsonValue; + UNUSED_PARAMETER_REFACTOR(kind) + if (BongoJsonObjectGetObject(obj, "value", &jsonValue) != BONGO_JSON_OK) { return; } @@ -897,7 +921,7 @@ JsonValueToIcalRecur(BongoJsonObject *obj, icalproperty *prop, icalvalue_kind ki first = FALSE; } } else { -#warning X- bits not implemented + // FIXME X- bits not implemented } } @@ -909,6 +933,8 @@ JsonValueToIcalRecur(BongoJsonObject *obj, icalproperty *prop, icalvalue_kind ki static void IcalValueToJsonTime(icalproperty *prop, BongoJsonObject *obj, icalvalue_kind kind) { + UNUSED_PARAMETER_REFACTOR(kind) + /* FIXME: treating times as strings? */ BongoJsonObjectPutString(obj, "value", icalproperty_get_value_as_string(prop)); @@ -919,6 +945,8 @@ JsonValueToIcalTime(BongoJsonObject *obj, icalproperty *prop, icalvalue_kind kin { const char *val; + UNUSED_PARAMETER_REFACTOR(kind) + /* FIXME: treating times as strings? */ if (BongoJsonObjectGetString(obj, "value", &val) == BONGO_JSON_OK) { icalproperty_set_value_from_string(prop, val, "TIME"); @@ -929,6 +957,8 @@ JsonValueToIcalTime(BongoJsonObject *obj, icalproperty *prop, icalvalue_kind kin static void IcalValueToJsonGeo(icalproperty *prop, BongoJsonObject *obj, icalvalue_kind kind) { + UNUSED_PARAMETER_REFACTOR(kind) + /* FIXME: treating geos as strings? */ BongoJsonObjectPutString(obj, "value", icalproperty_get_value_as_string(prop)); } @@ -938,6 +968,8 @@ JsonValueToIcalGeo(BongoJsonObject *obj, icalproperty *prop, icalvalue_kind kind { const char *val; + UNUSED_PARAMETER_REFACTOR(kind) + /* FIXME: treating geos as strings? */ if (BongoJsonObjectGetString(obj, "value", &val) == BONGO_JSON_OK) { icalproperty_set_value_from_string(prop, val, "GEO"); @@ -1246,6 +1278,8 @@ JsonComponentToIcalWithType(ComponentType *componentType, BongoJsonObject *obj, icalcomponent *comp; BongoJsonObjectIter iter; + UNUSED_PARAMETER(parent) + comp = icalcomponent_new(componentType->icalKind); for (BongoJsonObjectIterFirst(obj, &iter);