applied define statement instead of number 03/46903/1
authorJeesun Kim <iamjs.kim@samsung.com>
Tue, 19 May 2015 10:53:15 +0000 (19:53 +0900)
committerJeesun Kim <iamjs.kim@samsung.com>
Thu, 27 Aug 2015 05:43:26 +0000 (14:43 +0900)
Change-Id: I8b5004fd340fcb2b059f83ab4f409d09bc7f8777

28 files changed:
common/cal_time.cpp
common/cal_typedef.h
common/cal_vcalendar.c
common/cal_vcalendar_make.c
common/cal_vcalendar_parse.c
common/cal_zone.c
native/cal_db_alarm.c
native/cal_db_event.c
native/cal_db_instance.c
native/cal_db_plugin_alarm.c
native/cal_db_plugin_attendee.c
native/cal_db_plugin_calendar.c
native/cal_db_plugin_event.c
native/cal_db_plugin_extended.c
native/cal_db_plugin_instance_allday.c
native/cal_db_plugin_instance_allday_extended.c
native/cal_db_plugin_instance_normal.c
native/cal_db_plugin_instance_normal_extended.c
native/cal_db_plugin_search.c
native/cal_db_plugin_timezone.c
native/cal_db_plugin_todo.c
native/cal_db_query.c
native/cal_db_rrule.c
server/cal_server_alarm.c
server/cal_server_reminder.c
server/cal_server_reminder.h
server/cal_server_update.c
server/cal_server_zone.c

index e3c8265..210c45f 100644 (file)
@@ -63,7 +63,7 @@ int cal_time_is_registered_tzid(const char *tzid)
        int32_t s_count = s->count(ec);
 
        for (i = 0; i < s_count; i++) {
-               char buf[128] = {0};
+               char buf[CAL_STR_MIDDLE_LEN] = {0};
                const UnicodeString *unicode_tzid = s->snext(ec);
                unicode_tzid->extract(buf, sizeof(buf), NULL, ec);
                if (CAL_STRING_EQUAL == strncmp(tzid, buf, strlen(buf))) {
@@ -219,7 +219,7 @@ static int _cal_time_get_like_utzid(UChar *utzid, int len, const char *tzid, cal
        gmtoffset = sec2ms(tz->tz_offset_from_gmt * 60);
 
        if (tz->day_light_bias == 0) {
-               char buf[128] = {0};
+               char buf[CAL_STR_MIDDLE_LEN] = {0};
                snprintf(buf, sizeof(buf), "Etc/GMT%c%d",
                                gmtoffset < 0 ? '+' : '-',
                                tz->tz_offset_from_gmt / 60);
@@ -323,7 +323,7 @@ static int _cal_time_get_like_utzid(UChar *utzid, int len, const char *tzid, cal
 
 UCalendar *cal_time_open_ucal(int calendar_system_type, const char *tzid, int wkst)
 {
-       UChar utf16_timezone[64] = {0};
+       UChar utf16_timezone[CAL_STR_SHORT_LEN64] = {0};
        u_uastrncpy(utf16_timezone, tzid, sizeof(utf16_timezone));
 
        UErrorCode status = U_ZERO_ERROR;
@@ -357,7 +357,7 @@ UCalendar *cal_time_open_ucal(int calendar_system_type, const char *tzid, int wk
 
 UCalendar *cal_time_get_ucal(const char *tzid, int wkst)
 {
-       UChar utf16_timezone[64] = {0};
+       UChar utf16_timezone[CAL_STR_SHORT_LEN64] = {0};
        u_uastrncpy(utf16_timezone, tzid, sizeof(utf16_timezone));
 
        UErrorCode status = U_ZERO_ERROR;
@@ -474,7 +474,7 @@ char* cal_time_extract_by(int calendar_system_type, const char *tzid, int wkst,
 char* cal_time_convert_ltos(const char *tzid, long long int lli, int is_allday)
 {
        int y, mon, d, h, min, s;
-       char buf[32] = {0};
+       char buf[CAL_STR_SHORT_LEN32] = {0};
        UCalendar *ucal;
        UErrorCode status = U_ZERO_ERROR;
 
@@ -742,7 +742,7 @@ int cal_time_get_next_time(UCalendar *ucal, int offset, int freq, calendar_time_
  */
 char* cal_time_get_timezone(void)
 {
-       char buf[256] = {0};
+       char buf[CAL_STR_MIDDLE_LEN] = {0};
        ssize_t len = readlink("/opt/etc/localtime", buf, sizeof(buf)-1);
        RETVM_IF(-1 == len, NULL, "readlink() Fail");
 
@@ -948,7 +948,7 @@ bool cal_time_is_available_tzid(char *tzid)
        int len = strlen(tzid);
        int i, j;
        for (i = 0; i < s_count; i++) {
-               char buf[32] = {0};
+               char buf[CAL_STR_SHORT_LEN32] = {0};
                const UnicodeString *unicode_tzid = s->snext(ec);
                for (j = 0; j < unicode_tzid->length(); j++) {
                        buf[j] = unicode_tzid->charAt(j);
index 1ba92a6..e1628f0 100644 (file)
 #include "cal_record.h"
 #include <tzplatform_config.h>
 
-#define CAL_STR_SHORT_LEN 1024
+#define CAL_STR_SHORT_LEN32 32
+#define CAL_STR_SHORT_LEN64 64
+#define CAL_STR_MIDDLE_LEN 1024
+#define CAL_STR_LONG_LEN 2048
 #define CAL_STRING_EQUAL 0
 #define CAL_TZID_GMT "Etc/GMT"
 #define CAL_SOCK_PATH "/run/user/%d"
index 3a4c2c4..b9e271c 100644 (file)
@@ -181,7 +181,7 @@ API int calendar_vcalendar_parse_to_calendar_foreach(const char *vcalendar_file_
        FILE *file;
        int buf_size, len;
        char *stream;
-       char buf[1024];
+       char buf[CAL_STR_MIDDLE_LEN];
        vcalendar_foreach_s *foreach_data = NULL;
 
        RETV_IF(NULL == vcalendar_file_path, CALENDAR_ERROR_INVALID_PARAMETER);
index b663ef2..e28389e 100644 (file)
@@ -212,7 +212,7 @@ static int  _cal_vcalendar_make_time(cal_make_s *b, char *tzid, calendar_time_s
                return CALENDAR_ERROR_NONE;
        }
 
-       char buf[256] = {0};
+       char buf[CAL_STR_MIDDLE_LEN] = {0};
        int y = 0, m = 0, d = 0;
        int h = 0, n = 0, s = 0;
        switch (b->version) {
@@ -298,7 +298,7 @@ static void __encode_escaped_char(char *p, char **r)
 
 static const char* vl_tick(calendar_alarm_time_unit_type_e unit, int tick)
 {
-       static char buf[32] = {0};
+       static char buf[CAL_STR_SHORT_LEN32] = {0};
 
        int i = 0;
        if (0 < tick) {
@@ -352,7 +352,7 @@ int _cal_vcalendar_make_audio(cal_make_s *b, calendar_record_h alarm)
 
                }
                else {
-                       char datetime[32] = {0};
+                       char datetime[CAL_STR_SHORT_LEN32] = {0};
                        snprintf(datetime, sizeof(datetime), "%04d%02d%02dT%02d%02d%02d",
                                        at.time.date.year, at.time.date.month, at.time.date.mday,
                                        at.time.date.hour, at.time.date.minute, at.time.date.second);
@@ -389,7 +389,7 @@ static void _cal_vcalendar_make_aalarm(cal_make_s *b, calendar_record_h record,
        ret = calendar_record_get_int(alarm, _calendar_alarm.tick_unit, &unit);
        RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() Fail(%d)", ret);
 
-       char datetime[32] = {0};
+       char datetime[CAL_STR_SHORT_LEN32] = {0};
        if (CALENDAR_ALARM_TIME_UNIT_SPECIFIC == unit) {
                calendar_time_s at = {0};
                ret = calendar_record_get_caltime(alarm, _calendar_alarm.alarm_time, &at);
@@ -607,7 +607,7 @@ static void _cal_vcalendar_make_rrule_append_setpos(calendar_record_h record, ch
                                if (false == is_working) {
                                        is_extracted = true;
                                        is_working = true;
-                                       char num[32] = {0};
+                                       char num[CAL_STR_SHORT_LEN32] = {0};
                                        snprintf(num, digit +1, "%s%s", byday +i -digit, (-1 == sign) ? "- ": "+ ");
                                        if (NULL == strstr(buf, num)) {
                                                blen += snprintf(buf +blen, buf_len -blen, "%s", num);
@@ -949,7 +949,7 @@ static void __make_rrule_ver1_default(calendar_record_h record, int freq, int in
                d = caltime.time.date.mday;
                break;
        }
-       char mday[32] = {0};
+       char mday[CAL_STR_SHORT_LEN32] = {0};
        snprintf(mday, sizeof(mday), "%d", d);
        _cal_vcalendar_make_rrule_append_mday(buf, sizeof(buf), mday);
 }
@@ -960,7 +960,7 @@ static void __make_rrule_ver1(cal_make_s *b, calendar_record_h record)
        RET_IF(NULL == record);
 
        int ret = 0;
-       char buf[1024] = {0};
+       char buf[CAL_STR_MIDDLE_LEN] = {0};
 
        int freq = 0;
        ret = calendar_record_get_int(record, _calendar_event.freq, &freq);
@@ -1070,7 +1070,7 @@ static void __make_rrule_ver2(cal_make_s *b, calendar_record_h record)
 
        int ret = 0;
        char *text = NULL;
-       char tmp[32] = {0};
+       char tmp[CAL_STR_SHORT_LEN32] = {0};
        calendar_time_s caltime = {0};
 
        int freq = 0;
@@ -1521,7 +1521,7 @@ static void __make_created_time(cal_make_s *b, calendar_record_h record)
        int y = 0, m = 0, d = 0;
        int h = 0, n = 0, s = 0;
        cal_time_get_local_datetime(NULL, value, &y, &m, &d, &h, &n, &s);
-       char buf[128] = {0};
+       char buf[CAL_STR_MIDDLE_LEN] = {0};
        snprintf(buf, sizeof(buf), VCAL_DATETIME_FORMAT_YYYYMMDDTHHMMSSZ, y, m, d, h, n, s);
 
        switch (b->version) {
@@ -1638,7 +1638,7 @@ static void __make_organizer(cal_make_s *b, calendar_record_h record)
        if ((NULL == name || '\0' == *name) && (NULL == email || '\0' == *email))
                return;
 
-       char buf[128] = {0};
+       char buf[CAL_STR_MIDDLE_LEN] = {0};
        snprintf(buf, sizeof(buf), "ORGANIZER%s%s%s%s",
                        (name && *name) ? ";CN=" : "",
                        (name && *name) ? name : "",
@@ -1676,7 +1676,7 @@ static void __make_last_modified(cal_make_s *b, calendar_record_h record)
        int h = 0, n = 0, s = 0;
        cal_time_get_local_datetime(NULL, value, &y, &m, &d, &h, &n, &s);
 
-       char buf[128] = {0};
+       char buf[CAL_STR_MIDDLE_LEN] = {0};
        snprintf(buf, sizeof(buf), VCAL_DATETIME_FORMAT_YYYYMMDDTHHMMSSZ, y, m, d, h, n, s);
        _cal_vcalendar_make_printf(b, "LAST-MODIFIED:", buf);
 }
@@ -1751,7 +1751,7 @@ static void __make_completed(cal_make_s *b, calendar_record_h record)
        int y = 0, m = 0, d = 0;
        int h = 0, n = 0, s = 0;
        cal_time_get_local_datetime(NULL, value, &y, &m, &d, &h, &n, &s);
-       char buf[128] = {0};
+       char buf[CAL_STR_MIDDLE_LEN] = {0};
        snprintf(buf, sizeof(buf), VCAL_DATETIME_FORMAT_YYYYMMDDTHHMMSSZ, y, m, d, h, n, s);
        _cal_vcalendar_make_printf(b, "COMPLETED", buf);
 }
@@ -1810,7 +1810,7 @@ static void __make_priority(cal_make_s *b, calendar_record_h record)
                }
                break;
        }
-       char buf[128] = {0};
+       char buf[CAL_STR_MIDDLE_LEN] = {0};
        snprintf(buf, sizeof(buf), "PRIORITY:%d", priority);
        _cal_vcalendar_make_printf(b, buf, NULL);
 }
@@ -1828,7 +1828,7 @@ static void __make_dtstamp(cal_make_s *b, calendar_record_h record)
        int y = 0, m = 0, d = 0;
        int h = 0, n = 0, s = 0;
        cal_time_get_local_datetime(NULL, t, &y, &m, &d, &h, &n, &s);
-       char buf[128] = {0};
+       char buf[CAL_STR_MIDDLE_LEN] = {0};
        snprintf(buf, sizeof(buf), VCAL_DATETIME_FORMAT_YYYYMMDDTHHMMSSZ, y, m, d, h, n, s);
        _cal_vcalendar_make_printf(b, "DTSTAMP:", buf);
 }
@@ -2096,7 +2096,7 @@ static void __append_header(cal_make_s *b)
        ret = _cal_vcalendar_make_printf(b, "PRODID:vCal ID Default", NULL);
        RETM_IF(CALENDAR_ERROR_NONE != ret, "_cal_vcalendar_make_printf() Fail(%d)", ret);
 
-       char buf[32] = {0};
+       char buf[CAL_STR_SHORT_LEN32] = {0};
        snprintf(buf, sizeof(buf), "VERSION:%d.0", b->version);
        ret = _cal_vcalendar_make_printf(b, buf, NULL);
        RETM_IF(CALENDAR_ERROR_NONE != ret, "_cal_vcalendar_make_printf() Fail(%d)", ret);
@@ -2131,7 +2131,7 @@ static void __make_tz(cal_make_s *b, char *tzid, long long int created)
        int h = (zone / 3600) + (dst / 3600);
        int m = (zone % 3600) / 60 + (dst % 3600) / 60;
 
-       char buf[32] = {0};
+       char buf[CAL_STR_SHORT_LEN32] = {0};
        snprintf(buf, sizeof(buf), "TZ:%s%02d:%02d",
                        h == 0 ? "" : (h < 0 ? "-" : "+"),
                        h < 0 ? (-1 * h) : h, m < 0 ? (-1 * m) : m);
index 1c33548..fc1d49e 100644 (file)
@@ -932,7 +932,7 @@ static void __get_tz(char *value, char **tz)
        int h = 0, m = 0;
        __parse_tz(value +1, &h, &m); /* +1 to skip ':' */
 
-       char buf[32] = {0};
+       char buf[CAL_STR_SHORT_LEN32] = {0};
        if (0 == m) {
                snprintf(buf, sizeof(buf), "Etc/GMT%c%d", h < 0 ? '+' : '-', h);
 
@@ -1351,7 +1351,7 @@ static void __work_component_property_rrule_ver_1(char *value, calendar_record_h
        int freq_mode = 0;
        bool has_by = false;
 
-       char bystr[1024] = {0};
+       char bystr[CAL_STR_MIDDLE_LEN] = {0};
        int len_str = 0;
 
        int week[5] = {0};
@@ -2826,7 +2826,7 @@ static void __work_component_property_vtimezone_standard_tzoffsetto(char *value,
        WARN_IF(CALENDAR_ERROR_NONE != ret, "cal_record_set_int() Fail(%d)", ret);
 
        if (NULL == ud->timezone_tzid || '\0' == *ud->timezone_tzid) {
-               char buf[32] = {0};
+               char buf[CAL_STR_SHORT_LEN32] = {0};
                snprintf(buf, sizeof(buf), "Etc/GMT%c%d", offset < 0 ? '+' : '-', h);
                ud->timezone_tzid = strdup(buf);
                __adjust_tzid(ud->timezone_tzid);
index 06df7d5..ad13b10 100644 (file)
@@ -20,6 +20,7 @@
 #include <vasum.h>
 
 #include "calendar_errors.h"
+#include "cal_typedef.h"
 #include "cal_internal.h"
 #include "cal_zone.h"
 #include "cal_utils.h"
@@ -37,7 +38,7 @@ int cal_zone_get_canonicalize_path(const char *zone_name, const char *path, char
        RETV_IF(NULL == path, CALENDAR_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == canonicalize_path, CALENDAR_ERROR_INVALID_PARAMETER);
 
-       char buf[1024] = {0};
+       char buf[CAL_STR_MIDDLE_LEN] = {0};
        if (zone_name) {
                if ('\0' == *zone_name)
                        snprintf(buf, sizeof(buf), "%s", path);
index 58e2d39..d73b5be 100644 (file)
@@ -103,7 +103,7 @@ static int _cal_db_alarm_insert_record(calendar_record_h record, int parent_id)
        index++;
 
        if (CALENDAR_TIME_LOCALTIME == alarm->alarm.type) {
-               char alarm_datetime[32] = {0};
+               char alarm_datetime[CAL_STR_SHORT_LEN32] = {0};
                snprintf(alarm_datetime, sizeof(alarm_datetime), CAL_FORMAT_LOCAL_DATETIME,
                                alarm->alarm.time.date.year,
                                alarm->alarm.time.date.month,
index c31e38d..7e5129b 100644 (file)
@@ -505,7 +505,7 @@ void cal_db_event_apply_recurrence_id(int parent_id, cal_event_s *event, char *r
 
        int y = 0, m = 0, d = 0;
        int h = 0, n = 0, s = 0;
-       char dtstart_datetime[32] = {0};
+       char dtstart_datetime[CAL_STR_SHORT_LEN32] = {0};
        long long int dtstart_utime = 0;
        calendar_time_s rectime = {0};
        switch (len_datetime) {
@@ -635,8 +635,8 @@ int cal_db_event_insert_record(calendar_record_h record, int original_event_id,
        int index;
        int input_ver;
        char query[CAL_DB_SQL_MAX_LEN] = {0};
-       char dtstart_datetime[32] = {0};
-       char dtend_datetime[32] = {0};
+       char dtstart_datetime[CAL_STR_SHORT_LEN32] = {0};
+       char dtend_datetime[CAL_STR_SHORT_LEN32] = {0};
        sqlite3_stmt *stmt = NULL;
        cal_event_s* event =  (cal_event_s*)(record);
        cal_rrule_s *rrule = NULL;
index 71ffbe8..9918957 100644 (file)
@@ -300,7 +300,7 @@ static int _cal_db_instance_update_exdate_mod(int original_event_id, char *recur
 
                int y = 0, m = 0, d = 0;
                int h = 0, n = 0, s = 0;
-               char buf[32] = {0};
+               char buf[CAL_STR_SHORT_LEN32] = {0};
                switch (strlen(p)) {
                case 8:
                        DBG("ALLDAY instance");
@@ -494,8 +494,8 @@ static int _cal_db_instance_insert_record(UCalendar *ucal, long long int duratio
        long long int lli_e = 0;
        int y = 0, m = 0, d = 0;
        int h = 0, n = 0, s = 0;
-       char buf_s[256] = {0};
-       char buf_e[256] = {0};
+       char buf_s[CAL_STR_MIDDLE_LEN] = {0};
+       char buf_e[CAL_STR_MIDDLE_LEN] = {0};
 
        RETV_IF(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER);
 
@@ -763,12 +763,12 @@ static int _cal_db_instance_publish_yearly_yday(UCalendar *ucal, cal_event_s *ev
        /* set until before dtstart_utime */
        long long int until_utime = ms2sec(ucal_getMillis(ucal, &ec));
 
-       int byyearday[1024] = {0};
+       int byyearday[CAL_STR_MIDDLE_LEN] = {0};
        int byyearday_len = 0;
        _cal_db_instance_parse_byint(event->byyearday, byyearday, &byyearday_len);
        DBG("byyearday len(%d)", byyearday_len);
 
-       int bysetpos[1024] = {0};
+       int bysetpos[CAL_STR_MIDDLE_LEN] = {0};
        int bysetpos_len = 0;
        _cal_db_instance_parse_byint(event->bysetpos, bysetpos, &bysetpos_len);
        DBG("bysetpos len(%d)", bysetpos_len);
@@ -849,12 +849,12 @@ static int _cal_db_instance_publish_yearly_weekno(UCalendar *ucal, cal_event_s *
        }
        DBG("byday_len (%d) week integer(0x%x)", byday_len, week_bits);
 
-       int byweekno[1024] = {0};
+       int byweekno[CAL_STR_MIDDLE_LEN] = {0};
        int byweekno_len = 0;
        _cal_db_instance_parse_byint(event->byweekno, byweekno, &byweekno_len);
        DBG("byweekno len(%d)", byweekno_len);
 
-       int bysetpos[1024] = {0};
+       int bysetpos[CAL_STR_MIDDLE_LEN] = {0};
        int bysetpos_len = 0;
        _cal_db_instance_parse_byint(event->bysetpos, bysetpos, &bysetpos_len);
        DBG("bysetpos len(%d)", bysetpos_len);
@@ -952,7 +952,7 @@ static int _cal_db_instance_publish_yearly_wday(UCalendar *ucal, cal_event_s *ev
        }
 
        /* get bymonthday into array */
-       int bymonthday[1024] = {0};
+       int bymonthday[CAL_STR_MIDDLE_LEN] = {0};
        int bymonthday_len = 0;
        _cal_db_instance_parse_byint(event->bymonthday, bymonthday, &bymonthday_len);
        DBG("bymonthday_len(%d)", bymonthday_len);
@@ -968,7 +968,7 @@ static int _cal_db_instance_publish_yearly_wday(UCalendar *ucal, cal_event_s *ev
                __set_time_to_ucal(event->system_type, ucal, st);
                int nth = ucal_get(ucal, UCAL_DAY_OF_WEEK_IN_MONTH, &ec);
                int dtstart_wday = ucal_get(ucal, UCAL_DAY_OF_WEEK, &ec);
-               char buf[32] = {0};
+               char buf[CAL_STR_SHORT_LEN32] = {0};
                snprintf(buf, sizeof(buf), "%d%s", nth, week_text[dtstart_wday -1]);
                DBG("set byday[%s]", buf);
 
@@ -982,7 +982,7 @@ static int _cal_db_instance_publish_yearly_wday(UCalendar *ucal, cal_event_s *ev
        }
        DBG("[%s] byday_len(%d)", event->byday, byday_len);
 
-       int bysetpos[1024] = {0};
+       int bysetpos[CAL_STR_MIDDLE_LEN] = {0};
        int bysetpos_len = 0;
        _cal_db_instance_parse_byint(event->bysetpos, bysetpos, &bysetpos_len);
        DBG("bysetpos len(%d)", bysetpos_len);
@@ -1012,7 +1012,7 @@ static int _cal_db_instance_publish_yearly_wday(UCalendar *ucal, cal_event_s *ev
                                        if (0 == strlen(t[j])) continue;
                                        /* get nth, wday */
                                        int nth = 0;
-                                       char wday[32] = {0};
+                                       char wday[CAL_STR_SHORT_LEN32] = {0};
 
                                        sscanf(t[j], "%d%s", &nth, wday); /* -3SU, +2SA */
                                        DBG("nth(%d) wday[%s]", nth, wday);
@@ -1182,7 +1182,7 @@ static int _cal_db_instance_publish_yearly_mday(UCalendar *ucal, cal_event_s *ev
        DBG("bymonth_len(%d)", bymonth_len);
 
        /* get bymonthday into array */
-       int bymonthday[1024] = {0};
+       int bymonthday[CAL_STR_MIDDLE_LEN] = {0};
        int bymonthday_len = 0;
        _cal_db_instance_parse_byint(event->bymonthday, bymonthday, &bymonthday_len);
        if (0 == bymonthday_len) {
@@ -1194,7 +1194,7 @@ static int _cal_db_instance_publish_yearly_mday(UCalendar *ucal, cal_event_s *ev
        }
        DBG("bymonthday len(%d)", bymonthday_len);
 
-       int bysetpos[1024] = {0};
+       int bysetpos[CAL_STR_MIDDLE_LEN] = {0};
        int bysetpos_len = 0;
        _cal_db_instance_parse_byint(event->bysetpos, bysetpos, &bysetpos_len);
        DBG("bysetpos len(%d)", bysetpos_len);
@@ -1298,7 +1298,7 @@ static int _cal_db_instance_publish_monthly_wday(UCalendar *ucal, cal_event_s *e
        long long int until_utime = ms2sec(ucal_getMillis(ucal, &ec));
 
        /* get bymonthday into array */
-       int bymonthday[1024] = {0};
+       int bymonthday[CAL_STR_MIDDLE_LEN] = {0};
        int bymonthday_len = 0;
        _cal_db_instance_parse_byint(event->bymonthday, bymonthday, &bymonthday_len);
 
@@ -1313,7 +1313,7 @@ static int _cal_db_instance_publish_monthly_wday(UCalendar *ucal, cal_event_s *e
                __set_time_to_ucal(event->system_type, ucal, st);
                int week_nth = ucal_get(ucal, UCAL_DAY_OF_WEEK_IN_MONTH, &ec);
                int dtstart_wday = ucal_get(ucal, UCAL_DAY_OF_WEEK, &ec);
-               char buf[32] = {0};
+               char buf[CAL_STR_SHORT_LEN32] = {0};
                snprintf(buf, sizeof(buf), "%d%s", week_nth, week_text[dtstart_wday -1]);
                DBG("set byday[%s]", buf);
 
@@ -1327,7 +1327,7 @@ static int _cal_db_instance_publish_monthly_wday(UCalendar *ucal, cal_event_s *e
        }
        DBG("[%s] byday_len(%d)", event->byday, byday_len);
 
-       int bysetpos[1024] = {0};
+       int bysetpos[CAL_STR_MIDDLE_LEN] = {0};
        int bysetpos_len = 0;
        _cal_db_instance_parse_byint(event->bysetpos, bysetpos, &bysetpos_len);
        DBG("bysetpos len(%d)", bysetpos_len);
@@ -1356,7 +1356,7 @@ static int _cal_db_instance_publish_monthly_wday(UCalendar *ucal, cal_event_s *e
                                        continue;
                                /* get nth, wday */
                                int nth = 0;
-                               char wday[32] = {0};
+                               char wday[CAL_STR_SHORT_LEN32] = {0};
 
                                sscanf(t[i], "%d%s", &nth, wday); /* -3SU, +2SA */
                                DBG("nth(%d) wday[%s]", nth, wday);
@@ -1513,7 +1513,7 @@ static int _cal_db_instance_publish_monthly_mday(UCalendar *ucal, cal_event_s *e
        long long int until_utime = ms2sec(ucal_getMillis(ucal, &ec));
 
        /* get bymonthday into array */
-       int bymonthday[1024] = {0};
+       int bymonthday[CAL_STR_MIDDLE_LEN] = {0};
        int bymonthday_len = 0;
        _cal_db_instance_parse_byint(event->bymonthday, bymonthday, &bymonthday_len);
        if (0 == bymonthday_len) {
@@ -1525,7 +1525,7 @@ static int _cal_db_instance_publish_monthly_mday(UCalendar *ucal, cal_event_s *e
        }
        DBG("bymonthday_len(%d) [%s]", bymonthday_len, event->bymonthday);
 
-       int bysetpos[1024] = {0};
+       int bysetpos[CAL_STR_MIDDLE_LEN] = {0};
        int bysetpos_len = 0;
        _cal_db_instance_parse_byint(event->bysetpos, bysetpos, &bysetpos_len);
        DBG("bysetpos_len(%d)", bysetpos_len);
@@ -1631,7 +1631,7 @@ static int _cal_db_instance_publish_weekly_wday(UCalendar *ucal, cal_event_s *ev
        }
        DBG("week integer(0x%x)", week_bits);
 
-       int bysetpos[1024] = {0};
+       int bysetpos[CAL_STR_MIDDLE_LEN] = {0};
        int bysetpos_len = 0;
        _cal_db_instance_parse_byint(event->bysetpos, bysetpos, &bysetpos_len);
        DBG("bysetpos len(%d)", bysetpos_len);
index fb3eb50..c41a712 100644 (file)
@@ -327,7 +327,7 @@ static int _cal_db_alarm_get_records_with_query(calendar_query_h query, int offs
                CAL_FREE(order);
        }
 
-       char buf[32] = {0};
+       char buf[CAL_STR_SHORT_LEN32] = {0};
        if (0 < limit) {
                snprintf(buf, sizeof(buf), "LIMIT %d", limit);
                cal_db_append_string(&query_str, buf);
index cfcc3a1..b4cab49 100644 (file)
@@ -295,7 +295,7 @@ static int _cal_db_attendee_get_records_with_query(calendar_query_h query, int o
                CAL_FREE(order);
        }
 
-       char buf[32] = {0};
+       char buf[CAL_STR_SHORT_LEN32] = {0};
        if (0 < limit) {
                snprintf(buf, sizeof(buf), "LIMIT %d", limit);
                cal_db_append_string(&query_str, buf);
index 4c99ea8..4830736 100644 (file)
@@ -555,7 +555,7 @@ static int _cal_db_calendar_get_records_with_query(calendar_query_h query, int o
        CAL_FREE(condition);
 
        /* limit, offset */
-       char buf[32] = {0};
+       char buf[CAL_STR_SHORT_LEN32] = {0};
        if (0 < limit) {
                snprintf(buf, sizeof(buf), "LIMIT %d", limit);
                cal_db_append_string(&query_str, buf);
index 30c0b4d..6571d16 100644 (file)
@@ -350,7 +350,7 @@ static int __get_time_shifted_field(char *old_field, int old_type, int new_type,
                tm.tm_min = n;
                tm.tm_sec = s;
 
-               char buf[32] = {0};
+               char buf[CAL_STR_SHORT_LEN32] = {0};
                switch (new_type) {
                case CALENDAR_TIME_UTIME:
                        switch (strlen(t[i])) {
@@ -465,8 +465,8 @@ static int __update_record(calendar_record_h record, int is_dirty_in_time)
 {
        int ret = 0;
        char query[CAL_DB_SQL_MAX_LEN] = {0};
-       char dtstart_datetime[32] = {0};
-       char dtend_datetime[32] = {0};
+       char dtstart_datetime[CAL_STR_SHORT_LEN32] = {0};
+       char dtend_datetime[CAL_STR_SHORT_LEN32] = {0};
        sqlite3_stmt *stmt = NULL;
        cal_event_s* event =  (cal_event_s*)(record);
        cal_rrule_s *rrule = NULL;
@@ -1122,7 +1122,7 @@ static int _cal_db_event_get_records_with_query(calendar_query_h query, int offs
        CAL_FREE(condition);
 
        /* limit, offset */
-       char buf[32] = {0};
+       char buf[CAL_STR_SHORT_LEN32] = {0};
        if (0 < limit) {
                snprintf(buf, sizeof(buf), "LIMIT %d", limit);
                cal_db_append_string(&query_str, buf);
@@ -1427,8 +1427,8 @@ static int _cal_db_event_replace_record(calendar_record_h record, int id)
 {
        int ret = CALENDAR_ERROR_NONE;
        char query[CAL_DB_SQL_MAX_LEN] = {0};
-       char dtstart_datetime[32] = {0};
-       char dtend_datetime[32] = {0};
+       char dtstart_datetime[CAL_STR_SHORT_LEN32] = {0};
+       char dtend_datetime[CAL_STR_SHORT_LEN32] = {0};
        sqlite3_stmt *stmt = NULL;
        cal_event_s* event =  (cal_event_s*)(record);
        cal_rrule_s *rrule = NULL;
index 0700a17..914a5d1 100644 (file)
@@ -340,7 +340,7 @@ static int _cal_db_extended_get_records_with_query(calendar_query_h query, int o
                CAL_FREE(order);
        }
 
-       char buf[32] = {0};
+       char buf[CAL_STR_SHORT_LEN32] = {0};
        if (0 < limit) {
                snprintf(buf, sizeof(buf), "LIMIT %d", limit);
                cal_db_append_string(&query_str, buf);
index 22b7c5c..7ab2616 100644 (file)
@@ -213,7 +213,7 @@ static int _cal_db_instance_allday_get_records_with_query(calendar_query_h query
        CAL_FREE(condition);
 
        /* limit, offset */
-       char buf[32] = {0};
+       char buf[CAL_STR_SHORT_LEN32] = {0};
        if (0 < limit) {
                snprintf(buf, sizeof(buf), "LIMIT %d", limit);
                cal_db_append_string(&query_str, buf);
index 715f156..1e4f94e 100644 (file)
@@ -183,7 +183,7 @@ static int _cal_db_instance_allday_extended_get_records_with_query(calendar_quer
        CAL_FREE(condition);
 
        /* limit, offset */
-       char buf[32] = {0};
+       char buf[CAL_STR_SHORT_LEN32] = {0};
        if (0 < limit) {
                snprintf(buf, sizeof(buf), "LIMIT %d", limit);
                cal_db_append_string(&query_str, buf);
index 974cf3b..813bfaf 100644 (file)
@@ -217,7 +217,7 @@ static int _cal_db_instance_normal_get_records_with_query(calendar_query_h query
        CAL_FREE(condition);
 
        /* limit, offset */
-       char buf[32] = {0};
+       char buf[CAL_STR_SHORT_LEN32] = {0};
        if (0 < limit) {
                snprintf(buf, sizeof(buf), "LIMIT %d", limit);
                cal_db_append_string(&query_str, buf);
index b1e35c6..11eea3a 100644 (file)
@@ -182,7 +182,7 @@ static int _cal_db_instance_normal_extended_get_records_with_query(calendar_quer
        CAL_FREE(condition);
 
        /* limit, offset */
-       char buf[32] = {0};
+       char buf[CAL_STR_SHORT_LEN32] = {0};
        if (0 < limit) {
                snprintf(buf, sizeof(buf), "LIMIT %d", limit);
                cal_db_append_string(&query_str, buf);
index 133d3b9..27697f6 100644 (file)
@@ -124,7 +124,7 @@ static int _cal_db_search_get_records_with_query(calendar_query_h query, int off
        CAL_FREE(condition);
 
        /* limit, offset */
-       char buf[32] = {0};
+       char buf[CAL_STR_SHORT_LEN32] = {0};
        if (0 < limit) {
                snprintf(buf, sizeof(buf), "LIMIT %d", limit);
                cal_db_append_string(&query_str, buf);
index e81b85d..091497e 100644 (file)
@@ -488,7 +488,7 @@ static int _cal_db_timezone_get_records_with_query(calendar_query_h query, int o
                CAL_FREE(order);
        }
 
-       char buf[32] = {0};
+       char buf[CAL_STR_SHORT_LEN32] = {0};
        if (0 < limit) {
                snprintf(buf, sizeof(buf), "LIMIT %d", limit);
                cal_db_append_string(&query_str, buf);
index 4c76f7e..251bfe0 100644 (file)
@@ -86,8 +86,8 @@ static int _cal_db_todo_insert_record(calendar_record_h record, int* id)
        int index = -1;
        int input_ver;
        char query[CAL_DB_SQL_MAX_LEN] = {0};
-       char dtstart_datetime[32] = {0};
-       char dtend_datetime[32] = {0};
+       char dtstart_datetime[CAL_STR_SHORT_LEN32] = {0};
+       char dtend_datetime[CAL_STR_SHORT_LEN32] = {0};
        sqlite3_stmt *stmt = NULL;
        cal_todo_s* todo =  (cal_todo_s*)(record);
        cal_rrule_s *rrule = NULL;
@@ -389,8 +389,8 @@ static int _cal_db_todo_get_record(int id, calendar_record_h* out_record)
 static int _cal_db_todo_update_record(calendar_record_h record)
 {
        char query[CAL_DB_SQL_MAX_LEN] = {0};
-       char dtstart_datetime[32] = {0};
-       char dtend_datetime[32] = {0};
+       char dtstart_datetime[CAL_STR_SHORT_LEN32] = {0};
+       char dtend_datetime[CAL_STR_SHORT_LEN32] = {0};
        sqlite3_stmt *stmt = NULL;
        cal_todo_s* todo =  (cal_todo_s*)(record);
        cal_rrule_s *rrule = NULL;
@@ -664,8 +664,8 @@ static int _cal_db_todo_replace_record(calendar_record_h record, int id)
 {
        int ret = CALENDAR_ERROR_NONE;
        char query[CAL_DB_SQL_MAX_LEN] = {0};
-       char dtstart_datetime[32] = {0};
-       char dtend_datetime[32] = {0};
+       char dtstart_datetime[CAL_STR_SHORT_LEN32] = {0};
+       char dtend_datetime[CAL_STR_SHORT_LEN32] = {0};
        sqlite3_stmt *stmt = NULL;
        cal_todo_s* todo =  (cal_todo_s*)(record);
        cal_rrule_s *rrule = NULL;
@@ -1024,7 +1024,7 @@ static int _cal_db_todo_get_records_with_query(calendar_query_h query, int offse
        CAL_FREE(condition);
 
        /* limit, offset */
-       char buf[32] = {0};
+       char buf[CAL_STR_SHORT_LEN32] = {0};
        if (0 < limit) {
                snprintf(buf, sizeof(buf), "LIMIT %d", limit);
                cal_db_append_string(&query_str, buf);
index 3831cfc..b7817a4 100644 (file)
@@ -307,7 +307,7 @@ int cal_db_query_create_projection_update_set(calendar_record_h record, char **s
                                }
                                else {
                                        char *bind_tmp = NULL;
-                                       char bind_datetime[32] = {0};
+                                       char bind_datetime[CAL_STR_SHORT_LEN32] = {0};
                                        snprintf(bind_datetime, sizeof(bind_datetime), CAL_FORMAT_LOCAL_DATETIME,
                                                        tmp.time.date.year,
                                                        tmp.time.date.month,
@@ -446,7 +446,7 @@ int cal_db_query_create_projection_update_set_with_property(
                                }
                                else {
                                        char *bind_tmp = NULL;
-                                       char bind_datetime[32] = {0};
+                                       char bind_datetime[CAL_STR_SHORT_LEN32] = {0};
                                        snprintf(bind_datetime, sizeof(bind_datetime), CAL_FORMAT_LOCAL_DATETIME,
                                                        tmp.time.date.year,
                                                        tmp.time.date.month,
@@ -758,7 +758,7 @@ static int _cal_db_query_create_caltime_condition(cal_composite_filter_s *com_fi
                }
        }
        else if (filter->value.caltime.type == CALENDAR_TIME_LOCALTIME) {
-               char sdate[32] = {0};
+               char sdate[CAL_STR_SHORT_LEN32] = {0};
                snprintf(sdate, sizeof(sdate), CAL_FORMAT_LOCAL_DATETIME,
                                filter->value.caltime.time.date.year, filter->value.caltime.time.date.month, filter->value.caltime.time.date.mday,
                                filter->value.caltime.time.date.hour, filter->value.caltime.time.date.minute, filter->value.caltime.time.date.second);
index 6dbc2bb..18320cd 100644 (file)
@@ -217,7 +217,7 @@ int _cal_db_rrule_insert_record(int id, cal_rrule_s *rrule)
        int rrule_id;
        int index;
        char query[CAL_DB_SQL_MAX_LEN] = {0};
-       char until_datetime[32] = {0};
+       char until_datetime[CAL_STR_SHORT_LEN32] = {0};
        sqlite3_stmt *stmt = NULL;
        int ret = 0;
 
@@ -448,9 +448,9 @@ static int _cal_db_rrule_has_record(int id, int *has_record)
 
 static int _cal_db_rrule_update_record(int id, cal_rrule_s *rrule)
 {
-       char query[CAL_DB_SQL_MAX_LEN] = {0};
-       char until_datetime[32] = {0};
        int ret = 0;
+       char query[CAL_DB_SQL_MAX_LEN] = {0};
+       char until_datetime[CAL_STR_SHORT_LEN32] = {0};
        sqlite3_stmt *stmt = NULL;
 
        snprintf(query, sizeof(query),
index bdf4734..5302935 100644 (file)
@@ -46,7 +46,7 @@ struct _alarm_data_s
        int type; /* utime, localtime */
        long long int time;
        int record; /* todo, event */
-       char datetime[32];
+       char datetime[CAL_STR_SHORT_LEN32];
        int system_type;
 };
 
@@ -629,7 +629,7 @@ static void _cal_server_alarm_get_latest(time_t utime, bool get_all, GList **out
        struct tm st_local = {0};
        localtime_r(&utime, &st_local);
 
-       char datetime[32] = {0};
+       char datetime[CAL_STR_SHORT_LEN32] = {0};
        snprintf(datetime, sizeof(datetime), CAL_FORMAT_LOCAL_DATETIME,
                        st_local.tm_year +1900, st_local.tm_mon + 1, st_local.tm_mday,
                        st_local.tm_hour, st_local.tm_min, st_local.tm_sec);
@@ -780,30 +780,21 @@ static bool __app_matched_cb(app_control_h app_control, const char *package, voi
                DBG("pkg[%s] time[%lld] tick[%d] unit[%d] record_type[%d]",
                                package, ad->time, ad->tick, ad->unit, ad->record);
 
-               char buf_event_id[128] = {0};
-               char buf_time[128] = {0};
-               char buf_tick[128] = {0};
-               char buf_unit[128] = {0};
-               char buf_record_type[128] = {0};
-               snprintf(buf_event_id, sizeof(buf_event_id), "%d", ad->event_id);
-               snprintf(buf_time, sizeof(buf_time), "%lld", ad->time);
-               snprintf(buf_tick, sizeof(buf_tick), "%d", ad->tick);
-               snprintf(buf_unit, sizeof(buf_unit), "%d", ad->unit);
-               snprintf(buf_record_type, sizeof(buf_record_type), "%d", ad->record);
-
-               char *p = NULL;
-               cal_server_reminder_add_callback_data(&p, "id", buf_event_id);
-               cal_server_reminder_add_callback_data(&p, "time", buf_time);
-               cal_server_reminder_add_callback_data(&p, "tick", buf_tick);
-               cal_server_reminder_add_callback_data(&p, "unit", buf_unit);
-               cal_server_reminder_add_callback_data(&p, "type", buf_record_type);
-
-               app_control_add_extra_data(b, buf_event_id, p); // key: id, value: id=4&time=123123&..
-               DBG("value[%s]", p);
-               free(p);
-
-               // append ids
-               ids[i] = strdup(buf_event_id);
+               int len = 0;
+               char extra[CAL_STR_MIDDLE_LEN] = {0};
+               len = snprintf(extra, sizeof(extra), "%s=%d", "id", ad->event_id);
+               len += snprintf(extra+len, sizeof(extra)-len, "&%s=%lld", "time", ad->time);
+               len += snprintf(extra+len, sizeof(extra)-len, "&%s=%d", "tick", ad->tick);
+               len += snprintf(extra+len, sizeof(extra)-len, "&%s=%d", "unit", ad->unit);
+               len += snprintf(extra+len, sizeof(extra)-len, "&%s=%d", "type", ad->record);
+
+               char buf_id[CAL_STR_MIDDLE_LEN] = {0};
+               snprintf(buf_id, sizeof(buf_id), "%d", ad->event_id);
+               app_control_add_extra_data(b, buf_id, extra); /* key: id, value: id=4&time=123123&.. */
+               DBG("value[%s]", extra);
+
+               /* append ids */
+               ids[i] = strdup(buf_id);
 
                l = g_list_next(l);
        }
@@ -847,25 +838,15 @@ static void _cal_server_alarm_noti_with_callback(GList *alarm_list)
                DBG("callback time[%lld] tick[%d] unit[%d] record_type[%d]",
                                ad->time, ad->tick, ad->unit, ad->record);
 
-               char buf_event_id[128] = {0};
-               char buf_time[128] = {0};
-               char buf_tick[128] = {0};
-               char buf_unit[128] = {0};
-               char buf_record_type[128] = {0};
-               snprintf(buf_event_id, sizeof(buf_event_id), "%d", ad->event_id);
-               snprintf(buf_time, sizeof(buf_time), "%lld", ad->time);
-               snprintf(buf_tick, sizeof(buf_tick), "%d", ad->tick);
-               snprintf(buf_unit, sizeof(buf_unit), "%d", ad->unit);
-               snprintf(buf_record_type, sizeof(buf_record_type), "%d", ad->record);
-
-               char *p = NULL;
-               cal_server_reminder_add_callback_data(&p, "id", buf_event_id);
-               cal_server_reminder_add_callback_data(&p, "time", buf_time);
-               cal_server_reminder_add_callback_data(&p, "tick", buf_tick);
-               cal_server_reminder_add_callback_data(&p, "unit", buf_unit);
-               cal_server_reminder_add_callback_data(&p, "type", buf_record_type);
-               cal_server_reminder_publish(p);
-               free(p);
+               int len = 0;
+               char extra[CAL_STR_MIDDLE_LEN] = {0};
+               len = snprintf(extra, sizeof(extra), "%s=%d", "id", ad->event_id);
+               len += snprintf(extra+len, sizeof(extra)-len, "&%s=%lld", "time", ad->time);
+               len += snprintf(extra+len, sizeof(extra)-len, "&%s=%d", "tick", ad->tick);
+               len += snprintf(extra+len, sizeof(extra)-len, "&%s=%d", "unit", ad->unit);
+               len += snprintf(extra+len, sizeof(extra)-len, "&%s=%d", "type", ad->record);
+
+               cal_server_reminder_publish(extra, len);
 
                l = g_list_next(l);
        }
@@ -901,7 +882,6 @@ static int _alert_cb(alarm_id_t alarm_id, void *data)
        DBG("alarm_id (%ld)", alarm_id);
 
        time_t tt_alert = 0;
-       char *zone_name = data;
        cal_server_alarm_get_alert_time(alarm_id, &tt_alert);
        cal_server_alarm_alert(tt_alert);
        _cal_server_alarm_unset_alerted_alarmmgr_id(alarm_id);
index d025e95..21a4af9 100644 (file)
 
 #define CAL_SUBSCRIBE_MAX_LEN 1024
 
-static gboolean _cal_server_reminder_publish_changes_with_data(char *data, int len)
+void cal_server_reminder_publish(char *p, int p_len)
 {
-       pims_ipc_data_h indata = NULL;
-       if (NULL == data)
-       {
-               ERR("Invalid parameter: data is NULL");
-               return true;
-       }
+       RET_IF(NULL == p);
 
+       pims_ipc_data_h indata = NULL;
        indata = pims_ipc_data_create(0);
-       if (NULL == indata)
-       {
-               ERR("pims_ipc_data_create() failed");
-               return false;
-       }
-       if (pims_ipc_data_put(indata, &len, sizeof(int)) != 0)
-       {
-               ERR("pims_ipc_data_put() failed");
+       RETM_IF(NULL == indata, "pims_ipc_data_create() Fail");
+
+       if (pims_ipc_data_put(indata, &p_len, sizeof(int)) != 0) {
+               ERR("pims_ipc_data_put() Fail");
                pims_ipc_data_destroy(indata);
-               return false;
+               return;
        }
-       if (pims_ipc_data_put(indata, data, strlen(data) + 1) != 0)
-       {
-               ERR("pims_ipc_data_put() failed");
+       if (pims_ipc_data_put(indata, p, p_len + 1) != 0) {
+               ERR("pims_ipc_data_put() Fail");
                pims_ipc_data_destroy(indata);
-               return false;
+               return;
        }
-       if (pims_ipc_svc_publish(CAL_IPC_MODULE_FOR_SUBSCRIPTION, (char *)CAL_NOTI_REMINDER_CAHNGED, indata) != 0)
-       {
-               ERR("pims_ipc_svc_publish() failed");
+       if (pims_ipc_svc_publish(CAL_IPC_MODULE_FOR_SUBSCRIPTION, (char *)CAL_NOTI_REMINDER_CAHNGED, indata) != 0) {
+               ERR("pims_ipc_svc_publish() Fail");
                pims_ipc_data_destroy(indata);
-               return false;
+               return;
        }
        pims_ipc_data_destroy(indata);
-       return true;
-}
-
-void cal_server_reminder_publish(char *p)
-{
-       RET_IF(NULL == p);
-       _cal_server_reminder_publish_changes_with_data(p, strlen(p));
 }
 
 int cal_server_reminder_add_callback_data(char **p, char *key, char *value)
index e13b168..7c78691 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef __CAL_SERVER_REMINDER_H__
 #define __CAL_SERVER_REMINDER_H__
 
-void cal_server_reminder_publish(char *p);
+void cal_server_reminder_publish(char *p, int p_len);
 int cal_server_reminder_add_callback_data(char **p, char *key, char *value);
 
 #endif  /* __CAL_SERVER_REMINDER_H__ */
index dd255d0..7ea9504 100644 (file)
@@ -62,7 +62,7 @@ int cal_server_update(void)
        sqlite3 *__db;
        char query[CAL_DB_SQL_MAX_LEN] = {0};
 
-       char db_file[256] = {0};
+       char db_file[CAL_STR_MIDDLE_LEN] = {0};
        snprintf(db_file, sizeof(db_file), "%s/%s", DB_PATH, CALS_DB_NAME);
        ret = db_util_open(db_file, &__db, 0);
        if (SQLITE_OK != ret) {
index 5e69b7a..b909cee 100644 (file)
@@ -77,7 +77,7 @@ static void __zone_iterate_cb(vsm_zone_h zone, void *user_data)
        }
 
        DBG("schema init");
-       char path[1024] = {0};
+       char path[CAL_STR_MIDDLE_LEN] = {0};
        int len = 0;
        len = cal_zone_get_root_path(zone_name, path, sizeof(path));
        snprintf(path+len, sizeof(path)-len, "%s", "/opt/usr/dbspace/");
@@ -128,7 +128,7 @@ static int __status_cb(vsm_zone_h zone, vsm_zone_state_t state, void *user_data)
        vsm_zone_h old_zone = NULL;
 
        int len = 0;
-       char path[1024] = {0};
+       char path[CAL_STR_MIDDLE_LEN] = {0};
        switch (state) {
        case VSM_ZONE_STATE_STARTING:
                DBG("STARTING");