Name: calendar-service2
Description: calendar-service2 library
Version: 0.1.8
-Requires: glib-2.0 alarm-service bundle
+Requires: glib-2.0 alarm-service
Libs: -L${libdir} -lcalendar-service2
Cflags: -I${includedir}
static void __cal_client_reminder_subscribe_callback(pims_ipc_h ipc, pims_ipc_data_h data, void *user_data)
{
unsigned int size = 0;
- const unsigned char *str = NULL;
+ const char *str = NULL;
int len = 0;
subscribe_info_s *info = user_data;
ERR("pims_ipc_data_get() failed");
return;
}
- str = (const unsigned char *)pims_ipc_data_get(data, &size);
+ str = (const char *)pims_ipc_data_get(data, &size);
if (!str)
{
ERR("pims_ipc_data_get() failed");
callback_info_s *cb_info = l->data;
if (NULL == cb_info) continue;
- bundle *b = NULL;
- b = bundle_decode(str, len);
- if (b)
- {
- cb_info->cb(b, cb_info->user_data);
- bundle_free(b);
- }
+ cb_info->cb(str, cb_info->user_data);
}
}
}
#define __CAL_CLIENT_REMINDER_H__
int _cal_client_reminder_create_for_subscribe(void);
+int _cal_client_reminder_destroy_for_subscribe(void);
#endif // __CAL_CLIENT_REMINDER_H__
Name: calendar-service2
Description: calendar-service2 library
-Version: 0.1.13
+Version: 0.1.14
Requires: glib-2.0 alarm-service
Libs: -L${libdir} -lcalendar-service2
Cflags: -I${includedir}
switch (field)
{
+ case CAL_MONTH:
+ vali = ucal_get(ucal, UCAL_MONTH, &status) + 1;
+ snprintf(buf, sizeof(buf), "%d", vali);
+ break;
+
case CAL_DATE:
vali = ucal_get(ucal, UCAL_DATE, &status);
snprintf(buf, sizeof(buf), "%d", vali);
long long int _cal_time_convert_itol(const char *tzid, int y, int mon, int d, int h, int min, int s)
{
long long int lli;
- UCalendar *ucal;
+ UCalendar *ucal = NULL;
UErrorCode status = U_ZERO_ERROR;
ucal = _cal_time_get_ucal(tzid, -1);
ucal_set(ucal, UCAL_HOUR_OF_DAY, h);
ucal_set(ucal, UCAL_MINUTE, min);
ucal_set(ucal, UCAL_SECOND, s);
+ ucal_set(ucal, UCAL_MILLISECOND, 0);
lli = ms2sec(ucal_getMillis(ucal, &status));
ucal_close(ucal);
int _cal_time_get_like_tzid(const char *tzid, calendar_record_h timezone, char **like_tzid);
enum cal_extract_field {
+ CAL_MONTH,
CAL_DAY_OF_WEEK,
CAL_DATE,
};
return CALENDAR_ERROR_NONE;
}
-static inline int __cal_vcalendar_make_dtstart(cal_make_s *b, char *tzid, calendar_time_s *caltime)
+static inline int __cal_vcalendar_make_dtstart(int version, cal_make_s *b, char *tzid, calendar_time_s *caltime)
{
retvm_if(caltime == NULL, -1, "Invalid argument: calendar_time_s is NULL");
case CALENDAR_TIME_UTIME:
{
char* str_time = NULL;
- if (NULL != tzid && strlen(tzid) > 0)
+ if (version != 1 && NULL != tzid && strlen(tzid) > 0)
{
str_time = _cal_time_convert_ltos(tzid, caltime->time.utime);
if (str_time)
break;
case CALENDAR_TIME_LOCALTIME:
- __cal_vcalendar_make_printf(b, "DTSTART;VALUE=DATE:",
- __cal_vcalendar_make_itos(caltime->time.date.year,
- caltime->time.date.month, caltime->time.date.mday));
+ if (version == 1)
+ {
+ char buf[16] = {0};
+ snprintf(buf, sizeof(buf), "%04d%02d%02dT000000",
+ caltime->time.date.year, caltime->time.date.month, caltime->time.date.mday);
+ __cal_vcalendar_make_printf(b, "DTSTART:", buf);
+
+ }
+ else
+ {
+ __cal_vcalendar_make_printf(b, "DTSTART;VALUE=DATE:",
+ __cal_vcalendar_make_itos(caltime->time.date.year,
+ caltime->time.date.month, caltime->time.date.mday));
+ }
break;
}
return CALENDAR_ERROR_NONE;
}
-static inline int __cal_vcalendar_make_dtend(cal_make_s *b, char *tzid, calendar_time_s *caltime)
+static inline int __cal_vcalendar_make_dtend(int version, cal_make_s *b, char *tzid, calendar_time_s *caltime)
{
retvm_if(caltime == NULL, -1, "Invalid argument: calendar_time_s is NULL");
case CALENDAR_TIME_UTIME:
{
char* str_time = NULL;
- if (NULL != tzid && strlen(tzid) > 0)
+ if (version != 1 && NULL != tzid && strlen(tzid) > 0)
{
str_time = _cal_time_convert_ltos(tzid, caltime->time.utime);
if (str_time)
break;
case CALENDAR_TIME_LOCALTIME:
- __cal_vcalendar_make_printf(b, "DTEND;VALUE=DATE:",
- __cal_vcalendar_make_itos(caltime->time.date.year,
- caltime->time.date.month, caltime->time.date.mday));
+ if (version == 1)
+ {
+ char buf[16] = {0};
+ snprintf(buf, sizeof(buf), "%04d%02d%02dT000000",
+ caltime->time.date.year, caltime->time.date.month, caltime->time.date.mday);
+ __cal_vcalendar_make_printf(b, "DTEND:", buf);
+
+ }
+ else
+ {
+ __cal_vcalendar_make_printf(b, "DTEND;VALUE=DATE:",
+ __cal_vcalendar_make_itos(caltime->time.date.year,
+ caltime->time.date.month, caltime->time.date.mday));
+ }
break;
}
return CALENDAR_ERROR_NONE;
}
-static inline int __cal_vcalendar_make_due(cal_make_s *b, char *tzid, calendar_time_s *caltime)
+static inline int __cal_vcalendar_make_due(int version, cal_make_s *b, char *tzid, calendar_time_s *caltime)
{
retvm_if(caltime == NULL, -1, "Invalid argument: calendar_time_s is NULL");
case CALENDAR_TIME_UTIME:
{
char* str_time = NULL;
- if (NULL != tzid && strlen(tzid) > 0)
+ if (version != 1 && NULL != tzid && strlen(tzid) > 0)
{
str_time = _cal_time_convert_ltos(tzid, caltime->time.utime);
if (str_time)
break;
case CALENDAR_TIME_LOCALTIME:
- __cal_vcalendar_make_printf(b, "DUE:",
- __cal_vcalendar_make_itos(caltime->time.date.year,
- caltime->time.date.month, caltime->time.date.mday));
+ if (version == 1)
+ {
+ char buf[16] = {0};
+ snprintf(buf, sizeof(buf), "%04d%02d%02dT000000",
+ caltime->time.date.year, caltime->time.date.month, caltime->time.date.mday);
+ __cal_vcalendar_make_printf(b, "DUE:", buf);
+
+ }
+ else
+ {
+ __cal_vcalendar_make_printf(b, "DUE:",
+ __cal_vcalendar_make_itos(caltime->time.date.year,
+ caltime->time.date.month, caltime->time.date.mday));
+ }
break;
}
ERR("Failed to get start_time(%d)", ret);
return -1;
}
- ret = __cal_vcalendar_make_dtstart(b, tzid, &caltime);
+ ret = __cal_vcalendar_make_dtstart(version, b, tzid, &caltime);
retvm_if(ret != CALENDAR_ERROR_NONE, -1, "Failed to get dtstart(%d)", ret);
retvm_if(ret != CALENDAR_ERROR_NONE, -1,
"Failed to get end_time(%d)", ret);
- ret = __cal_vcalendar_make_dtend(b, tzid, &caltime);
+ ret = __cal_vcalendar_make_dtend(version, b, tzid, &caltime);
retvm_if(ret != CALENDAR_ERROR_NONE, -1, "Failed to get end(%d)", ret);
// categories
ERR("Failed to get start_time(%d)", ret);
return -1;
}
- ret = __cal_vcalendar_make_dtstart(b, tzid, &caltime);
+ ret = __cal_vcalendar_make_dtstart(version, b, tzid, &caltime);
retvm_if(ret != CALENDAR_ERROR_NONE, -1,
"Failed to get dtstart(%d)", ret);
retvm_if(ret != CALENDAR_ERROR_NONE, -1,
"Failed to get due_time(%d)", ret);
- ret = __cal_vcalendar_make_due(b, tzid, &caltime);
+ ret = __cal_vcalendar_make_due(version, b, tzid, &caltime);
retvm_if(ret != CALENDAR_ERROR_NONE, -1, "__cal_vcalendar_make_due() failed(%d)", ret);
// categories
static int __cal_vcalendar_parse_get_tzid_from_list(calendar_list_h list, const char *tzid, calendar_record_h *timezone)
{
GList *l = NULL;
- int ret = 0;
if (list == NULL || tzid == NULL)
{
char *uri = NULL;
calendar_record_h record = (calendar_record_h)l->data;
calendar_record_get_uri_p(record, &uri);
- if (CALENDAR_ERROR_NONE == ret)
+ if (strncmp(uri, _calendar_timezone._uri, strlen(_calendar_timezone._uri)))
{
- if (strncmp(uri, _calendar_timezone._uri, strlen(_calendar_timezone._uri)))
- {
- l = g_list_next(l);
- continue;
- }
+ l = g_list_next(l);
+ continue;
+ }
- cal_timezone_s *tz = (cal_timezone_s *)record;
- if (!strncmp(tz->standard_name, tzid, strlen(tzid)))
- {
- DBG("Found same tzid[%s] in the list", tzid);
- *timezone = record;
- break;
- }
+ cal_timezone_s *tz = (cal_timezone_s *)record;
+ if (!strncmp(tz->standard_name, tzid, strlen(tzid)))
+ {
+ DBG("Found same tzid[%s] in the list", tzid);
+ *timezone = record;
+ break;
}
+
l = g_list_next(l);
}
/**
* @ingroup CAPI_SOCIAL_CALENDAR_SVC_MODULE
- * @defgroup CAPI_SOCIAL_CALENDAR_SVC_RECORD_MODULE Record
+ * @defgroup CAPI_SOCIAL_CALENDAR_SVC_FILTER_MODULE Filter
*
- * @brief The calendar record API provides the set of the definitions and interfaces that enable you to get/set data from/to calendar record handle.
+ * @brief The calendar database API provides the set of the definitions and interfaces that enable you to handle filter.
*
- * @section CAPI_SOCIAL_CALENDAR_SVC_RECORD_MODULE_HEADER Required Header
+ * @section CAPI_SOCIAL_CALENDAR_SVC_FILTER_MODULE_HEADER Required Header
* \#include <calendar2.h>
*
* <BR>
/**
* @ingroup CAPI_SOCIAL_CALENDAR_SVC_MODULE
- * @defgroup CAPI_SOCIAL_CALENDAR_SVC_FILTER_MODULE Filter
+ * @defgroup CAPI_SOCIAL_CALENDAR_SVC_QUERY_MODULE Query
*
- * @brief The calendar database API provides the set of the definitions and interfaces that enable you to handle filter.
+ * @brief The calendar database API provides the set of the definitions and interfaces that enable you to handle query.
*
- * @section CAPI_SOCIAL_CALENDAR_SVC_FILTER_MODULE_HEADER Required Header
+ * @section CAPI_SOCIAL_CALENDAR_SVC_QUERY_MODULE_HEADER Required Header
* \#include <calendar2.h>
*
* <BR>
/**
* @ingroup CAPI_SOCIAL_CALENDAR_SVC_MODULE
- * @defgroup CAPI_SOCIAL_CALENDAR_SVC_QUERY_MODULE Query
+ * @defgroup CAPI_SOCIAL_CALENDAR_SVC_RECORD_MODULE Record
*
- * @brief The calendar database API provides the set of the definitions and interfaces that enable you to handle query.
+ * @brief The calendar record API provides the set of the definitions and interfaces that enable you to get/set data from/to calendar record handle.
*
- * @section CAPI_SOCIAL_CALENDAR_SVC_QUERY_MODULE_HEADER Required Header
+ * @section CAPI_SOCIAL_CALENDAR_SVC_RECORD_MODULE_HEADER Required Header
+ * \#include <calendar2.h>
+ *
+ * <BR>
+ */
+
+/**
+ * @ingroup CAPI_SOCIAL_CALENDAR_SVC_MODULE
+ * @defgroup CAPI_SOCIAL_CALENDAR_SVC_REMINDER_MODULE Reminder
+ *
+ * @brief The calendar record API provides the set of the definitions and interfaces that enable you to get/set reminder.
+ *
+ * @section CAPI_SOCIAL_CALENDAR_SVC_REMINDER_MODULE_HEADER Required Header
* \#include <calendar2.h>
*
* <BR>
#include <stdint.h>
#include <tizen.h>
#include <calendar_errors.h>
-#include <bundle.h>
#ifdef __cplusplus
extern "C" {
/**
* @brief Called when alarm is alerted.
*
- * @param[in] b bundle
+ * @param[in] consta char *param
* @param[in] user_data The user data passed from the callback registration function
*
* @see calendar_db_add_changed_cb()
*/
-typedef void (*calendar_reminder_cb)(bundle *b, void* user_data);
+typedef void (*calendar_reminder_cb)(const char *param, void* user_data);
/**
* @brief Definition for calendar connect flag
{
__cal_db_instance_publish_with_wday(ucal, event, duration, UCAL_YEAR, until);
}
- else if (event->bymonthday && strlen(event->bymonthday) > 0)
- {
- __cal_db_instance_publish_with_mday(ucal, event, duration, UCAL_YEAR, until);
- }
else
{
- ERR("Not completed");
+ __cal_db_instance_publish_with_mday(ucal, event, duration, UCAL_YEAR, until);
}
}
event->freq = CALENDAR_RECURRENCE_NONE;
}
+ DBG("event interval(%d)", event->interval);
+ if (event->interval < 1)
+ {
+ DBG("Invalid interval, so set 1");
+ event->interval = 1;
+ }
switch (event->range_type)
{
return CALENDAR_ERROR_INVALID_PARAMETER;
}
- long long int slli = 0;
- long long int elli = 0;
switch (event->start.type)
{
case CALENDAR_TIME_UTIME:
}
// check start > end
- slli = _cal_time_convert_itol(NULL, event->start.time.date.year,
- event->start.time.date.month, event->start.time.date.mday, 0, 0, 0);
- elli = _cal_time_convert_itol(NULL, event->end.time.date.year,
- event->end.time.date.month, event->end.time.date.mday, 0, 0, 0);
-
- if (slli > elli)
+ if (event->start.time.date.year > event->end.time.date.year)
{
- ERR("allday start(%lld) > end(%lld)", slli, elli);
+ ERR("allday start year(%d) > end year(%d)",
+ event->start.time.date.year > event->end.time.date.year);
return CALENDAR_ERROR_INVALID_PARAMETER;
}
+ else
+ {
+ if (event->start.time.date.month > event->end.time.date.month)
+ {
+ ERR("allday start month(%d) > end month(%d)",
+ event->start.time.date.month, event->end.time.date.month);
+ return CALENDAR_ERROR_INVALID_PARAMETER;
+ }
+ else
+ {
+ if (event->start.time.date.mday > event->end.time.date.mday)
+ {
+ ERR("allday start day(%d) > end day(%d)",
+ event->start.time.date.mday, event->end.time.date.mday);
+ return CALENDAR_ERROR_INVALID_PARAMETER;
+ }
+ }
+ }
break;
}
_cal_db_rrule_set_default(record);
_cal_db_rrule_get_rrule_from_event(record, &rrule);
- _cal_db_rrule_insert_record(event_id, rrule);
+ if (rrule)
+ {
+ _cal_db_rrule_insert_record(event_id, rrule);
+ CAL_FREE(rrule);
+ }
_cal_db_instance_publish_record(record);
calendar_list_h list;
DBG("No extended");
}
- CAL_FREE(rrule);
_cal_db_util_notify(CAL_NOTI_TYPE_EVENT);
_cal_record_set_int(record, _calendar_event.id, tmp);
__cal_db_event_update_original_event_version(event->original_event_id, input_ver);
_cal_db_rrule_get_rrule_from_event(record, &rrule);
- _cal_db_rrule_update_record(event->index, rrule);
- CAL_FREE(rrule);
+ if (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,
// add recurrence id to end of the exdate of original event.
const unsigned char *temp;
+ int len = 0;
char *exdate = NULL;
if (CAL_DB_ROW == _cal_db_util_stmt_step(stmt))
{
- temp = sqlite3_column_text(stmt, 1);
+ temp = sqlite3_column_text(stmt, 0);
if (NULL == temp)
{
exdate = strdup(event->recurrence_id);
sqlite3_finalize(stmt);
return CALENDAR_ERROR_NONE;
}
- exdate = strdup((char *)temp);
- strcat(exdate, event->recurrence_id);
+ len = strlen((const char *)temp) + strlen(event->recurrence_id) + 2;
+ exdate = calloc(len, sizeof(char));
+ if (NULL == exdate)
+ {
+ ERR("calloc() failed");
+ sqlite3_finalize(stmt);
+ return CALENDAR_ERROR_DB_FAILED;
+ }
+ snprintf(exdate, len, "%s,%s", temp, event->recurrence_id);
}
}
else
sqlite3_finalize(stmt);
if (CAL_DB_DONE != dbret) {
ERR("sqlite3_step() Failed(%d)", dbret);
+ if (exdate) free(exdate);
switch (dbret)
{
case CAL_DB_ERROR_NO_SPACE:
return CALENDAR_ERROR_DB_FAILED;
}
}
+ if (exdate) free(exdate);
+
return CALENDAR_ERROR_NONE;
}
__cal_db_event_update_original_event_version(event->original_event_id, input_ver);
_cal_db_rrule_get_rrule_from_event(record, &rrule);
- _cal_db_rrule_update_record(id, rrule);
- CAL_FREE(rrule);
+ if (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,
cal_rrule_s *rrule = NULL;
_cal_db_rrule_get_rrule_from_event(record, &rrule);
- _cal_db_rrule_update_record(event->index, rrule);
- CAL_FREE(rrule);
+ if (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,
#include "cal_view.h"
#include "cal_time.h"
-void _cal_db_rrule_set_default(calendar_record_h event)
+void _cal_db_rrule_set_default(calendar_record_h record)
{
- cal_event_s *_event = NULL;
- retm_if(event == NULL, "Invalid argument: rrule is NULL");
+ cal_event_s *event = NULL;
+ retm_if(record == NULL, "Invalid argument: rrule is NULL");
- _event = (cal_event_s *)event;
+ event = (cal_event_s *)record;
- switch (_event->freq)
+ switch (event->freq)
{
case CALENDAR_RECURRENCE_NONE:
break;
case CALENDAR_RECURRENCE_DAILY:
break;
case CALENDAR_RECURRENCE_WEEKLY:
- if (_event->bymonthday || _event->byday)
+ if (event->bymonthday || event->byday)
break;
- _event->byday = _cal_time_extract_by(_event->start_tzid,
- _event->wkst, &_event->start, CAL_DAY_OF_WEEK);
- DBG("No byday so set default[%s]", _event->byday);
+ event->byday = _cal_time_extract_by(event->start_tzid, event->wkst,
+ &event->start, CAL_DAY_OF_WEEK);
+ DBG("Not enough field in weekly, so set byda[%s]", event->byday);
break;
case CALENDAR_RECURRENCE_MONTHLY:
- if (_event->bymonthday || _event->byday)
+ if (event->bymonthday || event->byday)
break;
- _event->bymonthday = _cal_time_extract_by(_event->start_tzid,
- _event->wkst, &_event->start, CAL_DATE);
- DBG("No bymonthday so set default[%s]", _event->bymonthday);
+ event->bymonthday = _cal_time_extract_by(event->start_tzid, event->wkst,
+ &event->start, CAL_DATE);
+ DBG("Not enough field in monthly, so set bymonthday[%s]", event->bymonthday);
break;
case CALENDAR_RECURRENCE_YEARLY:
+ if (event->bymonth && (event->bymonthday || event->byday))
+ break;
+ else if (event->byyearday || event->byweekno)
+ break;
+
+ event->bymonth = _cal_time_extract_by(event->start_tzid, event->wkst,
+ &event->start, CAL_MONTH);
+ event->bymonthday = _cal_time_extract_by(event->start_tzid, event->wkst,
+ &event->start, CAL_DATE);
+ DBG("Not enough field in yearly, so set bymonth[%s] bymonthday[%s]",
+ event->bymonth, event->bymonthday);
break;
+
default:
break;
}
cal_event_s *_event;
retm_if(event == NULL, "Invalid argument: rrule is NULL");
-
_event = (cal_event_s *)event;
+ if (_event->freq == CALENDAR_RECURRENCE_NONE)
+ {
+ return;
+ }
_rrule = calloc(1, sizeof(cal_rrule_s));
retm_if(_rrule == NULL, "Failed to calloc");
*rrule = _rrule;
}
-int _cal_db_rrule_insert_record(int id, cal_rrule_s *rrule)
+int __cal_db_rrule_insert_record(int id, cal_rrule_s *rrule)
{
int rrule_id;
int index;
return CALENDAR_ERROR_NONE;
}
+int _cal_db_rrule_insert_record(int id, cal_rrule_s *rrule)
+{
+ retvm_if(rrule == NULL, CALENDAR_ERROR_INVALID_PARAMETER,
+ "Invalid argument: rrule is NULL");
+
+ if (rrule->freq == CALENDAR_RECURRENCE_NONE)
+ {
+ }
+ else
+ {
+ __cal_db_rrule_insert_record(id, rrule);
+ }
+ return CALENDAR_ERROR_NONE;
+}
+
int _cal_db_rrule_update_record(int id, cal_rrule_s *rrule)
{
int has_record = 0;
}
else
{
- _cal_db_rrule_insert_record(id, rrule);
+ __cal_db_rrule_insert_record(id, rrule);
}
}
return CALENDAR_ERROR_NONE;
Name: calendar-service
Summary: DB library for calendar
Version: 0.1.14
-Release: 84
+Release: 86
Group: System/Libraries
License: Apache 2.0
Source0: %{name}-%{version}.tar.gz
#include <stdlib.h>
-#include <bundle.h>
#include <pims-ipc-svc.h>
#include "calendar2.h"
#define CAL_SUBSCRIBE_MAX_LEN 1024
-static __thread unsigned char *__reminder_changed_info = NULL;
-static __thread bundle *__b = NULL;
-static __thread int __bundle_len = 0;
+static __thread char *__data = NULL;
+static __thread int __len_data = 0;
static gboolean __cal_server_reminder_publish_changes_with_data(unsigned char *data, int len)
{
void __cal_server_reminder_clear_changed_info(void)
{
- if (__reminder_changed_info)
+ if (__data)
{
- bundle_free_encoded_rawdata(&__reminder_changed_info);
- __reminder_changed_info = NULL;
- __bundle_len = 0;
+ free(__data);
+ __data = NULL;
+ __len_data = 0;
}
}
void _cal_server_reminder_publish(void)
{
- if (__b)
+ if (__data)
{
- bundle_encode(__b, &__reminder_changed_info, &__bundle_len);
- __cal_server_reminder_publish_changes_with_data(__reminder_changed_info, __bundle_len);
+ __cal_server_reminder_publish_changes_with_data((unsigned char *)__data, __len_data);
__cal_server_reminder_clear_changed_info();
}
}
-void _cal_server_reminder_add_callback_data(char *key, char *value)
+int _cal_server_reminder_add_callback_data(char *key, char *value)
{
- if (NULL == __b)
+ int len_data = 0;
+ int len_key = 0;
+ int len_value = 0;
+
+ if (NULL == key || NULL == value)
{
- __b = bundle_create();
+ ERR("Invalid parameter");
+ return CALENDAR_ERROR_INVALID_PARAMETER;
}
- bundle_add(__b, key, value);
+
+ len_key = strlen(key);
+ len_value = strlen(value);
+ DBG("key[%s]value[%s]", key, value);
+ if (NULL == __data)
+ {
+ __len_data = len_key + len_value + 2;
+ __data = calloc(__len_data, sizeof(char));
+ if (NULL == __data)
+ {
+ ERR("calloc() failed");
+ return CALENDAR_ERROR_DB_FAILED;
+ }
+ snprintf(__data, __len_data, "%s=%s", key, value);
+ }
+ else
+ {
+ char *p = NULL;
+ len_data = strlen(__data);
+
+ __len_data = len_data + len_key + len_value + 3;
+ p = calloc(__len_data, sizeof(char));
+ if (NULL == __data)
+ {
+ ERR("recalloc() failed");
+ return CALENDAR_ERROR_DB_FAILED;
+ }
+ snprintf(p, __len_data, "%s&%s=%s", __data, key, value);
+ free(__data);
+ __data = p;
+
+ }
+
+ DBG("data[%s]len(%d)", __data, __len_data);
+ return CALENDAR_ERROR_NONE;
}