Apply coding guide : NULL check, strncmp, ... 62/44662/2
authorSunggoo Kim <sung.goo.kim@samsung.com>
Tue, 12 May 2015 01:54:44 +0000 (10:54 +0900)
committerMyungHoon Chae <mhoon.chae@samsung.com>
Mon, 27 Jul 2015 06:32:08 +0000 (23:32 -0700)
Change-Id: I4ebe11d3997cb2ae1ddfdd51af4cc117dbb1d084
Signed-off-by: MyoungHoon Chae <mhoon.chae@samsung.com>
45 files changed:
client/ctsvc_client_noti.c
client/ctsvc_client_setting.c
common/ctsvc_vcard.c
common/ipc/ctsvc_ipc_marshal.c
native/ctsvc_db_access_control.c
native/ctsvc_db_init.c
native/ctsvc_db_plugin_activity.c
native/ctsvc_db_plugin_activity_photo_helper.c
native/ctsvc_db_plugin_address_helper.c
native/ctsvc_db_plugin_company_helper.c
native/ctsvc_db_plugin_contact.c
native/ctsvc_db_plugin_contact_helper.c
native/ctsvc_db_plugin_email_helper.c
native/ctsvc_db_plugin_event_helper.c
native/ctsvc_db_plugin_extension_helper.c
native/ctsvc_db_plugin_group.c
native/ctsvc_db_plugin_image_helper.c
native/ctsvc_db_plugin_messenger_helper.c
native/ctsvc_db_plugin_my_profile.c
native/ctsvc_db_plugin_name_helper.c
native/ctsvc_db_plugin_nickname_helper.c
native/ctsvc_db_plugin_note_helper.c
native/ctsvc_db_plugin_number_helper.c
native/ctsvc_db_plugin_person_helper.c
native/ctsvc_db_plugin_profile_helper.c
native/ctsvc_db_plugin_relationship_helper.c
native/ctsvc_db_plugin_sdn.c
native/ctsvc_db_plugin_url_helper.c
native/ctsvc_db_query.c
native/ctsvc_localize.c
native/ctsvc_localize_ch.c
native/ctsvc_localize_kor.c
native/ctsvc_number_utils.c
native/ctsvc_person.c
native/ctsvc_setting.c
native/ctsvc_sqlite.c
native/ctsvc_utils.c
server/ctsvc_ipc_server.c
server/ctsvc_ipc_server2.c
server/ctsvc_server_change_subject.c
server/ctsvc_server_sim.c
server/ctsvc_server_socket.c
server/ctsvc_server_sqlite.c
server/ctsvc_server_utils.c
server/ctsvc_server_zone.c [deleted file]

index 3af86ac..dad1c87 100644 (file)
@@ -53,7 +53,7 @@ static void __ctsvc_db_subscriber_callback(pims_ipc_h ipc, pims_ipc_data_h data,
        if (data)
                str = (char*)pims_ipc_data_get(data, &size);
 
-       if (!str) {
+       if (NULL == str) {
                CTS_ERR("There is no changed data");
                return;
        }
@@ -85,11 +85,11 @@ int ctsvc_ipc_create_for_change_subscription()
                return CONTACTS_ERROR_NONE;
        }
 
-       if (!__ipc) {
+       if (NULL == __ipc) {
                char sock_file[CTSVC_PATH_MAX_LEN] = {0};
                snprintf(sock_file, sizeof(sock_file), CTSVC_SOCK_PATH"/.%s_for_subscribe", getuid(), CTSVC_IPC_SERVICE);
                __ipc = pims_ipc_create_for_subscribe(sock_file);
-               if (!__ipc) {
+               if (NULL == __ipc) {
                        CTS_ERR("pims_ipc_create_for_subscribe error\n");
                        ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB);
                        return CONTACTS_ERROR_IPC;
@@ -135,12 +135,12 @@ API int contacts_db_add_changed_cb_with_info(const char* view_uri,
        RETVM_IF(view_uri == NULL, CONTACTS_ERROR_INVALID_PARAMETER, "view_uri is NULL");
        RETVM_IF(cb == NULL, CONTACTS_ERROR_INVALID_PARAMETER, "cb is NULL");
 
-       if (strncmp(view_uri, CTSVC_VIEW_URI_PHONELOG, strlen(CTSVC_VIEW_URI_PHONELOG)) == 0) {
+       if (STRING_EQUAL == strncmp(view_uri, CTSVC_VIEW_URI_PHONELOG, strlen(CTSVC_VIEW_URI_PHONELOG))) {
                ret = ctsvc_ipc_client_check_permission(CTSVC_PERMISSION_PHONELOG_READ, &result);
                RETVM_IF(ret != CONTACTS_ERROR_NONE, ret, "ctsvc_ipc_client_check_permission fail (%d)", ret);
                RETVM_IF(result == false, CONTACTS_ERROR_PERMISSION_DENIED, "Permission denied (phonelog read)");
        }
-       else if (strncmp(view_uri, CTSVC_VIEW_URI_PERSON, strlen(CTSVC_VIEW_URI_PERSON)) == 0) {
+       else if (STRING_EQUAL == strncmp(view_uri, CTSVC_VIEW_URI_PERSON, strlen(CTSVC_VIEW_URI_PERSON))) {
                ret = ctsvc_ipc_client_check_permission(CTSVC_PERMISSION_CONTACT_READ, &result);
                RETVM_IF(ret != CONTACTS_ERROR_NONE, ret, "ctsvc_ipc_client_check_permission fail (%d)", ret);
                RETVM_IF(result == false, CONTACTS_ERROR_PERMISSION_DENIED, "Permission denied (contact read)");
@@ -153,7 +153,7 @@ API int contacts_db_add_changed_cb_with_info(const char* view_uri,
        ctsvc_mutex_lock(CTS_MUTEX_PIMS_IPC_PUBSUB);
 
        for (it=__db_change_subscribe_list;it;it=it->next) {
-               if (!it->data) continue;
+               if (NULL == it->data) continue;
 
                info = it->data;
                if (STRING_EQUAL == strcmp(info->view_uri, view_uri))
@@ -162,7 +162,7 @@ API int contacts_db_add_changed_cb_with_info(const char* view_uri,
                        info = NULL;
        }
 
-       if (!info) {
+       if (NULL == info) {
                info = calloc(1, sizeof(subscribe_info_s));
                if (NULL == info) {
                        CTS_ERR("calloc() Fail");
@@ -219,7 +219,7 @@ API int contacts_db_remove_changed_cb_with_info(const char* view_uri,
        ctsvc_mutex_lock(CTS_MUTEX_PIMS_IPC_PUBSUB);
 
        for (it=__db_change_subscribe_list;it;it=it->next) {
-               if (!it->data) continue;
+               if (NULL == it->data) continue;
 
                info = it->data;
                if (STRING_EQUAL == strcmp(info->view_uri, view_uri))
index 2082599..71ca785 100755 (executable)
@@ -199,7 +199,7 @@ API int contacts_setting_add_name_display_order_changed_cb(
 
        ctsvc_mutex_lock(CTS_MUTEX_PIMS_IPC_PUBSUB);
 
-       if (!__setting_name_display_order_subscribe_list) {
+       if (NULL == __setting_name_display_order_subscribe_list) {
                if (pims_ipc_subscribe(ctsvc_ipc_get_handle_for_change_subsciption(),
                                        CTSVC_IPC_SUBSCRIBE_MODULE, CTSVC_SETTING_DISPLAY_ORDER_CHANGED,
                                        __ctsvc_setting_name_display_order_subscriber_callback, NULL) != 0) {
@@ -296,7 +296,7 @@ API int contacts_setting_add_name_sorting_order_changed_cb(
 
        ctsvc_mutex_lock(CTS_MUTEX_PIMS_IPC_PUBSUB);
 
-       if (!__setting_name_sorting_order_subscribe_list) {
+       if (NULL == __setting_name_sorting_order_subscribe_list) {
                if (pims_ipc_subscribe(ctsvc_ipc_get_handle_for_change_subsciption(),
                                        CTSVC_IPC_SUBSCRIBE_MODULE, CTSVC_SETTING_SORTING_ORDER_CHANGED,
                                        __ctsvc_setting_name_sorting_order_subscriber_callback, NULL) != 0) {
index 83b5e86..9e03feb 100644 (file)
@@ -391,7 +391,7 @@ static inline int __ctsvc_vcard_add_folding(char **buf, int *buf_size, int buf_l
                if (false == content_start) {
                        if (':' == *s)
                                content_start = true;
-                       else if (0 == strncmp(s, "ENCODING=BASE64", strlen("ENCODING=BASE64")))
+                       else if (STRING_EQUAL == strncmp(s, "ENCODING=BASE64", strlen("ENCODING=BASE64")))
                                encode_64 = true;
                }
 
@@ -915,7 +915,7 @@ static inline int __ctsvc_vcard_append_nicknames(ctsvc_list_s *nickname_list, ch
                        }
                }
        }
-       if (!first)
+       if (false == first)
                CTSVC_VCARD_APPEND_STR(buf, buf_size, len, CTSVC_CRLF);
 
        return len;
@@ -1255,7 +1255,7 @@ static inline int __ctsvc_vcard_append_events(ctsvc_list_s *event_list, char **b
 
        for (cursor=event_list->records;cursor;cursor=cursor->next) {
                data = cursor->data;
-               if (!data->date) continue;
+               if (0 == data->date) continue;
 
                event[0] = '\0';
                if (CONTACTS_EVENT_TYPE_BIRTH == data->type) {
@@ -1467,7 +1467,7 @@ static inline int __ctsvc_vcard_put_photo(ctsvc_list_s *image_list, char **buf,
 
        for (cursor=image_list->records;cursor;cursor=cursor->next) {
                data = cursor->data;
-               if (!data->path) continue;
+               if (NULL == data->path) continue;
 
                suffix = strrchr(data->path, '.');
                type = __ctsvc_vcard_get_image_type(suffix);
@@ -2080,7 +2080,7 @@ static inline bool __ctsvc_vcard_check_base64_encoded(char *src)
        while (*tmp) {
                if ('B' == *tmp) {
                        ret = strncmp(tmp, "BASE64", sizeof("BASE64") - 1);
-                       if (!ret)
+                       if (STRING_EQUAL == ret)
                                return true;
                } else if (':' == *tmp || '\r' == *tmp) {
                        break;
@@ -2099,7 +2099,7 @@ static inline int __ctsvc_vcard_check_quoted(char *src, int max, int *quoted)
        while (*src && max) {
                if ('Q' == *src) {
                        ret = strncmp(src, "QUOTED-PRINTABLE", sizeof("QUOTED-PRINTABLE") - 1);
-                       if (!ret) {
+                       if (STRING_EQUAL == ret) {
                                *quoted = TRUE;
                                return TRUE;
                        }
@@ -2188,7 +2188,7 @@ static inline char* __ctsvc_vcard_translate_charset(char *src, int len)
        while (*val) {
                if ('C' == *val) {
                        ret = strncmp(val, "CHARSET", sizeof("CHARSET") - 1);
-                       if (!ret) {
+                       if (STRING_EQUAL == ret) {
                                val += sizeof("CHARSET");
                                break;
                        }
@@ -2655,7 +2655,7 @@ static inline void __ctsvc_vcard_get_event_type(contacts_record_h event, char *v
                }
                if (strstr(lower, "anniversary"))
                        type = CONTACTS_EVENT_TYPE_ANNIVERSARY;
-               else if (NULL != (result = strstr(lower, "x-"))) {
+               else if ((result = strstr(lower, "x-"))) {
                        type = CONTACTS_EVENT_TYPE_CUSTOM;
                        contacts_record_set_str(event, _contacts_event.label, temp+(result-lower)+2);
                }
@@ -3232,7 +3232,7 @@ static inline bool __ctsvc_vcard_get_email_type(contacts_record_h email, char *v
                        type = CONTACTS_EMAIL_TYPE_WORK;
                else if (strstr(lower, "cell"))
                        type = CONTACTS_EMAIL_TYPE_MOBILE;
-               else if (NULL != (result = strstr(lower, "x-"))) {
+               else if ((result = strstr(lower, "x-"))) {
                        type = CONTACTS_EMAIL_TYPE_CUSTOM;
                        contacts_record_set_str(email, _contacts_email.label, temp+(result-lower)+2);
                }
@@ -3478,7 +3478,7 @@ static inline void __ctsvc_vcard_get_relationship_type(contacts_record_h relatio
                        type = CONTACTS_RELATIONSHIP_TYPE_SISTER;
                else if (strstr(lower, "spouse"))
                        type = CONTACTS_RELATIONSHIP_TYPE_SPOUSE;
-               else if (NULL != (result = strstr(lower, "x-"))) {
+               else if ((result = strstr(lower, "x-"))) {
                        type = CONTACTS_RELATIONSHIP_TYPE_CUSTOM;
                        contacts_record_set_str(relationship, _contacts_relationship.label, temp+(result-lower)+2);
                }
@@ -3718,7 +3718,7 @@ static inline void __ctsvc_vcard_make_contact_display_name(ctsvc_contact_s *cont
        free(contact->reverse_display_name);
        contact->reverse_display_name = NULL;
 
-       if (0 < contact->name->count && contact->name->records != NULL && contact->name->records->data != NULL) {
+       if (0 < contact->name->count && contact->name->records && contact->name->records->data) {
                name = (ctsvc_name_s *)contact->name->records->data;
        }
 
@@ -3943,7 +3943,7 @@ static inline void __ctsvc_vcard_make_contact_display_name(ctsvc_contact_s *cont
                        }
                }
 
-               if (!set_display_name &&
+               if (false == set_display_name &&
                                contact->nicknames && contact->nicknames->records) {
                        for (cur=contact->nicknames->records;cur;cur=cur->next) {
                                ctsvc_nickname_s *nickname = (ctsvc_nickname_s *)cur->data;
@@ -3956,7 +3956,7 @@ static inline void __ctsvc_vcard_make_contact_display_name(ctsvc_contact_s *cont
                        }
                }
 
-               if (!set_display_name &&
+               if (false == set_display_name &&
                                contact->numbers && contact->numbers->records) {
                        for (cur=contact->numbers->records;cur;cur=cur->next) {
                                ctsvc_number_s *number = (ctsvc_number_s *)cur->data;
@@ -3969,7 +3969,7 @@ static inline void __ctsvc_vcard_make_contact_display_name(ctsvc_contact_s *cont
                        }
                }
 
-               if (!set_display_name &&
+               if (false == set_display_name &&
                                contact->emails && contact->emails->records) {
                        for (cur=contact->emails->records;cur;cur=cur->next) {
                                ctsvc_email_s *email = (ctsvc_email_s *)cur->data;
@@ -4100,7 +4100,7 @@ static const char* __contacts_vcard_parse_get_vcard_object(const char *cursor, G
 
        vcard_start_cursor = __contacts_vcard_remove_line_break(vcard_start_cursor);
 
-       if (0 != strncmp(vcard_start_cursor, begin, strlen(begin)))
+       if (STRING_EQUAL != strncmp(vcard_start_cursor, begin, strlen(begin)))
                return vcard_start_cursor;
 
        vcard_cursor = vcard_start_cursor;
@@ -4110,7 +4110,7 @@ static const char* __contacts_vcard_parse_get_vcard_object(const char *cursor, G
 
        while (*vcard_cursor) {
                if (new_line) {
-                       if (0 == strncmp(vcard_cursor, end, strlen(end))) {
+                       if (STRING_EQUAL == strncmp(vcard_cursor, end, strlen(end))) {
                                GList *sub_vcard_cursor = NULL;
                                int vcard_len = 0;
                                const char *pos_start = NULL;
@@ -4143,7 +4143,7 @@ static const char* __contacts_vcard_parse_get_vcard_object(const char *cursor, G
 
                                return vcard_cursor;
                        }
-                       else if (0 == strncmp(vcard_cursor, begin, strlen(begin))) { // sub vcard
+                       else if (STRING_EQUAL == strncmp(vcard_cursor, begin, strlen(begin))) { // sub vcard
                                sub_vcard_info_s *sub_vcard_info = calloc(1, sizeof(sub_vcard_info_s));
                                sub_vcard_info->pos_start = vcard_cursor;
 
@@ -4239,7 +4239,7 @@ API int contacts_vcard_parse_to_contact_foreach(const char *vcard_file_name,
 
        while (fgets(line, sizeof(line), file)) {
                if (0 == len)
-                       if (strncmp(line, "BEGIN:VCARD", strlen("BEGIN:VCARD")))
+                       if (STRING_EQUAL != strncmp(line, "BEGIN:VCARD", strlen("BEGIN:VCARD")))
                                continue;
 
                if (len + sizeof(line) < buf_size)
@@ -4259,7 +4259,7 @@ API int contacts_vcard_parse_to_contact_foreach(const char *vcard_file_name,
                        len += snprintf(stream + len, buf_size - len, "%s", line);
                }
 
-               if (0 == strncmp(line, "END:VCARD", 9)) {
+               if (STRING_EQUAL == strncmp(line, "END:VCARD", 9)) {
                        vcard_depth--;
 
                        if (0 == vcard_depth) {
@@ -4288,7 +4288,7 @@ API int contacts_vcard_parse_to_contact_foreach(const char *vcard_file_name,
                                                        return ret;
                                                }
 
-                                               if (!cb(record, data)) {
+                                               if (false == cb(record, data)) {
                                                        free(stream);
                                                        fclose(file);
                                                        __contacts_vcard_free_vcard_object_list(list_vcard_object);
@@ -4302,7 +4302,7 @@ API int contacts_vcard_parse_to_contact_foreach(const char *vcard_file_name,
                                }
                        }
                }
-               else if (0 == strncmp(line, "BEGIN:VCARD", 11)) { // sub vcard object
+               else if (STRING_EQUAL == strncmp(line, "BEGIN:VCARD", 11)) { // sub vcard object
                        vcard_depth++;
                }
        }
@@ -4327,7 +4327,7 @@ API int contacts_vcard_get_entity_count(const char *vcard_file_name, int *count)
 
        cnt = 0;
        while (fgets(line, sizeof(line), file)) {
-               if (0 == strncmp(line, "END:VCARD", 9))
+               if (STRING_EQUAL == strncmp(line, "END:VCARD", 9))
                        cnt++;
        }
        fclose(file);
index c812f73..277ee36 100644 (file)
@@ -689,7 +689,7 @@ int ctsvc_ipc_marshal_string(const char* bufchar, pims_ipc_data_h ipc_data)
 
        RETV_IF(ipc_data==NULL,CONTACTS_ERROR_INVALID_PARAMETER);
 
-       if (bufchar != NULL) {
+       if (bufchar) {
                int length = strlen(bufchar);
                if (pims_ipc_data_put(ipc_data,(void*)&length,sizeof(int)) != 0) {
                        ret = CONTACTS_ERROR_OUT_OF_MEMORY;
index d0dbf5d..4ecd67d 100644 (file)
@@ -93,7 +93,7 @@ int ctsvc_have_file_read_permission(const char *path)
        ctsvc_mutex_lock(CTS_MUTEX_ACCESS_CONTROL);
        thread_id = (unsigned int)pthread_self();
        find = __ctsvc_find_access_info(thread_id);
-       if (!find) {
+       if (NULL == find) {
                CTS_ERR("does not have access info of the thread");
                free(file_label);
                ctsvc_mutex_unlock(CTS_MUTEX_ACCESS_CONTROL);
@@ -309,7 +309,7 @@ bool ctsvc_have_ab_write_permission(int addressbook_id)
        ctsvc_mutex_lock(CTS_MUTEX_ACCESS_CONTROL);
        thread_id = (unsigned int)pthread_self();
        find = __ctsvc_find_access_info(thread_id);
-       if (!find) {
+       if (NULL == find) {
                ctsvc_mutex_unlock(CTS_MUTEX_ACCESS_CONTROL);
                CTS_ERR("can not found access info");
                return false;
index 6e1a193..095522c 100644 (file)
@@ -168,7 +168,7 @@ int ctsvc_db_plugin_deinit()
                return;
 #endif
 
-       if (!__ctsvc_db_view_hash_table) {
+       if (NULL == __ctsvc_db_view_hash_table) {
                return CONTACTS_ERROR_NONE;
        }
        g_hash_table_destroy(__ctsvc_db_view_hash_table);
index 0182cfa..9465ba3 100644 (file)
@@ -358,7 +358,7 @@ static int __ctsvc_db_activity_get_records_with_query(contacts_query_h query, in
        else
                had_activity_id = true;
 
-       if (!had_activity_id) {
+       if (false == had_activity_id) {
                s_query->projection = realloc(s_query->projection, s_query->projection_count+1);
                s_query->projection[s_query->projection_count] = CTSVC_PROPERTY_ACTIVITY_ID;
                s_query->projection_count++;
index f2b2fff..02208c2 100644 (file)
@@ -100,7 +100,7 @@ int ctsvc_db_activity_photo_update(contacts_record_h record)
        ctsvc_activity_photo_s *activity_photo = (ctsvc_activity_photo_s*)record;
        char query[CTS_SQL_MIN_LEN] = {0};
 
-       RETVM_IF(!activity_photo->id, CONTACTS_ERROR_INVALID_PARAMETER, "activity_photo has no ID.");
+       RETVM_IF(0 == activity_photo->id, CONTACTS_ERROR_INVALID_PARAMETER, "activity_photo has no ID.");
        RETVM_IF(CTSVC_PROPERTY_FLAG_DIRTY != (activity_photo->base.property_flag & CTSVC_PROPERTY_FLAG_DIRTY), CONTACTS_ERROR_NONE, "No update");
 
        snprintf(query, sizeof(query),
index e9b6551..12e112c 100644 (file)
@@ -132,7 +132,7 @@ int ctsvc_db_address_insert(contacts_record_h record, int contact_id, bool is_my
                                __ctsvc_db_address_reset_default(address_id, contact_id);
                }
 
-               if (!is_my_profile)
+               if (false == is_my_profile)
                        ctsvc_set_address_noti();
        }
 
@@ -169,7 +169,7 @@ int ctsvc_db_address_update(contacts_record_h record, bool is_my_profile)
        do {
                if (CONTACTS_ERROR_NONE != (ret = ctsvc_db_create_set_query(record, &set, &bind_text))) break;
                if (CONTACTS_ERROR_NONE != (ret = ctsvc_db_update_record_with_set_query(set, bind_text, CTS_TABLE_DATA, address->id))) break;
-               if (!is_my_profile)
+               if (false == is_my_profile)
                        ctsvc_set_address_noti();
        } while (0);
 
@@ -195,7 +195,7 @@ int ctsvc_db_address_delete(int id, bool is_my_profile)
        ret = ctsvc_query_exec(query);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
 
-       if (!is_my_profile)
+       if (false == is_my_profile)
                ctsvc_set_address_noti();
 
        return ret;
index 468bb7b..0d5678a 100644 (file)
@@ -136,7 +136,7 @@ int ctsvc_db_company_insert(contacts_record_h record, int contact_id, bool is_my
                if (id)
                        *id = company_id;
 
-               if (!is_my_profile)
+               if (false == is_my_profile)
                        ctsvc_set_company_noti();
        }
        return CONTACTS_ERROR_NONE;
@@ -201,7 +201,7 @@ int ctsvc_db_company_update(contacts_record_h record, int contact_id, bool is_my
        ctsvc_company_s *company = (ctsvc_company_s*)record;
        cts_stmt stmt = NULL;
 
-       RETVM_IF(!company->id, CONTACTS_ERROR_INVALID_PARAMETER, "company of contact has no ID.");
+       RETVM_IF(0 == company->id, CONTACTS_ERROR_INVALID_PARAMETER, "company of contact has no ID.");
        RETVM_IF(CTSVC_PROPERTY_FLAG_DIRTY != (company->base.property_flag & CTSVC_PROPERTY_FLAG_DIRTY), CONTACTS_ERROR_NONE, "No update");
 
        snprintf(query, sizeof(query),
@@ -250,7 +250,7 @@ int ctsvc_db_company_update(contacts_record_h record, int contact_id, bool is_my
                }
 
                // add new logo file
-               if (!same && company->logo) {
+               if (false == same && company->logo) {
                        char dest[CTSVC_IMG_FULL_PATH_SIZE_MAX] = {0};
                        if (false == check_permission) {
                                ret = ctsvc_have_file_read_permission(company->logo);
@@ -276,7 +276,7 @@ int ctsvc_db_company_update(contacts_record_h record, int contact_id, bool is_my
        do {
                if (CONTACTS_ERROR_NONE != (ret = ctsvc_db_create_set_query(record, &set, &bind_text))) break;
                if (CONTACTS_ERROR_NONE != (ret = ctsvc_db_update_record_with_set_query(set, bind_text, CTS_TABLE_DATA, company->id))) break;
-               if (!is_my_profile)
+               if (false == is_my_profile)
                        ctsvc_set_company_noti();
        } while (0);
 
@@ -301,7 +301,7 @@ int ctsvc_db_company_delete(int id, bool is_my_profile)
 
        ret = ctsvc_query_exec(query);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
-       if (!is_my_profile)
+       if (false == is_my_profile)
                ctsvc_set_company_noti();
 
        return CONTACTS_ERROR_NONE;
index da17c4f..2b2508e 100644 (file)
@@ -526,7 +526,7 @@ static inline int __ctsvc_contact_make_search_data(int contact_id, ctsvc_contact
                contacts_list_first(number_list);
                do {
                        contacts_list_get_current_record_p(number_list, (contacts_record_h*)&number_record);
-                       if (NULL != number_record && number_record->cleaned) {
+                       if (number_record && number_record->cleaned) {
                                buf_size = SAFE_STRLEN(number) + SAFE_STRLEN(number_record->cleaned) + SAFE_STRLEN(number_record->normalized) + 3;
                                temp_number = calloc(1, buf_size);
                                if (number)
@@ -545,7 +545,7 @@ static inline int __ctsvc_contact_make_search_data(int contact_id, ctsvc_contact
                contacts_list_first(email_list);
                do {
                        contacts_list_get_current_record_p(email_list, (contacts_record_h*)&email);
-                       if (NULL != email && email->email_addr) {
+                       if (email && email->email_addr) {
                                int len = strlen(email->email_addr);
                                char temp[len+1];
                                bool had = __ctsvc_contact_check_token(email->email_addr, temp, len);
@@ -568,7 +568,7 @@ static inline int __ctsvc_contact_make_search_data(int contact_id, ctsvc_contact
                contacts_list_first(nickname_list);
                do {
                        contacts_list_get_current_record_p(nickname_list, (contacts_record_h*)&nickname);
-                       if (NULL != nickname && nickname->nickname) {
+                       if (nickname && nickname->nickname) {
                                int len = strlen(nickname->nickname);
                                char temp[len+1];
                                bool had = __ctsvc_contact_check_token(nickname->nickname, temp, len);
@@ -591,7 +591,7 @@ static inline int __ctsvc_contact_make_search_data(int contact_id, ctsvc_contact
                contacts_list_first(address_list);
                do {
                        contacts_list_get_current_record_p(address_list, (contacts_record_h*)&address);
-                       if (NULL != address) {
+                       if (address) {
                                bool had;
                                int str_len = SAFE_STRLEN(address->country)
                                                        + SAFE_STRLEN(address->pobox)
@@ -650,7 +650,7 @@ static inline int __ctsvc_contact_make_search_data(int contact_id, ctsvc_contact
                contacts_list_first(note_list);
                do {
                        contacts_list_get_current_record_p(note_list, (contacts_record_h*)&note);
-                       if (NULL != note && note->note) {
+                       if (note && note->note) {
                                int len = strlen(note->note);
                                char temp[len+1];
                                bool had = __ctsvc_contact_check_token(note->note, temp, len);
@@ -673,7 +673,7 @@ static inline int __ctsvc_contact_make_search_data(int contact_id, ctsvc_contact
                contacts_list_first(messenger_list);
                do {
                        contacts_list_get_current_record_p(messenger_list, (contacts_record_h*)&messenger);
-                       if (NULL != messenger && messenger->im_id) {
+                       if (messenger && messenger->im_id) {
                                int len = strlen(messenger->im_id);
                                char temp[len+1];
                                bool had = __ctsvc_contact_check_token(messenger->im_id, temp, len);
@@ -696,7 +696,7 @@ static inline int __ctsvc_contact_make_search_data(int contact_id, ctsvc_contact
                contacts_list_first(relationship_list);
                do {
                        contacts_list_get_current_record_p(relationship_list, (contacts_record_h*)&relationship);
-                       if (NULL != relationship && relationship->name) {
+                       if (relationship && relationship->name) {
                                int len = strlen(relationship->name);
                                char temp[len+1];
                                bool had = __ctsvc_contact_check_token(relationship->name, temp, len);
@@ -719,7 +719,7 @@ static inline int __ctsvc_contact_make_search_data(int contact_id, ctsvc_contact
                contacts_list_first(company_list);
                do {
                        contacts_list_get_current_record_p(company_list, (contacts_record_h*)&company);
-                       if (NULL != company) {
+                       if (company) {
                                bool had;
                                int str_len = SAFE_STRLEN(company->name)
                                                        + SAFE_STRLEN(company->department)
@@ -817,7 +817,7 @@ static inline int __ctsvc_contact_refresh_lookup_data(int contact_id, ctsvc_cont
                // name record of contact should be one
                do {
                        contacts_list_get_current_record_p(name_list, (contacts_record_h*)&name_record);
-                       if (NULL != name_record
+                       if (name_record
                                        && (name_record->last || name_record->first || name_record->addition || name_record->suffix)) {
                                char *normalized_name = NULL;
 
@@ -897,7 +897,7 @@ static inline int __ctsvc_contact_refresh_lookup_data(int contact_id, ctsvc_cont
                len = 0;
                do {
                        contacts_list_get_current_record_p(number_list, (contacts_record_h*)&number_record);
-                       if (NULL != number_record && number_record->number) {
+                       if (number_record && number_record->number) {
                                if (NULL == number_record->cleaned)
                                        continue;
 
@@ -940,7 +940,7 @@ static inline int __ctsvc_contact_refresh_lookup_data(int contact_id, ctsvc_cont
                contacts_list_first(nickname_list);
                do {
                        contacts_list_get_current_record_p(nickname_list, (contacts_record_h*)&nickname);
-                       if (NULL != nickname && NULL != nickname->nickname) {
+                       if (nickname && nickname->nickname) {
                                char *normalized_nickname = NULL;
                                ctsvc_normalize_str(nickname->nickname, &normalized_nickname);
                                snprintf(query, sizeof(query), "INSERT INTO %s(data_id, contact_id, name, type) "
@@ -1142,8 +1142,8 @@ static int __ctsvc_db_contact_update_record(contacts_record_h record)
 
                        image = (ctsvc_image_s*)record_image;
 
-                       if ((NULL == contact->image_thumbnail_path && NULL != image->path) ||
-                                       (NULL != contact->image_thumbnail_path && NULL == image->path) ||
+                       if ((NULL == contact->image_thumbnail_path && image->path) ||
+                                       (contact->image_thumbnail_path && NULL == image->path) ||
                                        (contact->image_thumbnail_path && image->path && STRING_EQUAL != strcmp(contact->image_thumbnail_path, image->path))) {
                                ctsvc_record_set_property_flag((ctsvc_record_s *)contact, _contacts_contact.image_thumbnail_path, CTSVC_PROPERTY_FLAG_DIRTY);
 
@@ -1157,7 +1157,7 @@ static int __ctsvc_db_contact_update_record(contacts_record_h record)
                        free(contact->image_thumbnail_path);
                        contact->image_thumbnail_path = NULL;
                        bool is_changed = ctsvc_record_check_property_flag((ctsvc_record_s *)contact, _contacts_contact.image_thumbnail_path, CTSVC_PROPERTY_FLAG_DIRTY);
-                       if ((!is_changed && !is_invalid) || (is_changed && !is_invalid)) {
+                       if ((false == is_changed && false == is_invalid) || (is_changed && false == is_invalid)) {
                                ctsvc_record_set_property_flag((ctsvc_record_s *)contact, _contacts_contact.image_thumbnail_path, CTSVC_PROPERTY_FLAG_DIRTY);
                        }
                        else {
@@ -1374,7 +1374,7 @@ static int __ctsvc_db_contact_get_records_with_query(contacts_query_h query, int
        else
                had_contact_id = true;
 
-       if (!had_contact_id) {
+       if (0 == had_contact_id) {
                s_query->projection = realloc(s_query->projection, s_query->projection_count+1);
                s_query->projection[s_query->projection_count] = CTSVC_PROPERTY_CONTACT_ID;
                s_query->projection_count++;
@@ -2014,7 +2014,7 @@ static int __ctsvc_db_contact_insert_record(contacts_record_h record, int *id)
                        "VALUES(%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, ?, ?, %d, %d, %d, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
                        contact->id, contact->person_id, contact->addressbook_id, contact->is_favorite,
                        version, version, (int)time(NULL), contact->link_mode,
-                       (NULL !=contact->image_thumbnail_path)?version:0, contact->has_phonenumber, contact->has_email,
+                       (contact->image_thumbnail_path)?version:0, contact->has_phonenumber, contact->has_email,
                        contact->display_source_type, contact->display_name_language, contact->reverse_display_name_language);
 
        ret = ctsvc_query_prepare(query, &stmt);
@@ -2207,8 +2207,8 @@ static int __ctsvc_db_contact_replace_record(contacts_record_h record, int conta
                        }
 
                        image = (ctsvc_image_s*)record_image;
-                       if ((NULL == contact->image_thumbnail_path && NULL != image->path) ||
-                                       (NULL != contact->image_thumbnail_path && NULL == image->path) ||
+                       if ((NULL == contact->image_thumbnail_path && image->path) ||
+                                       (contact->image_thumbnail_path && NULL == image->path) ||
                                        (contact->image_thumbnail_path && image->path && STRING_EQUAL != strcmp(contact->image_thumbnail_path, image->path))) {
                                ctsvc_record_set_property_flag((ctsvc_record_s *)contact, _contacts_contact.image_thumbnail_path, CTSVC_PROPERTY_FLAG_DIRTY);
 
@@ -2221,7 +2221,7 @@ static int __ctsvc_db_contact_replace_record(contacts_record_h record, int conta
                else if (contact->image_thumbnail_path) {
                        free(contact->image_thumbnail_path);
                        contact->image_thumbnail_path = NULL;
-                       if (!ctsvc_record_check_property_flag((ctsvc_record_s *)contact, _contacts_contact.image_thumbnail_path, CTSVC_PROPERTY_FLAG_DIRTY)) {
+                       if (false == ctsvc_record_check_property_flag((ctsvc_record_s *)contact, _contacts_contact.image_thumbnail_path, CTSVC_PROPERTY_FLAG_DIRTY)) {
                                ctsvc_record_set_property_flag((ctsvc_record_s *)contact, _contacts_contact.image_thumbnail_path, CTSVC_PROPERTY_FLAG_DIRTY);
                        }
                        else {
index 8026e63..776bbfb 100644 (file)
@@ -146,7 +146,7 @@ bool ctsvc_contact_check_image_location(const char *path)
        if (len != strlen(CTSVC_CONTACT_IMG_FULL_LOCATION))
                return false;
 
-       if (strncmp(path, CTSVC_CONTACT_IMG_FULL_LOCATION, len) == 0)
+       if (STRING_EQUAL == strncmp(path, CTSVC_CONTACT_IMG_FULL_LOCATION, len))
                return true;
 
        return false;
@@ -329,7 +329,7 @@ static inline void __ctsvc_contact_get_initial(char *src, char *dest, int dest_s
                        int k;
                        for (k=0;k<char_len && j < (dest_size-1) ;k++)
                                dest[j++] = src[i++];
-                       if (!pinyin && j < (dest_size-1))
+                       if (false == pinyin && j < (dest_size-1))
                                dest[j++] = ' ';
                        bFirst = false;
                }
@@ -380,7 +380,7 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name)
                        }
                        else {
                                char *langset = ctsvc_get_langset();
-                               if (strncmp(langset, "zh_CN", strlen("zh_CN")) == 0) {
+                               if (STRING_EQUAL == strncmp(langset, "zh_CN", strlen("zh_CN"))) {
                                        pinyin_name_s *pinyinname;
                                        int size, i, len;
 
@@ -511,7 +511,7 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name)
                int temp_len = 0;
 
                contacts_list_get_current_record_p(name_list, (contacts_record_h*)&name_record);
-               if (NULL != name_record) {
+               if (name_record) {
                        buf_size = SAFE_STRLEN(name_record->phonetic_first) + SAFE_STRLEN(name_record->phonetic_last) + SAFE_STRLEN(name_record->phonetic_middle);
                        if (0 < buf_size) {
                                buf_size += 3; // for space and null string
@@ -661,8 +661,8 @@ void ctsvc_contact_make_sortkey(ctsvc_contact_s *contact)
        int sort_type = -1;
 
        if (contact->display_source_type == CONTACTS_DISPLAY_NAME_SOURCE_TYPE_NAME) {
-               if ( 0 < contact->name->count && contact->name->records != NULL
-                               && contact->name->records->data != NULL) {
+               if (0 < contact->name->count && contact->name->records
+                               && contact->name->records->data) {
                        ctsvc_name_s *name = (ctsvc_name_s *)contact->name->records->data;
                        __ctsvc_make_phonetic_name(name, &phonetic, CONTACTS_NAME_DISPLAY_ORDER_FIRSTLAST);
                }
@@ -681,7 +681,7 @@ void ctsvc_contact_make_sortkey(ctsvc_contact_s *contact)
        switch (sort_type) {
        case CTSVC_SORT_CJK:
                {
-                       if (strncmp(langset, "zh_CN", strlen("zh_CN")) == 0) { // chinese to pinyin
+                       if (STRING_EQUAL == strncmp(langset, "zh_CN", strlen("zh_CN"))) { // chinese to pinyin
                                char *pinyin = NULL;
                                if (phonetic)
                                        __ctsvc_get_sort_name_to_pinyin(phonetic, &pinyin);
@@ -694,7 +694,7 @@ void ctsvc_contact_make_sortkey(ctsvc_contact_s *contact)
                                        sort_type = CTSVC_SORT_WESTERN;
                                }
                        }
-                       else if (strncmp(langset, "ko_KR", strlen("ko_KR")) == 0) {
+                       else if (STRING_EQUAL == strncmp(langset, "ko_KR", strlen("ko_KR"))) {
                                        sort_type = CTSVC_SORT_KOREAN;
                        }
                }
@@ -733,8 +733,8 @@ void ctsvc_contact_make_sortkey(ctsvc_contact_s *contact)
        // check reverse sort_name, reverser_display_name_language
        // make reverse phonetic name
        if (contact->display_source_type == CONTACTS_DISPLAY_NAME_SOURCE_TYPE_NAME) {
-               if ( 0 < contact->name->count && contact->name->records != NULL
-                               && contact->name->records->data != NULL) {
+               if (0 < contact->name->count && contact->name->records
+                               && contact->name->records->data) {
                        ctsvc_name_s *name = (ctsvc_name_s *)contact->name->records->data;
                        __ctsvc_make_phonetic_name(name, &phonetic, CONTACTS_NAME_DISPLAY_ORDER_LASTFIRST);
                }
@@ -752,7 +752,7 @@ void ctsvc_contact_make_sortkey(ctsvc_contact_s *contact)
        switch (sort_type) {
        case CTSVC_SORT_CJK:
                {
-                       if (strncmp(langset, "zh_CN", strlen("zh_CN")) == 0) {
+                       if (STRING_EQUAL == strncmp(langset, "zh_CN", strlen("zh_CN"))) {
                                char *pinyin = NULL;
                                if (phonetic)
                                        __ctsvc_get_sort_name_to_pinyin(phonetic, &pinyin);
@@ -765,7 +765,7 @@ void ctsvc_contact_make_sortkey(ctsvc_contact_s *contact)
                                        sort_type = CTSVC_SORT_WESTERN;
                                }
                        }
-                       else if (strncmp(langset, "ko_KR", strlen("ko_KR")) == 0) {
+                       else if (STRING_EQUAL == strncmp(langset, "ko_KR", strlen("ko_KR"))) {
                                        sort_type = CTSVC_SORT_KOREAN;
                        }
                }
@@ -932,7 +932,7 @@ void ctsvc_contact_make_display_name(ctsvc_contact_s *contact)
 
        contact->display_source_type = CONTACTS_DISPLAY_NAME_SOURCE_TYPE_INVALID;
 
-       if ( 0 < contact->name->count && contact->name->records != NULL && contact->name->records->data != NULL) {
+       if (0 < contact->name->count && contact->name->records && contact->name->records->data) {
                name = (ctsvc_name_s *)contact->name->records->data;
        }
 
@@ -1171,7 +1171,7 @@ void ctsvc_contact_make_display_name(ctsvc_contact_s *contact)
                        }
                }
 
-               if (!ctsvc_record_check_property_flag((ctsvc_record_s *)contact, _contacts_contact.display_name, CTSVC_PROPERTY_FLAG_DIRTY) &&
+               if (false == ctsvc_record_check_property_flag((ctsvc_record_s *)contact, _contacts_contact.display_name, CTSVC_PROPERTY_FLAG_DIRTY) &&
                                contact->nicknames && contact->nicknames->records) {
                        for (cur=contact->nicknames->records;cur;cur=cur->next) {
                                ctsvc_nickname_s *nickname = (ctsvc_nickname_s *)cur->data;
@@ -1184,7 +1184,7 @@ void ctsvc_contact_make_display_name(ctsvc_contact_s *contact)
                        }
                }
 
-               if (!ctsvc_record_check_property_flag((ctsvc_record_s *)contact, _contacts_contact.display_name, CTSVC_PROPERTY_FLAG_DIRTY) &&
+               if (false == ctsvc_record_check_property_flag((ctsvc_record_s *)contact, _contacts_contact.display_name, CTSVC_PROPERTY_FLAG_DIRTY) &&
                                contact->numbers && contact->numbers->records) {
                        for (cur=contact->numbers->records;cur;cur=cur->next) {
                                ctsvc_number_s *number = (ctsvc_number_s *)cur->data;
@@ -1197,7 +1197,7 @@ void ctsvc_contact_make_display_name(ctsvc_contact_s *contact)
                        }
                }
 
-               if (!ctsvc_record_check_property_flag((ctsvc_record_s *)contact, _contacts_contact.display_name, CTSVC_PROPERTY_FLAG_DIRTY) &&
+               if (false == ctsvc_record_check_property_flag((ctsvc_record_s *)contact, _contacts_contact.display_name, CTSVC_PROPERTY_FLAG_DIRTY) &&
                                contact->emails && contact->emails->records) {
                        for (cur=contact->emails->records;cur;cur=cur->next) {
                                ctsvc_email_s *email = (ctsvc_email_s *)cur->data;
@@ -1390,7 +1390,7 @@ bool ctsvc_contact_check_default_number(contacts_list_h number_list)
        contacts_list_first(number_list);
        do {
                contacts_list_get_current_record_p(number_list, (contacts_record_h*)&number);
-               if (NULL != number && number->number && *number->number) {
+               if (number && number->number && *number->number) {
                        if (number->is_default && false == has_default)
                                has_default = true;
                        else if (has_default)
@@ -1402,7 +1402,7 @@ bool ctsvc_contact_check_default_number(contacts_list_h number_list)
                contacts_list_first(number_list);
                do {
                        contacts_list_get_current_record_p(number_list, (contacts_record_h*)&number);
-                       if (NULL != number && number->number && *number->number) {
+                       if (number && number->number && *number->number) {
                                number->is_default = true;
                                ctsvc_record_set_property_flag((ctsvc_record_s *)number, _contacts_number.is_default, CTSVC_PROPERTY_FLAG_DIRTY);
                                has_default = true;
@@ -1429,7 +1429,7 @@ bool ctsvc_contact_check_default_email(contacts_list_h email_list)
        contacts_list_first(email_list);
        do {
                contacts_list_get_current_record_p(email_list, (contacts_record_h*)&email);
-               if (NULL != email && email->email_addr && *email->email_addr) {
+               if (email && email->email_addr && *email->email_addr) {
                        if (email->is_default && false == has_default)
                                has_default = true;
                        else if (has_default)
@@ -1441,7 +1441,7 @@ bool ctsvc_contact_check_default_email(contacts_list_h email_list)
                contacts_list_first(email_list);
                do {
                        contacts_list_get_current_record_p(email_list, (contacts_record_h*)&email);
-                       if (NULL != email && email->email_addr && *email->email_addr) {
+                       if (email && email->email_addr && *email->email_addr) {
                                email->is_default = true;
                                ctsvc_record_set_property_flag((ctsvc_record_s *)email, _contacts_email.is_default, CTSVC_PROPERTY_FLAG_DIRTY);
                                has_default = true;
@@ -1470,7 +1470,7 @@ bool ctsvc_contact_check_default_image(contacts_list_h image_list)
        contacts_list_first(image_list);
        do {
                contacts_list_get_current_record_p(image_list, (contacts_record_h*)&image);
-               if (NULL != image && image->path && *image->path) {
+               if (image && image->path && *image->path) {
                        if (image->is_default && false == has_default)
                                has_default = true;
                        else if (has_default)
@@ -1482,7 +1482,7 @@ bool ctsvc_contact_check_default_image(contacts_list_h image_list)
                contacts_list_first(image_list);
                do {
                        contacts_list_get_current_record_p(image_list, (contacts_record_h*)&image);
-                       if (NULL != image && image->path && *image->path) {
+                       if (image && image->path && *image->path) {
                                image->is_default = true;
                                ctsvc_record_set_property_flag((ctsvc_record_s *)image, _contacts_image.is_default, CTSVC_PROPERTY_FLAG_DIRTY);
                                has_default = true;
@@ -1511,7 +1511,7 @@ bool ctsvc_contact_check_default_address(contacts_list_h address_list)
        contacts_list_first(address_list);
        do {
                contacts_list_get_current_record_p(address_list, (contacts_record_h*)&address);
-               if (NULL != address &&
+               if (address &&
                                                (address->pobox || address->postalcode || address->region || address->locality
                                                        || address->street || address->extended || address->country)) {
                        if (address->is_default && false == has_default)
@@ -1525,7 +1525,7 @@ bool ctsvc_contact_check_default_address(contacts_list_h address_list)
                contacts_list_first(address_list);
                do {
                        contacts_list_get_current_record_p(address_list, (contacts_record_h*)&address);
-                       if (NULL != address &&
+                       if (address &&
                                                (address->pobox || address->postalcode || address->region || address->locality
                                                        || address->street || address->extended || address->country)) {
                                address->is_default = true;
index 0e7b021..a67e635 100644 (file)
@@ -107,7 +107,7 @@ int ctsvc_db_email_insert(contacts_record_h record, int contact_id, bool is_my_p
                        __ctsvc_db_email_reset_default(email_id, contact_id);
        }
 
-       if (!is_my_profile)
+       if (false == is_my_profile)
                ctsvc_set_email_noti();
 
        return CONTACTS_ERROR_NONE;
@@ -123,7 +123,7 @@ int ctsvc_db_email_update(contacts_record_h record, bool is_my_profile)
        ctsvc_email_s *email = (ctsvc_email_s*)record;
        char query[CTS_SQL_MAX_LEN] = {0};
 
-       RETVM_IF(!email->id, CONTACTS_ERROR_INVALID_PARAMETER, "email of contact has no ID.");
+       RETVM_IF(0 == email->id, CONTACTS_ERROR_INVALID_PARAMETER, "email of contact has no ID.");
        RETVM_IF(CTSVC_PROPERTY_FLAG_DIRTY != (email->base.property_flag & CTSVC_PROPERTY_FLAG_DIRTY), CONTACTS_ERROR_NONE, "No update");
 
        snprintf(query, sizeof(query),
@@ -139,7 +139,7 @@ int ctsvc_db_email_update(contacts_record_h record, bool is_my_profile)
        do {
                if (CONTACTS_ERROR_NONE != (ret = ctsvc_db_create_set_query(record, &set, &bind_text))) break;
                if (CONTACTS_ERROR_NONE != (ret = ctsvc_db_update_record_with_set_query(set, bind_text, CTS_TABLE_DATA, email->id))) break;
-               if (!is_my_profile)
+               if (false == is_my_profile)
                        ctsvc_set_email_noti();
        } while (0);
 
@@ -164,7 +164,7 @@ int ctsvc_db_email_delete(int id, bool is_my_profile)
 
        ret = ctsvc_query_exec(query);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
-       if (!is_my_profile)
+       if (false == is_my_profile)
                ctsvc_set_email_noti();
 
        return CONTACTS_ERROR_NONE;
index cbf8178..2646f53 100644 (file)
@@ -66,7 +66,7 @@ int ctsvc_db_event_insert(contacts_record_h record, int contact_id, bool is_my_p
 
        ctsvc_stmt_finalize(stmt);
 
-       if (!is_my_profile)
+       if (false == is_my_profile)
                ctsvc_set_event_noti();
 
        return CONTACTS_ERROR_NONE;
@@ -107,7 +107,7 @@ int ctsvc_db_event_update(contacts_record_h record, bool is_my_profile)
        ctsvc_event_s *event = (ctsvc_event_s*)record;
        char query[CTS_SQL_MAX_LEN] = {0};
 
-       RETVM_IF(!event->id, CONTACTS_ERROR_INVALID_PARAMETER, "event of contact has no ID.");
+       RETVM_IF(0 == event->id, CONTACTS_ERROR_INVALID_PARAMETER, "event of contact has no ID.");
        RETVM_IF(CTSVC_PROPERTY_FLAG_DIRTY != (event->base.property_flag & CTSVC_PROPERTY_FLAG_DIRTY), CONTACTS_ERROR_NONE, "No update");
 
        snprintf(query, sizeof(query),
@@ -118,7 +118,7 @@ int ctsvc_db_event_update(contacts_record_h record, bool is_my_profile)
        do {
                if (CONTACTS_ERROR_NONE != (ret = ctsvc_db_create_set_query(record, &set, &bind_text))) break;
                if (CONTACTS_ERROR_NONE != (ret = ctsvc_db_update_record_with_set_query(set, bind_text, CTS_TABLE_DATA, event->id))) break;
-               if (!is_my_profile)
+               if (false == is_my_profile)
                        ctsvc_set_event_noti();
        } while (0);
 
@@ -144,7 +144,7 @@ int ctsvc_db_event_delete(int id, bool is_my_profile)
        ret = ctsvc_query_exec(query);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
-       if (!is_my_profile)
+       if (false == is_my_profile)
                ctsvc_set_event_noti();
 
        return CONTACTS_ERROR_NONE;
index 8512ae7..8aa374f 100644 (file)
@@ -133,7 +133,7 @@ int ctsvc_db_extension_insert(contacts_record_h record, int contact_id, bool is_
                        *id = ctsvc_db_get_last_insert_id();
                ctsvc_stmt_finalize(stmt);
 
-               if (!is_my_profile)
+               if (false == is_my_profile)
                        ctsvc_set_data_noti();
        }
 
@@ -150,7 +150,7 @@ int ctsvc_db_extension_update(contacts_record_h record)
        ctsvc_extension_s *extension = (ctsvc_extension_s*)record;
        char query[CTS_SQL_MAX_LEN] = {0};
 
-       RETVM_IF(!extension->id, CONTACTS_ERROR_INVALID_PARAMETER, "extension of contact has no ID.");
+       RETVM_IF(0 == extension->id, CONTACTS_ERROR_INVALID_PARAMETER, "extension of contact has no ID.");
        RETVM_IF(CTSVC_PROPERTY_FLAG_DIRTY != (extension->base.property_flag & CTSVC_PROPERTY_FLAG_DIRTY), CONTACTS_ERROR_NONE, "No update");
 
        snprintf(query, sizeof(query),
@@ -184,7 +184,7 @@ int ctsvc_db_extension_delete(int id, bool is_my_profile)
        ret = ctsvc_query_exec(query);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
-       if (!is_my_profile)
+       if (false == is_my_profile)
                ctsvc_set_data_noti();
 
        return CONTACTS_ERROR_NONE;
index 9404042..05e6d85 100644 (file)
@@ -285,7 +285,7 @@ static int __ctsvc_db_group_update_record(contacts_record_h record)
                }
 
                // add new image file
-               if (!same && group->image_thumbnail_path) {
+               if (false == same && group->image_thumbnail_path) {
                        char dest[CTS_SQL_MAX_LEN] = {0};
                        if (false == check_permission) {
                                ret = ctsvc_have_file_read_permission(group->image_thumbnail_path);
index 763746d..06ce4b9 100644 (file)
@@ -133,7 +133,7 @@ int ctsvc_db_image_insert(contacts_record_h record, int contact_id, bool is_my_p
                        __ctsvc_db_image_reset_default(image_id, contact_id);
        }
 
-       if (!is_my_profile)
+       if (false == is_my_profile)
                ctsvc_set_image_noti();
 
        return CONTACTS_ERROR_NONE;
@@ -149,7 +149,7 @@ int ctsvc_db_image_update(contacts_record_h record, int contact_id, bool is_my_p
        ctsvc_image_s *image = (ctsvc_image_s*)record;
        char query[CTS_SQL_MAX_LEN] = {0};
 
-       RETVM_IF(!image->id, CONTACTS_ERROR_INVALID_PARAMETER, "image of contact has no ID.");
+       RETVM_IF(0 == image->id, CONTACTS_ERROR_INVALID_PARAMETER, "image of contact has no ID.");
        RETVM_IF(CTSVC_PROPERTY_FLAG_DIRTY != (image->base.property_flag & CTSVC_PROPERTY_FLAG_DIRTY), CONTACTS_ERROR_NONE, "No update");
 
        snprintf(query, sizeof(query),
@@ -184,7 +184,7 @@ int ctsvc_db_image_update(contacts_record_h record, int contact_id, bool is_my_p
        do {
                if (CONTACTS_ERROR_NONE != (ret = ctsvc_db_create_set_query(record, &set, &bind_text))) break;
                if (CONTACTS_ERROR_NONE != (ret = ctsvc_db_update_record_with_set_query(set, bind_text, CTS_TABLE_DATA, image->id))) break;
-               if (!is_my_profile)
+               if (false == is_my_profile)
                        ctsvc_set_image_noti();
        } while (0);
 
@@ -209,7 +209,7 @@ int ctsvc_db_image_delete(int id, bool is_my_profile)
        ret = ctsvc_query_exec(query);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
-       if (!is_my_profile)
+       if (false == is_my_profile)
                ctsvc_set_image_noti();
 
        return CONTACTS_ERROR_NONE;
index d9d6f11..6ca55f1 100644 (file)
@@ -89,7 +89,7 @@ int ctsvc_db_messenger_insert(contacts_record_h record, int contact_id, bool is_
                *id = ctsvc_db_get_last_insert_id();
        ctsvc_stmt_finalize(stmt);
 
-       if (!is_my_profile)
+       if (false == is_my_profile)
                ctsvc_set_messenger_noti();
 
        return CONTACTS_ERROR_NONE;
@@ -105,7 +105,7 @@ int ctsvc_db_messenger_update(contacts_record_h record, bool is_my_profile)
        ctsvc_messenger_s *messenger = (ctsvc_messenger_s*)record;
        char query[CTS_SQL_MIN_LEN] = {0};
 
-       RETVM_IF(!messenger->id, CONTACTS_ERROR_INVALID_PARAMETER, "messenger of contact has no ID.");
+       RETVM_IF(0 == messenger->id, CONTACTS_ERROR_INVALID_PARAMETER, "messenger of contact has no ID.");
        RETVM_IF(CTSVC_PROPERTY_FLAG_DIRTY != (messenger->base.property_flag & CTSVC_PROPERTY_FLAG_DIRTY), CONTACTS_ERROR_NONE, "No update");
 
        snprintf(query, sizeof(query),
@@ -116,7 +116,7 @@ int ctsvc_db_messenger_update(contacts_record_h record, bool is_my_profile)
        do {
                if (CONTACTS_ERROR_NONE != (ret = ctsvc_db_create_set_query(record, &set, &bind_text))) break;
                if (CONTACTS_ERROR_NONE != (ret = ctsvc_db_update_record_with_set_query(set, bind_text, CTS_TABLE_DATA, messenger->id))) break;
-               if (!is_my_profile)
+               if (false == is_my_profile)
                        ctsvc_set_messenger_noti();
        } while (0);
 
@@ -142,7 +142,7 @@ int ctsvc_db_messenger_delete(int id, bool is_my_profile)
        ret = ctsvc_query_exec(query);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
-       if (!is_my_profile)
+       if (false == is_my_profile)
                ctsvc_set_messenger_noti();
 
        return CONTACTS_ERROR_NONE;
index 9d6dda9..95cf2ed 100644 (file)
@@ -406,7 +406,7 @@ static void __ctsvc_make_my_profile_display_name(ctsvc_my_profile_s *my_profile)
        free(my_profile->reverse_display_name);
        my_profile->reverse_display_name = NULL;
 
-       if (0 < my_profile->name->count && my_profile->name->records != NULL && my_profile->name->records->data != NULL) {
+       if (0 < my_profile->name->count && my_profile->name->records && my_profile->name->records->data) {
                name = (ctsvc_name_s *)my_profile->name->records->data;
        }
 
@@ -617,7 +617,7 @@ static void __ctsvc_make_my_profile_display_name(ctsvc_my_profile_s *my_profile)
                        }
                }
 
-               if (!ctsvc_record_check_property_flag((ctsvc_record_s *)my_profile, _contacts_my_profile.display_name, CTSVC_PROPERTY_FLAG_DIRTY) &&
+               if (false == ctsvc_record_check_property_flag((ctsvc_record_s *)my_profile, _contacts_my_profile.display_name, CTSVC_PROPERTY_FLAG_DIRTY) &&
                                my_profile->nicknames && my_profile->nicknames->records) {
                        for (cur=my_profile->nicknames->records;cur;cur=cur->next) {
                                ctsvc_nickname_s *nickname = (ctsvc_nickname_s *)cur->data;
@@ -629,7 +629,7 @@ static void __ctsvc_make_my_profile_display_name(ctsvc_my_profile_s *my_profile)
                        }
                }
 
-               if (!ctsvc_record_check_property_flag((ctsvc_record_s *)my_profile, _contacts_my_profile.display_name, CTSVC_PROPERTY_FLAG_DIRTY) &&
+               if (false == ctsvc_record_check_property_flag((ctsvc_record_s *)my_profile, _contacts_my_profile.display_name, CTSVC_PROPERTY_FLAG_DIRTY) &&
                                my_profile->numbers && my_profile->numbers->records) {
                        for (cur=my_profile->numbers->records;cur;cur=cur->next) {
                                ctsvc_number_s *number = (ctsvc_number_s *)cur->data;
@@ -641,7 +641,7 @@ static void __ctsvc_make_my_profile_display_name(ctsvc_my_profile_s *my_profile)
                        }
                }
 
-               if (!ctsvc_record_check_property_flag((ctsvc_record_s *)my_profile, _contacts_my_profile.display_name, CTSVC_PROPERTY_FLAG_DIRTY) &&
+               if (false == ctsvc_record_check_property_flag((ctsvc_record_s *)my_profile, _contacts_my_profile.display_name, CTSVC_PROPERTY_FLAG_DIRTY) &&
                                my_profile->emails && my_profile->emails->records) {
                        for (cur=my_profile->emails->records;cur;cur=cur->next) {
                                ctsvc_email_s *email = (ctsvc_email_s *)cur->data;
@@ -725,8 +725,8 @@ static int __ctsvc_db_my_profile_update_record(contacts_record_h record)
                        }
 
                        image = (ctsvc_image_s*)record_image;
-                       if ((NULL == my_profile->image_thumbnail_path && NULL != image->path) ||
-                                       (NULL != my_profile->image_thumbnail_path && NULL == image->path) ||
+                       if ((NULL == my_profile->image_thumbnail_path && image->path) ||
+                                       (my_profile->image_thumbnail_path && NULL == image->path) ||
                                        (my_profile->image_thumbnail_path && image->path && STRING_EQUAL != strcmp(my_profile->image_thumbnail_path, image->path))) {
                                ctsvc_record_set_property_flag((ctsvc_record_s *)my_profile, _contacts_my_profile.image_thumbnail_path, CTSVC_PROPERTY_FLAG_DIRTY);
 
@@ -884,7 +884,7 @@ static int __ctsvc_db_my_profile_get_records_with_query(contacts_query_h query,
        else
                had_my_profile_id = true;
 
-       if (!had_my_profile_id) {
+       if (false == had_my_profile_id) {
                s_query->projection = realloc(s_query->projection, s_query->projection_count+1);
                s_query->projection[s_query->projection_count] = CTSVC_PROPERTY_MY_PROFILE_ID;
                s_query->projection_count++;
index bf9b307..da74edc 100644 (file)
@@ -39,9 +39,9 @@ enum{
 static inline void __ctsvc_make_name_lookup(int op_code, const char *name_first,
                const char *name_last, char **name_lookup)
 {
-       if (name_first && !name_last)
+       if (name_first && NULL == name_last)
                *name_lookup = SAFE_STRDUP(name_first);
-       else if (!name_first && name_last)
+       else if (NULL == name_first && name_last)
                *name_lookup = SAFE_STRDUP(name_last);
        else {
                if (CONTACTS_NAME_DISPLAY_ORDER_FIRSTLAST == op_code) {
@@ -221,7 +221,7 @@ int ctsvc_db_name_insert(contacts_record_h record, int contact_id, bool is_my_pr
                name->contact_id = contact_id;
                ctsvc_stmt_finalize(stmt);
 
-               if (!is_my_profile)
+               if (false == is_my_profile)
                        ctsvc_set_name_noti();
        }
 
@@ -283,7 +283,7 @@ int ctsvc_db_name_update(contacts_record_h record, bool is_my_profile)
        char *temp_normal_last = NULL;
        char query[CTS_SQL_MIN_LEN] = {0};
 
-       RETVM_IF(!name->id, CONTACTS_ERROR_INVALID_PARAMETER, "name of contact has no ID.");
+       RETVM_IF(0 == name->id, CONTACTS_ERROR_INVALID_PARAMETER, "name of contact has no ID.");
        RETVM_IF(CTSVC_PROPERTY_FLAG_DIRTY != (name->base.property_flag & CTSVC_PROPERTY_FLAG_DIRTY), CONTACTS_ERROR_NONE, "No update");
 
        snprintf(query, sizeof(query),
@@ -355,7 +355,7 @@ int ctsvc_db_name_update(contacts_record_h record, bool is_my_profile)
                bind_text = g_slist_append(bind_text, strdup(SAFE_STR(name->reverse_lookup)));
                if (CONTACTS_ERROR_NONE != (ret = ctsvc_db_update_record_with_set_query(query_set, bind_text, CTS_TABLE_DATA, name->id))) break;
 
-               if (!is_my_profile)
+               if (false == is_my_profile)
                        ctsvc_set_name_noti();
        } while (0);
 
@@ -380,7 +380,7 @@ int ctsvc_db_name_delete(int id, bool is_my_profile)
        ret = ctsvc_query_exec(query);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
-       if (!is_my_profile)
+       if (false == is_my_profile)
                ctsvc_set_name_noti();
 
        return CONTACTS_ERROR_NONE;
index eb86b7a..1b85f8d 100644 (file)
@@ -86,7 +86,7 @@ int ctsvc_db_nickname_insert(contacts_record_h record, int contact_id, bool is_m
                *id = ctsvc_db_get_last_insert_id();
        ctsvc_stmt_finalize(stmt);
 
-       if (!is_my_profile)
+       if (false == is_my_profile)
                ctsvc_set_nickname_noti();
        return CONTACTS_ERROR_NONE;
 }
@@ -101,7 +101,7 @@ int ctsvc_db_nickname_update(contacts_record_h record, bool is_my_profile)
        ctsvc_nickname_s *nickname = (ctsvc_nickname_s*)record;
        char query[CTS_SQL_MAX_LEN] = {0};
 
-       RETVM_IF(!nickname->id, CONTACTS_ERROR_INVALID_PARAMETER, "nickname of contact has no ID.");
+       RETVM_IF(0 == nickname->id, CONTACTS_ERROR_INVALID_PARAMETER, "nickname of contact has no ID.");
        RETVM_IF(CTSVC_PROPERTY_FLAG_DIRTY != (nickname->base.property_flag & CTSVC_PROPERTY_FLAG_DIRTY), CONTACTS_ERROR_NONE, "No update");
 
        snprintf(query, sizeof(query),
@@ -112,7 +112,7 @@ int ctsvc_db_nickname_update(contacts_record_h record, bool is_my_profile)
        do {
                if (CONTACTS_ERROR_NONE != (ret = ctsvc_db_create_set_query(record, &set, &bind_text))) break;
                if (CONTACTS_ERROR_NONE != (ret = ctsvc_db_update_record_with_set_query(set, bind_text, CTS_TABLE_DATA, nickname->id))) break;
-               if (!is_my_profile)
+               if (false == is_my_profile)
                        ctsvc_set_nickname_noti();
        } while (0);
 
@@ -137,7 +137,7 @@ int ctsvc_db_nickname_delete(int id, bool is_my_profile)
        ret = ctsvc_query_exec(query);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
-       if (!is_my_profile)
+       if (false == is_my_profile)
                ctsvc_set_nickname_noti();
 
        return CONTACTS_ERROR_NONE;
index 3623ffb..d63ceb3 100644 (file)
@@ -82,7 +82,7 @@ int ctsvc_db_note_insert(contacts_record_h record, int contact_id, bool is_my_pr
                *id = ctsvc_db_get_last_insert_id();
        ctsvc_stmt_finalize(stmt);
 
-       if (!is_my_profile)
+       if (false == is_my_profile)
                ctsvc_set_note_noti();
        return CONTACTS_ERROR_NONE;
 }
@@ -97,7 +97,7 @@ int ctsvc_db_note_update(contacts_record_h record, bool is_my_profile)
        ctsvc_note_s *note = (ctsvc_note_s*)record;
        char query[CTS_SQL_MAX_LEN] = {0};
 
-       RETVM_IF(!note->id, CONTACTS_ERROR_INVALID_PARAMETER, "note of contact has no ID.");
+       RETVM_IF(0 == note->id, CONTACTS_ERROR_INVALID_PARAMETER, "note of contact has no ID.");
        RETVM_IF(CTSVC_PROPERTY_FLAG_DIRTY != (note->base.property_flag & CTSVC_PROPERTY_FLAG_DIRTY), CONTACTS_ERROR_NONE, "No update");
 
        snprintf(query, sizeof(query),
@@ -109,7 +109,7 @@ int ctsvc_db_note_update(contacts_record_h record, bool is_my_profile)
                if (CONTACTS_ERROR_NONE != (ret = ctsvc_db_create_set_query(record, &set, &bind_text))) break;
                if (CONTACTS_ERROR_NONE != (ret = ctsvc_db_update_record_with_set_query(set, bind_text, CTS_TABLE_DATA, note->id))) break;
 
-               if (!is_my_profile)
+               if (false == is_my_profile)
                        ctsvc_set_messenger_noti();
        } while (0);
 
@@ -135,7 +135,7 @@ int ctsvc_db_note_delete(int id, bool is_my_profile)
        ret = ctsvc_query_exec(query);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
-       if (!is_my_profile)
+       if (false == is_my_profile)
                ctsvc_set_note_noti();
 
        return CONTACTS_ERROR_NONE;
index 1f52e8a..f73b507 100644 (file)
@@ -107,7 +107,7 @@ int ctsvc_db_number_insert(contacts_record_h record, int contact_id, bool is_my_
                        __ctsvc_db_number_reset_default(number_id, contact_id);
        }
 
-       if (!is_my_profile) {
+       if (false == is_my_profile) {
 #ifdef ENABLE_LOG_FEATURE
                // updata phonelog
                int person_id = -1;
@@ -170,7 +170,7 @@ int ctsvc_db_number_update(contacts_record_h record, bool is_my_profile)
        cts_stmt stmt = NULL;
 #endif // ENABLE_LOG_FEATURE
 
-       RETVM_IF(!number->id, CONTACTS_ERROR_INVALID_PARAMETER, "number of contact has no ID.");
+       RETVM_IF(0 == number->id, CONTACTS_ERROR_INVALID_PARAMETER, "number of contact has no ID.");
        RETVM_IF(CTSVC_PROPERTY_FLAG_DIRTY != (number->base.property_flag & CTSVC_PROPERTY_FLAG_DIRTY),
                                CONTACTS_ERROR_NONE, "No update");
 
@@ -197,7 +197,7 @@ int ctsvc_db_number_update(contacts_record_h record, bool is_my_profile)
                                                                                        "ON "CTS_TABLE_CONTACTS".contact_id = "CTS_TABLE_DATA".contact_id "
                                                                                        "WHERE data.id = %d", number->id);
                        ret = ctsvc_query_prepare(query, &stmt);
-                       if (stmt != NULL) {
+                       if (stmt) {
                                ret = ctsvc_stmt_step(stmt);
                                if (ret == 1) {
                                        person_id = ctsvc_stmt_get_int(stmt, 0);
@@ -241,7 +241,7 @@ int ctsvc_db_number_update(contacts_record_h record, bool is_my_profile)
                                                                                                "ON "CTS_TABLE_CONTACTS".contact_id = "CTS_TABLE_DATA".contact_id "
                                                                                                "WHERE data.id = %d", number->id);
                                ret = ctsvc_query_prepare(query, &stmt);
-                               if (stmt != NULL) {
+                               if (stmt) {
                                        ret = ctsvc_stmt_step(stmt);
                                        if (ret == 1) {
                                                person_id = ctsvc_stmt_get_int(stmt, 0);
@@ -258,12 +258,12 @@ int ctsvc_db_number_update(contacts_record_h record, bool is_my_profile)
 
                if (CONTACTS_ERROR_NONE != (ret = ctsvc_db_update_record_with_set_query(set, bind_text, CTS_TABLE_DATA, number->id))) break;
 
-               if (!is_my_profile)
+               if (false == is_my_profile)
                        ctsvc_set_number_noti();
 
 #ifdef ENABLE_LOG_FEATURE
                // update phone log
-               if (0 < person_id && pre_number != NULL)
+               if (0 < person_id && pre_number)
                        ctsvc_db_phone_log_update_person_id(pre_number, person_id, -1, false);
                if (0 < person_id)
                        ctsvc_db_phone_log_update_person_id(number->number, -1, person_id, false);
@@ -298,7 +298,7 @@ int ctsvc_db_number_delete(int id, bool is_my_profile)
                                                                        "ON "CTS_TABLE_CONTACTS".contact_id = "CTS_TABLE_DATA".contact_id "
                                                                        "WHERE data.id = %d", id);
        ret = ctsvc_query_prepare(query, &stmt);
-       if (stmt != NULL) {
+       if (stmt) {
                ret = ctsvc_stmt_step(stmt);
                if (ret == 1) {
                        person_id = ctsvc_stmt_get_int(stmt, 0);
@@ -325,12 +325,12 @@ int ctsvc_db_number_delete(int id, bool is_my_profile)
 
 #ifdef ENABLE_LOG_FEATURE
        // update phone log
-       if (0 < person_id && pre_number != NULL)
+       if (0 < person_id && pre_number)
                ctsvc_db_phone_log_update_person_id(pre_number, person_id, -1, false);
        ctsvc_stmt_finalize(stmt);
 #endif // ENABLE_LOG_FEATURE
 
-       if (!is_my_profile)
+       if (false == is_my_profile)
                ctsvc_set_number_noti();
 
        return CONTACTS_ERROR_NONE;
index e0f10fe..9524303 100755 (executable)
@@ -549,7 +549,7 @@ int ctsvc_db_update_person(contacts_record_h record)
                        return ret;
                }
        }
-       else if (CONTACTS_ERROR_NONE == ret && !is_favorite) {
+       else if (CONTACTS_ERROR_NONE == ret && false == is_favorite) {
                snprintf(query, sizeof(query),
                        "SELECT person_id FROM "CTS_TABLE_CONTACTS" WHERE person_id =%d AND is_favorite = 1", contact->person_id);
                ret = ctsvc_query_get_first_int_result(query, &person_id);
index 1539603..71ed58c 100644 (file)
@@ -122,7 +122,7 @@ int ctsvc_db_profile_insert(contacts_record_h record, int contact_id, bool is_my
                *id = ctsvc_db_get_last_insert_id();
        ctsvc_stmt_finalize(stmt);
 
-       if (!is_my_profile)
+       if (false == is_my_profile)
                ctsvc_set_profile_noti();
 
        return CONTACTS_ERROR_NONE;
@@ -139,7 +139,7 @@ int ctsvc_db_profile_update(contacts_record_h record, bool is_my_profile)
        ctsvc_profile_s *profile = (ctsvc_profile_s*)record;
        char query[CTS_SQL_MAX_LEN] = {0};
 
-       RETVM_IF(!profile->id, CONTACTS_ERROR_INVALID_PARAMETER, "profile of contact has no ID.");
+       RETVM_IF(0 == profile->id, CONTACTS_ERROR_INVALID_PARAMETER, "profile of contact has no ID.");
 
        snprintf(query, sizeof(query),
                        "SELECT id FROM "CTS_TABLE_DATA" WHERE id = %d", profile->id);
@@ -151,7 +151,7 @@ int ctsvc_db_profile_update(contacts_record_h record, bool is_my_profile)
        do {
                if (CONTACTS_ERROR_NONE != (ret = ctsvc_db_create_set_query(record, &set, &bind_text))) break;
                if (CONTACTS_ERROR_NONE != (ret = ctsvc_db_update_record_with_set_query(set, bind_text, CTS_TABLE_DATA, profile->id))) break;
-               if (!is_my_profile)
+               if (false == is_my_profile)
                        ctsvc_set_profile_noti();
        } while (0);
 
@@ -178,7 +178,7 @@ int ctsvc_db_profile_delete(int id, bool is_my_profile)
        ret = ctsvc_query_exec(query);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
-       if (!is_my_profile)
+       if (false == is_my_profile)
                ctsvc_set_profile_noti();
 
        return CONTACTS_ERROR_NONE;
index 2f314d5..31be602 100644 (file)
@@ -95,7 +95,7 @@ int ctsvc_db_relationship_insert(contacts_record_h record, int contact_id, bool
                *id = ctsvc_db_get_last_insert_id();
        ctsvc_stmt_finalize(stmt);
 
-       if (!is_my_profile)
+       if (false == is_my_profile)
                ctsvc_set_relationship_noti();
 
        return CONTACTS_ERROR_NONE;
@@ -111,7 +111,7 @@ int ctsvc_db_relationship_update(contacts_record_h record, bool is_my_profile)
        ctsvc_relationship_s *relationship = (ctsvc_relationship_s*)record;
        char query[CTS_SQL_MIN_LEN] = {0};
 
-       RETVM_IF(!relationship->id, CONTACTS_ERROR_INVALID_PARAMETER, "relationship of contact has no ID.");
+       RETVM_IF(0 == relationship->id, CONTACTS_ERROR_INVALID_PARAMETER, "relationship of contact has no ID.");
        snprintf(query, sizeof(query),
                        "SELECT id FROM "CTS_TABLE_DATA" WHERE id = %d", relationship->id);
        ret = ctsvc_query_get_first_int_result(query, &id);
@@ -122,7 +122,7 @@ int ctsvc_db_relationship_update(contacts_record_h record, bool is_my_profile)
        do {
                if (CONTACTS_ERROR_NONE != (ret = ctsvc_db_create_set_query(record, &set, &bind_text))) break;
                if (CONTACTS_ERROR_NONE != (ret = ctsvc_db_update_record_with_set_query(set, bind_text, CTS_TABLE_DATA, relationship->id))) break;
-               if (!is_my_profile)
+               if (false == is_my_profile)
                        ctsvc_set_relationship_noti();
        } while (0);
 
@@ -149,7 +149,7 @@ int ctsvc_db_relationship_delete(int id, bool is_my_profile)
        ret = ctsvc_query_exec(query);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
-       if (!is_my_profile)
+       if (false == is_my_profile)
                ctsvc_set_relationship_noti();
 
        return CONTACTS_ERROR_NONE;
index 61e324c..fe58dfc 100644 (file)
@@ -81,7 +81,7 @@ static int __ctsvc_db_sdn_value_set(cts_stmt stmt, contacts_record_h *record)
 
 static int __ctsvc_db_sdn_get_record(int id, contacts_record_h* out_record)
 {
-       RETVM_IF(!ctsvc_server_have_telephony_feature(), CONTACTS_ERROR_NOT_SUPPORTED, "Telephony feature disabled");
+       RETVM_IF(false == ctsvc_server_have_telephony_feature(), CONTACTS_ERROR_NOT_SUPPORTED, "Telephony feature disabled");
 
        int ret;
        cts_stmt stmt = NULL;
@@ -270,7 +270,7 @@ static int __ctsvc_db_sdn_delete_record(int sdn_id)
 static int __ctsvc_db_sdn_get_all_records(int offset, int limit,
        contacts_list_h* out_list)
 {
-       RETVM_IF(!ctsvc_server_have_telephony_feature(), CONTACTS_ERROR_NOT_SUPPORTED, "Telephony feature disabled");
+       RETVM_IF(false == ctsvc_server_have_telephony_feature(), CONTACTS_ERROR_NOT_SUPPORTED, "Telephony feature disabled");
 
        int ret;
        int len;
@@ -312,7 +312,7 @@ static int __ctsvc_db_sdn_get_all_records(int offset, int limit,
 
 static int __ctsvc_db_sdn_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h* out_list)
 {
-       RETVM_IF(!ctsvc_server_have_telephony_feature(), CONTACTS_ERROR_NOT_SUPPORTED, "Telephony feature disabled");
+       RETVM_IF(false == ctsvc_server_have_telephony_feature(), CONTACTS_ERROR_NOT_SUPPORTED, "Telephony feature disabled");
 
        int ret;
        int i;
index 7c2a03a..de8b525 100644 (file)
@@ -89,7 +89,7 @@ int ctsvc_db_url_insert(contacts_record_h record, int contact_id, bool is_my_pro
                *id = ctsvc_db_get_last_insert_id();
        ctsvc_stmt_finalize(stmt);
 
-       if (!is_my_profile)
+       if (false == is_my_profile)
                ctsvc_set_url_noti();
 
        return CONTACTS_ERROR_NONE;
@@ -105,7 +105,7 @@ int ctsvc_db_url_update(contacts_record_h record, bool is_my_profile)
        GSList *cursor = NULL;
        char query[CTS_SQL_MAX_LEN] = {0};
 
-       RETVM_IF(!url->id, CONTACTS_ERROR_INVALID_PARAMETER, "url of contact has no ID.");
+       RETVM_IF(0 == url->id, CONTACTS_ERROR_INVALID_PARAMETER, "url of contact has no ID.");
        RETVM_IF(CTSVC_PROPERTY_FLAG_DIRTY != (url->base.property_flag & CTSVC_PROPERTY_FLAG_DIRTY), CONTACTS_ERROR_NONE, "No update");
 
        snprintf(query, sizeof(query),
@@ -116,7 +116,7 @@ int ctsvc_db_url_update(contacts_record_h record, bool is_my_profile)
        do {
                if (CONTACTS_ERROR_NONE != (ret = ctsvc_db_create_set_query(record, &set, &bind_text))) break;
                if (CONTACTS_ERROR_NONE != (ret = ctsvc_db_update_record_with_set_query(set, bind_text, CTS_TABLE_DATA, url->id))) break;
-               if (!is_my_profile)
+               if (false == is_my_profile)
                        ctsvc_set_url_noti();
        } while (0);
 
@@ -141,7 +141,7 @@ int ctsvc_db_url_delete(int id, bool is_my_profile)
        ret = ctsvc_query_exec(query);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
-       if (!is_my_profile)
+       if (false == is_my_profile)
                ctsvc_set_url_noti();
 
        return CONTACTS_ERROR_NONE;
index 1042585..d50cc64 100644 (file)
@@ -542,7 +542,7 @@ static inline int __ctsvc_db_create_str_condition(ctsvc_composite_filter_s *com_
                                || filter->property_id == CTSVC_PROPERTY_PERSON_IMAGE_THUMBNAIL
                                || filter->property_id == CTSVC_PROPERTY_MY_PROFILE_IMAGE_THUMBNAIL
                                || filter->property_id == CTSVC_PROPERTY_IMAGE_PATH) {
-                       if (strncmp(filter->value.s, CTSVC_CONTACT_IMG_FULL_LOCATION, strlen(CTSVC_CONTACT_IMG_FULL_LOCATION)) == 0) {
+                       if (STRING_EQUAL == strncmp(filter->value.s, CTSVC_CONTACT_IMG_FULL_LOCATION, strlen(CTSVC_CONTACT_IMG_FULL_LOCATION))) {
                                *bind_text = g_slist_append(*bind_text,
                                                                        __ctsvc_db_get_str_with_escape(filter->value.s+strlen(CTSVC_CONTACT_IMG_FULL_LOCATION)+1,
                                                                        strlen(filter->value.s)-strlen(CTSVC_CONTACT_IMG_FULL_LOCATION)-1, with_escape));
@@ -551,7 +551,7 @@ static inline int __ctsvc_db_create_str_condition(ctsvc_composite_filter_s *com_
                                *bind_text = g_slist_append(*bind_text, __ctsvc_db_get_str_with_escape(filter->value.s, strlen(filter->value.s), with_escape));
                }
                else if (filter->property_id == CTSVC_PROPERTY_GROUP_IMAGE) {
-                       if (strncmp(filter->value.s, CTS_GROUP_IMAGE_LOCATION, strlen(CTS_GROUP_IMAGE_LOCATION)) == 0) {
+                       if (STRING_EQUAL == strncmp(filter->value.s, CTS_GROUP_IMAGE_LOCATION, strlen(CTS_GROUP_IMAGE_LOCATION))) {
                                *bind_text = g_slist_append(*bind_text,
                                                                        __ctsvc_db_get_str_with_escape(filter->value.s+strlen(CTS_GROUP_IMAGE_LOCATION)+1,
                                                                        strlen(filter->value.s)-strlen(CTS_GROUP_IMAGE_LOCATION)-1, with_escape));
@@ -560,7 +560,7 @@ static inline int __ctsvc_db_create_str_condition(ctsvc_composite_filter_s *com_
                                *bind_text = g_slist_append(*bind_text, __ctsvc_db_get_str_with_escape(filter->value.s, strlen(filter->value.s), with_escape));
                }
                else if (filter->property_id == CTSVC_PROPERTY_COMPANY_LOGO) {
-                       if (strncmp(filter->value.s, CTS_LOGO_IMAGE_LOCATION, strlen(CTS_LOGO_IMAGE_LOCATION)) == 0) {
+                       if (STRING_EQUAL == strncmp(filter->value.s, CTS_LOGO_IMAGE_LOCATION, strlen(CTS_LOGO_IMAGE_LOCATION))) {
                                *bind_text = g_slist_append(*bind_text,
                                                                        __ctsvc_db_get_str_with_escape(filter->value.s+strlen(CTS_LOGO_IMAGE_LOCATION)+1,
                                                                        strlen(filter->value.s)-strlen(CTS_LOGO_IMAGE_LOCATION)-1, with_escape));
@@ -1236,7 +1236,7 @@ static char* __ctsvc_db_make_search_keyword(const char *keyword)
                return NULL;
 
        size = strlen(keyword);
-       if (strstr(keyword, " ") != NULL) {
+       if (strstr(keyword, " ")) {
                int i = 0;
                int j = 0;
                char search_keyword[size * 2+1];
index 305c5f1..38bfe15 100755 (executable)
@@ -179,13 +179,13 @@ const char *ctsvc_get_language_locale(int lang)
        case CTSVC_LANG_GALICIAN: // gl, Spain - Galician
                return "gl";
        case CTSVC_LANG_HINDI: // hi, India - Hindi, Marathi, Nepali
-               if (!strncmp(langset, "hi", strlen("hi"))) {
+               if (STRING_EQUAL == strncmp(langset, "hi", strlen("hi"))) {
                        return "hi";
                }
-               else if (!strncmp(langset, "mr", strlen("mr"))) {
+               else if (STRING_EQUAL == strncmp(langset, "mr", strlen("mr"))) {
                        return "mr";
                }
-               else if (!strncmp(langset, "ne", strlen("ne"))) {
+               else if (STRING_EQUAL == strncmp(langset, "ne", strlen("ne"))) {
                        return "ne";
                }
                return "hi";
@@ -242,7 +242,7 @@ const char *ctsvc_get_language_locale(int lang)
        case CTSVC_LANG_THAI: // th_TH, Thai
                return "th";
        case CTSVC_LANG_BENGALI: // as, bn
-               if (!strncmp(langset, "as", strlen("as"))) {
+               if (STRING_EQUAL == strncmp(langset, "as", strlen("as"))) {
                        return "as";
                }
                return "bn";
@@ -299,183 +299,183 @@ int ctsvc_get_language_type(const char *system_lang)
        RETV_IF(NULL == system_lang, CTSVC_LANG_OTHERS);
 
        // az, Azerbaijan
-       if (!strncmp(system_lang, "az", strlen("az")))
+       if (STRING_EQUAL == strncmp(system_lang, "az", strlen("az")))
                type = CTSVC_LANG_AZERBAIJAN;
        // ar, Bahrain - Arabic
-       else if (!strncmp(system_lang, "ar", strlen("ar")))
+       else if (STRING_EQUAL == strncmp(system_lang, "ar", strlen("ar")))
                type = CTSVC_LANG_ARABIC;
        // bg, Bulgaria - Bulgarian
-       else if (!strncmp(system_lang, "bg", strlen("bg")))
+       else if (STRING_EQUAL == strncmp(system_lang, "bg", strlen("bg")))
                type = CTSVC_LANG_BULGARIAN;
        // ca, Spain - Catalan
-       else if (!strncmp(system_lang, "ca", strlen("ca")))
+       else if (STRING_EQUAL == strncmp(system_lang, "ca", strlen("ca")))
                type = CTSVC_LANG_CATALAN;
        // cs, Czech Republic - Czech
-       else if (!strncmp(system_lang, "cs", strlen("cs")))
+       else if (STRING_EQUAL == strncmp(system_lang, "cs", strlen("cs")))
                type = CTSVC_LANG_CZECH;
        // da, Denmark - Danish
-       else if (!strncmp(system_lang, "da", strlen("da")))
+       else if (STRING_EQUAL == strncmp(system_lang, "da", strlen("da")))
                type = CTSVC_LANG_DANISH;
        // de, Germany - German
-       else if (!strncmp(system_lang, "de", strlen("de")))
+       else if (STRING_EQUAL == strncmp(system_lang, "de", strlen("de")))
                type = CTSVC_LANG_GERMAN;
        // el, Greece - Greek
-       else if (!strncmp(system_lang, "el", strlen("el")))
+       else if (STRING_EQUAL == strncmp(system_lang, "el", strlen("el")))
                type = CTSVC_LANG_GREEK;
        // en, en_PH, en_US
-       else if (!strncmp(system_lang, "en", strlen("en")))
+       else if (STRING_EQUAL == strncmp(system_lang, "en", strlen("en")))
                type = CTSVC_LANG_ENGLISH;
        // es_ES, es_US, El Salvador - Spanish
-       else if (!strncmp(system_lang, "es", strlen("es")))
+       else if (STRING_EQUAL == strncmp(system_lang, "es", strlen("es")))
                type = CTSVC_LANG_SPANISH;
        // et, Estonia - Estonian
-       else if (!strncmp(system_lang, "et", strlen("et")))
+       else if (STRING_EQUAL == strncmp(system_lang, "et", strlen("et")))
                type = CTSVC_LANG_ESTONIAN;
        // eu, Spain - Basque
-       else if (!strncmp(system_lang, "eu", strlen("eu")))
+       else if (STRING_EQUAL == strncmp(system_lang, "eu", strlen("eu")))
                type = CTSVC_LANG_BASQUE;
        // fi, Finland - Finnish
-       else if (!strncmp(system_lang, "fi", strlen("fi")))
+       else if (STRING_EQUAL == strncmp(system_lang, "fi", strlen("fi")))
                type = CTSVC_LANG_FINNISH;
        // fr_CA, fr_FR
-       else if (!strncmp(system_lang, "fr", strlen("fr")))
+       else if (STRING_EQUAL == strncmp(system_lang, "fr", strlen("fr")))
                type = CTSVC_LANG_FRENCH;
        // ga, Ireland - Irish
-       else if (!strncmp(system_lang, "ga", strlen("ga")))
+       else if (STRING_EQUAL == strncmp(system_lang, "ga", strlen("ga")))
                type = CTSVC_LANG_IRISH;
        // gl, Spain - Galician
-       else if (!strncmp(system_lang, "gl", strlen("gl")))
+       else if (STRING_EQUAL == strncmp(system_lang, "gl", strlen("gl")))
                type = CTSVC_LANG_GALICIAN;
        // hi, India - Hindi
-       else if (!strncmp(system_lang, "hi", strlen("hi")))
+       else if (STRING_EQUAL == strncmp(system_lang, "hi", strlen("hi")))
                type = CTSVC_LANG_HINDI;
        // mr, India - marathi
-       else if (!strncmp(system_lang, "mr", strlen("mr")))
+       else if (STRING_EQUAL == strncmp(system_lang, "mr", strlen("mr")))
                type = CTSVC_LANG_HINDI;
        // ne, India - nepal
-       else if (!strncmp(system_lang, "ne", strlen("ne")))
+       else if (STRING_EQUAL == strncmp(system_lang, "ne", strlen("ne")))
                type = CTSVC_LANG_HINDI;
        // hr, Bosnia and Herzegovina - Croatian
-       else if (!strncmp(system_lang, "hr", strlen("hr")))
+       else if (STRING_EQUAL == strncmp(system_lang, "hr", strlen("hr")))
                type = CTSVC_LANG_CROATIAN;
        // hu, Hungary - Hungarian
-       else if (!strncmp(system_lang, "hu", strlen("hu")))
+       else if (STRING_EQUAL == strncmp(system_lang, "hu", strlen("hu")))
                type = CTSVC_LANG_HUNGARIAN;
        // hy, Armenia - Armenian
-       else if (!strncmp(system_lang, "hy", strlen("hy")))
+       else if (STRING_EQUAL == strncmp(system_lang, "hy", strlen("hy")))
                type = CTSVC_LANG_ARMENIAN;
        // is, Iceland - Icelandic
-       else if (!strncmp(system_lang, "is", strlen("is")))
+       else if (STRING_EQUAL == strncmp(system_lang, "is", strlen("is")))
                type = CTSVC_LANG_ICELANDIC;
        // it_IT, Italy - Italian
-       else if (!strncmp(system_lang, "it", strlen("it")))
+       else if (STRING_EQUAL == strncmp(system_lang, "it", strlen("it")))
                type = CTSVC_LANG_ITALIAN;
        // ja_JP, japan
-       else if (!strncmp(system_lang, "ja", strlen("ja")))
+       else if (STRING_EQUAL == strncmp(system_lang, "ja", strlen("ja")))
                type = CTSVC_LANG_JAPANESE;
        // ka, Georgia - Georgian
-       else if (!strncmp(system_lang, "ka", strlen("ka")))
+       else if (STRING_EQUAL == strncmp(system_lang, "ka", strlen("ka")))
                type = CTSVC_LANG_GEORGIAN;
        // kk, Kazakhstan
-       else if (!strncmp(system_lang, "kk", strlen("kk")))
+       else if (STRING_EQUAL == strncmp(system_lang, "kk", strlen("kk")))
                type = CTSVC_LANG_KAZAKHSTAN;
        // ko, ko_KR
-       else if (!strncmp(system_lang, "ko", strlen("ko")))
+       else if (STRING_EQUAL == strncmp(system_lang, "ko", strlen("ko")))
                type = CTSVC_LANG_KOREAN;
        // lt, Lithuania - Lithuanian
-       else if (!strncmp(system_lang, "lt", strlen("lt")))
+       else if (STRING_EQUAL == strncmp(system_lang, "lt", strlen("lt")))
                type = CTSVC_LANG_LITHUANIAN;
        // lv, Latvia - Latvian
-       else if (!strncmp(system_lang, "lv", strlen("lv")))
+       else if (STRING_EQUAL == strncmp(system_lang, "lv", strlen("lv")))
                type = CTSVC_LANG_LATVIAN;
        // mk, Macedonia
-       else if (!strncmp(system_lang, "mk", strlen("mk")))
+       else if (STRING_EQUAL == strncmp(system_lang, "mk", strlen("mk")))
                type = CTSVC_LANG_MACEDONIA;
        // nb, Norway
-       else if (!strncmp(system_lang, "nb", strlen("nb")))
+       else if (STRING_EQUAL == strncmp(system_lang, "nb", strlen("nb")))
                type = CTSVC_LANG_NORWAY;
        // nl_Nl, Netherlands Dutch
-       else if (!strncmp(system_lang, "nl", strlen("nl")))
+       else if (STRING_EQUAL == strncmp(system_lang, "nl", strlen("nl")))
                type = CTSVC_LANG_DUTCH;
        // pl, Polish
-       else if (!strncmp(system_lang, "pl", strlen("pl")))
+       else if (STRING_EQUAL == strncmp(system_lang, "pl", strlen("pl")))
                type = CTSVC_LANG_POLISH;
        // pt_BR, pt_PT, Portugal
-       else if (!strncmp(system_lang, "pt", strlen("pt")))
+       else if (STRING_EQUAL == strncmp(system_lang, "pt", strlen("pt")))
                type = CTSVC_LANG_PORTUGUESE;
        // ro, Romania
-       else if (!strncmp(system_lang, "ro", strlen("ro")))
+       else if (STRING_EQUAL == strncmp(system_lang, "ro", strlen("ro")))
                type = CTSVC_LANG_ROMANIA;
        // ru_RU, Russia
-       else if (!strncmp(system_lang, "ru", strlen("ru")))
+       else if (STRING_EQUAL == strncmp(system_lang, "ru", strlen("ru")))
                type = CTSVC_LANG_RUSSIAN;
        // sk, Slovakia - Slovak
-       else if (!strncmp(system_lang, "sk", strlen("sk")))
+       else if (STRING_EQUAL == strncmp(system_lang, "sk", strlen("sk")))
                type = CTSVC_LANG_SLOVAK;
        // sl, Slovenia - Slovenian
-       else if (!strncmp(system_lang, "sl", strlen("sl")))
+       else if (STRING_EQUAL == strncmp(system_lang, "sl", strlen("sl")))
                type = CTSVC_LANG_SLOVENIAN;
        // sr, Serbia - Serbian
-       else if (!strncmp(system_lang, "sr", strlen("sr")))
+       else if (STRING_EQUAL == strncmp(system_lang, "sr", strlen("sr")))
                type = CTSVC_LANG_SERBIAN;
        // sv, Finland - Swedish
-       else if (!strncmp(system_lang, "sv", strlen("sv")))
+       else if (STRING_EQUAL == strncmp(system_lang, "sv", strlen("sv")))
                type = CTSVC_LANG_SWEDISH;
        // tr_TR, Turkey - Turkish
-       else if (!strncmp(system_lang, "tr", strlen("tr")))
+       else if (STRING_EQUAL == strncmp(system_lang, "tr", strlen("tr")))
                type = CTSVC_LANG_TURKISH;
        // uk, Ukraine
-       else if (!strncmp(system_lang, "uk", strlen("uk")))
+       else if (STRING_EQUAL == strncmp(system_lang, "uk", strlen("uk")))
                type = CTSVC_LANG_UKRAINE;
        // zh_CN, zh_HK, zh_SG, zh_TW
-       else if (!strncmp(system_lang, "zh", strlen("zh")))
+       else if (STRING_EQUAL == strncmp(system_lang, "zh", strlen("zh")))
                type = CTSVC_LANG_CHINESE;
        // th_TH
-       else if (!strncmp(system_lang, "th", strlen("th")))
+       else if (STRING_EQUAL == strncmp(system_lang, "th", strlen("th")))
                type = CTSVC_LANG_THAI;
-       else if (!strncmp(system_lang, "as", strlen("as")))
+       else if (STRING_EQUAL == strncmp(system_lang, "as", strlen("as")))
                type = CTSVC_LANG_BENGALI;
-       else if (!strncmp(system_lang, "bn", strlen("bn")))
+       else if (STRING_EQUAL == strncmp(system_lang, "bn", strlen("bn")))
                type = CTSVC_LANG_BENGALI;
-       else if (!strncmp(system_lang, "pa", strlen("pa")))
+       else if (STRING_EQUAL == strncmp(system_lang, "pa", strlen("pa")))
                type = CTSVC_LANG_PUNJABI;
-       else if (!strncmp(system_lang, "ml", strlen("ml")))
+       else if (STRING_EQUAL == strncmp(system_lang, "ml", strlen("ml")))
                type = CTSVC_LANG_MALAYALAM;
-       else if (!strncmp(system_lang, "te", strlen("te")))
+       else if (STRING_EQUAL == strncmp(system_lang, "te", strlen("te")))
                type = CTSVC_LANG_TELUGU;
-       else if (!strncmp(system_lang, "ta", strlen("ta")))
+       else if (STRING_EQUAL == strncmp(system_lang, "ta", strlen("ta")))
                type = CTSVC_LANG_TAMIL;
-       else if (!strncmp(system_lang, "or", strlen("or")))
+       else if (STRING_EQUAL == strncmp(system_lang, "or", strlen("or")))
                type = CTSVC_LANG_ORIYA;
-       else if (!strncmp(system_lang, "si", strlen("si")))
+       else if (STRING_EQUAL == strncmp(system_lang, "si", strlen("si")))
                type = CTSVC_LANG_SINHALA;
-       else if (!strncmp(system_lang, "gu", strlen("gu")))
+       else if (STRING_EQUAL == strncmp(system_lang, "gu", strlen("gu")))
                type = CTSVC_LANG_GUJARATI;
-       else if (!strncmp(system_lang, "kn", strlen("kn")))
+       else if (STRING_EQUAL == strncmp(system_lang, "kn", strlen("kn")))
                type = CTSVC_LANG_KANNADA;
-       else if (!strncmp(system_lang, "lo", strlen("lo")))
+       else if (STRING_EQUAL == strncmp(system_lang, "lo", strlen("lo")))
                type = CTSVC_LANG_LAO;
-       else if (!strncmp(system_lang, "he", strlen("he")))
+       else if (STRING_EQUAL == strncmp(system_lang, "he", strlen("he")))
                type = CTSVC_LANG_HEBREW;
-       else if (!strncmp(system_lang, "vi", strlen("vi")))
+       else if (STRING_EQUAL == strncmp(system_lang, "vi", strlen("vi")))
                type = CTSVC_LANG_VIETNAMESE;
-       else if (!strncmp(system_lang, "fa", strlen("fa")))
+       else if (STRING_EQUAL == strncmp(system_lang, "fa", strlen("fa")))
                type = CTSVC_LANG_PERSIAN;
-       else if (!strncmp(system_lang, "uz", strlen("uz")))
+       else if (STRING_EQUAL == strncmp(system_lang, "uz", strlen("uz")))
                type = CTSVC_LANG_UZBEK;
-       else if (!strncmp(system_lang, "ur", strlen("ur")))
+       else if (STRING_EQUAL == strncmp(system_lang, "ur", strlen("ur")))
                type = CTSVC_LANG_URDU;
-       else if (!strncmp(system_lang, "sq", strlen("sq")))
+       else if (STRING_EQUAL == strncmp(system_lang, "sq", strlen("sq")))
                type = CTSVC_LANG_ALBANIAN;
-       else if (!strncmp(system_lang, "my", strlen("my")))
+       else if (STRING_EQUAL == strncmp(system_lang, "my", strlen("my")))
                type = CTSVC_LANG_BURMESE;
-       else if (!strncmp(system_lang, "ms", strlen("ms")))
+       else if (STRING_EQUAL == strncmp(system_lang, "ms", strlen("ms")))
                type = CTSVC_LANG_MALAY;
-       else if (!strncmp(system_lang, "km", strlen("km")))
+       else if (STRING_EQUAL == strncmp(system_lang, "km", strlen("km")))
                type = CTSVC_LANG_KHMER;
-       else if (!strncmp(system_lang, "id", strlen("id")))
+       else if (STRING_EQUAL == strncmp(system_lang, "id", strlen("id")))
                type = CTSVC_LANG_INDONESIAN;
-       else if (!strncmp(system_lang, "tl", strlen("tl")))
+       else if (STRING_EQUAL == strncmp(system_lang, "tl", strlen("tl")))
                type = CTSVC_LANG_TAGALOG;
        else
                type = CTSVC_LANG_OTHERS;
index 188b422..690103a 100755 (executable)
@@ -2176,8 +2176,8 @@ bool ctsvc_has_chinese(const char *src)
        UChar   temp[strlen(src)+1];
        UErrorCode status = 0;
 
-       RETVM_IF(src==NULL, false, "src is NULL");
-       RETVM_IF(!*src, false, "*src is NULL");
+       RETVM_IF(NULL == src, false, "src is NULL");
+       RETVM_IF('\0' == *src, false, "*src is NULL");
 
        u_strFromUTF8(temp, array_sizeof(temp), NULL, src, -1, &status);
        if (U_FAILURE(status)) {
@@ -2208,8 +2208,8 @@ int ctsvc_convert_chinese_to_pinyin(const char *src, pinyin_name_s **name, int *
 
        *size = 0;
 
-       RETVM_IF(src==NULL, CONTACTS_ERROR_SYSTEM, "src is NULL");
-       RETVM_IF(!*src, CONTACTS_ERROR_SYSTEM, "*src is NULL");
+       RETVM_IF(NULL == src, CONTACTS_ERROR_SYSTEM, "src is NULL");
+       RETVM_IF('\0' == *src, CONTACTS_ERROR_SYSTEM, "*src is NULL");
 
        u_strFromUTF8(temp_result, array_sizeof(temp_result), NULL, src, -1, &status);
        if (U_FAILURE(status)) {
index c722698..49da85f 100644 (file)
@@ -153,17 +153,17 @@ void ctsvc_hangul_compatibility2jamo(UChar *src)
 
        if (CTSVC_COMPARE_BETWEEN(CTSVC_HAN_C_START, *src, CTSVC_HAN_C_END)) {
                char *pos;
-               if (NULL != (pos = strchr(hangul_compatibility_choseong, unicode_value2))) {
+               if ((pos = strchr(hangul_compatibility_choseong, unicode_value2))) {
                        unicode_value1 = 0x11;
                        unicode_value2 = hangul_jamo_choseong[pos - hangul_compatibility_choseong];
                        (*src) = unicode_value1 << 8 | unicode_value2;
                }
-               else if (NULL != (pos = strchr(hangul_compatibility_jungseong, unicode_value2))) {
+               else if ((pos = strchr(hangul_compatibility_jungseong, unicode_value2))) {
                        unicode_value1 = 0x11;
                        unicode_value2 = hangul_jamo_jungseong[pos - hangul_compatibility_jungseong];
                        (*src) = unicode_value1 << 8 | unicode_value2;
                }
-               else if (NULL != (pos = strchr(hangul_compatibility_jongseong, unicode_value2))) {
+               else if ((pos = strchr(hangul_compatibility_jongseong, unicode_value2))) {
                        unicode_value1 = 0x11;
                        unicode_value2 = hangul_jamo_jongseong[pos - hangul_compatibility_jongseong];
                        (*src) = unicode_value1 << 8 | unicode_value2;
index e1c06c2..931afc1 100644 (file)
@@ -286,7 +286,7 @@ char* ctsvc_get_network_cc(bool reload)
        TapiHandle *handle = NULL;
        static bool cc_loaded = false;
 
-       if (cc_loaded && !reload)
+       if (cc_loaded && false == reload)
                return cc;
 
        cc_loaded = true;
@@ -698,7 +698,7 @@ static int __ctsvc_number_has_ip_and_cc(const char*number, int len, int *index)
                                break;          // end of '+0'
                        case '1':               // '+1'
                                start_index++;
-                               if (start_index+2 <= len && strncmp(&number[start_index], "19", 2) == 0) {      // '+119'
+                               if (start_index+2 <= len && STRING_EQUAL == strncmp(&number[start_index], "19", 2)) {   // '+119'
                                        match_len = start_index + 2;
                                        ret = (have_plus?CTSVC_PLUS_IP_ONLY:CTSVC_IP_ONLY);
                                }
@@ -709,7 +709,7 @@ static int __ctsvc_number_has_ip_and_cc(const char*number, int len, int *index)
                                break;
                        case '8':               // '+8'
                                start_index++;
-                               if (start_index+2 <= len && strncmp(&number[start_index], "10", 2) == 0) {      // '+810'
+                               if (start_index+2 <= len && STRING_EQUAL == strncmp(&number[start_index], "10", 2)) {   // '+810'
                                        match_len = start_index + 2;
                                        ret = (have_plus?CTSVC_PLUS_IP_ONLY:CTSVC_IP_ONLY);
                                }
@@ -1084,14 +1084,14 @@ static bool __ctsvc_number_compare(const char *number1, const char *number2)
                                && (CTSVC_PLUS_CC_ONLY == n2 || CTSVC_CC_ONLY == n2)) {
                        int p = (CTSVC_PLUS_CC_ONLY == n2)?1:0;
                        cc_index = __ctsvc_phone_number_has_country_code(&number2[p], len2-p);
-                       if (0 < cc_index && strncmp(&number1[index1], &number2[p], cc_index) == 0)
+                       if (0 < cc_index && STRING_EQUAL == strncmp(&number1[index1], &number2[p], cc_index))
                                return true;
                }
                else if ((CTSVC_PLUS_IP_CC == n2 || CTSVC_IP_CC == n2)
                                && (CTSVC_PLUS_CC_ONLY == n1 || CTSVC_CC_ONLY == n1)) {
                        int p = (CTSVC_PLUS_CC_ONLY == n1)?1:0;
                        cc_index = __ctsvc_phone_number_has_country_code(&number1[p], len1-p);
-                       if (0 < cc_index && strncmp(&number2[index2], &number1[p], cc_index) == 0)
+                       if (0 < cc_index && STRING_EQUAL == strncmp(&number2[index2], &number1[p], cc_index))
                                return true;
                }
                ///////////////////////////////////////////////////
index ef04507..8818c6d 100644 (file)
@@ -317,7 +317,7 @@ static inline int __ctsvc_put_person_default_image(int person_id, int id)
        }
 
        // unset is_default of all data of person if the data is not default
-       if (!is_default) {
+       if (false == is_default) {
                snprintf(query, sizeof(query),
                                "UPDATE "CTS_TABLE_DATA" SET is_default=0 WHERE datatype=%d  AND is_my_profile = 0 "
                                        "AND contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id=%d) ",
@@ -442,7 +442,7 @@ static inline int __ctsvc_put_person_default_data(int person_id, int id, int dat
        }
 
        // unset is_default of all data of person if the data is not default
-       if (!is_default) {
+       if (false == is_default) {
                snprintf(query, sizeof(query),
                                "UPDATE "CTS_TABLE_DATA" SET is_default=0 WHERE datatype=%d AND is_my_profile = 0 "
                                        "AND contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id=%d) ",
@@ -787,7 +787,7 @@ int ctsvc_person_aggregate(int person_id)
 
                len += snprintf(addressbook_ids + len, addressbooks_len -len, "%d%s", addressbook_id, ADDRESSBOOK_ID_DELIM);
 
-               if (!image_thumbnail_path && contact_image_thumbnail_path && *contact_image_thumbnail_path) {
+               if (NULL == image_thumbnail_path && contact_image_thumbnail_path && *contact_image_thumbnail_path) {
                        temp = __ctsvc_get_image_filename(contact_image_thumbnail_path);
                        image_thumbnail_path = SAFE_STRDUP(temp);
                        // update data table : is_primary_default
@@ -795,17 +795,17 @@ int ctsvc_person_aggregate(int person_id)
                free(contact_image_thumbnail_path);
 
                temp_str = contact_ringtone_path;
-               if (!ringtone_path && temp_str && strlen(temp_str))
+               if (NULL == ringtone_path && temp_str && strlen(temp_str))
                        ringtone_path = SAFE_STRDUP(temp_str);
                free(contact_ringtone_path);
 
                temp_str = contact_vibration;
-               if (!vibration && temp_str && strlen(temp_str))
+               if (NULL == vibration && temp_str && strlen(temp_str))
                        vibration = SAFE_STRDUP(temp_str);
                free(contact_vibration);
 
                temp_str = contact_message_alert;
-               if (!message_alert && temp_str && strlen(temp_str))
+               if (NULL == message_alert && temp_str && strlen(temp_str))
                        message_alert = SAFE_STRDUP(temp_str);
                free(contact_message_alert);
 
@@ -873,7 +873,7 @@ int ctsvc_person_aggregate(int person_id)
        free(message_alert);
        free(status);
 
-       if (!person_is_favorite) {
+       if (false == person_is_favorite) {
                snprintf(query, sizeof(query),
                                "DELETE FROM "CTS_TABLE_FAVORITES" WHERE person_id = %d", person_id);
                ret = ctsvc_query_exec(query);
@@ -969,7 +969,7 @@ API int contacts_person_link_person(int base_person_id, int person_id)
        }
 
        base_is_favorite = __ctsvc_get_person_favorite_info(base_person_id, &favorite_prio);
-       if (!base_is_favorite)
+       if (false == base_is_favorite)
                is_favorite = __ctsvc_get_person_favorite_info(person_id, &favorite_prio);
 
        snprintf(query, sizeof(query),
index 20eea3a..bea32f5 100644 (file)
@@ -86,8 +86,7 @@ API int contacts_setting_set_name_display_order(contacts_name_display_order_e or
 API int contacts_setting_get_name_sorting_order(contacts_name_sorting_order_e *order)
 {
        int ret;
-       if (name_sorting_order < 0)
-       {
+       if (name_sorting_order < 0) {
                ret = vconf_get_int(CTSVC_VCONF_SORTING_ORDER, &name_sorting_order);
                RETVM_IF(ret<0, CONTACTS_ERROR_SYSTEM, "System : vconf_get_int(sort order) Fail(%d)", ret);
        }
index cd592cd..1e90064 100755 (executable)
@@ -50,7 +50,7 @@ int ctsvc_db_open(void) {
        CTS_FN_CALL;
        int ret;
 
-       if (!ctsvc_db) {
+       if (NULL == ctsvc_db) {
                ret = db_util_open(CTSVC_DB_PATH, &ctsvc_db, 0);
                RETVM_IF(SQLITE_OK != ret, CONTACTS_ERROR_DB /*CTS_ERR_DB_NOT_OPENED*/,
                                "DB error : db_util_open() Fail(%d)", ret);
index cbb3bd1..22c6299 100644 (file)
@@ -453,7 +453,7 @@ int ctsvc_utils_copy_image(const char *dir, const char *src, const char *file)
        char dest[strlen(dir) + strlen(file) + 2];
        snprintf(dest, sizeof(dest), "%s/%s", dir, file);
 
-       if (!ctsvc_check_available_image_space())
+       if (false == ctsvc_check_available_image_space())
                return CONTACTS_ERROR_FILE_NO_SPACE;
 
        ret = __ctsvc_resize_and_copy_image(src, dest);
index 758e583..af6b71e 100644 (file)
@@ -49,7 +49,7 @@ void ctsvc_ipc_server_connect(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_d
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        return;
                }
@@ -79,7 +79,7 @@ void ctsvc_ipc_server_disconnect(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ip
        if (outdata)
        {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata)
+               if (NULL == *outdata)
                {
                        CTS_ERR("pims_ipc_data_create fail");
                        return;
@@ -122,7 +122,7 @@ void ctsvc_ipc_server_check_permission(pims_ipc_h ipc, pims_ipc_data_h indata,
 
 ERROR_RETURN:
        *outdata = pims_ipc_data_create(0);
-       if (!*outdata) {
+       if (NULL == *outdata) {
                CTS_ERR("pims_ipc_data_create fail");
                return;
        }
@@ -172,7 +172,7 @@ void ctsvc_ipc_server_db_insert_record(pims_ipc_h ipc, pims_ipc_data_h indata, p
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -207,7 +207,7 @@ void ctsvc_ipc_server_db_insert_record(pims_ipc_h ipc, pims_ipc_data_h indata, p
 ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -264,7 +264,7 @@ void ctsvc_ipc_server_db_get_record(pims_ipc_h ipc, pims_ipc_data_h indata, pims
 ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -328,7 +328,7 @@ void ctsvc_ipc_server_db_update_record(pims_ipc_h ipc, pims_ipc_data_h indata, p
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -356,7 +356,7 @@ void ctsvc_ipc_server_db_update_record(pims_ipc_h ipc, pims_ipc_data_h indata, p
 ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -410,7 +410,7 @@ void ctsvc_ipc_server_db_delete_record(pims_ipc_h ipc, pims_ipc_data_h indata, p
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -438,7 +438,7 @@ void ctsvc_ipc_server_db_delete_record(pims_ipc_h ipc, pims_ipc_data_h indata, p
 ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -494,7 +494,7 @@ void ctsvc_ipc_server_db_replace_record(pims_ipc_h ipc, pims_ipc_data_h indata,
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -524,7 +524,7 @@ void ctsvc_ipc_server_db_replace_record(pims_ipc_h ipc, pims_ipc_data_h indata,
 ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -585,7 +585,7 @@ void ctsvc_ipc_server_db_get_all_records(pims_ipc_h ipc, pims_ipc_data_h indata,
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -618,7 +618,7 @@ void ctsvc_ipc_server_db_get_all_records(pims_ipc_h ipc, pims_ipc_data_h indata,
 ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -681,7 +681,7 @@ void ctsvc_ipc_server_db_get_records_with_query(pims_ipc_h ipc, pims_ipc_data_h
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -712,7 +712,7 @@ void ctsvc_ipc_server_db_get_records_with_query(pims_ipc_h ipc, pims_ipc_data_h
 ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -767,7 +767,7 @@ void ctsvc_ipc_server_db_get_count(pims_ipc_h ipc, pims_ipc_data_h indata, pims_
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -798,7 +798,7 @@ void ctsvc_ipc_server_db_get_count(pims_ipc_h ipc, pims_ipc_data_h indata, pims_
 ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -844,7 +844,7 @@ void ctsvc_ipc_server_db_get_count_with_query(pims_ipc_h ipc, pims_ipc_data_h in
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -875,7 +875,7 @@ void ctsvc_ipc_server_db_get_count_with_query(pims_ipc_h ipc, pims_ipc_data_h in
 ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -940,7 +940,7 @@ void ctsvc_ipc_server_db_insert_records(pims_ipc_h ipc, pims_ipc_data_h indata,
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -990,7 +990,7 @@ void ctsvc_ipc_server_db_insert_records(pims_ipc_h ipc, pims_ipc_data_h indata,
 ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -1053,7 +1053,7 @@ void ctsvc_ipc_server_db_update_records(pims_ipc_h ipc, pims_ipc_data_h indata,
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -1083,7 +1083,7 @@ void ctsvc_ipc_server_db_update_records(pims_ipc_h ipc, pims_ipc_data_h indata,
 ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -1152,7 +1152,7 @@ void ctsvc_ipc_server_db_delete_records(pims_ipc_h ipc, pims_ipc_data_h indata,
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                }
                if (pims_ipc_data_put(*outdata,(void*)&ret,sizeof(int)) != 0) {
@@ -1182,7 +1182,7 @@ void ctsvc_ipc_server_db_delete_records(pims_ipc_h ipc, pims_ipc_data_h indata,
 ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -1265,7 +1265,7 @@ void ctsvc_ipc_server_db_replace_records(pims_ipc_h ipc, pims_ipc_data_h indata,
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -1294,7 +1294,7 @@ void ctsvc_ipc_server_db_replace_records(pims_ipc_h ipc, pims_ipc_data_h indata,
 ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -1356,7 +1356,7 @@ void ctsvc_ipc_server_db_get_changes_by_version(pims_ipc_h ipc, pims_ipc_data_h
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -1397,7 +1397,7 @@ void ctsvc_ipc_server_db_get_changes_by_version(pims_ipc_h ipc, pims_ipc_data_h
 ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -1436,7 +1436,7 @@ void ctsvc_ipc_server_db_get_current_version(pims_ipc_h ipc, pims_ipc_data_h ind
 ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        return;
                }
@@ -1509,7 +1509,7 @@ void ctsvc_ipc_server_db_search_records(pims_ipc_h ipc, pims_ipc_data_h indata,
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -1540,7 +1540,7 @@ void ctsvc_ipc_server_db_search_records(pims_ipc_h ipc, pims_ipc_data_h indata,
 ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -1616,7 +1616,7 @@ void ctsvc_ipc_server_db_search_records_with_range(pims_ipc_h ipc, pims_ipc_data
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -1647,7 +1647,7 @@ void ctsvc_ipc_server_db_search_records_with_range(pims_ipc_h ipc, pims_ipc_data
 ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -1718,7 +1718,7 @@ void ctsvc_ipc_server_db_search_records_with_query(pims_ipc_h ipc, pims_ipc_data
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -1749,7 +1749,7 @@ void ctsvc_ipc_server_db_search_records_with_query(pims_ipc_h ipc, pims_ipc_data
 ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
index e1c697e..7780d84 100644 (file)
@@ -62,7 +62,7 @@ ERROR_RETURN:
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        return;
                }
@@ -117,7 +117,7 @@ ERROR_RETURN:
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        return;
                }
@@ -179,7 +179,7 @@ ERROR_RETURN:
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        return;
                }
@@ -242,7 +242,7 @@ ERROR_RETURN:
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        return;
                }
@@ -310,7 +310,7 @@ ERROR_RETURN:
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        return;
                }
@@ -371,7 +371,7 @@ ERROR_RETURN:
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        return;
                }
@@ -432,7 +432,7 @@ ERROR_RETURN:
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        return;
                }
@@ -500,7 +500,7 @@ ERROR_RETURN:
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        return;
                }
@@ -566,7 +566,7 @@ ERROR_RETURN:
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        return;
                }
@@ -628,7 +628,7 @@ ERROR_RETURN:
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        return;
                }
@@ -691,7 +691,7 @@ ERROR_RETURN:
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        return;
                }
@@ -730,7 +730,7 @@ void ctsvc_ipc_phone_log_reset_statistics(pims_ipc_h ipc, pims_ipc_data_h indata
 ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        return;
                }
@@ -805,7 +805,7 @@ void ctsvc_ipc_phone_log_delete(pims_ipc_h ipc, pims_ipc_data_h indata,
 ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        goto DATA_FREE;
                }
@@ -848,7 +848,7 @@ void ctsvc_ipc_setting_get_name_display_order(pims_ipc_h ipc, pims_ipc_data_h in
 ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        return;
                }
@@ -888,7 +888,7 @@ void ctsvc_ipc_setting_get_name_sorting_order(pims_ipc_h ipc, pims_ipc_data_h in
 ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        return;
                }
@@ -940,7 +940,7 @@ void ctsvc_ipc_setting_set_name_display_order(pims_ipc_h ipc,
 ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        return;
                }
@@ -986,7 +986,7 @@ void ctsvc_ipc_setting_set_name_sorting_order(pims_ipc_h ipc,
 ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
-               if (!*outdata) {
+               if (NULL == *outdata) {
                        CTS_ERR("pims_ipc_data_create fail");
                        return;
                }
index ed4269e..f2cd645 100644 (file)
@@ -43,7 +43,7 @@ static gboolean __ctsvc_publish_changes_with_data(const char *view_uri, char *da
                return true;
 
        indata = pims_ipc_data_create(0);
-       if (!indata) {
+       if (NULL == indata) {
                CTS_ERR("pims_ipc_data_create error\n");
                return false;
        }
@@ -120,7 +120,7 @@ void ctsvc_change_subject_add_changed_person_id(contacts_changed_e type, int id)
        int info_len = 0;
        char changed_info[30] = {0};
 
-       if (!__person_changed_info) {
+       if (NULL == __person_changed_info) {
                __person_changed_info = (char*)calloc(CTSVC_SUBSCRIBE_MAX_LEN, sizeof(char));
                __person_buf_size = CTSVC_SUBSCRIBE_MAX_LEN;
                __person_changed_info[0] = '\0';
index 0820caf..8b93c6d 100644 (file)
@@ -107,7 +107,7 @@ static TapiHandle* __ctsvc_server_sim_get_tapi_handle(ctsvc_sim_info_s *info)
                // TODO: it should be changed API
                vconf_get_bool(VCONFKEY_TELEPHONY_READY, &bReady);
 
-               if (!bReady) {
+               if (0 == bReady) {
                        CTS_ERR("telephony is not ready ");
                        return NULL;
                }
@@ -406,7 +406,7 @@ static void __ctsvc_server_sim_import_contact_cb(TapiHandle *handle, int result,
 
        if (access_rt == TAPI_SIM_PB_INVALID_INDEX) {
                int start_index = 0;
-               if (user_data != NULL)
+               if (user_data)
                        start_index = (int)user_data;
                CTS_DBG("TAPI_SIM_PB_INVALID_INDEX : start_index = %d",start_index);
                start_index++;
@@ -484,7 +484,7 @@ int ctsvc_server_sim_import_contact(void* data, int sim_slot_no)
        info = __ctsvc_server_sim_get_handle_by_sim_slot_no(sim_slot_no);
        RETVM_IF(NULL == info, CONTACTS_ERROR_SYSTEM, "sim init is not completed");
        RETVM_IF(false == info->initialized, CONTACTS_ERROR_SYSTEM, "sim init is not completed");
-       RETVM_IF(NULL != __ctsvc_server_sim_get_return_data(), CONTACTS_ERROR_INTERNAL,
+       RETVM_IF(__ctsvc_server_sim_get_return_data(), CONTACTS_ERROR_INTERNAL,
                        "Server is already processing with sim");
 
        __ctsvc_server_sim_set_return_data(data);
@@ -601,7 +601,7 @@ static int __ctsvc_server_sim_sdn_read(ctsvc_sim_info_s* info)
        int card_changed = 0;
        TelSimCardStatus_t sim_status;
 
-       RETVM_IF(NULL != __ctsvc_server_sim_get_return_data(), CONTACTS_ERROR_INTERNAL,
+       RETVM_IF(__ctsvc_server_sim_get_return_data(), CONTACTS_ERROR_INTERNAL,
                        "Server is already processing with sim");
 
        ret = tel_get_sim_init_info(info->handle, &sim_status, &card_changed);
@@ -697,7 +697,7 @@ static void __ctsvc_server_sim_get_meta_info_cb(TapiHandle *handle, int result,
                return;
        }
 
-       if (!info->initialized) {
+       if (false == info->initialized) {
                info->initialized = true;
                ret = __ctsvc_server_sim_sdn_read(info);
                WARN_IF(CONTACTS_ERROR_NONE != ret, "__ctsvc_server_sim_sdn_read() Fail(%d)", ret);
@@ -921,7 +921,7 @@ static void __ctsvc_server_telephony_ready_cb(keynode_t *key, void *data)
        // TODO: it should be changed API
        vconf_get_bool(VCONFKEY_TELEPHONY_TAPI_STATE, &bReady);
 
-       if (!bReady) {
+       if (0 == bReady) {
                CTS_ERR("telephony is not ready ");
                return;
        }
@@ -949,7 +949,7 @@ int ctsvc_server_sim_init()
        // TODO: it should be changed API
        vconf_get_bool(VCONFKEY_TELEPHONY_TAPI_STATE, &bReady);
 
-       if (!bReady) {
+       if (0 == bReady) {
                CTS_ERR("telephony is not ready ");
                vconf_notify_key_changed(VCONFKEY_TELEPHONY_TAPI_STATE, __ctsvc_server_telephony_ready_cb, NULL);
                __ctsvc_tapi_cb = true;
index 408fcf1..422c1cc 100644 (file)
@@ -311,7 +311,7 @@ static gboolean __ctsvc_server_socket_request_handler(GIOChannel *src, GIOCondit
 
        bool have_telephony_feature = false;
        have_telephony_feature = ctsvc_server_have_telephony_feature();
-       if (!have_telephony_feature) {
+       if (false == have_telephony_feature) {
                CTS_ERR("Telephony feature disabled");
                __ctsvc_server_socket_read_flush(src, msg.attach_sizes[0]);     // sim_id
                ctsvc_server_socket_return(src, CONTACTS_ERROR_NOT_SUPPORTED, 0, NULL);
@@ -334,7 +334,7 @@ static gboolean __ctsvc_server_socket_request_handler(GIOChannel *src, GIOCondit
        switch (msg.type) {
 #ifdef ENABLE_SIM_FEATURE
        case CTSVC_SOCKET_MSG_TYPE_REQUEST_IMPORT_SIM:
-               if (!have_write_permission) {
+               if (false == have_write_permission) {
                        CTS_ERR("write permission denied");
                        __ctsvc_server_socket_read_flush(src, msg.attach_sizes[0]);             // sim_id
                        ctsvc_server_socket_return(src, CONTACTS_ERROR_PERMISSION_DENIED, 0, NULL);
@@ -343,7 +343,7 @@ static gboolean __ctsvc_server_socket_request_handler(GIOChannel *src, GIOCondit
                __ctsvc_server_socket_import_sim(src, msg.attach_sizes[0]);
                break;
        case CTSVC_SOCKET_MSG_TYPE_REQUEST_SIM_INIT_COMPLETE:
-               if (!have_read_permission) {
+               if (false == have_read_permission) {
                        CTS_ERR("read permission denied");
                        __ctsvc_server_socket_read_flush(src, msg.attach_sizes[0]);             // sim_id
                        ctsvc_server_socket_return(src, CONTACTS_ERROR_PERMISSION_DENIED, 0, NULL);
index fc60fe9..98bf082 100755 (executable)
@@ -55,7 +55,7 @@ int ctsvc_server_db_open(sqlite3 **db)
        CTS_FN_CALL;
        int ret;
 
-       if (!server_db) {
+       if (NULL == server_db) {
                ret = db_util_open(CTSVC_DB_PATH, &server_db, 0);
                RETVM_IF(ret != SQLITE_OK, CONTACTS_ERROR_DB,
                                "db_util_open() Fail(%d)", ret);
index b5f5b76..1f60240 100755 (executable)
@@ -81,12 +81,12 @@ static void __ctsvc_server_change_language_cb(keynode_t *key, void *data)
                        RETM_IF(ret<0, "ctsvc_get_secondary_sort() Fail(%d)", ret);
                }
 
-               if (strncmp(langset, "zh", strlen("zh")) == 0 ||
-                       strncmp(langset, "ko", strlen("ko")) == 0 ||
-                       strncmp(langset, "ja", strlen("ja")) == 0 ||
-                       strncmp(new_langset, "zh", strlen("zh")) == 0 ||
-                       strncmp(new_langset, "ko", strlen("ko")) == 0 ||
-                       strncmp(new_langset, "ja", strlen("ja")) == 0) {
+               if (STRING_EQUAL == strncmp(langset, "zh", strlen("zh")) ||
+                               STRING_EQUAL == strncmp(langset, "ko", strlen("ko")) ||
+                               STRING_EQUAL == strncmp(langset, "ja", strlen("ja")) ||
+                               STRING_EQUAL == strncmp(new_langset, "zh", strlen("zh")) ||
+                               STRING_EQUAL == strncmp(new_langset, "ko", strlen("ko")) ||
+                               STRING_EQUAL == strncmp(new_langset, "ja", strlen("ja"))) {
                        sort_name_update = true;
                }
                ctsvc_set_langset(strdup(new_langset));
diff --git a/server/ctsvc_server_zone.c b/server/ctsvc_server_zone.c
deleted file mode 100644 (file)
index 6701e2f..0000000
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * Contacts Service
- *
- * Copyright (c) 2010 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-
-#include "contacts.h"
-#include "ctsvc_socket.h"
-#include "ctsvc_service.h"
-#include "ctsvc_server_bg.h"
-#include "ctsvc_db_access_control.h"
-#include "ctsvc_ipc_define.h"
-#include "ctsvc_internal.h"
-#include "ctsvc_notification.h"
-#include "ctsvc_schema_recovery.h"
-#include "ctsvc_server_update.h"
-#include "ctsvc_server_zone.h"
-#include "ctsvc_server_utils.h"
-#include "ctsvc_zone.h"
-
-vsm_context_h ctsvc_vsm_ctx = NULL;
-static bool _ctsvc_zone_enabled = false;
-
-void ctsvc_server_zone_finalize_zone(const char *zone_name)
-{
-       ctsvc_server_bg_remove_cb(zone_name);
-       ctsvc_unset_client_access_info(zone_name);
-       ctsvc_disconnect(zone_name);
-}
-
-char* ctsvc_server_zone_get_default_zone()
-{
-       if (_ctsvc_zone_enabled)
-               return CTSVC_ZONE_NAME_PERSONAL;
-       else
-               return CTSVC_ZONE_NAME_HOST;
-}
-
-void ctsvc_server_zone_initialize_zone(const char *zone_name)
-{
-       CTS_FN_CALL;
-
-       if (zone_name && *zone_name)
-               _ctsvc_zone_enabled = true;
-
-       int ret;
-
-       ctsvc_noti_publish_socket_initialize(zone_name);
-
-       ret = ctsvc_server_check_schema(zone_name);
-       WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_check_schema() Fail(%d)", ret);
-
-       ret = ctsvc_server_db_update(zone_name);
-       WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_db_update() Fail(%d)", ret);
-
-       ret = ctsvc_connect(zone_name);
-       WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_connect() Fail(%d)", ret);
-
-       ctsvc_set_client_access_info(zone_name, "contacts-service", NULL);
-       ctsvc_server_bg_add_cb(zone_name);
-       ctsvc_server_bg_delete_start(zone_name);
-
-       if ('\0' == *zone_name || STRING_EQUAL == g_strcmp0(zone_name, CTSVC_ZONE_NAME_PERSONAL)) {
-               ret = ctsvc_server_init_configuration();
-               WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_init_configuration() Fail(%d)", ret);
-       }
-}
-
-static int _ctsvc_vsm_status_cb(vsm_zone_h zone, vsm_zone_state_t state, void *user_data)
-{
-       CTS_FN_CALL;
-
-       const char *zone_name = vsm_get_zone_name(zone);
-       CTS_DBG("state(%d) [%s]", state, zone_name);
-
-       switch (state) {
-       case VSM_ZONE_STATE_STARTING:
-               CTS_DBG("STARTING");
-               ctsvc_server_zone_initialize_zone(zone_name);
-               break;
-       case VSM_ZONE_STATE_STOPPED:
-               CTS_DBG("STOPPED");
-               break;
-       case VSM_ZONE_STATE_RUNNING:
-               CTS_DBG("RUNNING");
-               break;
-       case VSM_ZONE_STATE_STOPPING:
-               CTS_DBG("STOPPING");
-               ctsvc_server_zone_finalize_zone(zone_name);
-               break;
-       case VSM_ZONE_STATE_ABORTING:
-               CTS_DBG("ABORTING");
-               break;
-       case VSM_ZONE_STATE_FREEZING:
-               CTS_DBG("FREEZING");
-               break;
-       case VSM_ZONE_STATE_FROZEN:
-               CTS_DBG("FROZEN");
-               break;
-       case VSM_ZONE_STATE_THAWED:
-               CTS_DBG("THAWED");
-               break;
-       default:
-               CTS_DBG("###### invalid status");
-               break;
-       }
-CTS_FN_END;
-       return 0;
-}
-
-static gboolean _ctsvc_server_zone_mainloop_cb(GIOChannel *channel, GIOCondition condition, void *data)
-{
-       CTS_FN_CALL;
-       vsm_context_h ctx = data;
-       vsm_enter_eventloop(ctx, 0, 0);
-       return TRUE;
-}
-
-int ctsvc_server_zone_initialize(void)
-{
-       CTS_FN_CALL;
-       int ret = 0;
-
-       if (ctsvc_vsm_ctx) {
-               CTS_DBG("already existed");
-               ctsvc_server_zone_finalize();
-       }
-
-       vsm_context_h ctx = vsm_create_context();
-       RETVM_IF(NULL == ctx, CONTACTS_ERROR_DB, "vsm_create_context() return NULL");
-
-       ret = vsm_add_state_changed_callback(ctx, _ctsvc_vsm_status_cb, NULL);
-       WARN_IF(ret < 0, "vsm_add_state_callback() Fail(%d)", ret);
-
-       GIOChannel *channel = NULL;
-       int fd = vsm_get_poll_fd(ctx);
-       channel = g_io_channel_unix_new(fd);
-       g_io_add_watch(channel, G_IO_IN, _ctsvc_server_zone_mainloop_cb, ctx);
-       g_io_channel_unref(channel);
-
-       ctsvc_vsm_ctx = ctx;
-
-       CTS_FN_END;
-
-       return CONTACTS_ERROR_NONE;
-}
-
-int ctsvc_server_zone_declare_link(void)
-{
-       CTS_FN_CALL;
-       int ret = 0;
-
-       if (NULL == ctsvc_vsm_ctx) {
-               ret = ctsvc_server_zone_initialize();
-               RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_server_zone_initialize() Fail(%d)", ret);
-       }
-       vsm_context_h ctx = ctsvc_vsm_ctx;
-
-       ret = vsm_declare_link(ctx, CTSVC_SOCKET_PATH, CTSVC_SOCKET_PATH);
-       RETVM_IF(ret < 0, ret, "vsm_declare_link() Fail(%d)", ret);
-
-       ret = vsm_declare_link(ctx, CTSVC_IPC_SOCKET_PATH, CTSVC_IPC_SOCKET_PATH);
-       RETVM_IF(ret < 0, ret, "vsm_declare_link() Fail(%d)", ret);
-
-       ret = vsm_declare_link(ctx, CTSVC_IPC_SOCKET_PATH_FOR_CHANGE_SUBSCRIPTION, CTSVC_IPC_SOCKET_PATH_FOR_CHANGE_SUBSCRIPTION);
-       RETVM_IF(ret < 0, ret, "vsm_declare_link() Fail(%d)", ret);
-
-       return CONTACTS_ERROR_NONE;
-}
-
-void ctsvc_server_zone_finalize(void)
-{
-       RET_IF(NULL == ctsvc_vsm_ctx);
-       vsm_cleanup_context(ctsvc_vsm_ctx);
-}
-
-int ctsvc_server_zone_get_zone_name_by_pid(int pid, char **p_zone_name)
-{
-       if (NULL == ctsvc_vsm_ctx)
-               ctsvc_server_zone_initialize();
-
-       RETV_IF(pid < 0, CONTACTS_ERROR_INVALID_PARAMETER);
-       RETV_IF(NULL == p_zone_name, CONTACTS_ERROR_INVALID_PARAMETER);
-
-       vsm_zone_h zone = NULL;
-       zone = vsm_lookup_zone_by_pid(ctsvc_vsm_ctx, pid);
-       RETVM_IF(NULL == zone, CONTACTS_ERROR_INVALID_PARAMETER, "vsm_lookup_zone_by_pid() return NULL");
-
-       const char *zone_name = vsm_get_zone_name(zone);
-       *p_zone_name = g_strdup(zone_name);
-
-       return CONTACTS_ERROR_NONE;
-}
-
-static void _ctsvc_server_zone_get_activated_zone_iter_cb(vsm_zone_h zone, void *user_data)
-{
-       GList **list = user_data;
-
-       // try to connect zone with before launched service.
-       RET_IF(NULL == zone);
-       const char *zone_name = vsm_get_zone_name(zone);
-       RET_IF(NULL == zone_name);
-
-       *list = g_list_append(*list, strdup(zone_name));
-}
-
-int ctsvc_server_zone_get_activated_zone_name_list(char ***p_zone_name_list, int *p_list_count)
-{
-       CTS_FN_CALL;
-       int ret;
-       GList *list = NULL;
-
-       RETV_IF(NULL == p_zone_name_list, CONTACTS_ERROR_INVALID_PARAMETER);
-       RETV_IF(NULL == p_list_count, CONTACTS_ERROR_INVALID_PARAMETER);
-       *p_zone_name_list = NULL;
-       *p_list_count = 0;
-
-       RETVM_IF(NULL == ctsvc_vsm_ctx, CONTACTS_ERROR_SYSTEM, "ctsvc_vsm_ctx is NULL");
-       ret = vsm_iterate_zone(ctsvc_vsm_ctx, _ctsvc_server_zone_get_activated_zone_iter_cb, &list); // return value is handle
-       WARN_IF(0 != ret, "vsm_iterate_zone() Fail(%d)", ret);
-
-       GList *c;
-       char **zone_name_list = NULL;
-       int list_count = g_list_length(list);
-       zone_name_list = calloc(list_count, sizeof(char *));
-
-       int i=0;
-       for (c=list;c;c=c->next) {
-               char *zone_name = c->data;
-               zone_name_list[i++] = zone_name;
-       }
-       g_list_free(list);
-
-       *p_zone_name_list = zone_name_list;
-       *p_list_count = list_count;
-
-       return CONTACTS_ERROR_NONE;
-}
-
-vsm_zone_h ctsvc_server_zone_lookup_by_zone_name(const char *zone_name)
-{
-       RETVM_IF(NULL == ctsvc_vsm_ctx, NULL, "ctsvc_vsm_ctx is NULL");
-       vsm_zone_h zone = vsm_lookup_zone_by_name(ctsvc_vsm_ctx, zone_name);
-       return zone;
-}
-
-vsm_zone_h ctsvc_server_zone_join(vsm_zone_h zone)
-{
-       CTS_FN_CALL;
-       RETVM_IF(NULL == zone, NULL, "zone is NULL");
-       RETVM_IF(NULL == ctsvc_vsm_ctx, NULL, "ctsvc_vsm_ctx is NULL");
-       vsm_zone_h zone_old = vsm_join_zone(zone);
-       return zone_old;
-}
-