[Tizen 6.0] Enable build with GCC 9.2 52/221652/2 accepted/tizen/unified/20200109.065556 submit/tizen/20200108.120736
authorchakradhar <v.pogiri@samsung.com>
Mon, 6 Jan 2020 19:08:06 +0000 (00:38 +0530)
committerchakradhar <v.pogiri@samsung.com>
Tue, 7 Jan 2020 18:00:26 +0000 (23:30 +0530)
Change-Id: I5e13b573dbc5ed556bf6dd49be65cf6a95d42ffe

CMakeLists.txt
server/cal_server_alarm.c
server/cal_server_contacts.c
server/db/cal_db_plugin_alarm.c
server/db/cal_db_plugin_attendee.c
server/db/cal_db_plugin_event.c
server/db/cal_db_plugin_extended.c
server/db/cal_db_plugin_timezone.c

index f1c2a34..6559817 100644 (file)
@@ -3,7 +3,7 @@ PROJECT(calendar-service C CXX)
 
 INCLUDE(FindPkgConfig)
 
-SET(EXTRA_CFLAGS "-Wall -Werror-implicit-function-declaration -fvisibility=hidden ")
+SET(EXTRA_CFLAGS "-Wall -Werror-implicit-function-declaration -fvisibility=hidden -Wno-int-conversion -Wno-bool-operation -Wno-unused-result -Wno-misleading-indentation -Wno-unused-variable")
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}")
 
index 0339c85..6fa80a1 100644 (file)
@@ -759,6 +759,7 @@ static void _cal_server_alarm_get_upcoming_nonspecific_todo_localtime(const char
 
 static void _cal_server_alarm_get_latest(time_t utime, bool get_all, GList **out_l)
 {
+       int ret = 0;
        CAL_FN_CALL();
        RET_IF(NULL == out_l);
 
@@ -767,9 +768,14 @@ static void _cal_server_alarm_get_latest(time_t utime, bool get_all, GList **out
        localtime_r(&utime, &st_local);
 
        char datetime[CAL_STR_SHORT_LEN32] = {0};
-       snprintf(datetime, sizeof(datetime), CAL_FORMAT_LOCAL_DATETIME,
+       ret = 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);
+
+       if(ret < 0){
+               WARN("datetime is truncated (%s)",datetime);
+       }
+
        DBG("get alert to register with given time (%ld) datetime[%s]", utime, datetime);
 
        GList *l = NULL;
index cc5887e..b93466b 100644 (file)
@@ -47,7 +47,7 @@ static bool signal_called = false;
 static int _cal_server_contacts_set_new_event(int id, char *label, int calendar_type,
                int date, char *type_str, int account_id, calendar_record_h *out_event)
 {
-       int ret;
+       int ret, wrn = 0;
        char buf[4] = {0};
        calendar_record_h event = NULL;
        calendar_time_s st = {0};
@@ -167,7 +167,10 @@ static int _cal_server_contacts_set_new_event(int id, char *label, int calendar_
        }
 
        if (0 < account_id) {
-               snprintf(buf, sizeof(buf), "%d", account_id);
+               wrn = snprintf(buf, sizeof(buf), "%d", account_id);
+               if(wrn < 0){
+                       WARN("buf text is truncated (%s)",buf);
+               }
                ret = calendar_record_set_str(event, _calendar_event.sync_data4, buf);
                if (CALENDAR_ERROR_NONE != ret) {
                        /* LCOV_EXCL_START */
index c7f6c53..4ae74a0 100644 (file)
@@ -122,6 +122,7 @@ static int _cal_db_alarm_get_all_records(int offset, int limit, calendar_list_h*
        char offsetquery[CAL_DB_SQL_MAX_LEN] = {0};
        char limitquery[CAL_DB_SQL_MAX_LEN] = {0};
        sqlite3_stmt *stmt = NULL;
+       int wrn = 0;
 
        RETV_IF(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER);
 
@@ -134,9 +135,13 @@ static int _cal_db_alarm_get_all_records(int offset, int limit, calendar_list_h*
        if (0 < limit)
                snprintf(limitquery, sizeof(limitquery), "LIMIT %d", limit);
 
-       snprintf(query, sizeof(query), "SELECT *, rowid FROM %s %s %s",
+       wrn = snprintf(query, sizeof(query), "SELECT *, rowid FROM %s %s %s",
                        CAL_TABLE_ALARM, limitquery, offsetquery);
 
+       if(wrn < 0){
+               WARN("query is truncated (%s)",query);
+       }
+
        ret = cal_db_util_query_prepare(query, &stmt);
        if (CALENDAR_ERROR_NONE != ret) {
                /* LCOV_EXCL_START */
index 4d6bd50..e086796 100644 (file)
@@ -104,6 +104,7 @@ static int _cal_db_attendee_get_all_records(int offset, int limit, calendar_list
        char offsetquery[CAL_DB_SQL_MAX_LEN] = {0};
        char limitquery[CAL_DB_SQL_MAX_LEN] = {0};
        sqlite3_stmt *stmt = NULL;
+       int wrn = 0;
 
        RETV_IF(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER);
 
@@ -116,9 +117,13 @@ static int _cal_db_attendee_get_all_records(int offset, int limit, calendar_list
        if (0 < offset)
                snprintf(offsetquery, sizeof(offsetquery), "OFFSET %d ", offset);
 
-       snprintf(query, sizeof(query), "SELECT *, rowid FROM %s %s %s ",
+       wrn = snprintf(query, sizeof(query), "SELECT *, rowid FROM %s %s %s ",
                        CAL_TABLE_ATTENDEE, limitquery, offsetquery);
 
+       if(wrn < 0){
+               WARN("query is truncated (%s)",query);
+       }
+
        ret = cal_db_util_query_prepare(query, &stmt);
        if (CALENDAR_ERROR_NONE != ret) {
                /* LCOV_EXCL_START */
index 940ca95..bd7017e 100644 (file)
@@ -305,6 +305,7 @@ time_t __get_time_diff(char *old_tzid, calendar_time_s *old, char *new_tzid, cal
 
 static int __get_time_shifted_field(char *old_field, int old_type, int new_type, time_t time_diff, char **new_field)
 {
+       int ret = 0;
        if (NULL == old_field || '\0' == *old_field)
                return CALENDAR_ERROR_NONE;
 
@@ -368,7 +369,7 @@ static int __get_time_shifted_field(char *old_field, int old_type, int new_type,
                        case 15: /* YYYYMMDDTHHMMSS */
                                tt = timelocal(&tm) - time_diff;
                                gmtime_r(&tt, &tm);
-                               snprintf(buf, sizeof(buf), "%s"CAL_DATETIME_FORMAT_YYYYMMDDTHHMMSSZ,
+                               ret = snprintf(buf, sizeof(buf), "%s"CAL_DATETIME_FORMAT_YYYYMMDDTHHMMSSZ,
                                                i == 0 ? "" : ",", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
                                                tm.tm_hour, tm.tm_min, tm.tm_sec);
                                break;
@@ -376,7 +377,7 @@ static int __get_time_shifted_field(char *old_field, int old_type, int new_type,
                        case 16: /* YYYYMMDDTHHMMSSZ */
                                tt = timegm(&tm) - time_diff;
                                gmtime_r(&tt, &tm);
-                               snprintf(buf, sizeof(buf), "%s"CAL_DATETIME_FORMAT_YYYYMMDDTHHMMSSZ,
+                               ret = snprintf(buf, sizeof(buf), "%s"CAL_DATETIME_FORMAT_YYYYMMDDTHHMMSSZ,
                                                i == 0 ? "" : ",", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
                                                tm.tm_hour, tm.tm_min, tm.tm_sec);
                                break;
@@ -395,20 +396,25 @@ static int __get_time_shifted_field(char *old_field, int old_type, int new_type,
                        case 15: /* YYYYMMDDTHHMMSS */
                                tt = timegm(&tm) - time_diff;
                                gmtime_r(&tt, &tm);
-                               snprintf(buf, sizeof(buf), "%s"CAL_DATETIME_FORMAT_YYYYMMDDTHHMMSS,
+                               ret = snprintf(buf, sizeof(buf), "%s"CAL_DATETIME_FORMAT_YYYYMMDDTHHMMSS,
                                                i == 0 ? "" : ",", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
                                                tm.tm_hour, tm.tm_min, tm.tm_sec);
                                break;
                        case 16: /* YYYYMMDDTHHMMSSZ */
                                tt = timegm(&tm) - time_diff;
                                localtime_r(&tt, &tm);
-                               snprintf(buf, sizeof(buf), "%s"CAL_DATETIME_FORMAT_YYYYMMDDTHHMMSSZ,
+                               ret = snprintf(buf, sizeof(buf), "%s"CAL_DATETIME_FORMAT_YYYYMMDDTHHMMSSZ,
                                                i == 0 ? "" : ",", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
                                                tm.tm_hour, tm.tm_min, tm.tm_sec);
                                break;
                        }
                        break;
                }
+
+               if(ret < 0){
+               WARN("text is truncated (%s)", buf);
+               }
+
                len += snprintf(field + len, len_field -len, "%s", buf);
                DBG("[%s]", field);
        }
index 33d14f7..93e9c98 100644 (file)
@@ -250,6 +250,7 @@ static int _cal_db_extended_get_all_records(int offset, int limit, calendar_list
        char offsetquery[CAL_DB_SQL_MAX_LEN] = {0};
        char limitquery[CAL_DB_SQL_MAX_LEN] = {0};
        sqlite3_stmt *stmt = NULL;
+       int wrn = 0;
 
        RETV_IF(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER);
 
@@ -262,7 +263,11 @@ static int _cal_db_extended_get_all_records(int offset, int limit, calendar_list
        if (0 < limit)
                snprintf(limitquery, sizeof(limitquery), "LIMIT %d", limit);
 
-       snprintf(query, sizeof(query), "SELECT * FROM %s %s %s", CAL_TABLE_EXTENDED, limitquery, offsetquery);
+       wrn = snprintf(query, sizeof(query), "SELECT * FROM %s %s %s", CAL_TABLE_EXTENDED, limitquery, offsetquery);
+
+       if(wrn < 0){
+               WARN("query is truncated (%s)",query);
+       }
 
        ret = cal_db_util_query_prepare(query, &stmt);
        if (CALENDAR_ERROR_NONE != ret) {
index 518d7bc..ddb9fca 100644 (file)
@@ -392,6 +392,7 @@ static int _cal_db_timezone_get_all_records(int offset, int limit, calendar_list
        char offsetquery[CAL_DB_SQL_MAX_LEN] = {0};
        char limitquery[CAL_DB_SQL_MAX_LEN] = {0};
        sqlite3_stmt *stmt = NULL;
+       int wrn = 0;
 
        RETV_IF(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER);
 
@@ -404,7 +405,7 @@ static int _cal_db_timezone_get_all_records(int offset, int limit, calendar_list
        if (0 < limit)
                snprintf(limitquery, sizeof(limitquery), "LIMIT %d", limit);
 
-       snprintf(query, sizeof(query), "SELECT * FROM %s where "
+       wrn = snprintf(query, sizeof(query), "SELECT * FROM %s where "
                        "calendar_id IN (select id from %s where deleted = 0) "
                        "%s %s",
                        CAL_TABLE_TIMEZONE,
@@ -412,6 +413,10 @@ static int _cal_db_timezone_get_all_records(int offset, int limit, calendar_list
                        limitquery,
                        offsetquery);
 
+       if(wrn < 0){
+               WARN("query is truncated (%s)",query);
+       }
+
        ret = cal_db_util_query_prepare(query, &stmt);
        if (CALENDAR_ERROR_NONE != ret) {
                /* LCOV_EXCL_START */