From 5691fb98dfca41d441feb61002d34ef2788e7a13 Mon Sep 17 00:00:00 2001 From: Jeesun Kim Date: Mon, 1 Apr 2013 16:14:42 +0900 Subject: [PATCH] [misc] fixed freq update bug --- native/cal_db_plugin_event.c | 21 ++++++--------------- native/cal_db_rrule.c | 5 +---- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/native/cal_db_plugin_event.c b/native/cal_db_plugin_event.c index 7197746..26064d6 100644 --- a/native/cal_db_plugin_event.c +++ b/native/cal_db_plugin_event.c @@ -781,11 +781,8 @@ static int __cal_db_event_update_record(calendar_record_h record) __cal_db_event_update_original_event_version(event->original_event_id, input_ver); _cal_db_rrule_get_rrule_from_event(record, &rrule); - if (rrule) - { - _cal_db_rrule_update_record(event->index, rrule); - CAL_FREE(rrule); - } + _cal_db_rrule_update_record(event->index, rrule); // if rrule turns none, update 0. + CAL_FREE(rrule); ret = _cal_db_instance_discard_record(record); retvm_if(ret != CALENDAR_ERROR_NONE, CALENDAR_ERROR_DB_FAILED, @@ -1761,11 +1758,8 @@ static int __cal_db_event_replace_record(calendar_record_h record, int id) __cal_db_event_update_original_event_version(event->original_event_id, input_ver); _cal_db_rrule_get_rrule_from_event(record, &rrule); - if (rrule) - { - _cal_db_rrule_update_record(id, rrule); - CAL_FREE(rrule); - } + _cal_db_rrule_update_record(id, rrule); + CAL_FREE(rrule); ret = _cal_db_instance_discard_record(record); retvm_if(ret != CALENDAR_ERROR_NONE, CALENDAR_ERROR_DB_FAILED, @@ -2642,11 +2636,8 @@ static int __cal_db_event_update_dirty(calendar_record_h record) cal_rrule_s *rrule = NULL; _cal_db_rrule_get_rrule_from_event(record, &rrule); - if (rrule) - { - _cal_db_rrule_update_record(event->index, rrule); - CAL_FREE(rrule); - } + _cal_db_rrule_update_record(event->index, rrule); + CAL_FREE(rrule); ret = _cal_db_instance_discard_record(record); retvm_if(ret != CALENDAR_ERROR_NONE, CALENDAR_ERROR_DB_FAILED, diff --git a/native/cal_db_rrule.c b/native/cal_db_rrule.c index 5fe2996..a42d448 100644 --- a/native/cal_db_rrule.c +++ b/native/cal_db_rrule.c @@ -601,10 +601,7 @@ int _cal_db_rrule_update_record(int id, cal_rrule_s *rrule) { int has_record = 0; - retvm_if(rrule == NULL, CALENDAR_ERROR_INVALID_PARAMETER, - "Invalid argument: rrule is NULL"); - - if (rrule->freq == CALENDAR_RECURRENCE_NONE) + if (NULL == rrule || rrule->freq == CALENDAR_RECURRENCE_NONE) { DBG("freq is NONE"); __cal_db_rrule_delete_record(id); -- 2.7.4