apply coding style 50/55050/5
authorYoungjae Shin <yj99.shin@samsung.com>
Mon, 21 Dec 2015 10:45:34 +0000 (19:45 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Tue, 22 Dec 2015 07:33:15 +0000 (16:33 +0900)
Change-Id: I854fe8e0abddf4fc06a2889719aa39f5af19f679

247 files changed:
CMakeLists.txt [changed mode: 0755->0644]
LICENSE.APLv2
NOTICE
build-util/DB-schema-gen.c [changed mode: 0755->0644]
build-util/DB-schema-gen2.c [changed mode: 0755->0644]
build-util/Makefile [changed mode: 0755->0644]
build-util/generator.sh
client/CMakeLists.txt
client/contacts-service2.pc.in
client/ctsvc_client_activity.c
client/ctsvc_client_activity_helper.c
client/ctsvc_client_db.c
client/ctsvc_client_db_helper.c
client/ctsvc_client_db_helper.h
client/ctsvc_client_db_notification.c
client/ctsvc_client_group_helper.c
client/ctsvc_client_handle.c
client/ctsvc_client_handle.h
client/ctsvc_client_ipc.c
client/ctsvc_client_noti.c
client/ctsvc_client_person.c
client/ctsvc_client_person_helper.c
client/ctsvc_client_person_helper.h
client/ctsvc_client_phonelog.c
client/ctsvc_client_phonelog_helper.c
client/ctsvc_client_service.c
client/ctsvc_client_service_helper.c
client/ctsvc_client_service_helper.h
client/ctsvc_client_setting.c
common/ctsvc_filter.c
common/ctsvc_filter.h
common/ctsvc_handle.c
common/ctsvc_handle.h
common/ctsvc_inotify.c
common/ctsvc_inotify.h
common/ctsvc_internal.h
common/ctsvc_list.c
common/ctsvc_list.h
common/ctsvc_localize.c [deleted file]
common/ctsvc_localize.h [deleted file]
common/ctsvc_localize_ch.c [deleted file]
common/ctsvc_localize_ch.h [deleted file]
common/ctsvc_localize_utils.c
common/ctsvc_localize_utils.h
common/ctsvc_mutex.c
common/ctsvc_mutex.h
common/ctsvc_normalize.c [deleted file]
common/ctsvc_normalize.h [deleted file]
common/ctsvc_notify.h
common/ctsvc_query.c
common/ctsvc_record.c
common/ctsvc_record.h
common/ctsvc_record_addressbook.c
common/ctsvc_record_contact.c
common/ctsvc_record_group.c
common/ctsvc_record_my_profile.c
common/ctsvc_record_person.c
common/ctsvc_record_phonelog.c
common/ctsvc_record_result.c
common/ctsvc_record_sdn.c
common/ctsvc_record_speeddial.c
common/ctsvc_record_updated_info.c
common/ctsvc_sim.c
common/ctsvc_socket.c
common/ctsvc_socket.h
common/ctsvc_struct.h
common/ctsvc_vcard.c
common/ctsvc_view.c
common/ctsvc_view.h
common/ipc/ctsvc_ipc_activity.c
common/ipc/ctsvc_ipc_activity_photo.c
common/ipc/ctsvc_ipc_address.c
common/ipc/ctsvc_ipc_addressbook.c
common/ipc/ctsvc_ipc_company.c
common/ipc/ctsvc_ipc_contact.c
common/ipc/ctsvc_ipc_define.h
common/ipc/ctsvc_ipc_email.c
common/ipc/ctsvc_ipc_event.c
common/ipc/ctsvc_ipc_extension.c
common/ipc/ctsvc_ipc_group.c
common/ipc/ctsvc_ipc_grouprelation.c
common/ipc/ctsvc_ipc_image.c
common/ipc/ctsvc_ipc_marshal.c
common/ipc/ctsvc_ipc_marshal.h
common/ipc/ctsvc_ipc_messenger.c
common/ipc/ctsvc_ipc_my_profile.c
common/ipc/ctsvc_ipc_name.c
common/ipc/ctsvc_ipc_nickname.c
common/ipc/ctsvc_ipc_note.c
common/ipc/ctsvc_ipc_number.c
common/ipc/ctsvc_ipc_person.c
common/ipc/ctsvc_ipc_phonelog.c
common/ipc/ctsvc_ipc_profile.c
common/ipc/ctsvc_ipc_relationship.c
common/ipc/ctsvc_ipc_result.c
common/ipc/ctsvc_ipc_sdn.c
common/ipc/ctsvc_ipc_simple_contact.c
common/ipc/ctsvc_ipc_speeddial.c
common/ipc/ctsvc_ipc_updated_info.c
common/ipc/ctsvc_ipc_url.c
doc/contacts_doc.h
include/contacts.h
include/contacts_activity.h
include/contacts_db.h
include/contacts_db_extension.h
include/contacts_db_status.h
include/contacts_errors.h
include/contacts_filter.h
include/contacts_group.h
include/contacts_internal.h
include/contacts_list.h
include/contacts_person.h
include/contacts_phone_log.h
include/contacts_phone_log_internal.h
include/contacts_query.h
include/contacts_record.h
include/contacts_service.h
include/contacts_setting.h
include/contacts_sim.h
include/contacts_types.h
include/contacts_vcard.h
include/contacts_views.h
packaging/contacts-service.manifest [moved from contacts-service2.manifest with 100% similarity]
packaging/contacts-service.spec
schema.sql [changed mode: 0755->0644]
server/CMakeLists.txt
server/ctsvc_ipc_server.c
server/ctsvc_ipc_server2.c
server/ctsvc_ipc_server_sim.c
server/ctsvc_localize.c
server/ctsvc_localize.h
server/ctsvc_localize_ch.c
server/ctsvc_localize_ch.h
server/ctsvc_localize_jp.c
server/ctsvc_localize_jp.h
server/ctsvc_localize_kor.c
server/ctsvc_localize_kor.h
server/ctsvc_normalize.c
server/ctsvc_normalize.h
server/ctsvc_notification.c
server/ctsvc_notification.h
server/ctsvc_number_utils.c
server/ctsvc_number_utils.h
server/ctsvc_schema_recovery.c
server/ctsvc_schema_recovery.h
server/ctsvc_server.c
server/ctsvc_server_activity.c
server/ctsvc_server_activity.h
server/ctsvc_server_bg.c
server/ctsvc_server_change_subject.c
server/ctsvc_server_change_subject.h
server/ctsvc_server_group.c
server/ctsvc_server_group.h
server/ctsvc_server_person.c
server/ctsvc_server_person.h
server/ctsvc_server_phonelog.c
server/ctsvc_server_phonelog.h
server/ctsvc_server_service.c
server/ctsvc_server_service.h
server/ctsvc_server_setting.c
server/ctsvc_server_setting.h
server/ctsvc_server_sim.c
server/ctsvc_server_sim.h
server/ctsvc_server_socket.c
server/ctsvc_server_socket.h
server/ctsvc_server_sqlite.c
server/ctsvc_server_sqlite.h
server/ctsvc_server_update.c
server/ctsvc_server_update.h
server/ctsvc_server_utils.c
server/ctsvc_server_utils.h
server/db/ctsvc_db_access_control.c
server/db/ctsvc_db_access_control.h
server/db/ctsvc_db_init.c
server/db/ctsvc_db_init.h
server/db/ctsvc_db_plugin_activity.c
server/db/ctsvc_db_plugin_activity_photo.c
server/db/ctsvc_db_plugin_activity_photo_helper.c
server/db/ctsvc_db_plugin_activity_photo_helper.h
server/db/ctsvc_db_plugin_address.c
server/db/ctsvc_db_plugin_address_helper.c
server/db/ctsvc_db_plugin_address_helper.h
server/db/ctsvc_db_plugin_addressbook.c
server/db/ctsvc_db_plugin_addressbook_helper.c
server/db/ctsvc_db_plugin_addressbook_helper.h
server/db/ctsvc_db_plugin_company.c
server/db/ctsvc_db_plugin_company_helper.c
server/db/ctsvc_db_plugin_company_helper.h
server/db/ctsvc_db_plugin_contact.c
server/db/ctsvc_db_plugin_contact_helper.c
server/db/ctsvc_db_plugin_contact_helper.h
server/db/ctsvc_db_plugin_email.c
server/db/ctsvc_db_plugin_email_helper.c
server/db/ctsvc_db_plugin_email_helper.h
server/db/ctsvc_db_plugin_event.c
server/db/ctsvc_db_plugin_event_helper.c
server/db/ctsvc_db_plugin_event_helper.h
server/db/ctsvc_db_plugin_extension.c
server/db/ctsvc_db_plugin_extension_helper.c
server/db/ctsvc_db_plugin_extension_helper.h
server/db/ctsvc_db_plugin_group.c
server/db/ctsvc_db_plugin_group_helper.c
server/db/ctsvc_db_plugin_group_helper.h
server/db/ctsvc_db_plugin_grouprelation.c
server/db/ctsvc_db_plugin_image.c
server/db/ctsvc_db_plugin_image_helper.c
server/db/ctsvc_db_plugin_image_helper.h
server/db/ctsvc_db_plugin_messenger.c
server/db/ctsvc_db_plugin_messenger_helper.c
server/db/ctsvc_db_plugin_messenger_helper.h
server/db/ctsvc_db_plugin_my_profile.c
server/db/ctsvc_db_plugin_name.c
server/db/ctsvc_db_plugin_name_helper.c
server/db/ctsvc_db_plugin_name_helper.h
server/db/ctsvc_db_plugin_nickname.c
server/db/ctsvc_db_plugin_nickname_helper.c
server/db/ctsvc_db_plugin_nickname_helper.h
server/db/ctsvc_db_plugin_note.c
server/db/ctsvc_db_plugin_note_helper.c
server/db/ctsvc_db_plugin_note_helper.h
server/db/ctsvc_db_plugin_number.c
server/db/ctsvc_db_plugin_number_helper.c
server/db/ctsvc_db_plugin_number_helper.h
server/db/ctsvc_db_plugin_person.c
server/db/ctsvc_db_plugin_person_helper.c
server/db/ctsvc_db_plugin_person_helper.h
server/db/ctsvc_db_plugin_phonelog.c
server/db/ctsvc_db_plugin_profile.c
server/db/ctsvc_db_plugin_profile_helper.c
server/db/ctsvc_db_plugin_profile_helper.h
server/db/ctsvc_db_plugin_relationship.c
server/db/ctsvc_db_plugin_relationship_helper.c
server/db/ctsvc_db_plugin_relationship_helper.h
server/db/ctsvc_db_plugin_sdn.c
server/db/ctsvc_db_plugin_sdn.h
server/db/ctsvc_db_plugin_simple_contact.c
server/db/ctsvc_db_plugin_speeddial.c
server/db/ctsvc_db_plugin_url.c
server/db/ctsvc_db_plugin_url_helper.c
server/db/ctsvc_db_plugin_url_helper.h
server/db/ctsvc_db_query.c
server/db/ctsvc_db_query.h
server/db/ctsvc_db_schema.h
server/db/ctsvc_db_sqlite.c
server/db/ctsvc_db_sqlite.h
server/db/ctsvc_db_utils.c
server/db/ctsvc_db_utils.h

old mode 100755 (executable)
new mode 100644 (file)
index 31949e5..9a55330
@@ -1,49 +1,25 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 PROJECT(contacts-service C CXX)
 
+INCLUDE(FindPkgConfig)
+
 #IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
 #      SET(CMAKE_BUILD_TYPE "Release")
 #ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
 #MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
 
-SET(DEST_INCLUDE_DIR "include/contacts-svc")
-SET(SRC_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/include")
-
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-SET(EXEC_PREFIX "\${prefix}")
-SET(LIBDIR "\${prefix}/lib")
-SET(INCLUDEDIR "\${prefix}/${DEST_INCLUDE_DIR}")
-
 EXECUTE_PROCESS(COMMAND build-util/generator.sh)
 
-#INCLUDE_DIRECTORIES(${SRC_INCLUDE_DIR})
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -I${SRC_INCLUDE_DIR}")
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED glib-2.0 pims-ipc capi-base-common vconf dlog db-util libtzplatform-config gobject-2.0 icu-uc)
-
-FOREACH(flag ${pkgs_CFLAGS})
-       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -fdata-sections -ffunction-sections -Wl,--gc-sections")
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC")
+SET(EXTRA_CFLAGS "-fvisibility=hidden -fdata-sections -ffunction-sections -Wl,--gc-sections")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Werror-implicit-function-declaration ")
 #SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
 #SET(CMAKE_C_FLAGS_RELEASE "-mabi=aapcs-linux -march=armv7-a -msoft-float -O2")
 
-ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
-
 # for tizen open build test
 IF(ENABLE_LOG_FEATURE)
        ADD_DEFINITIONS("-DENABLE_LOG_FEATURE")
 ENDIF(ENABLE_LOG_FEATURE)
 
-
-# Install header file
-FILE(GLOB HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h)
-INSTALL(FILES ${HEADER_FILES} DESTINATION ${DEST_INCLUDE_DIR})
-
 ADD_SUBDIRECTORY(client)
 ADD_SUBDIRECTORY(server)
 
index f75eb46..3a908fd 100644 (file)
@@ -1,4 +1,4 @@
-Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+Copyright (c) 2010 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
 
                                  Apache License
                            Version 2.0, January 2004
diff --git a/NOTICE b/NOTICE
index d4bc6d5..d3b7450 100644 (file)
--- a/NOTICE
+++ b/NOTICE
@@ -1,3 +1,3 @@
-Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+Copyright (c) 2010 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
 Except as noted, this software is licensed under Apache License, Version 2.
 Please, see the LICENSE.APLv2 file for Apache license, version 2 terms and conditions.
old mode 100755 (executable)
new mode 100644 (file)
index 6d6ad98..fa9b7c3
@@ -1,9 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngjae Shin <yj99.shin@samsung.com>
+ * 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.
@@ -41,14 +39,14 @@ int main(int argc, char **argv)
                                while ('\n' != c && EOF != c)
                                        c = fgetc(fp);
                                printf("\\\n");
+                       } else {
+                               printf("-%c", c);
                        }
-                       else printf("-%c",c);
                        break;
                case EOF:
                        break;
                default:
-                       printf("%c",c);
-                       break;
+                       printf("%c", c);
                }
        } while (EOF != c);
 
old mode 100755 (executable)
new mode 100644 (file)
index b7d7959..83456b5
@@ -1,9 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngjae Shin <yj99.shin@samsung.com>
+ * 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.
@@ -38,13 +36,14 @@ int main(int argc, char **argv)
                                while ('\n' != c && EOF != c)
                                        c = fgetc(fp);
                                printf("\n");
+                       } else {
+                               printf("-%c", c);
                        }
-                       else printf("-%c",c);
                        break;
                case EOF:
                        break;
                default:
-                       printf("%c",c);
+                       printf("%c", c);
                        break;
                }
        } while (EOF != c);
old mode 100755 (executable)
new mode 100644 (file)
index 322d431..a1805aa 100755 (executable)
@@ -1,7 +1,7 @@
 #
 # Contacts Service
 #
-# Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+# Copyright (c) 2010 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
 #
 # Contact: Youngjae Shin <yj99.shin@samsung.com>
 #
index 0415821..42a4f0e 100644 (file)
@@ -88,17 +88,21 @@ SET(SRCS ${SRCS}
 )
 ENDIF(ENABLE_LOG_FEATURE)
 
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC")
-
-CONFIGURE_FILE(${CLIENT}.pc.in ${CLIENT}.pc @ONLY)
+pkg_check_modules(client_pkgs REQUIRED glib-2.0 pims-ipc capi-base-common dlog)
+INCLUDE_DIRECTORIES(${client_pkgs_INCLUDE_DIRS})
+LINK_DIRECTORIES(${client_pkgs_LIBRARY_DIRS})
 
 ADD_DEFINITIONS("-D_CONTACTS_IPC_CLIENT")
 
 ADD_LIBRARY(${CLIENT} SHARED ${SRCS})
-SET_TARGET_PROPERTIES(${CLIENT} PROPERTIES SOVERSION ${MAJORVER})
-SET_TARGET_PROPERTIES(${CLIENT} PROPERTIES VERSION ${FULLVER})
-TARGET_LINK_LIBRARIES(${CLIENT} ${pkgs_LDFLAGS} -lpthread)
-
+SET_TARGET_PROPERTIES(${CLIENT} PROPERTIES VERSION ${FULLVER} SOVERSION ${MAJORVER})
+TARGET_LINK_LIBRARIES(${CLIENT} ${client_pkgs_LIBRARIES} pthread)
 INSTALL(TARGETS ${CLIENT} DESTINATION ${LIB_INSTALL_DIR})
-INSTALL(FILES ${CLIENT}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
 
+# Install header file
+SET(DEST_INCLUDE_DIR "${INCLUDE_INSTALL_DIR}/contacts-svc")
+FILE(GLOB HEADER_FILES ${CMAKE_SOURCE_DIR}/include/*.h)
+INSTALL(FILES ${HEADER_FILES} DESTINATION ${DEST_INCLUDE_DIR})
+
+CONFIGURE_FILE(${CLIENT}.pc.in ${CLIENT}.pc @ONLY)
+INSTALL(FILES ${CLIENT}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
index 2b393a2..d5fa34f 100644 (file)
@@ -1,13 +1,11 @@
-# Package Information for pkg-config
-
-prefix=@PREFIX@
-exec_prefix=@EXEC_PREFIX@
-libdir=@LIBDIR@
-includedir=@INCLUDEDIR@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}/bin
+libdir=@LIB_INSTALL_DIR@
+includedir=@DEST_INCLUDE_DIR@
 
 Name: @TARGET@
 Description: @PROJECT_NAME@ library
 Version: @FULLVER@
-Requires: glib-2.0 @PC_REQUIRED@
+Requires:
 Libs: -L${libdir} -l@CLIENT@
 Cflags: -I${includedir}
index bd5dd5f..68f2f3c 100644 (file)
@@ -28,7 +28,10 @@ API int contacts_activity_delete_by_contact_id(int contact_id)
        contacts_h contact = NULL;
 
        ret = ctsvc_client_handle_get_p(&contact);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_client_handle_get_p() Fail(%d)", ret);
+       if (CONTACTS_ERROR_NONE != ret) {
+               ERR("ctsvc_client_handle_get_p() Fail(%d)", ret);
+               return ret;
+       }
 
        ret = ctsvc_client_activity_delete_by_contact_id(contact, contact_id);
 
@@ -41,7 +44,10 @@ API int contacts_activity_delete_by_account_id(int account_id)
        contacts_h contact = NULL;
 
        ret = ctsvc_client_handle_get_p(&contact);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_client_handle_get_p() Fail(%d)", ret);
+       if (CONTACTS_ERROR_NONE != ret) {
+               ERR("ctsvc_client_handle_get_p() Fail(%d)", ret);
+               return ret;
+       }
 
        ret = ctsvc_client_activity_delete_by_account_id(contact, account_id);
 
index d960c5a..28e5643 100644 (file)
@@ -17,7 +17,6 @@
  *
  */
 
-#include <glib.h>
 #include <pims-ipc-data.h>
 
 #include "contacts.h"
@@ -38,34 +37,37 @@ int ctsvc_client_activity_delete_by_contact_id(contacts_h contact, int contact_i
        pims_ipc_data_h indata = NULL;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(contact_id <= 0,CONTACTS_ERROR_INVALID_PARAMETER,"id should be greater than 0");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETVM_IF(contact_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
+                       "id should be greater than 0");
 
        /* make indata */
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_int(contact_id, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        /* ipc call */
-       if (ctsvc_ipc_call(CTSVC_IPC_ACTIVITY_MODULE, CTSVC_IPC_SERVER_ACTIVITY_DELETE_BY_CONTACT_ID, indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+       ret = ctsvc_ipc_call(CTSVC_IPC_ACTIVITY_MODULE,
+                       CTSVC_IPC_SERVER_ACTIVITY_DELETE_BY_CONTACT_ID, indata, &outdata);
+       if (0 != ret) {
+               ERR("ctsvc_ipc_call() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -75,15 +77,15 @@ int ctsvc_client_activity_delete_by_contact_id(contacts_h contact, int contact_i
        if (outdata) {
                int transaction_ver = 0;
 
-               // check result
+               /* check result */
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
                if (CONTACTS_ERROR_NONE == ret) {
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -101,34 +103,37 @@ int ctsvc_client_activity_delete_by_account_id(contacts_h contact, int account_i
        pims_ipc_data_h indata = NULL;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(account_id <= 0,CONTACTS_ERROR_INVALID_PARAMETER,"id should be greater than 0");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETVM_IF(account_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
+                       "id should be greater than 0");
 
        /* make indata */
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_int(account_id, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_record() Fail");
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        /* ipc call */
-       if (ctsvc_ipc_call(CTSVC_IPC_ACTIVITY_MODULE, CTSVC_IPC_SERVER_ACTIVITY_DELETE_BY_ACCOUNT_ID, indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+       ret = ctsvc_ipc_call(CTSVC_IPC_ACTIVITY_MODULE,
+                       CTSVC_IPC_SERVER_ACTIVITY_DELETE_BY_ACCOUNT_ID, indata, &outdata);
+       if (0 != ret) {
+               ERR("ctsvc_ipc_call() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -138,14 +143,14 @@ int ctsvc_client_activity_delete_by_account_id(contacts_h contact, int account_i
        if (outdata) {
                int transaction_ver = 0;
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
 
                if (CONTACTS_ERROR_NONE == ret) {
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
index 11e6a37..01a0c09 100644 (file)
@@ -3,9 +3,6 @@
  *
  * Copyright (c) 2010 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
  *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -39,7 +36,7 @@ API int contacts_db_insert_record(contacts_record_h record, int *id)
        return ret;
 }
 
-API int contacts_db_get_record(const char* view_uri, int id, contacts_record_h* out_record)
+API int contacts_db_get_record(const char *view_uri, int id, contacts_record_h *out_record)
 {
        int ret;
        contacts_h contact = NULL;
@@ -65,7 +62,7 @@ API int contacts_db_update_record(contacts_record_h record)
        return ret;
 }
 
-API int contacts_db_delete_record(const charview_uri, int id)
+API int contacts_db_delete_record(const char *view_uri, int id)
 {
        int ret;
        contacts_h contact = NULL;
@@ -92,7 +89,7 @@ API int contacts_db_replace_record(contacts_record_h record, int id)
 
 }
 
-API int contacts_db_get_all_records(const char* view_uri, int offset, int limit, contacts_list_h* out_list)
+API int contacts_db_get_all_records(const char *view_uri, int offset, int limit, contacts_list_h *out_list)
 {
        int ret;
        contacts_h contact = NULL;
@@ -105,7 +102,7 @@ API int contacts_db_get_all_records(const char* view_uri, int offset, int limit,
        return ret;
 }
 
-API int contacts_db_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_hout_list)
+API int contacts_db_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h *out_list)
 {
        int ret;
        contacts_h contact = NULL;
@@ -119,7 +116,7 @@ API int contacts_db_get_records_with_query(contacts_query_h query, int offset, i
 }
 
 
-API int contacts_db_get_count(const charview_uri, int *out_count)
+API int contacts_db_get_count(const char *view_uri, int *out_count)
 {
        int ret;
        contacts_h contact = NULL;
@@ -171,7 +168,7 @@ API int contacts_db_update_records(contacts_list_h list)
        return ret;
 }
 
-API int contacts_db_delete_records(const charview_uri, int ids[], int count)
+API int contacts_db_delete_records(const char *view_uri, int ids[], int count)
 {
        int ret;
        contacts_h contact = NULL;
@@ -197,8 +194,8 @@ API int contacts_db_replace_records(contacts_list_h list, int ids[], int count)
        return ret;
 }
 
-API int contacts_db_get_changes_by_version(const charview_uri, int addressbook_id,
-               int contacts_db_version, contacts_list_h* record_list, int* current_contacts_db_version)
+API int contacts_db_get_changes_by_version(const char *view_uri, int addressbook_id,
+               int contacts_db_version, contacts_list_h *record_list, int *current_contacts_db_version)
 {
        int ret;
        contacts_h contact = NULL;
@@ -211,7 +208,7 @@ API int contacts_db_get_changes_by_version(const char* view_uri, int addressbook
        return ret;
 }
 
-API int contacts_db_get_current_version(intcontacts_db_version)
+API int contacts_db_get_current_version(int *contacts_db_version)
 {
        int ret;
        contacts_h contact = NULL;
@@ -225,8 +222,8 @@ API int contacts_db_get_current_version(int* contacts_db_version)
 
 }
 
-API int contacts_db_search_records(const charview_uri, const char *keyword,
-               int offset, int limit, contacts_list_hout_list)
+API int contacts_db_search_records(const char *view_uri, const char *keyword,
+               int offset, int limit, contacts_list_h *out_list)
 {
        int ret;
        contacts_h contact = NULL;
@@ -239,8 +236,8 @@ API int contacts_db_search_records(const char* view_uri, const char *keyword,
        return ret;
 }
 
-API int contacts_db_search_records_with_range(const charview_uri, const char *keyword,
-               int offset, int limit, int range, contacts_list_hout_list)
+API int contacts_db_search_records_with_range(const char *view_uri, const char *keyword,
+               int offset, int limit, int range, contacts_list_h *out_list)
 {
        int ret;
        contacts_h contact = NULL;
@@ -254,7 +251,7 @@ API int contacts_db_search_records_with_range(const char* view_uri, const char *
 }
 
 API int contacts_db_search_records_with_query(contacts_query_h query, const char *keyword,
-               int offset, int limit, contacts_list_hout_list)
+               int offset, int limit, contacts_list_h *out_list)
 {
        int ret;
        contacts_h contact = NULL;
@@ -267,7 +264,7 @@ API int contacts_db_search_records_with_query(contacts_query_h query, const char
        return ret;
 }
 
-API int contacts_db_get_last_change_version(intlast_version)
+API int contacts_db_get_last_change_version(int *last_version)
 {
        int ret;
        contacts_h contact = NULL;
@@ -294,7 +291,7 @@ API int contacts_db_get_status(contacts_db_status_e *status)
 }
 
 API int contacts_db_add_status_changed_cb(
-               contacts_db_status_changed_cb cb, voiduser_data)
+               contacts_db_status_changed_cb cb, void *user_data)
 {
        int ret;
        contacts_h contact = NULL;
@@ -308,7 +305,7 @@ API int contacts_db_add_status_changed_cb(
 }
 
 API int contacts_db_remove_status_changed_cb(
-               contacts_db_status_changed_cb cb, voiduser_data)
+               contacts_db_status_changed_cb cb, void *user_data)
 {
        int ret;
        contacts_h contact = NULL;
index dbbebd6..239ced8 100644 (file)
@@ -3,10 +3,6 @@
  *
  * Copyright (c) 2010 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
  *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
- *
  * 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
@@ -48,33 +44,33 @@ int ctsvc_client_db_insert_record(contacts_h contact, contacts_record_h record,
        if (id)
                *id = 0;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(record==NULL,CONTACTS_ERROR_INVALID_PARAMETER,"record is NULL");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
 
        /* make indata */
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
-       ret = ctsvc_ipc_marshal_record(record,indata);
+       ret = ctsvc_ipc_marshal_record(record, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_record() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        /* ipc call */
        if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_INSERT_RECORD, indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -83,7 +79,7 @@ int ctsvc_client_db_insert_record(contacts_h contact, contacts_record_h record,
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
@@ -91,7 +87,7 @@ int ctsvc_client_db_insert_record(contacts_h contact, contacts_record_h record,
                if (CONTACTS_ERROR_NONE == ret) {
                        int transaction_ver = 0;
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -99,7 +95,7 @@ int ctsvc_client_db_insert_record(contacts_h contact, contacts_record_h record,
 
                        if (id) {
                                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, id)) {
-                                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                                        pims_ipc_data_destroy(outdata);
                                        return CONTACTS_ERROR_IPC;
                                }
@@ -111,49 +107,49 @@ int ctsvc_client_db_insert_record(contacts_h contact, contacts_record_h record,
        return ret;
 }
 
-int ctsvc_client_db_get_record(contacts_h contact, const char* view_uri, int id, contacts_record_h* out_record)
+int ctsvc_client_db_get_record(contacts_h contact, const char *view_uri, int id, contacts_record_h *out_record)
 {
        int ret = CONTACTS_ERROR_NONE;
        pims_ipc_data_h indata = NULL;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(view_uri==NULL,CONTACTS_ERROR_INVALID_PARAMETER,"view_uri is NULL");
-       RETVM_IF(id<0,CONTACTS_ERROR_INVALID_PARAMETER,"id<0");
-       RETVM_IF(out_record==NULL,CONTACTS_ERROR_INVALID_PARAMETER,"record is NULL");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == view_uri, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETVM_IF(id < 0, CONTACTS_ERROR_INVALID_PARAMETER, "id < 0");
+       RETV_IF(NULL == out_record, CONTACTS_ERROR_INVALID_PARAMETER);
        *out_record = NULL;
 
        /* make indata */
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
-       ret = ctsvc_ipc_marshal_string(view_uri,indata);
+       ret = ctsvc_ipc_marshal_string(view_uri, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
-       ret = ctsvc_ipc_marshal_int(id,indata);
+       ret = ctsvc_ipc_marshal_int(id, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        /* ipc call */
        if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_GET_RECORD, indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -162,13 +158,13 @@ int ctsvc_client_db_get_record(contacts_h contact, const char* view_uri, int id,
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
                if (CONTACTS_ERROR_NONE == ret) {
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_record(outdata, out_record)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_record() Fail");
+                               ERR("ctsvc_ipc_unmarshal_record() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -184,34 +180,34 @@ int ctsvc_client_db_update_record(contacts_h contact, contacts_record_h record)
        pims_ipc_data_h indata = NULL;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(record==NULL,CONTACTS_ERROR_INVALID_PARAMETER,"record is NULL");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
 
        /* make indata */
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
-       ret = ctsvc_ipc_marshal_record(record,indata);
+       ret = ctsvc_ipc_marshal_record(record, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_record() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        /* ipc call */
        if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_UPDATE_RECORD, indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -220,15 +216,15 @@ int ctsvc_client_db_update_record(contacts_h contact, contacts_record_h record)
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
                if (CONTACTS_ERROR_NONE == ret) {
-                       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s *)record);
+                       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s*)record);
                        int transaction_ver = 0;
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -239,46 +235,46 @@ int ctsvc_client_db_update_record(contacts_h contact, contacts_record_h record)
        return ret;
 }
 
-int ctsvc_client_db_delete_record(contacts_h contact, const charview_uri, int id)
+int ctsvc_client_db_delete_record(contacts_h contact, const char *view_uri, int id)
 {
        int ret = CONTACTS_ERROR_NONE;
        pims_ipc_data_h indata = NULL;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(view_uri==NULL,CONTACTS_ERROR_INVALID_PARAMETER,"view_uri is NULL");
-       RETVM_IF(id<=0,CONTACTS_ERROR_INVALID_PARAMETER,"id <= 0");
+       RETV_IF(NULL == view_uri, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETVM_IF(id <= 0, CONTACTS_ERROR_INVALID_PARAMETER, "id <= 0");
 
        /* make indata */
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
-       ret = ctsvc_ipc_marshal_string(view_uri,indata);
+       ret = ctsvc_ipc_marshal_string(view_uri, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
-       ret = ctsvc_ipc_marshal_int(id,indata);
+       ret = ctsvc_ipc_marshal_int(id, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        /* ipc call */
        if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_DELETE_RECORD, indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -287,14 +283,14 @@ int ctsvc_client_db_delete_record(contacts_h contact, const char* view_uri, int
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
                if (CONTACTS_ERROR_NONE == ret) {
                        int transaction_ver = 0;
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -313,33 +309,33 @@ int ctsvc_client_db_replace_record(contacts_h contact, contacts_record_h record,
        pims_ipc_data_h indata = NULL;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(NULL == contact,CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : record is NULL");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
 
        /* make indata */
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_record(record, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_record() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
        ret = ctsvc_ipc_marshal_int(id, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
@@ -347,7 +343,7 @@ int ctsvc_client_db_replace_record(contacts_h contact, contacts_record_h record,
        /* ipc call */
        if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE,
                                CTSVC_IPC_SERVER_DB_REPLACE_RECORD, indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -356,14 +352,14 @@ int ctsvc_client_db_replace_record(contacts_h contact, contacts_record_h record,
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
                if (CONTACTS_ERROR_NONE == ret) {
                        int transaction_ver = 0;
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -375,54 +371,54 @@ int ctsvc_client_db_replace_record(contacts_h contact, contacts_record_h record,
        return ret;
 }
 
-int ctsvc_client_db_get_all_records(contacts_h contact, const char* view_uri, int offset, int limit, contacts_list_h* out_list)
+int ctsvc_client_db_get_all_records(contacts_h contact, const char *view_uri, int offset, int limit, contacts_list_h *out_list)
 {
        int ret = CONTACTS_ERROR_NONE;
        pims_ipc_data_h indata = NULL;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(NULL == out_list,CONTACTS_ERROR_INVALID_PARAMETER,"list is NULL");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == out_list, CONTACTS_ERROR_INVALID_PARAMETER);
        *out_list = NULL;
-       RETVM_IF(view_uri==NULL,CONTACTS_ERROR_INVALID_PARAMETER,"view_uri is NULL");
+       RETV_IF(NULL == view_uri, CONTACTS_ERROR_INVALID_PARAMETER);
 
        /* make indata */
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
-       ret = ctsvc_ipc_marshal_string(view_uri,indata);
+       ret = ctsvc_ipc_marshal_string(view_uri, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
-       ret = ctsvc_ipc_marshal_int(offset,indata);
+       ret = ctsvc_ipc_marshal_int(offset, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
-       ret = ctsvc_ipc_marshal_int(limit,indata);
+       ret = ctsvc_ipc_marshal_int(limit, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        /* ipc call */
        if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_GET_ALL_RECORDS, indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -431,14 +427,14 @@ int ctsvc_client_db_get_all_records(contacts_h contact, const char* view_uri, in
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
 
                if (ret == CONTACTS_ERROR_NONE) {
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_list(outdata, out_list)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_list() Fail");
+                               ERR("ctsvc_ipc_unmarshal_list() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -448,54 +444,54 @@ int ctsvc_client_db_get_all_records(contacts_h contact, const char* view_uri, in
        return ret;
 }
 
-int ctsvc_client_db_get_records_with_query(contacts_h contact, contacts_query_h query, int offset, int limit, contacts_list_hout_list)
+int ctsvc_client_db_get_records_with_query(contacts_h contact, contacts_query_h query, int offset, int limit, contacts_list_h *out_list)
 {
        int ret = CONTACTS_ERROR_NONE;
        pims_ipc_data_h indata = NULL;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(NULL == out_list,CONTACTS_ERROR_INVALID_PARAMETER,"list is NULL");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == out_list, CONTACTS_ERROR_INVALID_PARAMETER);
        *out_list = NULL;
-       RETVM_IF(NULL == query,CONTACTS_ERROR_INVALID_PARAMETER,"query is NULL");
+       RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
 
        /* make indata */
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
-       ret = ctsvc_ipc_marshal_query(query,indata);
+       ret = ctsvc_ipc_marshal_query(query, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_query() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
-       ret = ctsvc_ipc_marshal_int(offset,indata);
+       ret = ctsvc_ipc_marshal_int(offset, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
-       ret = ctsvc_ipc_marshal_int(limit,indata);
+       ret = ctsvc_ipc_marshal_int(limit, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                return ret;
        }
 
        /* ipc call */
        if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_GET_RECORDS_WITH_QUERY, indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -504,14 +500,14 @@ int ctsvc_client_db_get_records_with_query(contacts_h contact, contacts_query_h
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
 
                if (CONTACTS_ERROR_NONE == ret) {
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_list(outdata, out_list)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_list() Fail");
+                               ERR("ctsvc_ipc_unmarshal_list() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -524,42 +520,42 @@ int ctsvc_client_db_get_records_with_query(contacts_h contact, contacts_query_h
 }
 
 
-int ctsvc_client_db_get_count(contacts_h contact, const charview_uri, int *out_count)
+int ctsvc_client_db_get_count(contacts_h contact, const char *view_uri, int *out_count)
 {
        int ret = CONTACTS_ERROR_NONE;
        pims_ipc_data_h indata = NULL;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(view_uri==NULL,CONTACTS_ERROR_INVALID_PARAMETER,"view_uri is NULL");
-       RETVM_IF(out_count==NULL,CONTACTS_ERROR_INVALID_PARAMETER,"count pointer is NULL");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == view_uri, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == out_count, CONTACTS_ERROR_INVALID_PARAMETER);
        *out_count = 0;
 
        /* make indata */
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
-       ret = ctsvc_ipc_marshal_string(view_uri,indata);
+       ret = ctsvc_ipc_marshal_string(view_uri, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        /* ipc call */
        if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_GET_COUNT, indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -568,14 +564,14 @@ int ctsvc_client_db_get_count(contacts_h contact, const char* view_uri, int *out
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
 
                if (CONTACTS_ERROR_NONE == ret) {
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, out_count)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -593,35 +589,35 @@ int ctsvc_client_db_get_count_with_query(contacts_h contact, contacts_query_h qu
        pims_ipc_data_h indata = NULL;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(NULL == query,CONTACTS_ERROR_INVALID_PARAMETER,"record is NULL");
-       RETVM_IF(out_count==NULL,CONTACTS_ERROR_INVALID_PARAMETER,"count pointer is NULL");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == out_count, CONTACTS_ERROR_INVALID_PARAMETER);
        *out_count = 0;
 
        /* make indata */
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
-       ret = ctsvc_ipc_marshal_query(query,indata);
+       ret = ctsvc_ipc_marshal_query(query, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_query() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        /* ipc call */
        if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_GET_COUNT_WITH_QUERY, indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -630,14 +626,14 @@ int ctsvc_client_db_get_count_with_query(contacts_h contact, contacts_query_h qu
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
 
                if (CONTACTS_ERROR_NONE == ret) {
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, out_count)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -659,32 +655,32 @@ int ctsvc_client_db_insert_records(contacts_h contact, contacts_list_h list, int
        if (count)
                *count = 0;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(list==NULL,CONTACTS_ERROR_INVALID_PARAMETER, "list is NULL");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == list, CONTACTS_ERROR_INVALID_PARAMETER);
 
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
-       ret = ctsvc_ipc_marshal_list(list,indata);
+       ret = ctsvc_ipc_marshal_list(list, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_list() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_INSERT_RECORDS,
                                indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -693,7 +689,7 @@ int ctsvc_client_db_insert_records(contacts_h contact, contacts_list_h list, int
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
@@ -701,7 +697,7 @@ int ctsvc_client_db_insert_records(contacts_h contact, contacts_list_h list, int
                if (CONTACTS_ERROR_NONE == ret) {
                        int transaction_ver = 0;
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -713,20 +709,20 @@ int ctsvc_client_db_insert_records(contacts_h contact, contacts_list_h list, int
                                int c;
 
                                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &c)) {
-                                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                                        pims_ipc_data_destroy(outdata);
                                        return CONTACTS_ERROR_IPC;
                                }
                                id = calloc(c, sizeof(int));
                                if (NULL == id) {
-                                       CTS_ERR("calloc() Fail");
+                                       ERR("calloc() Fail");
                                        pims_ipc_data_destroy(outdata);
                                        return CONTACTS_ERROR_OUT_OF_MEMORY;
                                }
 
-                               for (i=0;i<c;i++) {
+                               for (i = 0; i < c; i++) {
                                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &(id[i]))) {
-                                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                                pims_ipc_data_destroy(outdata);
                                                free(id);
                                                return CONTACTS_ERROR_IPC;
@@ -748,33 +744,33 @@ int ctsvc_client_db_update_records(contacts_h contact, contacts_list_h list)
        pims_ipc_data_h indata = NULL;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contct is NULL");
-       RETVM_IF(NULL == list, CONTACTS_ERROR_INVALID_PARAMETER, "list is NULL");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == list, CONTACTS_ERROR_INVALID_PARAMETER);
 
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
-       ret = ctsvc_ipc_marshal_list(list,indata);
+       ret = ctsvc_ipc_marshal_list(list, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_list() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_UPDATE_RECORDS,
                                indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -783,7 +779,7 @@ int ctsvc_client_db_update_records(contacts_h contact, contacts_list_h list)
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
@@ -791,7 +787,7 @@ int ctsvc_client_db_update_records(contacts_h contact, contacts_list_h list)
                if (CONTACTS_ERROR_NONE == ret) {
                        int transaction_ver = 0;
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -804,48 +800,48 @@ int ctsvc_client_db_update_records(contacts_h contact, contacts_list_h list)
        return ret;
 }
 
-int ctsvc_client_db_delete_records(contacts_h contact, const charview_uri, int ids[], int count)
+int ctsvc_client_db_delete_records(contacts_h contact, const char *view_uri, int ids[], int count)
 {
        int i;
        int ret = CONTACTS_ERROR_NONE;
        pims_ipc_data_h indata = NULL;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(view_uri == NULL, CONTACTS_ERROR_INVALID_PARAMETER, "view_uri is NULL");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == view_uri, CONTACTS_ERROR_INVALID_PARAMETER);
 
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
-       ret = ctsvc_ipc_marshal_string(view_uri,indata);
+       ret = ctsvc_ipc_marshal_string(view_uri, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
-       ret = ctsvc_ipc_marshal_int(count,indata);
+       ret = ctsvc_ipc_marshal_int(count, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
-       for (i=0;i<count;i++) {
-               ret = ctsvc_ipc_marshal_int(ids[i],indata);
+       for (i = 0; i < count; i++) {
+               ret = ctsvc_ipc_marshal_int(ids[i], indata);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("marshal fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                        pims_ipc_data_destroy(indata);
                        return ret;
                }
@@ -853,7 +849,7 @@ int ctsvc_client_db_delete_records(contacts_h contact, const char* view_uri, int
 
        if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_DELETE_RECORDS,
                                indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -862,7 +858,7 @@ int ctsvc_client_db_delete_records(contacts_h contact, const char* view_uri, int
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
@@ -870,7 +866,7 @@ int ctsvc_client_db_delete_records(contacts_h contact, const char* view_uri, int
                if (CONTACTS_ERROR_NONE == ret) {
                        int transaction_ver = 0;
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -890,44 +886,44 @@ int ctsvc_client_db_replace_records(contacts_h contact, contacts_list_h list, in
        pims_ipc_data_h indata = NULL;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(NULL == contact,CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(NULL == list,CONTACTS_ERROR_INVALID_PARAMETER, "list is NULL");
-       RETVM_IF(NULL == ids, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter");
-       RETVM_IF(0 == count, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == list, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == ids, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(0 == count, CONTACTS_ERROR_INVALID_PARAMETER);
 
        /* make indata */
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_list(list, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_list() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_int(count, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
-       for (i=0;i<count;i++) {
+       for (i = 0; i < count; i++) {
                ret = ctsvc_ipc_marshal_int(ids[i], indata);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("marshal fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                        pims_ipc_data_destroy(indata);
                        return ret;
                }
@@ -935,7 +931,7 @@ int ctsvc_client_db_replace_records(contacts_h contact, contacts_list_h list, in
 
        if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_REPLACE_RECORDS,
                                indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -944,14 +940,14 @@ int ctsvc_client_db_replace_records(contacts_h contact, contacts_list_h list, in
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
                if (CONTACTS_ERROR_NONE == ret) {
                        int transaction_ver = 0;
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -963,55 +959,56 @@ int ctsvc_client_db_replace_records(contacts_h contact, contacts_list_h list, in
        return ret;
 }
 
-int ctsvc_client_db_get_changes_by_version(contacts_h contact, const char* view_uri, int addressbook_id, int contacts_db_version, contacts_list_h* record_list, int* current_contacts_db_version)
+int ctsvc_client_db_get_changes_by_version(contacts_h contact, const char *view_uri, int addressbook_id, int contacts_db_version, contacts_list_h *record_list, int *current_contacts_db_version)
 {
        int ret = CONTACTS_ERROR_NONE;
        pims_ipc_data_h indata = NULL;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(record_list==NULL,CONTACTS_ERROR_INVALID_PARAMETER,"record_list is NULL");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == record_list, CONTACTS_ERROR_INVALID_PARAMETER);
+
        *record_list = NULL;
-       RETVM_IF(view_uri==NULL,CONTACTS_ERROR_INVALID_PARAMETER,"view_uri is NULL");
-       RETVM_IF(current_contacts_db_version==NULL,CONTACTS_ERROR_INVALID_PARAMETER,"current_contacts_db_version is NULL");
+       RETV_IF(NULL == view_uri, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == current_contacts_db_version, CONTACTS_ERROR_INVALID_PARAMETER);
 
        /* make indata */
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
-       ret = ctsvc_ipc_marshal_string(view_uri,indata);
+       ret = ctsvc_ipc_marshal_string(view_uri, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
-       ret = ctsvc_ipc_marshal_int(addressbook_id,indata);
+       ret = ctsvc_ipc_marshal_int(addressbook_id, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
-       ret = ctsvc_ipc_marshal_int(contacts_db_version,indata);
+       ret = ctsvc_ipc_marshal_int(contacts_db_version, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        /* ipc call */
        if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_CHANGES_BY_VERSION, indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -1020,19 +1017,19 @@ int ctsvc_client_db_get_changes_by_version(contacts_h contact, const char* view_
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
 
                if (ret == CONTACTS_ERROR_NONE) {
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_list(outdata, record_list)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_list() Fail");
+                               ERR("ctsvc_ipc_unmarshal_list() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, current_contacts_db_version)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -1043,34 +1040,35 @@ int ctsvc_client_db_get_changes_by_version(contacts_h contact, const char* view_
        return ret;
 }
 
-int ctsvc_client_db_get_current_version(contacts_h contact, intcontacts_db_version)
+int ctsvc_client_db_get_current_version(contacts_h contact, int *contacts_db_version)
 {
        int ret = CONTACTS_ERROR_NONE;
        pims_ipc_data_h indata = NULL;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is null");
-       RETVM_IF(contacts_db_version==NULL,CONTACTS_ERROR_INVALID_PARAMETER,"contacts_db_version is null");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == contacts_db_version, CONTACTS_ERROR_INVALID_PARAMETER);
+
        *contacts_db_version = 0;
 
        /* make indata */
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        /* ipc call */
        if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_GET_CURRENT_VERSION, indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -1079,14 +1077,14 @@ int ctsvc_client_db_get_current_version(contacts_h contact, int* contacts_db_ver
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
 
                if (CONTACTS_ERROR_NONE == ret) {
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, contacts_db_version)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -1097,58 +1095,58 @@ int ctsvc_client_db_get_current_version(contacts_h contact, int* contacts_db_ver
        return ret;
 }
 
-int ctsvc_client_db_search_records(contacts_h contact, const charview_uri, const char *keyword,
-               int offset, int limit, contacts_list_hout_list)
+int ctsvc_client_db_search_records(contacts_h contact, const char *view_uri, const char *keyword,
+               int offset, int limit, contacts_list_h *out_list)
 {
        int ret = CONTACTS_ERROR_NONE;
        pims_ipc_data_h indata = NULL;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(out_list == NULL, CONTACTS_ERROR_INVALID_PARAMETER, "list is NULL");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == out_list, CONTACTS_ERROR_INVALID_PARAMETER);
        *out_list = NULL;
 
        /* make indata */
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("pims_ipc_data_create() Fail");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
-       ret = ctsvc_ipc_marshal_string(view_uri,indata);
+       ret = ctsvc_ipc_marshal_string(view_uri, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
-       ret = ctsvc_ipc_marshal_string(keyword,indata);
+       ret = ctsvc_ipc_marshal_string(keyword, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
-       ret = ctsvc_ipc_marshal_int(offset,indata);
+       ret = ctsvc_ipc_marshal_int(offset, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
-       ret = ctsvc_ipc_marshal_int(limit,indata);
+       ret = ctsvc_ipc_marshal_int(limit, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        /* ipc call */
        if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_SEARCH_RECORDS, indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -1157,14 +1155,14 @@ int ctsvc_client_db_search_records(contacts_h contact, const char* view_uri, con
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
 
                if (CONTACTS_ERROR_NONE == ret) {
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_list(outdata, out_list)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_list() Fail");
+                               ERR("ctsvc_ipc_unmarshal_list() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -1176,63 +1174,63 @@ int ctsvc_client_db_search_records(contacts_h contact, const char* view_uri, con
        return ret;
 }
 
-int ctsvc_client_db_search_records_with_range(contacts_h contact, const charview_uri, const char *keyword,
-               int offset, int limit, int range, contacts_list_hout_list)
+int ctsvc_client_db_search_records_with_range(contacts_h contact, const char *view_uri, const char *keyword,
+               int offset, int limit, int range, contacts_list_h *out_list)
 {
        int ret = CONTACTS_ERROR_NONE;
        pims_ipc_data_h indata = NULL;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(contact == NULL, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(out_list == NULL, CONTACTS_ERROR_INVALID_PARAMETER, "list is NULL");
-       RETVM_IF(range == 0, CONTACTS_ERROR_INVALID_PARAMETER, "range is 0");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == out_list, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(0 == range, CONTACTS_ERROR_INVALID_PARAMETER);
        *out_list = NULL;
 
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("pims_ipc_data_create() Fail");
+               ERR("pims_ipc_data_create() Fail");
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_string(view_uri, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
        ret = ctsvc_ipc_marshal_string(keyword, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
        ret = ctsvc_ipc_marshal_int(offset, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
        ret = ctsvc_ipc_marshal_int(limit, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
        ret = ctsvc_ipc_marshal_int(range, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        if (0 != ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_SEARCH_RECORDS_WITH_RANGE, indata, &outdata)) {
-               CTS_ERR("ctsvc_ipc_call failed");
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -1241,13 +1239,13 @@ int ctsvc_client_db_search_records_with_range(contacts_h contact, const char* vi
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
                if (CONTACTS_ERROR_NONE == ret) {
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_list(outdata, out_list)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_list() Fail");
+                               ERR("ctsvc_ipc_unmarshal_list() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -1259,57 +1257,57 @@ int ctsvc_client_db_search_records_with_range(contacts_h contact, const char* vi
 }
 
 int ctsvc_client_db_search_records_with_query(contacts_h contact, contacts_query_h query, const char *keyword,
-               int offset, int limit, contacts_list_hout_list)
+               int offset, int limit, contacts_list_h *out_list)
 {
        int ret = CONTACTS_ERROR_NONE;
        pims_ipc_data_h indata = NULL;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(NULL == out_list, CONTACTS_ERROR_INVALID_PARAMETER, "list is NULL");
-       RETVM_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER, "query is NULL");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == out_list, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
        *out_list = NULL;
 
        /* make indata */
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("pims_ipc_data_create() Fail");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
-       ret = ctsvc_ipc_marshal_query(query,indata);
+       ret = ctsvc_ipc_marshal_query(query, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_query() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
-       ret = ctsvc_ipc_marshal_string(keyword,indata);
+       ret = ctsvc_ipc_marshal_string(keyword, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
-       ret = ctsvc_ipc_marshal_int(offset,indata);
+       ret = ctsvc_ipc_marshal_int(offset, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                return ret;
        }
-       ret = ctsvc_ipc_marshal_int(limit,indata);
+       ret = ctsvc_ipc_marshal_int(limit, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        /* ipc call */
        if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_SEARCH_RECORDS_WITH_QUERY, indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -1318,14 +1316,14 @@ int ctsvc_client_db_search_records_with_query(contacts_h contact, contacts_query
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
 
                if (CONTACTS_ERROR_NONE == ret) {
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_list(outdata, out_list)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_list() Fail");
+                               ERR("ctsvc_ipc_unmarshal_list() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -1337,19 +1335,19 @@ int ctsvc_client_db_search_records_with_query(contacts_h contact, contacts_query
        return ret;
 }
 
-int ctsvc_client_db_get_last_change_version(contacts_h contact, intlast_version)
+int ctsvc_client_db_get_last_change_version(contacts_h contact, int *last_version)
 {
        int ret = CONTACTS_ERROR_NONE;
        bool result = false;
 
-       RETVM_IF(NULL == last_version, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter");
+       RETV_IF(NULL == last_version, CONTACTS_ERROR_INVALID_PARAMETER);
        *last_version = 0;
 
        ret = ctsvc_ipc_client_check_permission(CTSVC_PERMISSION_CONTACT_READ, &result);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_ipc_client_check_permission fail (%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_ipc_client_check_permission Fail(%d)", ret);
        if (result == false) {
                ret = ctsvc_ipc_client_check_permission(CTSVC_PERMISSION_PHONELOG_READ, &result);
-               RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_ipc_client_check_permission fail (%d)", ret);
+               RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_ipc_client_check_permission Fail(%d)", ret);
                RETVM_IF(result == false, CONTACTS_ERROR_PERMISSION_DENIED, "Permission denied");
        }
 
@@ -1357,11 +1355,10 @@ int ctsvc_client_db_get_last_change_version(contacts_h contact, int* last_versio
        return ret;
 }
 
-typedef struct
-{
+typedef struct {
        contacts_db_status_changed_cb cb;
        void *user_data;
-}status_callback_info_s;
+} status_callback_info_s;
 
 static GSList *__status_change_subscribe_list = NULL;
 
@@ -1372,7 +1369,8 @@ static void __ctsvc_client_db_free_cb_info(status_callback_info_s *cb_info)
        free(cb_info);
 }
 
-static void __ctsvc_db_status_subscriber_callback(pims_ipc_h ipc, pims_ipc_data_h data, void *user_data)
+static void __ctsvc_db_status_subscriber_callback(pims_ipc_h ipc, pims_ipc_data_h data,
+               void *user_data)
 {
        int ret;
        int status = -1;
@@ -1383,7 +1381,7 @@ static void __ctsvc_db_status_subscriber_callback(pims_ipc_h ipc, pims_ipc_data_
                WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_ipc_unmarshal_int() Fail(%d)", ret);
        }
 
-       for (l = __status_change_subscribe_list;l;l=l->next) {
+       for (l = __status_change_subscribe_list; l; l = l->next) {
                status_callback_info_s *cb_info = l->data;
                /* TODO: Fixme - check zone_name */
                if (cb_info->cb)
@@ -1397,41 +1395,41 @@ int ctsvc_client_db_get_status(contacts_h contact, contacts_db_status_e *status)
        pims_ipc_data_h outdata = NULL;
        pims_ipc_data_h indata = NULL;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(status == NULL, CONTACTS_ERROR_INVALID_PARAMETER,"The out param is NULL");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == status, CONTACTS_ERROR_INVALID_PARAMETER);
        *status = 0;
 
        /* make indata */
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("pims_ipc_data_create() Fail");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_GET_STATUS, indata, &outdata) != 0) {
                pims_ipc_data_destroy(indata);
-               CTS_ERR("ctsvc_ipc_call failed");
+               ERR("ctsvc_ipc_call() Fail");
                return CONTACTS_ERROR_IPC;
        }
        pims_ipc_data_destroy(indata);
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
                if (CONTACTS_ERROR_NONE == ret) {
-                       if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, (int *)status)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, (int*)status)) {
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -1443,18 +1441,17 @@ int ctsvc_client_db_get_status(contacts_h contact, contacts_db_status_e *status)
 }
 
 int ctsvc_client_db_add_status_changed_cb(contacts_h contact,
-               contacts_db_status_changed_cb cb, voiduser_data)
+               contacts_db_status_changed_cb cb, void *user_data)
 {
        int ret;
        status_callback_info_s *cb_info = NULL;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(NULL == cb, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : callback is null");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == cb, CONTACTS_ERROR_INVALID_PARAMETER);
 
        ret = ctsvc_ipc_create_for_change_subscription();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_create_for_change_subscription() Fail(%d)", ret);
+               ERR("ctsvc_ipc_create_for_change_subscription() Fail(%d)", ret);
                return ret;
        }
 
@@ -1463,14 +1460,14 @@ int ctsvc_client_db_add_status_changed_cb(contacts_h contact,
        if (pims_ipc_subscribe(ctsvc_ipc_get_handle_for_change_subsciption(),
                                CTSVC_IPC_SUBSCRIBE_MODULE, CTSVC_IPC_SERVER_DB_STATUS_CHANGED,
                                __ctsvc_db_status_subscriber_callback, NULL) != 0) {
-               CTS_ERR("pims_ipc_subscribe error\n");
+               ERR("pims_ipc_subscribe error\n");
                ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB);
                return CONTACTS_ERROR_IPC;
        }
 
        cb_info = calloc(1, sizeof(status_callback_info_s));
        if (NULL == cb_info) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB);
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
@@ -1483,23 +1480,22 @@ int ctsvc_client_db_add_status_changed_cb(contacts_h contact,
 }
 
 int ctsvc_client_db_remove_status_changed_cb(contacts_h contact,
-       contacts_db_status_changed_cb cb, void* user_data)
+               contacts_db_status_changed_cb cb, void *user_data)
 {
        int ret;
        GSList *l;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(NULL == cb, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : callback is null");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == cb, CONTACTS_ERROR_INVALID_PARAMETER);
 
        ret = ctsvc_ipc_destroy_for_change_subscription(false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_destroy_for_change_subscription() Fail(%d)", ret);
+               ERR("ctsvc_ipc_destroy_for_change_subscription() Fail(%d)", ret);
                return ret;
        }
 
        ctsvc_mutex_lock(CTS_MUTEX_PIMS_IPC_PUBSUB);
-       for (l = __status_change_subscribe_list;l;l=l->next) {
+       for (l = __status_change_subscribe_list; l; l = l->next) {
                status_callback_info_s *cb_info = l->data;
                if (cb == cb_info->cb && user_data == cb_info->user_data) {
                        __status_change_subscribe_list = g_slist_remove(__status_change_subscribe_list, cb_info);
index a6a8d69..27368b4 100644 (file)
 #include "contacts_types.h"
 
 int ctsvc_client_db_insert_record(contacts_h contact, contacts_record_h record, int *id);
-int ctsvc_client_db_get_record(contacts_h contact, const char* view_uri, int id, contacts_record_h* out_record);
+int ctsvc_client_db_get_record(contacts_h contact, const char *view_uri, int id, contacts_record_h *out_record);
 int ctsvc_client_db_update_record(contacts_h contact, contacts_record_h record);
-int ctsvc_client_db_delete_record(contacts_h contact, const charview_uri, int id);
+int ctsvc_client_db_delete_record(contacts_h contact, const char *view_uri, int id);
 int ctsvc_client_db_replace_record(contacts_h contact, contacts_record_h record, int id);
-int ctsvc_client_db_get_all_records(contacts_h contact, const char* view_uri, int offset, int limit, contacts_list_h* out_list);
-int ctsvc_client_db_get_records_with_query(contacts_h contact, contacts_query_h query, int offset, int limit, contacts_list_hout_list);
-int ctsvc_client_db_get_count(contacts_h contact, const charview_uri, int *out_count);
+int ctsvc_client_db_get_all_records(contacts_h contact, const char *view_uri, int offset, int limit, contacts_list_h *out_list);
+int ctsvc_client_db_get_records_with_query(contacts_h contact, contacts_query_h query, int offset, int limit, contacts_list_h *out_list);
+int ctsvc_client_db_get_count(contacts_h contact, const char *view_uri, int *out_count);
 int ctsvc_client_db_get_count_with_query(contacts_h contact, contacts_query_h query, int *out_count);
 int ctsvc_client_db_insert_records(contacts_h contact, contacts_list_h list, int **ids, int *count);
 int ctsvc_client_db_update_records(contacts_h contact, contacts_list_h list);
-int ctsvc_client_db_delete_records(contacts_h contact, const charview_uri, int ids[], int count);
+int ctsvc_client_db_delete_records(contacts_h contact, const char *view_uri, int ids[], int count);
 int ctsvc_client_db_replace_records(contacts_h contact, contacts_list_h list, int ids[], int count);
-int ctsvc_client_db_get_changes_by_version(contacts_h contact, const char* view_uri, int addressbook_id, int ctsvc_client_db_version, contacts_list_h* record_list, int* current_ctsvc_client_db_version);
-int ctsvc_client_db_get_current_version(contacts_h contact, intctsvc_client_db_version);
-int ctsvc_client_db_search_records(contacts_h contact, const char* view_uri, const char *keyword, int offset, int limit, contacts_list_h* out_list);
-int ctsvc_client_db_search_records_with_range(contacts_h contact, const char* view_uri, const char *keyword, int offset, int limit, int range, contacts_list_h* out_list);
-int ctsvc_client_db_search_records_with_query(contacts_h contact, contacts_query_h query, const char *keyword, int offset, int limit, contacts_list_hout_list);
-int ctsvc_client_db_get_last_change_version(contacts_h contact, intlast_version);
+int ctsvc_client_db_get_changes_by_version(contacts_h contact, const char *view_uri, int addressbook_id, int ctsvc_client_db_version, contacts_list_h *record_list, int *current_ctsvc_client_db_version);
+int ctsvc_client_db_get_current_version(contacts_h contact, int *ctsvc_client_db_version);
+int ctsvc_client_db_search_records(contacts_h contact, const char *view_uri, const char *keyword, int offset, int limit, contacts_list_h *out_list);
+int ctsvc_client_db_search_records_with_range(contacts_h contact, const char *view_uri, const char *keyword, int offset, int limit, int range, contacts_list_h *out_list);
+int ctsvc_client_db_search_records_with_query(contacts_h contact, contacts_query_h query, const char *keyword, int offset, int limit, contacts_list_h *out_list);
+int ctsvc_client_db_get_last_change_version(contacts_h contact, int *last_version);
 int ctsvc_client_db_get_status(contacts_h contact, contacts_db_status_e *status);
-int ctsvc_client_db_add_status_changed_cb(contacts_h contact, contacts_db_status_changed_cb cb, voiduser_data);
-int ctsvc_client_db_remove_status_changed_cb(contacts_h contact, contacts_db_status_changed_cb cb, voiduser_data);
+int ctsvc_client_db_add_status_changed_cb(contacts_h contact, contacts_db_status_changed_cb cb, void *user_data);
+int ctsvc_client_db_remove_status_changed_cb(contacts_h contact, contacts_db_status_changed_cb cb, void *user_data);
 
 #endif /* __CTSVC_CLIENT_DB_HELPER_H__ */
\ No newline at end of file
index 5b945ad..2425725 100644 (file)
@@ -23,7 +23,7 @@
 #include "ctsvc_client_handle.h"
 #include "ctsvc_client_ipc.h"
 
-static int _ctsvc_db_view_check_read_permission(const char* view_uri)
+static int _client_noti_check_read_permission(const char *view_uri)
 {
        int ret;
        bool result = false;
@@ -53,60 +53,76 @@ static int _ctsvc_db_view_check_read_permission(const char* view_uri)
                        || STRING_EQUAL == strncmp(view_uri, CTSVC_VIEW_URI_SPEEDDIAL, strlen(CTSVC_VIEW_URI_SPEEDDIAL))
                        || STRING_EQUAL == strncmp(view_uri, CTSVC_VIEW_URI_SDN, strlen(CTSVC_VIEW_URI_SDN))
                        || STRING_EQUAL == strncmp(view_uri, CTSVC_VIEW_URI_GROUP_RELATION, strlen(CTSVC_VIEW_URI_GROUP_RELATION))) {
-               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)");
-       }
-       else 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)");
-       }
+                               ret = ctsvc_ipc_client_check_permission(CTSVC_PERMISSION_CONTACT_READ, &result);
+                               if (CONTACTS_ERROR_NONE != ret) {
+                                       ERR("ctsvc_ipc_client_check_permission() Fail(%d)", ret);
+                                       return ret;
+                               }
+
+                               RETVM_IF(result == false, CONTACTS_ERROR_PERMISSION_DENIED,
+                                               "Permission denied(contact read)");
+                       } else 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);
+                               if (CONTACTS_ERROR_NONE != ret) {
+                                       ERR("ctsvc_ipc_client_check_permission() Fail(%d)", ret);
+                                       return ret;
+                               }
+
+                               RETVM_IF(result == false, CONTACTS_ERROR_PERMISSION_DENIED,
+                                               "Permission denied(phonelog read)");
+                       }
 
        return CONTACTS_ERROR_NONE;
 }
 
-API int contacts_db_add_changed_cb(const charview_uri, contacts_db_changed_cb cb,
-               voiduser_data)
+API int contacts_db_add_changed_cb(const char *view_uri, contacts_db_changed_cb cb,
+               void *user_data)
 {
        int ret;
        contacts_h contact = NULL;
 
-       RETVM_IF(NULL == view_uri, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : view_uri is null");
-       RETVM_IF(NULL == cb, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : callback is null");
+       RETV_IF(NULL == view_uri, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == cb, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       ret = _ctsvc_db_view_check_read_permission(view_uri);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "_ctsvc_db_view_check_read_permission() Fail(%d)", ret);
+       ret = _client_noti_check_read_permission(view_uri);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret,
+                       "_client_noti_check_read_permission() Fail(%d)", ret);
 
        ret = ctsvc_client_handle_get_p(&contact);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_client_handle_get_p() Fail(%d)", ret);
+       if (CONTACTS_ERROR_NONE != ret) {
+               ERR("ctsvc_client_handle_get_p() Fail(%d)", ret);
+               return ret;
+       }
 
        ret = ctsvc_inotify_subscribe(contact, view_uri, cb, user_data);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret,
-                       "ctsvc_inotify_subscribe(%s) Fail(%d)", view_uri, ret);
+       if (CONTACTS_ERROR_NONE != ret) {
+               ERR("ctsvc_inotify_subscribe(%s) Fail(%d)", view_uri, ret);
+               return ret;
+       }
 
        return CONTACTS_ERROR_NONE;
 }
 
-API int contacts_db_remove_changed_cb(const charview_uri, contacts_db_changed_cb cb,
-               voiduser_data)
+API int contacts_db_remove_changed_cb(const char *view_uri, contacts_db_changed_cb cb,
+               void *user_data)
 {
        int ret;
        contacts_h contact = NULL;
 
-       RETVM_IF(NULL == view_uri, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : view_uri is null");
-       RETVM_IF(NULL == cb, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : callback is null");
+       RETV_IF(NULL == view_uri, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == cb, CONTACTS_ERROR_INVALID_PARAMETER);
 
        ret = ctsvc_client_handle_get_p(&contact);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_client_handle_get_p() Fail(%d)", ret);
+       if (CONTACTS_ERROR_NONE != ret) {
+               ERR("ctsvc_client_handle_get_p() Fail(%d)", ret);
+               return ret;
+       }
 
        ret = ctsvc_inotify_unsubscribe(contact, view_uri, cb, user_data);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret,
-                       "ctsvc_inotify_unsubscribe(%s) Fail(%d)", view_uri, ret);
+       if (CONTACTS_ERROR_NONE != ret) {
+               ERR("ctsvc_inotify_unsubscribe(%s) Fail(%d)", view_uri, ret);
+               return ret;
+       }
 
        return CONTACTS_ERROR_NONE;
 }
index 215290a..5ee2b25 100644 (file)
@@ -37,40 +37,40 @@ int ctsvc_client_group_add_contact(contacts_h contact, int group_id, int contact
        pims_ipc_data_h indata = NULL;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(group_id <= 0 || contact_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,"id should be greater than 0");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETVM_IF(group_id <= 0 || contact_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER, "id should be greater than 0");
 
        /* make indata */
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_int(group_id, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
        ret = ctsvc_ipc_marshal_int(contact_id, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        /* ipc call */
        if (ctsvc_ipc_call(CTSVC_IPC_GROUP_MODULE, CTSVC_IPC_SERVER_GROUP_ADD_CONTACT, indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -79,7 +79,7 @@ int ctsvc_client_group_add_contact(contacts_h contact, int group_id, int contact
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
@@ -87,7 +87,7 @@ int ctsvc_client_group_add_contact(contacts_h contact, int group_id, int contact
                if (CONTACTS_ERROR_NONE == ret) {
                        int transaction_ver = 0;
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -107,19 +107,19 @@ int ctsvc_client_group_remove_contact(contacts_h contact, int group_id, int cont
        pims_ipc_data_h indata = NULL;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(group_id <= 0 || contact_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,"id should be greater than 0");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETVM_IF(group_id <= 0 || contact_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER, "id should be greater than 0");
 
        /* make indata */
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
@@ -127,20 +127,20 @@ int ctsvc_client_group_remove_contact(contacts_h contact, int group_id, int cont
 
        ret = ctsvc_ipc_marshal_int(group_id, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
        ret = ctsvc_ipc_marshal_int(contact_id, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        /* ipc call */
        if (ctsvc_ipc_call(CTSVC_IPC_GROUP_MODULE, CTSVC_IPC_SERVER_GROUP_REMOVE_CONTACT, indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -149,7 +149,7 @@ int ctsvc_client_group_remove_contact(contacts_h contact, int group_id, int cont
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
@@ -157,7 +157,7 @@ int ctsvc_client_group_remove_contact(contacts_h contact, int group_id, int cont
                if (CONTACTS_ERROR_NONE == ret) {
                        int transaction_ver = 0;
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -177,45 +177,45 @@ int ctsvc_client_group_set_group_order(contacts_h contact, int group_id, int pre
        pims_ipc_data_h indata = NULL;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(group_id <= 0 || previous_group_id < 0 || next_group_id < 0, CONTACTS_ERROR_INVALID_PARAMETER,"id should be greater than 0");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETVM_IF(group_id <= 0 || previous_group_id < 0 || next_group_id < 0, CONTACTS_ERROR_INVALID_PARAMETER, "id should be greater than 0");
 
        /* make indata */
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_int(group_id, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
        ret = ctsvc_ipc_marshal_int(previous_group_id, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
        ret = ctsvc_ipc_marshal_int(next_group_id, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        /* ipc call */
        if (ctsvc_ipc_call(CTSVC_IPC_GROUP_MODULE, CTSVC_IPC_SERVER_GROUP_SET_GROUP_ORDER, indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -224,7 +224,7 @@ int ctsvc_client_group_set_group_order(contacts_h contact, int group_id, int pre
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
@@ -232,7 +232,7 @@ int ctsvc_client_group_set_group_order(contacts_h contact, int group_id, int pre
                if (CONTACTS_ERROR_NONE == ret) {
                        int transaction_ver = 0;
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
index 90951b7..032b0da 100644 (file)
 
 static GHashTable *_ctsvc_handle_table = NULL;
 
-static int _ctsvc_client_handle_get_key(unsigned int id, char *key, int key_len)
+static int _client_handle_get_key(unsigned int id, char *key, int key_len)
 {
        RETV_IF(NULL == key, CONTACTS_ERROR_INVALID_PARAMETER);
 
        snprintf(key, key_len, "%d:%u", getuid(), id);
-       CTS_DBG("key[%s]", key);
+       DBG("key[%s]", key);
        return CONTACTS_ERROR_NONE;
 }
 
@@ -43,18 +43,18 @@ int ctsvc_client_handle_get_p_with_id(unsigned int id, contacts_h *p_contact)
        char key[CTSVC_STR_SHORT_LEN] = {0};
        contacts_h contact = NULL;
 
-       RETVM_IF(NULL == _ctsvc_handle_table, CONTACTS_ERROR_NO_DATA, "_ctsvc_handle_table is NULL");
+       RETV_IF(NULL == _ctsvc_handle_table, CONTACTS_ERROR_NO_DATA);
        RETV_IF(NULL == p_contact, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       ret = _ctsvc_client_handle_get_key(id, key, sizeof(key));
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "_ctsvc_client_handle_get_key() Fail(%d)", ret);
+       ret = _client_handle_get_key(id, key, sizeof(key));
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "_client_handle_get_key() Fail(%d)", ret);
 
        ctsvc_mutex_lock(CTS_MUTEX_HANDLE);
        contact = g_hash_table_lookup(_ctsvc_handle_table, key);
        ctsvc_mutex_unlock(CTS_MUTEX_HANDLE);
 
        if (NULL == contact) {
-               CTS_ERR("g_hash_table_lookup() Fail. key[%s]", key);
+               ERR("g_hash_table_lookup() Fail. key[%s]", key);
                return CONTACTS_ERROR_NO_DATA;
        }
 
@@ -68,25 +68,24 @@ int ctsvc_client_handle_get_p(contacts_h *p_contact)
        char key[CTSVC_STR_SHORT_LEN] = {0};
        contacts_h contact = NULL;
 
-       RETVM_IF(NULL == _ctsvc_handle_table, CONTACTS_ERROR_NO_DATA, "_ctsvc_handle_table is NULL");
+       RETV_IF(NULL == _ctsvc_handle_table, CONTACTS_ERROR_NO_DATA);
        RETV_IF(NULL == p_contact, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       ret = _ctsvc_client_handle_get_key(ctsvc_client_get_tid(), key, sizeof(key));
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "_ctsvc_client_handle_get_key() Fail(%d)", ret);
+       ret = _client_handle_get_key(ctsvc_client_get_tid(), key, sizeof(key));
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "_client_handle_get_key() Fail(%d)", ret);
 
        ctsvc_mutex_lock(CTS_MUTEX_HANDLE);
        contact = g_hash_table_lookup(_ctsvc_handle_table, key);
        ctsvc_mutex_unlock(CTS_MUTEX_HANDLE);
 
        if (NULL == contact) {
-               ret = _ctsvc_client_handle_get_key(ctsvc_client_get_pid(), key, sizeof(key));
-               RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "_ctsvc_client_handle_get_key() Fail(%d)", ret);
+               ret = _client_handle_get_key(ctsvc_client_get_pid(), key, sizeof(key));
+               RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "_client_handle_get_key() Fail(%d)", ret);
 
                ctsvc_mutex_lock(CTS_MUTEX_HANDLE);
                contact = g_hash_table_lookup(_ctsvc_handle_table, key);
                ctsvc_mutex_unlock(CTS_MUTEX_HANDLE);
-
-               RETVM_IF(NULL == contact, CONTACTS_ERROR_NO_DATA, "g_hash_table_lookup() Fail. key[%s]", key);
+               RETVM_IF(NULL == contact, CONTACTS_ERROR_NO_DATA, "g_hash_table_lookup(%s) Fail", key);
        }
        *p_contact = contact;
        return CONTACTS_ERROR_NONE;
@@ -101,8 +100,8 @@ int ctsvc_client_handle_create(unsigned int id, contacts_h *p_contact)
        RETV_IF(NULL == p_contact, CONTACTS_ERROR_INVALID_PARAMETER);
        *p_contact = NULL;
 
-       ret = _ctsvc_client_handle_get_key(id, handle_key, sizeof(handle_key));
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "_ctsvc_client_handle_get_key() Fail(%d)", ret);
+       ret = _client_handle_get_key(id, handle_key, sizeof(handle_key));
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "_client_handle_get_key() Fail(%d)", ret);
 
        ret = ctsvc_handle_create(&contact);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_handle_create() Fail(%d)", ret);
@@ -112,7 +111,7 @@ int ctsvc_client_handle_create(unsigned int id, contacts_h *p_contact)
                _ctsvc_handle_table = g_hash_table_new_full(g_str_hash, g_str_equal, free, NULL);
 
        g_hash_table_insert(_ctsvc_handle_table, strdup(handle_key), contact);
-       CTS_INFO("handle insert key[%s]", handle_key);
+       INFO("handle insert key[%s]", handle_key);
        ctsvc_mutex_unlock(CTS_MUTEX_HANDLE);
 
        *p_contact = contact;
@@ -123,14 +122,15 @@ int ctsvc_client_handle_remove(unsigned int id, contacts_h contact)
 {
        int ret;
        char key[CTSVC_STR_SHORT_LEN] = {0};
-       RETVM_IF(NULL == _ctsvc_handle_table, CONTACTS_ERROR_NONE, "_ctsvc_handle_table is NULL");
 
-       ret = _ctsvc_client_handle_get_key(id, key, sizeof(key));
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "_ctsvc_client_handle_get_key() Fail(%d)", ret);
+       RETV_IF(NULL == _ctsvc_handle_table, CONTACTS_ERROR_NONE);
+
+       ret = _client_handle_get_key(id, key, sizeof(key));
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "_client_handle_get_key() Fail(%d)", ret);
 
        ctsvc_mutex_lock(CTS_MUTEX_HANDLE);
        if (false == g_hash_table_remove(_ctsvc_handle_table, key))
-               CTS_ERR("g_hash_table_remove() Fail. key[%s]", key);
+               ERR("g_hash_table_remove() Fail. key[%s]", key);
 
        if (0 == g_hash_table_size(_ctsvc_handle_table)) {
                g_hash_table_destroy(_ctsvc_handle_table);
index 1d8bf99..c3b1455 100644 (file)
@@ -19,6 +19,7 @@
 
 #ifndef __CTSVC_CLIENT_HANDLE_H__
 #define __CTSVC_CLIENT_HANDLE_H__
+
 #include "contacts_types.h"
 
 int ctsvc_client_handle_get_p(contacts_h *p_contact);
@@ -26,4 +27,4 @@ int ctsvc_client_handle_get_p_with_id(unsigned int id, contacts_h *p_contact);
 int ctsvc_client_handle_remove(unsigned int id, contacts_h contact);
 int ctsvc_client_handle_create(unsigned int id, contacts_h *p_contact);
 
-#endif /* __CTSVC_CLIENT_HANDLE_H__ */
+#endif /* __CTSVC_CLIENT_HANDLE_H__ */
\ No newline at end of file
index 8a4682c..b2eac42 100644 (file)
@@ -75,13 +75,13 @@ bool ctsvc_ipc_is_busy()
 
        pims_ipc_h ipc = _ctsvc_get_ipc_handle();
        if (NULL == ipc) {
-               CTS_ERR("_ctsvc_get_ipc_handle() return NULL");
+               ERR("_ctsvc_get_ipc_handle() return NULL");
                return false;
        }
 
        ret = pims_ipc_is_call_in_progress(ipc);
        if (ret)
-               CTS_ERR("global ipc channel is busy.");
+               ERR("global ipc channel is busy.");
 
        return ret;
 }
@@ -89,15 +89,16 @@ bool ctsvc_ipc_is_busy()
 static int _ctsvc_ipc_create(pims_ipc_h *p_ipc)
 {
        char sock_file[CTSVC_PATH_MAX_LEN] = {0};
-       snprintf(sock_file, sizeof(sock_file), CTSVC_SOCK_PATH"/.%s", getuid(), CTSVC_IPC_SERVICE);
+
+       snprintf(sock_file, sizeof(sock_file), CTSVC_SOCK_PATH"/.%s", getuid(),
+                       CTSVC_IPC_SERVICE);
        pims_ipc_h ipc = pims_ipc_create(sock_file);
        if (NULL == ipc) {
                if (errno == EACCES) {
-                       CTS_ERR("pims_ipc_create() Failed(%d)", CONTACTS_ERROR_PERMISSION_DENIED);
+                       ERR("pims_ipc_create() Fail(%d)", CONTACTS_ERROR_PERMISSION_DENIED);
                        return CONTACTS_ERROR_PERMISSION_DENIED;
-               }
-               else {
-                       CTS_ERR("pims_ipc_create() Failed(%d)", CONTACTS_ERROR_IPC_NOT_AVALIABLE);
+               } else {
+                       ERR("pims_ipc_create() Fail(%d)", CONTACTS_ERROR_IPC_NOT_AVALIABLE);
                        return CONTACTS_ERROR_IPC_NOT_AVALIABLE;
                }
        }
@@ -131,20 +132,22 @@ static int _ctsvc_ipc_connect(contacts_h contact, pims_ipc_h ipc)
        /* Access control : put cookie to indata */
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("pims_ipc_data_create() return NULL");
+               ERR("pims_ipc_data_create() return NULL");
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
 
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_marshal_handle Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        /* ipc call */
-       if (pims_ipc_call(ipc, CTSVC_IPC_MODULE, CTSVC_IPC_SERVER_CONNECT, indata, &outdata) != 0) {
-               CTS_ERR("[GLOBAL_IPC_CHANNEL] pims_ipc_call failed");
+       ret = pims_ipc_call(ipc, CTSVC_IPC_MODULE, CTSVC_IPC_SERVER_CONNECT, indata,
+                       &outdata);
+       if (0 != ret) {
+               ERR("pims_ipc_call() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -153,7 +156,8 @@ static int _ctsvc_ipc_connect(contacts_h contact, pims_ipc_h ipc)
        if (outdata) {
                ctsvc_ipc_unmarshal_int(outdata, &ret);
                pims_ipc_data_destroy(outdata);
-               RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_ipc_server_connect return(%d)", ret);
+               if (CONTACTS_ERROR_NONE != ret)
+                       ERR("ctsvc_ipc_unmarshal_int() return(%d)", ret);
        }
        return ret;
 }
@@ -171,16 +175,17 @@ int ctsvc_ipc_connect(contacts_h contact, unsigned int handle_id)
 
        snprintf(ipc_key, sizeof(ipc_key), "%u", handle_id);
 
-       if (NULL == _ctsvc_ipc_table)
-               _ctsvc_ipc_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, _ctsvc_ipc_data_free);
-       else
+       if (NULL == _ctsvc_ipc_table) {
+               _ctsvc_ipc_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
+                               _ctsvc_ipc_data_free);
+       } else {
                ipc_data = g_hash_table_lookup(_ctsvc_ipc_table, ipc_key);
+       }
 
        if (NULL == ipc_data) {
                ipc_data = calloc(1, sizeof(struct ctsvc_ipc_s));
-               if (NULL == ipc_data)
-               {
-                       CTS_ERR("calloc() Fail");
+               if (NULL == ipc_data) {
+                       ERR("calloc() Fail");
                        return CONTACTS_ERROR_OUT_OF_MEMORY;
                }
                ret = _ctsvc_ipc_create(&(ipc_data->ipc));
@@ -198,7 +203,8 @@ int ctsvc_ipc_connect(contacts_h contact, unsigned int handle_id)
 }
 
 
-int ctsvc_ipc_disconnect(contacts_h contact, unsigned int handle_id, int connection_count)
+int ctsvc_ipc_disconnect(contacts_h contact, unsigned int handle_id,
+               int connection_count)
 {
        int ret = CONTACTS_ERROR_NONE;
        struct ctsvc_ipc_s *ipc_data = NULL;
@@ -214,37 +220,39 @@ int ctsvc_ipc_disconnect(contacts_h contact, unsigned int handle_id, int connect
 
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
 
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
-       if (pims_ipc_call(ipc_data->ipc, CTSVC_IPC_MODULE, CTSVC_IPC_SERVER_DISCONNECT, indata, &outdata) != 0) {
+
+       ret = pims_ipc_call(ipc_data->ipc, CTSVC_IPC_MODULE, CTSVC_IPC_SERVER_DISCONNECT,
+                       indata, &outdata);
+       if (0 != ret) {
                pims_ipc_data_destroy(indata);
-               CTS_ERR("[GLOBAL_IPC_CHANNEL] pims_ipc_call failed");
+               ERR("pims_ipc_call() Fail(%d)", ret);
                return CONTACTS_ERROR_IPC;
        }
+       pims_ipc_data_destroy(indata);
 
        if (outdata) {
                ctsvc_ipc_unmarshal_int(outdata, &ret);
                pims_ipc_data_destroy(outdata);
 
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("[GLOBAL_IPC_CHANNEL] pims_ipc didn't destroyed!!!(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_int() Fail(%d)", ret);
                        return ret;
                }
 
-               if (1 == connection_count) {
+               if (1 == connection_count)
                        g_hash_table_remove(_ctsvc_ipc_table, ipc_key);
-               }
-       }
-       else {
-               CTS_ERR("pims_ipc_call out data is NULL");
+       } else {
+               ERR("pims_ipc_call out data is NULL");
                return CONTACTS_ERROR_IPC;
        }
 
@@ -263,7 +271,8 @@ static void __ctsvc_ipc_unlock(void)
                ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_CALL);
 }
 
-int ctsvc_ipc_call(char *module, char *function, pims_ipc_h data_in, pims_ipc_data_h *data_out)
+int ctsvc_ipc_call(char *module, char *function, pims_ipc_h data_in,
+               pims_ipc_data_h *data_out)
 {
        pims_ipc_h ipc_handle;
 
@@ -284,15 +293,19 @@ int ctsvc_ipc_call(char *module, char *function, pims_ipc_h data_in, pims_ipc_da
 
 void ctsvc_client_ipc_set_change_version(contacts_h contact, int version)
 {
-       RETM_IF(NULL == contact, "contact is NULL");
-       ctsvc_base_s *base = (ctsvc_base_s *)contact;
+       ctsvc_base_s *base = (ctsvc_base_s*)contact;
+
+       RET_IF(NULL == contact);
+
        base->version = version;
 }
 
 int ctsvc_client_ipc_get_change_version(contacts_h contact)
 {
-       RETVM_IF(NULL == contact, -1, "contact is NULL");
-       ctsvc_base_s *base = (ctsvc_base_s *)contact;
+       ctsvc_base_s *base = (ctsvc_base_s*)contact;
+
+       RETV_IF(NULL == contact, -1);
+
        return base->version;
 }
 
@@ -307,19 +320,21 @@ int ctsvc_ipc_client_check_permission(int permission, bool *result)
 
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail !");
+               ERR("pims_ipc_data_create() Fail");
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
 
        ret = ctsvc_ipc_marshal_int(permission, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
-       if (ctsvc_ipc_call(CTSVC_IPC_MODULE, CTSVC_IPC_SERVER_CHECK_PERMISSION, indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call Fail");
+       ret = ctsvc_ipc_call(CTSVC_IPC_MODULE, CTSVC_IPC_SERVER_CHECK_PERMISSION, indata,
+                       &outdata);
+       if (0 != ret) {
+               ERR("ctsvc_ipc_call() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -328,14 +343,14 @@ int ctsvc_ipc_client_check_permission(int permission, bool *result)
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
 
                if (CONTACTS_ERROR_NONE == ret && result) {
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_bool(outdata, result)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_bool() Fail");
+                               ERR("ctsvc_ipc_unmarshal_bool() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -366,22 +381,25 @@ void ctsvc_ipc_set_disconnected(bool is_disconnected)
 int ctsvc_ipc_get_disconnected()
 {
        pthread_mutex_lock(&_ctsvc_mutex_disconnected);
-       CTS_DBG("_ctsvc_ipc_disconnected=%d", _ctsvc_ipc_disconnected);
+       DBG("_ctsvc_ipc_disconnected=%d", _ctsvc_ipc_disconnected);
        pthread_mutex_unlock(&_ctsvc_mutex_disconnected);
        return _ctsvc_ipc_disconnected;
 }
 
-static void _ctsvc_ipc_recovery_foreach_cb(gpointer key, gpointer value, gpointer user_data)
+static void _ctsvc_ipc_recovery_foreach_cb(gpointer key, gpointer value,
+               gpointer user_data)
 {
        GList *c;
        struct ctsvc_ipc_s *ipc_data = value;
 
        ctsvc_ipc_unset_disconnected_cb(ipc_data->ipc);
+
        int ret = _ctsvc_ipc_create(&(ipc_data->ipc));
        RETM_IF(CONTACTS_ERROR_NONE != ret, "_ctsvc_ipc_create() Fail(%d)", ret);
+
        ctsvc_ipc_set_disconnected_cb(ipc_data->ipc, _ctsvc_ipc_disconnected_cb, NULL);
 
-       for (c=ipc_data->list_handle;c;c=c->next) {
+       for (c = ipc_data->list_handle; c; c = c->next) {
                contacts_h contact = c->data;
                ret = _ctsvc_ipc_connect(contact, ipc_data->ipc);
                WARN_IF(CONTACTS_ERROR_NONE != ret, "_ctsvc_ipc_connect() Fail(%d)", ret);
@@ -394,4 +412,3 @@ void ctsvc_ipc_recovery()
        g_hash_table_foreach(_ctsvc_ipc_table, _ctsvc_ipc_recovery_foreach_cb, NULL);
 }
 
-
index 9aaa9be..3121379 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
 #include "ctsvc_client_setting.h"
 #include "contacts_extension.h"
 
-typedef struct
-{
+typedef struct {
        contacts_db_change_cb_with_info cb;
        void *user_data;
-}db_callback_info_s;
+} db_callback_info_s;
 
-typedef struct
-{
+typedef struct {
        char *view_uri;
        GSList *callbacks;
-}subscribe_info_s;
+} subscribe_info_s;
 
 static int __ipc_pubsub_ref = 0;
 static pims_ipc_h __ipc = NULL;
 static GSList *__db_change_subscribe_list = NULL;
 
-static void __ctsvc_db_subscriber_callback(pims_ipc_h ipc, pims_ipc_data_h data, void *user_data)
+static void _cnoti_subscribe_cb(pims_ipc_h ipc, pims_ipc_data_h data,
+               void *user_data)
 {
        int ret;
        char *str = NULL;
@@ -60,36 +59,35 @@ static void __ctsvc_db_subscriber_callback(pims_ipc_h ipc, pims_ipc_data_h data,
        }
 
        if (NULL == str) {
-               CTS_ERR("There is no changed data");
-               goto DATA_FREE;
+               ERR("There is no changed data");
+               free(str);
+               return;
        }
 
        if (info) {
                GSList *l;
-               for (l = info->callbacks;l;l=l->next) {
+               for (l = info->callbacks; l; l = l->next) {
                        db_callback_info_s *cb_info = l->data;
-                       if (cb_info->cb) {
+                       if (cb_info->cb)
                                cb_info->cb(info->view_uri, str, cb_info->user_data);
-                       }
                }
        }
-DATA_FREE:
        free(str);
 }
 
-int __ctsvc_db_recover_for_change_subscription()
+int _cnoti_recover_for_change_subscription()
 {
        GSList *it = NULL;
        subscribe_info_s *info = NULL;
 
-       for (it=__db_change_subscribe_list;it;it=it->next) {
+       for (it = __db_change_subscribe_list; it; it = it->next) {
                if (NULL == it->data) continue;
 
                info = it->data;
                if (info->view_uri) {
                        if (pims_ipc_subscribe(__ipc, CTSVC_IPC_SUBSCRIBE_MODULE, info->view_uri,
-                                               __ctsvc_db_subscriber_callback, (void*)info) != 0) {
-                               CTS_ERR("pims_ipc_subscribe() Fail");
+                                               _cnoti_subscribe_cb, (void*)info) != 0) {
+                               ERR("pims_ipc_subscribe() Fail");
                                return CONTACTS_ERROR_IPC;
                        }
                }
@@ -117,10 +115,11 @@ int ctsvc_ipc_create_for_change_subscription()
 
        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);
+               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 (NULL == __ipc) {
-                       CTS_ERR("pims_ipc_create_for_subscribe() Fail");
+                       ERR("pims_ipc_create_for_subscribe() Fail");
                        ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB);
                        return CONTACTS_ERROR_IPC;
                }
@@ -142,19 +141,19 @@ int ctsvc_ipc_recover_for_change_subscription()
        pims_ipc_destroy_for_subscribe(__ipc);
        __ipc = pims_ipc_create_for_subscribe(CTSVC_IPC_SOCKET_PATH_FOR_CHANGE_SUBSCRIPTION);
        if (NULL == __ipc) {
-               CTS_ERR("pims_ipc_create_for_subscribe() Fail");
+               ERR("pims_ipc_create_for_subscribe() Fail");
                ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB);
                return CONTACTS_ERROR_IPC;
        }
        ret = ctsvc_setting_recover_for_change_subscription();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_setting_recover_for_change_subscription() Fail(%d)", ret);
+               ERR("ctsvc_setting_recover_for_change_subscription() Fail(%d)", ret);
                ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB);
                return ret;
        }
-       ret = __ctsvc_db_recover_for_change_subscription();
+       ret = _cnoti_recover_for_change_subscription();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("__ctsvc_db_recover_changed_cb_with_info() Fail(%d)", ret);
+               ERR("__ctsvc_db_recover_changed_cb_with_info() Fail(%d)", ret);
                ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB);
                return ret;
        }
@@ -179,12 +178,11 @@ int ctsvc_ipc_destroy_for_change_subscription(bool is_disconnect)
        if (1 == __ipc_pubsub_ref) {
                pims_ipc_destroy_for_subscribe(__ipc);
                __ipc = NULL;
-       }
-       else if (1 < __ipc_pubsub_ref) {
-               CTS_DBG("ctsvc pubsub ipc ref count : %d", __ipc_pubsub_ref);
-       }
-       else {
-               CTS_DBG("System : please call connection APIs, connection count is (%d)", __ipc_pubsub_ref);
+       } else if (1 < __ipc_pubsub_ref) {
+               DBG("ctsvc pubsub ipc ref count : %d", __ipc_pubsub_ref);
+       } else {
+               DBG("System : please call connection APIs, connection count is (%d)",
+                               __ipc_pubsub_ref);
                ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
@@ -195,8 +193,8 @@ int ctsvc_ipc_destroy_for_change_subscription(bool is_disconnect)
        return CONTACTS_ERROR_NONE;
 }
 
-API int contacts_db_add_changed_cb_with_info(const charview_uri,
-               contacts_db_change_cb_with_info cb, voiduser_data)
+API int contacts_db_add_changed_cb_with_info(const char *view_uri,
+               contacts_db_change_cb_with_info cb, void *user_data)
 {
        GSList *it = NULL;
        subscribe_info_s *info = NULL;
@@ -204,33 +202,42 @@ API int contacts_db_add_changed_cb_with_info(const char* view_uri,
        bool result = false;
        int ret;
 
-       RETVM_IF(view_uri == NULL, CONTACTS_ERROR_INVALID_PARAMETER, "view_uri is NULL");
-       RETVM_IF(cb == NULL, CONTACTS_ERROR_INVALID_PARAMETER, "cb is NULL");
+       RETV_IF(view_uri == NULL, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(cb == NULL, CONTACTS_ERROR_INVALID_PARAMETER);
 
        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 (STRING_EQUAL == strncmp(view_uri, CTSVC_VIEW_URI_PERSON, strlen(CTSVC_VIEW_URI_PERSON))) {
+               if (CONTACTS_ERROR_NONE != ret) {
+                       ERR("ctsvc_ipc_client_check_permission() Fail(%d)", ret);
+                       return ret;
+               }
+
+               RETVM_IF(result == false, CONTACTS_ERROR_PERMISSION_DENIED,
+                               "Permission denied (phonelog read)");
+       } 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)");
-       }
-       else {
-               CTS_ERR("We support this API for only %s and %s", CTSVC_VIEW_URI_PERSON, CTSVC_VIEW_URI_PHONELOG);
+               if (CONTACTS_ERROR_NONE != ret) {
+                       ERR("ctsvc_ipc_client_check_permission() Fail(%d)", ret);
+                       return ret;
+               }
+
+               RETVM_IF(result == false, CONTACTS_ERROR_PERMISSION_DENIED,
+                               "Permission denied (contact read)");
+       } else {
+               ERR("We support this API for only %s and %s", CTSVC_VIEW_URI_PERSON,
+                               CTSVC_VIEW_URI_PHONELOG);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
        ret = ctsvc_ipc_create_for_change_subscription();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_create_for_change_subscription() Fail(%d)", ret);
+               ERR("ctsvc_ipc_create_for_change_subscription() Fail(%d)", ret);
                return ret;
        }
 
        ctsvc_mutex_lock(CTS_MUTEX_PIMS_IPC_PUBSUB);
 
-       for (it=__db_change_subscribe_list;it;it=it->next) {
+       for (it = __db_change_subscribe_list; it; it = it->next) {
                if (NULL == it->data) continue;
 
                info = it->data;
@@ -243,27 +250,26 @@ API int contacts_db_add_changed_cb_with_info(const char* view_uri,
        if (NULL == info) {
                info = calloc(1, sizeof(subscribe_info_s));
                if (NULL == info) {
-                       CTS_ERR("calloc() Fail");
+                       ERR("calloc() Fail");
                        ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB);
                        return CONTACTS_ERROR_OUT_OF_MEMORY;
                }
 
                if (pims_ipc_subscribe(__ipc, CTSVC_IPC_SUBSCRIBE_MODULE, (char*)view_uri,
-                                       __ctsvc_db_subscriber_callback, (void*)info) != 0) {
-                       CTS_ERR("pims_ipc_subscribe() Fail");
+                                       _cnoti_subscribe_cb, (void*)info) != 0) {
+                       ERR("pims_ipc_subscribe() Fail");
                        free(info);
                        ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB);
                        return CONTACTS_ERROR_IPC;
                }
                info->view_uri = strdup(view_uri);
                __db_change_subscribe_list = g_slist_append(__db_change_subscribe_list, info);
-       }
-       else {
+       } else {
                GSList *l;
-               for (l = info->callbacks;l;l=l->next) {
+               for (l = info->callbacks; l; l = l->next) {
                        db_callback_info_s *cb_info = l->data;
                        if (cb_info->cb == cb && cb_info->user_data == user_data) {
-                               CTS_ERR("The same callback(%s) is already exist", view_uri);
+                               ERR("The same callback(%s) is already exist", view_uri);
                                ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB);
                                return CONTACTS_ERROR_INVALID_PARAMETER;
                        }
@@ -272,7 +278,7 @@ API int contacts_db_add_changed_cb_with_info(const char* view_uri,
 
        cb_info = calloc(1, sizeof(db_callback_info_s));
        if (NULL == cb_info) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB);
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
@@ -284,32 +290,34 @@ API int contacts_db_add_changed_cb_with_info(const char* view_uri,
        return CONTACTS_ERROR_NONE;
 }
 
-API int contacts_db_remove_changed_cb_with_info(const charview_uri,
-               contacts_db_change_cb_with_info cb, voiduser_data)
+API int contacts_db_remove_changed_cb_with_info(const char *view_uri,
+               contacts_db_change_cb_with_info cb, void *user_data)
 {
        int ret;
        GSList *it = NULL;
        subscribe_info_s *info = NULL;
 
-       RETVM_IF(view_uri == NULL, CONTACTS_ERROR_INVALID_PARAMETER, "view_uri is NULL");
-       RETVM_IF(cb == NULL, CONTACTS_ERROR_INVALID_PARAMETER, "cb is NULL");
+       RETV_IF(view_uri == NULL, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(cb == NULL, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       if (STRING_EQUAL != strcmp(view_uri, CTSVC_VIEW_URI_PHONELOG) &&
-                       STRING_EQUAL != strcmp(view_uri, CTSVC_VIEW_URI_PERSON)) {
-               CTS_ERR("We support this API for only %s and %s", CTSVC_VIEW_URI_PERSON, CTSVC_VIEW_URI_PHONELOG);
+       if (STRING_EQUAL != strcmp(view_uri, CTSVC_VIEW_URI_PHONELOG)
+                       && STRING_EQUAL != strcmp(view_uri, CTSVC_VIEW_URI_PERSON)) {
+               ERR("We support this API for only %s and %s", CTSVC_VIEW_URI_PERSON,
+                               CTSVC_VIEW_URI_PHONELOG);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
        ret = ctsvc_ipc_destroy_for_change_subscription(false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_destroy_for_change_subscription() Fail(%d)", ret);
+               ERR("ctsvc_ipc_destroy_for_change_subscription() Fail(%d)", ret);
                return ret;
        }
 
        ctsvc_mutex_lock(CTS_MUTEX_PIMS_IPC_PUBSUB);
 
-       for (it=__db_change_subscribe_list;it;it=it->next) {
-               if (NULL == it->data) continue;
+       for (it = __db_change_subscribe_list; it; it = it->next) {
+               if (NULL == it->data)
+                       continue;
 
                info = it->data;
                if (STRING_EQUAL == strcmp(info->view_uri, view_uri))
@@ -320,7 +328,7 @@ API int contacts_db_remove_changed_cb_with_info(const char* view_uri,
 
        if (info) {
                GSList *l;
-               for (l = info->callbacks;l;l=l->next) {
+               for (l = info->callbacks; l; l = l->next) {
                        db_callback_info_s *cb_info = l->data;
                        if (cb == cb_info->cb && user_data == cb_info->user_data) {
                                info->callbacks = g_slist_remove(info->callbacks, cb_info);
index e64bf04..2eedf19 100644 (file)
@@ -35,7 +35,7 @@ API int contacts_person_link_person(int base_person_id, int person_id)
        return ret;
 }
 
-API int contacts_person_unlink_contact(int person_id, int contact_id, intunlinked_person_id)
+API int contacts_person_unlink_contact(int person_id, int contact_id, int *unlinked_person_id)
 {
        int ret;
        contacts_h contact = NULL;
@@ -43,7 +43,8 @@ API int contacts_person_unlink_contact(int person_id, int contact_id, int* unlin
        ret = ctsvc_client_handle_get_p(&contact);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_client_handle_get_p() Fail(%d)", ret);
 
-       ret = ctsvc_client_person_unlink_contact(contact, person_id, contact_id, unlinked_person_id);
+       ret = ctsvc_client_person_unlink_contact(contact, person_id, contact_id,
+                       unlinked_person_id);
 
        return ret;
 
@@ -62,7 +63,8 @@ API int contacts_person_reset_usage(int person_id, contacts_usage_type_e type)
        return ret;
 }
 
-API int contacts_person_set_favorite_order(int person_id, int previous_person_id, int next_person_id)
+API int contacts_person_set_favorite_order(int person_id, int previous_person_id,
+               int next_person_id)
 {
        int ret;
        contacts_h contact = NULL;
@@ -70,7 +72,8 @@ API int contacts_person_set_favorite_order(int person_id, int previous_person_id
        ret = ctsvc_client_handle_get_p(&contact);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_client_handle_get_p() Fail(%d)", ret);
 
-       ret = ctsvc_client_person_set_favorite_order(contact, person_id, previous_person_id, next_person_id);
+       ret = ctsvc_client_person_set_favorite_order(contact, person_id, previous_person_id,
+                       next_person_id);
 
        return ret;
 }
index cdbe165..7c0749f 100644 (file)
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include <pims-ipc-data.h>
 
 #include "contacts.h"
 #include "ctsvc_client_ipc.h"
 #include "ctsvc_ipc_marshal.h"
 
-static const char CONTACTS_READ_PRIVILEGE_ID[] =  "http://tizen.org/privilege/contact.read";
-static const char CONTACTS_WRITE_PRIVILEGE_ID[] =  "http://tizen.org/privilege/contact.write";
-static const char PHONELOG_READ_PRIVILEGE_ID[] =  "http://tizen.org/privilege/callhistory.read";
-static const char PHONELOG_WRITE_PRIVILEGE_ID[] =  "http://tizen.org/privilege/callhistory.write";
+static const char CONTACTS_READ_PRIVILEGE_ID[] = "http://tizen.org/privilege/contact.read";
+static const char CONTACTS_WRITE_PRIVILEGE_ID[] = "http://tizen.org/privilege/contact.write";
+static const char PHONELOG_READ_PRIVILEGE_ID[] = "http://tizen.org/privilege/callhistory.read";
+static const char PHONELOG_WRITE_PRIVILEGE_ID[] = "http://tizen.org/privilege/callhistory.write";
 
-int ctsvc_client_person_link_person(contacts_h contact, int base_person_id, int person_id)
+int ctsvc_client_person_link_person(contacts_h contact, int base_person_id,
+               int person_id)
 {
        int ret = CONTACTS_ERROR_NONE;
 
        pims_ipc_data_h indata = NULL;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(base_person_id <= 0 || person_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,"id should be greater than 0");
-
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETVM_IF(base_person_id <= 0 || person_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
+                       "id should be greater than 0");
 
        /* make indata */
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_ipc_marshal_handle Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        bool success = false;
        do {
-               if (ctsvc_ipc_marshal_int(base_person_id, indata) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int(person_id, indata) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_marshal_int(base_person_id, indata) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int(person_id, indata) != CONTACTS_ERROR_NONE)
+                       break;
 
                success = true;
        } while (0);
 
        if (success == false) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
 
-/*
-       ret = ctsvc_ipc_marshal_int(base_person_id, indata);
-       if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
-               return ret;
-       }
-       ret = ctsvc_ipc_marshal_int(person_id, indata);
-       if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
-               return ret;
-       }
-*/
+       /*
+          ret = ctsvc_ipc_marshal_int(base_person_id, indata);
+          if (ret != CONTACTS_ERROR_NONE) {
+          ERR("marshal fail");
+          return ret;
+          }
+          ret = ctsvc_ipc_marshal_int(person_id, indata);
+          if (ret != CONTACTS_ERROR_NONE) {
+          ERR("marshal fail");
+          return ret;
+          }
+          */
 
        /* ipc call */
-       if (ctsvc_ipc_call(CTSVC_IPC_PERSON_MODULE, CTSVC_IPC_SERVER_PERSON_LINK_PERSON, indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+       if (ctsvc_ipc_call(CTSVC_IPC_PERSON_MODULE, CTSVC_IPC_SERVER_PERSON_LINK_PERSON,
+                               indata, &outdata) != 0) {
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -92,7 +95,7 @@ int ctsvc_client_person_link_person(contacts_h contact, int base_person_id, int
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
@@ -100,7 +103,7 @@ int ctsvc_client_person_link_person(contacts_h contact, int base_person_id, int
                if (CONTACTS_ERROR_NONE == ret) {
                        int transaction_ver = 0;
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -113,15 +116,17 @@ int ctsvc_client_person_link_person(contacts_h contact, int base_person_id, int
        return ret;
 }
 
-int ctsvc_client_person_unlink_contact(contacts_h contact, int person_id, int contact_id, int* unlinked_person_id)
+int ctsvc_client_person_unlink_contact(contacts_h contact, int person_id, int contact_id,
+               int *unlinked_person_id)
 {
        int ret = CONTACTS_ERROR_NONE;
 
        pims_ipc_data_h indata = NULL;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(person_id <= 0 || contact_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,"id should be greater than 0");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETVM_IF(person_id <= 0 || contact_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
+                       "id should be greater than 0");
 
        if (unlinked_person_id)
                *unlinked_person_id = 0;
@@ -129,33 +134,34 @@ int ctsvc_client_person_unlink_contact(contacts_h contact, int person_id, int co
        /* make indata */
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_ipc_marshal_handle Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_int(person_id, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
        ret = ctsvc_ipc_marshal_int(contact_id, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        /* ipc call */
-       if (ctsvc_ipc_call(CTSVC_IPC_PERSON_MODULE, CTSVC_IPC_SERVER_PERSON_UNLINK_CONTACT, indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+       if (ctsvc_ipc_call(CTSVC_IPC_PERSON_MODULE, CTSVC_IPC_SERVER_PERSON_UNLINK_CONTACT,
+                               indata, &outdata) != 0) {
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -164,7 +170,7 @@ int ctsvc_client_person_unlink_contact(contacts_h contact, int person_id, int co
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
@@ -172,15 +178,16 @@ int ctsvc_client_person_unlink_contact(contacts_h contact, int person_id, int co
                if (CONTACTS_ERROR_NONE == ret) {
                        int transaction_ver = 0;
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
                        ctsvc_client_ipc_set_change_version(contact, transaction_ver);
 
                        if (unlinked_person_id) {
-                               if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, unlinked_person_id)) {
-                                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata,
+                                                       unlinked_person_id)) {
+                                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                                        pims_ipc_data_destroy(outdata);
                                        return CONTACTS_ERROR_IPC;
                                }
@@ -192,26 +199,28 @@ int ctsvc_client_person_unlink_contact(contacts_h contact, int person_id, int co
        return ret;
 }
 
-int ctsvc_client_person_reset_usage(contacts_h contact, int person_id, contacts_usage_type_e type)
+int ctsvc_client_person_reset_usage(contacts_h contact, int person_id,
+               contacts_usage_type_e type)
 {
        int ret = CONTACTS_ERROR_NONE;
 
        pims_ipc_data_h indata = NULL;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(person_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,"contact_id should be greater than 0");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETVM_IF(person_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
+                       "contact_id should be greater than 0");
 
        /* make indata */
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_ipc_marshal_handle Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
@@ -219,20 +228,21 @@ int ctsvc_client_person_reset_usage(contacts_h contact, int person_id, contacts_
 
        ret = ctsvc_ipc_marshal_int(person_id, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
        ret = ctsvc_ipc_marshal_int((int)type, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        /* ipc call */
-       if (ctsvc_ipc_call(CTSVC_IPC_PERSON_MODULE, CTSVC_IPC_SERVER_PERSON_RESET_USAGE, indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+       if (ctsvc_ipc_call(CTSVC_IPC_PERSON_MODULE, CTSVC_IPC_SERVER_PERSON_RESET_USAGE,
+                               indata, &outdata) != 0) {
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -241,7 +251,7 @@ int ctsvc_client_person_reset_usage(contacts_h contact, int person_id, contacts_
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
@@ -249,7 +259,7 @@ int ctsvc_client_person_reset_usage(contacts_h contact, int person_id, contacts_
                if (CONTACTS_ERROR_NONE == ret) {
                        int transaction_ver = 0;
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -262,52 +272,56 @@ int ctsvc_client_person_reset_usage(contacts_h contact, int person_id, contacts_
        return ret;
 }
 
-int ctsvc_client_person_set_favorite_order(contacts_h contact, int person_id, int previous_person_id, int next_person_id)
+int ctsvc_client_person_set_favorite_order(contacts_h contact, int person_id,
+               int previous_person_id, int next_person_id)
 {
        int ret = CONTACTS_ERROR_NONE;
 
        pims_ipc_data_h indata = NULL;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(person_id <= 0 || previous_person_id < 0 || next_person_id < 0, CONTACTS_ERROR_INVALID_PARAMETER,"id should be greater than 0");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETVM_IF(person_id <= 0 || previous_person_id < 0 || next_person_id < 0,
+                       CONTACTS_ERROR_INVALID_PARAMETER, "id should be greater than 0");
 
        /* make indata */
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_ipc_marshal_handle Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_int(person_id, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
        ret = ctsvc_ipc_marshal_int(previous_person_id, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
        ret = ctsvc_ipc_marshal_int(next_person_id, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        /* ipc call */
-       if (ctsvc_ipc_call(CTSVC_IPC_PERSON_MODULE, CTSVC_IPC_SERVER_PERSON_SET_FAVORITE_ORDER, indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+       ret = ctsvc_ipc_call(CTSVC_IPC_PERSON_MODULE,
+                       CTSVC_IPC_SERVER_PERSON_SET_FAVORITE_ORDER, indata, &outdata);
+       if (0 != ret) {
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -316,7 +330,7 @@ int ctsvc_client_person_set_favorite_order(contacts_h contact, int person_id, in
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
@@ -324,7 +338,7 @@ int ctsvc_client_person_set_favorite_order(contacts_h contact, int person_id, in
                if (CONTACTS_ERROR_NONE == ret) {
                        int transaction_ver = 0;
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -338,54 +352,56 @@ int ctsvc_client_person_set_favorite_order(contacts_h contact, int person_id, in
 
 }
 
-int ctsvc_client_person_set_default_property(contacts_h contact, contacts_person_property_e property,
-               int person_id, int id)
+int ctsvc_client_person_set_default_property(contacts_h contact,
+               contacts_person_property_e property, int person_id, int id)
 {
        int ret = CONTACTS_ERROR_NONE;
 
        pims_ipc_data_h indata = NULL;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(person_id <= 0 || id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,"id should be greater than 0");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETVM_IF(person_id <= 0 || id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
+                       "id should be greater than 0");
 
        /* make indata */
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_ipc_marshal_handle Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_int(person_id, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
        ret = ctsvc_ipc_marshal_unsigned_int(property, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_unsigned_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
        ret = ctsvc_ipc_marshal_int(id, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        /* ipc call */
-       if (ctsvc_ipc_call(CTSVC_IPC_PERSON_MODULE, CTSVC_IPC_SERVER_PERSON_SET_DEFAULT_PROPERTY, indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+       if (ctsvc_ipc_call(CTSVC_IPC_PERSON_MODULE, CTSVC_IPC_SERVER_PERSON_SET_DEFAULT_PROPERTY,
+                               indata, &outdata) != 0) {
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -394,14 +410,14 @@ int ctsvc_client_person_set_default_property(contacts_h contact, contacts_person
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
                if (CONTACTS_ERROR_NONE == ret) {
                        int transaction_ver = 0;
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -414,42 +430,43 @@ int ctsvc_client_person_set_default_property(contacts_h contact, contacts_person
        return ret;
 }
 
-int ctsvc_client_person_get_default_property(contacts_h contact, contacts_person_property_e property,
-               int person_id, int *id)
+int ctsvc_client_person_get_default_property(contacts_h contact,
+               contacts_person_property_e property, int person_id, int *id)
 {
        int ret = CONTACTS_ERROR_NONE;
        pims_ipc_data_h indata = NULL;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
-       RETVM_IF(person_id <= 0 || id == NULL, CONTACTS_ERROR_INVALID_PARAMETER,"id should be greater than 0");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETVM_IF(person_id <= 0 || id == NULL, CONTACTS_ERROR_INVALID_PARAMETER,
+                       "id should be greater than 0");
        *id = 0;
 
        /* make indata */
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_ipc_marshal_handle Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_int(person_id, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_unsigned_int(property, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_unsigned_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
@@ -457,7 +474,7 @@ int ctsvc_client_person_get_default_property(contacts_h contact, contacts_person
        /* ipc call */
        if (ctsvc_ipc_call(CTSVC_IPC_PERSON_MODULE, CTSVC_IPC_SERVER_PERSON_GET_DEFAULT_PROPERTY,
                                indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -466,13 +483,13 @@ int ctsvc_client_person_get_default_property(contacts_h contact, contacts_person
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
                if (ret == CONTACTS_ERROR_NONE && id) {
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, id)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
index 1fce48e..6cab85b 100644 (file)
@@ -23,7 +23,7 @@
 #include "contacts_types.h"
 
 int ctsvc_client_person_link_person(contacts_h contact, int base_person_id, int person_id);
-int ctsvc_client_person_unlink_contact(contacts_h contact, int person_id, int contact_id, intunlinked_person_id);
+int ctsvc_client_person_unlink_contact(contacts_h contact, int person_id, int contact_id, int *unlinked_person_id);
 int ctsvc_client_person_reset_usage(contacts_h contact, int person_id, contacts_usage_type_e type);
 int ctsvc_client_person_set_favorite_order(contacts_h contact, int person_id, int previous_person_id, int next_person_id);
 int ctsvc_client_person_set_default_property(contacts_h contact, contacts_person_property_e property, int person_id, int id);
index 931067e..3991fbf 100644 (file)
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_client_handle.h"
index 5f94a97..28153c4 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include <pims-ipc-data.h>
 
 #include "contacts.h"
 #include "ctsvc_ipc_marshal.h"
 
 
-static const char CONTACTS_READ_PRIVILEGE_ID[] =  "http://tizen.org/privilege/contact.read";
-static const char CONTACTS_WRITE_PRIVILEGE_ID[] =  "http://tizen.org/privilege/contact.write";
-static const char PHONELOG_READ_PRIVILEGE_ID[] =  "http://tizen.org/privilege/callhistory.read";
-static const char PHONELOG_WRITE_PRIVILEGE_ID[] =  "http://tizen.org/privilege/callhistory.write";
+static const char CONTACTS_READ_PRIVILEGE_ID[] = "http://tizen.org/privilege/contact.read";
+static const char CONTACTS_WRITE_PRIVILEGE_ID[] = "http://tizen.org/privilege/contact.write";
+static const char PHONELOG_READ_PRIVILEGE_ID[] = "http://tizen.org/privilege/callhistory.read";
+static const char PHONELOG_WRITE_PRIVILEGE_ID[] = "http://tizen.org/privilege/callhistory.write";
 
 int ctsvc_client_phone_log_reset_statistics(contacts_h contact)
 {
@@ -43,26 +42,27 @@ int ctsvc_client_phone_log_reset_statistics(contacts_h contact)
        pims_ipc_data_h indata = NULL;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
 
        /* make indata */
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        /* ipc call */
-       if (ctsvc_ipc_call(CTSVC_IPC_PHONELOG_MODULE, CTSVC_IPC_SERVER_PHONELOG_RESET_STATISTICS, indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+       if (ctsvc_ipc_call(CTSVC_IPC_PHONELOG_MODULE, CTSVC_IPC_SERVER_PHONELOG_RESET_STATISTICS,
+                               indata, &outdata) != 0) {
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -71,7 +71,7 @@ int ctsvc_client_phone_log_reset_statistics(contacts_h contact)
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
@@ -79,7 +79,7 @@ int ctsvc_client_phone_log_reset_statistics(contacts_h contact)
                if (CONTACTS_ERROR_NONE == ret) {
                        int transaction_ver = 0;
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -93,7 +93,8 @@ int ctsvc_client_phone_log_reset_statistics(contacts_h contact)
 
 }
 
-int ctsvc_client_phone_log_delete(contacts_h contact, contacts_phone_log_delete_e op, va_list args)
+int ctsvc_client_phone_log_delete(contacts_h contact, contacts_phone_log_delete_e op,
+               va_list args)
 {
 #ifndef ENABLE_LOG_FEATURE
        return CONTACTS_ERROR_NOT_SUPPORTED;
@@ -106,11 +107,11 @@ int ctsvc_client_phone_log_delete(contacts_h contact, contacts_phone_log_delete_
        char *number = NULL;
        int extra_data1;
 
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
 
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                pims_ipc_data_destroy(indata);
                return ret;
@@ -118,19 +119,19 @@ int ctsvc_client_phone_log_delete(contacts_h contact, contacts_phone_log_delete_
 
        ret = ctsvc_ipc_marshal_handle(contact, indata);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
+               ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_int(op, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_ipc_marshal_int fail");
+               ERR("ctsvc_ipc_marshal_int fail");
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
-       switch(op) {
+       switch (op) {
        case CONTACTS_PHONE_LOG_DELETE_BY_ADDRESS:
                number = va_arg(args, char *);
                if (NULL == number) {
@@ -139,7 +140,7 @@ int ctsvc_client_phone_log_delete(contacts_h contact, contacts_phone_log_delete_
                }
                ret = ctsvc_ipc_marshal_string(number, indata);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_marshal_string fail");
+                       ERR("ctsvc_ipc_marshal_string fail");
                        pims_ipc_data_destroy(indata);
                        return ret;
                }
@@ -149,20 +150,20 @@ int ctsvc_client_phone_log_delete(contacts_h contact, contacts_phone_log_delete_
                extra_data1 = va_arg(args, int);
                ret = ctsvc_ipc_marshal_int(extra_data1, indata);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_marshal_int fail");
+                       ERR("ctsvc_ipc_marshal_int fail");
                        pims_ipc_data_destroy(indata);
                        return ret;
                }
                break;
        default:
-               CTS_ERR("Invalid parameter : operation is not proper (%d)", ret);
+               ERR("operation is not proper (%d)", ret);
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
        if (ctsvc_ipc_call(CTSVC_IPC_PHONELOG_MODULE,
-                       CTSVC_IPC_SERVER_PHONELOG_DELETE, indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call failed");
+                               CTSVC_IPC_SERVER_PHONELOG_DELETE, indata, &outdata) != 0) {
+               ERR("ctsvc_ipc_call() Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -171,14 +172,14 @@ int ctsvc_client_phone_log_delete(contacts_h contact, contacts_phone_log_delete_
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
                if (CONTACTS_ERROR_NONE == ret) {
                        int transaction_ver = 0;
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
index b4440f7..ab2ad21 100644 (file)
@@ -3,9 +3,6 @@
  *
  * Copyright (c) 2010 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
  *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -37,16 +34,14 @@ API int contacts_connect_with_flags(unsigned int flags)
        ret = ctsvc_client_handle_get_p_with_id(id, &contact);
        if (CONTACTS_ERROR_NO_DATA == ret) {
                ret = ctsvc_client_handle_create(id, &contact);
-               if (CONTACTS_ERROR_NONE != ret)
-               {
-                       CTS_ERR("ctsvc_client_handle_create() Fail(%d)", ret);
+               if (CONTACTS_ERROR_NONE != ret) {
+                       ERR("ctsvc_client_handle_create() Fail(%d)", ret);
                        if (CONTACTS_ERROR_INVALID_PARAMETER == ret)
                                return CONTACTS_ERROR_INTERNAL;
                        return ret;
                }
-       }
-       else if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_client_handle_get_p_with_id() Fail(%d)", ret);
+       } else if (CONTACTS_ERROR_NONE != ret) {
+               ERR("ctsvc_client_handle_get_p_with_id() Fail(%d)", ret);
                return ret;
        }
 
@@ -68,16 +63,14 @@ API int contacts_connect(void)
        ret = ctsvc_client_handle_get_p_with_id(id, &contact);
        if (CONTACTS_ERROR_NO_DATA == ret) {
                ret = ctsvc_client_handle_create(id, &contact);
-               if (CONTACTS_ERROR_NONE != ret)
-               {
-                       CTS_ERR("ctsvc_client_handle_create() Fail(%d)", ret);
+               if (CONTACTS_ERROR_NONE != ret) {
+                       ERR("ctsvc_client_handle_create() Fail(%d)", ret);
                        if (CONTACTS_ERROR_INVALID_PARAMETER == ret)
                                return CONTACTS_ERROR_INTERNAL;
                        return ret;
                }
-       }
-       else if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_client_handle_get_p_with_id() Fail(%d)", ret);
+       } else if (CONTACTS_ERROR_NONE != ret) {
+               ERR("ctsvc_client_handle_get_p_with_id() Fail(%d)", ret);
                return ret;
        }
        ret = ctsvc_client_connect(contact);
@@ -117,16 +110,14 @@ API int contacts_connect_on_thread(void)
        ret = ctsvc_client_handle_get_p_with_id(id, &contact);
        if (CONTACTS_ERROR_NO_DATA == ret) {
                ret = ctsvc_client_handle_create(id, &contact);
-               if (CONTACTS_ERROR_NONE != ret)
-               {
-                       CTS_ERR("ctsvc_client_handle_create() Fail(%d)", ret);
+               if (CONTACTS_ERROR_NONE != ret) {
+                       ERR("ctsvc_client_handle_create() Fail(%d)", ret);
                        if (CONTACTS_ERROR_INVALID_PARAMETER == ret)
                                return CONTACTS_ERROR_INTERNAL;
                        return ret;
                }
-       }
-       else if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_client_handle_get_p_with_id() Fail(%d)", ret);
+       } else if (CONTACTS_ERROR_NONE != ret) {
+               ERR("ctsvc_client_handle_get_p_with_id() Fail(%d)", ret);
                return ret;
        }
 
index e51d8e0..b42a801 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
@@ -60,9 +56,9 @@ int ctsvc_client_connect_with_flags(contacts_h contact, unsigned int flags)
        if (flags & CONTACTS_CONNECT_FLAG_RETRY) {
                int i;
                int waiting_time = 500;
-               for (i=0;i<9;i++) {
+               for (i = 0; i < 9; i++) {
                        usleep(waiting_time * 1000);
-                       CTS_DBG("retry cnt=%d, ret=%x, %d",(i+1), ret, waiting_time);
+                       DBG("retry cnt=%d, ret=%x, %d", (i+1), ret, waiting_time);
                        ret = ctsvc_client_connect(contact);
                        if (ret == CONTACTS_ERROR_NONE)
                                break;
@@ -90,14 +86,14 @@ int ctsvc_client_connect(contacts_h contact)
 {
        CTS_FN_CALL;
        int ret;
-       ctsvc_base_s *base = (ctsvc_base_s *)contact;
+       ctsvc_base_s *base = (ctsvc_base_s*)contact;
        RETV_IF(NULL == base, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       ctsvc_mutex_lock(CTS_MUTEX_CONNECTION);
+       ctsvc_mutex_lock(CTS_MUTEX_CONNECTION);
        if (0 == base->connection_count) {
                ret = ctsvc_ipc_connect(contact, ctsvc_client_get_pid());
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_connect() Fail(%d)", ret);
+                       ERR("ctsvc_ipc_connect() Fail(%d)", ret);
                        ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION);
                        return ret;
                }
@@ -107,22 +103,22 @@ int ctsvc_client_connect(contacts_h contact)
        if (0 == _ctsvc_connection) {
                ret = ctsvc_socket_init();
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_socket_init() Fail(%d)", ret);
+                       ERR("ctsvc_socket_init() Fail(%d)", ret);
                        ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION);
                        return ret;
                }
 
                ret = ctsvc_inotify_init();
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_inotify_init() Fail(%d)", ret);
+                       ERR("ctsvc_inotify_init() Fail(%d)", ret);
                        ctsvc_socket_final();
                        ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION);
                        return ret;
                }
                ctsvc_view_uri_init();
+       } else {
+               DBG("Contacts service has been already connected(%d)", _ctsvc_connection + 1);
        }
-       else
-               CTS_DBG("System : Contacts service has been already connected(%d)", _ctsvc_connection + 1);
 
        if (1 == base->connection_count)
                ctsvc_inotify_subscribe_ipc_ready(contact, _ctsvc_ipc_initialized_cb, NULL);
@@ -137,7 +133,7 @@ int ctsvc_client_disconnect(contacts_h contact)
 {
        CTS_FN_CALL;
        int ret;
-       ctsvc_base_s *base = (ctsvc_base_s *)contact;
+       ctsvc_base_s *base = (ctsvc_base_s*)contact;
        RETV_IF(NULL == base, CONTACTS_ERROR_INVALID_PARAMETER);
 
        ctsvc_mutex_lock(CTS_MUTEX_CONNECTION);
@@ -146,7 +142,7 @@ int ctsvc_client_disconnect(contacts_h contact)
                ret = ctsvc_ipc_disconnect(contact, ctsvc_client_get_pid(), _ctsvc_connection);
                if (ret != CONTACTS_ERROR_NONE) {
                        ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION);
-                       CTS_ERR("ctsvc_ipc_disconnect() Fail(%d)", ret);
+                       ERR("ctsvc_ipc_disconnect() Fail(%d)", ret);
                        return ret;
                }
                ctsvc_inotify_unsubscribe_ipc_ready(contact);
@@ -159,11 +155,10 @@ int ctsvc_client_disconnect(contacts_h contact)
                ctsvc_inotify_close();
                ctsvc_socket_final();
 
-       }
-       else if (1 < _ctsvc_connection)
-               CTS_DBG("System : connection count is %d", _ctsvc_connection);
-       else {
-               CTS_DBG("System : please call contacts_connect(), connection count is (%d)", _ctsvc_connection);
+       } else if (1 < _ctsvc_connection) {
+               DBG("connection count is %d", _ctsvc_connection);
+       } else {
+               DBG("call contacts_connect(), connection count is %d", _ctsvc_connection);
                ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION);
                return CONTACTS_ERROR_DB;
        }
@@ -171,7 +166,7 @@ int ctsvc_client_disconnect(contacts_h contact)
        _ctsvc_connection--;
 
        if (0 == base->connection_count) {
-               CTS_INFO("connection_count is 0. remove handle");
+               INFO("connection_count is 0. remove handle");
                ret = ctsvc_client_handle_remove(ctsvc_client_get_pid(), contact);
                WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_client_handle_remove() Fail(%d)", ret);
        }
@@ -183,7 +178,7 @@ int ctsvc_client_disconnect(contacts_h contact)
 int ctsvc_client_connect_on_thread(contacts_h contact)
 {
        int ret;
-       ctsvc_base_s *base = (ctsvc_base_s *)contact;
+       ctsvc_base_s *base = (ctsvc_base_s*)contact;
        RETV_IF(NULL == base, CONTACTS_ERROR_INVALID_PARAMETER);
 
        ctsvc_mutex_lock(CTS_MUTEX_CONNECTION);
@@ -191,7 +186,7 @@ int ctsvc_client_connect_on_thread(contacts_h contact)
        if (0 == base->connection_count) {
                ret = ctsvc_ipc_connect(contact, ctsvc_client_get_tid());
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_connect() Fail(%d)", ret);
+                       ERR("ctsvc_ipc_connect() Fail(%d)", ret);
                        ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION);
                        return ret;
                }
@@ -201,22 +196,22 @@ int ctsvc_client_connect_on_thread(contacts_h contact)
        if (0 == _ctsvc_connection_on_thread) {
                ret = ctsvc_socket_init();
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_socket_init() Fail(%d)", ret);
+                       ERR("ctsvc_socket_init() Fail(%d)", ret);
                        ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION);
                        return ret;
                }
 
                ret = ctsvc_inotify_init();
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_inotify_init() Fail(%d)", ret);
+                       ERR("ctsvc_inotify_init() Fail(%d)", ret);
                        ctsvc_socket_final();
                        ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION);
                        return ret;
                }
                ctsvc_view_uri_init();
+       } else if (0 < _ctsvc_connection_on_thread) {
+               DBG("System : Contacts service has been already connected");
        }
-       else if (0 < _ctsvc_connection_on_thread)
-               CTS_DBG("System : Contacts service has been already connected");
 
        if (1 == base->connection_count)
                ctsvc_inotify_subscribe_ipc_ready(contact, _ctsvc_ipc_initialized_cb, NULL);
@@ -231,15 +226,16 @@ int ctsvc_client_connect_on_thread(contacts_h contact)
 int ctsvc_client_disconnect_on_thread(contacts_h contact)
 {
        int ret;
-       ctsvc_base_s *base = (ctsvc_base_s *)contact;
+       ctsvc_base_s *base = (ctsvc_base_s*)contact;
        RETV_IF(NULL == base, CONTACTS_ERROR_INVALID_PARAMETER);
 
        ctsvc_mutex_lock(CTS_MUTEX_CONNECTION);
 
        if (1 == base->connection_count) {
-               ret = ctsvc_ipc_disconnect(contact, ctsvc_client_get_tid(), _ctsvc_connection_on_thread);
+               ret = ctsvc_ipc_disconnect(contact, ctsvc_client_get_tid(),
+                               _ctsvc_connection_on_thread);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_disconnect() Fail(%d)", ret);
+                       ERR("ctsvc_ipc_disconnect() Fail(%d)", ret);
                        ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION);
                        return ret;
                }
@@ -253,13 +249,12 @@ int ctsvc_client_disconnect_on_thread(contacts_h contact)
                ctsvc_view_uri_deinit();
                ctsvc_inotify_close();
                ctsvc_socket_final();
-               CTS_DBG("System : connection_on_thread was destroyed successfully");
-       }
-       else if (1 < _ctsvc_connection_on_thread) {
-               CTS_DBG("System : connection count is %d", _ctsvc_connection_on_thread);
-       }
-       else {
-               CTS_DBG("System : please call contacts_connect_on_thread(), connection count is (%d)", _ctsvc_connection_on_thread);
+               DBG("System : connection_on_thread was destroyed successfully");
+       } else if (1 < _ctsvc_connection_on_thread) {
+               DBG("connection count is %d", _ctsvc_connection_on_thread);
+       } else {
+               DBG("call contacts_connect_on_thread(), connection count is %d",
+                               _ctsvc_connection_on_thread);
                ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION);
                return CONTACTS_ERROR_DB;
        }
@@ -267,7 +262,7 @@ int ctsvc_client_disconnect_on_thread(contacts_h contact)
        _ctsvc_connection_on_thread--;
 
        if (0 == base->connection_count) {
-               CTS_INFO("connection_count is 0. remove handle");
+               INFO("connection_count is 0. remove handle");
                ret = ctsvc_client_handle_remove(ctsvc_client_get_tid(), contact);
                WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_client_handle_remove() Fail(%d)", ret);
        }
index d0d0bf2..af048de 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
index 13b1c02..e2d5540 100644 (file)
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include <glib.h>
 #include <pims-ipc-data.h>
 
 #include "ctsvc_client_ipc.h"
 #include "ctsvc_mutex.h"
 
-typedef struct
-{
+typedef struct {
        contacts_setting_name_display_order_changed_cb cb;
        void *user_data;
-}ctsvc_name_display_order_changed_cb_info_s;
+} ctsvc_name_display_order_changed_cb_info_s;
 
-typedef struct
-{
+typedef struct {
        contacts_setting_name_sorting_order_changed_cb cb;
        void *user_data;
-}ctsvc_name_sorting_order_changed_cb_info_s;
+} ctsvc_name_sorting_order_changed_cb_info_s;
 
 static GSList *__setting_name_display_order_subscribe_list = NULL;
 static GSList *__setting_name_sorting_order_subscribe_list = NULL;
 
-API int contacts_setting_get_name_display_order(contacts_name_display_order_e *name_display_order)
+API int contacts_setting_get_name_display_order(
+               contacts_name_display_order_e *name_display_order)
 {
        int ret = CONTACTS_ERROR_NONE;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(name_display_order == NULL, CONTACTS_ERROR_INVALID_PARAMETER,"The out param is NULL");
+       RETV_IF(name_display_order == NULL, CONTACTS_ERROR_INVALID_PARAMETER);
        *name_display_order = 0;
 
-       if (ctsvc_ipc_call(CTSVC_IPC_SETTING_MODULE, CTSVC_IPC_SERVER_SETTING_GET_NAME_DISPLAY_ORDER, NULL, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call Fail");
+       if (ctsvc_ipc_call(CTSVC_IPC_SETTING_MODULE, CTSVC_IPC_SERVER_SETTING_GET_NAME_DISPLAY_ORDER,
+                               NULL, &outdata) != 0) {
+               ERR("ctsvc_ipc_call Fail");
                return CONTACTS_ERROR_IPC;
        }
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
 
                if (CONTACTS_ERROR_NONE == ret) {
-                       if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, (int *)name_display_order)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, (int*)name_display_order)) {
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -76,28 +75,30 @@ API int contacts_setting_get_name_display_order(contacts_name_display_order_e *n
        return ret;
 }
 
-API int contacts_setting_get_name_sorting_order(contacts_name_sorting_order_e *name_sorting_order)
+API int contacts_setting_get_name_sorting_order(
+               contacts_name_sorting_order_e *name_sorting_order)
 {
        int ret = CONTACTS_ERROR_NONE;
        pims_ipc_data_h outdata = NULL;
 
-       RETVM_IF(name_sorting_order == NULL, CONTACTS_ERROR_INVALID_PARAMETER, "The out param is NULL");
+       RETV_IF(name_sorting_order == NULL, CONTACTS_ERROR_INVALID_PARAMETER);
        *name_sorting_order = 0;
 
-       if (ctsvc_ipc_call(CTSVC_IPC_SETTING_MODULE, CTSVC_IPC_SERVER_SETTING_GET_NAME_SORTING_ORDER, NULL, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call Fail");
+       if (ctsvc_ipc_call(CTSVC_IPC_SETTING_MODULE, CTSVC_IPC_SERVER_SETTING_GET_NAME_SORTING_ORDER,
+                               NULL, &outdata) != 0) {
+               ERR("ctsvc_ipc_call Fail");
                return CONTACTS_ERROR_IPC;
        }
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
                if (CONTACTS_ERROR_NONE == ret) {
-                       if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, (int *)name_sorting_order)) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, (int*)name_sorting_order)) {
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                pims_ipc_data_destroy(outdata);
                                return CONTACTS_ERROR_IPC;
                        }
@@ -108,7 +109,8 @@ API int contacts_setting_get_name_sorting_order(contacts_name_sorting_order_e *n
        return ret;
 }
 
-API int contacts_setting_set_name_display_order(contacts_name_display_order_e name_display_order)
+API int contacts_setting_set_name_display_order(
+               contacts_name_display_order_e name_display_order)
 {
        int ret = CONTACTS_ERROR_NONE;
        pims_ipc_data_h indata = NULL;
@@ -116,24 +118,26 @@ API int contacts_setting_set_name_display_order(contacts_name_display_order_e na
 
        RETVM_IF(name_display_order != CONTACTS_NAME_DISPLAY_ORDER_FIRSTLAST
                        && name_display_order != CONTACTS_NAME_DISPLAY_ORDER_LASTFIRST,
-                       CONTACTS_ERROR_INVALID_PARAMETER, "name display order is invalid : %d", name_display_order);
+                       CONTACTS_ERROR_INVALID_PARAMETER,
+                       "name display order is invalid : %d", name_display_order);
 
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_int(name_display_order, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
-       if (ctsvc_ipc_call(CTSVC_IPC_SETTING_MODULE, CTSVC_IPC_SERVER_SETTING_SET_NAME_DISPLAY_ORDER, indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call Fail");
+       if (ctsvc_ipc_call(CTSVC_IPC_SETTING_MODULE, CTSVC_IPC_SERVER_SETTING_SET_NAME_DISPLAY_ORDER,
+                               indata, &outdata) != 0) {
+               ERR("ctsvc_ipc_call Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -141,7 +145,7 @@ API int contacts_setting_set_name_display_order(contacts_name_display_order_e na
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
@@ -151,7 +155,8 @@ API int contacts_setting_set_name_display_order(contacts_name_display_order_e na
        return ret;
 }
 
-API int contacts_setting_set_name_sorting_order(contacts_name_sorting_order_e name_sorint_order)
+API int contacts_setting_set_name_sorting_order(
+               contacts_name_sorting_order_e name_sorint_order)
 {
        int ret = CONTACTS_ERROR_NONE;
        pims_ipc_data_h indata = NULL;
@@ -159,24 +164,26 @@ API int contacts_setting_set_name_sorting_order(contacts_name_sorting_order_e na
 
        RETVM_IF(name_sorint_order != CONTACTS_NAME_SORTING_ORDER_FIRSTLAST
                        && name_sorint_order != CONTACTS_NAME_SORTING_ORDER_LASTFIRST,
-                       CONTACTS_ERROR_INVALID_PARAMETER, "name sorting order is invalid : %d", name_sorint_order);
+                       CONTACTS_ERROR_INVALID_PARAMETER,
+                       "name sorting order is invalid : %d", name_sorint_order);
 
        indata = pims_ipc_data_create(0);
        if (indata == NULL) {
-               CTS_ERR("ipc data created fail!");
+               ERR("pims_ipc_data_create() Fail");
                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                return ret;
        }
 
        ret = ctsvc_ipc_marshal_int(name_sorint_order, indata);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("marshal fail");
+               ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret);
                pims_ipc_data_destroy(indata);
                return ret;
        }
 
-       if (ctsvc_ipc_call(CTSVC_IPC_SETTING_MODULE, CTSVC_IPC_SERVER_SETTING_SET_NAME_SORTING_ORDER, indata, &outdata) != 0) {
-               CTS_ERR("ctsvc_ipc_call Fail");
+       if (ctsvc_ipc_call(CTSVC_IPC_SETTING_MODULE, CTSVC_IPC_SERVER_SETTING_SET_NAME_SORTING_ORDER,
+                               indata, &outdata) != 0) {
+               ERR("ctsvc_ipc_call Fail");
                pims_ipc_data_destroy(indata);
                return CONTACTS_ERROR_IPC;
        }
@@ -184,7 +191,7 @@ API int contacts_setting_set_name_sorting_order(contacts_name_sorting_order_e na
 
        if (outdata) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        pims_ipc_data_destroy(outdata);
                        return CONTACTS_ERROR_IPC;
                }
@@ -194,7 +201,8 @@ API int contacts_setting_set_name_sorting_order(contacts_name_sorting_order_e na
        return ret;
 }
 
-static void __ctsvc_setting_name_display_order_subscriber_callback(pims_ipc_h ipc, pims_ipc_data_h data, void *user_data)
+static void _csetting_name_display_order_subscribe_cb(pims_ipc_h ipc,
+               pims_ipc_data_h data, void *user_data)
 {
        int ret;
        int value = -1;
@@ -205,7 +213,7 @@ static void __ctsvc_setting_name_display_order_subscriber_callback(pims_ipc_h ip
        }
        if (__setting_name_display_order_subscribe_list) {
                GSList *l;
-               for (l = __setting_name_display_order_subscribe_list;l;l=l->next) {
+               for (l = __setting_name_display_order_subscribe_list; l; l = l->next) {
                        ctsvc_name_display_order_changed_cb_info_s *cb_info = l->data;
                        if (cb_info->cb)
                                cb_info->cb((contacts_name_display_order_e)value, cb_info->user_data);
@@ -213,7 +221,8 @@ static void __ctsvc_setting_name_display_order_subscriber_callback(pims_ipc_h ip
        }
 }
 
-static void __ctsvc_setting_name_sorting_order_subscriber_callback(pims_ipc_h ipc, pims_ipc_data_h data, void *user_data)
+static void _csetting_name_sorting_order_subscribe_cb(pims_ipc_h ipc,
+               pims_ipc_data_h data, void *user_data)
 {
        int ret;
        int value = -1;
@@ -225,7 +234,7 @@ static void __ctsvc_setting_name_sorting_order_subscriber_callback(pims_ipc_h ip
 
        if (__setting_name_sorting_order_subscribe_list) {
                GSList *l;
-               for (l = __setting_name_sorting_order_subscribe_list;l;l=l->next) {
+               for (l = __setting_name_sorting_order_subscribe_list; l; l = l->next) {
                        ctsvc_name_sorting_order_changed_cb_info_s *cb_info = l->data;
                        if (cb_info->cb)
                                cb_info->cb((contacts_name_sorting_order_e)value, cb_info->user_data);
@@ -237,26 +246,26 @@ int ctsvc_setting_recover_for_change_subscription()
 {
        GSList *it;
 
-       for (it = __setting_name_display_order_subscribe_list; it; it=it->next) {
+       for (it = __setting_name_display_order_subscribe_list; it; it = it->next) {
                ctsvc_name_display_order_changed_cb_info_s *cb_info = it->data;
                if (cb_info->cb) {
                        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) {
-                               CTS_ERR("pims_ipc_subscribe() Fail");
+                                               _csetting_name_display_order_subscribe_cb, NULL) != 0) {
+                               ERR("pims_ipc_subscribe() Fail");
                                return CONTACTS_ERROR_IPC;
                        }
                        break;
                }
        }
 
-       for (it = __setting_name_sorting_order_subscribe_list; it; it=it->next) {
+       for (it = __setting_name_sorting_order_subscribe_list; it; it = it->next) {
                ctsvc_name_sorting_order_changed_cb_info_s *cb_info = it->data;
                if (cb_info->cb) {
                        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) {
-                               CTS_ERR("pims_ipc_subscribe() Fail");
+                                               _csetting_name_sorting_order_subscribe_cb, NULL) != 0) {
+                               ERR("pims_ipc_subscribe() Fail");
                                return CONTACTS_ERROR_IPC;
                        }
                        break;
@@ -267,22 +276,22 @@ int ctsvc_setting_recover_for_change_subscription()
 }
 
 API int contacts_setting_add_name_display_order_changed_cb(
-       contacts_setting_name_display_order_changed_cb cb, void* user_data)
+               contacts_setting_name_display_order_changed_cb cb, void *user_data)
 {
        GSList *l;
        int ret;
        bool result = false;
        ctsvc_name_display_order_changed_cb_info_s *cb_info;
 
-       RETVM_IF(cb == NULL, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : callback is NULL");
+       RETV_IF(cb == NULL, CONTACTS_ERROR_INVALID_PARAMETER);
 
        ret = ctsvc_ipc_client_check_permission(CTSVC_PERMISSION_CONTACT_READ, &result);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_ipc_client_check_permission fail (%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_ipc_client_check_permission() Fail(%d)", ret);
        RETVM_IF(result == false, CONTACTS_ERROR_PERMISSION_DENIED, "Permission denied (contact read)");
 
        ret = ctsvc_ipc_create_for_change_subscription();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_create_for_change_subscription() Fail(%d)", ret);
+               ERR("ctsvc_ipc_create_for_change_subscription() Fail(%d)", ret);
                return ret;
        }
 
@@ -291,17 +300,17 @@ API int contacts_setting_add_name_display_order_changed_cb(
        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) {
-                       CTS_ERR("pims_ipc_subscribe() Fail");
+                                       _csetting_name_display_order_subscribe_cb, NULL) != 0) {
+                       ERR("pims_ipc_subscribe() Fail");
                        ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB);
                        return CONTACTS_ERROR_IPC;
                }
        }
 
-       for (l = __setting_name_display_order_subscribe_list;l;l=l->next) {
+       for (l = __setting_name_display_order_subscribe_list; l; l = l->next) {
                ctsvc_name_display_order_changed_cb_info_s *cb_info = l->data;
                if (cb_info->cb == cb && cb_info->user_data == user_data) {
-                       CTS_ERR("The same callback(%x) is already exist", cb);
+                       ERR("The same callback(%x) is already exist", cb);
                        ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB);
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
@@ -309,7 +318,7 @@ API int contacts_setting_add_name_display_order_changed_cb(
 
        cb_info = calloc(1, sizeof(ctsvc_name_display_order_changed_cb_info_s));
        if (NULL == cb_info) {
-               CTS_ERR("calloc() Failed");
+               ERR("calloc() Fail");
                ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB);
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
@@ -322,14 +331,15 @@ API int contacts_setting_add_name_display_order_changed_cb(
 }
 
 API int contacts_setting_remove_name_display_order_changed_cb(
-       contacts_setting_name_display_order_changed_cb cb, void* user_data)
+               contacts_setting_name_display_order_changed_cb cb, void *user_data)
 {
        int ret;
-       RETVM_IF(cb == NULL, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : callback is NULL");
+
+       RETV_IF(cb == NULL, CONTACTS_ERROR_INVALID_PARAMETER);
 
        ret = ctsvc_ipc_destroy_for_change_subscription(false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_destroy_for_change_subscription() Fail(%d)", ret);
+               ERR("ctsvc_ipc_destroy_for_change_subscription() Fail(%d)", ret);
                return ret;
        }
 
@@ -337,7 +347,7 @@ API int contacts_setting_remove_name_display_order_changed_cb(
 
        if (__setting_name_display_order_subscribe_list) {
                GSList *l;
-               for (l = __setting_name_display_order_subscribe_list;l;l=l->next) {
+               for (l = __setting_name_display_order_subscribe_list; l; l = l->next) {
                        ctsvc_name_display_order_changed_cb_info_s *cb_info = l->data;
                        if (cb == cb_info->cb && user_data == cb_info->user_data) {
                                __setting_name_display_order_subscribe_list = g_slist_remove(__setting_name_display_order_subscribe_list, cb_info);
@@ -358,22 +368,22 @@ API int contacts_setting_remove_name_display_order_changed_cb(
 }
 
 API int contacts_setting_add_name_sorting_order_changed_cb(
-       contacts_setting_name_sorting_order_changed_cb cb, void* user_data)
+               contacts_setting_name_sorting_order_changed_cb cb, void *user_data)
 {
        GSList *l;
        int ret;
        bool result = false;
        ctsvc_name_sorting_order_changed_cb_info_s *cb_info;
 
-       RETVM_IF(cb == NULL, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : callback is NULL");
+       RETV_IF(cb == NULL, CONTACTS_ERROR_INVALID_PARAMETER);
 
        ret = ctsvc_ipc_client_check_permission(CTSVC_PERMISSION_CONTACT_READ, &result);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_ipc_client_check_permission fail (%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_ipc_client_check_permission Fail(%d)", ret);
        RETVM_IF(result == false, CONTACTS_ERROR_PERMISSION_DENIED, "Permission denied (contact read)");
 
        ret = ctsvc_ipc_create_for_change_subscription();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_create_for_change_subscription() Fail(%d)", ret);
+               ERR("ctsvc_ipc_create_for_change_subscription() Fail(%d)", ret);
                return ret;
        }
 
@@ -382,17 +392,17 @@ API int contacts_setting_add_name_sorting_order_changed_cb(
        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) {
-                       CTS_ERR("pims_ipc_subscribe() Fail");
+                                       _csetting_name_sorting_order_subscribe_cb, NULL) != 0) {
+                       ERR("pims_ipc_subscribe() Fail");
                        ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB);
                        return CONTACTS_ERROR_IPC;
                }
        }
 
-       for (l = __setting_name_sorting_order_subscribe_list;l;l=l->next) {
+       for (l = __setting_name_sorting_order_subscribe_list; l; l = l->next) {
                ctsvc_name_sorting_order_changed_cb_info_s *cb_info = l->data;
                if (cb_info->cb == cb && cb_info->user_data == user_data) {
-                       CTS_ERR("The same callback(%x) is already exist", cb);
+                       ERR("The same callback(%x) is already exist", cb);
                        ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB);
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
@@ -400,7 +410,7 @@ API int contacts_setting_add_name_sorting_order_changed_cb(
 
        cb_info = calloc(1, sizeof(ctsvc_name_sorting_order_changed_cb_info_s));
        if (NULL == cb_info) {
-               CTS_ERR("calloc() Failed");
+               ERR("calloc() Fail");
                ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB);
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
@@ -413,14 +423,14 @@ API int contacts_setting_add_name_sorting_order_changed_cb(
 }
 
 API int contacts_setting_remove_name_sorting_order_changed_cb(
-       contacts_setting_name_sorting_order_changed_cb cb, void* user_data)
+               contacts_setting_name_sorting_order_changed_cb cb, void *user_data)
 {
        int ret;
-       RETVM_IF(cb == NULL, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : callback is NULL");
+       RETV_IF(cb == NULL, CONTACTS_ERROR_INVALID_PARAMETER);
 
        ret = ctsvc_ipc_destroy_for_change_subscription(false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_ipc_destroy_for_change_subscription() Fail(%d)", ret);
+               ERR("ctsvc_ipc_destroy_for_change_subscription() Fail(%d)", ret);
                return ret;
        }
 
@@ -428,7 +438,7 @@ API int contacts_setting_remove_name_sorting_order_changed_cb(
 
        if (__setting_name_sorting_order_subscribe_list) {
                GSList *l;
-               for (l = __setting_name_sorting_order_subscribe_list;l;l=l->next) {
+               for (l = __setting_name_sorting_order_subscribe_list; l; l = l->next) {
                        ctsvc_name_sorting_order_changed_cb_info_s *cb_info = l->data;
                        if (cb == cb_info->cb && user_data == cb_info->user_data) {
                                __setting_name_sorting_order_subscribe_list = g_slist_remove(__setting_name_sorting_order_subscribe_list, cb_info);
index b7cf6c6..326f2a2 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
  * limitations under the License.
  *
  */
-
 #include <glib.h>
 
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_filter.h"
 
-static inline bool __ctsvc_filters_property_check(const property_info_s *properties,
+static inline bool _filter_property_check(const property_info_s *properties,
                int count, unsigned int property_id, int *type)
 {
        int i;
-       for (i=0;i<count;i++) {
+       for (i = 0; i < count; i++) {
                property_info_s *p = (property_info_s*)&(properties[i]);
                if (property_id == p->property_id) {
-                       if (p->property_type == CTSVC_SEARCH_PROPERTY_ALL || p->property_type == CTSVC_SEARCH_PROPERTY_FILTER) {
+                       if (p->property_type == CTSVC_SEARCH_PROPERTY_ALL
+                                       || p->property_type == CTSVC_SEARCH_PROPERTY_FILTER) {
                                *type = (property_id & CTSVC_VIEW_DATA_TYPE_MASK);
                                return true;
-                       }
-                       else
+                       } else {
                                return false;
+                       }
                }
        }
        return false;
 }
 
-API int contacts_filter_create(const char* view_uri, contacts_filter_h* out_filter)
+API int contacts_filter_create(const char *view_uri, contacts_filter_h *out_filter)
 {
        ctsvc_composite_filter_s *com_filter;
 
@@ -53,27 +49,31 @@ API int contacts_filter_create(const char* view_uri, contacts_filter_h* out_filt
        *out_filter = NULL;
 
        RETV_IF(NULL == view_uri, CONTACTS_ERROR_INVALID_PARAMETER);
-       com_filter = (ctsvc_composite_filter_s *)calloc(1, sizeof(ctsvc_composite_filter_s));
+
+       com_filter = calloc(1, sizeof(ctsvc_composite_filter_s));
        RETV_IF(NULL == com_filter, CONTACTS_ERROR_OUT_OF_MEMORY);
 
        com_filter->filter_type = CTSVC_FILTER_COMPOSITE;
        com_filter->view_uri = strdup(view_uri);
-       com_filter->properties = (property_info_s *)ctsvc_view_get_all_property_infos(view_uri, &com_filter->property_count);
+       com_filter->properties = (property_info_s*)ctsvc_view_get_all_property_infos(view_uri,
+                       &com_filter->property_count);
        *out_filter = (contacts_filter_h)com_filter;
        return CONTACTS_ERROR_NONE;
 }
 
-API int contacts_filter_add_operator(contacts_filter_h filter, contacts_filter_operator_e op)
+API int contacts_filter_add_operator(contacts_filter_h filter,
+               contacts_filter_operator_e op)
 {
        ctsvc_composite_filter_s *com_filter;
 
        RETV_IF(NULL == filter, CONTACTS_ERROR_INVALID_PARAMETER);
 
        com_filter = (ctsvc_composite_filter_s*)filter;
-
        RETVM_IF(g_slist_length(com_filter->filter_ops) != (g_slist_length(com_filter->filters)-1),
-                               CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : Please check the operator of filter");
+                       CONTACTS_ERROR_INVALID_PARAMETER, "Please check the operator of filter");
+
        com_filter->filter_ops = g_slist_append(com_filter->filter_ops, (void*)op);
+
        return CONTACTS_ERROR_NONE;
 }
 
@@ -85,62 +85,68 @@ API int contacts_filter_add_filter(contacts_filter_h filter1, contacts_filter_h
        contacts_filter_h new_filter;
 
        RETV_IF(NULL == filter1 || NULL == filter2, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_filter1 = (ctsvc_composite_filter_s *)filter1;
-       s_filter2 = (ctsvc_composite_filter_s *)filter2;
+       s_filter1 = (ctsvc_composite_filter_s*)filter1;
+       s_filter2 = (ctsvc_composite_filter_s*)filter2;
 
        RETVM_IF(g_slist_length(s_filter1->filter_ops) != (g_slist_length(s_filter1->filters)),
-                               CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : Please check the operator of filter");
-       RETVM_IF (STRING_EQUAL != strcmp(s_filter1->view_uri, s_filter2->view_uri), CONTACTS_ERROR_INVALID_PARAMETER,
-                               "The filter view_uri is different (filter1:%s, filter2:%s)", s_filter1->view_uri, s_filter2->view_uri);
+                       CONTACTS_ERROR_INVALID_PARAMETER, "Please check the operator of filter");
+       RETVM_IF(STRING_EQUAL != strcmp(s_filter1->view_uri, s_filter2->view_uri),
+                       CONTACTS_ERROR_INVALID_PARAMETER,
+                       "The filter view_uri is different (filter1:%s, filter2:%s)",
+                       s_filter1->view_uri, s_filter2->view_uri);
+
        ret = ctsvc_filter_clone(filter2, &new_filter);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_filter_clone is Fail (%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_filter_clone is Fail(%d)", ret);
        s_filter1->filters = g_slist_append(s_filter1->filters, new_filter);
 
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_attribute_filter_create(ctsvc_composite_filter_s *com_filter, unsigned int property_id,
-               int match, int filter_type, ctsvc_attribute_filter_s **out_filter)
+static int _filter_create_attribute(ctsvc_composite_filter_s *com_filter,
+               unsigned int property_id,
+               int match,
+               int filter_type,
+               ctsvc_attribute_filter_s **out_filter)
 {
        ctsvc_attribute_filter_s *filter;
        int type;
        bool find = false;
 
        RETVM_IF(g_slist_length(com_filter->filter_ops) != g_slist_length(com_filter->filters),
-                               CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter :Please check the operator of filter");
+                       CONTACTS_ERROR_INVALID_PARAMETER, "Please check the operator of filter");
 
-       find = __ctsvc_filters_property_check(com_filter->properties, com_filter->property_count, property_id, &type);
+       find = _filter_property_check(com_filter->properties, com_filter->property_count, property_id, &type);
        RETVM_IF(false == find, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : property_id(%d) is not supported on view_uri(%s)", property_id, com_filter->view_uri);
+                       "property_id(%d) is not supported on view_uri(%s)", property_id, com_filter->view_uri);
 
        if (type == CTSVC_VIEW_DATA_TYPE_INT && CTSVC_FILTER_INT != filter_type) {
-               CTS_ERR("Invalid parameter : use contacts_filter_add_int() (%d)", filter_type);
+               ERR("use contacts_filter_add_int() (%d)", filter_type);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
        if (type == CTSVC_VIEW_DATA_TYPE_STR && CTSVC_FILTER_STR != filter_type) {
-               CTS_ERR("Invalid parameter : use contacts_filter_add_str() (%d)", filter_type);
+               ERR("use contacts_filter_add_str() (%d)", filter_type);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
        if (type == CTSVC_VIEW_DATA_TYPE_BOOL && CTSVC_FILTER_BOOL != filter_type) {
-               CTS_ERR("Invalid parameter : use contacts_filter_add_bool() (%d)", filter_type);
+               ERR("use contacts_filter_add_bool() (%d)", filter_type);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
        if (type == CTSVC_VIEW_DATA_TYPE_LLI && CTSVC_FILTER_LLI != filter_type) {
-               CTS_ERR("Invalid parameter : use contacts_filter_add_lli() (%d)", filter_type);
+               ERR("use contacts_filter_add_lli() (%d)", filter_type);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
        if (type == CTSVC_VIEW_DATA_TYPE_DOUBLE && CTSVC_FILTER_DOUBLE != filter_type) {
-               CTS_ERR("Invalid parameter : use contacts_filter_add_double() (%d)", filter_type);
+               ERR("use contacts_filter_add_double() (%d)", filter_type);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
-       filter = (ctsvc_attribute_filter_s *)calloc(1, sizeof(ctsvc_attribute_filter_s));
+       filter = calloc(1, sizeof(ctsvc_attribute_filter_s));
        if (NULL == filter) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
        filter->filter_type = filter_type;
@@ -153,7 +159,7 @@ static int __ctsvc_attribute_filter_create(ctsvc_composite_filter_s *com_filter,
 }
 
 API int contacts_filter_add_str(contacts_filter_h filter, unsigned int property_id,
-               contacts_match_str_flag_e match, const charmatch_value)
+               contacts_match_str_flag_e match, const char *match_value)
 {
        ctsvc_composite_filter_s *com_filter;
        ctsvc_attribute_filter_s *str_filter;
@@ -162,10 +168,11 @@ API int contacts_filter_add_str(contacts_filter_h filter, unsigned int property_
        RETV_IF(NULL == filter || NULL == match_value, CONTACTS_ERROR_INVALID_PARAMETER);
 
        com_filter = (ctsvc_composite_filter_s*)filter;
-       ret = __ctsvc_attribute_filter_create(com_filter, property_id, match, CTSVC_FILTER_STR, &str_filter);
-       RETVM_IF(CONTACTS_ERROR_NONE !=ret, ret,
-               "Invalid parameter : The parameter is not proper (view_uri:%s, property_id:0x%x, match:%d)",
-               com_filter->view_uri, property_id, match);
+       ret = _filter_create_attribute(com_filter, property_id, match,
+                       CTSVC_FILTER_STR, &str_filter);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret,
+                       "The parameter is not proper (view_uri:%s, property_id:0x%x, match:%d)",
+                       com_filter->view_uri, property_id, match);
 
        str_filter->value.s = SAFE_STRDUP(match_value);
        return CONTACTS_ERROR_NONE;
@@ -179,15 +186,16 @@ API int contacts_filter_add_int(contacts_filter_h filter, unsigned int property_
        int ret;
 
        RETV_IF(NULL == filter, CONTACTS_ERROR_INVALID_PARAMETER);
-       RETVM_IF(property_id == CTSVC_PROPERTY_PHONELOG_SIM_SLOT_NO &&
-                       (CONTACTS_MATCH_GREATER_THAN <= match && match <= CONTACTS_MATCH_LESS_THAN_OR_EQUAL),
+       RETVM_IF(property_id == CTSVC_PROPERTY_PHONELOG_SIM_SLOT_NO
+                       && (CONTACTS_MATCH_GREATER_THAN <= match && match <= CONTACTS_MATCH_LESS_THAN_OR_EQUAL),
                        CONTACTS_ERROR_INVALID_PARAMETER, "Not support this condition");
 
        com_filter = (ctsvc_composite_filter_s*)filter;
-       ret = __ctsvc_attribute_filter_create(com_filter, property_id, match, CTSVC_FILTER_INT, &int_filter);
-       RETVM_IF(CONTACTS_ERROR_NONE !=ret, ret,
-               "Invalid parameter : The parameter is not proper (view_uri:%s, property_id:0x%x, match:%d)",
-               com_filter->view_uri, property_id, match);
+       ret = _filter_create_attribute(com_filter, property_id, match,
+                       CTSVC_FILTER_INT, &int_filter);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret,
+                       "The parameter is not proper (view_uri:%s, property_id:0x%x, match:%d)",
+                       com_filter->view_uri, property_id, match);
 
        int_filter->value.i = match_value;
 
@@ -204,10 +212,11 @@ API int contacts_filter_add_lli(contacts_filter_h filter, unsigned int property_
        RETV_IF(NULL == filter, CONTACTS_ERROR_INVALID_PARAMETER);
 
        com_filter = (ctsvc_composite_filter_s*)filter;
-       ret = __ctsvc_attribute_filter_create(com_filter, property_id, match, CTSVC_FILTER_LLI, &lli_filter);
-       RETVM_IF(CONTACTS_ERROR_NONE !=ret, ret,
-               "Invalid parameter : The parameter is not proper (view_uri:, property_id:0x%x, match:%d)",
-               property_id, match);
+       ret = _filter_create_attribute(com_filter, property_id, match,
+                       CTSVC_FILTER_LLI, &lli_filter);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret,
+                       "The parameter is not proper (view_uri:, property_id:0x%x, match:%d)",
+                       property_id, match);
 
        lli_filter->value.l = match_value;
 
@@ -224,17 +233,19 @@ API int contacts_filter_add_double(contacts_filter_h filter, unsigned int proper
        RETV_IF(NULL == filter, CONTACTS_ERROR_INVALID_PARAMETER);
 
        com_filter = (ctsvc_composite_filter_s*)filter;
-       ret = __ctsvc_attribute_filter_create(com_filter, property_id, match, CTSVC_FILTER_DOUBLE, &double_filter);
-       RETVM_IF(CONTACTS_ERROR_NONE !=ret, ret,
-               "Invalid parameter : The parameter is not proper (view_uri:, property_id:0x%x, match:%d)",
-               property_id, match);
+       ret = _filter_create_attribute(com_filter, property_id, match,
+                       CTSVC_FILTER_DOUBLE, &double_filter);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret,
+                       "The parameter is not proper (view_uri:, property_id:0x%x, match:%d)",
+                       property_id, match);
 
        double_filter->value.d = match_value;
 
        return CONTACTS_ERROR_NONE;
 }
 
-API int contacts_filter_add_bool(contacts_filter_h filter, unsigned int property_id, bool match_value)
+API int contacts_filter_add_bool(contacts_filter_h filter, unsigned int property_id,
+               bool match_value)
 {
        ctsvc_composite_filter_s *com_filter;
        ctsvc_attribute_filter_s *bool_filter;
@@ -243,10 +254,11 @@ API int contacts_filter_add_bool(contacts_filter_h filter, unsigned int property
        RETV_IF(NULL == filter, CONTACTS_ERROR_INVALID_PARAMETER);
 
        com_filter = (ctsvc_composite_filter_s*)filter;
-       ret = __ctsvc_attribute_filter_create(com_filter, property_id, 0, CTSVC_FILTER_BOOL, &bool_filter);
-       RETVM_IF(CONTACTS_ERROR_NONE !=ret, ret,
-               "Invalid parameter : The parameter is not proper (view_uri:, property_id:%d)",
-               property_id);
+       ret = _filter_create_attribute(com_filter, property_id, 0, CTSVC_FILTER_BOOL,
+                       &bool_filter);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret,
+                       "The parameter is not proper (view_uri:, property_id:%d)",
+                       property_id);
 
        bool_filter->value.b = match_value;
 
@@ -260,13 +272,13 @@ static int __ctsvc_composite_filter_destroy(ctsvc_composite_filter_s *com_filter
 
        RETV_IF(NULL == com_filter, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       for (cursor=com_filter->filters;cursor;cursor=cursor->next) {
-               ctsvc_filter_s *sub_filter = (ctsvc_filter_s *)cursor->data;
+       for (cursor = com_filter->filters; cursor; cursor = cursor->next) {
+               ctsvc_filter_s *sub_filter = cursor->data;
 
-               if (sub_filter->filter_type == CTSVC_FILTER_COMPOSITE)
-                       __ctsvc_composite_filter_destroy((ctsvc_composite_filter_s *)sub_filter);
-               else {
-                       ctsvc_attribute_filter_s *attr = (ctsvc_attribute_filter_s *)sub_filter;
+               if (sub_filter->filter_type == CTSVC_FILTER_COMPOSITE) {
+                       __ctsvc_composite_filter_destroy((ctsvc_composite_filter_s*)sub_filter);
+               else {
+                       ctsvc_attribute_filter_s *attr = (ctsvc_attribute_filter_s*)sub_filter;
                        if (attr->filter_type == CTSVC_FILTER_STR)
                                free(attr->value.s);
                        free(attr);
@@ -289,12 +301,13 @@ API int contacts_filter_destroy(contacts_filter_h filter)
        return __ctsvc_composite_filter_destroy((ctsvc_composite_filter_s*)filter);
 }
 
-static int __ctsvc_attribute_filter_clone(ctsvc_attribute_filter_s *src, ctsvc_attribute_filter_s **dest)
+static int __ctsvc_attribute_filter_clone(ctsvc_attribute_filter_s *src,
+               ctsvc_attribute_filter_s **dest)
 {
        ctsvc_attribute_filter_s *out;
-       out = (ctsvc_attribute_filter_s *)calloc(1, sizeof(ctsvc_attribute_filter_s));
+       out = calloc(1, sizeof(ctsvc_attribute_filter_s));
        if (NULL == out) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
        out->filter_type = src->filter_type;
@@ -311,7 +324,7 @@ static int __ctsvc_attribute_filter_clone(ctsvc_attribute_filter_s *src, ctsvc_a
        else if (src->filter_type == CTSVC_FILTER_DOUBLE)
                out->value.d = src->value.d;
        else
-               CTS_ERR("Invalid parameter : unknown type (%d)", src->filter_type);
+               ERR("unknown type (%d)", src->filter_type);
 
        *dest = out;
        return CONTACTS_ERROR_NONE;
@@ -324,16 +337,19 @@ static int __ctsvc_composite_filter_clone(ctsvc_composite_filter_s * filter,
        ctsvc_composite_filter_s *out;
 
        RETV_IF(NULL == filter, CONTACTS_ERROR_INVALID_PARAMETER);
-       contacts_filter_create(filter->view_uri, (contacts_filter_h *)&out);
+       contacts_filter_create(filter->view_uri, (contacts_filter_h*)&out);
 
-       for (cursor=filter->filters;cursor;cursor=cursor->next) {
-               ctsvc_filter_s *src = (ctsvc_filter_s *)cursor->data;
+       for (cursor = filter->filters; cursor; cursor = cursor->next) {
+               ctsvc_filter_s *src = cursor->data;
                ctsvc_filter_s *dest = NULL;
 
-               if (src->filter_type == CTSVC_FILTER_COMPOSITE)
-                       __ctsvc_composite_filter_clone((ctsvc_composite_filter_s *)src, (ctsvc_composite_filter_s **)&dest);
-               else
-                       __ctsvc_attribute_filter_clone((ctsvc_attribute_filter_s *)src, (ctsvc_attribute_filter_s **)&dest);
+               if (src->filter_type == CTSVC_FILTER_COMPOSITE) {
+                       __ctsvc_composite_filter_clone((ctsvc_composite_filter_s*)src,
+                                       (ctsvc_composite_filter_s **)&dest);
+               } else {
+                       __ctsvc_attribute_filter_clone((ctsvc_attribute_filter_s*)src,
+                                       (ctsvc_attribute_filter_s **)&dest);
+               }
 
                out->filters = g_slist_append(out->filters, dest);
        }
@@ -348,5 +364,6 @@ int ctsvc_filter_clone(contacts_filter_h filter, contacts_filter_h *out_filter)
 {
        RETV_IF(NULL == filter || NULL == out_filter, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       return __ctsvc_composite_filter_clone((ctsvc_composite_filter_s *)filter, (ctsvc_composite_filter_s **)out_filter);
+       return __ctsvc_composite_filter_clone((ctsvc_composite_filter_s*)filter,
+                       (ctsvc_composite_filter_s **)out_filter);
 }
index 82a7441..19095c4 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
index fee39d9..e69a6b7 100644 (file)
@@ -24,9 +24,8 @@ int ctsvc_handle_create(contacts_h *contact)
 {
        RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
        ctsvc_base_s *base = calloc(1, sizeof(ctsvc_base_s));
-       if (NULL == base)
-       {
-               CTS_ERR("calloc() Fail");
+       if (NULL == base) {
+               ERR("calloc() Fail");
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
        *contact = (contacts_h)base;
@@ -36,7 +35,7 @@ int ctsvc_handle_create(contacts_h *contact)
 int ctsvc_handle_destroy(contacts_h contact)
 {
        RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
-       ctsvc_base_s *base = (ctsvc_base_s *)contact;
+       ctsvc_base_s *base = (ctsvc_base_s*)contact;
        free(base);
        base = NULL;
        return CONTACTS_ERROR_NONE;
@@ -47,7 +46,7 @@ int ctsvc_handle_clone(contacts_h contact, contacts_h *pcontact)
        RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == pcontact, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       ctsvc_base_s *base = (ctsvc_base_s *)contact;
+       ctsvc_base_s *base = (ctsvc_base_s*)contact;
        ctsvc_base_s *clone = calloc(1, sizeof(ctsvc_base_s));
        clone->connection_count = base->connection_count;
        clone->version = base->version;
@@ -66,13 +65,14 @@ int ctsvc_handle_compare(contacts_h contact1, contacts_h contact2)
        else if (NULL == contact2)
                return 1;
 
-       ctsvc_base_s *base1 = (ctsvc_base_s *)contact1;
-       ctsvc_base_s *base2 = (ctsvc_base_s *)contact2;
+       ctsvc_base_s *base1 = (ctsvc_base_s*)contact1;
+       ctsvc_base_s *base2 = (ctsvc_base_s*)contact2;
 
        if ((base1->connection_count == base2->connection_count) &&
-               (base1->version == base2->version))
+                       (base1->version == base2->version)) {
                return 0;
-       else
+       } else {
                return 1;
+       }
 }
 
index 4d6ad75..e1419cc 100644 (file)
@@ -27,4 +27,4 @@ int ctsvc_handle_clone(contacts_h contact, contacts_h *pcontact);
 int ctsvc_handle_compare(contacts_h contact1, contacts_h contact2);
 
 
-#endif // __CTSVC_HANDLE_H__
+#endif /* __CTSVC_HANDLE_H__ */
\ No newline at end of file
index 50322bc..beac0f4 100644 (file)
@@ -1,9 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngjae Shin <yj99.shin@samsung.com>
+ * 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.
 #include "ctsvc_client_ipc.h"
 #endif
 
-typedef struct
-{
+typedef struct {
        contacts_h contact;
        int wd;
        char *view_uri;
        contacts_db_changed_cb cb;
        void *cb_data;
        bool blocked;
-}noti_info;
+} noti_info;
 
 struct socket_init_noti_info {
        int wd;
@@ -64,7 +61,7 @@ static inline void __ctsvc_inotify_handle_callback(GSList *noti_list, int wd, ui
        noti_info *noti;
        GSList *it = NULL;
 
-       for (it = noti_list;it;it=it->next) {
+       for (it = noti_list; it; it = it->next) {
                noti = (noti_info *)it->data;
 
                if (noti->wd == wd) {
@@ -77,7 +74,7 @@ static inline void __ctsvc_inotify_handle_callback(GSList *noti_list, int wd, ui
                        }
 #endif
                        if ((mask & IN_CLOSE_WRITE) && noti->cb) {
-                               CTS_DBG("%s", noti->view_uri);
+                               DBG("%s", noti->view_uri);
                                noti->cb(noti->view_uri, noti->cb_data);
                        }
                }
@@ -86,7 +83,6 @@ static inline void __ctsvc_inotify_handle_callback(GSList *noti_list, int wd, ui
 
 static void _ctsvc_inotify_socket_init_noti_table_foreach_cb(gpointer key, gpointer value, gpointer user_data)
 {
-       GList *c;
        struct socket_init_noti_info *noti_info = value;
 
        int wd = GPOINTER_TO_INT(user_data);
@@ -111,7 +107,7 @@ static gboolean __ctsvc_inotify_gio_cb(GIOChannel *src, GIOCondition cond, gpoin
                                __ctsvc_inotify_handle_callback(__noti_list, ie.wd, ie.mask);
 
                        while (0 != ie.len) {
-                               ret = read(fd, name, (ie.len<sizeof(name))?ie.len:sizeof(name));
+                               ret = read(fd, name, (ie.len < sizeof(name)) ? ie.len : sizeof(name));
                                if (-1 == ret) {
                                        if (EINTR == errno)
                                                continue;
@@ -123,8 +119,7 @@ static gboolean __ctsvc_inotify_gio_cb(GIOChannel *src, GIOCondition cond, gpoin
                                else
                                        ie.len -= ret;
                        }
-               }
-               else {
+               } else {
                        while (ret < sizeof(ie)) {
                                int read_size;
                                read_size = read(fd, name, sizeof(ie)-ret);
@@ -147,7 +142,7 @@ static inline int __ctsvc_inotify_attach_handler(int fd)
        guint ret;
        GIOChannel *channel;
 
-       RETVM_IF(fd < 0, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter: fd is invalid");
+       RETVM_IF(fd < 0, CONTACTS_ERROR_INVALID_PARAMETER, "fd is invalid");
 
        channel = g_io_channel_unix_new(fd);
        RETVM_IF(NULL == channel, CONTACTS_ERROR_SYSTEM, "System: g_io_channel_unix_new() Fail");
@@ -179,7 +174,7 @@ int ctsvc_inotify_init(void)
 
        __inoti_handler = __ctsvc_inotify_attach_handler(__inoti_fd);
        if (__inoti_handler <= 0) {
-               CTS_ERR("__ctsvc_inotify_attach_handler() Fail");
+               ERR("__ctsvc_inotify_attach_handler() Fail");
                close(__inoti_fd);
                __inoti_fd = -1;
                __inoti_handler = 0;
@@ -209,7 +204,7 @@ static inline int __ctsvc_inotify_watch(int fd, const char *notipath)
 static inline const char* __ctsvc_noti_get_file_path(const char *view_uri)
 {
        ctsvc_record_type_e match = ctsvc_view_get_record_type(view_uri);
-       switch((int)match) {
+       switch ((int)match) {
        case CTSVC_RECORD_ADDRESSBOOK:
                return CTSVC_NOTI_ADDRESSBOOK_CHANGED;
        case CTSVC_RECORD_GROUP:
@@ -263,7 +258,7 @@ static inline const char* __ctsvc_noti_get_file_path(const char *view_uri)
                return CTSVC_NOTI_SDN_CHANGED;
        case CTSVC_RECORD_RESULT:
        default:
-               CTS_ERR("Invalid parameter : The type(%s) is not supported", view_uri);
+               ERR("The type(%s) is not supported", view_uri);
                return NULL;
        }
        return NULL;
@@ -282,7 +277,7 @@ int ctsvc_inotify_subscribe_ipc_ready(contacts_h contact, void (*cb)(void *), vo
        if (NULL == noti_info) {
                int wd = __ctsvc_inotify_get_wd(__inoti_fd, noti_path);
                if (-1 == wd) {
-                       CTS_ERR("__ctsvc_inotify_get_wd() Failed(noti_path=%s, errno : %d)", noti_path, errno);
+                       ERR("__ctsvc_inotify_get_wd() Fail(noti_path=%s, errno : %d)", noti_path, errno);
                        if (errno == EACCES)
                                return CONTACTS_ERROR_PERMISSION_DENIED;
                        return CONTACTS_ERROR_SYSTEM;
@@ -290,13 +285,13 @@ int ctsvc_inotify_subscribe_ipc_ready(contacts_h contact, void (*cb)(void *), vo
 
                int ret = __ctsvc_inotify_watch(__inoti_fd, noti_path);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("__ctsvc_inotify_watch() Failed");
+                       ERR("__ctsvc_inotify_watch() Fail");
                        return ret;
                }
 
                noti_info = calloc(1, sizeof(struct socket_init_noti_info));
                if (NULL == noti_info) {
-                       CTS_ERR("calloc() return NULL");
+                       ERR("calloc() return NULL");
                        return ret;
                }
 
@@ -311,20 +306,23 @@ int ctsvc_inotify_subscribe_ipc_ready(contacts_h contact, void (*cb)(void *), vo
 
 int ctsvc_inotify_unsubscribe_ipc_ready(contacts_h contact)
 {
-       RETVM_IF(NULL == _ctsvc_socket_init_noti_table, CONTACTS_ERROR_INVALID_PARAMETER, "_ctsvc_socket_init_noti_table is NULL");
-
        const char *noti_path = CTSVC_NOTI_IPC_READY;
        struct socket_init_noti_info *noti_info = NULL;
 
+       RETV_IF(NULL == _ctsvc_socket_init_noti_table, CONTACTS_ERROR_INVALID_PARAMETER);
+
        noti_info = g_hash_table_lookup(_ctsvc_socket_init_noti_table, noti_path);
-       RETVM_IF(NULL == noti_info, CONTACTS_ERROR_INVALID_PARAMETER, "g_hash_table_lookup() return NULL");
+       if (NULL == noti_info) {
+               ERR("g_hash_table_lookup() return NULL");
+               return CONTACTS_ERROR_INVALID_PARAMETER;
+       }
 
        if (1 == noti_info->subscribe_count) {
                int wd = noti_info->wd;
                inotify_rm_watch(__inoti_fd, wd);
-               g_hash_table_remove(_ctsvc_socket_init_noti_table, noti_path); // free noti_info automatically
-       }
-       else {
+               /* free noti_info automatically */
+               g_hash_table_remove(_ctsvc_socket_init_noti_table, noti_path);
+       else {
                noti_info->subscribe_count--;
        }
 
@@ -333,14 +331,14 @@ int ctsvc_inotify_unsubscribe_ipc_ready(contacts_h contact)
 
 
 int ctsvc_inotify_subscribe(contacts_h contact, const char *view_uri,
-                       void *cb, void *data)
+               void *cb, void *data)
 {
        int ret, wd;
        noti_info *noti, *same_noti = NULL;
        GSList *it;
        const char *path;
 
-       RETV_IF(NULL==cb, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == cb, CONTACTS_ERROR_INVALID_PARAMETER);
        RETVM_IF(__inoti_fd < 0, CONTACTS_ERROR_SYSTEM,
                        "__inoti_fd(%d) is invalid", __inoti_fd);
 
@@ -350,27 +348,29 @@ int ctsvc_inotify_subscribe(contacts_h contact, const char *view_uri,
 
        wd = __ctsvc_inotify_get_wd(__inoti_fd, path);
        if (-1 == wd) {
-               CTS_ERR("__ctsvc_inotify_get_wd() Fail(errno : %d)", errno);
+               ERR("__ctsvc_inotify_get_wd() Fail(errno : %d)", errno);
                if (errno == EACCES)
                        return CONTACTS_ERROR_PERMISSION_DENIED;
                return CONTACTS_ERROR_SYSTEM;
        }
 
-       for (it=__noti_list;it;it=it->next) {
+       for (it = __noti_list; it; it = it->next) {
                if (it->data) {
                        same_noti = it->data;
-                       if (same_noti->wd == wd && same_noti->cb == cb &&
-                                       STRING_EQUAL == strcmp(same_noti->view_uri, view_uri) && same_noti->cb_data == data &&
-                                       0 == ctsvc_handle_compare(contact, same_noti->contact))
+                       if (same_noti->wd == wd && same_noti->cb == cb
+                                       && STRING_EQUAL == strcmp(same_noti->view_uri, view_uri)
+                                       && same_noti->cb_data == data
+                                       && 0 == ctsvc_handle_compare(contact, same_noti->contact)) {
                                break;
-                       else
+                       } else {
                                same_noti = NULL;
+                       }
                }
        }
 
        if (same_noti) {
                __ctsvc_inotify_watch(__inoti_fd, path);
-               CTS_ERR("The same callback(%s) is already exist", view_uri);
+               ERR("The same callback(%s) is already exist", view_uri);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
@@ -406,8 +406,8 @@ static inline int __ctsvc_del_noti(GSList **noti_list, contacts_h contact, int w
                noti_info *noti = it->data;
                if (noti && wd == noti->wd) {
                        if (cb == noti->cb && user_data == noti->cb_data
-                               && STRING_EQUAL == strcmp(noti->view_uri, view_uri)
-                               && 0 == ctsvc_handle_compare(contact, noti->contact)) {
+                                       && STRING_EQUAL == strcmp(noti->view_uri, view_uri)
+                                       && 0 == ctsvc_handle_compare(contact, noti->contact)) {
                                it = it->next;
                                result = g_slist_remove(result, noti);
                                ctsvc_handle_destroy(noti->contact);
@@ -415,8 +415,7 @@ static inline int __ctsvc_del_noti(GSList **noti_list, contacts_h contact, int w
                                free(noti);
                                del_cnt++;
                                continue;
-                       }
-                       else {
+                       } else {
                                remain_cnt++;
                        }
                }
@@ -434,7 +433,7 @@ int ctsvc_inotify_unsubscribe(contacts_h contact, const char *view_uri, void *cb
        int ret, wd;
        const char *path;
 
-       RETV_IF(NULL==cb, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == cb, CONTACTS_ERROR_INVALID_PARAMETER);
        RETVM_IF(__inoti_fd < 0, CONTACTS_ERROR_SYSTEM,
                        "System : __inoti_fd(%d) is invalid", __inoti_fd);
 
@@ -444,7 +443,7 @@ int ctsvc_inotify_unsubscribe(contacts_h contact, const char *view_uri, void *cb
 
        wd = __ctsvc_inotify_get_wd(__inoti_fd, path);
        if (-1 == wd) {
-               CTS_ERR("__ctsvc_inotify_get_wd() Fail(errno : %d)", errno);
+               ERR("__ctsvc_inotify_get_wd() Fail(errno : %d)", errno);
                if (errno == EACCES)
                        return CONTACTS_ERROR_PERMISSION_DENIED;
                return CONTACTS_ERROR_SYSTEM;
@@ -476,12 +475,11 @@ static inline gboolean __ctsvc_inotify_detach_handler(guint id)
 void ctsvc_inotify_close(void)
 {
        if (1 < __ctsvc_inoti_ref) {
-               CTS_DBG("inotify ref count : %d", __ctsvc_inoti_ref);
+               DBG("inotify ref count : %d", __ctsvc_inoti_ref);
                __ctsvc_inoti_ref--;
                return;
-       }
-       else if (__ctsvc_inoti_ref < 1) {
-               CTS_DBG("Please call connection API. inotify ref count : %d", __ctsvc_inoti_ref);
+       } else if (__ctsvc_inoti_ref < 1) {
+               DBG("Please call connection API. inotify ref count : %d", __ctsvc_inoti_ref);
                return;
        }
 
index 136d8f7..42150ba 100644 (file)
@@ -3,8 +3,6 @@
  *
  * Copyright (c) 2010 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
  *
- * Contact: Youngjae Shin <yj99.shin@samsung.com>
- *
  * 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
index 3e61dd6..7971c76 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
@@ -41,9 +37,6 @@
 
 #define LOG_TAG "CONTACTS_SERVICE"
 #include <dlog.h>
-#define DLOG(prio, fmt, arg...) \
-       do { SLOG(prio, LOG_TAG, fmt, ##arg); } while (0)
-
 
 #if defined(_CONTACTS_IPC_SERVER)
 #define IPC_ROLE "[SERVER]"
 #define IPC_ROLE "[LIB]"
 #endif
 
-#define INFO(fmt, arg...) SLOGI(IPC_ROLE" "fmt, ##arg)
-#define ERR(fmt, arg...) SLOGE(IPC_ROLE" "fmt, ##arg)
-#define DBG(fmt, arg...) SLOGD(IPC_ROLE" "fmt, ##arg)
-#define WARN(fmt, arg...) SLOGD(IPC_ROLE" "fmt, ##arg)
-#define VERBOSE(fmt, arg...) SLOGV(IPC_ROLE" "fmt, ##arg)
+#define CTS_LOG_RED "\033[0;31m"
+#define CTS_LOG_GREEN "\033[0;32m"
+#define CTS_LOG_BROWN "\033[0;33m"
+#define CTS_LOG_BLUE "\033[0;34m"
+#define CTS_LOG_END "\033[0;m"
+
+#define _INFO(fmt, arg...) SLOGI(CTS_LOG_GREEN IPC_ROLE CTS_LOG_END fmt, ##arg)
+#define _ERR(fmt, arg...) SLOGE(CTS_LOG_GREEN IPC_ROLE CTS_LOG_END fmt, ##arg)
+#define _DBG(fmt, arg...) SLOGD(CTS_LOG_GREEN IPC_ROLE CTS_LOG_END fmt, ##arg)
+#define _WARN(fmt, arg...) SLOGW(CTS_LOG_GREEN IPC_ROLE CTS_LOG_END fmt, ##arg)
 
 #ifdef CONTACTS_DEBUGGING
 
-       #define CTS_FN_CALL DBG(">>>>>>>> called")
-       #define CTS_FN_END DBG("<<<<<<<< ended")
+       #define CTS_FN_CALL _DBG(">>>>>>>> called")
+       #define CTS_FN_END _DBG("<<<<<<<< ended")
 
-       #define CTS_DBG(fmt, arg...) DBG(fmt, ##arg)
-       #define CTS_WARN(fmt, arg...) WARN(fmt, ##arg)
-       #define CTS_ERR(fmt, arg...) ERR(fmt, ##arg)
-       #define CTS_INFO(fmt, arg...) INFO(fmt, ##arg)
-       #define CTS_VERBOSE(fmt, arg...) VERBOSE(fmt, ##arg)
+       #define DBG(fmt, arg...) _DBG(fmt, ##arg)
+       #define WARN(fmt, arg...) _WARN(CTS_LOG_BROWN fmt CTS_LOG_END, ##arg)
+       #define ERR(fmt, arg...) _ERR(CTS_LOG_RED fmt CTS_LOG_END, ##arg)
+       #define INFO(fmt, arg...) _INFO(CTS_LOG_BLUE fmt CTS_LOG_END, ##arg)
 
 #else /* CONTACTS_DEBUGGING */
        #define CTS_FN_CALL
        #define CTS_FN_END
 
-       #define CTS_DBG(fmt, arg...)
-       #define CTS_WARN(fmt, arg...)
-       #define CTS_ERR(fmt, arg...) ERR(fmt, ##arg)
-       #define CTS_INFO(fmt, arg...) INFO(fmt, ##arg)
-       #define CTS_VERBOSE(fmt, arg...)
+       #define DBG(fmt, arg...)
+       #define WARN(fmt, arg...)
+       #define ERR(fmt, arg...) _ERR(fmt, ##arg)
+       #define INFO(fmt, arg...) _INFO(fmt, ##arg)
 
        #define G_DISABLE_ASSERT
 #endif /* CONTACTS_DEBUGGING */
 
-#define WARN_IF(expr, fmt, arg...) do { \
-       if (expr) { \
-               CTS_WARN(fmt, ##arg); \
-       } \
-} while (0)
-#define RET_IF(expr) do { \
-       if (expr) { \
-               CTS_ERR("(%s)", #expr); \
-               return; \
-       } \
-} while (0)
-#define RETV_IF(expr, val) do { \
-       if (expr) { \
-               CTS_ERR("(%s)", #expr); \
-               return (val); \
-       } \
-} while (0)
-#define RETM_IF(expr, fmt, arg...) do { \
-       if (expr) { \
-               CTS_ERR(fmt, ##arg); \
-               return; \
-       } \
-} while (0)
-#define RETVM_IF(expr, val, fmt, arg...) do { \
-       if (expr) { \
-               CTS_ERR(fmt, ##arg); \
-               return (val); \
-       } \
-} while (0)
+#define RET_IF(expr) \
+       do { \
+               if (expr) { \
+                       ERR("(%s)", #expr); \
+                       return; \
+               }\
+       } while(0)
 
+#define RETV_IF(expr, val) \
+       do { \
+               if (expr) { \
+                       ERR("(%s)", #expr); \
+                       return (val); \
+               } \
+       } while (0)
 
-/* TO DISABLE THIS MACRO, DEFINE "G_DISABLE_ASSERT" */
-#define ASSERT_NOT_REACHED(fmt, arg...) do { \
-        CTS_ERR(fmt, ##arg); \
-        assert(!"DO NOT REACH HERE!"); \
+#define RETM_IF(expr, fmt, arg...) \
+       do { \
+               if (expr) { \
+                       ERR(fmt, ##arg); \
+                       return; \
+               } \
        } while (0)
 
+#define RETVM_IF(expr, val, fmt, arg...) \
+       do { \
+               if (expr) { \
+                       ERR(fmt, ##arg); \
+                       return (val); \
+               } \
+       } while (0)
 
-#define CONTACTS_FREE(ptr) \
+#define WARN_IF(expr, fmt, arg...) \
        do { \
-               free(ptr); \
-               ptr = NULL; \
+               if (expr) { \
+                       WARN(fmt, ##arg); \
+               } \
        } while (0)
 
+
+/* TO DISABLE THIS MACRO, DEFINE "G_DISABLE_ASSERT" */
+#define ASSERT_NOT_REACHED(fmt, arg...) do { \
+        ERR(fmt, ##arg); \
+        assert(!"DO NOT REACH HERE!"); \
+       } while (0)
+
+
 /* Thread-local storage */
 #ifdef _CONTACTS_IPC_SERVER
 #define TLS __thread
index 4b140cc..e5d2727 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
@@ -20,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include <glib.h>
 
 #include "contacts.h"
 #include "ctsvc_list.h"
 #include "ctsvc_record.h"
 
-API int contacts_list_create(contacts_list_hout_list)
+API int contacts_list_create(contacts_list_h *out_list)
 {
        ctsvc_list_s *list_s;
 
        RETV_IF(NULL == out_list, CONTACTS_ERROR_INVALID_PARAMETER);
        *out_list = NULL;
 
-       list_s = (ctsvc_list_s*)calloc(1, sizeof(ctsvc_list_s));
-       RETVM_IF(NULL == list_s, CONTACTS_ERROR_OUT_OF_MEMORY, "Out of memory : calloc is Fail");
+       list_s = calloc(1, sizeof(ctsvc_list_s));
+       RETVM_IF(NULL == list_s, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        list_s->l_type = -1;
        *out_list = (contacts_list_h)list_s;
@@ -51,7 +46,7 @@ API int contacts_list_get_count(contacts_list_h list, int *count)
        *count = 0;
 
        RETV_IF(NULL == list, CONTACTS_ERROR_INVALID_PARAMETER);
-       list_s = (ctsvc_list_s *)list;
+       list_s = (ctsvc_list_s*)list;
 
        *count = list_s->count;
        return CONTACTS_ERROR_NONE;
@@ -63,12 +58,11 @@ int ctsvc_list_add_child(contacts_list_h list, contacts_record_h child_record)
        ctsvc_record_s *s_record;
 
        RETV_IF(NULL == list || NULL == child_record, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_list = (ctsvc_list_s *)list;
-       s_record = (ctsvc_record_s *)child_record;
+       s_list = (ctsvc_list_s*)list;
+       s_record = (ctsvc_record_s*)child_record;
 
-       if (-1 == s_list->l_type) {
+       if (-1 == s_list->l_type)
                s_list->l_type = s_record->r_type;
-       }
        else if (s_list->l_type != s_record->r_type)
                return CONTACTS_ERROR_INVALID_PARAMETER;
 
@@ -87,12 +81,11 @@ API int contacts_list_add(contacts_list_h list, contacts_record_h child_record)
        ctsvc_record_s *s_record;
 
        RETV_IF(NULL == list || NULL == child_record, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_list = (ctsvc_list_s *)list;
-       s_record = (ctsvc_record_s *)child_record;
+       s_list = (ctsvc_list_s*)list;
+       s_record = (ctsvc_record_s*)child_record;
 
-       if (-1 == s_list->l_type) {
+       if (-1 == s_list->l_type)
                s_list->l_type = s_record->r_type;
-       }
        else if (s_list->l_type != s_record->r_type)
                return CONTACTS_ERROR_INVALID_PARAMETER;
 
@@ -111,12 +104,11 @@ int ctsvc_list_prepend(contacts_list_h list, contacts_record_h child_record)
        ctsvc_record_s *s_record;
 
        RETV_IF(NULL == list || NULL == child_record, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_list = (ctsvc_list_s *)list;
-       s_record = (ctsvc_record_s *)child_record;
+       s_list = (ctsvc_list_s*)list;
+       s_record = (ctsvc_record_s*)child_record;
 
-       if (-1 == s_list->l_type) {
+       if (-1 == s_list->l_type)
                s_list->l_type = s_record->r_type;
-       }
        else if (s_list->l_type != s_record->r_type)
                return CONTACTS_ERROR_INVALID_PARAMETER;
 
@@ -134,16 +126,16 @@ int ctsvc_list_reverse(contacts_list_h list)
        ctsvc_list_s *s_list;
 
        RETV_IF(NULL == list, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_list = (ctsvc_list_s *)list;
-
+       s_list = (ctsvc_list_s*)list;
 
        if (s_list->count != 0)
-               s_list->records =  g_list_reverse (s_list->records);
+               s_list->records =  g_list_reverse(s_list->records);
 
        return CONTACTS_ERROR_NONE;
 }
 
-int ctsvc_list_remove_child(contacts_list_h list, contacts_record_h record, bool insert_delete_list)
+int ctsvc_list_remove_child(contacts_list_h list, contacts_record_h record,
+               bool insert_delete_list)
 {
        GList *cursor = NULL;
        ctsvc_list_s *s_list;
@@ -152,14 +144,14 @@ int ctsvc_list_remove_child(contacts_list_h list, contacts_record_h record, bool
        contacts_error_e err = CONTACTS_ERROR_NONE;
 
        RETV_IF(NULL == list || NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_list = (ctsvc_list_s *)list;
-       s_record = (ctsvc_record_s *)record;
+       s_list = (ctsvc_list_s*)list;
+       s_record = (ctsvc_record_s*)record;
 
        if (s_list->l_type != s_record->r_type)
                return CONTACTS_ERROR_INVALID_PARAMETER;
 
-       for (cursor=s_list->records;cursor;cursor=cursor->next) {
-               ctsvc_record_s *data = (ctsvc_record_s *)cursor->data;
+       for (cursor = s_list->records; cursor; cursor = cursor->next) {
+               ctsvc_record_s *data = cursor->data;
                if (data == s_record) {
                        s_list->count--;
                        if (s_list->cursor == cursor)
@@ -168,7 +160,11 @@ int ctsvc_list_remove_child(contacts_list_h list, contacts_record_h record, bool
                        s_list->records = g_list_remove(s_list->records, s_record);
                        if (insert_delete_list) {
                                err = contacts_record_clone(record, &delete_record);
-                               RETVM_IF(CONTACTS_ERROR_NONE != err, err,"contacts_record_clone() Fail(%d)", err);
+                               if (CONTACTS_ERROR_NONE != err) {
+                                       ERR("contacts_record_clone() Fail(%d)", err);
+                                       return err;
+                               }
+
                                s_list->deleted_records = g_list_append(s_list->deleted_records, delete_record);
                        }
                        return CONTACTS_ERROR_NONE;
@@ -185,14 +181,14 @@ API int contacts_list_remove(contacts_list_h list, contacts_record_h record)
        ctsvc_record_s *s_record;
 
        RETV_IF(NULL == list || NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_list = (ctsvc_list_s *)list;
-       s_record = (ctsvc_record_s *)record;
+       s_list = (ctsvc_list_s*)list;
+       s_record = (ctsvc_record_s*)record;
 
        if (s_list->l_type != s_record->r_type)
                return CONTACTS_ERROR_INVALID_PARAMETER;
 
-       for (cursor=s_list->records;cursor;cursor=cursor->next) {
-               ctsvc_record_s *data = (ctsvc_record_s *)cursor->data;
+       for (cursor = s_list->records; cursor; cursor = cursor->next) {
+               ctsvc_record_s *data = cursor->data;
                if (data == s_record) {
                        s_list->count--;
                        if (s_list->cursor == cursor)
@@ -205,7 +201,7 @@ API int contacts_list_remove(contacts_list_h list, contacts_record_h record)
        return CONTACTS_ERROR_NO_DATA;
 }
 
-API int contacts_list_get_current_record_p(contacts_list_h list, contacts_record_hrecord)
+API int contacts_list_get_current_record_p(contacts_list_h list, contacts_record_h *record)
 {
        ctsvc_list_s *list_s;
 
@@ -213,7 +209,7 @@ API int contacts_list_get_current_record_p(contacts_list_h list, contacts_record
        *record = NULL;
 
        RETV_IF(NULL == list || NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
-       list_s = (ctsvc_list_s *)list;
+       list_s = (ctsvc_list_s*)list;
 
        if (NULL == list_s->cursor) {
                *record = NULL;
@@ -225,7 +221,7 @@ API int contacts_list_get_current_record_p(contacts_list_h list, contacts_record
        return CONTACTS_ERROR_NONE;
 }
 
-int ctsvc_list_get_nth_record_p(contacts_list_h list, int index, contacts_record_hrecord)
+int ctsvc_list_get_nth_record_p(contacts_list_h list, int index, contacts_record_h *record)
 {
        GList *cursor = NULL;
        ctsvc_list_s *list_s;
@@ -235,11 +231,11 @@ int ctsvc_list_get_nth_record_p(contacts_list_h list, int index, contacts_record
        *record = NULL;
 
        RETV_IF(NULL == list || NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
-       list_s = (ctsvc_list_s *)list;
+       list_s = (ctsvc_list_s*)list;
 
-       for (i=0,j=0,cursor=list_s->records;cursor;cursor=cursor->next, i++) {
+       for (i = 0, j = 0, cursor = list_s->records; cursor; cursor = cursor->next, i++) {
                if (j == index) {
-                       *record = (contacts_record_h)cursor->data;
+                       *record = cursor->data;
                        return CONTACTS_ERROR_NONE;
                }
                j++;
@@ -253,7 +249,7 @@ static int __ctsvc_list_move_cursor(contacts_list_h list, bool next)
        ctsvc_list_s *list_s;
 
        RETV_IF(NULL == list, CONTACTS_ERROR_INVALID_PARAMETER);
-       list_s = (ctsvc_list_s *)list;
+       list_s = (ctsvc_list_s*)list;
 
        if (NULL == list_s->cursor)
                return CONTACTS_ERROR_NO_DATA;
@@ -283,7 +279,7 @@ API int contacts_list_first(contacts_list_h list)
        ctsvc_list_s *list_s;
 
        RETV_IF(NULL == list, CONTACTS_ERROR_INVALID_PARAMETER);
-       list_s = (ctsvc_list_s *)list;
+       list_s = (ctsvc_list_s*)list;
 
        list_s->cursor = list_s->records;
        if (NULL == list_s->cursor)
@@ -297,7 +293,7 @@ API int contacts_list_last(contacts_list_h list)
        ctsvc_list_s *list_s;
 
        RETV_IF(NULL == list, CONTACTS_ERROR_INVALID_PARAMETER);
-       list_s = (ctsvc_list_s *)list;
+       list_s = (ctsvc_list_s*)list;
 
        list_s->cursor = g_list_last(list_s->records);
        if (NULL == list_s->cursor)
@@ -311,16 +307,17 @@ API int contacts_list_destroy(contacts_list_h list, bool delete_child)
        ctsvc_list_s *s_list;
        GList *cursor = NULL;
 
-       RETVM_IF(NULL == list, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : The list is null");
-       s_list = (ctsvc_list_s *)list;
+       RETV_IF(NULL == list, CONTACTS_ERROR_INVALID_PARAMETER);
+
+       s_list = (ctsvc_list_s*)list;
 
        if (delete_child) {
-               for (cursor = s_list->records;cursor;cursor=cursor->next)
+               for (cursor = s_list->records; cursor; cursor = cursor->next)
                        contacts_record_destroy((contacts_record_h)(cursor->data), true);
        }
        g_list_free(s_list->records);
 
-       for (cursor = s_list->deleted_records;cursor;cursor=cursor->next)
+       for (cursor = s_list->deleted_records; cursor; cursor = cursor->next)
                contacts_record_destroy((contacts_record_h)(cursor->data), true);
        g_list_free(s_list->deleted_records);
 
@@ -328,7 +325,7 @@ API int contacts_list_destroy(contacts_list_h list, bool delete_child)
        return CONTACTS_ERROR_NONE;
 }
 
-int ctsvc_list_clone(contacts_list_h list, contacts_list_hout_list)
+int ctsvc_list_clone(contacts_list_h list, contacts_list_h *out_list)
 {
        ctsvc_list_s *list_s;
        contacts_record_h new_record;
@@ -336,15 +333,15 @@ int ctsvc_list_clone(contacts_list_h list, contacts_list_h* out_list)
        GList *cursor = NULL;
        contacts_error_e err = CONTACTS_ERROR_NONE;
 
-       RETVM_IF(NULL == list, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "The list is null");
-       list_s = (ctsvc_list_s *)list;
+       RETV_IF(NULL == list, CONTACTS_ERROR_INVALID_PARAMETER);
+
+       list_s = (ctsvc_list_s*)list;
 
        contacts_list_create(&new_list);
-       for (cursor = list_s->records;cursor;cursor=cursor->next) {
-               err = contacts_record_clone((contacts_record_h)cursor->data, &new_record);
+       for (cursor = list_s->records; cursor; cursor = cursor->next) {
+               err = contacts_record_clone(cursor->data, &new_record);
                if (CONTACTS_ERROR_NONE != err) {
-                       CTS_ERR("contacts_record_clone() Fail(%d)", err);
+                       ERR("contacts_record_clone() Fail(%d)", err);
                        contacts_list_destroy(new_list, true);
                        return err;
                }
@@ -352,17 +349,20 @@ int ctsvc_list_clone(contacts_list_h list, contacts_list_h* out_list)
        }
        ctsvc_list_reverse(new_list);
 
-       for (cursor = list_s->deleted_records;cursor;cursor=cursor->next) {
-               err = contacts_record_clone((contacts_record_h)cursor->data, &new_record);
+       for (cursor = list_s->deleted_records; cursor; cursor = cursor->next) {
+               err = contacts_record_clone(cursor->data, &new_record);
                if (CONTACTS_ERROR_NONE != err) {
-                       CTS_ERR("contacts_record_clone() Fail(%d)", err);
+                       ERR("contacts_record_clone() Fail(%d)", err);
                        contacts_list_destroy(new_list, true);
                        return err;
                }
-               ((ctsvc_list_s*)new_list)->deleted_records = g_list_prepend(((ctsvc_list_s*)new_list)->deleted_records, new_record);
+               ((ctsvc_list_s*)new_list)->deleted_records
+                       = g_list_prepend(((ctsvc_list_s*)new_list)->deleted_records, new_record);
+       }
+       if (((ctsvc_list_s*)new_list)->deleted_records) {
+               ((ctsvc_list_s*)new_list)->deleted_records
+                       = g_list_reverse(((ctsvc_list_s*)new_list)->deleted_records);
        }
-       if (((ctsvc_list_s*)new_list)->deleted_records)
-               ((ctsvc_list_s*)new_list)->deleted_records = g_list_reverse(((ctsvc_list_s*)new_list)->deleted_records);
 
        *out_list = new_list;
 
@@ -378,18 +378,18 @@ int ctsvc_list_get_deleted_count(contacts_list_h list, unsigned int *count)
        *count = 0;
 
        RETV_IF(NULL == list, CONTACTS_ERROR_INVALID_PARAMETER);
-       list_s = (ctsvc_list_s *)list;
+       list_s = (ctsvc_list_s*)list;
 
-       if (NULL == list_s->deleted_records) {
+       if (NULL == list_s->deleted_records)
                return CONTACTS_ERROR_NONE;
-       }
 
        *count = g_list_length(list_s->deleted_records);
 
        return CONTACTS_ERROR_NONE;
 }
 
-int ctsvc_list_get_deleted_nth_record_p(contacts_list_h list, int index, contacts_record_h* record)
+int ctsvc_list_get_deleted_nth_record_p(contacts_list_h list, int index,
+               contacts_record_h *record)
 {
        ctsvc_list_s *list_s;
 
@@ -397,7 +397,7 @@ int ctsvc_list_get_deleted_nth_record_p(contacts_list_h list, int index, contact
        *record = NULL;
 
        RETV_IF(NULL == list || NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
-       list_s = (ctsvc_list_s *)list;
+       list_s = (ctsvc_list_s*)list;
 
        RETV_IF(NULL == list_s->deleted_records, CONTACTS_ERROR_NO_DATA);
 
@@ -412,7 +412,7 @@ int ctsvc_list_append_deleted_record(contacts_list_h list, contacts_record_h rec
 
        RETV_IF(NULL == list || NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       list_s = (ctsvc_list_s *)list;
+       list_s = (ctsvc_list_s*)list;
 
        list_s->deleted_records = g_list_append(list_s->deleted_records, record);
 
index f0d72d6..9025ed5 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
 
 #include "contacts_views.h"
 
-int ctsvc_list_clone(contacts_list_h list, contacts_list_hout_list);
-int ctsvc_list_get_nth_record_p(contacts_list_h list, int index, contacts_record_hrecord);
+int ctsvc_list_clone(contacts_list_h list, contacts_list_h *out_list);
+int ctsvc_list_get_nth_record_p(contacts_list_h list, int index, contacts_record_h *record);
 int ctsvc_list_add_child(contacts_list_h list, contacts_record_h child_record);
 int ctsvc_list_prepend(contacts_list_h list, contacts_record_h child_record);
 int ctsvc_list_reverse(contacts_list_h list);
 int ctsvc_list_remove_child(contacts_list_h list, contacts_record_h record, bool insert_delete_list);
 
 int ctsvc_list_get_deleted_count(contacts_list_h list, unsigned int *count);
-int ctsvc_list_get_deleted_nth_record_p(contacts_list_h list, int index, contacts_record_hrecord);
+int ctsvc_list_get_deleted_nth_record_p(contacts_list_h list, int index, contacts_record_h *record);
 int ctsvc_list_append_deleted_record(contacts_list_h list, contacts_record_h record);
 
 #endif /* __CTSVC_LIST_H__ */
diff --git a/common/ctsvc_localize.c b/common/ctsvc_localize.c
deleted file mode 100755 (executable)
index 7e906cf..0000000
+++ /dev/null
@@ -1,947 +0,0 @@
-/*
- * Contacts Service Helper
- *
- * Copyright (c) 2010 - 2012 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 <unicode/ustring.h>
-#include <unicode/unorm.h>
-#include <unicode/ucol.h>
-#include <unicode/uset.h>
-#include "ctsvc_internal.h"
-#include "ctsvc_normalize.h"
-#include "ctsvc_localize.h"
-
-/* korean -Hangul Jamo extended A*/
-#define CTSVC_JAMO_A_START (UChar)0xA960
-#define CTSVC_JAMO_A_END (UChar)0xA97F
-
-/* korean -Hangul Jamo extended B*/
-#define CTSVC_JAMO_B_START (UChar)0xD7B0
-#define CTSVC_JAMO_B_END (UChar)0xD7FF
-
-/* korean -Hangul Compatability */
-#define CTSVC_HAN_C_START (UChar)0x3130
-#define CTSVC_HAN_C_END (UChar)0x318F
-
-/* korean -Hangul halfwidth */
-#define CTSVC_HAN_HALF_START (UChar)0xFFA0
-#define CTSVC_HAN_HALF_END (UChar)0xFFDC
-
-/* korean -Hangul Syllables */
-#define CTSVC_HAN_SYLLABLES_START (UChar)0xAC00
-#define CTSVC_HAN_SYLLABLES_END (UChar)0xD7A3
-
-
-/* japanese - katakana */
-#define CTSVC_JAPANESE_KATAKANA_START  0x30A0
-#define CTSVC_JAPANESE_KATAKANA_END    0x30FF
-
-/* japanese - katakana phonetic extensions */
-#define CTSVC_JAPANESE_KATAKANA_PHONETIC_EXTENSIONS_START 0x31F0
-#define CTSVC_JAPANESE_KATAKANA_PHONETIC_EXTENSIONS_END 0x31FF
-
-/* japanese - halfwidth and fullwidth forms */
-#define CTSVC_JAPANESE_HALFWIDTH_AND_FULLWIDTH_FORMS_START 0xFF00
-#define CTSVC_JAPANESE_HALFWIDTH_AND_FULLWIDTH_FORMS_END 0xFFEF
-
-/* japanese - halfwidth and fullwidth forms */
-#define CTSVC_ASCII_HALFWIDTH_AND_FULLWIDTH_FORMS_START 0xFF01
-#define CTSVC_ASCII_HALFWIDTH_AND_FULLWIDTH_FORMS_END 0xFF5E
-
-/* japanese - hiragana */
-#define CTSVC_JAPANESE_HIRAGANA_START 0x3040
-#define CTSVC_JAPANESE_HIRAGANA_END 0x309F
-
-static const char hangul_compatibility_choseong[] = {
-       0x31, 0x32, 0x34, 0x37, 0x38, 0x39, 0x40, 0x41,
-       0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
-       0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x65, 0x66, 0x6E,
-       0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
-       0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, 0x80,
-       0x81, 0x84, 0x85, 0x86, 0x00};
-
-static const unsigned char hangul_jamo_choseong[] = {
-       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x1A, 0x06, 0x07,           // to choseong 0x1100~0x115F
-       0x08, 0x21, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
-       0x10, 0x11, 0x12, 0x14, 0x15, 0x1C, 0x1D, 0x1E, 0x20,
-       0x22, 0x23, 0x27, 0x29, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
-       0x32, 0x36, 0x40, 0x47, 0x4C, 0x57, 0x58, 0x59, 0x00};
-
-static const char hangul_compatibility_jungseong[] = {
-       0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56,
-       0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E,
-       0x5F, 0x60, 0x61, 0x62, 0x63, 0x64, 0x87, 0x88,
-       0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x00};
-
-static const unsigned char hangul_jamo_jungseong[] = {
-       0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,   // to jungseong 0x1160~0x11A7
-       0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72,
-       0x73, 0x74, 0x75, 0x60, 0x84, 0x85, 0x88, 0x91, 0x92,
-       0x94, 0x9E, 0xA1, 0x00};
-
-static const char hangul_compatibility_jongseong[] = {
-       0x33, 0x35, 0x36, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E,
-       0x3F, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D,
-       0x6F, 0x70, 0x82, 0x83, 0x00};
-
-static const unsigned char hangul_jamo_jongseong[] = {
-       0xAA, 0xAC, 0xAD, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5,   // to jongseong 0x11A8~0x11FF
-       0xC7, 0xC8, 0xCC, 0xCE, 0xD3, 0xD7, 0xD9, 0xDF, 0xF1, 0xF2, 0x00};
-
-static const unsigned char japanese_halfwidth_katakana_to_hiragana[] = { // 0xff66 - 0xff9d
-       0x92, 0x41, 0x43, 0x45, 0x47, 0x49, 0x83, 0x85, 0x87, 0x63,
-       0x00, 0x42, 0x44, 0x46, 0x48, 0x4A, 0x4B, 0x4D, 0x4F, 0x51,
-       0x53, 0x55, 0x57, 0x59, 0x5B, 0x5D, 0x5F, 0x61, 0x64, 0x66,
-       0x68, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x72, 0x75, 0x78,
-       0x7B, 0x7E, 0x7F, 0x80, 0x81, 0x82, 0x84, 0x86, 0x88, 0x89,
-       0x8A, 0x8B, 0x8C, 0x8D, 0x8F, 0x93};
-
-static const unsigned char japanese_halfwidth_katakana_sonant_to_hiragana[] = { // 0xff76 - 0xff89
-       0x4C, 0x4E, 0x50, 0x52, 0x54, 0x56, 0x58, 0x5A, 0x5C, 0x5E,
-       0x60, 0x62, 0x65, 0x67, 0x69, 0x70, 0x73, 0x76, 0x79, 0x7C};
-
-static const unsigned char japanese_halfwidth_katakana_half_dullness_to_hiragana[] = { // 0xff8a - 0xff8e
-       0x71, 0x74, 0x77, 0x7A, 0x7D};
-
-int ctsvc_check_utf8(char c)
-{
-       if ((c & 0xff) < (128 & 0xff))
-               return 1;
-       else if ((c & (char)0xe0) == (char)0xc0)
-               return 2;
-       else if ((c & (char)0xf0) == (char)0xe0)
-               return 3;
-       else if ((c & (char)0xf8) == (char)0xf0)
-               return 4;
-       else if ((c & (char)0xfc) == (char)0xf8)
-               return 5;
-       else if ((c & (char)0xfe) == (char)0xfc)
-               return 6;
-       else
-               return CONTACTS_ERROR_INVALID_PARAMETER;
-}
-
-static inline bool is_chosung(UChar src)
-{
-       int unicode_value1 = 0;
-       int unicode_value2 = 0;
-
-       unicode_value1 = (0xFF00 & (src)) >> 8;
-       unicode_value2 = (0xFF & (src));
-
-       if (unicode_value1 == 0x31
-                       && (0x30 <= unicode_value2 && unicode_value2 <= 0x4e))
-               return true;
-       return false;
-}
-
-static inline bool is_hangul(UChar src)
-{
-       if ((0x1100 == (src & 0xFF00))       /* korean -Hangul Jamo*/
-                       || CTSVC_COMPARE_BETWEEN(CTSVC_JAMO_A_START, src, CTSVC_JAMO_A_END)
-                       || CTSVC_COMPARE_BETWEEN(CTSVC_JAMO_B_START, src, CTSVC_JAMO_B_END)
-                       || CTSVC_COMPARE_BETWEEN(CTSVC_HAN_C_START, src, CTSVC_HAN_C_END)
-                       || CTSVC_COMPARE_BETWEEN(CTSVC_HAN_HALF_START, src, CTSVC_HAN_HALF_END)
-                       || CTSVC_COMPARE_BETWEEN(CTSVC_HAN_SYLLABLES_START, src, CTSVC_HAN_SYLLABLES_END))
-               return true;
-       else
-               return FALSE;
-}
-
-static inline bool is_japanese(UChar src)
-{
-       if (CTSVC_COMPARE_BETWEEN(CTSVC_JAPANESE_KATAKANA_START, src, CTSVC_JAPANESE_KATAKANA_END)
-                       || CTSVC_COMPARE_BETWEEN(CTSVC_JAPANESE_KATAKANA_PHONETIC_EXTENSIONS_START, src, CTSVC_JAPANESE_KATAKANA_PHONETIC_EXTENSIONS_END)
-                       || CTSVC_COMPARE_BETWEEN(CTSVC_JAPANESE_HALFWIDTH_AND_FULLWIDTH_FORMS_START, src, CTSVC_JAPANESE_HALFWIDTH_AND_FULLWIDTH_FORMS_END)
-                       || CTSVC_COMPARE_BETWEEN(CTSVC_JAPANESE_HIRAGANA_START, src, CTSVC_JAPANESE_HIRAGANA_END))
-               return true;
-       else
-               return false;
-}
-
-static inline void hangul_compatibility2jamo(UChar *src)
-{
-       int unicode_value1 = 0;
-       int unicode_value2 = 0;
-
-       unicode_value1 = (0xFF00 & (*src)) >> 8;
-       unicode_value2 = (0xFF & (*src));
-
-       /* korean -Hangul Jamo halfwidth*/
-       if (CTSVC_COMPARE_BETWEEN(CTSVC_HAN_HALF_START, *src, CTSVC_HAN_HALF_END)) {
-               unicode_value1 = 0x31;
-
-               if (unicode_value2 < 0xBF)
-                       unicode_value2 -= 0x70;
-               else if (unicode_value2 < 0xC8)
-                       unicode_value2 -= 0x73;
-               else if (unicode_value2 < 0xD0)
-                       unicode_value2 -= 0x75;
-               else if (unicode_value2 < 0xD8)
-                       unicode_value2 -= 0x77;
-               else
-                       unicode_value2 -= 0x79;
-
-               (*src) = unicode_value1 << 8 | unicode_value2;
-       }
-
-       if (CTSVC_COMPARE_BETWEEN(CTSVC_HAN_C_START, *src, CTSVC_HAN_C_END)) {
-               char *pos;
-               if (NULL != (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))) {
-                       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))) {
-                       unicode_value1 = 0x11;
-                       unicode_value2 = hangul_jamo_jongseong[pos - hangul_compatibility_jongseong];
-                       (*src) = unicode_value1 << 8 | unicode_value2;
-               }
-       }
-}
-
-int ctsvc_convert_japanese_to_hiragana_unicode(UChar *src, UChar *dest, int dest_size)
-{
-       int i, j = 0, len = 0;
-
-       len = u_strlen(src);
-
-       for(i = 0; i < len; i++) {
-               int unicode_value1 = 0;
-               int unicode_value2 = 0;
-
-               unicode_value2 = (0xFF & (src[i]));
-
-               if (CTSVC_COMPARE_BETWEEN(CTSVC_JAPANESE_KATAKANA_START, src[i], CTSVC_JAPANESE_KATAKANA_END)) {
-                       unicode_value1 = 0x30;
-                       if ((0xa1 <= unicode_value2 && unicode_value2 <= 0xef)
-                                       || (unicode_value2 == 0xF2 || unicode_value2 == 0xF3)) {
-                               unicode_value2 -= 0x60;
-                               dest[j] = unicode_value1 << 8 | unicode_value2;
-                       }
-                       else {
-                               dest[j] = src[i];
-                       }
-               }
-               else if (CTSVC_COMPARE_BETWEEN(CTSVC_JAPANESE_HALFWIDTH_AND_FULLWIDTH_FORMS_START, src[i], CTSVC_JAPANESE_HALFWIDTH_AND_FULLWIDTH_FORMS_END)) {
-                       unicode_value1 = 0x30;
-                       if (i+1 < len && (0xFF & (src[i+1])) == 0x9E
-                                       && 0x76 <= unicode_value2 && unicode_value2 <= 0x89) {
-                               unicode_value2 = japanese_halfwidth_katakana_sonant_to_hiragana[unicode_value2 - 0x76];
-                               dest[j] = unicode_value1 << 8 | unicode_value2;
-                               i++;
-                       }
-                       else if (i+1 < len && (0xFF & (src[i])) == 0x9F
-                                       && 0x8a <= unicode_value2 && unicode_value2 <= 0x8e) {
-                               unicode_value2 = japanese_halfwidth_katakana_half_dullness_to_hiragana[unicode_value2 - 0x8a];
-                               dest[j] = unicode_value1 << 8 | unicode_value2;
-                               i++;
-                       }
-                       else if (0x66 <= unicode_value2 && unicode_value2 <= 0x9d) {
-                               unicode_value2 = japanese_halfwidth_katakana_to_hiragana[unicode_value2 - 0x66];
-                               dest[j] = unicode_value1 << 8 | unicode_value2;
-                       }
-                       else {
-                               dest[j] = src[i];
-                       }
-               }
-               else if (CTSVC_COMPARE_BETWEEN(CTSVC_ASCII_HALFWIDTH_AND_FULLWIDTH_FORMS_START, src[i], CTSVC_ASCII_HALFWIDTH_AND_FULLWIDTH_FORMS_END)) {
-                       unicode_value1 = 0x00;
-                       unicode_value2 = unicode_value2 - 0x20;
-                       dest[j] = unicode_value1 << 8 | unicode_value2;
-               } else {
-                       dest[j] = src[i];
-               }
-               j++;
-       }
-
-       dest[j] = 0x0;
-
-       return j;
-}
-
-int ctsvc_convert_japanese_to_hiragana(const char *src, char **dest)
-{
-       int ret = CONTACTS_ERROR_NONE;
-       UChar *tmp_result = NULL;
-       UChar *result = NULL;
-       UErrorCode status = 0;
-       int32_t size;
-
-       u_strFromUTF8(NULL, 0, &size, src, strlen(src), &status);
-       if (U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR) {
-               CTS_ERR("u_strFromUTF8 to get the dest length Fail(%s)", u_errorName(status));
-               ret = CONTACTS_ERROR_SYSTEM;
-               goto DATA_FREE;
-       }
-       status = U_ZERO_ERROR;
-       tmp_result = calloc(1, sizeof(UChar) * (size + 1));
-       u_strFromUTF8(tmp_result, size + 1, NULL, src, -1, &status);
-       if (U_FAILURE(status)) {
-               CTS_ERR("u_strFromUTF8 Fail(%s)", u_errorName(status));
-               ret = CONTACTS_ERROR_SYSTEM;
-               goto DATA_FREE;
-       }
-
-       result = calloc(1, sizeof(UChar) * (size + 1));
-
-       ctsvc_convert_japanese_to_hiragana_unicode(tmp_result, result, size + 1);
-
-       u_strToUTF8(NULL, 0, &size, result, -1, &status);
-       if (U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR) {
-               CTS_ERR("u_strToUTF8 to get the dest length Fail(%s)", u_errorName(status));
-               ret = CONTACTS_ERROR_SYSTEM;
-               goto DATA_FREE;
-       }
-
-       status = U_ZERO_ERROR;
-       *dest = calloc(1, sizeof(char)*(size+1));
-
-       u_strToUTF8(*dest, size + 1, &size, result, -1, &status);
-
-       if (U_FAILURE(status)) {
-               CTS_ERR("u_strToUTF8 Fail(%s)", u_errorName(status));
-               ret =  CONTACTS_ERROR_SYSTEM;
-               goto DATA_FREE;
-       }
-
-DATA_FREE:
-       free(tmp_result);
-       free(result);
-
-       return ret;
-}
-
-int ctsvc_check_language(UChar *word)
-{
-       int type;
-
-       int unicode_value1 = 0;
-       int unicode_value2 = 0;
-
-       unicode_value1 = (0xFF00 & (*word)) >> 8;
-       unicode_value2 = (0xFF & (*word));
-
-       CTS_VERBOSE("0x%x%x", unicode_value1, unicode_value2);
-
-       if (u_isdigit(word[0])) {
-               type = CTSVC_LANG_NUMBER;
-       }
-       else if (u_isalpha(word[0])) {
-               // refer to the uchar.h
-               // #define U_GC_L_MASK  (U_GC_LU_MASK|U_GC_LL_MASK|U_GC_LT_MASK|U_GC_LM_MASK|U_GC_LO_MASK)
-               // U_GC_LU_MASK : U_UPPERCASE_LETTER
-               // U_GC_LL_MASK : U_LOWERCASE_LETTER
-               // U_GC_LT_MASK : U_TITLECASE_LETTER
-               // U_GC_LM_MASK : U_MODIFIER_LETTER
-               // U_GC_LO_MASK : U_OTHER_LETTER
-
-               UBlockCode code = ublock_getCode(word[0]);
-               CTS_VERBOSE("Character unicode block is %d", code);
-
-               switch (code) {
-               //english
-               case UBLOCK_BASIC_LATIN:                                                        // = 1, /*[0000]*/
-               case UBLOCK_LATIN_1_SUPPLEMENT:                                 // =2, /*[0080]*/
-               case UBLOCK_LATIN_EXTENDED_A:                                           // =3, /*[0100]*/
-               case UBLOCK_LATIN_EXTENDED_B:                                           // =4, /*[0180]*/
-               case UBLOCK_LATIN_EXTENDED_ADDITIONAL:                  // =38, /*[1E00]*/
-                       type = CTSVC_LANG_ENGLISH;
-                       // type = CTSVC_LANG_CATALAN;   // ca, Spain - Catalan
-                       // type = CTSVC_LANG_GERMAN:     // de, Germany - German
-                       // type = CTSVC_LANG_BASQUE:    // eu, Spain - Basque
-                       // type = CTSVC_LANG_DUTCH;             // nl_Nl, Netherlands Dutch
-                       // type = CTSVC_LANG_FRENCH;    // fr_CA, fr_FR
-                       // type = CTSVC_LANG_ITALIAN:   // it_IT, Italy - Italian
-                       // type = CTSVC_LANG_PORTUGUESE:         // pt_BR, pt_PT, Portugal
-                       // type = CTSVC_LANG_SPANISH: // es_ES, es_US, El Salvador - Spanish
-                       // type =  CTSVC_LANG_NORWAY: // nb, Norway
-                       // type = CTSVC_LANG_DANISH: // da, Denmark - Danish
-                       // type = CTSVC_LANG_AZERBAIJAN: // az, Azerbaijan
-                       // type = CTSVC_LANG_ROMANIA: // ro, Romania
-                       // type = CTSVC_LANG_CZECH: // cs, Czech Republic - Czech
-                       // type = CTSVC_LANG_ESTONIAN: // et, Estonia - Estonian
-                       // type = CTSVC_LANG_FINNISH: // fi, Finland - Finnish
-                       // type = CTSVC_LANG_IRISH: // ga, Ireland - Irish
-                       // type = CTSVC_LANG_GALICIAN: // gl, Spain - Galician
-                       // type = CTSVC_LANG_HUNGARIAN: // hu, Hungary - Hungarian
-                       // type = CTSVC_LANG_SWEDISH: // sv, Finland - Swedish
-                       // type = CTSVC_LANG_SLOVENIAN: // sl, Slovenia - Slovenian
-                       // type = CTSVC_LANG_SLOVAK: // sk, Slovakia - Slovak
-                       // type = CTSVC_LANG_LITHUANIAN: // lt, Lithuania - Lithuanian
-                       // type = CTSVC_LANG_POLISH: // pl, Polish
-                       // type = CTSVC_LANG_LATVIAN: // lv, Latvia - Latvian
-                       // type = CTSVC_LANG_CROATIAN: // hr, Bosnia and Herzegovina - Croatian
-                       // type = CTSVC_LANG_ICELANDIC: // is, Iceland - Icelandic
-                       break;
-
-               //korean
-               case UBLOCK_HANGUL_JAMO:                                                // =30, /*[1100]*/
-               case UBLOCK_HANGUL_COMPATIBILITY_JAMO:          // =65, /*[3130]*/
-               case UBLOCK_HANGUL_SYLLABLES:                           // =74, /*[AC00]*/
-               case UBLOCK_HANGUL_JAMO_EXTENDED_A:             // = 180, /*[A960]*/
-               case UBLOCK_HANGUL_JAMO_EXTENDED_B:             // = 185, /*[D7B0]*/
-                       type = CTSVC_LANG_KOREAN;
-                       break;
-
-               // chainese
-               case UBLOCK_CJK_RADICALS_SUPPLEMENT:                     //=58, /*[2E80]*/
-               case UBLOCK_CJK_SYMBOLS_AND_PUNCTUATION:                 //=61, /*[3000]*/
-               case UBLOCK_ENCLOSED_CJK_LETTERS_AND_MONTHS:  //=68, /*[3200]*/
-               case UBLOCK_CJK_STROKES:                                                         // =130, /*[31C0]*/
-               case UBLOCK_CJK_COMPATIBILITY:                                           // =69, /*[3300]*/
-               case UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A: //=70, /*[3400]*/
-               case UBLOCK_CJK_UNIFIED_IDEOGRAPHS:                              //=71, /*[4E00]*/
-               case UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS:                //=79, /*[F900]*/
-               case UBLOCK_CJK_COMPATIBILITY_FORMS:                             //=83, /*[FE30]*/
-               case UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B :       // =94, /*[20000]*/
-               case UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT:         // =95, /*[2F800]*/
-               case UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C:         // =197, /*[2A700]*/
-               case UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D:         // =209, /*[2B740]*/
-                       type = CTSVC_LANG_CHINESE;
-                       break;
-
-               // japanese
-               case UBLOCK_HIRAGANA:                                                           // =62, /*[3040]*/
-               case UBLOCK_KATAKANA:                                                           // =63, /*[30A0]*/
-               case UBLOCK_KATAKANA_PHONETIC_EXTENSIONS:               // =107, /*[31F0]*/
-               case UBLOCK_JAVANESE:                                                           // =181, /*[A980]*/
-                       type = CTSVC_LANG_JAPANESE;
-                       break;
-
-               case UBLOCK_GREEK:                                              // =8, /*[0370]*/
-               case UBLOCK_GREEK_EXTENDED:                             // =39, /*[1F00]*/
-                       type = CTSVC_LANG_GREEK;
-                       break;
-
-               case UBLOCK_CYRILLIC:                                                           // =9, /*[0400]*/
-               case UBLOCK_CYRILLIC_EXTENDED_A:                                        // = 158, /*[2DE0]*/
-               case UBLOCK_CYRILLIC_EXTENDED_B:                                        // = 160, /*[A640]*/
-               case UBLOCK_CYRILLIC_SUPPLEMENTARY:                             // = 97, UBLOCK_CYRILLIC_SUPPLEMENT = UBLOCK_CYRILLIC_SUPPLEMENTARY, /*[0500]*/
-                       type = CTSVC_LANG_RUSSIAN;
-                       // type = CTSVC_LANG_BULGARIAN: // bg, Bulgaria - Bulgarian
-                       // type = CTSVC_LANG_MACEDONIA: // mk, Macedonia
-                       // type = CTSVC_LANG_KAZAKHSTAN: // kk, Kazakhstan
-                       // type = CTSVC_LANG_SERBIAN: // sr, Serbia - Serbian
-                       // type = CTSVC_LANG_UKRAINE: // uk, Ukraine
-                       break;
-
-               case UBLOCK_ARMENIAN:                                           //=10, /*[0530]*/
-                       type = CTSVC_LANG_ARMENIAN;
-                       break;
-               case UBLOCK_ARABIC:                                             //=12, /*[0600]*/
-                       type = CTSVC_LANG_ARABIC;
-                       break;
-               case UBLOCK_DEVANAGARI:                                 // =15, /*[0900]*/
-               case UBLOCK_DEVANAGARI_EXTENDED:                // = 179, /*[A8E0]*/:
-                       type = CTSVC_LANG_HINDI;
-                       break;
-               case UBLOCK_GEORGIAN:                                           //=29, /*[10A0]*/
-               case UBLOCK_GEORGIAN_SUPPLEMENT:                // = 135, /*[2D00]*/
-                       type = CTSVC_LANG_GEORGIAN;
-                       break;
-               case UBLOCK_OLD_TURKIC:                                 // = 191, /*[10C00]*/
-                       type = CTSVC_LANG_TURKISH;
-                       break;
-               case UBLOCK_HALFWIDTH_AND_FULLWIDTH_FORMS:              // =87, /*[FF00]*/      // hangul : FFA0 ~ FFDC
-               {
-                       if (CTSVC_COMPARE_BETWEEN((UChar)0xFF21, word[0], (UChar)0xFF3A)
-                               || CTSVC_COMPARE_BETWEEN((UChar)0xFF41, word[0], (UChar)0xFF5A))
-                               type = CTSVC_LANG_ENGLISH;
-                       else if (CTSVC_COMPARE_BETWEEN((UChar)0xFF10, word[0], (UChar)0xFF19))
-                               type = CTSVC_LANG_NUMBER;
-                       else if (CTSVC_COMPARE_BETWEEN((UChar)0xFF65, word[0], (UChar)0xFF9F))
-                               type = CTSVC_LANG_JAPANESE;
-                       else if (CTSVC_COMPARE_BETWEEN((UChar)0xFFA0, word[0], (UChar)0xFFDC))
-                               type = CTSVC_LANG_KOREAN;
-                       else
-                               type = CTSVC_LANG_OTHERS;
-                       break;
-               }
-               default:
-                       type = CTSVC_LANG_OTHERS;
-                       break;
-               }
-       }
-       else
-               type = CTSVC_LANG_OTHERS;
-
-       CTS_VERBOSE("language type = %d", type);
-       return type;
-}
-
-#define array_sizeof(a) (sizeof(a) / sizeof(a[0]))
-
-int ctsvc_check_language_type(const char *src)
-{
-       int length = 0;
-       char temp[10] = {0};
-       UChar tmp_result[2];
-       UChar result[10];
-       UErrorCode status = 0;
-       int32_t size;
-
-       if (src && src[0]) {
-               length = ctsvc_check_utf8(src[0]);
-               RETVM_IF(length <= 0, CONTACTS_ERROR_INTERNAL, "check_utf8 Fail");
-
-               strncpy(temp, src, length);
-
-               CTS_VERBOSE("temp(%s) src(%s) length(%d)", temp, src, length);
-
-               u_strFromUTF8(tmp_result, array_sizeof(tmp_result), NULL, temp, -1, &status);
-                       RETVM_IF(U_FAILURE(status), CONTACTS_ERROR_SYSTEM,
-                                       "u_strFromUTF8() Fail(%s)", u_errorName(status));
-
-               u_strToUpper(tmp_result, array_sizeof(tmp_result), tmp_result, -1, NULL, &status);
-               RETVM_IF(U_FAILURE(status), CONTACTS_ERROR_SYSTEM,
-                               "u_strToLower() Fail(%s)", u_errorName(status));
-
-               size = unorm_normalize(tmp_result, -1, UNORM_NFD, 0,
-                               (UChar *)result, array_sizeof(result), &status);
-               RETVM_IF(U_FAILURE(status), CONTACTS_ERROR_SYSTEM,
-                               "unorm_normalize(%s) Fail(%s)", src, u_errorName(status));
-
-               CTS_VERBOSE("0x%x%x", (0xFF00 & (tmp_result[0])) >> 8,  (0xFF & (tmp_result[0])));
-
-               return ctsvc_check_language(result);
-       }
-
-       return CONTACTS_ERROR_INVALID_PARAMETER;
-}
-
-int ctsvc_get_sort_type_from_language(int language)
-{
-       switch(language) {
-       case CTSVC_LANG_CHINESE:
-               return CTSVC_SORT_CJK;
-       case CTSVC_LANG_JAPANESE:
-               return CTSVC_SORT_JAPANESE;
-       case CTSVC_LANG_KOREAN:
-               return CTSVC_SORT_KOREAN;
-       case CTSVC_LANG_ENGLISH:
-               return CTSVC_SORT_WESTERN;
-       case CTSVC_LANG_NUMBER:
-               return CTSVC_SORT_NUMBER;
-       case CTSVC_LANG_RUSSIAN:
-       case CTSVC_LANG_BULGARIAN:
-       case CTSVC_LANG_MACEDONIA:
-       case CTSVC_LANG_KAZAKHSTAN:
-       case CTSVC_LANG_SERBIAN:
-       case CTSVC_LANG_UKRAINE:
-               return CTSVC_SORT_CYRILLIC;
-       case CTSVC_LANG_ARMENIAN:
-               return CTSVC_SORT_ARMENIAN;
-       case CTSVC_LANG_GREEK:
-               return CTSVC_SORT_GREEK;
-       case CTSVC_LANG_ARABIC:
-               return CTSVC_SORT_ARABIC;
-       case CTSVC_LANG_HINDI:
-               return CTSVC_SORT_DEVANAGARI;
-       case CTSVC_LANG_GEORGIAN:
-               return CTSVC_SORT_GEORGIAN;
-       case CTSVC_LANG_TURKISH:
-               return CTSVC_SORT_TURKISH;
-       case CTSVC_LANG_OTHERS:
-               return CTSVC_SORT_OTHERS;
-       default:
-               return CTSVC_SORT_WESTERN;
-       }
-}
-
-int ctsvc_get_name_sort_type(const char *src)
-{
-       UErrorCode status = 0;
-       UChar tmp_result[10];
-       int ret = CTSVC_SORT_OTHERS;
-       int char_len = 0;
-       int language_type;
-       char char_src[10];
-
-       char_len = ctsvc_check_utf8(src[0]);
-       RETVM_IF(char_len <= 0, CONTACTS_ERROR_INVALID_PARAMETER, "check_utf8 Fail");
-
-       memcpy(char_src, &src[0], char_len);
-       char_src[char_len] = '\0';
-
-       u_strFromUTF8(tmp_result, array_sizeof(tmp_result), NULL, char_src, -1, &status);
-       RETVM_IF(U_FAILURE(status), CONTACTS_ERROR_SYSTEM,
-                       "u_strFromUTF8() Fail(%s)", u_errorName(status));
-
-       language_type = ctsvc_check_language(tmp_result);
-       ret = ctsvc_get_sort_type_from_language(language_type);
-
-       return ret;
-}
-
-void ctsvc_extra_normalize(UChar *word, int32_t word_size)
-{
-       int i;
-       for (i=0;i<word_size;i++) {
-               // FF00 ~ FF60, FFE0~FFE6 : fullwidth -> halfwidth
-               if (CTSVC_COMPARE_BETWEEN((UChar)0xFF00, word[i], (UChar)0xFF60)) {
-                       int unicode_value1 = 0;
-                       int unicode_value2 = 0;
-                       unicode_value1 = 0x0;
-                       unicode_value2 = (0xFF & word[i]) + 0x20;
-                       word[i] = unicode_value1 << 8 | unicode_value2;
-               }
-               else if (is_hangul(word[i])) {
-                       hangul_compatibility2jamo(&word[i]);
-               }
-       }
-}
-
-const char *ctsvc_get_language_locale(int lang)
-{
-       switch(lang)
-       {
-       case CTSVC_LANG_AZERBAIJAN: // az, Azerbaijan
-               return "az";
-       case CTSVC_LANG_ARABIC: // ar, Bahrain - Arabic
-               return "ar";
-       case CTSVC_LANG_BULGARIAN: // bg, Bulgaria - Bulgarian
-               return "bg";
-       case CTSVC_LANG_CATALAN: // ca, Spain - Catalan
-               return "ca";
-       case CTSVC_LANG_CZECH: // cs, Czech Republic - Czech
-               return "cs";
-       case CTSVC_LANG_DANISH: // da, Denmark - Danish
-               return "da";
-       case CTSVC_LANG_GERMAN: // de, Germany - German
-               return "de";
-       case CTSVC_LANG_GREEK: // el, Greece - Greek
-               return "el";
-       case CTSVC_LANG_ENGLISH: // en, en_PH, en_US
-               return "en";
-       case CTSVC_LANG_SPANISH: // es_ES, es_US, El Salvador - Spanish
-               return "es";
-       case CTSVC_LANG_ESTONIAN: // et, Estonia - Estonian
-               return "et";
-       case CTSVC_LANG_BASQUE: // eu, Spain - Basque
-               return "eu";
-       case CTSVC_LANG_FINNISH: // fi, Finland - Finnish
-               return "fi";
-       case CTSVC_LANG_FRENCH: // fr_CA, fr_FR
-               return "fr";
-       case CTSVC_LANG_IRISH: // ga, Ireland - Irish
-               return "ga";
-       case CTSVC_LANG_GALICIAN: // gl, Spain - Galician
-               return "gl";
-       case CTSVC_LANG_HINDI: // hi, India - Hindi
-               return "hi";
-       case CTSVC_LANG_CROATIAN: // hr, Bosnia and Herzegovina - Croatian
-               return "hr";
-       case CTSVC_LANG_HUNGARIAN: // hu, Hungary - Hungarian
-               return "hu";
-       case CTSVC_LANG_ARMENIAN: // hy, Armenia - Armenian
-               return "hy";
-       case CTSVC_LANG_ICELANDIC: // is, Iceland - Icelandic
-               return "is";
-       case CTSVC_LANG_ITALIAN: // it_IT, Italy - Italian
-               return "it";
-       case CTSVC_LANG_JAPANESE: // ja_JP, japan
-               return "ja";
-       case CTSVC_LANG_GEORGIAN: // ka, Georgia - Georgian
-               return "ka";
-       case CTSVC_LANG_KAZAKHSTAN: // kk, Kazakhstan
-               return "kk";
-       case CTSVC_LANG_KOREAN: // ko, ko_KR
-               return "ko";
-       case CTSVC_LANG_LITHUANIAN: // lt, Lithuania - Lithuanian
-               return "lt";
-       case CTSVC_LANG_LATVIAN: // lv, Latvia - Latvian
-               return "lv";
-       case CTSVC_LANG_MACEDONIA: // mk, Macedonia
-               return "mk";
-       case CTSVC_LANG_NORWAY: // nb, Norway
-               return "nb";
-       case CTSVC_LANG_DUTCH: // nl_Nl, Netherlands Dutch
-               return "nl";
-       case CTSVC_LANG_POLISH: // pl, Polish
-               return "pl";
-       case CTSVC_LANG_PORTUGUESE: // pt_BR, pt_PT, Portugal
-               return "pt";
-       case CTSVC_LANG_ROMANIA: // ro, Romania
-               return "ro";
-       case CTSVC_LANG_RUSSIAN: // ru_RU, Russia
-               return "ru";
-       case CTSVC_LANG_SLOVAK: // sk, Slovakia - Slovak
-               return "sk";
-       case CTSVC_LANG_SLOVENIAN: // sl, Slovenia - Slovenian
-               return "sl";
-       case CTSVC_LANG_SERBIAN: // sr, Serbia - Serbian
-               return "sr";
-       case CTSVC_LANG_SWEDISH: // sv, Finland - Swedish
-               return "sv";
-       case CTSVC_LANG_TURKISH: // tr_TR, Turkey - Turkish
-               return "tr";
-       case CTSVC_LANG_UKRAINE: // uk, Ukraine
-               return "uk";
-       case CTSVC_LANG_CHINESE: // zh_CN, zh_HK, zh_SG, zh_TW
-               return "zh";
-       }
-
-       return "";
-}
-
-int ctsvc_get_language_type(const char *system_lang)
-{
-       // refer to the VCONFKEY_LANGSET
-       int type;
-
-       RETV_IF(NULL == system_lang, CTSVC_LANG_OTHERS);
-
-       // az, Azerbaijan
-       if (!strncmp(system_lang, "az", strlen("az")))
-               type = CTSVC_LANG_AZERBAIJAN;
-       // ar, Bahrain - Arabic
-       else if (!strncmp(system_lang, "ar", strlen("ar")))
-               type = CTSVC_LANG_ARABIC;
-       // bg, Bulgaria - Bulgarian
-       else if (!strncmp(system_lang, "bg", strlen("bg")))
-               type = CTSVC_LANG_BULGARIAN;
-       // ca, Spain - Catalan
-       else if (!strncmp(system_lang, "ca", strlen("ca")))
-               type = CTSVC_LANG_CATALAN;
-       // cs, Czech Republic - Czech
-       else if (!strncmp(system_lang, "cs", strlen("cs")))
-               type = CTSVC_LANG_CZECH;
-       // da, Denmark - Danish
-       else if (!strncmp(system_lang, "da", strlen("da")))
-               type = CTSVC_LANG_DANISH;
-       // de, Germany - German
-       else if (!strncmp(system_lang, "de", strlen("de")))
-               type = CTSVC_LANG_GERMAN;
-       // el, Greece - Greek
-       else if (!strncmp(system_lang, "el", strlen("el")))
-               type = CTSVC_LANG_GREEK;
-       // en, en_PH, en_US
-       else if (!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")))
-               type = CTSVC_LANG_SPANISH;
-       // et, Estonia - Estonian
-       else if (!strncmp(system_lang, "et", strlen("et")))
-               type = CTSVC_LANG_ESTONIAN;
-       // eu, Spain - Basque
-       else if (!strncmp(system_lang, "eu", strlen("eu")))
-               type = CTSVC_LANG_BASQUE;
-       // fi, Finland - Finnish
-       else if (!strncmp(system_lang, "fi", strlen("fi")))
-               type = CTSVC_LANG_FINNISH;
-       // fr_CA, fr_FR
-       else if (!strncmp(system_lang, "fr", strlen("fr")))
-               type = CTSVC_LANG_FRENCH;
-       // ga, Ireland - Irish
-       else if (!strncmp(system_lang, "ga", strlen("ga")))
-               type = CTSVC_LANG_IRISH;
-       // gl, Spain - Galician
-       else if (!strncmp(system_lang, "gl", strlen("gl")))
-               type = CTSVC_LANG_GALICIAN;
-       // hi, India - Hindi
-       else if (!strncmp(system_lang, "hi", strlen("hi")))
-               type = CTSVC_LANG_HINDI;
-       // hr, Bosnia and Herzegovina - Croatian
-       else if (!strncmp(system_lang, "hr", strlen("hr")))
-               type = CTSVC_LANG_CROATIAN;
-       // hu, Hungary - Hungarian
-       else if (!strncmp(system_lang, "hu", strlen("hu")))
-               type = CTSVC_LANG_HUNGARIAN;
-       // hy, Armenia - Armenian
-       else if (!strncmp(system_lang, "hy", strlen("hy")))
-               type = CTSVC_LANG_ARMENIAN;
-       // is, Iceland - Icelandic
-       else if (!strncmp(system_lang, "is", strlen("is")))
-               type = CTSVC_LANG_ICELANDIC;
-       // it_IT, Italy - Italian
-       else if (!strncmp(system_lang, "it", strlen("it")))
-               type = CTSVC_LANG_ITALIAN;
-       // ja_JP, japan
-       else if (!strncmp(system_lang, "ja", strlen("ja")))
-               type = CTSVC_LANG_JAPANESE;
-       // ka, Georgia - Georgian
-       else if (!strncmp(system_lang, "ka", strlen("ka")))
-               type = CTSVC_LANG_GEORGIAN;
-       // kk, Kazakhstan
-       else if (!strncmp(system_lang, "kk", strlen("kk")))
-               type = CTSVC_LANG_KAZAKHSTAN;
-       // ko, ko_KR
-       else if (!strncmp(system_lang, "ko", strlen("ko")))
-               type = CTSVC_LANG_KOREAN;
-       // lt, Lithuania - Lithuanian
-       else if (!strncmp(system_lang, "lt", strlen("lt")))
-               type = CTSVC_LANG_LITHUANIAN;
-       // lv, Latvia - Latvian
-       else if (!strncmp(system_lang, "lv", strlen("lv")))
-               type = CTSVC_LANG_LATVIAN;
-       // mk, Macedonia
-       else if (!strncmp(system_lang, "mk", strlen("mk")))
-               type = CTSVC_LANG_MACEDONIA;
-       // nb, Norway
-       else if (!strncmp(system_lang, "nb", strlen("nb")))
-               type = CTSVC_LANG_NORWAY;
-       // nl_Nl, Netherlands Dutch
-       else if (!strncmp(system_lang, "nl", strlen("nl")))
-               type = CTSVC_LANG_DUTCH;
-       // pl, Polish
-       else if (!strncmp(system_lang, "pl", strlen("pl")))
-               type = CTSVC_LANG_POLISH;
-       // pt_BR, pt_PT, Portugal
-       else if (!strncmp(system_lang, "pt", strlen("pt")))
-               type = CTSVC_LANG_PORTUGUESE;
-       // ro, Romania
-       else if (!strncmp(system_lang, "ro", strlen("ro")))
-               type = CTSVC_LANG_ROMANIA;
-       // ru_RU, Russia
-       else if (!strncmp(system_lang, "ru", strlen("ru")))
-               type = CTSVC_LANG_RUSSIAN;
-       // sk, Slovakia - Slovak
-       else if (!strncmp(system_lang, "sk", strlen("sk")))
-               type = CTSVC_LANG_SLOVAK;
-       // sl, Slovenia - Slovenian
-       else if (!strncmp(system_lang, "sl", strlen("sl")))
-               type = CTSVC_LANG_SLOVENIAN;
-       // sr, Serbia - Serbian
-       else if (!strncmp(system_lang, "sr", strlen("sr")))
-               type = CTSVC_LANG_SERBIAN;
-       // sv, Finland - Swedish
-       else if (!strncmp(system_lang, "sv", strlen("sv")))
-               type = CTSVC_LANG_SWEDISH;
-       // tr_TR, Turkey - Turkish
-       else if (!strncmp(system_lang, "tr", strlen("tr")))
-               type = CTSVC_LANG_TURKISH;
-       // uk, Ukraine
-       else if (!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")))
-               type = CTSVC_LANG_CHINESE;
-       else
-               type = CTSVC_LANG_OTHERS;
-
-       return type;
-}
-
-int ctsvc_get_chosung(const char *src, char *dest, int dest_size)
-{
-       int32_t size;
-       UErrorCode status = 0;
-       UChar tmp_result[10];
-       UChar result[10];
-       int chosung_len=0, count = 0, i=0, j=0;
-       int char_len = 0;
-       int str_len = strlen(src);
-       char temp[dest_size];
-
-       for (i=0;i<str_len;i+=char_len) {
-               char char_src[10];
-               char_len = ctsvc_check_utf8(src[i]);
-               RETVM_IF(char_len <= 0, CONTACTS_ERROR_INVALID_PARAMETER, "check_utf8 Fail");
-
-               memcpy(char_src, &src[i], char_len);
-               char_src[char_len] = '\0';
-
-               u_strFromUTF8(tmp_result, array_sizeof(tmp_result), NULL, char_src, -1, &status);
-               RETVM_IF(U_FAILURE(status), CONTACTS_ERROR_SYSTEM,
-                               "u_strFromUTF8() Fail(%s)", u_errorName(status));
-
-               u_strToUpper(tmp_result, array_sizeof(tmp_result), tmp_result, -1, NULL, &status);
-               RETVM_IF(U_FAILURE(status), CONTACTS_ERROR_SYSTEM,
-                               "u_strToLower() Fail(%s)", u_errorName(status));
-
-               size = unorm_normalize(tmp_result, -1, UNORM_NFD, 0,
-                               (UChar *)result, array_sizeof(result), &status);
-               RETVM_IF(U_FAILURE(status), CONTACTS_ERROR_SYSTEM,
-                               "unorm_normalize(%s) Fail(%s)", src, u_errorName(status));
-               ctsvc_extra_normalize(result, size);
-               u_strToUTF8(temp, dest_size, &size, result, -1, &status);
-               RETVM_IF(U_FAILURE(status), CONTACTS_ERROR_SYSTEM,
-                               "u_strToUTF8() Fail(%s)", u_errorName(status));
-               chosung_len = ctsvc_check_utf8(temp[0]);
-               RETVM_IF(chosung_len <= 0, CONTACTS_ERROR_INVALID_PARAMETER, "check_utf8 Fail");
-               memcpy(&dest[j], temp, chosung_len);
-               j += chosung_len;
-               count++;
-       }
-
-       dest[j] = '\0';
-
-       return count;
-}
-
-int ctsvc_get_korean_search_pattern(const char *src, char *dest, int dest_size)
-{
-       int32_t size;
-       UErrorCode status = 0;
-       UChar tmp_result[10];
-       UChar result[10];
-       int i=0, j=0, count=0;
-       int char_len = 0;
-       int str_len = strlen(src);
-
-
-       for (i=0;i<str_len;i+=char_len) {
-               char char_src[10];
-               char_len = ctsvc_check_utf8(src[i]);
-               RETVM_IF(char_len <= 0, CONTACTS_ERROR_INVALID_PARAMETER, "check_utf8 Fail");
-
-               memcpy(char_src, &src[i], char_len);
-               char_src[char_len] = '\0';
-
-               u_strFromUTF8(tmp_result, array_sizeof(tmp_result), NULL, char_src, -1, &status);
-               RETVM_IF(U_FAILURE(status), CONTACTS_ERROR_SYSTEM,
-                               "u_strFromUTF8() Fail(%s)", u_errorName(status));
-
-               if (is_chosung(tmp_result[0]))
-               {
-                       hangul_compatibility2jamo(tmp_result);
-
-                       u_strToUTF8(&dest[j], dest_size - j, &size, tmp_result, -1, &status);
-                       RETVM_IF(U_FAILURE(status), CONTACTS_ERROR_SYSTEM,
-                                       "u_strToUTF8() Fail(%s)", u_errorName(status));
-                       j += size;
-                       dest[j] = '*';
-                       j++;
-               }
-               else {
-                       u_strToUpper(tmp_result, array_sizeof(tmp_result), tmp_result, -1, NULL, &status);
-                       RETVM_IF(U_FAILURE(status), CONTACTS_ERROR_SYSTEM,
-                                       "u_strToUpper() Fail(%s)", u_errorName(status));
-                       size = unorm_normalize(tmp_result, -1, UNORM_NFD, 0,
-                                       (UChar *)result, array_sizeof(result), &status);
-                       RETVM_IF(U_FAILURE(status), CONTACTS_ERROR_SYSTEM,
-                                       "unorm_normalize(%s) Fail(%s)", src, u_errorName(status));
-                       ctsvc_extra_normalize(result, size);
-                       u_strToUTF8(&dest[j], dest_size - j, &size, result, -1, &status);
-                       RETVM_IF(U_FAILURE(status), CONTACTS_ERROR_SYSTEM,
-                                       "u_strToUTF8() Fail(%s)", u_errorName(status));
-                       j += size;
-
-               }
-               count++;
-       }
-
-       dest[j] = '\0';
-
-       return count;
-}
diff --git a/common/ctsvc_localize.h b/common/ctsvc_localize.h
deleted file mode 100755 (executable)
index f609c69..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Contacts Service Helper
- *
- * Copyright (c) 2010 - 2012 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.
- *
- */
-#ifndef __CTSVC_LOCALIZE_H__
-#define __CTSVC_LOCALIZE_H__
-
-#include <unicode/utypes.h>
-
-enum SORTTYPE{
-       CTSVC_SORT_OTHERS,              // 0??
-       CTSVC_SORT_NUMBER,              // 1
-       CTSVC_SORT_PRIMARY,     // 2
-       CTSVC_SORT_SECONDARY,   // 3
-       CTSVC_SORT_WESTERN,             // 4
-       CTSVC_SORT_KOREAN,              // 5
-       CTSVC_SORT_JAPANESE,    // 6
-       CTSVC_SORT_CJK,                 // 7
-       CTSVC_SORT_CYRILLIC,    // 8
-       CTSVC_SORT_GREEK,               // 9
-       CTSVC_SORT_ARMENIAN,    // 10
-       CTSVC_SORT_ARABIC,              // 11
-       CTSVC_SORT_DEVANAGARI,  // 12
-       CTSVC_SORT_GEORGIAN,    // 13
-       CTSVC_SORT_TURKISH,
-};
-
-int ctsvc_check_utf8(char c);
-int ctsvc_check_language(UChar *word);
-int ctsvc_check_language_type(const char *src);
-
-int ctsvc_get_name_sort_type(const char *src);
-int ctsvc_get_language_type(const char *system_lang);
-const char *ctsvc_get_language_locale(int lang);
-int ctsvc_get_sort_type_from_language(int language);
-
-void ctsvc_extra_normalize(UChar *word, int32_t word_size);
-
-int ctsvc_get_chosung(const char *src, char *dest, int dest_size);
-int ctsvc_convert_japanese_to_hiragana(const char *src, char **dest);
-int ctsvc_convert_japanese_to_hiragana_unicode(UChar *src, UChar *dest, int dest_size);
-int ctsvc_get_korean_search_pattern(const char *src, char *dest, int dest_size);
-
-#endif /* __CTSVC_LOCALIZE_H__ */
diff --git a/common/ctsvc_localize_ch.c b/common/ctsvc_localize_ch.c
deleted file mode 100755 (executable)
index ac963fb..0000000
+++ /dev/null
@@ -1,2275 +0,0 @@
-/*
- * Contacts Service Helper
- *
- * Copyright (c) 2010 - 2012 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 <unicode/uchar.h>
-#include <unicode/ustring.h>
-
-
-#include "ctsvc_internal.h"
-#include "ctsvc_localize_ch.h"
-
-
-#define CHINESE_COUNT                                          20902
-#define CHINESE_DUOYINZI_MAX_COUNT                     6
-
-
-#define CHINESE_UNICODE_START                          0x4E01
-#define CHINESE_UNICODE_END                                    0x9FA5
-
-static const char* const pinyin_spell_table[] = {
-       "yi","ding|zheng","kao|qiao|yu","qi","shang","xia","mo","wan|mo","zhang","san",
-       "shang","xia","qi|ji","bu|fou","yu","mian","gai","chou","chou","zhuan",
-       "qie|ju","pi","shi","shi","qiu","bing","ye","cong","dong","si",
-       "cheng","diu","qiu","liang","diu","you","liang","yan","bing","sang",
-       "gun","jiu","ge","ya","pan","zhong","ji","jie","feng","guan|kuang",
-       "chuan","chan","lin","zhuo","zhu","ba","wan","dan","wei","zhu",
-       "jing","li","ju","pie","fu","yi|ji","yi","nai","wu","jiu",
-       "jiu","tuo|zhe","me|yao|mB","yi","ho","zhi","wu","zha","hu","fa",
-       "le|yue","yin","ping","pang","qiao","hu","guai","cheng|sheng","cheng|sheng","yi",
-       "hao","zhe","mie|nie","jiu","qi","ye","xi","xiang","gai","jiu",
-       "hal","hol","shu","dou","shi","ji","nang","kal","keol","tol",
-       "mol","ol","mai","luan","cal","ru","xue","yan","phoi","sha",
-       "na","qian","sol","er","zu","ceor","qian|gan","zhi|luan","gui","qian",
-       "luan","lin","yi","jue","liao|le","ma","yu","zheng","shi","shi",
-       "er","chu","yu","kui","yu","yun","hu","qi","wu","jing",
-       "si","sui","gen","gen","ya","xie|suo","ya","qi|zhai","ya","ji|qi",
-       "tou","wang|wu","kang","da","jiao","hai","yi","chan","heng|peng","mu",
-       "ye","xiang","jing","ting","liang","xiang","jing","ye","qin|qing","bo",
-       "you","xie","dan","lian","duo","wei|men","ren","ren","ji","ji",
-       "wang","yi","shi|shen","ren","le","ding","ze","jin","pu","chou|qiu",
-       "ba","zhang","jin","jie","bing","reng","cong|zong","fo","jin|san","lun",
-       "bing","cang","zi|zai","shi","ta","zhang","fu","xian","xian","tuo|cha|duo",
-       "hong","tong","ren","qian","gan|han","yi|ge","bo","dai","ling","yi",
-       "chao","chang|zhang","sa","chang","yi","mu","men","ren","fan","chao|miao",
-       "yang|ang","qian","zhong","pi","wo","wu","jian","jia|jie","yao|fo","feng",
-       "cang","ren","wang","fen|bin","di","fang","zhong","qi","pei","yu",
-       "diao","dun","wen","yi","xin","kang","yi","ji","ai","wu",
-       "ji|qi","fu","fa","xiu|xu","jin","pi","dan","fu","tang","zhong",
-       "you","huo","hui|kuai","yu","cui","yun","san","wei","chuan|zhuan","che|ju",
-       "ya","qian","shang","chang","lun","cang|chen","xun","xin","wei","zhu",
-       "chi","xian|xuan","nu","bo|bai|ba","gu","ni","ni","xie","ban","xu",
-       "ling","zhou","shen","qu","si|ci","peng","si|shi","qie|jia|ga","pi","zhi",
-       "si","yi|chi","zheng","dian|tian","han|gan","mai","dan","zhu","bu","qu",
-       "bi","zhao|shao","ci","wei","di","zhu","zuo","you","yang","ti|ben",
-       "zhan|dian","he","bi","tuo","she","yu","yi|die","fo|fu|bi|bo","zuo","gou|kou",
-       "ning","tong","ni","xian","qu","yong","wa","qian","shi","ka",
-       "bao","pei","hui|huai","ge","lao","xiang","ge","yang","bai","fa",
-       "ming","jia","er|nai","bing","ji","hen","huo","gui","quan","tiao",
-       "jiao","ci","yi","shi","xing","shen","tuo","kan","zhi","gai",
-       "lai","yi","chi","kua","gong","li","yin","shi","mi","zhu",
-       "xu","you","an","lu","mou","er","lun","dong|tong","cha","chi",
-       "xun","gong","zhou","yi","ru","cun","xia","si","dai","lv",
-       "ta","jiao|yao","zhen","ce|ze|zhai","qiao","kuai","chai","ning","nong","jin",
-       "wu","hou","jiong","cheng|ting","zhen","zuo","hao","qin","lv","jv",
-       "shu|dou","ting","shen","tuo|tui","bo","nan","xiao","bian|pian","tui","yu",
-       "xi","cu","e","qiu","xu","guang","ku","wu","jun","yi",
-       "fu","liang","zu","qiao|xiao","li","yong","hun","jing","qian","san",
-       "pei","su","fu","xi","li","fu","ping","bao","yu|shu","si|qi",
-       "xia","xin|shen","xiu","yu","di","che|ju","chou","zhi","yan","liang|lia",
-       "li","lai","si","jian","xiu","fu","huo","ju","xiao","pai",
-       "jian","biao","chu|ti","fei","feng","ya","an","bei","yu","xin",
-       "bi","hu|chi","chang","zhi","bing","jiu","yao","cui|zu","liang|lia","wan",
-       "lai","cang","zong","ge","guan","bei","tian","shu","shu","men",
-       "dao","tan","jue","chui","xing","peng","tang|chang","hou","yi","qi",
-       "ti","gan","liang|jing","jie","sui","chang","jie","fang","zhi","kong",
-       "juan","zong","ju","qian","ni","lun","zhuo","wo|wei","luo","song",
-       "leng","hun","dong","zi","ben","wu","ju","nai","cai","jian",
-       "zhai","ye","zhi","sha","qing","ning","ying","cheng|chen","qian","yan",
-       "ruan","zhong|tong","chun","jia","ji|jie","wei","yu","bing","ruo","ti",
-       "wei","pian","yan","feng","tang|dang","wo","e","xie","che","sheng",
-       "kan","di","zuo","cha","ting","bei","xie","huang","yao","zhan",
-       "chou|qiao","an","you","jian","xu","zha","ci","fu","bi","zhi",
-       "zong","mian","ji","yi","xie","xun","cai|si","duan","ce|ze|zhai","zhen",
-       "ou","tou","tou","bei","zan|za|zBn","lv|lou","jie","wei","fen","chang",
-       "kui|gui","sou","zhi|si","su","xia","fu","yuan","rong","li","nu",
-       "yun","jiang|gou","ma","bang","dian","tang","hao","jie","xi","shan",
-       "qian|jian","que|jue","cang|chen","chu","san","bei","xiao","rong","yao","ta|tan",
-       "suo","yang","fa","bing","jia","dai","zai","tang","gu","bin",
-       "chu","nuo","can","lei","cui","yong","zao|cao","zong","peng","song",
-       "ao","chuan|zhuan","yu","zhai","qi|cou","shang","chuang","jing","chi","sha",
-       "han","zhang","qing","yan","di","xie","lv|lou","bei","piao|biao","jin",
-       "lian","lu","man","qian","xian","tan","ying","dong","zhuan","xiang",
-       "shan","qiao","jiong","tui","zun","pu","xi","lao","chang","guang",
-       "liao","qi","cheng|deng","zhan|zhuan|chan","wei","ji","bo","hui","chuan","tie|jian",
-       "dan","jiao|yao","jiu","seng","fen","xian","yu|ju","e|wu","jiao","jian",
-       "tong|zhuang","lin","bo","gu","xian","su","xian","jiang","min","ye",
-       "jin","jia|jie","qiao","pi","feng","zhou","ai","sai","yi","jun",
-       "nong","chan|tan|shan","yi","dang","jing","xuan","kuai","jian","chu","dan",
-       "jiao","sha","zai","can","bin","an","ru","tai","chou","chai",
-       "lan","ni|yi","jin","qian","meng","wu","ning","qiong","ni","chang",
-       "lie","lei","lv","kuang","bao","yu","biao","zan","zhi","si",
-       "you","hao","qing","chen","li","teng","wei","long","chu","chan",
-       "rang|xiang","shu","hui|xie","li","luo","zan","nuo","tang","yan","lei",
-       "nang","er","wu","yun","zan","yuan","xiong","chong","zhao","xiong",
-       "xian","guang","dui|rui|yue","ke","dui|rui|yue","mian","tu","chang|zhang","er","dui|rui|yue",
-       "er|ni","jin","tu","si","yan","yan","shi","shike","dang","qibnke",
-       "dou","gongfenPPPU","hboke","shen","dou","baike","jing","gongli","huang","ru",
-       "wang","nei","quan","liang","yu|shu","ba","gong","liu|lu","xi","han",
-       "lan","gong","tian","guan","xing","bing","qi|ji","ju","dian","zi|ci",
-       "bun","yang","jian","shou","ji","yi","ji","chan","jiong","mao",
-       "ran","nei|na","yuan","mao","gang","ran","ce","jiong","ce","zai",
-       "gua","jiong","mao","zhou","mao|mo","gou","xu","mian","mi","rong",
-       "yin|you","xie","kan","jun","nong","yi","shen","shi","guan","meng",
-       "zhong","zui","yuan","ming","kou","lin","fu","xie","mi","bing",
-       "dong","tai","gang","feng|ping","bing","hu","chong","jue","ya","kuang",
-       "ye","leng","pan","fa","min","dong","xian","lie","qia","jian",
-       "jing|cheng","sou","mei","tu","qi","gu","zhun","song","jing|cheng","liang",
-       "qing","diao","ling","dong","gan","jian","yin","cou","ai","li",
-       "cang","ming","zhun","cui","si","duo","jin","lin","lin","ning",
-       "xi","du","ji","fan","fan","fan","feng","ju","chu","yi kB|yi kB no bo li|tB ko",
-       "feng","mu","zhi","fu","feng","ping","feng","kai","huang","kai",
-       "gan","deng","ping","kan|qian","xiong","kuai","tu","ao|wa","chu","ji",
-       "dang","han","han","zao","dao","diao","dao","ren","ren","chuang",
-       "fen","qie","yi","ji","kan","qian","cun","chu","wen","ji",
-       "dan","xing","hua","wan","jue","li","yue","lie","liu","ze",
-       "gang","chuang","fu","chu","qu","diao","shan","min","ling","zhong",
-       "pan","bie","jie","jie","pao|bao","li","shan","bie","chan","jing",
-       "gua","geng","dao","chuang","kui","ku","duo","er","zhi","shua",
-       "quan|xuan","cha|sha","ci","ke","jie","gui","ci","gui","kai","duo",
-       "ji","ti","jing","dou","luo","ze","yuan","cuo","xiao|xue","kei|ke",
-       "la","qian","cha|sha","chuang","gua","jian","cuo","li","ti","fei",
-       "pou","chan","qi","chuang","zi","gang","wan","bao|bo","ji","duo",
-       "qing","yan|shan","du|zhuo","jian","ji","bao|bo","yan","ju","huo","sheng",
-       "jian","duo","zhi|duan","wu","gua","fu|pi","sheng","jian","ge","da|zha",
-       "kai","chuang","chuan","chan","tuan|zhuan","lu|jiu","li","peng","shan","piao",
-       "kou","jiao|chao","gua","qiao","jue","hua","zha","zhuo","lian","ju",
-       "pi","liu","gui","jiao|chao","gui","jian","jian","tang","huo","ji",
-       "jian","yi","jian","zhi","chan","zuan","mo","li","zhu","li",
-       "ya","quan","ban","gong","jia","wu","mai","lie","jin|jing","keng",
-       "xie|lie","zhi","dong","zhu|chu","nu","jie","qu","shao","yi","zhu",
-       "miao","li","jin|jing","lao","lao","juan","kou","yang","wa","xiao",
-       "mou","kuang","jie","lie","he","shi","ke","jin|jing","gao","bo|bei",
-       "min","chi","lang","yong","yong","mian","ke","xun","juan","qing",
-       "lu","bu","meng","chi","le|lei","kai","mian","dong","xu","xu",
-       "kan","wu","yi","xun","weng|yang","sheng","lao","mu","lu","piao",
-       "shi","ji","qin","jiang","jiao|chao","quan","xiang","yi","qiao","fan",
-       "juan","tong|dong","ju","dan","xie","mai","xun","xun","lv","li",
-       "che","rang|xiang","quan","bao","shao","yun","jiu","bao","gou","wu",
-       "yun","mo","xiong","gai","gai","bao","cong","yi","xiong","peng",
-       "ju","tao|yao","ge","pu","e","pao","fu","gong","da","jiu",
-       "gong","bi","hua","bei","nao","chi|shi","fang","jiu","yi","za",
-       "jiang","kang","jiang","kuang","hu","xia","qu","fan","gui","qie",
-       "zang|cang","kuang","fei","hu","yu","gui","kui|gui","hui","dan","kui|gui",
-       "lian","lian","suan","du","jiu","jue","xi","pi","qu|ou","yi",
-       "ke|qia","yan","bian","ni","qu|ou","shi","xun","qian","nian","sa",
-       "zu","sheng","wu","hui","ban","shi","xi","wan","hua","xie",
-       "wan","bei","zu|cu","zhuo","xie","dan|shan|chan","mai","nan|na","dan","ji",
-       "bo","shuai|lv","bu|bo","guan|kuang","bian","bu","zhan","qia|ka","lu","you",
-       "lu","xi","gua","wo","xie","jie","jie","wei","yang|ang","qiong",
-       "zhi","mao","yin","wei","shao","ji","que","luan","chi","juan",
-       "xie","xu","jin","que","wu","ji","e","qing","xi","san",
-       "chang|an|han","wei","e","ting","li","zhe|zhai","han|an","li","ya","ya",
-       "yan","she","di","zha|zhai","pang","ya","qie","ya","zhi|shi","ce",
-       "mang","ti","li","she","hou","ting","zui","cuo","fei","yuan",
-       "ce","yuan","xiang","yan","li","jue","sha|xia","dian","chu","jiu",
-       "jin","ao","gui","yan","si","li","chang","qian|lan","li","yan",
-       "yan","yuan","si|mou","gong|hong","lin|miao","rou|qiu","qu","qu","ke","lei",
-       "du","xian|xuan","zhuan","san","can|shen|cen|san","can|shen|cen|san","can|shen|cen|san","can|shen|cen|san","ai|yi","dai",
-       "you","cha","ji","you","shuang","fan","shou","guai","ba","fa",
-       "ruo","li","shu","zhuo|yi|li|jue","qu","shou","bian","xu","jia","pan",
-       "sou","ji","wei|yu","sou","die","rui","cong","kou","gu","ju|gou",
-       "ling","gua","tao|dao","kou","zhi","jiao","zhao|shao","ba","ding","ke",
-       "tai","chi","shi","you","qiu","po","ye|xie","hao","si","tan",
-       "chi","le","diao","ji","dug","hong","mie","xu|yu","mang","chi",
-       "ge","xuan|song","yao","zi","he|ge","ji","diao","dou|cun","tong","ming",
-       "hou","li","tu","xiang","zha","xia|he","ye","lv","a","ma|mB",
-       "ou","huo","yi","jun","chou","lin","tun","yin","fei","pi|bi",
-       "qin","qin","jie|ge","bu","fou|pi","ba","dun","fen","e|hua","han",
-       "ting","hang|keng","shun","qi","hong","zhi|zi","yin|shen","wu","wu","chao",
-       "na|ne","xue|chuo|jue","xi","chui","dou|ru","wen","hou","hou|hong|ou","wu|yu","gao",
-       "ya|yB","jun","lv","e","ge","wen","dai","qi","cheng","wu",
-       "gao","fu","jiao","hong","chi","sheng","na|ne","tun|tian","fu|?","yi",
-       "dai","ou","li","bei|bai","yuan|yun","wai|he|wo|wa|gua|guo","hua|qi","qiang","wu","e",
-       "shi","juan","pen","wen|min","ne","mou|m","ling","ran","you","di",
-       "zhou","shi","zhou","tie|che","xi","yi","qi|zhi","ping","zi|ci","gua|gu",
-       "zi|ci","wei","xu|hou|gou","he|a|ke","nao","xia","pei","yi","xiao|hao","shen",
-       "hu","ming","da|dan","qu","ju|zui","xian|gan","za","tuo","duo","pou",
-       "pao","bi","fu","yang","he","zha|za","he|huo|hu","hai","jiu","yong",
-       "fu","da","zhou","wa","ka","gu","ka|ga","zuo","bu","long",
-       "dong","ning","tuo","si","xian","huo","qi","er","e","guang",
-       "zha","die|xi","yi","lie","zi","mie","mi","zhi","yao","ji|xi|qia",
-       "zhou","ka|luo|lo|ge","shu|xun","zan|za|zBn","xiao","ke|hai","hui","kua","huai|shi","tao",
-       "xian","e|an","xuan","xiu","wai|he|wo|wa|gua|guo","yan|ye","lao","yi","ai","pin",
-       "shen","tong","hong","xiong","duo","wa|wB","ha","zai","you","die|di",
-       "pai","xiang","ai","gen|hen","kuang","ya","da","xiao","bi","yue|hui",
-       "nian","hua","xing","kuai","duo","po","ji|jie|zhai","nong","mou","yo",
-       "hao","yuan|yun","long","pou","mang","ge","o","chi","shao","li",
-       "na|nei|nB|ne","zu","he","ku","xiao","xian","lao","po|ba|bo","zhe","zha",
-       "liang|lang","ba","mie","lie|lv","sui","fu","bu","han","heng|hng","geng",
-       "chuo|yue","ge|jia","you","yan","gu","gu","bei|bai","han","suo","chun",
-       "yi","ai","jia|qian","tu","dan|xian|yan","wan","li","xi","tang","zuo",
-       "qiu","che","wu","zao","ya","dou","qi","di","qin","ma",
-       "ma","gong|hong","dou","ge","lao","liang","suo","zao","huan","leng",
-       "sha|shB","ji","zu","wo|wei","feng","jin|yin","hu|xia","qi","shou","wei",
-       "shua","chang","er|wa","li","qiang","an","jie|ze|zuo","yo","nian","yu",
-       "tian","lai","sha","xi","tuo","hu","ai","zhou|zhao|tiao","gou","ken",
-       "zhuo","zhuo|zhao","shang","di","heng","lan|lin","a","cai","qiang","zhun|tun|xiang|dui",
-       "wu","wen","cui|qi","sha|jie|die|ti","gu","qi","qi","tao","dan","dan",
-       "yue|wa","zi|ci","bi|tu","cui","chuo|chuai","he","ya","qi","zhe","fei",
-       "liang","xian","pi","sha","lB|la","ze","qing|ying","gua","pa","ze|shi",
-       "se","zhuan","nie","guo","luo","yan","di","quan","tan|chan|tuo","bo",
-       "ding","lang","xiao","ju","tang","chi","ti","an","jiu","dan",
-       "ka","yong","wei","nan","shan","yu","zhe","la","jie","hou",
-       "han","die|zha","zhou","chai","wai","nuo|re","huo|guo|xu","yin","zan|za|zBn","yao",
-       "o|wo","mian","hu","yun","chuan","hui","huan","huan|yuan|xuan|he","xi","he|ye",
-       "ji","kui","zhong|chuang","wei","sha","xu","huang","duo|zha","yan","xuan",
-       "liang","yu","sang","chi","qiao|jiao","yan","dan|shan|chan","pen|ben","can|sun|qi","li",
-       "yo","zha|cha","wei","miao","ying","pen","pbo","kui","xi","yu",
-       "jie","lou","ku","zao|qiao","hu","ti","yao","he|xiao|hu","sha|a","xiu",
-       "qiang","se","yong","su","gong|hong","xie","yi|ai","suo","ma|mB","cha",
-       "hai","ke","ta|da","sang","chen","ru","sou","wa|gu","ji","beng|pang",
-       "wu","xian|qian|qie","shi","ge","zi","jie","lao","weng","wa","si",
-       "chi","hao","suo","jia","hai|hei","suo","qin","nie","he","zi",
-       "sai","ng","ge","na","dia","ai","qiang","tong","bi","ao",
-       "ao","lian","zui|sui","zhe|zhu","mo","sou","sou","tan","di","qi",
-       "jiao","chong","jiao|dao","kai|ge","tan","shan|can","cao","jia","ai","xiao",
-       "piao","lou","ga","gu","xiao|jiao","hu","hui","guo","ou","xian",
-       "ze","chang","xu|shi","po","de|dei","ma","ma","hu","le","du",
-       "ga","tang","ye","beng","ying","sai","jiao","mi","xiao","hua",
-       "mai","ran","zuo","peng","lao","xiao","ji","zhu","chao|zhao","kui",
-       "zui","xiao","si","hao","fu|?","liao","qiao","xi","chu|xu|shou","tan|chan",
-       "dan|tan","hei|mo","xun","e","zun","fan|bo","chi","hui","zan","chuang",
-       "cu|za|he","dan","jue","tun|kuo","ceng","jiao","ye","xi","qi","hao",
-       "lian","xu|shi","deng","hui","yin","pu","jue","qin","xun","nie",
-       "lu","si","yan","ying","da","zhan","o","zhou|zhuo","jin","nong",
-       "yue|hui","xie","qi","e","zao","yi","shi","jiao|qiao|chi","yuan","ai",
-       "yong","jue|xue","kuai","yu","pen","dao","ga","xin|hen","dun","dang",
-       "xin","sai","pi","pi","yin","zui","ning","di","lan","ta",
-       "huo|o","ru","hao","he|xia","yan","duo","xiu|pi","zhou|chou","ji|jie|zhai","jin",
-       "hao","ti","chang","xun","me","ca|cha","ti","lu","hui","bo|pao|bao",
-       "you","nie","yin","hu","mei|me|mo","hong","zhe","li","liu","xie|hai",
-       "nang","xiao","mo","yan","li","lu","long","po","dan","chen",
-       "pin","pi","xiang","huo","me","xi","duo","ku","yan","chan",
-       "ying","rang","dian","la","ta","xiao","jiao|jue","chuo","huan","huo",
-       "zhuan","nie","xiao","ca","li","chan","chai","li","yi","luo",
-       "nang","za|zan|can","su","xi","zeng","jian","yan|za|nie","zhu","lan","nie",
-       "nang","ramo","luo","wei|guo","hui","yin","qiu","si","nin","jian|nan",
-       "hui","xin","yin","nan","tuan","tuan","dun|tun","kang","yuan","jiong",
-       "pian","yun","cong","hu","hui","yuan","e","guo","kun","cong",
-       "wei|tong","tu","wei","lun","guo","qun","ri","ling","gu","guo",
-       "tai","guo","tu","you","guo","yin","hun","pu","yu","han",
-       "yuan","lun","quan|juan","yu","qing","guo","chuan|chui","wei","yuan","quan|juan",
-       "ku","pu","yuan","yuan","ya","tuan","tu","tu","tuan","lve",
-       "hui","yi","huan|yuan","luan","luan","tu","ya","tu","ting","sheng",
-       "pu","lu","kuai","ya","zai","wei|xu","ge","yu|zhun","wu","gui",
-       "pi","yi","di|de","qian|su","qian","zhen","zhuo","dang","qia","xia",
-       "shan","kuang","chang","qi|yin","nie","mo","ji","jia","zhi","zhi",
-       "ban","xun","yi","qin","mei|fen","jun","rong|keng","tun|dun","fang","ben|fen",
-       "ben","tan","kan","huai|pei|pi","zuo","keng","bi","jing","di|lan","jing",
-       "ji","kuai","di","jing","jian","tan","li","ba","wu","fen",
-       "zhui","po","pan|ban","tang","kun","qu","tan","zhi","tuo","gan",
-       "ping","dian","gua","ni","tai","pi","jiong","yang","fo","ao",
-       "lu","qiu","mu","ke","gou","xue","fa","di|chi","che","ling",
-       "zhu","fu","hu","zhi","chui","la","long","long","lu","ao",
-       "dai","pao","min","xing","dong|tong","ji","he","lv","ci","chi",
-       "lei","gai","yin","hou","dui","zhao","fu","guang","yao","duo",
-       "duo","gui","cha","yang","yin","fa","gou","yuan","die","xie",
-       "ken","shang","shou","e","bing","dian","hong","ya","kua","da",
-       "ka","dang","kai","hang","nao","an","xing","xian","yuan|huan","bang",
-       "pou|fu","ba","yi","yin","han","xu","chui","cen","geng","ai",
-       "beng|feng","di|fang","que|jue","yong","jun","xia|jia","di","mai|man","lang","juan",
-       "cheng","yan|shan","qin|jin","zhe","lie","lie","pu|bu","cheng","hua","bu",
-       "shi","xun","guo","jiong","ye","nian","di","yu","bu","ya",
-       "quan","sui|su","pi","qing|zheng","wan","ju","lun","zheng|cheng","kong","chong|shang",
-       "dong","dai","tan","an","cai","chu|tou","beng","xian|kan","zhi","duo",
-       "yi|shi","zhi","yi","pei","ji","zhun","qi","sao","ju","ni",
-       "ku","ke","tang","kun","ni","jian","dui","jin","gang","yu",
-       "e","peng|beng","gu","tu","leng","fang","ya","qian|zan|jian","kun","an",
-       "shen","duo|hui","nao","tu","cheng","yin","huan","bi","lian","guo",
-       "die","zhuan","hou","bao|bu|pu","bao","yu","di","mao|mou|wu","jie","ruan",
-       "e|ai|ye","geng","kan","zong","yu","huang","e","yao","yan","bao",
-       "ji","mei","chang","du","tuo","yin","feng","zhong","jie","jin",
-       "feng","gang","chuan","jian","ping","lei","jiang","huang","leng","duan",
-       "wan","xuan","xi","ji","kuai","ying","ta","cheng","yong","kai",
-       "su","su","shi","mi","ta","weng","cheng","tu","tang","que",
-       "zhong","li","peng","bang","sai|se","zang","dui","tian","wu","zheng",
-       "xun","ge","zhen","ai","gong","yan","xian","tian|zhen","yuan","wen",
-       "xie","liu","hai","lang","chang","peng","beng","chen","lu","lu",
-       "ou|qiu","qian|zan|jian","mei","mo","zhuan|tuan","shuang","shu","lou","chi","man",
-       "biao","jing","qi","shu","zhi|di","zhang","kan","yong","dian","chen",
-       "zhi|zhuo","xi","guo","qiang","jin","shang","shang","mu","cui","yan",
-       "ta","zeng","qian","qiang","liang","wei","zhui","qiao","zeng","xu",
-       "shan","shan","fa","pu","kuai|tui","tuan|dong","fan","qiao|que","mo","dun",
-       "dun","zun|dun","di","sheng","duo|hui","duo","tan","deng","wu","fen",
-       "huang","tan","da","ye","zhu","jian","ao","qiang","ji","qiao|ao",
-       "ken","yi|tu","pi","bi","dian","jiang","ye","yong","xue|bo|jue","tan",
-       "lan","ju","huai","dang","rang","qian","xun","xian|lan","xi","he",
-       "ai","ya","dao","hao","ruan","jin","lei","kuang","lu","yan",
-       "tan","wei","huai","long","long","rui","li","lin","rang","chan",
-       "xun","yan","lei","ba","wan","shi","ren","san","zhuang","zhuang",
-       "sheng","yi","mai","ke|qiao","zhu","zhuang","hu","hu","kun","yi",
-       "hu","xu","kun","shou","mang","dun","shou","yi","zhi|zhong","gu|ying",
-       "chu","jiang|xiang","feng|pang","bei","zhai","bian","sui","qun","ling","fu",
-       "cuo","xia","xiong|xuan","xie","nao","xia","kui","xi","wai","yuan|wan",
-       "mao|wan","su","duo","duo","ye","qing","yi","gou","gou","qi",
-       "meng","meng","yin","huo","chen","da|dai","ce","tian","tai","fu",
-       "guai","yao","yang","hang|ben","gao","shi","tao|ben","tai","tou","yan|tao",
-       "bi","yi","kua","jia|ga|xia","duo","hua","kuang","yun","jia|ga|xia","ba",
-       "en","lian","huan","di|ti","yan","pao","juan","qi|ji","nai","feng",
-       "xie","fen","dian","quan|juan","kui","zou","huan","qi|qie|xie","kai","she|chi|zha",
-       "ben","yi","jiang","tao","zang|zhuang","ben","xi","huang","fei","diao",
-       "xun|zhui","beng","dian","ao","she","weng","po|ha|tai","ao|yu","wu","ao|yu",
-       "jiang","lian","duo","yun","jiang","shi","fen","huo","bi","luan",
-       "duo|che","nv","nu","ding|tian","nai","qian","jian","ta|jie","jiu","nuan",
-       "cha","hao","xian","fan","ji","shuo","ru","fei|pei","wang","hong",
-       "zhuang","fu","ma","dan","ren","fu|you","jing","yan","hai|jie","wen",
-       "zhong","pa","du","ji","keng|hang","zhong","yao","jin","yun","miao",
-       "fou|pei|pi","chi","yue|jue","zhuang","niu","yan","na|nan","xin","fen","bi",
-       "yu","tuo","feng","wan|yuan","fang","wu","yu","gui","du","ba",
-       "ni","zhou","zhuo","zhao","da","ni|nai","yuan","tou","xian|xuan|xu","zhi|yi",
-       "e","mei","mo","qi","bi","shen","qie","e","he","xu",
-       "fa","zheng","min","ban","mu","fu","ling","zi","zi","shi",
-       "ran","shan","yang","gan","jie","gu","si","xing","wei","zi",
-       "ju","shan","pin","ren","yao","dong","jiang","shu","ji","gai",
-       "xiang","hua|huo","juan","jiao|xiao","gou|du","mu|lao","jian","jian","yi","nian",
-       "zhi","zhen","ji","xian","heng","guang","jun|xun","kua|hu","yan","ming",
-       "lie","pei","e","you","yan","cha","shen|xian","yin","shi","gui",
-       "quan","zi","song","wei","hong","wa","lou","ya","rao","jiao",
-       "luan","ping","xian","shao","li","cheng|sheng","xie","mang","fu","suo",
-       "wu|mu","wei","ke","chuo|lai","chuo","ting","niang","xing","nan","yu",
-       "na|nuo","pou|bi","nei|sui","juan","shen","zhi","han","di","zhuang","e",
-       "pin","tui","man","mian","wu|yu","yan","wu","xi|ai","yan","yu",
-       "si","yu","wa","li","xian","ju","qu","zhui|shui","qi","xian",
-       "zhuo","dong","chang","lu","ai|e","e","e","lou","mian","cong",
-       "pou|pei|bu","ju","po","cai","ling","wan","biao","xiao","shu","qi",
-       "hui","fu|fan","wo","wo","tan","fei","fei","jie","tian","ni",
-       "quan|juan","jing","hun","jing","qian|jin","dian","xing","hu","wan|wa","lai",
-       "bi","yin","zhou|chou","chuo|nao","fu","jing","lun","an|n<e","lan","hun|kun",
-       "yin","ya","ju","li","dian","xian","huB|dB tBi","hua","ying","chan",
-       "shen","ting","dang|yang","yao","wu","nan","ruo|chuo","jia","tou|yu","xu",
-       "yu","wei","di|ti","rou","mei","dan","ruan|nen","qin","hui","wo",
-       "qian","chun","miao","fu","jie","duan","yi|pei","zhong","mei","huang",
-       "mian","an","ying","xuan","jie","wei","mei","yuan","zheng","qiu",
-       "ti","xie","tuo|duo","lian","mao","ran","si","pian","wei","wa",
-       "cu","hu","ao|yun|wo","jie","bao","xu","tou|yu","gui","chu|zou","yao",
-       "pi","xi","yuan","ying","rong","ru","chi","liu","mei","pan",
-       "ao|yun|wo","ma","gou","kui","qin|shen","jia","sao","zhen","yuan","jie|suo",
-       "rong","ming","ying","ji","su","niao","xian","tao","pang","lang",
-       "nao","biao","ai","pi","pin","yi","piao","yu","lei","xuan",
-       "man","yi","zhang","kang","yong","ni","li","di","gui","yan",
-       "jin","zhuan","chang","ze","han|nan","nen","lao","mo","zhe","hu",
-       "hu","ao","nen","qiang","ma","pie","gu","wu","qiao","tuo",
-       "zhan","miao","xian","xian","mo","liao","lian","hua","gui","deng",
-       "zhi","xu","yi","hua","xi","kui","rao","xi","yan","chan",
-       "jiao","mei","fan","fan","xian|yan|jin","yi","hui","jiao","fu","shi",
-       "bi","shan","sui","qiang","lian","huan|xuan|qiong","xin","niao","dong","yi",
-       "can","ai","niang","ning","mo","tiao","chou","jin","ci","yu",
-       "pin","rong","ru","nai","yan","tai","ying","qian","niao","yue",
-       "ying","mian","bi","mo","shen","xing","ni","du","liu","yuan",
-       "lan","yan","shuang","ling","jiao","niang","lan","xian|qian","ying","shuang",
-       "xie|hui","huan|quan","mi","li","luan","yan","zhu|chuo","lan","zi","jie",
-       "jue","jue","kong","yun","zi|ma","zi","cun","sun|xun","fu","bei",
-       "zi","xiao","xin","meng","si","tai","bao","ji","gu","nu",
-       "xue","you","zhuan","hai","luan","sun|xun","nao","mie","cong","qian",
-       "shu","chan|can","ya","zi","ni","fu","zi","li","xue","bo",
-       "ru","nai","nie","nie","ying","luan","mian","ning","rong","ta",
-       "gui","zhai","qiong","yu","shou","an","tu|jia","song","wan","rou",
-       "yao","hong","yi","jing","zhun","mi|fu","zhu","dang","hong","zong",
-       "guan","zhou","ding","wan|yuan","yi","bao","shi","shi","chong","shen",
-       "ke","xuan","shi","you","huan","yi","tiao","shi","xian","gong",
-       "cheng","qun","gong","xiao","zai","zha","bao|shi","hai","yan","xiao",
-       "jia|jiB","cai","chen","rong","huang","mi","kou","kuan","bin","su|xiu",
-       "cai","zan","ji","yuan","ji","yin","mi","kou","qing","he",
-       "zhen","jian","fu","ning","bing","huan","mei","qin","han","yu",
-       "shi","ning","jin|qin","ning","zhi","yu","bao","kuan","ning","qin",
-       "mo","cha","ju|lou","gua","qin","hu","wu","liao","shi","ning",
-       "zhai","shen","wei","xie","kuan","hui","liao","jun","huan","yi",
-       "yi","bao","qin","chong","bao","feng","cun","dui","si","xun",
-       "dao","l<e|luo","dui","shou","po","feng","zhuan","fu","she|ye|yi","kei|ke",
-       "jiang","jiang","zhuan","wei|yu","zun","xun","shu|zhu","dui","dao","xiao",
-       "jie|ji","shao","er","er","er","ga","jian","shu","chen","shang",
-       "shang","mo","ga","chang","liao","xian","xian","hun","you","wang",
-       "you","liao","liao","yao","long|mang|meng|pang","wang","wang","wang","ga","yao",
-       "duo","kui","zhong","jiu","gan","gu","gan","tui","gan","gan",
-       "shi","yin","chi|che","kao","ni","jin","wei|yi","niao|sui","ju","pi",
-       "ceng","xi","bi","ju","jie","tian","qu","ti","jie","wu",
-       "diao","shi","shi","ping|bing","ji","xie","zhen","xi","ni","zhan",
-       "xi","wei","man","e","lou","ping|bing","ti","fei","shu|zhu","xie|ti",
-       "tu","lv","lv","xi","ceng","lv","ju","xie","ju","jue",
-       "liao","jue","shu|zhu","xi","che|cao","tun|zhun","ni|ji","shan","wa","xian",
-       "li","an","hui","hui","hong|long","yi","qi","ren","wu","han|an",
-       "shen","yu","chu","sui","qi|kai","yin","yue","ban","yao","ang",
-       "ya","wu","jie","e","ji","qian","fen","wan","qi","cen",
-       "qian","qi","cha","jie","qu","gang","xian","ao","lan","dao",
-       "ba","zuo","zuo","yang","ju","gang","ke","gou","xue","po",
-       "li","tiao","ju","yan","fu","xiu","jia","ling","tuo","pi",
-       "ao","dai","kuang","yue","qu","hu","po","min","an","tiao",
-       "ling","di","ping","dong","zBi|ze mo","kui","xiu","mao","tong","xue",
-       "yi","bian","he","ke|ba","luo","e","fu|nie","xun","die","lu",
-       "en","er","gai","quan","tong|dong","yi","mu","shi","an","wei",
-       "huan","zhi|shi","mi","li","fa","tong","wei","you","qia","xia",
-       "li","yao","jiao|qiao","zheng","luan","jiao","e","e","yu","xie|ye",
-       "bu","qiao","qun","feng","feng","nao","li","you","xian","rong",
-       "dao","shen","cheng","tu","geng","jun","gao","xia","yin","wu",
-       "lang","kan","lao","lai","xian","que","kong","chong","chong","ta",
-       "lin","hua","ju","lai","qi","min","kun","kun","zu|cui","gu",
-       "cui","ya","ya","gang","lun","lun","ling","jue","duo","zheng",
-       "guo","yin","dong","han","zheng","wei","xiao","pi|bi","yan","song",
-       "jie","beng","zu","jue","dong","zhan|chan","gu","yin","zi","ze",
-       "huang","yu","wai|wei","yang|dang","feng","qiu","yang","ti","yi","zhi|shi",
-       "shi|die","zai","yao","e","zhu","kan|zhan","lv","yan","mei","han",
-       "ji","ji","huan","ting","sheng","mei","qian|kan","wu|mao","yu","zong",
-       "lan","ke|jie","yan","yan","wei","zong","cha","sui","rong","ke",
-       "qin","yu","qi","lou","tu","cui","xi","weng","cang","dang|tang",
-       "rong|ying","jie","kai|ai","liu","wu","song","kao|qiao","zi","wei","beng",
-       "dian","cuo","qin|qian","yong","nie","cuo","ji","shi","ruo","song",
-       "zong","jiang","liao","kang","yan","die|di","cen","ding","tu","lou",
-       "zhang","zhan|chan","zhan|chan","ao","cao","qu","qiang","wei","zui","dao",
-       "dao","xi","yu","pi|pei","long","xiang","ceng","bo","qin","jiao",
-       "yan","lao","zhan","lin","liao","liao","qin","deng","tuo","zun",
-       "jiao|qiao","jue|gui","yao","jiao","yao","jue","zhan|shan","yi","xue","nao",
-       "ye","ye","yi","nie","xian","ji","xie|jie","ke|jie","gui|xi|juan","di",
-       "ao","zui","wei","ni","rong","dao","ling","jie","yu","yue",
-       "yin","ru","jie","li|lie","gui|xi|juan","long","long","dian","ying|hong","xi",
-       "ju","chan","ying","kui","yan","wei","nao","quan","chao","cuan",
-       "luan","dian","dian","nie","yan","yan","yan","kui","yan","chuan",
-       "kuai","chuan","zhou","huang","jing|xing","xun","chao","chao","lie","gong",
-       "zuo","qiao","ju","gong","ge","wu","pu","pu","cha|chai|ci","qiu",
-       "qiu","ji","yi","si","ba","zhi","zhao","xiang|hang","yi","jin",
-       "xun","juan","pa","xun","jin","fu","za","bi","shi","bu",
-       "ding","shuai","fan","nie","shi","fen","pa","zhi","xi","hu",
-       "dan","wei","zhang","tang|nu","dai","mo|wa","pei","pa","tie","fu",
-       "lian","zhi","zhou","bo","zhi","di","mo","yi","yi","ping",
-       "qia","juan","ru","shuai","dai","zhen","shui","qiao","zhen","shi",
-       "qun","xi","bang","dai","gui","chou|dao","ping","zhang","jian|san","wan",
-       "dai","wei","chang","sha|qie","qi|ji","ze","guo","mao","zhu","hou",
-       "zhen","zheng","mi","wei","wo","fu","yi","bang","ping","die",
-       "gong","pan","huang","tao","mi","jia","teng","hui","zhong","shan|qiao|shen",
-       "man","mu","biao","guo","ze","mu","bang","zhang","jing","chan",
-       "fu","zhi","hu","fan","chuang|zhuang","bi","bi","zhang","mi","qiao",
-       "chan","fen","meng","bang","chou|dao","mie","chu","jie","xian","lan",
-       "gan","ping","nian","jian","bing","bing","xing","gan","yao","huan",
-       "you","you","ji","guang|an","pi","ting","ze","guang","zhuang","me|mo",
-       "qing","bi","qin","dun|tun","chuang","gui","ya","bai|ting","jie","xu",
-       "lu","wu","zhuang","ku","ying","di|de","pao","dian","ya","miao",
-       "geng","ci","fu","tong","pang","fei","xiang","yi","zhi","tiao",
-       "zhi","xiu","du|duo","zuo","xiao","tu","gui","ku","mang|meng|pang","ting",
-       "you","bu","bing|ping","cheng","lai","bei","ji|cuo","an","shu","kang",
-       "yong","tuo","song","shu","qing","yu","yu","miao","sou","ce",
-       "xiang","fei","jiu","e","gui|wei|hui","liu","sha|xia","lian","lang","sou",
-       "zhi","bu","qing","jiu","jiu","jin|qin","ao","kuo","lou","yin",
-       "liao","dai","lu","yi","chu","chan","tu","si","xin","miao",
-       "chang","wu","fei","guang","kao","kuai","bi","qiang|se","xie","lin",
-       "lin","liao","lu","ji","ying","xian","ting","yong","li","ting",
-       "yin","xun","yan","ting","di","po|pai","jian","hui","nai","hui",
-       "gong","nian","kai","bian","yi","qi","nong|long","fen","ju","yan",
-       "yi","zang","bi","yi","yi","er","san","shi","er","shi",
-       "shi","gong","diao","yin","hu","fu","hong","wu","tui","chi",
-       "jiang","ba","shen","di|ti|tui","zhang","jue|zhang","tao","fu","di","mi",
-       "xian","hu","chao","nu","jing","zhen","yi","mi","juan|quan","wan",
-       "shao","ruo","xuan|yuan","jing","diao","zhang","jiang","qiang|jiang","peng","dan|tan",
-       "qiang|jiang","bi","bi","she","dan|tan","jian","gou","ge","fa","bi",
-       "kou","jian","bie","xiao","dan|tan","guo","qiang|jiang","hong","mi","guo",
-       "wan","jue","xue","ji","gui","dang","lu","lu","tuan","hui",
-       "zhi","hui","hui","yi","yi","yi","yi","huo","huo","shan|xian",
-       "xing","wen","tong","yan","yan","yu","chi","cai","biao","diao",
-       "bin","peng|bang","yong","piao","zhang","ying","chi","chi","zhuo|bo","tuo|yi",
-       "ji","pang|fang","zhong","yi","wang","che","bi","di","ling","fo",
-       "wang","zheng","cu","wang","jing","dai","xi","xun","hen","yang",
-       "huai","lv","hou","wang|jia|wa","cheng|zheng","zhi","xu","jing","tu","cong",
-       "cong","lai","cong","de|dei","pai","xi","dong","ji","chang","zhi",
-       "cong|zong","zhou","lai","yu","xie","jie","jian","shi|ti","jia|xia","bian",
-       "huang","fu","xun","wei","pang","yao","wei","xi","zheng","piao",
-       "ti|chi","de","zhi|zheng","zhi|zheng","bie","de","zhong|chong","che","jiao|yao","hui",
-       "jiao","hui","mei","long","xiang","bao","qu|ju","xin","xin","bi",
-       "yi","le","ren","dao","ding|ting","gai","ji","ren","ren","chan",
-       "tan","te","te|tui","gan|han","yi|qi","shi|tai","cun","zhi","wang","mang",
-       "xi|lie","fan","ying","tian","min|wen","min|wen","zhong","chong","wu","ji",
-       "wu","xi","jia","you","wan","cong","song|zhong","kuai","yu|shu","bian",
-       "zhi","qi|shi","cui","chen","tai","tun|zhun|dun","qian|qin","nian","hun","xiong",
-       "niu","kuang|wang","xian","xin","kang|hang","hu","kai","fen","huai","tai",
-       "song","wu","ou","chang","chuang","ju","yi","bao","chao","min|men",
-       "pei","zuo|zha","zen","yang","kou|ju","ban","nu","nao|niu","zheng","pa",
-       "bu","tie|zhan","hu|gu","hu","cu|ju|zu","da","lian","si|sai","you|chou","di",
-       "dai","yi","tu|die","you","fu","ji","peng","xing","yuan","ni",
-       "guai","fei","xi","bi","you|yao","qie","xuan","cong","bing","huang",
-       "xu|xue","chu","bi|pi","shu","xi|shu","tan","yong","zong","dui","mi",
-       "gi","yi","shi","nen|nin","xun","shi","xi","lao","heng","kuang",
-       "mou","zhi","xie","lian","tiao|yao","huang","die","hao","kong","gui",
-       "heng","xi|qi|xu","xiao|jiao","shu","si","hu|kua","qiu","yang","hui","hui",
-       "chi","jia","yi","xiong","guai","lin","hui","zi","xu","chi",
-       "shang","nv","hen","en","ke","dong","tian","gong","quan|zhuan","xi",
-       "qia","yue","peng","ken","de","hui","e|wu","qiu","tong","yan",
-       "kai","ce","nao","yun","mang","yong","yong","yuan|juan","pi","kun",
-       "qiao","yue","yu|shu","tu","jie|ke","xi","zhe","lin","ti","han",
-       "hao|jiao","qie","ti","bu","yi","qian","hui","xi","bei","man|men",
-       "yi","heng","song","quan","cheng","kui|li","wu","wu","you","li",
-       "liang","huan","cong","yi|nian","yue","li","nin","nao","e","que",
-       "xuan","qian","wu","min","cong","fei","bei","de","cui","chang",
-       "men","li","ji","guan","guan","xing","dao","qi","kong","tian",
-       "lun","xi","kan","gun","ni","qing","chou","dun","guo","zhan",
-       "jing","wan","yuan|wan","jin","ji","lan|lin","yu|xu","huo","he","juan|quan",
-       "tan|dan","ti","ti","nian","wang","chuo|chui","hu","hun|men","xi","chang",
-       "xin","wei","hui","e|wu","suo|rui","zong","jian","yong","dian","ju",
-       "can","cheng","de","bei","qie","can","dan|da","guan","duo","nao",
-       "yun","xiang","zhui","die","huang","chun","qiong","re","xing","ce",
-       "bian","min","zong","ti|shi","qiao","chou","bei","xuan","wei","ge",
-       "qian","wei","yu","yu|tou","bi","xuan","huan","min","bi","yi",
-       "mian","yong","qi|kai","dang|shang|tang|yang","yin","e","chen|xin|dan","mao","ke|qia","ke",
-       "yu","ai","qie","yan","nuo","gan","yun","cong|song","sai|si","leng",
-       "fen","ying","kui","kui","que","gong|hong","yun","su","su|shuo","qi",
-       "yao","song","huang","ji","gu","ju","chuang","ni","xie","kai",
-       "zheng","yong","cao","xun","shen","bo","kai|xi","yuan","xi|xie","hun",
-       "yong","yang","li","cao|sao","tao","yin","ci","xu|chu","qian|qie","tai",
-       "huang","yun","shen","ming","gong|hong","she","cao|cong","piao","mu","mu",
-       "guo","chi","can","can","can","cui","min","te","zhang","tong",
-       "ao","shuang","man","guan","que","zao","jiu","hui","kai","lian",
-       "ou","song","qin|jin","yin","lv","shang","wei","tuan","man","qian",
-       "she","yong","qing","kang","di|chi","zhi|zhe","lou|lv","juan","qi","qi",
-       "yu","ping","liao","cong","you","chong","zhi","tong","cheng","qi",
-       "qu","peng","bei","bie","qiong","jiao","zeng","chi","lian","ping",
-       "kui","hui","qiao","cheng|deng|zheng","yin","yin","xi","xi","dan|da","tan",
-       "duo","dui","dui|dun|tun","su","jue","ce","xiao|jiao","fan","fen","lao",
-       "lao","chong","han","qi","xian","min","jing","liao","wu","can",
-       "jue","cu","xian","tan","sheng","pi","yi","chu","xian","nao|nang",
-       "dan","tan","jing","song","han","jiao|ji","wei","xuan|huan","dong","qin",
-       "qin","ju","cao|sao","ken","xie","ying","ao","mao","yi","lin",
-       "se","jun","huai","men","lan","ai","lin","yan","guo","xia",
-       "chi","yu","yin","dai","meng","ai|yi|ni","meng","dui","qi|ji","mo",
-       "lan|xian","men","chou","zhi","nuo","nuo","yan","yang","bo","zhi",
-       "kuang","kuang","you","fu","liu","mie","cheng","hui","chan","meng",
-       "lan","huai","xuan","rang","chan","ji","ju","huan","she","yi",
-       "lian","nan","mi","tang","jue","gang|zhuang","gang|zhuang","gang|zhuang","ge","yue",
-       "wu","jian","qu","shu","rong","xi|hu","cheng","wo","jie","ge",
-       "jian","qiang","huo","qiang","zhan","dong","qi","jia","die","zei",
-       "jia","ji","zhi","kan","ji","kui","gai","deng","zhan","qiang",
-       "ge","jian","jie","yu","jian","yan","lu","xi|hu","zhan","xi|hu",
-       "xi|hu","chuo","dai","qu","hu","hu","hu","e","shi","ti",
-       "mao","hu","li","fang","suo","bian|pian","dian","jiong","shang|jiong","yi",
-       "yi","shan","hu","fei","yan","shou","shou","cai","za|zha","qiu",
-       "le|li|cai","pu","ba|pa","da","reng","fan|fu","ru","zai","tuo","zhang",
-       "diao|di|yue|li","kang|gang","yu|wu","yu|wu|ku","han","shen","cha","tuo|chi|yi","gu|xi|ge|jie","kou",
-       "wu","den","qian","zhi","ren","kuo","men","sao","yang","niu",
-       "ban","che","rao","xi|cha|qi","qian|qin","ban","jia","yu","fu","ba|ao",
-       "xi|zhe","pi","di","zhi|sun|kan","e","den","zhao","cheng","ji","yan",
-       "kuang|wang|zai","bian","chao","ju","wen","hu|gu","yue","jue","ba","qin",
-       "dan|shen","zheng","yun","wan","ne|ni|rui|na","yi","shu","zhua","pou","tou",
-       "dou","kang","zhe|she","pou|fu","fu","pao","ba","ao|niu","ze|zhBi","tuan",
-       "kou","lun","qiang|cheng","yun","hu","bao","bing","zhi|zhai","peng","nan",
-       "bu|pu","pi","tai","yao|tao","zhen","zha","yang","bao","he|qia","ni",
-       "ye","di","chi","pi|pei","jia","mo|ma","mei","chen","ya","chou",
-       "qu","min","zhu","jia|ya","fu|bi","zha","zhu","dan","chai|ca","mu",
-       "nian","la","fu","pao","ban|pan","pai","lin","na","guai","qian",
-       "ju","tuo|ta|zhi","ba","tuo","tuo","ao|niu","ju|gou","zhuo","pan|pin|fan","zhao",
-       "bai","bai","di","ni","ju","kuo","long","jian","qia","yong",
-       "lan","ning","bo","ze|zhai","qian","hen","kuo|gua","shi","jie|jia","zheng",
-       "nin","gong","gong","quan","shuan","cun|zun","za|zan","kao","yi|chi|hai","xie",
-       "ce|se|chuo","hui","pin","zhuai|ye","shi|she","na","bai","chi","gua","zhi",
-       "kuo|guang","duo","duo","zhi","qie","an","nong","zhen","ge","jiao",
-       "kua|ku","dong","ru|na","tiao","lie","zha","lv","die|she","wa","jue",
-       "lie ri","ju","zhi","luan","ya","zhua|wo","ta","xie|jia","nao","dang",
-       "jiao","zheng","ji","hui","xian","yu","ai","tuo|shui","nuo","cuo",
-       "bo","geng","ti","zhen","cheng","suo|sB|shB","suo|sB|shB","keng|qian","mei","nong",
-       "ju","bang|peng","jian","yi","ting","shan","nuo","wan","xie|jia","cha",
-       "peng","jiao|ku","wu","jun","jiu","tong","kun","huo|chi","tu|shu|cha","zhuo",
-       "pou|fu","luo|lv","ba","han","shao","nie","juan","ze","shu|song|sou","ye|yu",
-       "jue|zhuo","bu","wan","bu|pu|zhi","zun","ye","zhai","lv","sou","tuo|shui",
-       "lao","sun","bang","jian","huan","dao","wei","wan|yu","qin","peng",
-       "she","lie","min","men","fu|bu","bai","ju","dao","wo|luo","ai",
-       "juan|quan","yue","zong","chen","chui","jie","tu","ben","na","nian|nie",
-       "ruo|wei|re","zuo","wo|xia","qi","xian","cheng","dian","sao","lun","qing|qian",
-       "gang","duo","shou","diao","pou","di","zhang","hun","ji","tao",
-       "qia","qi","pai","shu","qian|wan","ling","ye","ya","jue","zheng",
-       "liang","gua","ni|nie|yi","huo|xu","shan|yan","zheng|ding","lve","cai","tan","che",
-       "bing","jie","ti","kong","tui","yan","cuo","zou|zhou|chou","ju","tian",
-       "qian","ken","bai","pa","jie","lu","guai","ming","jie","zhi",
-       "dan|shan","meng","chan|xian|can|shan","sao","guan","peng","yuan","nuo","jian","zheng|keng",
-       "jiu|you","jian","yu","yan","kui","nan","hong","rou","pi|che","wei",
-       "sai|zong|cai","zou","xuan","miao","ti|di","nie","cha","shi","zong|song","zhen",
-       "yi","xun","huang|yong","bian","yang","huan","yan","zan|zuan","an","xu|ju",
-       "ya","wo","ke|qia","chuai|tuan|zhui","ji","ti|di","la","la","cheng","kai",
-       "jiu","jiu","tu","jie|qi","hui","gen","chong|dong","xiao","she|die|ye","xie",
-       "yuan","qian|jian","ye","cha","zha","bei","yao","wei","beng","lan",
-       "wen","qin","chan","ge","lou","zong","gen","jiao","gou","qin",
-       "rong","que","chou|zou","chuai","zhan","sun","sun","bo","chu","rong|nang",
-       "bang|peng","cuo","sao","e","yao","dao","zhi","nu|nuo|nou","la|xie|xian","jian",
-       "sou","qiu","gao","gan","shuo","sang","jin","mie","e","chui",
-       "nuo","shan","ta","jie|zhe","tang","pan|ban|po","ban","da","li","tao",
-       "hu|ku","zhi|nai","wa","hua","qian","wen","qiang|cheng","tian|shen","zhen","e",
-       "xie","na|nuo","quan","cha","zha","ge","wu","en","she","kang",
-       "she|nie","shu","bai","yao","bin","sou","tan","sa|sha|shai","chan|sun","suo",
-       "jiu|liu|liao|jiao|nao|","chong","chuang","guai","bing","feng|peng","shuai","di|tu|zhi","qi|ji|cha","sou|song",
-       "zhai","lian","cheng","chi","guan","lu","luo","lou","zong","gai|xi",
-       "hu|chu","zha","qiang","tang","hua","cui","zhi|nai","mo|ma","jiang|qiang","gui",
-       "ying","zhi","ao|qiao","zhi","nie|che","man","chan|can","kou","chu","se|mi|su",
-       "tuan","jiao|chao","mo","mo","zhe","chan|xian|can|shan","keng|qian","biao","jiang","yao",
-       "gou","qian","liao","ji","ying","jue","pie","pie","lao","dun",
-       "xian","ruan","gui","zan|zen|qian","yi","xian","cheng","cheng","sa","nao",
-       "hong","si","han","heng|guang","da","zun","nian","lin","zheng|cheng","hui|wei",
-       "zhuang","jiao","ji","cao","dan","dan|shan","che","bo","che","jue",
-       "xiao|sou","liao","ben","fu","qiao","bo","cuo|zuo","zhuo","zhuan","wei|tuo",
-       "pu","qin","dun","nian","hua","xie","lu","jiao","cuan","ta",
-       "han","qiao|yao|ji","zhua|wo","jian","gan","yong","lei","nang","lu","shan",
-       "zhuo","ze|zhai","pu","chuo","ji","dang","se","cao","qing","qing|jing",
-       "huan","jie","qin","kuai","dan","xie","qia|jia|ye","pi|bo","bo|bai","ao",
-       "ju","ye","e","meng","sou","mi","ji","tai","zhuo","dao",
-       "xing","lan","ca","ju","ye","ru","ye","ye","ni","huo",
-       "jie","bin","ning","ge","zhi","zhi|jie","kuo","mo","jian","xie",
-       "lie|la","tan","bai","sou","lu","li|luo|yue","rao","ti|zhi|zhai","pan","yang",
-       "lei","ca|sa","shu","zan","nian","xian","jun|pei","huo","li|luo","la|lai",
-       "huan","ying","lu|luo","long","qian","qian","zan|cuan","qian","lan","xian|jian",
-       "ying","mei","rang","chan","weng","cuan","xie","she|nie","luo","jun",
-       "mi|mo","chi","zan|cuan","luan","tan","zuan","li|shai","dian","wa","dang",
-       "jiao","jue","lan","li|luo","nang","zhi","gui","gui","qi|yi|ji","xun",
-       "pu","pu","shou","kao","you","gai","yi","gong","gan|han","ban",
-       "fang","zheng","po","dian","kou","min","wu|mou","gu","he","ce",
-       "xiao","mi","chu|shou","ge|guo|e","di","xu","jiao","min","chen","jiu",
-       "shen","duo|dui","yu","chi","ao","bai","xu","jiao","duo|dui","lian",
-       "nie","bi","chang","dian","duo|que","yi","gan","san","ke","yan",
-       "dun|dui","qi|yi|ji","tou","xiao|xue","duo|que","jiao","jing","yang","xia","min",
-       "shu|shuo","ai|zhu","qiao","ai|zhu","zheng","di","chen","fu","shu|shuo","liao",
-       "qu","xiong|xuan","yi","jiao","shan","jiao","zhuo|zhu","yi|du","lian","bi",
-       "li|tai","xiao","xiao","wen","xue","qi","qi","zhai","bin","jue|jiao",
-       "zhai","lang","fei","ban","ban","lan","yu|zhong","lan","wei|men","dou",
-       "sheng","liao","jia","hu","xie","jia","yu","zhen","jiao","wo|guan",
-       "tou|tiao","dou","jin","chi","yin|zhi","fu","qiang","zhan","qu","zhuo",
-       "zhan","duan","zhuo","si","xin","zhuo","zhuo","qin","lin","zhuo",
-       "chu","duan","zhu","fang","chan|jie","hang","yu|wu","shi","pei","liu|you",
-       "mie","pang|bang","qi","zhan","mao","lv","pei","pi|bi","liu","fu",
-       "fang","xuan","jing","jing","ni","zu","zhao","yi","liu","shao",
-       "jian","en","yi","qi","zhi","fan","piao","fan","zhan","kuai",
-       "sui","yu","wu","ji","ji","ji","huo","ri","dan","jiu",
-       "zhi","zao","xie","tiao","xun","xu","ga","la","gan|han","han",
-       "tai|ying","di|de","xu","chan","shi","kuang","yang","shi","wang","min",
-       "min","tun|zhun","chun","wu","yun","bei","ang","ze","ban","jie",
-       "kun","sheng","hu","fang","hao","gui","chang","xuan","ming","hun",
-       "fen","qin","hu","yi","xi","xin","yan","ze","fang","tan",
-       "shen","ju","yang","zan","bing","xing","ying","xuan","po","zhen",
-       "ling","chun","hao","mei","zuo","mo","bian","xu","hun","zhao",
-       "zong","shi","shi","yu","fei","die|yi","mao","ni","chang","wen",
-       "dong","ai","bing","ang","zhou","long","xian","kuang","tiao","chao",
-       "shi","huang","huang","xuan","kui","xu|kua","jiao","jin","zhi","jin",
-       "shang","tong","hong","yan","gai","xiang","shai","xiao","ye","yun",
-       "hui","han","han","jun","wan","xian","kun","zhou","xi","sheng|cheng",
-       "sheng","bu","zhe","zhe","wu","wan","hui","hao","chen","wan",
-       "tian","zhuo","zui","zhou","pu","jing|ying","xi","shan","ni","xi",
-       "qing","qi|du","jing","gui","zheng","yi","zhi","an|yan","wan","lin",
-       "liang","cheng","wang","xiao","zan","fei","xuan","xuan","yi","xia",
-       "yun","hui","xu","min","kui","ye","ying","shu|du","wei","shu",
-       "qing","mao","nan","jian|lan","nuan","an","yang","chun","yao","suo",
-       "pu","ming","jiao","kai","hao","weng","chang","qi","hao","yan",
-       "li","ai","ji","ji","men","zan","xie","hao","mu","mu",
-       "cong","ni","zhang","hui","bao|pu","han","xuan","chuan","liao","xian",
-       "tan","jing","pie","lin","tun","xi","yi","ji","huang","dai",
-       "ye","ye","li","tan","tong","xiao","fei","shen","zhao","hao",
-       "yi","xiang","xing","shen","jiao","bao","jing","yan","ai","ye",
-       "ru","shu","meng","xun","yao","pu|bao","li","chen","kuang","die",
-       "liao","yan","huo","lu","xi","rong","long","nang","luo","luan",
-       "shai","tang","yan","zhu","yue","yue","qu","ye","geng","ye",
-       "hu","he","shu","cao","cao","sheng","man","zeng|ceng","zeng|ceng","ti",
-       "zui","can|qian|jian","xu","hui|kuai","yin","qie|he","fen","bi|pi","yue","you",
-       "ruan","peng","fen|ban","fu","ling","fei|ku","qu|xu|chun","ti","nv|ga","tiao",
-       "shuo","zhen","lang","lang","juan|zui","ming","huang|mang|wang","wang","tun","zhao|chao",
-       "ji","qi|ji","ying","zong","wang","tong|chuang","lang","lao","meng","long",
-       "mu","pin","wei","mo","ben","zha","shu|zhu","shu|zhu","teul","zhu|shu",
-       "ren","ba","piao|pu|po","duo","duo","dao|tiao|mu","li","qiu|gui","ji","jiu",
-       "bi","xiu","cheng","ci","sha","ru","za","quan","qian","yu|wu",
-       "gan","wu","cha","shan|sha","xun","fan","wu","zi","li","xing",
-       "cai","cun","ren|er","shao|biao","tuo|zhe","di|duo","zhang","mang","chi","yi",
-       "gu|gai","gong","du","yi|li|duo|tuo","qi","shu","gang","tiao","jie","mian",
-       "wan","lai","jiu","mang","yang","ma","miao","si|zhi|xi","yuan|wan","hang",
-       "fei|bei","bei","jie","dong","gao","yao","xian","chu","chun","pa",
-       "shu|dui","hua","xin","niu|chou","zhu","chou","song","ban","song","ji",
-       "wo|yue","jin","gou","ji","mao","pi","pi|mi","wang","ang","fang|bing",
-       "fen","yi","fu","nan","xi","hu|di","ya","dou","xin","zhen",
-       "yao","lin","rui","e","mei","zhao","guo","zhi|qi","cong|zong","yun",
-       "hua","sheng","shu","zao","di|duo","li","lu","jian","cheng","song|mB ti su",
-       "qiang","feng","zhan","xiao","xian|zhen","ku","ping","si|tai","xi","zhi",
-       "guai","xiao","jia","jia","ju|gou","bao|fu","mo","yi|xie","ye","ye",
-       "shi","nie","bi","tuo|duo","yi|duo|li","ling","bing","ni|chi","la","he",
-       "pan|ban","fan","zhong","dai","ci","yang|ying","fu","bai|bo","mou","gan",
-       "qi","ran","rou","mao","shao","song","zhe","xia","you","shen",
-       "gui|ju","tuo","zuo|zha","nan","ning","yong","di","zhi|die","zha|zu","cha|zha",
-       "dan","gu","bu|pu","jiu","ao","fu","jian","ba|fu|pei|bo|bie|","duo|zuo|wu","ke",
-       "nai","zhu","bi|bie","liu","chai","zha","si","zhu","bei|pei","shi|fei",
-       "guai","cha|zha","yao","cheng","jiu","shi","zhi","liu","mei","li",
-       "rong","zha|shan|shi|ce","zao","biao","zhan","zhi","long","dong","lu","sa",
-       "li|yue","lan","yong","shu","xun","shuan","qi|qie","chen","qi|xi","li",
-       "yi","xiang","zhen","li","se","gua|tian","kan","ben|bing","ren","xiao|jiao",
-       "bai","ren","bing","zi","chou","yi|xie","ci","xu","zhu","jian|zun",
-       "zui","er","er","you|yu","fa","gong","kao","lao","zhan","lie",
-       "yin","yang","he|hu","gen","zhi|yi","shi","ge","zai","luan","fu",
-       "jie","heng|hang","gui","tao","guang","wei","kuang","ru","an","an",
-       "juan","yi|ti","zhuo","ku","zhi","qiong","tong","sang","sang","huan",
-       "jie|ju","jiu","xue","duo","chui","yu|mou","za|zan","kB sei","ying","jie",
-       "liu","zhan","ya","nao","zhen","dang","qi","qiao","hua","gui|hui",
-       "jiang","zhuang","xun","suo","sha","chen|zhen","bei","ting|ying","gua","jing",
-       "bo","ben|fan","fu","rui","tong","jue","xi","lang","liu","feng",
-       "qi","wen","jun","gan","su|yin","liang","qiu","ting","you","mei",
-       "bang","long","peng","zhuang","di","xuan|juan|xie","tu|cha","zao","ao|you","gu",
-       "bi","di","han","zi","zhi","ren|er","bei","geng","jian","huan",
-       "wan","nuo","jia","tiao","ji","xiao","lv","kuan","shao|sao","chen",
-       "fen","song","meng","wu","li","si|qi","dou","qin","ying","suo",
-       "ju","ti","xie","kun","zhuo","shu","chan|yan","fan","wei","jing",
-       "li","bin|bing","xia","fo","chou|tao|dao","zhi","lai","lian","jian","zhuo",
-       "ling","li","qi","bing","lun","cong|song","qian","mian","qi","qi",
-       "cai","gun|hun","chan","de|zhe","fei","pai|bei|pei","bang","bang|pou|bei","hun","zong",
-       "cheng","zao","ji","li|lie","peng","yu","yu","gu","jun","dong",
-       "tang","gang","wang","di|dai|ti","que","fan","cheng","zhan","qi","yuan",
-       "yan","yu","quan|juan","yi","sen","ren|shen","chui","leng|ling","qi","zhuo",
-       "fu|su","ke","lai","zou|sou","zou","zhao|zhuo","guan","fen","fen","chen",
-       "qing","ni","wan","guo","lu","hao","jie|qie","yi","chou|zhou|diao","ju",
-       "ju","cheng|sheng","zu|cui","liang","qiang|kong","zhi","zhui|chui","ya","ju","bei",
-       "jiao","zhuo","zi","bin","peng","ding","chu","chang","men","hua",
-       "jian","gui","xi","du","qian","dao","gui","dian","luo","zhi",
-       "quan|juan","mi eng","fu","geng","peng","shan","yi","tuo","sen","duo|chuan",
-       "ye","fu","wei|hui","wei","duan","jia","zong","jian|han","yi","zhen|shen",
-       "xi","yan|ya","yan","chuan","jian","chun","yu","he","zha|cha","wo",
-       "pian","bi","yao","guo|kua","xu","ruo","yang","la","yan","ben",
-       "hui","kui","jie","kui","si","feng","xie","tuo","ji|zhi","jian",
-       "mu","mao","chu","ku|hu","hu","lian","leng","ting","nan","yu",
-       "you","mei","song|cong","xuan|yuan","xuan","yang|ying","zhen","pian","die|ye","ji",
-       "jie","ye","chu","shun|dun","yu","cou|zou","wei","mei","di|shi","ji",
-       "jie","kai|jie","qiu","ying","rou","huang","lou","le|yue","quan","xiang",
-       "pin","shi","gai","tan","lan","wen|yun","yu","chen","lv","ju",
-       "shen","chu","bi|pi","xie","jia","yi","zhan|nian|zhen","fu|bo","nuo","mi",
-       "lang","rong","gu","jian|jin","ju","ta","yao","zhen","bang","sha|xie",
-       "yuan","zi","ming","su","jia","yao","jie","huang","gan","fei",
-       "zha","qian","ma","sun","yuan","xie","rong","shi","zhi","cui",
-       "wen","ting","liu","rong","tang","que","zhai","si","sheng","ta",
-       "ke","xi","gu","qi","gao","gao","sun","pan","tao","ge",
-       "chun","dian","nou","ji","shuo","gou","chui","qiang","cha","qian|lian|xian",
-       "huai","mei","xu","gang","gao","zhuo","tuo","qiao","yang","dian|zhen",
-       "jia","jian|kan","zui","dao","long","bin|bing","zhu","sang","xi|die","ji|gui",
-       "lian","hui","rong|yong","qian","guo","gai","gai","tuan|shuan|quan","hua","qi|se",
-       "sen","cui|zhi","peng","you|chao","hu","jiang","hu","huan","gui","nie",
-       "yi","gao","kang","gui","gui","cao","man|wan","jin","di","zhuang",
-       "le|yue","lang","chen","cong|zong","li|chi","xiu","qing","shang","fan","tong",
-       "guan","ze","su","lei","lu","liang","mi","lou","chao|jiao","su",
-       "ke","chu","cheng","biao","lu","jiu|liao","zhe","zha","shu","zhang",
-       "man","mo|mu","niao|mu","yang","tiao","peng","zhu","sha|xie","xi","quan",
-       "heng","jian","cong","ji","yan","qiang","xue","ying","er","xun",
-       "zhi","qiao","zui","cong","piao","shu","hua","gui","zhen","zun",
-       "yue","shan","xi","chun","dian","fa|fei","gan","mo","wu","qiao",
-       "rao|nao","lin","liu","qiao","xian","run","fan","zhan|jian","tuo","liao",
-       "yun","shun","tui|dun","cheng","tang|cheng","meng","ju","cheng","su|qiu","jue",
-       "jue","tan|dian","hui","ji","nuo","xiang","tuo","ning","rui","zhu",
-       "tong|chuang","zeng|ceng","fen|fei","qiong","ran|yan","heng","qian","gu","liu","lao",
-       "gao","chu","xi","sheng","zi","zan","ji","dou","jing","lu",
-       "xian","cu|chu","yuan","ta","shu|qiao","jiang","tan","lin","nong","yin",
-       "xi","hui","shan","zui","xuan","cheng","gan","ju","zui","yi",
-       "qin","pu","yan","lei","feng","hui","dang","ji","sui","bo",
-       "ping|bo","cheng","chu","zhua","gui|hui","ji","jie","jia","qing","zhai|shi|tu",
-       "jian","qiang","dao","yi","biao","song","she","lin","li","cha",
-       "meng","yin","chou|tao|dao","tai","mian","qi","tuan","bin|bing","huo","ji",
-       "qian|lian","ni|mi","ning","yi","gao","jian|kan","yin","nou|ruan|ru","qing","yan",
-       "qi","mi","zhao","gui","chun","ji","kui","po","deng","chu",
-       "ge","mian","you","zhi","huang|guo|gu","qian","lei","lei","sa","lu",
-       "li","cuan","lv|chu","mie|mei","hui","ou","lv","zhi","gao","du",
-       "yuan","li|yue","fei","zhuo|zhu","sou","lian","jiang","chu","qing","zhu",
-       "lu","yan","li","zhu","chen","jue|ji","e","su","huai|gui","nie",
-       "yu","long","la|lai","qiao","xian","gui","ju","xiao","ling","ying",
-       "jian","yin","you","ying","xiang","nong","bo","chan|zhan","lan","ju",
-       "shuang","she","wei|zui","cong","quan","qu","cang","jiu","yu","luo",
-       "li","cuan","luan","dang","qu","yan","lan","lan","zhu","lei",
-       "li","ba","nang","yu","ling","guan","qian","ci","huan","xin",
-       "yu","yu|yi","qian|xian","ou","xu","chao","chu|qu|xi","qi","ke|ai","yi|yin",
-       "jue","xi|kai","xu","he","yu","kuai","lang","kuan","shuo|sou","xi",
-       "ei|ai","qi","qi","xu|chua","chi|chuai","qin","kuan","kan|qian","kuan","kan|ke",
-       "chuan","sha","gua","yan|yin","xin","xie","yu","qian","xiao","ye",
-       "ge","wu","tan","jin|qun","ou","hu","ti","huan","xu","pen",
-       "xi","xiao","xu","xi|she","shan","lian|han","chu","yi","e","yu",
-       "chuo","huan","zhi","zheng","ci","bu","wu","qi","bu","bu",
-       "wai","ju","qian","zhi|chi","se","chi","se|sha","zhong","sui","sui",
-       "li","ze","yu","li","gui","dai","dai","si","jian","zhe",
-       "mo|wen","mo","yao","mo","cu","yang","tian","sheng","dai","shang",
-       "xu","xun","shu","can","jing","piao","qia","qiu","su","qing|jing",
-       "yun","lian","yi","fou|bo","zhi|shi","ye|yan","can","hun|mei","dan","ji",
-       "die","zhen","yun","wen","chou","bin","ti","jin","shang","yin",
-       "chi","jiu","kui|hui","cuan","yi","dan","du","jiang","lian","bin",
-       "du","jian","jian","shu","ou","duan","zhu","yin|yan","qing|keng|sheng","yi",
-       "sha","ke|qiao","ke|qiao","xiao|yao","xun","dian","hui","hui","gu","qiao",
-       "ji","yi","ou","hui","duan","yi","xiao","wu","guan|wan","mu",
-       "mei","mei","ai","jie","du|dai","yu","bi","bi","bi","pi",
-       "pi","bi","chan","mao","hao","cai","bi","lie","jia","zhan",
-       "sai","mu","tuo","xun","er","rong","xian","ju","mu","hao",
-       "qiu","dou|nuo","mushiruPPPV","tan","pei","ju","duo","cui","bi","san",
-       "san","mao","sai|sui","shu","shu","tuo","he","jian","ta","san",
-       "lv","mu","mao","tong","rong","chang","pu","lu","zhan","sao",
-       "zhan","meng","lu","qu","die","shi|zhi","di","min","jue","meng|mang",
-       "qi","pie","nai","qi","dao","xian","chuan","fen","yang|ri","nei",
-       "nei","fu","shen","dong","qing","qi","yin","xi","hai","yang",
-       "an","ya","ke","qing","ya","dong","dan","lv","qing","yang",
-       "yun","yun","shui","shui","zheng|cheng","bing","yong","dang","shui","le",
-       "ni","tun","fan","gui|jiu","ting","zhi","qiu","bin|pa","ze","mian",
-       "cuan","hui","diao","han","cha","zhuo|que","chuan","wan","fan","da",
-       "xi","tuo","mang","qiu","qi","shan","pin","han","qian","wu",
-       "wu","xun","si","ru","gong","jiang","chi","wu","tu","jiu",
-       "tang|shang","zhi|ji","zhi","qian","mi","gu|yu","wang","jing","jing","rui",
-       "jun","hong","tai","tai","ji","bian","bian","gan|han|cen","wen|men","zhong",
-       "fang|pang","xiong","jue","hu|huang","niu|you","qi","fen","xu","xu","qin",
-       "yi","wo","yun","yuan","hang","yan","shen|chen","chen","dan","you",
-       "dun","hu","huo","qi","mu","nv|niu","mei|mo","ta|da","mian","mi|wu",
-       "chong","hong|pang","bi","sha","zhi","pei","pan","zhui|zi","za","gou",
-       "pai","mei|mo","ze","feng","ou","li","lun","cang","feng","wei",
-       "hu","mo","mei","shu","ju","za","tuo|duo","tuo","tuo|duo","he",
-       "li","mi|li","yi|chi","fa","fei","you","tian","zhi","zhao","gu",
-       "zhan","yan","si","kuang","jiong","ju","xie|yi","qiu","yi|die","jia",
-       "zhong","quan","bo|po","hui","mi|bi","ben","ze","chu|she","le","you|ao",
-       "gu","hong","gan","fa","mao","si","hu","peng|ping","ci","fan",
-       "zhi","su","ning","cheng","ling","pao","bo","qi","si","ni",
-       "ju","yue|sa","zhu","sheng","lei","xuan","jue|xue","fu","pan","min",
-       "tai","yang","ji","yong","guan","beng","xue","long|shuang","lu","dan",
-       "luo|po","xie","po","ze|shi","jing","yin","pan","jie","yie","hui",
-       "hui","zai","cheng","yin","wei","hou","jian","yang","lie","si",
-       "ji","er","xing","fu","sa|xi","se|qi|zi","zhi","yin","wu","xi|xian",
-       "kao","zhu","jiang","luo","luo","an|yan|e","dong","ti","si","lei",
-       "yi","mi","quan","jin","po","wei","xiao","xie","hong","xu",
-       "su|shuo","kuang","tao","qie|jie","ju","er","zhou","ru","ping","xun",
-       "xiong","zhi","guang","huan","ming","huo","wa","qia","pai","wu",
-       "qu","liu","yi","jia","jing","qian|jian","jiang","jiao","zhen","shi",
-       "zhuo","ce","fa","kuai|hui","ji","liu","chan","hun","hu|xu","nong",
-       "xun","jin","lie","qiu","wei","zhe","jun|xun","han","bang","mang",
-       "zhuo","you|di","xi","bo","dou","huan","hong","yi","pu","ying|cheng",
-       "lan","hao","lang","han","li","geng","fu","wu","li","chun",
-       "feng|hong","yi","yu","tong","lao","hai","jin","jia","chong","jiong",
-       "mei","sui|nei","cheng","pei","xian","shen","tu","kun","ping","nie",
-       "han","jing","xiao","she","nian","tu","yong|chong","xiao","xian","ting",
-       "e","su","tun|yun","juan","cen","ti","li","shui","si","lei",
-       "shui","tao","du","lao","lai","lian","wei","wo|guo","yun","huan",
-       "di","heng","run","jian","zhang","se","fu","guan","xing","shou|tao",
-       "shuan","ya","chuo","zhang","ye","kong|nang","wan|wo|yuan","han","tuo","dong",
-       "he","wo","ju","she","liang","hun","ta","zhuo","dian","qie|ji",
-       "de","juan","zi","xi","xiao","qi","gu","guo|guan","yan","lin",
-       "tang|chang","zhou","peng","hao","chang","shu","qi","fang","zhi","lu",
-       "nao|chuo|zhuo","ju","tao","cong","lei","zhe","ping|peng","fei","song","tian",
-       "pi|pei","dan","yu|xu","ni","yu","lu","gan","mi","jing|cheng","ling",
-       "lun","yin","cui","qu","huai","yu","nian|shen","shen","biao|hu","chun|zhun",
-       "hu","yuan","lai","hun","qing","yan","qian","tian","miao","zhi",
-       "yin","bo","ben","yuan","wen|min","ruo|re|luo","fei","qing","yuan","ke",
-       "ji","she","yuan","se","lu","zi","du|dou","yi","jian","mian|sheng",
-       "pai","xi","yu","yuan","shen","shen","rou","huan","zhu","jian",
-       "nuan","yu","qiu|wu","ting","qu|ju","du","feng","zha","bo","wo",
-       "wo|guo","ti|di","wei","wen","ru","xie","ce","wei","he","gang|jiang",
-       "yan","hong","xuan","mi","ke","mao","ying","yan","you","hong|qing",
-       "miao","sheng","mei","zai","hun","nai","gui","chi","e","pai",
-       "mei","lian","qi","qi","mei","tian","cou","wei","can","tuan",
-       "mian","hui|min|xu","po","xu","ji","pen","jian","jian","hu","feng",
-       "xiang","yi","yin","zhan","shi","jie","zhen","huang","tan","yu",
-       "bi","min|hun","shi","tu","sheng","yong","ju","dong","tuan|nuan","qiu|jiao",
-       "qiu|jiao","qiu","yan|yin","tang|shang","long","huo","yuan","nan","ban|pan","you",
-       "quan","zhuang|hun","liang","chan","xian","chun","nie","zi","wan","shi",
-       "man","ying","la","kui|hui","feng|hong","jian","xu","lou","wei","gai",
-       "bo","ying","po","jin","yan|gui","tang","yuan","suo","yuan","lian|nian|xian",
-       "yao","meng","zhun","cheng","ke","tai","da|ta","wa","liu","gou",
-       "sao","ming","zha","shi","yi","lun","ma","pu","wei","li",
-       "zai","wu","xi","wen","qiang","ze","shi","su","ai","zhen|qin",
-       "sou","yun","xiu","yin","rong","hun","su","suo","ni|niao","ta",
-       "shi","ru","ai","pan","chu|xu","chu","pang","weng","cang","mie",
-       "ge","dian","hao|xue","huang","qi|xi|xie","zi","di","zhi","xing|ying","fu",
-       "jie","hua","ge","zi","tao","teng","sui","bi","jiao","hui",
-       "gun","yin","ze|hao","long","zhi","yan","she","man","ying","chun",
-       "lv","lan","luan","yao","bin","tan","yu","xiu","hu","bi",
-       "biao","zhi","jiang","kou","shen","shang","di","mi","ao","lu",
-       "hu|xu","hu","you","chan","fan","yong","gun","man","qing","yu",
-       "piao","ji","ya","chao","qi","xi","ji","lu","lou","long",
-       "jin","guo","cong|song","lou","zhi","gai","qiang","li","yan","cao",
-       "jiao","cong","chun","tuan|zhuan","ou","teng","ye","xi","mi","tang",
-       "mo","shang","han","lian","lan","wa","chi","gan","feng|peng","xuan",
-       "yi","man","zi","mang","kang","luo|ta","ben|peng","shu","zhang","zhang",
-       "chong|zhuang","xu","huan","huo|kuo","jian","yan","shuang","liao|liu","cui","ti",
-       "yang","jiang","cong|zong","ying","hong","xiu","shu","guan","ying","xiao",
-       "cong|zong","kun","xu","lian","zhi","wei","pi|pie","yu","jiao|qiao","po",
-       "dang|xiang","hui","jie","wu","pa","ji","pan","wei","su","qian",
-       "qian","xi|ya","lu","xi","xun","dun","huang|guang","min","run","su",
-       "lao|liao","zhen","cong|zong","yi","zhi","wan","tan|shan","tan","chao","xun",
-       "kui|hui","ye","shao","tu|zha","zhu","san|sa","hei","bi","shan","chan",
-       "chan","shu","tong","pu","lin","wei","se","se","cheng","jiong",
-       "cheng|deng","hua","jiao","lao","che","gan","cun","jing","si","shu|zhu",
-       "peng","han","yun","liu","hong|gong","fu","hao","he","xian","jian",
-       "shan","xi","ao","lu","lan","ning","yu","lin","mian|sheng","zao",
-       "dang","huan","ze|shi","xie","yu","li","shi","xue","ling","wan|man",
-       "zi","yong","kuai|hui","can","lian","dian","ye","ao","huan","zhen",
-       "chan","man","gan","dan|tan","yi","sui","pi","ju","ta","qin",
-       "ji","zhuo","lian","nong","guo|wo","jin","fen|pen","se","ji|sha","sui",
-       "hui|huo","chu","ta","song","ding|ting","se","zhu","lai","bin","lian",
-       "mi|ni","shi","shu","mi","ning","ying","ying","meng","jin","qi",
-       "bi|pi","ji","hao","ru","cui|zui","wo","tao","yin","yin","dui",
-       "ci","huo|hu","qing","lan","jun|xun","ai|kai|ke","pu","zhuo|zhao","wei","bin",
-       "gu","qian","ying","bin","kuo","fei","cang","me","jian","wei|dui",
-       "luo|po","zan|cuan","lv","li","you","yang","lu","si","zhi","ying",
-       "du|dou","wang","hui","xie","pan","shen","biao","chan","mie|mo","liu",
-       "jian","pu|bao","se","cheng|deng","gu","bin","huo","xian","lu","qin",
-       "han","ying","rong","li","jing","xiao","ying","sui","wei|dui","xie",
-       "huai|wai","xue","zhu","long|shuang","lai","dui","fan","hu","lai","shu",
-       "lian","ying","mi","ji","lian","jian|zun","ying","fen","lin","yi",
-       "jian","yue","chan","dai","rang|nang","jian","lan","fan","shuang","yuan",
-       "zhuo|jiao|ze","feng","she","lei","lan","cong","qu","yong","qian","fa",
-       "guan","jue","yan","hao","ying","sa","zan|cuan","luan","yan","li",
-       "mi","shan","tan","dang|tang","jiao","chan","ying","hao","ba","zhu",
-       "lan","lan","nang","wan","luan","xun|quan","xian","yan","gan","yan",
-       "yu","huo","huo|biao","mie","guang","deng","hui","xiao","xiao","hui",
-       "hong","ling","zao","zhuan","jiu","zha|yu","xie","chi","zhuo","zai",
-       "zai","can","yang","qi","zhong","fen|ben","niu","jiong|gui","wen","pu",
-       "yi","lu","chui","pi","kai","pan","yan","yan","pang|feng","mu",
-       "chao","liao","que","kang","dun","guang","xin","zhi","guang","guang",
-       "wei","qiang","bian","da","xia","zheng","zhu","ke","zhao","fu",
-       "ba","xie","xie","ling","zhuo|chu","xuan","ju","tan","pao|bao","jiong",
-       "pao|fou","tai","tai","bing","yang","tong","shan|qian","zhu","zha","dian",
-       "wei","shi","lian","chi","huang","zhou","hu","shuo","lan","ting",
-       "jiao|yao","xu","heng","quan","lie","huan","yang","xiao","xiu","xian",
-       "yin","wu","zhou","yao","shi","wei","tong|dong","mie","zai","kai",
-       "hong","lao|luo","xia","zhu","xuan","zheng","po","yan","hui","guang",
-       "che","hui","kao","chen","fan","shao","ye","hui","uu","tang",
-       "jin","re","lie","xi","fu|pao","jiong","xie|che","pu","ting","zhuo",
-       "ting","wan","hai","peng","lang","yan","xu","feng","chi","rong",
-       "hu","xi","shu","he","xun|hun","ku","juan|ye","xiao","xi","yan",
-       "han","zhuang","qu|jun","di","xie|che","ji|qi","wu","yan","lv","han",
-       "yan","huan","men","ju","dao","bei","fen","lin","kun","hun",
-       "tun","xi","cui","wu","hong","chao|ju","fu","wo|ai","jiao","zong|cong",
-       "feng","ping","qiong","ruo","xi|yi","qiong","xin","zhuo|chao","yan","yan",
-       "yi","jue","yu","gang","ran","pi","xiong|ying","gang","sheng","chang",
-       "shao","xiong|ying","nem","geng","qu","chen","he","kui","zhong","duan",
-       "xia","hui|yun|xun","feng","lian","xuan","xing","huang","jiao","jian","bi",
-       "ying","zhu","wei","tuan","shan|qian","xi|yi","nuan","nuan","chan","yan",
-       "jiong","jiong","yu","mei","sha","wei","ye|zha","jin","qiong","rou",
-       "mei","huan","xu","zhao","wei","fan","qiu","sui","yang","lie",
-       "zhu","jie","zao","gua","bao","hu","yun","nan","shi","huo",
-       "bian","gou","tui","tang","chao","shan","en|yun","bo","huang","xie",
-       "xi","wu","xi","yun","he","he|xiao","xi","yun","xiong","xiong",
-       "shan","qiong","yao","xun","mi","lian","ying","wu","rong","gong",
-       "yan","qiang","liu","xi","bi","biao","cong|zong","lu|ao","jian","shu",
-       "yi","lou","peng|feng","sui|cui","yi","teng","jue","zong","yun|yu","hu",
-       "yi","zhi","ao","wei","liu","han|ran","ou","re","jiong","man",
-       "kun","shang","cuan","zeng","jian","xi","xi","xi","yi","xiao",
-       "chi","huang","chan|dan","ye","tan","ran","yan","xun","qiao","jun",
-       "deng","dun","shen","jiao|qiao|jue|zhuo","fen","si","liao","yu","lin","tong|dong",
-       "shao","fen","fan","yan","xun","lan","mei","tang","yi","jiong",
-       "men","zhu","jiao","ying","yu","yi","xue","lan","tai|lie","zao",
-       "can","sui","xi","que","zong","lian","hui","zhu","xie","ling",
-       "wei","yi","xie","zhao","hui","da","nong","lan","xu","xian",
-       "he","xun","jin","chou","tao","yao","he","lan","biao","rong|ying",
-       "li|lie","mo","bao","ruo","lv","la|lie","ao","xun","kuang|huang","shuo",
-       "liao","li","lu","jue","liao","yan|xun","xi","xie","long","ye",
-       "can","rang","yue","lan","cong","jue","chong","guan","qu","che",
-       "mi","tang","lan","zhu","lan","ling","cuan","yu","zhao|zhua","zhao|zhua",
-       "pa","zheng","pao","cheng|chen","yuan","ai","wei","han","jue","jue",
-       "fu","ye","ba","die","ye","yao","zu","shuang","er","pan",
-       "chuang","ke","zang","die","qiang","yong","qiang","pian","ban","pan",
-       "chao","jian","pai","du","chuang","yu","zha","bian|mian","die","bang",
-       "bo","chuang","you","you|yong","du","ya","cheng","niu","niu","pin",
-       "jiu|le","mou|mu","ta","mu","lao","ren","mang","fang","mao","mu",
-       "gang","wu","yan","ge|qiu","bei","si","jian","gu","you|chou","ke",
-       "sheng","mu","di","qian","quan","quan","zi","te","xi","mang",
-       "keng","qian","wu","gu","xi","li","li","pou","ji","gang",
-       "zhi|te","ben","quan","chun","du","ju","jia","jian|qian","feng","pian",
-       "ke","ju","kao","chu","xi","bei","luo","jie","ma","san",
-       "wei","mao|li","dun","tong","qiao","jiang","xi","li","du","lie",
-       "bai","piao","bao","xi","chou","wei","kui","chou","quan","quan",
-       "quan|ba","fan","qiu","ji","chai","zhuo|bao","han|an","ge","zhuang","guang",
-       "ma","you","kang|gang","pei|fei","hou","ya","yin","huan|fan","zhuang","yun",
-       "kuang","niu","di","kuang","zhong","mu","bei","pi","ju","yi|quan|chi",
-       "sheng|xing","pao","xia","tuo|yi","hu","ling","fei","pi","ni","yao",
-       "you","gou","xue","ju","dan","bo","ku","xian","ning","huan",
-       "hen","jiao","he","zhao","jie","xun","shan","ta|shi","rong","shou",
-       "tong|dong","lao","du","xia","shi","kuai","zheng","yu","sun","yu",
-       "bi","mang|dou","xi|shi","juan","li","xia","yin","suan","lang","bei",
-       "zhi","yan","sha","li","han","xian","jing","pai","fei","xiao",
-       "bai|pi","qi","ni","biao","yin","lai","lie","jian|yan","qiang","kun",
-       "yan","guo","zong","mi","chang","yi","zhi","zheng","ya|wei","meng",
-       "cai","cu","she","lie","ceon","luo","hu","zong","gui","wei",
-       "feng","wo","yuan","xing","zhu","mao","wei","chuan","xian","tuan",
-       "ya|jia|qie","nao","xie|he|ge|hai","jia","hou","bian|pian","you","you","mei","cha",
-       "yao","sun","bo|po","ming","hua","yuan","sou","ma","huan","dai",
-       "yu","shi","hao","qiang","yi","zhen","cang","hao|gao","man","jing",
-       "jiang","mo","zhang","chan","ao","ao","hao","suo","fen","jue",
-       "bi","bi","huang","pu","lin","xu","tong","yao|xiao","lao","shuo|xi",
-       "xiao","shou","dun","jiao","ge|lie|xie","juan","du","hui","kuai","xian",
-       "xie","ta","xian","xun","ning","bian|pian","huo","nou|ru","meng","lie",
-       "nao|you","guang","shou","lu","ta","xian","mi","rang","huan","nao|you",
-       "luo","xian","qi","jue","xuan","miao","zi","shuai|lv","lu","yu",
-       "su","wang","qiu","ga","ding","le","ba","ji","hong","di",
-       "chuan","gan","jiu","yu","qi","yu","chang|yang","ma","hong","wu",
-       "fu","min|wen","jie","ya","bin|fen","bian","bang","yue","jue","men|yun",
-       "jue","wan","jian|qian","mei","dan","pin","wei","huan","xian","qiang|cang",
-       "ling","dai","yi","an|gan","ping","dian","fu","xuan|xian","xi","bo",
-       "ci","gou","jia","shao","po","ci","ke","ran","sheng","shen",
-       "yi|tai","zu|ju","jia","min","shan","liu","bi","zhen","zhen","jue",
-       "fa","long","jin","jiao","jian","li","guang","xian","zhou","gong",
-       "yan","xiu","yang","xu","luo","su","zhu","qin","yin|ken","xun",
-       "bao","er","xiang","yao","xia","hang","gui","chong","xu","ban",
-       "pei","lao","dang","ying","hun|hui","wen","e","cheng","di|ti","wu",
-       "wu","cheng","jun","mei","bei","ting","xian","chu","han","xuan|qiong",
-       "yan","qiu","xuan","lang","li","xiu","fu","liu","ya","xi",
-       "ling","li","jin","lian","suo","suo","feng","wan","dian","pin|bing",
-       "zhan","cui|se","min","yu","ju","chen","lai","min","sheng","wei|yu",
-       "tian","shu","zhuo|zuo","beng|pei","cheng","hu","qi","e","kun","chang",
-       "qi","beng","wan","lu","cong","guan","yan","diao","bei","lin",
-       "qin","pi","pa","que","zhuo","qin","fa","jin","qiong","du",
-       "jie","hun|hui","yu","mao","mei","chun","xuan","ti","xing","dai",
-       "rou","min","jian","wei","ruan","huan","xie|jie","chuan","jian","zhuan",
-       "chang|yang","lian","quan","xia","duan","yuan","ye","nao","hu","ying",
-       "yu","huang","rui","se","liu","shi","rong","suo","yao","wen",
-       "wu","zhen","jin","ying","ma","tao","liu","tang","li","lang",
-       "gui","tian|zhen","qiang|cang","cuo","jue","zhao","yao","ai","bin|pian","tu|shu",
-       "chang","kun","zhuan","cong","jin","yi","cui","cong","qi","li",
-       "jing","zao|suo","qiu","xuan","ao","lian","men","zhang","yin","ye",
-       "ying","zhi","lu","wu","deng","xiu","zeng","xun","qu","dang",
-       "lin","liao","qiong|jue","su","huang","gui","pu","jing","fan","jin",
-       "liu","ji","hui","jing","ai","bi","can","qu","zao","dang",
-       "jiao","guan","tan","hui|kuai","huan","se","sui","tian","chu","yu",
-       "jin","lu|fu","bin|pian","shu","wen","zui","lan","xi","ji|zi","xuan",
-       "ruan","wo","gai","lei","du","li","zhi","rou","li","zan",
-       "qiong","ti","gui","sui","la","long","lu","li","zan","lan",
-       "ying","mi|xi","xiang","qiong|wei","guan","dao","zan","huan|ye|ya","gua","bo",
-       "die","bo|pao","hu","zhi|hu","piao","ban","rang","li","wa","shiwa",
-       "xiang|hong","qianwa","ban","pen","fang","dan","weng","ou","fenwa","maowa",
-       "ki ro ton|mao wa","hu","ling","yi","ping","ci","bai","juan","chang","chi",
-       "liwa","dang","wa","bu","zhui","ping","bian","zhou","zhen","liwa",
-       "ci","ying","qi","xian","lou","di","ou","meng","zhuan","beng",
-       "lin","zeng","wu","pi","dan","weng","ying","yan","gan","dai",
-       "shen","tian","tian","han","chang","sheng","qing","shen","chan","chan",
-       "rui","sheng","su","shen","yong","shuai","lu","fu","yong","beng",
-       "beng","ning","tian","you","jia","shen","you","dian","fu","nan",
-       "dian|tian|sheng","ping","ting|ding","hua","ting|ding","zhen","zai|zi","meng","bi","bi|qi",
-       "mu","xun","liu","chang","mu","yun","fan","fu","geng","tian",
-       "jie","jie","quan","wei","fu|bi","tian","mu","tap","pan","jiang",
-       "wa","da|fu","nan","liu","ben","zhen","xu|chu","mu","mu","ce|ji",
-       "zai|zi","gai","bi","da","zhi|chou|shi","lve","qi","lve","fan|pan","yi",
-       "fan|pan","hua","she|yu","she","mu","jun","yi","liu","she","die",
-       "chou","hua","dang","zhui","ji","wan","jiang","cheng","chang","tuan",
-       "lei","ji","cha","liu","die","tuan","lin","jiang","jiang|qiang","chou",
-       "pi","die","die","pi|ya|shu","jie|qie","dan","shu","shu","zhi|di","yi|ni",
-       "ne","nai","ding","bi","jie","liao","gang","ge|yi","jiu","zhou",
-       "xia","shan","xu","n<e|yao","li|lai","yang","chen","you","ba","jie",
-       "jue|xue","qi","ya|xia","cui","bi","yi","li","zong","chuang","feng",
-       "zhu","pao","pi","gan","ke","ci","xue","zhi","da","zhen",
-       "fa|bian","zhi","teng","ju","ji","fei","gou","shan|dian","jia","xuan",
-       "zha","bing","nie","zheng","yong","jing","quan","teng|chong","tong","yi",
-       "jie","wei|you|yu","hui","tan|shi","yang","zhi","zhi","hen","ya","mei",
-       "dou","jing","xiao","tong","tu","mang","pi","xiao","suan","pu",
-       "li","zhi","cuo","duo","wu","sha","lao","shou","huan","xian",
-       "yi","beng|peng","zhang","guan","tan","fei","ma","ma|lin","chi","ji",
-       "tian|dian","an|ye|e","chi","bi","bi","min","gu","dui","ke|e","wei",
-       "yu","cui","ya","zhu","cu","dan","shen","zhong","zhi|chi","yu",
-       "hou","feng","la","yang","chen","tu","yu","guo","wen","huan",
-       "ku","jia|xia","yin","yi","lou","sao","jue","chi","xi","guan",
-       "yi","wen","ji","chuang","ban","hui|lei","liu","chai|cuo","shou","n<e|yao",
-       "dian|chen","da|dB","bie","tan","zhang","biao","shen","cu","luo","yi",
-       "zong","chou","zhang","zhai","sou","se","que","diao","lou","lou",
-       "mo","qin","yin","ying","huang","fu","liao","long","qiao|jiao","liu",
-       "lao","xian","fei","dan","yin","he","ai","ban","xian","guan",
-       "gui|wei","nong","yu","wei","yi","yong","pi","lei","li|lai","shu",
-       "dan","lin","dian","lin","la","bie","ji","chi","yang","xuan",
-       "jie","zheng","mo","li","huo","la","ji","dian","xuan","ying",
-       "yin","qu","yong","tan","dian","luo","luan","luan","bo","uu",
-       "gui","ba","fa","deng","fa","bai","bai","qie","ji|bi","zao",
-       "zao","mao","di|de","pa|ba","jie","huang","gui","ci","ling","gao|yao",
-       "mo","ji","jiao","peng","gao|yao","ai","e","hao","han","bi",
-       "wan","chou","qian","xi","ai","xiao","hao","huang","hao","ze",
-       "cui","hao","xiao","ye","po","hao","jiao","ai","xing","huang",
-       "li|luo|bo","piao","he","jiao","pi","gan","pao","zhou","jun","qiu",
-       "cun","que","zha","gu","jun","jun","zhou","zha|cu","gu","zhao|zhan|dan",
-       "du","min","qi","ying","yu","bei","diao","zhong","pen","he",
-       "ying","he","yi","bo","wan","he","ang","zhan","yan","jian",
-       "he","yu","kui","fan","gai|ge|he","dao","pan","fu","qiu","sheng|cheng",
-       "dao","lu","zhan","meng","li","jin","xu","jian","pan","guan",
-       "an","lu","xu","zhou|chou","dang","an","gu","li","mu","ding",
-       "gan","xu","mang","mang|wang","zhi","qi","yuan","xian|tian","xiang","dun",
-       "xin","xi|pan","pan","feng","dun","min","ming","sheng|xing","shi","yun|hun",
-       "mian","pan","fang","miao","dan","mei","mao","kan","xian","kou",
-       "shi","yang|ying","zheng","yao|ao","shen","huo","da","zhen","kuang","ju|xu|kou",
-       "shen","yi|chi","sheng","mei","mo|mie","zhu","zhen","zhen","mian","shi",
-       "yuan","die|ti","ni","zi","zi","chao","zha","xuan","bing|fang","pang|pan",
-       "long","gui|sui","tong","mi","die|zhi","di","ne","ming","xuan|shun|xun","chi",
-       "kuang","juan","mou","zhen","tiao","yang","yan","mo","zhong","mo",
-       "zhuo|zhao|zhe","zheng","mei","suo","qiao|shao|xiao","han","huan","di","cheng","cuo|zhuai",
-       "juan","e","mian","xian","xi","kun","lai","jian","shan","tian",
-       "gun","wan","leng","shi","qiong","li","ya","jing","zheng","li",
-       "lai","sui|zui","juan","shui","sui","du","bi","bi","mu","hun",
-       "ni","lu","yi|ze|gao","jie","cai","zhou","yu","hun","ma","xia",
-       "xing","hui","hun","zai","chun","jian","mei","du","hou","xuan",
-       "ti","kui","gao","rui","mao","xu","fa","wo","miao","chou",
-       "gui|wei|kui","mi","weng","kou|ji","dang","chen","ke","sou","xia","qiong|huan",
-       "mo","ming","man|men","fen","ze","zhang","yi","diao|dou","kou","mo",
-       "shun","cong","lou|lv","chi","man|men","piao","cheng","gui","meng","wan",
-       "run|shun","pie","xi","qiao","pu","zhu","deng","shen","shun","liao",
-       "che","xian|jian","kan","ye","xue","tong","wu|mi","lin","gui|kui","jian",
-       "ye","ai","hui","zhan","jian","gu","zhao","qu|ju","wei","chou",
-       "sao","ning|cheng","xun","yao","huo|yue","meng","mian","pin","mian","lei",
-       "kuang|guo","jue","xuan","mian","huo","lu","meng","long","guan|quan","man",
-       "xi","chu","tang","kan","zhu","mao","jin|qin|guan","jin|qin|guan","yu|xu|jue","shuo",
-       "ze","jue","shi","yi","shen","zhi","hou","shen","ying","ju",
-       "zhou","jiao","cuo","duan","ai","jiao","zeng","yue","ba","shi|dan",
-       "ding","qi","ji","zi","gan","wu","zhe","ku","gang|qiang|kong","xi",
-       "fan","kuang","dang","ma","sha","dan","jue","li","fu","min",
-       "e","xu|hua","kang","zhi","qi|qie","kan","jie","pin|bin|fen","e","ya",
-       "pi","zhe","yan","sui","zhuan","che","dun","wa","yan","jin",
-       "feng","fa","mo","zha","ju","yu","ke|luo","tuo","tuo","di",
-       "zhai","zhen","e","fu|fei","mu","zhu","li|la","bian","nu","ping",
-       "peng","ling","pao","le","po","bo","po","shen","za","ai",
-       "li","long","tong","yong","li","kuang","chu","keng","quan","zhu",
-       "kuang|guang","gui","e","nao","qia","lu","wei|gui","ai","luo|ge","ken|xian|gun|yin",
-       "xing","yan","dong","peng|ping","xi","lao","hong","shuo|shi","xia","qiao",
-       "qing","wei|ai|gai","qiao","ce","keng","xiao","que|ke|ku","chan","lang","hong",
-       "yu","xiao","xia","mang|bang","luo|long","yong|tong","che","che","wo","liu",
-       "ying","mang","que","yan","sha","kun","yu","ze","hua","lu",
-       "chen","jian","nve","song","zhuo","keng","peng","yan","zhui|chui|duo","kong",
-       "cheng","qi","zong|cong","qing","lin","jun","bo","ding","min","diao",
-       "jian|zhan","he","lu|liu","ai","sui","que|xi","leng","bei","yin","dui",
-       "wu","qi","lun","wan","dian","nao|gang","bei","qi","chen","ruan",
-       "yan","die","ding","zhou","tuo","jie|ya","ying","bian","ke","bi",
-       "wei","shuo|shi","zhen","duan","xia","dang","ti|di","nao","peng","jian",
-       "di","tan","cha","tian","qi","dun","feng","xuan","que","que|qiao",
-       "ma","gong","nian","su|xie","e","ci","liu","si|ti","tang","bang|pang",
-       "hua|ke|gu","pi","kui|wei","sang","lei","cuo","tian","xia|qia|ya","xi","lian|qian",
-       "pan","wei|ai|gai","yun","dui","zhe","ke","la","zhuan","yao","gun",
-       "zhuan","chan","qi","ao|qiao","peng","liu","lu","kan","chuang","chen",
-       "yin","lei","biao","qi","mo","qi|zhu","cui","zong","qing","chuo",
-       "lun","ji","shan","lao|luo","qu","zeng","deng","jian","xi","lin",
-       "ding","dian","huang","pan|bo","ji|she","qiao","di","li","jian","jiao",
-       "xi","zhang","qiao","dun","jian","yu","zhui","he|qiao","ke|huo","ze",
-       "lei","jie","chu","ye","que|hu","dang","yi","jiang","pi","pi",
-       "yu","pin","e|qi","ai","ke","jian","yu","ruan","meng","pao",
-       "ci","bo","yang","mie","ca","xian|xin","kuang","lei","lei","zhi",
-       "li","li","fan","que","pao","ying","li","long","long","mo",
-       "bo","shuang","guan","jian","ca","yan","shi","shi","li","reng",
-       "she","yue","si","qi","ta","ma","xie","yao","xian","zhi|qi",
-       "qi","zhi","beng|fang","dui","zhong","ren","yi","shi","you","zhi",
-       "tiao","fu","fu","mi|bi","zu","zhi","suan","mei","zuo","qu",
-       "hu","zhu","shen","sui","ci","chai","mi","lv","yu","xiang",
-       "wu","tiao","piao","zhu","gui","xia","zhi","ji|zhai","gao","zhen",
-       "gao","shui|lei","jin","shen","gai","kun","di","dao","huo","tao",
-       "qi","gu","guan","zui","ling","lu","bing","jin","dao","zhi",
-       "lu","chan|shan","bi|pi","chu","hui","you|chao","xi","yin","zi","huo",
-       "zhen","fu","yuan","xu","xian","shang|yang","ti|zhi","yi","mei","si",
-       "di","bei","zhuo","zhen","ying","ji","gao","tang","si","ma",
-       "ta","fu","xuan","qi","yu","xi","ji","si","shan|chan","dan",
-       "gui","sui","li","nong","mi","dao","li","rang","yue","ti",
-       "zan","lei","rou","yu","yu|ou","li","xie","qin","he","tu",
-       "xiu","si","ren","tu","zi","cha|na","gan","yi|zhi","xian","bing",
-       "nian","qiu","qiu","zhong","fen","hao|mao","yun","ke","miao","zhi",
-       "jing","bi","zhi","yu","mi|bi","ku","ban","pi","ni","li",
-       "you","zu","pi","bo","ling","mo","cheng","nian","qin","yang",
-       "zuo","zhi","di","shu","ju","zi","huo|kuo","ji","cheng|chen","tong",
-       "shi|zhi","huo|kuo","huo","yin","zi","zhi","jie","ren","du","yi",
-       "zhu","hui","nong","fu|pu","xi","gao","lang","fu","xun|ze","shui",
-       "lv","kun","gan","jing","ti","cheng","tu|shu","shao","shui","ya",
-       "lun","lu","gu","zuo","ren","zhun","bang","bai","ji|qi","zhi",
-       "zhi","kun","leng|ling","peng","ke","bing","chou","zui|zu|su","yu","su",
-       "lve","uu","yi","xi|qie","bian","ji","fu","pi|bi","nuo","jie",
-       "zhong","zong","xu","cheng|chen","dao","wen","xian|jian|lian","zi|jiu","yu","ji",
-       "xu","zhen","zhi","dao","jia","ji|qi","gao","gao","gu","rong",
-       "sui","rong","ji","kang","mu","can|shan|cen","men|mei","zhi","ji","lu",
-       "su","ji","ying","wen","qiu","se","kweok","yi","huang","qie",
-       "ji","sui","xiao|rao","pu","jiao","zhuo|bo","tong|zhong","zuo","lu","sui",
-       "nong","se","hui","rang","nuo","yu","pin","ji","tui","wen",
-       "cheng|chen","huo","kuang","lv","biao|pao","se","rang","zhuo|jue","li","cuan|zan",
-       "xue","wa","jiu","qiong","xi","qiong","kong","yu","shen","jing",
-       "yao","chuan","zhun","tu","lao","qie","zhai","yao","bian","bao",
-       "yao","bing","wa","zhu|ku","jiao|liao|liu","qiao","diao","wu","wa|gui","yao",
-       "zhi","chuang","yao","tiao|yao","jiao","chuang","jiong","xiao","cheng","kou",
-       "cuan","wo","dan","ku","ke","zhuo","huo","su","guan","kui",
-       "dou","zhuo","yin|xun","wo","wa","ya|ye","yu","ju","qiong","yao",
-       "yao","tiao","chao","yu","tian|dian|yan","diao","ju","liao","xi","wu",
-       "kui","chuang","chao|ke","kuan|cuan","kuan|cuan","long","cheng","cui","liao","zao",
-       "cuan","qiao","qiong","dou","zao","long","qie","li","chu","shi",
-       "fu","qian","chu|qi","hong","qi","hao","sheng","fen","shu","miao",
-       "qu|kou","zhan","zhu","ling","long","bing","jing","jing","zhang","bai",
-       "si","jun","hong","tong","song","jing|zhen","diao","yi","shu","jing",
-       "qu","jie","ping","duan","li","zhuan","ceng|zeng","deng","cun","wai",
-       "jing","kan","jing","zhu","zhu|du","le|jin","peng","yu","chi","gan",
-       "mang","zhu","wan","du","ji","jiao","ba","suan","ji","qin",
-       "zhao","sun","ya","zhui|rui","yuan","hu","hang","xiao","cen|jin|han","pi|bi",
-       "bi","jian","yi","dong","shan","sheng","da|xia|na","di","zhu","na",
-       "chi","gu","li","qie","min","bao","tiao","si","fu","ce",
-       "ben","fa","da","zi","di","ling","zuo|ze","nu","fu|fei","gou",
-       "fan","jia","ge","fan","shi","mao","po","ti","jian","qiong",
-       "long","min","bian","luo","gui","qu","chi","yin","yao","xian",
-       "bi","qiong","kuo","deng","jiao","jin","quan","sun","ru","fa",
-       "kuang","zhu","tong","ji","da","hang","ce","zhong","kou","lai",
-       "bi","shai","dang","zheng","ce","fu","yun|jun","tu","pa","li",
-       "lang","ju","guan","jian","han","tong","xia","zhi","cheng","suan",
-       "shi","zhu","zuo","xiao","shao","ting","ce","yan","gao","kuai",
-       "gan","chou","kuang","gang","yun","o","qian","xiao","jian","pou|bu|fu|pu",
-       "lai","zou","pai|bei","bi","bi","ge","tai|chi","guai|dai","yu","jian",
-       "zhao|dao","gu","chi","zheng","qing|jing","sha","zhou","lu","bo","ji",
-       "lin","suan","jun|qun","fu","zha","gu","kong","qian","quan","jun",
-       "chui","guan","wan|yuan","ce","zu","po","ze","qie","tuo","luo",
-       "dan","xiao","ruo","jian","xuan","bian","sun","xiang","xian","ping",
-       "zhen","xing","hu","shi|yi","zhu","yue|yao|chuo","chun","lv","wu","dong",
-       "shuo|xiao|qiao","ji","jie","huang","xing","mei","fan","chuan","zhuan","pian",
-       "feng","zhu","hong","qie","hou","qiu","miao","qian","gu","kui",
-       "yi","lou","yun","he","tang","yue","chou","gao","fei","ruo",
-       "zheng","gou","nie","qian","xiao","cuan","gong|gan|long","peng|pang","du","li",
-       "bi","zhuo|huo","chu","shai","chi","zhu","qiang|cang","long","lan","jian",
-       "bu","li","hui","bi","zhu|di","cong","yan","peng","cen|zan|can","zhuan|zuan|suan",
-       "pi","piao|biao","dou","yu","mie","tuan|zhuan","ze","shai","guo|gui","yi",
-       "hu","chan","kou","cu","ping","zao","ji","gui","su","lou",
-       "ce|ji","lu","nian","suo","cuan","diao","suo","le","duan","zhu",
-       "xiao","bo","mi|mie","shai|si","dang","liao","dan","dian","fu","jian",
-       "min","kui","dai","jiao","deng","huang","sun|zhuan","lao","zan","xiao",
-       "lu","shi","zan","qi","pai","qi","pai","gan","ju","lu",
-       "lu","yan","bo","dang","sai","zhua","gou","qian","lian","bu|bo",
-       "zhou","lai","shi","lan","kui","yu","yue","hao","zhen|jian","tai",
-       "ti","nie","chou","ji","yi","qi","teng","zhuan","zhou","fan|pan|bian",
-       "sou|shu","zhou","qian","zhuo","teng","lu","lu","jian","tuo","ying",
-       "yu","lai","long","shen shi|sen si|qie","lian","lan","qian","yue","zhong","qu",
-       "lian","bian","duan","zuan","li","shai","luo","ying","yue","zhuo",
-       "yu","mi","di","fan","shen","zhe","shen","nv","he","lei",
-       "xian","zi","ni","cun","zhang","qian","zhai","bi","ban","wu",
-       "sha|chao","kang|jing","rou","fen","bi","cui","yin","zhe","mi","ta",
-       "hu","ba","li","gan","ju","po","yu","cu","nian","zhou",
-       "chi","su","tiao","li","xi","su","hong","tong","zi|ci","ce|se",
-       "yue","zhou|yu","lin","zhuang","bai","lao","fen","er","qu","he",
-       "liang","xian","fu","liang","can","jing","li","yue","lu","ju",
-       "qi","cui","bai","zhang","lin","zong","jing","guo","hua","san|shen",
-       "shen","tang","bian","rou","mian","hou","xu","zong","hu","jian",
-       "zan","ci","li","xie","fu","nuo","bei","gu|gou","xiu","gao",
-       "tang","qiu","jia","cao","zhuang","tang","mi|mei","san|shen","fen","zao",
-       "kang","jiang","mo","san|shen","san","nuo","xi","liang","jiang","kuai",
-       "bo","huan","shu","zong","xian","nuo","tuan","nie","li","zuo",
-       "di","nie","tiao","lan","mi|si","si","jiu","xi|ji","gong","zheng",
-       "jiu","gong","ji","cha","zhou","xun","yue|yao","hong|gong","yu","he|ge",
-       "wan","ren","wen","wen","qiu","na","zi","tou","niu","fou",
-       "ji|jie","shu","chun","bi","zhen","sha","hong","zhi","ji","fen",
-       "yun","ren","dan","jin","su","fang","suo","cui","jiu","zha|za",
-       "ha","jin","fu","zhi","qi","zi","chou","hong","zha|za","lei",
-       "xi","fu","xie","shen","bo|bi","zhu","qu","ling","zhu","shao",
-       "gan","yang","fu","tuo","zhen|tian","dai","chu","shi","zhong","xian",
-       "zu","jiong","ban","qu","mo","shu","zui","kuang","jing","ren",
-       "hang","xie","jie","zhu","chou","gua|kua","bai|mo","jue","kuang","hu",
-       "ci","huan|geng","geng","tao","xie|jie","ku","jiao","quan|shuan","gai|ai","luo|lao",
-       "xuan","beng|bing|peng","xian","fu","gei|ji","tong|dong","rong","tiao|diao|dao","yin","lei",
-       "xie","juan","xu","gai|hai","die","tong","si","jiang","xiang","hui",
-       "jue","zhi","jian","juan","chi|zhi","mian|wen|man|wan","zhen","lv","cheng","qiu",
-       "shu","bang","tong","xiao","huan|wan","qin|xian","geng","xu","ti","xiu",
-       "xie","hong","xi","fu","ting","sui","dui","kun","fu","jing",
-       "hu","zhi","yan|xian","jiong","feng","ji","xu","ren","zong|zeng","lin|chen",
-       "duo","li|lie","lv","jing","chou","quan","shao","qi","qi","zhun",
-       "ji|qi","wan","qian|qing|zheng","xian","shou","wei","qing|qi","tao","wan","gang",
-       "wang","beng","zhui","cai","guo","cui","lun|guan","liu","qi","zhan",
-       "bi","chuo|chao","ling","mian","qi","ji","tian|tan|chan","zong","gun","zou",
-       "xi","zi","xing","liang","gei|ji","fei","rui","min","yu","zong",
-       "fan","lv|lu","xu","ying","shang","zi","xu","xiang","jian","ke",
-       "xian","ruan","mian","ji|qi","duan","chong|zhong","di","min","miao|mao","yuan",
-       "xie|ye","bao","si","qiu","bian","huan","geng","zong","mian","wei",
-       "fu","wei","tou|xu|shu","gou","miao","xie","lian","zong","bian|pian","gun|yun",
-       "yin","ti","gua|wo","zhi","yun|wen","cheng","chan","dai","xie","yuan",
-       "zong","xu","sheng","wei","geng","seon","ying","jin","yi","zhui",
-       "ni","bang","gu","pan","zhou","jian","ci|cuo|suo","quan","shuang","yun|wen",
-       "xia","cui|sui|shuai","xi","rong","tao","fu","yun","zhen","gao","ru",
-       "hu","zai|zeng","teng","xian|xuan","su","zhen","zong","tao","huang","cai",
-       "bi","feng","cu","li","suo|su","yan|yin","xi","zong","lei","zhuan|juan",
-       "qian","man","zhi","lv","mu|mo","piao","lian","mi","xuan","zong",
-       "ji","shan","sui","fan|po","lv","beng","yi","sao","mou|miu|miao|mu|liao|","yao|you|zhou",
-       "qiang","sheng","xian","ji","zong","xiu","ran","xuan","sui","qiao",
-       "zeng","zuo","zhi","shan","san","lin","ju|jue","fan","liao","chuo",
-       "zun","jian","rao","chan","rui","xiu","hui","hua","zuan","xi",
-       "qiang","wen","da","sheng","hui","xi|ji","se","jian","jiang","huan",
-       "qiao|sao","cong","xie","jiao|zhuo","bi","dan|tan|chan","yi","nong","sui","yi",
-       "sha","ru","ji","bin","qian","lan","pu|fu","xun","zuan","zi",
-       "peng","yao|li","mo","lei","xie","zuan","kuang","you","xu","lei",
-       "xian","chan","jiao","lu","chan","ying","cai","xiang|rang","qian","zui",
-       "zuan","luo","li|xi|sa","dao","lan","lei","lian","si","jiu","yu",
-       "hong|gong","zhou","xian|qian","he|ge","yue|yao","ji","wan","kuang","ji","ren",
-       "wei","yun","hong","chun","pi|bi","sha","gang","na","ren","zong",
-       "lun|guan","fen","zhi","wen","fang","zhu","zhen","niu","shu","xian",
-       "gan","xie","fu","lian","zu","shen","xi","zhi","zhong","zhou",
-       "ban","fu","chu","shao","yi","jing","dai","bang","rong","jie",
-       "ku","rao","die","hang","hui","gei|ji","xuan","jiang","luo|lao","jue",
-       "jiao","tong","bing","xiao","juan","xiu","xi","sui","tao","ji",
-       "ti","ji","xu","ling","ying","xu","qi","fei","chuo|chao","shang",
-       "gun","sheng","wei","mian","shou","beng","chou","tao","liu","quan",
-       "zong|zeng","zhan","wan","lv|lu","zhui","zi","ke","xiang","jian","mian",
-       "lan","ti","miao","ji|qi","yun|wen","hui","si","duo","duan","bian|pian",
-       "xian","gou","zhui","huan","di","lv","bian","min","yuan","jin",
-       "fu","ru","zhen","feng","cui|sui|shuai","gao","chan","li","yi","jian",
-       "bin","piao","man","lei","ying","suo|su","mou|miu|miao|mu|liao|","sao","xie","liao",
-       "shan","zeng","jiang","qian","qiao|sao","huan","jiao|zhuo","zuan","fou","xie",
-       "gang","fou","que","fou","que","bo","ping","xiang","zhao","gang",
-       "ying","ying","qing","xia","guan","zun","tan","cheng","qi","weng",
-       "ying","lei","tan","lu","guan","wang","wang","wang","wang","han",
-       "rb","luo","fu","shen","fa","gu","zhu","ju","mao","gu",
-       "min","gang","ba|pi","gua","ti","juan","fu","shen","yan","zhao",
-       "zui","guai|gua","zhuo","yu","zhi","an","fa","lan","shu","si",
-       "pi","ma","liu","ba|pi","fa","li","chao","wei","bi","ji",
-       "zeng","chong","liu","ji","juan","mi","zhao","luo","pi","ji",
-       "ji","luan","yang|xiang","mi","qiang","da","mei","yang|xiang","ling","you",
-       "fen","ba","gao","yang","gu","qiang","zang","mei|gao","ling","yi|xi",
-       "zhu","di","xiu","qiang","yi","xian","rong","qun","qun","qiang",
-       "huan","suo","xian","yi","you","qiang|kong","qian|xian|yan","yu","geng","jie",
-       "tang","yuan","xi","fan","shan","fen","shan","lian","lei","geng",
-       "nou","qiang","chan","yu","hong|gong","yi","chong","weng","fen","hong",
-       "chi","chi","cui","fu","xia","ben","yi","la","yi","pi|bi|po",
-       "ling","liu","zhi","qu|yu","xi","xie","xiang","xi","xi","ke",
-       "qiao","hui","hui","xiao","sha","hong","jiang","di|zhai","cui","fei",
-       "dao|zhou","sha","chi","zhu","jian","xuan","chi","pian","zong","wan",
-       "hui","hou","he","he","han","ao","piao","yi","lian","hou|qu",
-       "ao","lin","pen","qiao","ao","fan","yi","hui","xuan","dao",
-       "yao","lao","lao","kao","mao","zhe","qi|shi","gou","gou","gou",
-       "die","die","er","shua","ruan|nuo","er|nai","nai","duan|zhuan","lei","ting",
-       "zi","geng","chao","hao","yun","ba|pa","pi","si|chi","si","qu|chu",
-       "jia","ju","huo","chu","lao","lun","ji|jie","tang","ou","lou",
-       "nou","jiang","pang","zha|ze","lou","ji","lao","huo","you","mo",
-       "huai","er","yi","ding","ye","da","song","qin","yun|ying","chi",
-       "dan","dan","hong","geng","zhi","pan","nie","dan","zhen","che",
-       "ling","zheng","you","wa|tui|zhuo","liao","long","zhi","ning","tiao","er|nv",
-       "ya","tie|zhe","guo","xu","lian","hao","sheng","lie","pin","jing",
-       "ju","bi","di|zhi","guo","wen","xu","ping","cong","ding","ni",
-       "ting","ju","cong","kui","lian","kui","cong","lian","weng","kui",
-       "lian","lian","cong","ao","sheng","song","ting","kui","nie","zhi",
-       "dan","ning","qie","ni|jian","ting","ting","long","yu","yu","zhao",
-       "si","su","yi","su","si","zhao","zhao","rou","yi","lei|le",
-       "ji","qiu","ken","cao","ge","bo|di","huan","huang","chi","ren",
-       "xiao","ru","zhou","yuan","du","gang","rong|chen","gan","chai","wo",
-       "chang","gu","zhi","qin|han","fu","fei","ban","pei","pang|pan","jian",
-       "fang","zhun|chun","you","na","ang","ken","ran","gong","yu","wen",
-       "yao","qi","pi|bi","qian","xi","xi","fei","ken","jing","tai",
-       "shen","zhong","zhang","xie","shen","wei","zhou","die","dan","fei|bi",
-       "ba","bo","qu","tian","bei","gua","tai","zi|fei","fei|ku","zhi",
-       "ni","ping|peng","zi","fu|zhou","pang|pan","zhen","xian","zuo","pei","jia",
-       "sheng","zhi","bao","mu","qu","hu","qia","chi","yin","xu",
-       "yang","long","dong","ka","lu","jing","nu","yan","pang","kua",
-       "yi","guang","hai","ge","dong","chi","jiao","xiong","xiong","er",
-       "an","heng","pian","neng|nai","zi","gui|kui","zheng","tiao","zhi","cui",
-       "mei","xie","cui","xie","mai","mai","ji","xie","nin","kuai",
-       "sa","zang","qi","nao","mi","nong","luan","wan","bo","wen",
-       "wan","xiu","jiao","jing","rou","heng","cuo","lie","shan","ting",
-       "mei","chun","shen","jia","te","juan","cu","xiu","xin","tuo",
-       "pao","cheng","nei","fu","dou","tuo","niao","nao","pi","gu",
-       "luo","li","lian","zhang","cui","jie","liang","shui","pi","biao",
-       "lun","pian","guo","juan","chui","dan","tian","nei","jing","nai",
-       "la","ye","a","ren","shen","zhui","fu","fu","ju","fei",
-       "qiang","wan","dong","pi","guo","zong","ding","wo","mei","ruan",
-       "zhuan","chi","cou","luo","ou","di","an","xing","nao","shu",
-       "shuan","nan","yun","zhong","rou","e","sai","tu","yao","jian",
-       "wei","jiao","yu","jia","duan","bi","chang","fu","xian","ni",
-       "mian","wa","teng","tui","bang","qian","lv","wa","shou","tang",
-       "su","zhui","ge","yi","bo","liao","ji","pi","xie","gao",
-       "lv","bin","ou","chang","lu|biao","guo","pang","chuai","biao","jiang",
-       "fu","tang","mo","xi","zhuan|chuan|chun","lv","jiao","ying","lv","zhi",
-       "xue","cun","lin","tong","peng","ni","chuai","liao","cui","kui",
-       "xiao","teng","fan|pan","zhi","jiao","shan","hu|wu","cui","run","xiang",
-       "sui","fen","ying","shan|dan","zhua","dan","kuai","nong","tun","lian",
-       "bi|bei","yong","jue","chu","yi","juan","la|ge","lian","sao","tun",
-       "gu","qi","cui","bin","xun","nao","wo|yue","zang","xian","biao",
-       "xing","kuan","la","yan","lu","huo","za","luo","qu","zang",
-       "luan","ni|luan","za","chen","qian|xian","wo","guang|jiong","zang|cang","lin","guang|jiong",
-       "zi","jiao","nie","chou|xiu","ji","gao","chou","mian|bian","nie","zhi",
-       "zhi","ge","jian","die|zhi","zhi|jin","xiu","tai","zhen","jiu","xian",
-       "yu","cha","yao","yu","chong","xi","xi","jiu","yu","yu",
-       "xing","ju","jiu","xin","she","she","she","jiu","shi","tan",
-       "shu","shi","tian","tan","pu","pu","guan","hua","tian","chuan",
-       "shun","xia","wu","zhou","dao","chuan","shan","yi","fan","pa",
-       "tai","fan","ban","chuan","hang","fang","ban","bi","lu","zhong",
-       "jian","cang","ling","zhu","ze","duo","bo","xian","ge","chuan",
-       "xia","lu","qiong","pang","xi","kua","fu","zao","feng","li",
-       "shao","yu","lang","ting","yu","wei","bo","meng","nian","ju",
-       "huang","shou","ke","bian","mu","die","dao","bang","cha","yi",
-       "sou","cang","cao","lou","dai","xue","yao","chong","deng","dang",
-       "qiang","lu","yi","ji","jian","huo","meng","qi","lu","lu",
-       "chan","shuang","gen","liang","jian","jian","se","yan","fu","ping",
-       "yan","yan","cao","ao","yi","le","ding","qiu","ai","nai",
-       "tiao","qiu","jie","peng","wan","yi","chai|cha","mian","mi","gan",
-       "qian","yu","yu","shao","xiong","du","hu|xia","qi","mang","zi",
-       "hui|hu","sui","zhi","xiang","bi|pi","fu","tun|chun","wei","wu","zhi",
-       "qi","shan","wen","qian","ren","fu","kou","jie|gai","lu","xu|zhu",
-       "ji","qin","qi","yuan|yan","fen","ba","rui","xin","ji","hua",
-       "lun|hua","fang","wu|hu","jue","gou","zhi","yun","qin","ao","chu",
-       "mao","ya","fei|fu","reng","hang","cong","chan|yin","you","bian","yi",
-       "qie","wei","li","pi","e","xian","chang","cang","zhu","su",
-       "di|ti","yuan","ran","ling","tai","tiao|shao","di","miao","qing","ji",
-       "yong","ke|he","mu","bei","bao","gou","min","yi","yi","ju|qu",
-       "pie","ruo|re","ku","zhu|ning","ni","pa|bo","bing","shan","xiu","yao",
-       "xian","ben","hong","ying","zuo|zha","dong","cha","die","nie","gan",
-       "hu","ping|peng","mei","fu","sheng|rui","gu","bi","wei","fu","zhuo",
-       "mao","fan","jia","mao","mao","ba","ci","mo","zi","zhi",
-       "chi","ji","jing","long","cong","niao","yuan","xue","ying","qiong",
-       "ge","ming","li","rong","yin","gen","qian","chai","chen","yu",
-       "hao","zi","lie","wu","ji","gui","ci","jian","ci","hou",
-       "guang","mang","cha","jiao","jiao","fu","yu","zhu","zi","jiang",
-       "hui","yin","cha","fa","rong","ru","chong","mang","tong","zhong",
-       "qian","zhu","xun","huan","fu","quan","gai","da","jing","xing",
-       "chuan","cao","jing","er","an","qiao","chi","ren","jian","ti",
-       "huang","ping","li","jin","lao","shu","zhuang","da","jia","rao",
-       "bi","ce","qiao","hui","ji","dang","zi","rong","hun","xing",
-       "luo","ying","qian","jin","sun","yin","mai","hong","zhou","yao",
-       "du","wei","li","dou","fu","ren","yin","he","bi","bu",
-       "yun","di","tu","sui","sui","cheng","chen","wu","bie","xi",
-       "geng","li","pu","zhu","mo","li","zhuang","zuo","tuo","qiu",
-       "suo|sha","suo","chen","peng|feng","ju","mei","meng","xing","jing","che",
-       "shen|xin","jun","yan","ting","you","cuo","guan|wan","han","you","cuo",
-       "jia","wang","su|you","niu","shao|xiao","xian","lang|liang","fu|piao","e","mo|mu",
-       "wen|wan|mian","jie","nan","mu","kan","lai","lian","shi","wo","tu",
-       "xian|lian","huo","you","ying","ying","neus","chun","mang","mang","ci",
-       "wan|yun","jing","di","qu","dong","jian","zou|chu","gu","la","lu",
-       "ju","wei","jun","nie|ren","kun","he","pu","zi|zai","gao","guo",
-       "fu","lun","chang","chou","song","chui","zhan","men","cai","ba",
-       "li","tu","bo","han","bao","qin","juan","xi","qin","di",
-       "jie|sha","pu","dang","jin","qiao|zhao","tai|zhi|chi","geng","hua","gu","ling",
-       "fei","qin|jin","an","wang","beng","zhou","yan","zu","jian","lin|ma",
-       "tan","shu","tian","dao","hu","qi","he","cui","tao","chun",
-       "bi","chang","huan","fei","lai","qi","meng","ping","wei","dan",
-       "sha","huan","yan","yi","tiao","qi","wan","ce","nai","zhen",
-       "tuo","jiu","tie","luo","bi","yi","pan","bo","pao","ding",
-       "ying","ying","ying","xiao","sa","qiu","ke","xiang","wan","yu",
-       "yu","fu","lian","xuan","xuan","nan","ce","wo","chun","shao",
-       "yu","bian","mao","an","e","luo|la|lao","ying","kuo","kuo","jiang",
-       "mian","zuo","zuo","zu","bao","rou","xi","ye","an","qu",
-       "jian","fu","lv","jing","pen","feng","hong","hong","hou","xing",
-       "tu","zhu|zhuo|zhe","zi","xiang","ren","ge","qia","qing","mi","huang",
-       "shen","pu","gai","dong","zhou","qian","wei","bo","wei","pa",
-       "ji","hu","zang","jia","duan","yao","jun","cong","quan","wei",
-       "zhen","kui","ting","hun","xi","shi","qi","lan","zong","yao",
-       "yuan","mei","yun","shu","di","zhuan","guan","ran","xue","chan",
-       "kai","kui|kuai","uu","jiang","lou","wei","pai","yong","sou","yin",
-       "shi","chun","shi","yun","zhen","lang","ru|na","meng","li","que",
-       "suan","yuan|huan","li","ju","xi","bang","chu","xu|shu","tu","liu",
-       "huo","dian","qian","ju","po","cuo","yuan","chu","yu","kuai",
-       "pan","pu","pu","na","shuo","xi","fen","yun","zheng","jian",
-       "ji","ruo","cang","en","mi","hao","sun","zhen","ming","sou",
-       "xu","liu","xi","gu","lang","rong","weng","gai|ge|he","cuo","shi",
-       "tang","luo","ru","suo","xuan","bei","yao|zhuo","gui","bi","zong",
-       "gun","zuo","tiao","ce","pei","lan","dan","ji","li","shen",
-       "lang","yu","ling","ying","mo","diao|tiao|di","tiao","mao","tong","zhu",
-       "peng","an","lian","cong","xi","ping","qiu|xu|fu","jin","chun","jie",
-       "wei","tui","cao","yu","yi","zi|ju","liao|lu","bi","lu","xu",
-       "bu","zhang","lei","qiang","man","yan","ling","ji","biao","gun",
-       "han","di","su","lu","she","shang","di","mie","hun","wan",
-       "bu","di","cuo","zhe","shen","xuan","wei","hu","ao","mi",
-       "lou","cu","zhong","cai","po","jiang","mi","cong","niao","hui",
-       "juan","yin","jian","nian","shu","yin","guo","chen","hu","sha",
-       "kou","qian","ma","zang","ze","qiang","dou","lian","lin","kou",
-       "ai","bi","li","wei","ji","qian","sheng","fan","meng","ou",
-       "chan","dian","xun","jiao","rui","rui","lei","yu","qiao","zhu",
-       "hua","jian","mai","yun","bao","you","qu","lu","rao","hui",
-       "e","ti","fei","jue","zui","fa","ru","fen","kui","shun",
-       "rui","ya","xu","fu","jue","dang","wu","dong","si","xiao",
-       "xi","sa","yun","shao","qi","jian","yun","sun","ling","yu",
-       "xia","weng","ji","hong","si","nong","lei","xuan","yun","yu",
-       "xi|xiao","hao","bao|bo","hao","ai","wei","hui","hui","ji","ci",
-       "xiang","wan|luan","mie","yi","leng","jiang","can","shen","qiang|se","lian",
-       "ke","yuan","da","ti","tang","xue","bi","zhan","sun","xian|lian",
-       "fan","ding","xie","gu","xie","shu","jian","hao|kao","hong","sa",
-       "xin","xun","yao","bai","sou","shu","xun","dui","pin","yuan|wei",
-       "ning","chou|zhou","mai|wo","ru","piao","tai","ji","zao","chen","zhen",
-       "er","ni","ying","gao","cong","xiao|hao","qi","fa","jian","xu",
-       "kui","jie|ji","bian","diao|zhuo","mi","lan","jin","cang|zang","miao","qiong",
-       "qi","xian","liao","ou","xian","su","lv","yi","mai","xie",
-       "li","yi","la","lei","jiao","di","zhi","bei","teng","yao|yue",
-       "mo","huan","biao|pao","fan","sou","tan","tui","qiong","qiao","wei",
-       "liu","hui","ou","gao","yun","bao","li","shu","zhu|chu","ai",
-       "lin","zao","xuan","qin","lai","huo","tuo","wu","rui","rui",
-       "qi","heng","lu","su","tui","mang","yun","ping","yu","xun",
-       "ji","jiong","xuan","mo","qiu","su","jiong","peng","nie","nie",
-       "rang","yi","xian","yu","ju","lian","lian","yin","qiang","ying",
-       "long","tou","hua","yue","ling","qu","yao","fan","mi","lan",
-       "gui","lan","ji","dang","man","lei","lei","hui","feng","zhi",
-       "wei","kui","zhan","huai","li","ji","mi","lei","huai","luo",
-       "ji","kui","lu","jian","sal","teng","lei","quan","xiao","yi",
-       "luan","men","bie","hu","hu","lu","nve","lv","si","xiao",
-       "qian","chu","hu","xu","cuo","fu","xu","xu","lu","hu",
-       "yu","hao","jiao","ju","guo","bao","yan","zhan","zhan","kui",
-       "bin","xi","shu","chong","qiu","diao","ji","qiu","ding","shi",
-       "xia","jue","zhe","she","yu","han","zi","hong","hui","meng",
-       "ge","sui","xia","chai","shi","yi","ma","xiang","fang|bang","e",
-       "ba","chi","qian","wen","wen","rui","bang|beng","pi","yue","yue",
-       "jun","qi","tong","yin","qi|zhi","can","yuan|wan","jue|que","hui","qin|qian",
-       "qi","zhong","ya","hao","mu","wang","fen","fen","hang","gong|zhong",
-       "zao","fu","ran","jie","fu","chi","dou","bao","xian","ni",
-       "dai|de","qiu","you","zha","ping","chi","you","he","han","ju",
-       "li","fu","ran","zha","gou|qu|xu","pi","pi|bo","xian","zhu","diao",
-       "bie","bing","gu","zhan","qu","she|yi","tie","ling","gu","dan",
-       "tun","ying","li","cheng","qu","mou","ge|luo","ci","hui","hui",
-       "mang|bang","fu","yang","wa","lie","zhu","yi","xian","kuo","jiao",
-       "li","yi|xu","ping","jie","ge|ha","she","yi","wang","mo","qiong",
-       "qie|ni","gui","qiong","zhi","man","lao","zhe","jia","nao","si",
-       "qi","xing","jie","qiu","xiao","yong","jia","tui","che","bei",
-       "e|yi","han","shu","xuan","feng","shen","shen","fu","xian","zhe",
-       "wu","fu","li","lang","bi","chu","yuan","you","jie","dan",
-       "yan","ting","dian","tui","hui","wo","zhi","zhong","fei","ju",
-       "mi","qi","qi","yu","jun","la","meng","qiang","si","xi",
-       "lun","li","die","tiao","tao","kun","han","han","yu","bang",
-       "fei","pi","wei","dun","yi","yuan","suo","quan","qian","rui",
-       "ni","qing","wei","liang","guo","wan","dong","e","ban","di",
-       "wang","can","yang","ying","guo","chan","ding","la","ke","ji",
-       "xie","ting","mao","xu","mian","yu","jie","shi","xuan","huang",
-       "yan","bian","rou","wei","fu","yuan","mei","wei","fu","ru",
-       "xie","you","qiu","mao","xia","ying","shi","chong","tang","zhu",
-       "zong","di","fu","yuan","kui","meng","la","dai","hu","qiu",
-       "die","li","wo","yun","qu","nan","lou","chun","rong","ying",
-       "jiang","ban","lang","pang","si","xi","ci","xi","yuan","weng",
-       "lian","sou","ban","rong","rong","ji","wu","xiu","han","qin",
-       "yi","bi","hua","tang","yi","du","nai|neng","he|xia","hu","gui|hui",
-       "ma","ming","yi","wen","ying","teng","zhong","cang","sao","qi",
-       "man","dao","shang","shi|zhe","cao","chi","di","ao","lu","wei",
-       "die|zhi","tang","chen","piao","qu|ju","pi","yu","chan|jian","luo","lou",
-       "qin","zhong","yin","jiang","shuai","wen","xiao","wan","zhe","zhe",
-       "ma","ma","guo","liu","mao","xi","cong","li","man","xiao",
-       "chang","zhang","mang|meng","xiang","mo","zui","si","qiu","te","zhi",
-       "peng","peng","jiao","qu","bie","liao","pan","gui","xi","ji",
-       "zhuan","huang","fei|ben","lao|liao","jue","jue","hui","yin|xun","chan","jiao",
-       "shan","nao","xiao","wu","chong","xun","si","chu","cheng","dang",
-       "li","xie","shan","yi","jing","da","chan","qi","ci","xiang",
-       "she","luo","qin","ying","chai","li","zei","xuan","lian","zhu",
-       "ze","xie","mang","xie","qi","rong","jian","meng","hao","ru",
-       "huo","zhuo","jie","pin","he","mie","fan","lei","jie","la",
-       "min","li","chun","li","qiu","nie","lu","du","xiao","zhu",
-       "long","li","long","feng","ye","pi","nang","gu","juan","ying",
-       "shu","xi","can","qu","quan","du","can","man","qu","jie",
-       "zhu","zhuo","xie","huang","nv","pei","nv","xin","zhong","mai",
-       "er","ke","mie","xi","xing|hang|heng","yan","kan","yuan","qu","ling",
-       "xuan","shu","xian","tong","xiang","jie","xian","ya","hu","wei",
-       "dao","chong","wei","dao","zhun","heng","qu","yi","yi","bu",
-       "gan","yu","biao","cha","yi","shan","chen","fu","gun","fen",
-       "shuai","jie","na","zhong","dan","ri","zhong","zhong","jie","zhi",
-       "xie","ran","zhi","ren","qin","jin","jun","yuan","mei","chai",
-       "ao","niao","hui","ran","jia","tuo","ling","dai","bao|pao","pao",
-       "yao","zuo","bi","shao","tan","ju|jie","he|ke","xue","xiu","zhen",
-       "yi","pa","fu","di","wa","fu","gun","zhi","zhi","ran",
-       "pan","yi","mao","tuo","na|jue","gou","xuan","zhe","qu","bei|pi",
-       "yu","xi","mi","bo","uu","fu","chi|nuo","chi|qi|duo|nuo","ku","ren",
-       "peng","jia|jie|qia","jian|zun","bo|mo","jie","er","ge","ru","zhu","gui|gua",
-       "yin","cai","lie","ka","hang","zhuang","dang","xu","kun","ken",
-       "niao","shu","jia","kun","cheng","li","juan","shen","pou","ge|jie",
-       "yi","yu","zhen","liu","qiu","qun","ji","yi","bu","zhuang",
-       "shui","sha","qun","li","lian","lian","ku","jian","bao","chan",
-       "bi|pi","kun","tao","yuan","ling","chi","chang","chou|dao","duo","biao",
-       "liang","chang|shBng","pei","pei","fei","yuan|gun","luo","guo","yan|an","du",
-       "xi|ti","zhi","ju","yi","qi","guo","gua","ken","qi","ti",
-       "ti","fu","chong","xie","bian","die","kun","duan","xiu","xiu",
-       "he","yuan","bao","bao","fu","yu","tuan","yan","hui","bei",
-       "zhu","lv","pao","dan","yun","ta","gou","da","huai","rong",
-       "yuan","ru","nai","jiong","suo","ban","tui","chi","sang","niao",
-       "ying","jie","qian","huai","ku","lian","lan","li","zhe","shi",
-       "lv","yi","die","xie","xian","wei","biao","cao","ji","qiang",
-       "sen","bao","xiang","bi","fu","jian","zhuan","jian","cui","ji",
-       "dan","za","fan","bo","xiang","xin","bie","rao","man","lan",
-       "ao","ze","gui","cao","sui","nong","chan","lian","bi","jin",
-       "dang","shu","tan","bi","lan","fu","ru","zhi","ta","shu",
-       "wa","shi","bai","xie","bo","chen","lai","long","xi","xian",
-       "lan","zhe","dai","ju","zan","shi","jian","pan","yi","lan",
-       "ya","xi","ya","yao","feng","tan|qin","fu","fiao","fu","ba|po",
-       "he","ji","ji","jian|xian","guan","bian","yan","gui","jue|jiao","pian",
-       "mao","mi","mi","pie|mie","shi","si","chan","zhen","jue|jiao","mi",
-       "tiao","lian","yao","zhi","jun","xi","shan","wei","xi","tian",
-       "yu","lan","e","du","qin|qing","pang","ji","ming","ying","gou",
-       "qu","zhan","jin","guan","deng","jian|bian","luo|luan","qu","jian","wei",
-       "jue|jiao","qu","luo","lan","shen","di","guan","jian|xian","guan","yan",
-       "gui","mi","shi","chan","lan","jue|jiao","ji","xi","di","tian",
-       "yu","gou","jin","qu","jiao|jue","qiu","jin","cu","jue","zhi",
-       "chao","ji","gu","dan","zi|zui","di","shang","hua|xie","quan","ge",
-       "shi","jie|xie","gui","gong","chu","jie|xie","hun","qiu","xing","su",
-       "ni","ji|qi","jue","zhi","zha","bi","xing","hu","shang","gong",
-       "zhi","xue|hu","chu","xi","yi","li|lu","jue","xi","yan","xi",
-       "yan","yan","ding","fu","qiu","qiu","jiao","hong","ji","fan",
-       "xun","diao","hong","chai","tao","xu","jie","dan","ren","xun",
-       "yin","shan","qi","tuo","ji","xun","yin","e","fen","ya",
-       "yao","song","shen","yin","xin","jue","xiao","ne","chen","you",
-       "zhi","xiong","fang","xin","chao","she","yan","sa","zhun","xu",
-       "yi","yi","su","chi","he","shen","he","xu","zhen","zhu",
-       "zheng","gou","zi","zi","zhan","gu","fu","jian","die","ling",
-       "di","yang","li","nao","pan","zhou","gan","yi","ju","yao",
-       "zha","tuo","yi","qu","zhao","ping","bi","xiong","qu","ba",
-       "da","zu","tao","zhu","ci","zhe","yong","xu","xun","yi",
-       "huang","he","shi","cha","xiao","shi","hen","cha","gou","gui",
-       "quan","hui","jie","hua","gai","xiang","wei","shen","chou","tong",
-       "mi","zhan","ming","luo","hui","yan","xiong","gua","er","bing",
-       "tiao|diao","yi|chi","lei","zhu","kuang","kua","wu","yu","teng","ji",
-       "zhi","ren","cu","lang","e","kuang","ei|xi","shi","ting","dan",
-       "bei|bo","chan","you","keng","qiao","qin","shua","an","yu","xiao",
-       "cheng","jie","xian","wu","wu","gao","song","bu","hui","jing",
-       "shuo|shui|yue","zhen","shuo|shui|yue","du","hua","chang","shui|shei","jie","ke","qu|jue",
-       "cong","xiao","sui","wang","xian","fei","chi|lai","ta","yi","ni|na",
-       "yin","diao|tiao","pi|bei","zhuo","chan","chen","zhun","ji","qi","tan",
-       "zhui","wei","ju","qing","dong","zheng","ze|zuo|zha|cuo","zou","qian","zhuo",
-       "liang","jian","chu|ji","xia|hao","lun","shen","biao","hua","bian","yu",
-       "die","xu","pian","shi|di","xuan","shi","hun","hua|gua","e","zhong",
-       "di","xie","fu","pu","ting","jian","qi","yu","zi","zhuan",
-       "xi|shai|ai","hui","yin","an","xian","nan","chen","feng","zhu","yang",
-       "yan","huang","xuan","ge","nuo","xu","mou","ye","wei","xing",
-       "teng","zhou","shan","jian","bo","kui","huang","huo","ge","ying",
-       "mi","xiao","mi","xi","qiang","chen","xue","ti","su","bang",
-       "chi","qian","shi","jiang","yuan","xie","he","tao","yao","yao",
-       "lu","yu","biao","cong","qing","li","mo","mo","shang","zhe",
-       "miu","jian","ze","jie","lian","lou","can","ou","gun","xi",
-       "zhuo","ao","ao","jin","zhe","yi","hu","jiang","man","chao",
-       "han","hua","chan","xu","zeng","se","xi","zha","dui","zheng",
-       "nao","lan","e","ying","jue","ji","zun","jiao","bo","hui",
-       "zhuan","wu","zen","zha","shi","qiao","tan","jian","pu","sheng",
-       "xuan","zao","tan","dang","sui","xian","ji","jiao","jing","zhan",
-       "nong","yi","ai","zhan","pi","hui","hua","yi","yi","shan",
-       "rang","rou","qian","dui","ta","hu","zhou","hao","ai","ying",
-       "jian","yu","jian","hui","du","zhe","juan|xuan","zan","lei","shen",
-       "wei","chan","li","yi|tui","bian","zhe","yan","e","chou","wei",
-       "chou","yao","chan","rang","yin","lan","chen","xie","nie","huan",
-       "zan","yi","dang","zhan","yan","du","yan","ji","ding","fu",
-       "ren","ji","jie","hong","tao","rang","shan","qi","tuo","xun",
-       "yi","xun","ji","ren","jiang","hui","ou","ju","ya","ne",
-       "xu|hu","e","lun","xiong","song","feng","she","fang","jue","zheng",
-       "gu","he","ping","zu","shi|zhi","xiong","zha","su","zhen","di",
-       "zhou","ci","qu","zhao","bi","yi","yi|dai","kuang","lei","shi",
-       "gua","shi","jie|ji","hui","cheng","zhu","shen","hua","dan","gou",
-       "quan","gui","xun","yi","zheng","gai","xiang|yang","cha","hun","xu",
-       "zhou|chou","jie","wu","yu","qiao","wu","gao","you","hui","kuang",
-       "shuo|shui|yue","song","ei|xi","qing","zhu","zou","nuo","du|dou","zhuo","fei",
-       "ke","wei","yu","shui","shen","diao","chan","liang","zhun","sui",
-       "tan","shen","yi","mou","chen","die","huang","jian","xie","xue",
-       "ye","wei","e","yu","xuan","chan","zi","an","yan","di",
-       "mi","pian","xu","mo","dang","su","xie","yao","bang","shi",
-       "qian","mi","jin","man","zhe","jian","miu","tan","zen","qiao",
-       "lan","pu","jue","yan","qian","zhan","chen","gu","qian","hong",
-       "xia","ji","hong","han","hong","xi","xi","huo","liao","han",
-       "du","long","dou","jiang","qi","chi","li","deng","wan","bi",
-       "shu","xian","feng","zhi","zhi","yan","yan","shi","chu","hui",
-       "tun","yi","tun","yi","jian","ba","hou","e","chu","xiang",
-       "huan","jian","ken","gai","ju","fu","xi","bin","hao","yu",
-       "zhu","jia","fen","xi","hu","wen","huan","bin","di","zong",
-       "fen","yi","zhi","bao","chai","an","pi","na","pi","gou",
-       "na","you","diao","mo","si","xiu","huan","ken|kun","he|mo","he|hao|mo",
-       "mo","an","mao","li","ni","bi","yu","jia","tuan","mao",
-       "pi","xi","yi","ju|lou","mo","chu","tan","huan","jue","bei",
-       "zhen","yuan|yun","fu","cai","gong","dai","yi","hang","wan","pin",
-       "huo","fan","tan","guan","ze|zhai","zhi","er","zhu","shi","bi",
-       "zi","er","gui","pian","bian","mai","dai|te","sheng","kuang","fei",
-       "tie","yi","chi","mao","he","bi|ben","lu","lin","hui","gai",
-       "pian","zi","jia|gu","xu","zei","jiao","gai","zang","jian","ying",
-       "jun","zhen","she","bin","bin","qiu","she","chuan","zang","zhou",
-       "lai","zan","ci","chen","shang","tian","pei","geng","xian","mai",
-       "jian","sui","fu","dan","cong","cong","zhi","lai","zhang","du",
-       "jin","xiong|min","chun","yun","bao","zai","lai","feng","cang","ji",
-       "sheng","ai","zhuan|zuan","fu","gou","sai","ze","liao","yi","bai",
-       "chen","wan","zhi","zhui","biao","yun","zeng","dan","zan","yan",
-       "pu","shan","wan","ying","jin","gan","xian","zang","bi","du",
-       "shu","yan","shang","xuan","long","gan","zang","bei","zhen","fu",
-       "yuan","gong","cai","ze","xian","bai","zhang","huo","zhi","fan",
-       "tan","pin","bian","gou","zhu","guan","er","jian","bi","shi",
-       "tie","gui","kuang","dai","mao","fei","he","yi","zei","zhi",
-       "jia|gu","hui","zi","lin","lu","zang","zi","gai","jin","qiu",
-       "zhen","lai","she","fu","du","ji","shu","shang","ci","bi",
-       "zhou","geng","pei","dan","lai","feng","zhui","fu","zhuan","sai",
-       "ze","yan","zan","yun","zeng","shan","ying","gan","chi","xi",
-       "she","nan","tong","xi","cheng","he","cheng","zhe","xia","tang",
-       "zou","zou","li","jiu","fu","zhao","gan","qi","shan","qiong",
-       "yin","xian","zi","jue","qin","chi","ci","chen","chen","die|tu",
-       "qie|ju","chao","di","xi","zhan","jue","yue","qu|cu","ji|jie","qu",
-       "chu","gua|huo","xue","zi","tiao","duo","lie","gan","suo","cu",
-       "xi","zhao","su","yin","ju","jian","que|qi|ji","tang","chuo","cui",
-       "lu","qu|cu","dang","qiu","zi","ti","qu|cu","chi","huang","qiao",
-       "qiao","jiao","zao","ti|yue","er","zan","zan","zu","pa","bao|bo",
-       "kua|wu","ke","dun","jue|gui","fu","chen","jian","fang|pang","zhi","ta",
-       "yue","ba|pao","qi","yue","qiang","tuo","tai","yi","jian|chen","ling",
-       "mei","ba","die","ku","tuo","jia","ci","pao","qia","zhu",
-       "ju","dian|tie|die","zhi","fu","pan|ban","ju|qie","shan","bo","ni","ju",
-       "li|luo","gen","yi","ji","dai|duo|chi","xian","jiao","duo","zhu","quan",
-       "kua","zhuai","gui","qiong","kui","xiang","die","lu","pian|beng","zhi",
-       "jie","tiao|tao","cai","jian","da","qiao","bi","xian","duo","ji",
-       "ju","ji","shu|chou","tu","chuo","jing","nie","xiao","bu","xue",
-       "qun","mu","shu","liang","yong","jiao","chou","qiao","mou","ta",
-       "jian","ji","wo","wei","chuo","jie","ji","nie","ju","nie",
-       "lun","lu","leng","huai","ju","chi","wan","quan","ti","bo",
-       "zu","qie","qi","cu","zong","cai","zong","peng","zhi","zheng",
-       "dian","zhi","yu","duo","dun","chuan","yong","zhong","di","zhe",
-       "chen","chuai","jian","gua","tang","ju","fu","cu","die","pian",
-       "rou","nuo","ti","cha","tui","jian","dao","cuo","xi","ta",
-       "qiang","nian","dian","ti","ji","nie","pan","liu","zan","bi",
-       "chong","lu","liao","cu","tang","dai","su","xi","kui","ji",
-       "zhi","qiang","di","pan","zong","lian","beng","zao","nian","bie",
-       "tui","ju","deng","ceng","xian","fan","chu","zhong","dun","bo",
-       "cu","cu","jue","jue","lin","ta","qiao","qiao","pu","liao",
-       "dun","cuan","guan","zao","ta","bi","bi","zhu","ju","chu",
-       "qiao","dun","chou","ji","wu","yue","nian","lin","lie","zhi",
-       "li|luo","zhi","chan","chu","duan","wei","long","lin","xian","wei",
-       "zuan","lan","xie","rang","sa|xie","nie","ta","qu","ji","cuan",
-       "zuan","xi","kui","jue","lin","shen","gong","dan","fen","qu",
-       "ti","duo","duo","gong","lang","ren","luo","ai","ji","ju",
-       "tang","kong","lao","yan","mei","kang","qu","lou","lao","duo",
-       "zhi","yan","ti","dao","ying","yu","che|ju","ya|zha|ga","gui","jun",
-       "wei","yue","xin|xian","dai","xuan","fan|gui","ren","shan","kuang","shu",
-       "tun","chen","dai","e","na","qi","mao","ruan","kuang","qian",
-       "zhuan","hong","hu","qu","kuang","di","ling","dai","ao","zhen",
-       "fan","kuang","yang","peng","bei","gu","gu","pao","zhu","rong",
-       "e","ba","zhou","zhi","yao","ke","yi","qing","shi","ping",
-       "er","gong","ju","jiao","guang","lu","kai","quan","zhou","zai",
-       "zhi","she","liang","yu","shao","you","wan","yin","zhe","wan",
-       "fu","qing","zhou","ni","ling","zhe","han","liang","zi","hui",
-       "wang","chuo","guo","kan","yi","peng","qian","gun","nian","ping",
-       "guan","bei","lun","pai","liang","ruan","rou","ji","yang","xian",
-       "chuan","cou","chun","ge","you","hong","shu","fu","zi","fu",
-       "wen","fan","zhan","yu","wen","tao","gu","zhen","xia","yuan",
-       "lu","jiao","chao","zhuan","wei","hun","xue","zhe","jiao","zhan",
-       "bu","lao","fen","fan","lin","ge","se","kan","huan","yi",
-       "ji","dui","er","yu","jian","hong","lei","pei","li","li",
-       "lu","lin","che","ya","gui","xuan","dai","ren","zhuan","e",
-       "lun","ruan","hong","gu","ke","lu","zhou","zhi","yi","hu",
-       "zhen","li","yao","qing","shi","zai","zhi","jiao","zhou","quan",
-       "lu","jiao","zhe","fu","liang","nian","bei","hui","gun","wang",
-       "liang","chuo","zi","cou","fu","ji","wen","shu","pei","yuan",
-       "xia","zhan|nian","lu","zhe","lin","xin","gu","ci","ci","bi|pi",
-       "zui","bian","la","la","ci","xue","ban","bian","bian","bian",
-       "xue","bian","ban","ci","bian","bian","chen","ru","nong","nong",
-       "zhen","chuo","chuo","yi","reng","bian","dao|bian","shi","yu","liao",
-       "da","chan","gan","qian","yu","yu","qi","xun","yi","guo",
-       "mai","qi","bi","wang|kuang","tu","zhun","ying","da","yun","jin",
-       "hang","ya","fan","wu","da","e","huan|hai","zhe|zhei","da","jin",
-       "yuan","wei","lian","chi","che","chi","tiao","zhi|li","yi","jiong",
-       "jia","chen","dai","er","di","po|pai","zhu|wang","die","ze","tao",
-       "shu","yi","keop","jing","hui","dong","you","mi","beng","ji",
-       "nai","yi","jie","zhui|dui","lie","xun","tui","song","kuo","tao",
-       "pang","hou","ni","dun","jiong","xuan","xun","bu","you","xiao",
-       "qiu","tou","zhu","qiu","di","di","tu","jing","ti","dou",
-       "yi","zhe","tong","guang","wu","shi","cheng","su","zao","qun",
-       "feng","lian","suo","hui","li","gu","lai","ben","cuo","zhu",
-       "beng","huan","dai","lu","you","zhou","jin","yu","chuo","kui",
-       "wei","ti","yi","da","yuan","luo","bi","nuo","yu","dang",
-       "sui","dun","sui","yan","chuan","chi","di","yu","shi","zhen",
-       "you","yun","e","bian","guo","e","xia","huang","qiu","dao",
-       "da","wei","nan","yi","gou","yao","chou","liu","xun","ta",
-       "di","chi","yuan","su","ta","qian","ma","yao","guan","zhang",
-       "ao","shi","ca","chi","su","zao","zhe","dun","di","lou",
-       "chi","cuo","lin","zun","rao","qian","xuan","yu","wei","e",
-       "liao","ju","shi","bi","yao","mai","xie","sui","huan|hai","zhan",
-       "teng","er","miao","bian","bian","la","li|chi","yuan","yao","luo",
-       "li","yi","ting","deng","qi","yong","shan","han","yu","mang",
-       "ru","qiong","xi","kuang","fu","kang|hang","bin","fang","xing","na|nei",
-       "xin","shen","bang","yuan","cun","huo","xie|ya|ye|yu|xu|","bang","wu","ju",
-       "you","han","tai","qiu","bi","pi","bing","shao","bei","wa",
-       "di","zou","ye","lin","kuang","gui","zhu","shi","ku","yu",
-       "gai|hai","he","qie|xi","zhi","ji","xun|huan","hou","xing","jiao","xi",
-       "gui","na","lang","jia","kuai","zheng","lang","yun","yan","cheng",
-       "dou","chi","lv","fu","wu","fu","gao","hao","lang","jia",
-       "geng","jun","ying","bo","xi","bei","li|zhi","yun","bu","xiao|ao",
-       "qi","pi","qing","guo","zhou","tan","zou","ping","lai","ni",
-       "chen","you","bu","xiang","dan","ju","yong","qiao","yi","du|dou",
-       "yan","mei","ruo","bei","e","shu","juan","yu","yun","hou",
-       "kui","xiang","xiang","sou","tang","ming","xi","ru","chu","zi",
-       "zou","yi","wu","xiang","yun","hao","yong","bi","mao","chao",
-       "fu","liao","yin","zhuan","hu","qiao","yan","zhang","man","qiao",
-       "xu","deng","bi","xun","bi","zeng","wei","zheng","mao","shan",
-       "lin","po","dan","meng","ye","cao","kuai","feng","meng","zou",
-       "kuang","lian","zan","chan","you","qi","yan","chan","cuo","ling",
-       "huan","xi","feng","cuo","li","you","ding","qiu","zhuo","pei",
-       "zhou","yi","gan","yu","jiu","yan","zui","mao","dan","xu",
-       "dou","zhen","fen","yuan","fu","yun","tai","tian","qia","tuo",
-       "cu","han","gu","su","fa","chou","zai","ming","lao","chuo",
-       "chou","you","tong","zhi","xian","jiang","cheng","yin","tu","jiao",
-       "mei","ku","suan","lei","pu","zui","hai","yan","shai","niang",
-       "wei","lu","lan","yan","tao","pei","zhan","chun","tan|dan","zui",
-       "zhui","cu","kun","ti","xian","du","hu","xu","xing","tan",
-       "qiu|chou","chun","yun","fa","ke","sou","mi","quan","chou","cuo",
-       "yun","yong","ang","zha","hai","tang","jiang","piao","chan|chen","yu",
-       "li","zao","lao","yi","jiang","bu","jiao","xi","tan","po|fa",
-       "nong","yi|shi","li","ju","yan|lian|xian","yi","niang","ru","xun","chou",
-       "yan","ling","mi","mi","niang","xin","jiao","shi","mi","yan",
-       "bian","cai","shi","you","shi","shi","li","zhong|chong","ye","liang",
-       "li","jin","jin","ga","yi","liao","dao","zhao","ding","po",
-       "qiu","he","fu","zhen","zhi","ba","luan","fu","nai","diao",
-       "shan","qiao|jiao","kou","chuan","zi","fan","hua|yu","hua|wu","han","gang",
-       "qi","mang","ri|ren|jian","di|dai","si","xi","yi","chai","shi|yi","tu",
-       "xi","nv","qian","qiu","ri|ren|jian","pi|zhao","ye|ya","jin","ba","fang",
-       "chen","xing","dou","yue","qian","fu","bu","na","xin","e",
-       "jue","dun","gou","yin","qian","ban","sa","ren","chao","niu",
-       "fen","yun","yi","qin","pi","guo","hong","yin","jun","diao",
-       "yi","zhong","xi","gai","ri","huo","tai","kang","yuan","lu",
-       "e","qin","duo","zi","ni","tu","shi","min","gu","ke",
-       "ling","bing","si","gu","bo","pi","yu","si","zuo","bu",
-       "you","dian","jia","zhen","shi","shi","tie","ju","zuan","shi",
-       "ta","xuan","zhao","bao","he","bi","sheng","chu","shi","bo",
-       "zhu","chi","za","po","tong","qian","fu","zhai","mao","qian",
-       "fu","li","yue","pi","yang","ban","bo","jie","gou","shu",
-       "zheng","mu","xi","xi","di","jia","mu","tan","shen","yi",
-       "si","kuang","ka","bei","jian","tong","xing","hong","jiao","chi",
-       "er","ge","bing","shi","mao","ha","yin","jun","zhou","chong",
-       "xiang|jiong","tong","mo","lei","ji","yu|si","xu|hui","ren","zun","zhi",
-       "qiong","shan|shuo","chi|li","xian|xi","xing","quan","pi","tie","zhu","hou|xiang",
-       "ming","kua","diao|tiao|yao","xian|kuo|tian|gua","xian","xiu","jun","cha","lao","ji",
-       "pi","ru","mi","yi","yin","guang","an","diu","you","se",
-       "kao","qian","luan","si","ng","diao","han","rui","shi|zhi","keng",
-       "qiu","xiao","zhe|nie","xiu","zang","ti","cuo","xian|kuo|tian|gua","hong|gong","zhong|yong",
-       "tou|tu|dou","lv","mei|meng","lang","wan|jian","xin","yun|jun","bei","wu","su",
-       "yu","chan","ting|ding","bo","han","jia","hong","juan|jian|cuan","feng","chan",
-       "wan","zhi","si","xuan|juan","hua|wu","wu","tiao","kuang","zhuo|chuo","lve",
-       "xing|jing","qin","shen","han","lve","ye","chu","zeng","ju","xian",
-       "e","mang","pu","li","pan","rui","cheng","gao","li","te",
-       "bing","zhu","zhen","tu","liu","zui|nie","ju","chang","yuan|wan","jian",
-       "gang","diao","tao","shang","lun","ke","ling","pi","lu","li",
-       "qing","pei","juan","min","zui","peng","an","pi","xian","ya",
-       "zhui","lei","a","kong","ta","kun","du","nei","chui","zi",
-       "zheng","ben","nie","cong","chun","tan","ding","qi","qian","zhui",
-       "ji","yu","jin","guan","mao","chang","tian","xi","lian","diao",
-       "gu","cuo","shu","zhen","lu","meng","lu","hua","biao","ga",
-       "lai","ken","fang","bu","nai","wan","zan","hu","de","xian",
-       "uu","huo","liang","fa","men","kai","yang","chi","lian","guo",
-       "xian","du","tu","wei","zong","fu","rou","ji","e","jun",
-       "chen","ti","zha","hu","yang","duan","xia","yu","keng","sheng",
-       "huang","wei","fu","zhao","cha","qie","shi","hong","kui","nuo",
-       "mou","qiao","qiao","hou","tou","cong","huan","ye","min","jian",
-       "duan","jian","si","kui","hu","xuan","zhe","jie","zhen","bian",
-       "zhong","zi","xiu","ye","mei","pai","ai","jie","qian","mei",
-       "cuo|cha","da|ta","bang","xia","lian","suo|se","kai","liu","yao|zu","ye|ta|ge",
-       "nou","weng","rong","tang","suo","qiang|cheng","ge|li","shuo","chui","bo",
-       "pan","da","bi|pi","sang","gang","zi","wu","ying","huang","tiao",
-       "liu","kai","sun","sha","sou","wan|jian","gao|hao","zhen","zhen","lang",
-       "yi","yuan","tang","nie","xi","jia","ge","ma","juan","song",
-       "zu","suo","xia","feng","wen","na","lu","suo","ou","zu|chuo",
-       "tuan","xiu","guan","xuan","lian","shou|sou","ao","man","mo","luo",
-       "bi","wei","liu","di","san|qiao|can","cong","yi","lu|ao","ao","keng",
-       "qiang","cui","qi","shang","tang","man","yong","chan","feng","jing",
-       "biao","shu","lou","xiu","cong","long","zan","jian|zan","cao","li",
-       "xia","xi","kang","shuang","beng","zhang","qian","zheng","lu","hua",
-       "ji","pu","hui|sui|rui","qiang","po","lin","se","xiu","san|xian|sa","cheng",
-       "gui","si","liu","nao","huang","pie","sui","fan","qiao","quan",
-       "xi","tang","xiang","jue","jiao","zun","liao","qi","lao","dui",
-       "xin","zan","ji","jian","zhong","deng","ya","ying","dui","jue",
-       "nou","zan","pu","tie","uu","cheng","ding","shan","kai","jian",
-       "fei","sui","lu","juan","hui","yu","lian","zhuo","qiao","jian",
-       "zhuo","lei","bi","tie","huan","ye","duo","guo","dang","ju",
-       "fen","da","bei","yi","ai","zong","xun","diao","zhu","heng",
-       "zhui","ji","nie","he","huo","qing","bin","ying","gui","ning",
-       "xu","jian","jian","qian","cha","zhi","mie","li","lei","ji",
-       "zuan","kuang","shang","peng","la","du","shuo","chuo","lv","biao",
-       "pao","lu","xian","kuan","long","e","lu","xin","jian","lan",
-       "bo","jian","yao","chan","xiang","jian","xi","guan","cang","nie",
-       "lei","cuan","qu","pan","luo","zuan","luan","zao","nie","jue",
-       "tang","zhu","lan","jin","ga","yi","zhen","ding","zhao","po",
-       "liao","tu","qian","chuan","shan","sa|xi","fan","diao","men","nv",
-       "yang","chai","xing","gai","bu","tai","ju","dun","chao","zhong",
-       "na","bei","gang","ban","qian","yue|yao","qin","jun","wu","gou",
-       "kang","fang","huo","dou","niu","ba|pa","yu","qian","zheng","qian",
-       "gu","bo","ke","po","bu","bo","yue","zuan","mu","tan",
-       "jia","dian|tian","you","tie","bo","ling","shuo","qian|yan","mao","bao",
-       "shi","xuan","ta|tuo","bi","ni","pi","duo","xing","kao","lao",
-       "er","mang","ya","you","cheng","jia","ye","nao","zhi","dang|cheng",
-       "tong","lv","diao","yin","kai","zha","zhu","xian|xi","ting|ding","diu",
-       "xian|kuo|tian|gua","hua","quan","sha","ha|ke","diao|tiao|yao","ge","ming","zheng","se",
-       "jiao","yi","chan","chong","tang","an","yin","ru","zhu","lao",
-       "pu","wu","lai","te","lian","keng","xiao","suo","li","zeng",
-       "chu","guo","gao","e","xiu","cuo","lve","feng","xin","liu",
-       "kai","jian","rui","ti","lang","qin","ju","a","qiang","zhe",
-       "nuo","cuo","mao","ben","qi","de","ke","kun","chang","xi",
-       "gu","luo","chui","zhui","jin","zhi","xian","juan","huo","pei",
-       "tan","ding","jian","ju","meng","zi","qie","ying","kai","qiang",
-       "si","e","cha","qiao","zhong","duan","sou","huang","huan","ai",
-       "du","mei","lou","zi","fei","mei","mo","zhen","bo","ge",
-       "nie","tang","juan","nie","na","liu","gao","bang","yi","jia",
-       "bin","rong","biao","tang","man","luo","beng","yong","jing","di",
-       "zu","xuan","liu","xin","jue","liao","pu","lu","dui","lan",
-       "pu","cuan","qiang","deng","huo","lei","huan","zhuo","lian","yi",
-       "cha","biao","la","chan","xiang","chang","chang","jiu","ao","die",
-       "jie","liao","mi","chang|zhang","men","ma","shuan","shan","huo|shan","men",
-       "yan","bi","han|bi","bi","ci ka Bi lu","kai","kang","beng","hong","run",
-       "san","xian","xian|jian","jian","min","xia","lao","dou","zha","nao",
-       "zhan","peng","xia|ke","ling","bian|guan","bi","run","he","guan","ge",
-       "he","fa","chu","hong|xiang","gui","min","se","kun","lang","lv",
-       "ting","sha","ju","yue","yue","chan","qu","lin","chang","sha",
-       "kun","yan","wen","yan","e|yan","hun","yu","wen","hong","bao",
-       "hong|juan|xiang","qu","yao","wen","ban|pan","an","wei","yin","kuo","que",
-       "lan","du","quan","pBi ying|po he deng","tian","nie","ta","kai","he","que",
-       "chuang","guan","dou","qi","kui","tang|chang","guan","piao","kan|han","xi|se|ta",
-       "hui","chan","bi","dang","huan","ta","wen","ta","men","shuan",
-       "shan","yan","han|bi","bi","wen","chuang","run","wei","xian","hong",
-       "jian","min","kang","men","zha","nao","gui","wen","ta","min",
-       "lv","kai","fa","ge","he","kun","jiu","yue","lang","du",
-       "yu","yan","chang","xi","wen","hun","yan","e","chan","lan",
-       "qu","hui","kuo","que","he","tian","ta","que","kan|han","huan",
-       "fu","fu","le","dui","xin","qian","wu","yi","tuo","yin",
-       "yang","dou","e","sheng","ban","pei","keng","yun","ruan","zhi",
-       "pi","jing","fang","yang","yin","zhen","jie","cheng","e","qu",
-       "di","zu","zuo","dian","lin","a","tuo","tuo","bei","bing",
-       "fu","ji","lu","long","chen","xing","duo","lou","mo","jiang",
-       "shu","duo","xian","er","gui","yu","gai","shan","jun","qiao",
-       "xing","chun","wu","bi","xia","shan","sheng","zhi","pu","dou",
-       "yuan","zhen","chu","xian","dao","nie","yun","xian","pei","fei",
-       "zou","qi","dui","lun","yin","ju","chui","chen","pi","ling",
-       "tao","xian","lu","sheng","xian","yin","zhu","yang","reng","xia",
-       "chong","yan","yin","yu|yao|shu","di","yu","long","wei","wei","nie",
-       "dui|zhui","sui|duo","an","huang","jie","sui","yin","qi|gai|ai","yan","hui|duo",
-       "ge","yun","wu","wei|kui","ai","xi","tang","ji","zhang","dao",
-       "ao","xi","yin","sa","rao","lin","tui","deng","pi","sui",
-       "sui","ao|yu","xian","fen","ni","er","ji","dao","xi","yin",
-       "zhi","hui|duo","long","xi","li|dai","li|dai","li|dai","zhui|cui|wei","hu|he","zhi",
-       "sun","jun|juan","nan|nuo","yi","que|qiao","yan","qin","jian","xiong","ya",
-       "ji","gu","huan","zhi","gou","jun|juan","ci","yong","ju","chu",
-       "hu","za","luo","yu","chou","diao","sui","han","huo","shuang",
-       "guan|huan","chu","za","yong","ji","gui|xi","chou","liu","li","nan|nuo",
-       "yu","za","chou","ji","yu","yu","xue","na","fou","se|xi",
-       "mu","wen","fen","pang","yun","li","chi","yang","ling","lei",
-       "an","bao","wu|meng","dian","dang","hu","wu","diao","xu","ji",
-       "mu","chen","xiao","zha","ting","zhen","pei","mei","ling","qi",
-       "zhou","huo","sha","fei","hong","zhan","yin","ni","shu","tun",
-       "lin","ling","dong","ying","wu","ling","shuang","ling","xia","hong",
-       "yin","mai","mai","yun","liu","meng","bin","wu","wei","kuo",
-       "yin","xi","yi","ai","dan","teng","xian","yu","lu","long",
-       "dai","ji","pang","yang","ba","pi","wei","uu","xi","ji",
-       "mai","meng","meng","lei","li","huo","ai","fei","dai","long",
-       "ling","ai","feng","li","bao","he","he","he","bing","qing",
-       "qing","liang","tian","zheng","jing","cheng","qing","jing","liang","dian",
-       "jing","tian","fei","fei","kao","mi","mian","mian","pao","ye",
-       "mian","hui","ye","ge","ding","cha","jian","ren","di","du",
-       "wu","ren","qin","jin","xue","niu","ba","yin","sa","na",
-       "mo","zu","da","ban","xie","yao","tao","bei","jie","hong",
-       "pao","yang","bing","yin","ge|ta|sa","tao","jie|ji","xie","an","an",
-       "hen","gong","qia","da","qiao","ting","man|men","bian|ying","sui","tiao",
-       "qiao|shao","xuan|juan","kong","beng","ta","shang|zhang","bing|pi|bi|bei","kuo","ju","la",
-       "xie|die","rou","bang","eng","qiu","qiu","he","qiao","mu|mou","ju",
-       "jian","bian","di","jian","wen|yun","tao","gou","ta","bei","xie",
-       "pan","ge","bi|bing","kuo","tang","lou","gui","qiao","xue","ji",
-       "jian","jiang","chan","da","huo","xian","qian","du","wa","jian",
-       "lan","wei","ren","fu","mei|wa","quan","ge","wei","qiao","han",
-       "chang","kuo","rou","yun","she|xie","wei","ge","bai","tao","gou",
-       "yun","gao","bi","wei","sui","du","wa","du","wei","ren",
-       "fu","han","wei","yun|wen","tao","jiu","jiu","xian","xie","xian",
-       "ji","yin","za","yun","shao","le","peng","huang","ying","yun",
-       "peng","an","yin","xiang","hu","ye","ding","qing","qiu","xiang",
-       "shun","han","xu","yi","xu","e","song","kui","qi","hang",
-       "yu","wan","ban","dun","di","dan","pan","po","ling","che",
-       "jing","lei","he","qiao","e","e","wei","jie","kuo","shen",
-       "yi","yi","ke","dui","yu","ping","lei","fu","jia","tou",
-       "hui","kui","jia","luo","ting","cheng","ying","jun","hu","han",
-       "geng","tui","tui","bin","lai","tui","zi","zi","chui","ding",
-       "lai","tan","han","qian","ke","cui","jiong","qin","yi","sai",
-       "ti","e","e","yan","wen","kan","yong","zhuan","yan","xian",
-       "xin","yi","yuan","sang","dian","dian","jiang","kui","lei","lao",
-       "piao","wai","man","cu","yao","hao","qiao","gu","xun","yan",
-       "hui","chan","ru","meng","bin","xian","pin","lu","lan","nie",
-       "quan","ye","ding","qing","han","xiang","shun","xu","xu","wan",
-       "gu","dun","qi","ban","song","hang","yu","lu","ling","po",
-       "jing|geng","jie|xie|jia","jia","ting","he|ge","ying","jiong","ke","yi","pin|bin",
-       "hui","tui","han","ying","ying","ke","ti","yong","e","zhuan",
-       "yan","e","nie","man","dian","sang","hao","lei","chan|zhan","ru",
-       "pin","quan","feng","biao|diu","gua","fu","xia","zhan","biao","sa",
-       "ba|fu","tai","lie","gua","xuan","xiao","ju","biao","si","wei",
-       "yang","yao","sou","kai","sao|sou","fan","liu","xi","liu|liao","piao",
-       "piao","liu","biao","biao","biao","liao","biao","se","feng","xiu",
-       "feng","yang","zhan","biao","sa","ju","si","sou","yao","liu",
-       "piao","biao","biao","fei","fan","fei","fei","shi|si|yi","shi","can",
-       "ji","ding","si","tuo","zhan","sun","xiang","tun","ren","yu",
-       "yang|juan","chi","yin","fan","fan","sun","yin","zhu|tou","si","zuo|ze|zha",
-       "bi","jie","tao","bao","ci","tie","si","bao","shi","duo",
-       "hai","ren","tian","jiao","he","bing","yao","tong","ci","xiang",
-       "yang","juan","er","yan","le","xi","can","bo","nei","e",
-       "bu","jun","dou","su","yu","shi","yao","hun","guo","shi",
-       "jian","chuo","bing","xian","bu","ye","dan","fei","zhang","wei",
-       "guan","e","nuan","yun","hu","huang","tie","hui","jian","hou",
-       "ai","xing","fen","wei","gu","cha","song","tang","bo","gao",
-       "xi","kui","liu","sou","tao","ye","wen","mo","tang","man",
-       "bi","yu","xiu","jin","san","kui","zhuan","shan","xi","dan",
-       "yi","ji","rao","cheng","yong","tao","wei","xiang","zhan","fen",
-       "hai","meng","yan","mo","chan","xiang","luo","zan","nang","shi",
-       "ding","ji","tuo","xing","tun","xi","ren","yu","chi","fan",
-       "yin","jian","shi","bao","si","duo","yi","er","rao","xiang",
-       "he","ge","jiao","xi","bing","bo","dou","e","yu","nei",
-       "jun","guo","hun","xian","guan","cha","kui","gu","sou","chan",
-       "ye","mo","bo","liu","xiu","jin","man","san","zhuan","nang",
-       "shou","kui","guo","xiang","fen","bo","ni","bi","bo","tu",
-       "han","fei","jian","an","ai","fu","xian","yun|wo","xin","fen",
-       "pin","xin","ma","yu","feng|ping","han","di","tuo|duo","tuo|zhe","chi",
-       "xun","zhu","zhi|shi","pei","xin|jin","ri","sa","yun","wen","zhi",
-       "dan","lu","you","bo","bao","jue|kuai","tuo|duo","yi","qu","wen",
-       "qu","jiong","po","zhao","yuan","peng","zhou","ju","zhu","nu",
-       "ju","pi","zang","jia","ling","zhen","tai|dai","fu","yang","shi",
-       "bi","tuo","tuo","si","liu","ma","pian","tao","zhi","rong",
-       "teng","dong","xun|xuan","quan","shen","jiong","er","hai","bo","zhu",
-       "yin","luo","zhou","dan","hai","liu","ju","song","qin","mang",
-       "liang|lang","han","tu","xuan","tui","jun","e","cheng","xing","dai",
-       "lu","zhui","zhou","she","pian","kun","tao","lai","zong","ke",
-       "qi","qi","yan","fei","sao","yan","ge","yao","wu","pian",
-       "cong","pian","qian","fei","huang","qian","huo","yu","ti","quan",
-       "xia","zong","kui","rou","si","gua","tuo","gui","sou","qian",
-       "cheng","zhi","liu","peng","teng","xi","cao","du","yan","yuan",
-       "zou","sao","shan","qi","zhi","shuang","lu","xi","luo","zhang",
-       "mo","ao","can","piao","cong","qu","bi","zhi","yu","xu",
-       "hua","bo","su","xiao","lin","zhan","dun","liu","tuo","ceng",
-       "dian","jiao","tie","yan","luo","zhan","jing","yi","ye","tuo",
-       "pin","zhou","yan","long","lv","teng","xiang","ji","shuang","ju",
-       "xi","huan","li","biao","ma","yu","duo","xun","chi","qu",
-       "ri","bo","lv","zang","shi","si","fu","ju","zou","zhu",
-       "tuo","nu","jia","yi","dai","xiao","ma","yin","jiao","hua",
-       "luo","hai","pian","biao","li","cheng","yan","xing","qin","jun",
-       "qi","qi","ke","zhui","zong","su","can","pian","zhi","kui",
-       "sao","wu","ao","liu","qian","shan","piao|biao","luo","cong","chan",
-       "zhou","ji","shuang","xiang","gu","wei","wei","wei","yu","gan",
-       "yi","ang","tou","jie","bao","bei|mo","ci","ti","di","ku",
-       "hai","qiao|xiao","hou","kua","ge","tui","geng","pian","bi","ke",
-       "qia","ou","sui","lou","bo","xiao","bang","bo|jue","ci","kuan",
-       "bin","mo","liao","lou","xiao","du","zang","sui","ti","bin",
-       "kuan","lu","gao","gao","qiao","kao","qiao","lao","sao","biao",
-       "kun","kun","di","fang","xiu","ran","mao","dan","kun","bin",
-       "fa","tiao","pi","zi","fa","ran","ti","bao","bi|po","mao|meng",
-       "fu","er","er","qu","gong","xiu","kuo|yue","ji","peng","zhua",
-       "shao","sha","ti","li","bin","zong","ti","peng","song","zheng",
-       "quan","zong","shun","jian","duo","hu","la","jiu","qi","lian",
-       "zhen","bin","peng","ma","san","man","man","seng","xu","lie",
-       "qian","qian","nong","huan","kuo","ning","bin","lie","rang","dou",
-       "dou","nao","hong","xi","dou","kan","dou","dou","jiu","chang",
-       "yu","yu","ge","yan","fu","zeng","gui","zong","liu","gui",
-       "shang","yu","gui","mei","ji","qi","ga","kui","hun","ba",
-       "bo","mei","xu","yan","xiao","liang","yu","tui","qi","wang",
-       "liang","wei","gan","chi","piao","bi","mo","ji","xu","chou",
-       "yan","zhan","yu","dao","ren","ji","ba","hong","tuo","diao",
-       "ji","yu","e","ji","sha","hang","tun","mo","jie","shen",
-       "ban","yuan","pi","lu","wen","hu","lu","za","fang","fen",
-       "na","you","pian","mo","he","xia","qu","han","pi","ling",
-       "tuo","ba","qiu","ping","fu","bi","ci|ji","wei","ju","diao",
-       "bo|ba","you","gun","pi","nian","xing","tai","bao","fu","zha",
-       "ju","gu","shi","dong","chou","ta","jie","shu","hou","xiang",
-       "er","an","wei","zhao","zhu","yin","lie","luo|ge","tong","yi",
-       "yi","bing","wei","jiao","ku","gui|xie|wa|kui","xian","ge","hui","lao",
-       "fu","kao","xiu","tuo","jun","ti","mian","shao","zha","suo",
-       "qin","yu","nei","zhe","gun","geng","su","wu","qiu","shan",
-       "pu|bu","huan","tiao","li","sha","sha","kao","meng","cheng","li",
-       "zou","xi","yong","shen","zi","qi","qing","xiang","nei","chun",
-       "ji","diao","qie","gu","zhou","dong","lai","fei","ni","yi|si",
-       "kun","lu","jiu","chang","jing","lun","ling","zou","li","meng",
-       "zong","zhi","nian","hu","yu","di","shi","shen","huan","ti",
-       "hou","xing","zhu","la","zong","ji","bian","bian","huan","quan",
-       "zei","wei","wei","yu","chun","rou","die","huang","lian","yan",
-       "qiu","qiu","jian","bi","e","yang","fu","sai","jian","xia",
-       "tuo","hu","shi","ruo","xuan","wen","jian","hao","wu","pang",
-       "sao","liu","ma","shi","shi","guan","zi","teng","ta","yao",
-       "e","yong","qian","qi","wen","ruo","ha ta ha ta","lian","ao","le",
-       "hui","min","ji","tiao","qu","jian","shen","man","xi","qiu",
-       "piao","ji","ji","zhu","jiang","xiu","zhuan","yong","zhang","kang",
-       "xue","bie","yu","qu","xiang","bo","jiao","xun","su","huang",
-       "zun","shan","shan","fan","gui","lin","xun","yao","xi","zeng",
-       "xiang","fen","guan","hou","kuai","zei","sao","zhan","gan","gui",
-       "ying","li","chang","lei","se","ai","ru","ji","xu","hu",
-       "shu","li","lie","le","mie","zhen","xiang","e","lu","guan",
-       "li","xian","yu","dao","ji","you","tun","lu","fang","ba",
-       "he|ge","ba","ping","nian","lu","you","zha","fu","bo|ba","bao",
-       "hou","pi","tai","gui|xie","jie","kao","wei","er","tong","zei",
-       "hou","kuai","ji","jiao","xian","zha","xiang","xun","geng","li",
-       "lian","jian","li","shi","tiao","gun","sha","huan","jun","ji",
-       "yong","qing","ling","qi","zou","fei","kun","chang","gu","ni",
-       "nian","diao","jing","shen","shi","zi","fen","die","bi","chang",
-       "ti","wen","wei","sai|xi","e","qiu","fu","huang","quan","jiang",
-       "bian","sao","ao","qi","ta","guan","yao","pang","jian","le",
-       "biao","xue","bie","man","min","yong","wei","xi","gui|jue","shan",
-       "lin","zun","hu","gan","li","zhan|shan","guan","niao|diao","yi","fu",
-       "li","jiu","bu","yan","fu","diao|zhao","ji","feng","ru","gan|han|yan",
-       "shi","feng","ming","bao","yuan","zhi","hu","qin","fu|gui","ban|fen",
-       "wen","jian|qian|zhan","shi","yu","fou","yao","jue","jue","pi","huan",
-       "zhen","bao","yan","ya","zheng","fang","feng","wen","ou","dai",
-       "jia","ru","ling","mie","fu","tuo","min","li","bian","zhi",
-       "ge","yuan","ci","qu","xiao","chi","dan","ju","yao","gu",
-       "zhong","yu","yang","yu","ya","die","yu","tian","ying","dui",
-       "wu","er","gua","ai","zhi","yan","heng","xiao","jia","lie",
-       "zhu","yang","yi","hong","lu","ru","mou","ge","ren","jiao",
-       "xiu","zhou","chi","luo","heng","nian","e","luan","jia","ji",
-       "tu","huan","tuo","bu","wu","juan","yu","bo","jun","jun",
-       "bi","xi","jun","ju","tu","jing","ti","e","e","kuang",
-       "hu","wu","shen","lai","zan","pan","lu","pi","shu","fu",
-       "an","zhuo","peng","qin","qian","bei","diao","lu","que","jian",
-       "ju","tu","ya","yuan","qi","li","ye","zhui","kong","duo",
-       "kun","sheng","qi","jing","yi","yi","jing","zi","lai","dong",
-       "qi","chun","geng","ju","qu","yi","zun","ji","shu","ying",
-       "chi","miao","rou","an","qiu","ti|chi","hu","ti|chi","e","jie",
-       "mao","fu|bi","chun","tu","yan","he|jie","yuan","pian|bian","kun","mei",
-       "hu","ying","chuan|zhi","wu","ju","dong","cang|qiang","fang","he|hu","ying",
-       "yuan","xian","weng","shi","he","chu","tang","xia","ruo","liu",
-       "ji","gu|hu","jian","sun|xun","han","ci","ci","yi","yao","yan",
-       "ji","li","tian","kou","ti","ti","yi","tu","ma","xiao",
-       "gao","tian","chen","ji","tuan","zhe","ao","yao","yi","ou",
-       "chi","zhi","liu","yong","lou|lv","bi","shuang","zhuo","yu","wu",
-       "jue","yin","ti","si","jiao","yi","hua","bi","ying","su",
-       "huang","fan","jiao","liao","yan","gao","jiu","xian","xian","tu",
-       "mai","zun","yu","ying","lu","tuan","xian","xue","yi","pi",
-       "zhu","luo","xi","yi","ji","ze","yu","zhan","ye","yang",
-       "pi","ning","hu","mi","ying","meng","di","yue","yu","lei",
-       "bu","lu","he","long","shuang","yue","ying","guan","qu","li",
-       "luan","niao","jiu","ji","yuan","ming","shi","ou","ya","cang",
-       "bao","zhen","gu","dong","lu","ya","xiao","yang","ling","chi",
-       "qu","yuan","xue","tuo","si","zhi","er","gua","xiu","heng",
-       "zhou","ge","luan","hong","wu","bo","li","juan","hu","e",
-       "yu","xian","ti","wu","que","miao","an","kun","bei","peng",
-       "qian","chun","geng","yuan","su","hu","he","e","gu","qiu",
-       "ci","mei","wu","yi","yao","weng","liu","ji","yi","jian",
-       "he","yi","ying","zhe","liu","liao","jiao","jiu","yu","lu",
-       "huan","zhan","ying","hu","meng","guan","shuang","lu","jin","ling",
-       "jian","xian","cuo","jian","jian","yan","cuo","lu","you","cu",
-       "ji","pao|biao","cu","pao","zhu|cu","jun|qun","zhu","jian","mi","mi",
-       "yu","liu","chen","jun","lin","ni","qi","lu","jiu","jun",
-       "jing","li","xiang","xian","jia","mi","li","she","zhang","lin",
-       "jing","qi","ling","yan","cu","mai","mai","he","chao","fu",
-       "mian","mian","fu","pao","qu","qu","mou","fu","xian","lai",
-       "qu","mian","chi","feng","fu","qu","mian","ma","mo|me","mo|me",
-       "hui","mi","zou","nun","fen","huang","huang","jin","guang","tian",
-       "tou","hong","hua","kuang","hong","shu","li","nian","chi","hei",
-       "hei","yi","qian","dan","xi","tun","mo","mo","qian","dai",
-       "chu","you","dian","yi","xia","yan","qu","mei","yan","qing",
-       "yue","li","dang","du","can","yan","yan","yan","dan|shen","an",
-       "zhen|yan","dai","can","yi","mei","dan|zhan","yan","du","lu","zhi",
-       "fen","fu","fu","min|mian|meng","min|mian|meng","yuan","cu","qu","chao","wa",
-       "zhu","zhi","meng","ao","bie","tuo","bi","yuan","chao","tuo",
-       "ding","mi","nai","ding","zi","gu","gu","dong","fen","tao",
-       "yuan","pi","chang","gao","cao","yuan","tang","teng","shu","shu",
-       "fen","fei","wen","ba","diao","tuo","zhong","qu","sheng","shi",
-       "you","shi","ting","wu","ju","jing","hun","ju","yan","tu",
-       "si","xi","xian","yan","lei","bi","yao","qiu","han","wu",
-       "wu","hou","xie","e","zha","xiu","weng","zha","nong","nang",
-       "qi","zhai","ji","zi","ji","ji","qi","ji","chi","chen",
-       "chen","he","ya","yin","xie","bao","ze","xie","zi","chi",
-       "yan","ju","tiao","ling","ling","chu","quan","xie","yin","nie",
-       "jiu","yao","chuo","yun","yu","chu","yi","ni","ze","zou",
-       "qu","yun","yan","yu","e","wo","yi","ci","zou","dian",
-       "chu","jin","ya","chi","chen","he","yin|ken","ju","ling","bao",
-       "tiao","zi","yin|ken","yu","chuo","qu","wo","long","pang","gong|wo",
-       "pang","yan","long","long","gong","kan","da","ling","da","long",
-       "gong","kan","gui|jun|qiu","qiu","bie","gui|jun|qiu","yue","chui","he","jiao",
-       "xie","yu"};
-
-#define DUOYINZI_SEPERATOR '|'
-
-static inline int __ctsvc_get_pinyinspell(UChar src, char spell[CHINESE_DUOYINZI_MAX_COUNT][CHINESE_PINYIN_SPELL_MAX_LEN])
-{
-       int offset, len, i, j;
-       int count=0;
-
-       offset = src - CHINESE_UNICODE_START;
-       RETVM_IF(offset < 0 || CHINESE_COUNT <= offset, CONTACTS_ERROR_INVALID_PARAMETER, "src is invalid");
-
-       len = strlen(pinyin_spell_table[offset]);
-
-       for(i=0, j=0; i<=len; i++) {
-               if (pinyin_spell_table[offset][i]== DUOYINZI_SEPERATOR
-                               || pinyin_spell_table[offset][i] == '\0') {
-                       strncpy(spell[count], pinyin_spell_table[offset]+j, i-j);
-                       j=i+1;
-                       count++;
-               }
-       }
-
-       return count;
-}
-
-static inline bool __ctsvc_is_chinese(const UChar *src)
-{
-       if (CHINESE_UNICODE_START <= *src && *src <= CHINESE_UNICODE_END)
-               return true;
-
-       return  false;
-}
-
-static inline bool
-__ctsvc_has_chinese(const UChar *src)
-{
-       int     i, len;
-
-       len = u_strlen(src);
-
-       for (i = 0; i < len; i++)
-       {
-               if (__ctsvc_is_chinese(&src[i]))
-                       return true;
-       }
-
-       return false;
-}
-
-#define array_sizeof(a) (sizeof(a) / sizeof(a[0]))
-
-bool ctsvc_has_chinese(const char *src)
-{
-       UChar   temp[strlen(src)+1];
-       UErrorCode status = 0;
-
-       RETVM_IF(src==NULL, CONTACTS_ERROR_SYSTEM, "src is NULL");
-       RETVM_IF(!*src, CONTACTS_ERROR_SYSTEM, "*src is NULL");
-
-       u_strFromUTF8(temp, array_sizeof(temp), NULL, src, -1, &status);
-       if (U_FAILURE(status)) {
-               CTS_ERR("u_strFromUTF8 Fail(%s)", u_errorName(status));
-               return false;
-       }
-
-       return __ctsvc_has_chinese(temp);
-}
-
-int ctsvc_convert_chinese_to_pinyin(const char *src, pinyin_name_s **name, int *size)
-{
-       char spell[CHINESE_PINYIN_MAX_LEN][CHINESE_DUOYINZI_MAX_COUNT][CHINESE_PINYIN_SPELL_MAX_LEN];
-       int pinyin_spell_count[CHINESE_PINYIN_MAX_LEN] = {0};
-       UChar   temp_result[strlen(src)+1];
-       int     count = 0, len=0, total_count=0;
-       int ret, i, j;
-       UErrorCode status = 0;
-       pinyin_name_s *temp_name = NULL;
-
-       RETVM_IF(src==NULL, CONTACTS_ERROR_SYSTEM, "src is NULL");
-       RETVM_IF(!*src, CONTACTS_ERROR_SYSTEM, "*src is NULL");
-
-       memset(spell, 0x0, CHINESE_PINYIN_MAX_LEN * CHINESE_DUOYINZI_MAX_COUNT * CHINESE_PINYIN_SPELL_MAX_LEN);
-
-       u_strFromUTF8(temp_result, array_sizeof(temp_result), NULL, src, -1, &status);
-       if (U_FAILURE(status)) {
-               CTS_ERR("u_strFromUTF8 Fail(%s)", u_errorName(status));
-               return CONTACTS_ERROR_SYSTEM;
-       }
-
-       len = u_strlen(temp_result);
-       for (count = 0; count < len && count < CHINESE_PINYIN_MAX_LEN; count++)
-       {
-               if (__ctsvc_is_chinese(&temp_result[count])) {
-                       ret = __ctsvc_get_pinyinspell(temp_result[count], spell[count]);
-
-                       RETVM_IF(ret < CONTACTS_ERROR_NONE, CONTACTS_ERROR_SYSTEM, "__ctsvc_get_pinyinspell() Fail(%d)", ret);
-                       pinyin_spell_count[count] = ret;
-
-                       if (total_count==0)
-                               total_count = ret;
-                       else
-                               total_count *= ret;
-               }
-               else {
-                       UChar temp[2];
-                       int size;
-
-                       temp[0] = temp_result[count];
-                       temp[1] = 0x00;
-                       u_strToUTF8(spell[count][0], 10, &size, temp, -1, &status);
-                       RETVM_IF(U_FAILURE(status), CONTACTS_ERROR_SYSTEM, "u_strToUTF8() Fail(%s)", u_errorName(status));
-                       spell[count][0][size]='\0';
-                       pinyin_spell_count[count] = 1;
-               }
-       }
-
-       *size = total_count;
-       temp_name = calloc(total_count, sizeof(pinyin_name_s));
-       RETVM_IF(temp_name == NULL, CONTACTS_ERROR_OUT_OF_MEMORY,"calloc Fail()");
-
-       int repeat = 1;
-       int name_len[total_count];
-       int initial_len[total_count];
-       for(i=0; i < count ; i++) {
-               for(j=0;j<total_count;j++) {
-                       int index = (j/repeat) %pinyin_spell_count[i];
-
-                       if (i==0) {
-                               name_len[j] = 0;
-                               initial_len[j] = 0;
-                       }
-
-                       if (spell[i][index][0]) {
-                               if (temp_name[j].pinyin_name[0])
-                                       name_len[j] += snprintf(temp_name[j].pinyin_name + name_len[j], sizeof(temp_name[j].pinyin_name) - name_len[j], " ");
-
-                               name_len[j] += snprintf(temp_name[j].pinyin_name + name_len[j], sizeof(temp_name[j].pinyin_name) - name_len[j],
-                                                               "%s", spell[i][index]);
-                               initial_len[j] += snprintf(temp_name[j].pinyin_initial + initial_len[j], sizeof(temp_name[j].pinyin_initial) - initial_len[j],
-                                                               "%c", spell[i][index][0]);
-                       }
-               }
-               repeat *= pinyin_spell_count[i];
-       }
-
-       *name = temp_name;
-
-       return CONTACTS_ERROR_NONE;
-}
-
diff --git a/common/ctsvc_localize_ch.h b/common/ctsvc_localize_ch.h
deleted file mode 100755 (executable)
index c8c86af..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Contacts Service Helper
- *
- * Copyright (c) 2010 - 2012 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.
- *
- */
-#ifndef __CTSVC_LOCALIZE_CH_H__
-#define __CTSVC_LOCALIZE_CH_H__
-
-#define CHINESE_PINYIN_SPELL_MAX_LEN   15
-#define        CHINESE_PINYIN_MAX_LEN                  3
-
-typedef struct {
-       char pinyin_initial[CHINESE_PINYIN_MAX_LEN+1];
-       char pinyin_name[CHINESE_PINYIN_SPELL_MAX_LEN*(CHINESE_PINYIN_MAX_LEN+1)];
-} pinyin_name_s;
-
-int ctsvc_convert_chinese_to_pinyin(const char *src, pinyin_name_s **name, int *size);
-
-bool ctsvc_has_chinese(const char *src);
-
-#endif /* __CTSVC_LOCALIZE_CH_H__ */
index 0f96c8d..512b827 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -51,8 +51,7 @@ int ctsvc_check_language(UChar *word)
 
        if (u_isdigit(word[0])) {
                type = CTSVC_LANG_NUMBER;
-       }
-       else if (u_isalpha(word[0])) {
+       } else if (u_isalpha(word[0])) {
                /*
                 * refer to the uchar.h
                 * #define U_GC_L_MASK  (U_GC_LU_MASK|U_GC_LL_MASK|U_GC_LT_MASK|U_GC_LM_MASK|U_GC_LO_MASK)
@@ -64,10 +63,10 @@ int ctsvc_check_language(UChar *word)
                 */
 
                UBlockCode code = ublock_getCode(word[0]);
-               CTS_VERBOSE("Character unicode block is %d", code);
+               DBG("Character unicode block is %d", code);
 
                switch (code) {
-               /* english */
+                       /* english */
                case UBLOCK_BASIC_LATIN:          /* =1, [0000] */
                case UBLOCK_LATIN_1_SUPPLEMENT:   /* =2, [0080] */
                case UBLOCK_LATIN_EXTENDED_A:     /* =3, [0100] */
@@ -102,7 +101,7 @@ int ctsvc_check_language(UChar *word)
                        /* type = CTSVC_LANG_ICELANDIC; */ /* is, Iceland - Icelandic */
                        break;
 
-               /* korean */
+                       /* korean */
                case UBLOCK_HANGUL_JAMO:                /* =30, [1100] */
                case UBLOCK_HANGUL_COMPATIBILITY_JAMO:  /* =65, [3130] */
                case UBLOCK_HANGUL_SYLLABLES:           /* =74, [AC00] */
@@ -111,7 +110,7 @@ int ctsvc_check_language(UChar *word)
                        type = CTSVC_LANG_KOREAN;
                        break;
 
-               /* chainese */
+                       /* chainese */
                case UBLOCK_CJK_RADICALS_SUPPLEMENT:                 /* =58, [2E80] */
                case UBLOCK_CJK_SYMBOLS_AND_PUNCTUATION:             /* =61, [3000] */
                case UBLOCK_ENCLOSED_CJK_LETTERS_AND_MONTHS:         /* =68, [3200] */
@@ -121,14 +120,14 @@ int ctsvc_check_language(UChar *word)
                case UBLOCK_CJK_UNIFIED_IDEOGRAPHS:                  /* =71, [4E00] */
                case UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS:            /* =79, [F900] */
                case UBLOCK_CJK_COMPATIBILITY_FORMS:                 /* =83, [FE30] */
-               case UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B :     /* =94, [20000] */
+               case UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B:     /* =94, [20000] */
                case UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT: /* =95, [2F800] */
                case UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C:      /* =197, [2A700] */
                case UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D:      /* =209, [2B740] */
                        type = CTSVC_LANG_CHINESE;
                        break;
 
-               /* japanese */
+                       /* japanese */
                case UBLOCK_HIRAGANA:                      /* =62, [3040] */
                case UBLOCK_KATAKANA:                      /* =63, [30A0] */
                case UBLOCK_KATAKANA_PHONETIC_EXTENSIONS:  /* =107, [31F0] */
@@ -171,9 +170,8 @@ int ctsvc_check_language(UChar *word)
                        type = CTSVC_LANG_TURKISH;
                        break;
                case UBLOCK_HALFWIDTH_AND_FULLWIDTH_FORMS: /* =87, [FF00]  hangul : FFA0 ~ FFDC */
-               {
                        if (CTSVC_COMPARE_BETWEEN((UChar)0xFF21, word[0], (UChar)0xFF3A)
-                               || CTSVC_COMPARE_BETWEEN((UChar)0xFF41, word[0], (UChar)0xFF5A))
+                                       || CTSVC_COMPARE_BETWEEN((UChar)0xFF41, word[0], (UChar)0xFF5A))
                                type = CTSVC_LANG_ENGLISH;
                        else if (CTSVC_COMPARE_BETWEEN((UChar)0xFF10, word[0], (UChar)0xFF19))
                                type = CTSVC_LANG_NUMBER;
@@ -184,16 +182,14 @@ int ctsvc_check_language(UChar *word)
                        else
                                type = CTSVC_LANG_OTHERS;
                        break;
-               }
                default:
                        type = CTSVC_LANG_OTHERS;
-                       break;
                }
-       }
-       else
+       } else {
                type = CTSVC_LANG_OTHERS;
+       }
 
-       CTS_VERBOSE("language type = %d", type);
+       DBG("language type = %d", type);
        return type;
 }
 
@@ -208,15 +204,15 @@ int ctsvc_check_language_type(const char *src)
 
        if (src && src[0]) {
                length = ctsvc_check_utf8(src[0]);
-               RETVM_IF(length <= 0, CONTACTS_ERROR_INTERNAL, "check_utf8 Fail");
+               RETVM_IF(length <= 0, CONTACTS_ERROR_INTERNAL, "check_utf8() Fail");
 
                strncpy(temp, src, length);
 
-               CTS_VERBOSE("temp(%s) src(%s) length(%d)", temp, src, length);
+               DBG("temp(%s) src(%s) length(%d)", temp, src, length);
 
                u_strFromUTF8(tmp_result, array_sizeof(tmp_result), NULL, temp, -1, &status);
-                       RETVM_IF(U_FAILURE(status), CONTACTS_ERROR_SYSTEM,
-                                       "u_strFromUTF8() Fail(%s)", u_errorName(status));
+               RETVM_IF(U_FAILURE(status), CONTACTS_ERROR_SYSTEM,
+                               "u_strFromUTF8() Fail(%s)", u_errorName(status));
 
                u_strToUpper(tmp_result, array_sizeof(tmp_result), tmp_result, -1, NULL, &status);
                RETVM_IF(U_FAILURE(status), CONTACTS_ERROR_SYSTEM,
@@ -227,7 +223,7 @@ int ctsvc_check_language_type(const char *src)
                RETVM_IF(U_FAILURE(status), CONTACTS_ERROR_SYSTEM,
                                "unorm_normalize(%s) Fail(%s)", src, u_errorName(status));
 
-               CTS_VERBOSE("0x%x%x", (0xFF00 & (tmp_result[0])) >> 8,  (0xFF & (tmp_result[0])));
+               DBG("0x%x%x", (0xFF00 & (tmp_result[0])) >> 8,  (0xFF & (tmp_result[0])));
 
                return ctsvc_check_language(result);
        }
index 5e084bf..78a8d3e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
index 124640e..10b3a0a 100644 (file)
@@ -1,9 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngjae Shin <yj99.shin@samsung.com>
+ * 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.
 #include "ctsvc_mutex.h"
 
 typedef struct {
-       int (* lock) (pthread_mutex_t *mutex);
-       int (* unlock) (pthread_mutex_t *mutex);
-}cts_mutex_fns;
+       int (*lock) (pthread_mutex_t *mutex);
+       int (*unlock) (pthread_mutex_t *mutex);
+} cts_mutex_fns;
 
-static cts_mutex_fns __ctsvc_mutex_funtions =
-{
+static cts_mutex_fns __ctsvc_mutex_funtions = {
        pthread_mutex_lock,
        pthread_mutex_unlock
 };
@@ -81,7 +78,7 @@ static inline pthread_mutex_t* __ctsvc_mutex_get_mutex(int type)
                ret_val = &cynara_mutex;
                break;
        default:
-               CTS_ERR("unknown type(%d)", type);
+               ERR("unknown type(%d)", type);
                ret_val = NULL;
                break;
        }
@@ -111,7 +108,7 @@ void ctsvc_mutex_lock(int type)
 
        if (__ctsvc_mutex_funtions.lock) {
                ret = __ctsvc_mutex_funtions.lock(mutex);
-               WARN_IF(ret, "mutex_lock Failed(%d)", ret);
+               WARN_IF(ret, "mutex_lock Fail(%d)", ret);
        }
 }
 
@@ -124,12 +121,11 @@ void ctsvc_mutex_unlock(int type)
 
        if (__ctsvc_mutex_funtions.unlock) {
                ret = __ctsvc_mutex_funtions.unlock(mutex);
-               WARN_IF(ret, "mutex_unlock Failed(%d)", ret);
+               WARN_IF(ret, "mutex_unlock Fail(%d)", ret);
        }
 
        __defered_ref--;
-       if (__defered_ref == 0) {
+       if (__defered_ref == 0)
                pthread_setcanceltype(__old_type, NULL);
-       }
 }
 
index 7364f62..b5f972f 100644 (file)
@@ -1,9 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Youngjae Shin <yj99.shin@samsung.com>
+ * 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.
diff --git a/common/ctsvc_normalize.c b/common/ctsvc_normalize.c
deleted file mode 100644 (file)
index aa92ef9..0000000
+++ /dev/null
@@ -1,980 +0,0 @@
-/*
- * Contacts Service
- *
- * Copyright (c) 2010 - 2012 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 <ctype.h>
-#include <unicode/ulocdata.h>
-#include <unicode/ustring.h>
-#include <unicode/unorm.h>
-#include <unicode/ucol.h>
-#include <unicode/uset.h>
-#include <vconf.h>
-#include <vconf-keys.h>
-
-#include "contacts.h"
-#include "ctsvc_internal.h"
-#include "ctsvc_normalize.h"
-#include "ctsvc_localize.h"
-#include "ctsvc_localize_ch.h"
-
-#define CTSVC_NORMALIZED_MAX_LEN 1024
-
-#define CTSVC_COMBINING_DIACRITICAL_MARKS_START 0x0300
-#define CTSVC_COMBINING_DIACRITICAL_MARKS_END  0x036f
-
-typedef struct {
-       UChar letter;
-       char start;
-       char end;
-}hiragana_group_letter;
-
-static hiragana_group_letter hiragana_group[13] = {
-       {0x3042, 0x41, 0x4a}, // ぁ    あ     ぃ     い     ぅ     う     ぇ     え     ぉ     お
-       {0x3042, 0x94, 0x94}, // ゔ
-       {0x304b, 0x4b, 0x54}, // か    が     き     ぎ     く     ぐ     け     げ     こ     ご
-       {0x304b, 0x95, 0x96}, // ゕ    ゖ
-       {0x3055, 0x55, 0x5e}, // さ    ざ     し     じ     す     ず     せ     ぜ     そ     ぞ
-       {0x305f, 0x5f, 0x69}, // た    だ     ち     ぢ     っ     つ     づ     て     で     と     ど
-       {0x306a, 0x6a, 0x6e}, // な    に     ぬ     ね     の
-       {0x306f, 0x6f, 0x7d}, // は    ば     ぱ     ひ     び     ぴ     ふ     ぶ     ぷ     へ     べ     ぺ     ほ     ぼ     ぽ
-       {0x307e, 0x7e, 0x82}, // ま    み     む     め     も
-       {0x3084, 0x83, 0x88}, // ゃ    や     ゅ     ゆ     ょ     よ
-       {0x3089, 0x89, 0x8d}, // ら    り     る     れ     ろ
-       {0x308f, 0x8e, 0x92}, // ゎ    わ
-       {0x3093, 0x93, 0x93}, // ゐ    ゑ     を
-};
-
-static int __ctsvc_remove_special_char(const char *src, char *dest, int dest_size)
-{
-       int s_pos=0, d_pos=0, char_type, src_size;
-
-       if (NULL == src) {
-               CTS_ERR("The parameter(src) is NULL");
-               dest[d_pos] = '\0';
-               return 0;
-       }
-       src_size = strlen(src);
-
-       while (src[s_pos] != 0) {
-               char_type = ctsvc_check_utf8(src[s_pos]);
-
-               if (0 < char_type && char_type < dest_size - d_pos && char_type <= src_size - s_pos) {
-                       memcpy(dest+d_pos, src+s_pos, char_type);
-                       d_pos += char_type;
-                       s_pos += char_type;
-               }
-               else {
-                       CTS_ERR("The parameter(src:%s) has invalid character set", src);
-                       dest[d_pos] = '\0';
-                       return CONTACTS_ERROR_INVALID_PARAMETER;
-               }
-       }
-
-       dest[d_pos] = '\0';
-       return d_pos;
-}
-
-#define array_sizeof(a) (sizeof(a) / sizeof(a[0]))
-
-static inline int __ctsvc_collation_str(const char *src, char **dest)
-{
-       int32_t size = 0;
-       UErrorCode status = U_ZERO_ERROR;
-       UChar *tmp_result = NULL;
-       UCollator *collator;
-       char *region = NULL;
-
-       region = vconf_get_str(VCONFKEY_REGIONFORMAT);
-       collator = ucol_open(region, &status);
-       free(region);
-       RETVM_IF(U_FAILURE(status), CONTACTS_ERROR_SYSTEM,
-                       "ucol_open() Fail(%s)", u_errorName(status));
-
-       if (U_FAILURE(status)) {
-               CTS_ERR("ucol_setAttribute Fail(%s)", u_errorName(status));
-               ucol_close(collator);
-               return CONTACTS_ERROR_SYSTEM;
-       }
-
-       u_strFromUTF8(NULL, 0, &size, src, strlen(src), &status);
-       if (U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR) {
-               CTS_ERR("u_strFromUTF8 to get the dest length Fail(%s)", u_errorName(status));
-               ucol_close(collator);
-               return CONTACTS_ERROR_SYSTEM;
-       }
-       status = U_ZERO_ERROR;
-       tmp_result = calloc(1, sizeof(UChar) * (size + 1));
-       u_strFromUTF8(tmp_result, size + 1, NULL, src, -1, &status);
-       if (U_FAILURE(status)) {
-               CTS_ERR("u_strFromUTF8 Fail(%s)", u_errorName(status));
-               free(tmp_result);
-               ucol_close(collator);
-               return CONTACTS_ERROR_SYSTEM;
-       }
-
-       size = ucol_getSortKey(collator, tmp_result, -1, NULL, 0);
-       *dest = calloc(1, sizeof(uint8_t) * (size + 1));
-       size = ucol_getSortKey(collator, tmp_result, -1, (uint8_t *)*dest, size + 1);
-
-       ucol_close(collator);
-       free(tmp_result);
-       return CONTACTS_ERROR_NONE;
-}
-
-int ctsvc_collation_str(char *src, char **dest)
-{
-       int ret;
-       char temp[SAFE_STRLEN(src) + 1];
-
-       ret = __ctsvc_remove_special_char(src, temp, sizeof(temp));
-       WARN_IF(ret < CONTACTS_ERROR_NONE, "__ctsvc_remove_special_char() Fail(%d)", ret);
-
-       return __ctsvc_collation_str(temp, dest);
-}
-
-static int __ctsvc_normalize_str(const char *src, char **dest)
-{
-       int ret;
-       int32_t tmp_size = 100;
-       int32_t upper_size;
-       int32_t size = 100;
-       UErrorCode status = 0;
-       UChar *tmp_result = NULL;
-       UChar *tmp_upper = NULL;
-       UChar *result = NULL;
-
-       tmp_result = calloc(1, sizeof(UChar)*(tmp_size+1));
-       u_strFromUTF8(tmp_result, tmp_size + 1, &tmp_size, src, -1, &status);
-
-       if (status == U_BUFFER_OVERFLOW_ERROR) {
-               status = U_ZERO_ERROR;
-               free(tmp_result);
-               tmp_result = calloc(1, sizeof(UChar) * (tmp_size + 1));
-               u_strFromUTF8(tmp_result, tmp_size + 1, NULL, src, -1, &status);
-               if (U_FAILURE(status)) {
-                       CTS_ERR("u_strFromUTF8()Fail(%s)", u_errorName(status));
-                       ret = CONTACTS_ERROR_SYSTEM;
-                       goto DATA_FREE;
-               }
-       }
-       else if (U_FAILURE(status)) {
-               CTS_ERR("u_strFromUTF8() Fail(%s)", u_errorName(status));
-               ret = CONTACTS_ERROR_SYSTEM;
-               goto DATA_FREE;
-       }
-
-       tmp_upper = calloc(1, sizeof(UChar)*(tmp_size+1));
-       upper_size = u_strToUpper(tmp_upper, tmp_size+1, tmp_result, -1, NULL, &status);
-       if (status == U_BUFFER_OVERFLOW_ERROR) {
-               status = U_ZERO_ERROR;
-               free(tmp_upper);
-               tmp_upper = calloc(1, sizeof(UChar) * (upper_size + 1));
-               u_strFromUTF8(tmp_upper, upper_size + 1, NULL, src, -1, &status);
-               if (U_FAILURE(status)) {
-                       CTS_ERR("u_strFromUTF8()Fail(%s)", u_errorName(status));
-                       ret = CONTACTS_ERROR_SYSTEM;
-                       goto DATA_FREE;
-               }
-       }
-       else if (U_FAILURE(status)) {
-               CTS_ERR("u_strToUpper() Fail(%s)", u_errorName(status));
-               ret = CONTACTS_ERROR_SYSTEM;
-               goto DATA_FREE;
-       }
-
-       result = calloc(1, sizeof(UChar)*(size+1));
-       size = unorm_normalize(tmp_upper, -1, UNORM_NFD, 0,
-                       result, size+1, &status);
-       if (status == U_BUFFER_OVERFLOW_ERROR) {
-               status = U_ZERO_ERROR;
-               free(result);
-               result = calloc(1, sizeof(UChar)*(size + 1));
-               unorm_normalize(tmp_upper, -1, UNORM_NFD, 0, result, size+1, &status);
-               if (U_FAILURE(status)) {
-                       CTS_ERR("unorm_normalize() Fail(%s)", u_errorName(status));
-                       ret = CONTACTS_ERROR_SYSTEM;
-                       goto DATA_FREE;
-               }
-       }
-       else if (U_FAILURE(status)) {
-               CTS_ERR("unorm_normalize() Fail(%s)", u_errorName(status));
-               ret = CONTACTS_ERROR_SYSTEM;
-               goto DATA_FREE;
-       }
-
-       ret = ctsvc_check_language(result);
-       ctsvc_extra_normalize(result, size);
-
-       // remove diacritical : U+3000 ~ U+034F
-       int i, j;
-       UChar *temp_result = NULL;
-       temp_result = calloc(1, sizeof(UChar)*(size+1));
-       bool replaced = false;
-       for(i=0,j=0; i<size;i++) {
-               if (CTSVC_COMPARE_BETWEEN((UChar)CTSVC_COMBINING_DIACRITICAL_MARKS_START,
-                       result[i], (UChar)CTSVC_COMBINING_DIACRITICAL_MARKS_END)) {
-                       replaced = true;
-               }
-               else
-                       temp_result[j++] = result[i];
-       }
-
-       if (replaced) {
-               temp_result[j] = 0x0;
-               free(result);
-               result = temp_result;
-       }
-       else
-               free(temp_result);
-
-       u_strToUTF8(NULL, 0, &size, result, -1, &status);
-       status = U_ZERO_ERROR;
-       *dest = calloc(1, sizeof(char) * (size+1));
-
-       u_strToUTF8(*dest, size+1, NULL, result, -1, &status);
-       if (U_FAILURE(status)) {
-               CTS_ERR("u_strToUTF8() Fail(%s)", u_errorName(status));
-               ret = CONTACTS_ERROR_SYSTEM;
-               free(*dest);
-               *dest = NULL;
-               goto DATA_FREE;
-       }
-
-DATA_FREE:
-       free(tmp_result);
-       free(tmp_upper);
-       free(result);
-       return ret;
-}
-
-static int __ctsvc_convert_halfwidth_ascii_and_symbol(const char *src, UChar *dest, int dest_size, int* str_size)
-{
-       int i;
-       int32_t size = dest_size;
-       UErrorCode status = 0;
-
-       u_strFromUTF8(dest, dest_size, &size, src, strlen(src), &status);
-       if (U_FAILURE(status)) {
-               CTS_ERR("u_strFromUTF8() Fail(%s)", u_errorName(status));
-               return CONTACTS_ERROR_SYSTEM;
-       }
-
-       *str_size = size;
-
-       // full width -> half width
-       for (i=0; i < size; i++) {
-               // FF00 ~ FF60: Fullwidth ASCII variants
-               if (CTSVC_COMPARE_BETWEEN((UChar)0xFF00, dest[i], (UChar)0xFF60)) {
-                       int unicode_value1 = 0;
-                       int unicode_value2 = 0;
-                       unicode_value1 = 0x0;
-                       unicode_value2 = (0xFF & dest[i]) + 0x20;
-                       dest[i] = unicode_value1 << 8 | unicode_value2;
-               }
-               // FFE0~FFE6: Fullwidth symbol variants
-               else if (CTSVC_COMPARE_BETWEEN((UChar)0xFFE0, dest[i], (UChar)0xFFE6)) {
-                       if (dest[i] == (UChar)0xFFE0)
-                       {
-                               dest[i] = (UChar)0x00A2;
-                       }
-                       else if (dest[i] == (UChar)0xFFE1)
-                       {
-                               dest[i] = (UChar)0x00A3;
-                       }
-                       else if (dest[i] == (UChar)0xFFE2)
-                       {
-                               dest[i] = (UChar)0x00AC;
-                       }
-                       else if (dest[i] == (UChar)0xFFE3)
-                       {
-                               dest[i] = (UChar)0x00AF;
-                       }
-                       else if (dest[i] == (UChar)0xFFE4)
-                       {
-                               dest[i] = (UChar)0x00A6;
-                       }
-                       else if (dest[i] == (UChar)0xFFE5)
-                       {
-                               dest[i] = (UChar)0x00A5;
-                       }
-                       else if (dest[i] == (UChar)0xFFE6)
-                       {
-                               dest[i] = (UChar)0x20A9;
-                       }
-                       else
-                       {
-
-                       }
-               }
-               else {
-
-               }
-
-       }
-
-       dest[size] = 0x00;
-       return CONTACTS_ERROR_NONE;
-}
-
-#define LARGE_BUFFER_SIZE 100
-
-int ctsvc_get_halfwidth_string(const char *src, char** dest, int* dest_size)
-{
-       UChar unicodes[LARGE_BUFFER_SIZE];
-       int ustr_size = 0;
-
-       if (__ctsvc_convert_halfwidth_ascii_and_symbol(src, unicodes, LARGE_BUFFER_SIZE, &ustr_size) != CONTACTS_ERROR_NONE)
-       {
-               CTS_ERR("convert to halfwidth Fail! %s ", src);
-
-               return CONTACTS_ERROR_SYSTEM;
-       }
-
-       UErrorCode status = 0;
-
-       // pre-flighting
-       int size = 0;
-       u_strToUTF8(NULL, 0, &size, unicodes, -1, &status);
-       status = U_ZERO_ERROR;
-       *dest = calloc(1, sizeof(char) * (size+1));
-
-       u_strToUTF8(*dest, size+1, dest_size, unicodes, ustr_size, &status);
-       if (U_FAILURE(status)) {
-               CTS_ERR("u_strToUTF8() Fail(%s)", u_errorName(status));
-
-               free(*dest);
-               *dest = NULL;
-               *dest_size = 0;
-
-               return CONTACTS_ERROR_SYSTEM;
-       }
-
-       return CONTACTS_ERROR_NONE;
-}
-
-////// contacts_normalized_strstr API should be separated from contacts-service /////////////////////////////////////////////////////////////
-static int __ctsvc_normalize_str_to_unicode(const char *src, int src_size, UChar *dest, int dest_size)
-{
-       int ret;
-       int32_t size = dest_size;
-       UErrorCode status = 0;
-       UChar tmp_result[dest_size];
-
-       u_strFromUTF8(tmp_result, dest_size, &size, src, src_size, &status);
-
-       if (U_FAILURE(status)) {
-               CTS_ERR("u_strFromUTF8() Fail(%s)", u_errorName(status));
-               return CONTACTS_ERROR_SYSTEM;
-       }
-
-       u_strToUpper(tmp_result, dest_size, tmp_result, -1, NULL, &status);
-       if (U_FAILURE(status)) {
-               CTS_ERR("u_strToUpper() Fail(%s)", u_errorName(status));
-               return CONTACTS_ERROR_SYSTEM;
-       }
-
-       size = unorm_normalize(tmp_result, -1, UNORM_NFD, 0,
-                       (UChar *)dest, dest_size, &status);
-       if (U_FAILURE(status)) {
-               CTS_ERR("unorm_normalize() Fail(%s)", u_errorName(status));
-               return CONTACTS_ERROR_SYSTEM;
-       }
-
-       ret = ctsvc_check_language(dest);
-       ctsvc_extra_normalize(dest, size);
-
-       dest[size] = 0x00;
-
-       return ret;
-}
-
-int ctsvc_normalize_str(const char *src, char **dest)
-{
-       int ret = CONTACTS_ERROR_NONE;
-       char temp[strlen(src) + 1];
-
-       ret = __ctsvc_remove_special_char(src, temp, strlen(src) + 1);
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "__ctsvc_remove_special_char() Fail(%d)", ret);
-
-       ret = __ctsvc_normalize_str(temp, dest);
-       return ret;
-}
-
-static void __ctsvc_convert_japanese_group_letter(char *dest)
-{
-       int i, size, dest_len;
-       UErrorCode status = 0;
-       UChar tmp_result[2];
-       UChar result[2] = {0x00};
-       int unicode_value1, unicode_value2;
-
-       dest_len = strlen(dest) + 1;
-       u_strFromUTF8(tmp_result, array_sizeof(tmp_result), NULL, dest, -1, &status);
-       RETM_IF(U_FAILURE(status), "u_strFromUTF8() Fail(%s)", u_errorName(status));
-
-       unicode_value1 = (0xFF00 & (tmp_result[0])) >> 8;
-       unicode_value2 = (0xFF & (tmp_result[0]));
-
-       for(i=0; i < 13; i++) {
-               if (hiragana_group[i].start <= unicode_value2
-                               && unicode_value2 <= hiragana_group[i].end)
-                       result[0] = hiragana_group[i].letter;
-       }
-
-       u_strToUTF8(dest, dest_len, &size, result, -1, &status);
-       RETM_IF(U_FAILURE(status), "u_strToUTF8() Fail(%s)", u_errorName(status));
-
-}
-
-int ctsvc_normalize_index(const char *src, char **dest)
-{
-       int ret = CONTACTS_ERROR_NONE;
-       char first_str[10] = {0};
-       int length = 0;
-
-       length = ctsvc_check_utf8(src[0]);
-       RETVM_IF(length <= 0, CONTACTS_ERROR_INTERNAL, "check_utf8 is Fail");
-
-       strncpy(first_str, src, length);
-       if (length != strlen(first_str))
-               return CONTACTS_ERROR_INVALID_PARAMETER;
-
-       ret = __ctsvc_normalize_str(first_str, dest);
-       if ((*dest)[0] != '\0') {
-               length = ctsvc_check_utf8((*dest)[0]);
-               (*dest)[length] = '\0';
-       }
-
-       if (ret == CTSVC_LANG_JAPANESE) {
-               __ctsvc_convert_japanese_group_letter(*dest);
-       }
-       return ret;
-}
-
-static inline bool __ctsvc_is_choseong(const char *src)
-{
-       unsigned short tmp;
-
-       tmp = (src[1] << 8) | src[2];
-       if (((char)0xE1 == src[0] && CTSVC_COMPARE_BETWEEN(0x8480, tmp, 0x859F)) /* korean -Hangul Jamo*/
-                       || ((char)0xEA == src[0] && CTSVC_COMPARE_BETWEEN(0xA5A0, tmp, 0xA5BC))) /* korean -Hangul Jamo extended A*/
-       {
-               return true;
-       }
-       return false;
-}
-
-static inline bool __ctsvc_is_diacritical(const char *src)
-{
-       unsigned short tmp;
-
-       if (!src || !*src || !*(src+1))
-               return false;
-
-       tmp = (src[0] << 8) | src[1];
-       if (CTSVC_COMPARE_BETWEEN(0xCC80, tmp, 0xCCBF)
-                       || CTSVC_COMPARE_BETWEEN(0xCD80, tmp, 0xCDAF))
-       {
-               return true;
-       }
-       return false;
-}
-
-static inline bool __ctsvc_compare_utf8(const char *str1, const char *str2, int str2_len)
-{
-       int k;
-       for (k=0; k<str2_len;k++)
-               if (!str1[k] || !str2[k] || str1[k] != str2[k])
-                       return false;
-       return true;
-}
-
-#define SMALL_BUFFER_SIZE 10
-
-static bool __ctsvc_compare_pinyin_letter(const char *haystack, int haystack_lang, const char *needle, int needle_lang, int *h_len, int *n_len)
-{
-       pinyin_name_s *pinyinname = NULL;
-       int size, ret = false;
-       int len, i, j, k;
-       char temp_needle[strlen(needle) + 1];
-       char temp[SMALL_BUFFER_SIZE];
-       bool match = false, initial_match = false;
-
-       if (haystack_lang != CTSVC_LANG_CHINESE || needle_lang != CTSVC_LANG_ENGLISH)
-               return false;
-
-       for(i=0, k=0; i < sizeof(temp_needle); i++)
-       {
-               if (isupper(needle[i]))
-                       temp_needle[i] = tolower(needle[i]);
-               else
-                       temp_needle[i] = needle[i];
-       }
-
-       for(i=0, j=0; i < strlen(haystack) && j < strlen(temp_needle) ; i+=len)
-       {
-               len = ctsvc_check_utf8(haystack[i]);
-               if (len < 0)
-                       return false;
-               memcpy(temp, haystack + i, len);
-               temp[len] = '\0';
-
-               ret = ctsvc_convert_chinese_to_pinyin(temp, &pinyinname, &size);
-               if (ret != CONTACTS_ERROR_NONE) {
-                       return false;
-               }
-
-               for(k=0; k<size; k++) {
-                       if (!initial_match &&
-                                       strlen(pinyinname[k].pinyin_name) <= strlen(temp_needle + j) &&
-                                       strncmp(pinyinname[k].pinyin_name, temp_needle + j, strlen(pinyinname[k].pinyin_name)) == 0) {
-                               match = true;
-                               j+=strlen(pinyinname[k].pinyin_name);
-                               break;
-
-                       }
-                       else if (!initial_match &&
-                                       strlen(temp_needle + j) < strlen(pinyinname[k].pinyin_name) &&
-                                       strncmp(pinyinname[k].pinyin_name, temp_needle + j, strlen(temp_needle + j)) == 0) {
-                               match = true;
-                               j+=strlen(temp_needle + j);
-                               break;
-
-                       }
-                       else if (pinyinname[k].pinyin_initial[0] ==  temp_needle[j]) {
-                               initial_match = true;
-                               match = true;
-                               j++;
-                               break;
-                       }
-                       else
-                               match = false;
-               }
-               free(pinyinname);
-
-               if (match==false) {
-                       break;
-               }
-
-       }
-
-       if (match) {
-               *h_len = i;
-               *n_len = j;
-       }
-
-       return match;
-}
-
-static bool __ctsvc_compare_unicode_letter(const UChar* haystack, int haystack_lang, const UChar *needle, int needle_lang)
-{
-       int i, j;
-       bool ret = false;
-
-       switch (haystack_lang)
-       {
-       case CTSVC_LANG_NUMBER:
-       case CTSVC_LANG_OTHERS:
-               {
-                       if (haystack_lang == needle_lang)
-                       {
-                               for(i=0, j=0; i<u_strlen(haystack) && j<u_strlen(needle);) {
-                                       if (haystack[i] == needle[j])
-                                               ret = true;
-                                       else {
-                                               ret = false;
-                                               break;
-                                       }
-                                       i++;
-                                       j++;
-                               }
-                       }
-                       return ret;
-               }
-       case CTSVC_LANG_ENGLISH:
-               {
-                       switch(needle_lang)
-                       {
-                       case CTSVC_LANG_ENGLISH:
-                               for(i=0, j=0; i<u_strlen(haystack) && j<u_strlen(needle);) {
-                                       if (CTSVC_COMPARE_BETWEEN(CTSVC_COMBINING_DIACRITICAL_MARKS_START,
-                                                       haystack[i], CTSVC_COMBINING_DIACRITICAL_MARKS_END)) {
-                                               i++;
-                                               continue;
-                                       }
-                                       if (CTSVC_COMPARE_BETWEEN(CTSVC_COMBINING_DIACRITICAL_MARKS_START,
-                                                       needle[j], CTSVC_COMBINING_DIACRITICAL_MARKS_END)) {
-                                               j++;
-                                               continue;
-                                       }
-
-                                       if (haystack[i] == needle[j])
-                                               ret = true;
-                                       else {
-                                               ret = false;
-                                               break;
-                                       }
-
-                                       i++;
-                                       j++;
-                               }
-                               return ret;
-                       default:
-                               return false;
-                       }
-               }
-               break;
-       case CTSVC_LANG_KOREAN:
-               {
-                       if (needle_lang != CTSVC_LANG_KOREAN)
-                               break;
-
-                       if (u_strlen(needle) == 1
-                                       && CTSVC_COMPARE_BETWEEN(0x3130, needle[0], 0x314e)
-                                       && haystack[0] == needle[0]) {
-                               return true;
-                       }
-
-                       for(i=0, j=0; i<u_strlen(haystack) && j<u_strlen(needle);) {
-                               if (haystack[i] == needle[j])
-                                       ret = true;
-                               else {
-                                       ret = false;
-                                       break;
-                               }
-                               i++;
-                               j++;
-                       }
-                       return ret;
-               }
-               break;
-       case CTSVC_LANG_JAPANESE:
-               {
-                       if (needle_lang != CTSVC_LANG_JAPANESE)
-                               break;
-
-                       if (haystack[0] == needle[0])
-                               ret = true;
-                       else {
-                               UChar temp_haystack[2] = {0x00,};
-                               UChar temp_needle[2] = {0x00,};
-                               UChar hiragana_haystack[2] = {0x00,};
-                               UChar hiragana_needle[2] = {0x00,};
-                               temp_haystack[0] = haystack[0];
-                               temp_needle[0] = needle[0];
-
-                               ctsvc_convert_japanese_to_hiragana_unicode(temp_haystack, hiragana_haystack, 2);
-
-                               ctsvc_convert_japanese_to_hiragana_unicode(temp_needle, hiragana_needle,  2);
-
-                               if (hiragana_haystack[0] == hiragana_needle[0])
-                                       ret = true;
-                       }
-                       return ret;
-               }
-       case CTSVC_LANG_CHINESE:
-               {
-                       if (needle_lang == haystack_lang
-                                       && haystack[0] == needle[0])
-                               ret = true;
-               }
-               return ret;
-       }
-
-       return false;
-}
-
-/**
- * This function compares compares two strings which is not normalized.
- * If search_str is included in str, this function return #sCONTACTS_ERROR_NONE. \n
- * The behavior of this function cannot fix because of localization.
- * So, The behavior can be different from each other.
- *
- * @param[in] haystack Base string.
- * @param[in] needle searching string
- * @param[out] len substring length
- * @return a position of the beginning of the substring, Negative value(#cts_error) on error or difference.
- */
-API int contacts_utils_strstr(const char *haystack,
-               const char *needle, int *len)
-{
-       int ret, h_len, n_len, i, j;
-       UChar haystack_letter[SMALL_BUFFER_SIZE];
-       UChar needle_letter[SMALL_BUFFER_SIZE];
-       UChar first_needle_letter[SMALL_BUFFER_SIZE];
-       int haystack_letter_lang;
-       int needle_letter_lang;
-       int first_needle_letter_lang;
-
-       bool matching=false;
-       int match_len = 0;
-       int match_start = -1;
-
-       char temp_haystack[strlen(haystack) + 1];
-       char temp_needle[strlen(needle) + 1];
-
-       RETVM_IF(NULL == haystack, -1, "The parameter(haystack) is NULL");
-       RETVM_IF(NULL == needle, -1, "The parameter(needle) is NULL");
-       CTS_VERBOSE("haystack = %s, needle = %s", haystack, needle);
-
-       *len = 0;
-
-       ret = __ctsvc_remove_special_char(haystack, temp_haystack, strlen(haystack) + 1);
-       ret = __ctsvc_remove_special_char(needle, temp_needle, strlen(needle) + 1);
-
-       n_len = ctsvc_check_utf8(temp_needle[0]);
-
-       first_needle_letter_lang = __ctsvc_normalize_str_to_unicode(temp_needle, n_len, first_needle_letter, SMALL_BUFFER_SIZE);
-       RETVM_IF(first_needle_letter_lang < CONTACTS_ERROR_NONE , -1, "The __ctsvc_normalize_str_to_unicode Fail(%d)", first_needle_letter_lang);
-
-       for (i=0, j=0;i<strlen(temp_haystack) && j<strlen(temp_needle);i+=h_len) {
-               h_len = ctsvc_check_utf8(temp_haystack[i]);
-
-               haystack_letter_lang = __ctsvc_normalize_str_to_unicode(temp_haystack + i, h_len, haystack_letter, SMALL_BUFFER_SIZE);
-               RETVM_IF(haystack_letter_lang < CONTACTS_ERROR_NONE , -1, "The __ctsvc_normalize_str_to_unicode Fail(%d)", haystack_letter_lang);
-
-               if (matching == false) {
-                       if (__ctsvc_compare_unicode_letter(haystack_letter, haystack_letter_lang, first_needle_letter, first_needle_letter_lang)
-                                       || __ctsvc_compare_pinyin_letter(temp_haystack + i, haystack_letter_lang, temp_needle + j, first_needle_letter_lang, &h_len, &n_len)) {
-                               matching = true;
-                               j+=n_len;
-                               match_start = i;
-                               match_len = h_len;
-
-                               if (temp_needle[j] == '\0') {
-                                       *len = match_len;
-                                       return match_start;
-                               }
-                       }
-                       continue;
-               }
-               else if (matching == true) {
-                       n_len = ctsvc_check_utf8(temp_needle[j]);
-
-                       needle_letter_lang = __ctsvc_normalize_str_to_unicode(temp_needle + j, n_len, needle_letter, SMALL_BUFFER_SIZE);
-                       RETVM_IF(needle_letter_lang < CONTACTS_ERROR_NONE , -1, "The __ctsvc_normalize_str_to_unicode Fail(%d)", needle_letter_lang);
-
-                       if (__ctsvc_compare_unicode_letter(haystack_letter, haystack_letter_lang, needle_letter, needle_letter_lang)) {
-                               j+=n_len;
-                               match_len += h_len;
-
-                               if (temp_needle[j] == '\0') {
-                                       *len = match_len;
-                                       return match_start;
-                               }
-                               continue;
-                       }
-                       else {
-                               j = 0;
-                               matching = false;
-                               match_start = -1;
-                               match_len = 0;
-                       }
-               }
-       }
-
-       CTS_VERBOSE("NOT match");
-       return -1;
-}
-
-/**
- * This function compares compares two strings which must have been normalized already.
- * If search_str is included in str, this function return #sCONTACTS_ERROR_NONE. \n
- * The behavior of this function cannot fix because of localization.
- * So, The behavior can be different from each other.
- *
- * @param[in] haystack Base string.
- * @param[in] needle searching string
- * @param[out] len substring length
- * @return a position of the beginning of the substring, Negative value(#cts_error) on error or difference.
- */
-API int contacts_normalized_strstr(const char *haystack,
-               const char *needle, int *len)
-{
-       int i, j, wind, h_len, n_len;
-       int first_needle_len;
-       int equal_index;
-       int equal_length;
-       int equal_wind = 0;
-       bool counted = false;
-       RETVM_IF(NULL == haystack, -1, "The parameter(haystack) is NULL");
-       RETVM_IF(NULL == needle, -1, "The parameter(needle) is NULL");
-       CTS_VERBOSE("haystack = %s, needle = %s", haystack, needle);
-
-       h_len = 1;
-       n_len = 1;
-       equal_index = 0;
-       first_needle_len = ctsvc_check_utf8(needle[0]);
-       for (i=0, j=0;i<strlen(haystack);i = wind?wind:(i+h_len)) {
-               if (equal_wind) {
-                       equal_index = equal_wind;
-                       counted = false;
-               }
-               wind = 0;
-               equal_length = 0;
-               equal_wind = 0;
-               for (j=0;j<strlen(needle);) {
-                       bool equal;
-                       h_len = ctsvc_check_utf8(haystack[i]);
-
-                       if (h_len == 1 && haystack[i] == 0x7E) {                //skip seperator
-                               counted = false;
-                               i+=h_len;
-                               continue;
-                       }
-
-                       n_len = ctsvc_check_utf8(needle[j]);
-                       if (n_len == 1 && needle[j] == 0x7E) {          //skip seperator
-                               j++;
-                               continue;
-                       }
-
-                       if (wind == 0 && j && 0 < i) {
-                               if (h_len == first_needle_len && __ctsvc_compare_utf8(&haystack[i], needle, first_needle_len)
-                                               && !__ctsvc_is_diacritical(&haystack[i])) {
-                                       unsigned short tmp;
-
-                                       tmp = (haystack[i+1] << 8) | haystack[i+2];
-                                       if (!counted) {
-                                               wind = i;
-                                               equal_wind = equal_index + equal_length;
-                                       }
-                               }
-                       }
-
-                       if ((2 == h_len && __ctsvc_is_diacritical(&haystack[i]))
-                                       && (2 != n_len || !__ctsvc_is_diacritical(&needle[j]))) {
-                               if (j == 0) {
-                                       if (counted)
-                                               equal_index++;
-                                       else {
-                                               equal_index += h_len;
-                                               counted = true;
-                                       }
-                               }
-                               else if (!counted) {
-                                       equal_length += h_len;
-                                       counted = true;
-                               }
-                               else if (counted)
-                                       equal_length++;
-                               i+=h_len;
-                               continue;
-                       }
-
-                       if (h_len != n_len) {
-                               if (!counted) {
-                                       equal_index += (equal_length + h_len);
-                                       counted = true;
-                               }
-                               break;
-                       }
-
-                       if (3 == n_len && __ctsvc_is_choseong(&needle[j]) && !(__ctsvc_is_choseong(&haystack[i]))) {
-                               if (j < (n_len+1) || !__ctsvc_is_choseong(&needle[j-n_len-1])) {                // skip 강나 search by 가나
-                                       if (!counted) {
-                                               equal_index += (equal_length + h_len);
-                                               counted = true;
-                                       }
-                                       break;
-                               }
-                               else {
-                                       if (j == 0) {
-                                               if (!counted) {
-                                                       equal_index += h_len;
-                                                       counted = true;
-                                               }
-                                       }
-                                       else if (!counted) {
-                                               equal_length += h_len;
-                                               counted = true;
-                                       }
-                                       i+=h_len;
-                                       continue;
-                               }
-                       }
-
-                       equal = __ctsvc_compare_utf8(&haystack[i], &needle[j], n_len);
-
-                       if (equal) {
-                               if (!counted) {
-                                       equal_length += h_len;
-                                       counted = true;
-                               }
-                               else if (2 == n_len && __ctsvc_is_diacritical(&needle[j]))
-                                       equal_length ++;
-                               j += n_len;
-                               i+=h_len;
-                               continue;
-                       }
-                       else {
-                               if (!counted) {
-                                       equal_index += (equal_length + h_len);
-                                       counted = true;
-                               }
-                               else {
-                                       if (2 == n_len && __ctsvc_is_diacritical(&needle[j]))
-                                               equal_index += (equal_length + 1);
-                                       else
-                                               equal_index += equal_length;
-                               }
-                               break;
-                       }
-               }
-
-               if ('\0' == needle[j]) {
-                       if ('\0' != haystack[i]) {
-                               h_len = ctsvc_check_utf8(haystack[i]);
-                               if (h_len == 2 && __ctsvc_is_diacritical(&haystack[i]))
-                                       equal_length++;
-                       }
-                       *len = equal_length;
-                       return equal_index;
-               }
-       }
-
-       CTS_VERBOSE("NOT match");
-       return -1;
-}
-
-/**
- * This function make searchable string.
- * The string can use at contacts_svc_normalized_strstr().
- *
- * @param[in] src the string to convert
- * @param[out] dest The pointer to get normalized string.
- * @param[out] dest_len the size of dest.
- * @return #CTS_SUCCESS on success, Negative value(#cts_error) on error
- */
-API int contacts_normalize_str(const char *src, char *dest, const int dest_len)
-{
-       int ret;
-       char *temp = NULL;
-       RETV_IF(NULL == dest, CONTACTS_ERROR_INVALID_PARAMETER);
-       RETVM_IF(dest_len <= 0, CONTACTS_ERROR_INVALID_PARAMETER, "dest_len(%d) is Invalid", dest_len);
-       dest[0] = '\0';
-
-       ret = ctsvc_normalize_str(src, &temp);
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "ctsvc_normalize_str() Fail(%d)", ret);
-
-       snprintf(dest, dest_len, "%s", temp);
-       free(temp);
-
-       return CONTACTS_ERROR_NONE;
-}
-
diff --git a/common/ctsvc_normalize.h b/common/ctsvc_normalize.h
deleted file mode 100644 (file)
index a59e30a..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Contacts Service
- *
- * Copyright (c) 2010 - 2012 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.
- *
- */
-#ifndef __CTSVC_NORMALIZE_H__
-#define __CTSVC_NORMALIZE_H__
-
-enum LANGTYPE{
-       CTSVC_LANG_NUMBER = 0,
-       CTSVC_LANG_DEFAULT = 1,
-       CTSVC_LANG_SECONDARY = 2,
-       CTSVC_LANG_ENGLISH = 3,
-       CTSVC_LANG_KOREAN = 4, /* always last-first */
-       CTSVC_LANG_CHINESE = 5,
-       CTSVC_LANG_JAPANESE = 6,
-       CTSVC_LANG_FRENCH = 7,
-       CTSVC_LANG_GERMAN = 8,
-       CTSVC_LANG_ITALIAN = 9,
-       CTSVC_LANG_RUSSIAN = 10,
-       CTSVC_LANG_DUTCH = 11,
-       CTSVC_LANG_PORTUGUESE = 12,
-       CTSVC_LANG_TURKISH = 13,
-       CTSVC_LANG_GREEK = 14,
-       CTSVC_LANG_SPANISH = 15,
-       CTSVC_LANG_DANISH = 16,
-       CTSVC_LANG_AZERBAIJAN = 17,
-       CTSVC_LANG_ARABIC = 18,
-       CTSVC_LANG_BULGARIAN = 19,
-       CTSVC_LANG_CATALAN = 20,
-       CTSVC_LANG_CZECH = 21,
-       CTSVC_LANG_ESTONIAN = 22,
-       CTSVC_LANG_BASQUE = 23,
-       CTSVC_LANG_FINNISH = 24,
-       CTSVC_LANG_IRISH = 25,
-       CTSVC_LANG_GALICIAN = 26,
-       CTSVC_LANG_HINDI = 27,
-       CTSVC_LANG_CROATIAN = 28,
-       CTSVC_LANG_HUNGARIAN= 29,
-       CTSVC_LANG_ARMENIAN = 30,
-       CTSVC_LANG_ICELANDIC = 31,
-       CTSVC_LANG_GEORGIAN = 32,
-       CTSVC_LANG_KAZAKHSTAN = 33,
-       CTSVC_LANG_LITHUANIAN = 34,
-       CTSVC_LANG_LATVIAN = 35,
-       CTSVC_LANG_MACEDONIA = 36,
-       CTSVC_LANG_NORWAY= 37,
-       CTSVC_LANG_POLISH = 38,
-       CTSVC_LANG_ROMANIA = 39,
-       CTSVC_LANG_SLOVAK = 40,
-       CTSVC_LANG_SLOVENIAN = 41,
-       CTSVC_LANG_SERBIAN = 42,
-       CTSVC_LANG_SWEDISH = 43,
-       CTSVC_LANG_UKRAINE = 44,
-       CTSVC_LANG_OTHERS = 1000,
-};
-
-#define CTSVC_COMPARE_BETWEEN(left_range, value, right_range) (((left_range) <= (value)) && ((value) <= (right_range)))
-
-int ctsvc_normalize_str(const char *src, char **dest);
-int ctsvc_collation_str(char *src, char **dest);
-int ctsvc_normalize_index(const char *src, char **dest);
-int ctsvc_get_halfwidth_string(const char *src, char** dest, int* dest_size);
-
-#endif /*  __CTSVC_NORMALIZE_H__ */
index 661f329..4499e56 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
 #ifndef __CTSVC_NOTIFY_H__
 #define __CTSVC_NOTIFY_H__
 
-#define CTSVC_VCARD_IMAGE_LOCATION tzplatform_mkpath(TZ_USER_SHARE,"vcard")
+#define CTSVC_VCARD_IMAGE_LOCATION tzplatform_mkpath(TZ_USER_SHARE, "vcard")
 
 #define DATA_REPERTORY tzplatform_getenv(TZ_USER_DATA)
-#define CTSVC_NOTI_REPERTORY tzplatform_mkpath(TZ_USER_DATA,"contacts-svc")
-#define CTSVC_NOTI_IMG_REPERTORY tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/img/")
-#define CTS_MY_IMAGE_LOCATION tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/img/my")
-#define CTS_GROUP_IMAGE_LOCATION tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/img/group")
-#define CTS_LOGO_IMAGE_LOCATION tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/img/logo")
-#define CTSVC_CONTACT_IMG_FULL_LOCATION tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/img/contact")
+#define CTSVC_NOTI_REPERTORY tzplatform_mkpath(TZ_USER_DATA, "contacts-svc")
+#define CTSVC_NOTI_IMG_REPERTORY tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/img/")
+#define CTS_MY_IMAGE_LOCATION tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/img/my")
+#define CTS_GROUP_IMAGE_LOCATION tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/img/group")
+#define CTS_LOGO_IMAGE_LOCATION tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/img/logo")
+#define CTSVC_CONTACT_IMG_FULL_LOCATION tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/img/contact")
 
-#define CTSVC_NOTI_IPC_READY tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/.CONTACTS_SVC_IPC_READY")
-#define CTSVC_NOTI_ADDRESSBOOK_CHANGED tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/.CONTACTS_SVC_AB_CHANGED")
-#define CTSVC_NOTI_GROUP_CHANGED tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/.CONTACTS_SVC_GROUP_CHANGED")
-#define CTSVC_NOTI_PERSON_CHANGED tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/.CONTACTS_SVC_PERSON_CHANGED")
-#define CTSVC_NOTI_CONTACT_CHANGED tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/.CONTACTS_SVC_DB_CHANGED")
-#define CTSVC_NOTI_MY_PROFILE_CHANGED tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/.CONTACTS_SVC_MY_PROFILE_CHANGED")
-#define CTSVC_NOTI_NAME_CHANGED tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/.CONTACTS_SVC_NAME_CHANGED")
-#define CTSVC_NOTI_NUMBER_CHANGED tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/.CONTACTS_SVC_NUMBER_CHANGED")
-#define CTSVC_NOTI_EMAIL_CHANGED tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/.CONTACTS_SVC_EMAIL_CHANGED")
-#define CTSVC_NOTI_EVENT_CHANGED tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/.CONTACTS_SVC_EVENT_CHANGED")
-#define CTSVC_NOTI_URL_CHANGED tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/.CONTACTS_SVC_URL_CHANGED")
-#define CTSVC_NOTI_GROUP_RELATION_CHANGED tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/.CONTACTS_SVC_GROUP_RELATION_CHANGED")
-#define CTSVC_NOTI_ADDRESS_CHANGED tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/.CONTACTS_SVC_ADDRESS_CHANGED")
-#define CTSVC_NOTI_NOTE_CHANGED tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/.CONTACTS_SVC_NOTE_CHANGED")
-#define CTSVC_NOTI_COMPANY_CHANGED tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/.CONTACTS_SVC_COMPANY_CHANGED")
-#define CTSVC_NOTI_RELATIONSHIP_CHANGED tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/.CONTACTS_SVC_RELATIONSHIP_CHANGED")
-#define CTSVC_NOTI_IMAGE_CHANGED tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/.CONTACTS_SVC_IMAGE_CHANGED")
-#define CTSVC_NOTI_NICKNAME_CHANGED tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/.CONTACTS_SVC_NICKNAME_CHANGED")
-#define CTSVC_NOTI_MESSENGER_CHANGED tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/.CONTACTS_SVC_MESSENGER_CHANGED")
-#define CTSVC_NOTI_DATA_CHANGED tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/.CONTACTS_SVC_DATA_CHANGED")
-#define CTSVC_NOTI_SDN_CHANGED tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/.CONTACTS_SVC_SDN_CHANGED")
-#define CTSVC_NOTI_PROFILE_CHANGED tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/.CONTACTS_SVC_PROFILE_CHANGED")
-#define CTSVC_NOTI_ACTIVITY_CHANGED tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/.CONTACTS_SVC_ACTIVITY_CHANGED")
-#define CTSVC_NOTI_ACTIVITY_PHOTO_CHANGED tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/.CONTACTS_SVC_ACTIVITY_PHOTO_CHANGED")
-#define CTSVC_NOTI_PHONELOG_CHANGED tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/.CONTACTS_SVC_PLOG_CHANGED")
-#define CTSVC_NOTI_SPEEDDIAL_CHANGED tzplatform_mkpath(TZ_USER_DATA,"contacts-svc/.CONTACTS_SVC_SPEED_CHANGED")
+#define CTSVC_NOTI_IPC_READY tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/.CONTACTS_SVC_IPC_READY")
+#define CTSVC_NOTI_ADDRESSBOOK_CHANGED tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/.CONTACTS_SVC_AB_CHANGED")
+#define CTSVC_NOTI_GROUP_CHANGED tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/.CONTACTS_SVC_GROUP_CHANGED")
+#define CTSVC_NOTI_PERSON_CHANGED tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/.CONTACTS_SVC_PERSON_CHANGED")
+#define CTSVC_NOTI_CONTACT_CHANGED tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/.CONTACTS_SVC_DB_CHANGED")
+#define CTSVC_NOTI_MY_PROFILE_CHANGED tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/.CONTACTS_SVC_MY_PROFILE_CHANGED")
+#define CTSVC_NOTI_NAME_CHANGED tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/.CONTACTS_SVC_NAME_CHANGED")
+#define CTSVC_NOTI_NUMBER_CHANGED tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/.CONTACTS_SVC_NUMBER_CHANGED")
+#define CTSVC_NOTI_EMAIL_CHANGED tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/.CONTACTS_SVC_EMAIL_CHANGED")
+#define CTSVC_NOTI_EVENT_CHANGED tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/.CONTACTS_SVC_EVENT_CHANGED")
+#define CTSVC_NOTI_URL_CHANGED tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/.CONTACTS_SVC_URL_CHANGED")
+#define CTSVC_NOTI_GROUP_RELATION_CHANGED tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/.CONTACTS_SVC_GROUP_RELATION_CHANGED")
+#define CTSVC_NOTI_ADDRESS_CHANGED tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/.CONTACTS_SVC_ADDRESS_CHANGED")
+#define CTSVC_NOTI_NOTE_CHANGED tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/.CONTACTS_SVC_NOTE_CHANGED")
+#define CTSVC_NOTI_COMPANY_CHANGED tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/.CONTACTS_SVC_COMPANY_CHANGED")
+#define CTSVC_NOTI_RELATIONSHIP_CHANGED tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/.CONTACTS_SVC_RELATIONSHIP_CHANGED")
+#define CTSVC_NOTI_IMAGE_CHANGED tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/.CONTACTS_SVC_IMAGE_CHANGED")
+#define CTSVC_NOTI_NICKNAME_CHANGED tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/.CONTACTS_SVC_NICKNAME_CHANGED")
+#define CTSVC_NOTI_MESSENGER_CHANGED tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/.CONTACTS_SVC_MESSENGER_CHANGED")
+#define CTSVC_NOTI_DATA_CHANGED tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/.CONTACTS_SVC_DATA_CHANGED")
+#define CTSVC_NOTI_SDN_CHANGED tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/.CONTACTS_SVC_SDN_CHANGED")
+#define CTSVC_NOTI_PROFILE_CHANGED tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/.CONTACTS_SVC_PROFILE_CHANGED")
+#define CTSVC_NOTI_ACTIVITY_CHANGED tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/.CONTACTS_SVC_ACTIVITY_CHANGED")
+#define CTSVC_NOTI_ACTIVITY_PHOTO_CHANGED tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/.CONTACTS_SVC_ACTIVITY_PHOTO_CHANGED")
+#define CTSVC_NOTI_PHONELOG_CHANGED tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/.CONTACTS_SVC_PLOG_CHANGED")
+#define CTSVC_NOTI_SPEEDDIAL_CHANGED tzplatform_mkpath(TZ_USER_DATA, "contacts-svc/.CONTACTS_SVC_SPEED_CHANGED")
 #define CTSVC_SETTING_DISPLAY_ORDER_CHANGED "contacts.setting.display_order"
 #define CTSVC_SETTING_SORTING_ORDER_CHANGED "contacts.setting.sorting_order"
 
index a1bf80f..78f6246 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
 typedef enum {
        QUERY_SORTKEY,
        QUERY_PROJECTION,
-}query_property_type_e;
+} query_property_type_e;
 
 static bool __ctsvc_query_property_check(const property_info_s *properties,
                int count, query_property_type_e property_type, unsigned int property_id)
 {
        int i;
 
-       for (i=0;i<count;i++) {
+       for (i = 0; i < count; i++) {
                property_info_s *p = (property_info_s*)&(properties[i]);
                if (property_id == p->property_id) {
                        if (property_type == QUERY_PROJECTION) {
@@ -43,15 +39,15 @@ static bool __ctsvc_query_property_check(const property_info_s *properties,
                                        return true;
                                else
                                        return false;
-                       }
-                       else
+                       } else {
                                return true;
+                       }
                }
        }
        return false;
 }
 
-API int contacts_query_create(const char* view_uri, contacts_query_h* out_query)
+API int contacts_query_create(const char *view_uri, contacts_query_h *out_query)
 {
        ctsvc_query_s *query;
 
@@ -60,11 +56,11 @@ API int contacts_query_create(const char* view_uri, contacts_query_h* out_query)
 
        RETV_IF(NULL == view_uri || NULL == out_query, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       query = (ctsvc_query_s *)calloc(1, sizeof(ctsvc_query_s));
+       query = calloc(1, sizeof(ctsvc_query_s));
        RETV_IF(NULL == query, CONTACTS_ERROR_OUT_OF_MEMORY);
 
        query->view_uri = strdup(view_uri);
-       query->properties = (property_info_s *)ctsvc_view_get_all_property_infos(view_uri, &query->property_count);
+       query->properties = (property_info_s*)ctsvc_view_get_all_property_infos(view_uri, &query->property_count);
        *out_query = (contacts_query_h)query;
 
        return CONTACTS_ERROR_NONE;
@@ -77,19 +73,19 @@ API int contacts_query_set_projection(contacts_query_h query, unsigned int prope
        bool find;
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       query_s = (ctsvc_query_s *)query;
+       query_s = (ctsvc_query_s*)query;
 
-       for (i=0;i<count;i++) {
+       for (i = 0; i < count; i++) {
                find = __ctsvc_query_property_check(query_s->properties, query_s->property_count, QUERY_PROJECTION, property_ids[i]);
                RETVM_IF(false == find, CONTACTS_ERROR_INVALID_PARAMETER,
-                                       "Invalid parameter : property_id(%d) is not supported on view_uri(%s)", property_ids[i], query_s->view_uri);
+                               "property_id(%d) is not supported on view_uri(%s)", property_ids[i], query_s->view_uri);
        }
        if (query_s->projection)
                free(query_s->projection);
 
        query_s->projection = calloc(count, sizeof(unsigned int));
        if (NULL == query_s->projection) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
        memcpy(query_s->projection, property_ids, sizeof(unsigned int) * count);
@@ -105,7 +101,7 @@ API int contacts_query_set_filter(contacts_query_h query, contacts_filter_h filt
        contacts_filter_h new_filter;
 
        RETV_IF(NULL == query || NULL == filter, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        ret = ctsvc_filter_clone(filter, &new_filter);
        RETVM_IF(ret != CONTACTS_ERROR_NONE, ret, "ctsvc_filter_clone Fail(%d)", ret);
@@ -120,11 +116,11 @@ API int contacts_query_set_sort(contacts_query_h query, unsigned int property_id
        bool find = false;
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       query_s = (ctsvc_query_s *)query;
+       query_s = (ctsvc_query_s*)query;
 
        find = __ctsvc_query_property_check(query_s->properties, query_s->property_count, QUERY_SORTKEY, property_id);
        RETVM_IF(false == find, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is not supported on view_uri(%s)", property_id, query_s->view_uri);
+                       "property_id(%d) is not supported on view_uri(%s)", property_id, query_s->view_uri);
        query_s->sort_property_id = property_id;
        query_s->sort_asc = asc;
 
@@ -135,7 +131,7 @@ API int contacts_query_destroy(contacts_query_h query)
 {
        ctsvc_query_s *s_query;
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        if (s_query->filter)
                contacts_filter_destroy((contacts_filter_h)s_query->filter);
@@ -152,7 +148,7 @@ API int contacts_query_set_distinct(contacts_query_h query, bool set)
        ctsvc_query_s *query_s;
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       query_s = (ctsvc_query_s *)query;
+       query_s = (ctsvc_query_s*)query;
        query_s->distinct = set;
 
        return CONTACTS_ERROR_NONE;
index 0192e27..ebd860f 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
@@ -61,7 +57,7 @@ extern ctsvc_record_plugin_cb_s phonelog_plugin_cbs;
 
 static const ctsvc_record_plugin_cb_s *__ctsvc_record_get_plugin_cb(int r_type)
 {
-       switch((int)r_type) {
+       switch ((int)r_type) {
        case CTSVC_RECORD_ADDRESSBOOK:
                return &addressbook_plugin_cbs;
        case CTSVC_RECORD_GROUP:
@@ -126,14 +122,14 @@ static const ctsvc_record_plugin_cb_s *__ctsvc_record_get_plugin_cb(int r_type)
 }
 
 #define __INVALID_PARAMETER_ERROR_HANDLING() \
-               CTS_ERR("Invalid parameter: Operation restricted."); \
-               return CONTACTS_ERROR_INVALID_PARAMETER;
+       ERR("Invalid parameter: Operation restricted."); \
+return CONTACTS_ERROR_INVALID_PARAMETER;
 
 /*
  * This function is used for view_uri which is able to CRUD.
  * The view_uri's property should be sequencial value because it is used to find index at the below logic.
  */
-bool ctsvc_record_check_property_flag(const ctsvc_record_ss_record, unsigned int property_id, contacts_property_flag_e flag)
+bool ctsvc_record_check_property_flag(const ctsvc_record_s *s_record, unsigned int property_id, contacts_property_flag_e flag)
 {
        int index = property_id & 0x000000FF;
 
@@ -165,7 +161,7 @@ bool ctsvc_record_check_property_flag(const ctsvc_record_s* s_record, unsigned i
        return (s_record->properties_flags[index] & flag) ? true : false;
 }
 
-int ctsvc_record_set_property_flag(ctsvc_record_s_record, int property_id, contacts_property_flag_e flag)
+int ctsvc_record_set_property_flag(ctsvc_record_s *_record, int property_id, contacts_property_flag_e flag)
 {
        int index = property_id & 0x000000FF;
 
@@ -179,7 +175,7 @@ int ctsvc_record_set_property_flag(ctsvc_record_s* _record, int property_id, con
 
                _record->properties_flags = calloc(count, sizeof(char));
                _record->property_max_count = count;
-               RETVM_IF(NULL == _record->properties_flags, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc Fail");
+               RETVM_IF(NULL == _record->properties_flags, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
        }
        _record->property_flag |= flag;
        _record->properties_flags[index] |= flag;
@@ -189,18 +185,18 @@ int ctsvc_record_set_property_flag(ctsvc_record_s* _record, int property_id, con
 
 #define __CHECK_READ_ONLY_PROPERTY() \
        if (CTSVC_READ_ONLY_CHECK(property_id, CTSVC_READ_ONLY_PROPERTY)) { \
-               CTS_ERR("Invalid parameter: Don't try to change read-only property.(0x%0x)", property_id); \
+               ERR("Don't try to change read-only property.(0x%0x)", property_id); \
                return CONTACTS_ERROR_INVALID_PARAMETER; \
        }
 
 #define __CHECK_PROJECTED_PROPERTY() \
        if (false == ctsvc_record_check_property_flag(s_record, property_id, CTSVC_PROPERTY_FLAG_PROJECTION)) { \
-               CTS_ERR("Invalid parameter: Don't try to get un-projected property(0x%0x).", property_id); \
+               ERR("Don't try to get un-projected property(0x%0x).", property_id); \
                return CONTACTS_ERROR_INVALID_PARAMETER; \
        }
 
 /* Record constuct/destruct */
-API int contacts_record_create(const char* view_uri, contacts_record_h* out_record)
+API int contacts_record_create(const char *view_uri, contacts_record_h *out_record)
 {
        int ret;
        ctsvc_record_type_e r_type;
@@ -211,15 +207,15 @@ API int contacts_record_create(const char* view_uri, contacts_record_h* out_reco
        *out_record = NULL;
 
        r_type = ctsvc_view_get_record_type(view_uri);
-       RETVM_IF (CTSVC_RECORD_INVALID == r_type, CONTACTS_ERROR_INVALID_PARAMETER,
-                                       "Invalid parameter : view_uri(%s)", view_uri);
+       RETVM_IF(CTSVC_RECORD_INVALID == r_type, CONTACTS_ERROR_INVALID_PARAMETER,
+                       "view_uri(%s)", view_uri);
 
        plugin_cb = __ctsvc_record_get_plugin_cb(r_type);
        if (plugin_cb && plugin_cb->create) {
                ret = plugin_cb->create(out_record);
-               if (CONTACTS_ERROR_NONE == ret) {
+               if (CONTACTS_ERROR_NONE == ret)
                        CTSVC_RECORD_INIT_BASE((ctsvc_record_s*)*out_record, r_type, plugin_cb, ctsvc_view_get_uri(view_uri));
-               }
+
                return ret;
        }
 
@@ -231,7 +227,7 @@ API int contacts_record_destroy(contacts_record_h record, bool delete_child)
        ctsvc_record_s *s_record;
 
        RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_record = (ctsvc_record_s *)record;
+       s_record = (ctsvc_record_s*)record;
 
        if (s_record && s_record->plugin_cbs && s_record->plugin_cbs->destroy)
                return s_record->plugin_cbs->destroy(record, delete_child);
@@ -239,7 +235,7 @@ API int contacts_record_destroy(contacts_record_h record, bool delete_child)
        __INVALID_PARAMETER_ERROR_HANDLING();
 }
 
-API int contacts_record_clone(contacts_record_h record, contacts_record_hout_record)
+API int contacts_record_clone(contacts_record_h record, contacts_record_h *out_record)
 {
        ctsvc_record_s *s_record;
 
@@ -247,7 +243,7 @@ API int contacts_record_clone(contacts_record_h record, contacts_record_h* out_r
        *out_record = NULL;
 
        RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_record = (ctsvc_record_s *)record;
+       s_record = (ctsvc_record_s*)record;
 
        if (s_record->plugin_cbs && s_record->plugin_cbs->clone)
                return s_record->plugin_cbs->clone(record, out_record);
@@ -255,21 +251,22 @@ API int contacts_record_clone(contacts_record_h record, contacts_record_h* out_r
        __INVALID_PARAMETER_ERROR_HANDLING();
 }
 
-API int contacts_record_get_uri_p(contacts_record_h record, const char** out_str)
+API int contacts_record_get_uri_p(contacts_record_h record, const char **out_str)
 {
-    int ret = CONTACTS_ERROR_NONE;
+       int ret = CONTACTS_ERROR_NONE;
 
-    ctsvc_record_s *temp = (ctsvc_record_s*)(record);
+       ctsvc_record_s *temp = (ctsvc_record_s*)(record);
 
-    RETVM_IF(NULL == record || NULL == out_str, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter");
+       RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == out_str, CONTACTS_ERROR_INVALID_PARAMETER);
 
-    *out_str = (temp->view_uri);
+       *out_str = (temp->view_uri);
 
-    return ret;
+       return ret;
 }
 
 /* Record get/set int,str, etc.. */
-API int contacts_record_get_str(contacts_record_h record, unsigned int property_id, char** out_str)
+API int contacts_record_get_str(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        ctsvc_record_s *s_record;
 
@@ -277,7 +274,7 @@ API int contacts_record_get_str(contacts_record_h record, unsigned int property_
        *out_str = NULL;
 
        RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_record = (ctsvc_record_s *)record;
+       s_record = (ctsvc_record_s*)record;
 
        __CHECK_PROJECTED_PROPERTY();
 
@@ -295,7 +292,7 @@ API int contacts_record_get_lli(contacts_record_h record, unsigned int property_
        *value = 0;
 
        RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_record = (ctsvc_record_s *)record;
+       s_record = (ctsvc_record_s*)record;
 
        __CHECK_PROJECTED_PROPERTY();
 
@@ -313,7 +310,7 @@ API int contacts_record_get_double(contacts_record_h record, unsigned int proper
        *value = 0;
 
        RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_record = (ctsvc_record_s *)record;
+       s_record = (ctsvc_record_s*)record;
 
        __CHECK_PROJECTED_PROPERTY();
 
@@ -323,7 +320,7 @@ API int contacts_record_get_double(contacts_record_h record, unsigned int proper
        __INVALID_PARAMETER_ERROR_HANDLING();
 }
 
-API int contacts_record_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str)
+API int contacts_record_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        ctsvc_record_s *s_record;
 
@@ -331,7 +328,7 @@ API int contacts_record_get_str_p(contacts_record_h record, unsigned int propert
        *out_str = NULL;
 
        RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_record = (ctsvc_record_s *)record;
+       s_record = (ctsvc_record_s*)record;
 
        __CHECK_PROJECTED_PROPERTY();
 
@@ -341,7 +338,7 @@ API int contacts_record_get_str_p(contacts_record_h record, unsigned int propert
        __INVALID_PARAMETER_ERROR_HANDLING();
 }
 
-API int contacts_record_get_int(contacts_record_h record, unsigned int property_id, intout_value)
+API int contacts_record_get_int(contacts_record_h record, unsigned int property_id, int *out_value)
 {
        ctsvc_record_s *s_record;
 
@@ -349,7 +346,7 @@ API int contacts_record_get_int(contacts_record_h record, unsigned int property_
        *out_value = 0;
 
        RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_record = (ctsvc_record_s *)record;
+       s_record = (ctsvc_record_s*)record;
 
        __CHECK_PROJECTED_PROPERTY();
 
@@ -359,7 +356,7 @@ API int contacts_record_get_int(contacts_record_h record, unsigned int property_
        __INVALID_PARAMETER_ERROR_HANDLING();
 }
 
-API int contacts_record_set_str(contacts_record_h record, unsigned int property_id, const charvalue)
+API int contacts_record_set_str(contacts_record_h record, unsigned int property_id, const char *value)
 {
        RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
 
@@ -368,13 +365,13 @@ API int contacts_record_set_str(contacts_record_h record, unsigned int property_
        return ctsvc_record_set_str(record, property_id, value);
 }
 
-int ctsvc_record_set_str(contacts_record_h record, unsigned int property_id, const charvalue)
+int ctsvc_record_set_str(contacts_record_h record, unsigned int property_id, const char *value)
 {
        char *str;
        ctsvc_record_s *s_record;
        int ret;
 
-       s_record = (ctsvc_record_s *)record;
+       s_record = (ctsvc_record_s*)record;
        __CHECK_PROJECTED_PROPERTY();
 
        if (value && *value)
@@ -394,7 +391,8 @@ int ctsvc_record_set_str(contacts_record_h record, unsigned int property_id, con
        __INVALID_PARAMETER_ERROR_HANDLING();
 }
 
-API int contacts_record_get_bool(contacts_record_h record, unsigned int property_id, bool* value)
+API int contacts_record_get_bool(contacts_record_h record,
+               unsigned int property_id, bool *value)
 {
        ctsvc_record_s *s_record;
 
@@ -402,7 +400,7 @@ API int contacts_record_get_bool(contacts_record_h record, unsigned int property
        *value = false;
 
        RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_record = (ctsvc_record_s *)record;
+       s_record = (ctsvc_record_s*)record;
 
        __CHECK_PROJECTED_PROPERTY();
 
@@ -412,7 +410,8 @@ API int contacts_record_get_bool(contacts_record_h record, unsigned int property
        __INVALID_PARAMETER_ERROR_HANDLING();
 }
 
-API int contacts_record_set_bool(contacts_record_h record, unsigned int property_id, bool value)
+API int contacts_record_set_bool(contacts_record_h record,
+               unsigned int property_id, bool value)
 {
        RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
 
@@ -425,7 +424,7 @@ int ctsvc_record_set_bool(contacts_record_h record, unsigned int property_id, bo
 {
        int ret;
        ctsvc_record_s *s_record;
-       s_record = (ctsvc_record_s *)record;
+       s_record = (ctsvc_record_s*)record;
        __CHECK_PROJECTED_PROPERTY();
 
        if (s_record->plugin_cbs && s_record->plugin_cbs->set_bool) {
@@ -439,7 +438,8 @@ int ctsvc_record_set_bool(contacts_record_h record, unsigned int property_id, bo
        __INVALID_PARAMETER_ERROR_HANDLING();
 }
 
-API int contacts_record_set_int(contacts_record_h record, unsigned int property_id, int value)
+API int contacts_record_set_int(contacts_record_h record, unsigned int property_id,
+               int value)
 {
        RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
 
@@ -447,7 +447,7 @@ API int contacts_record_set_int(contacts_record_h record, unsigned int property_
 
 #ifdef _CONTACTS_IPC_CLIENT
        if (CTSVC_RECORD_RESULT == ((ctsvc_record_s*)record)->r_type) {
-               CTS_ERR("Can not set int to result record");
+               ERR("Can not set int to result record");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 #endif
@@ -458,7 +458,7 @@ int ctsvc_record_set_int(contacts_record_h record, unsigned int property_id, int
 {
        int ret;
        ctsvc_record_s *s_record;
-       s_record = (ctsvc_record_s *)record;
+       s_record = (ctsvc_record_s*)record;
        __CHECK_PROJECTED_PROPERTY();
 
        if (s_record->plugin_cbs && s_record->plugin_cbs->set_int) {
@@ -471,7 +471,8 @@ int ctsvc_record_set_int(contacts_record_h record, unsigned int property_id, int
        __INVALID_PARAMETER_ERROR_HANDLING();
 }
 
-API int contacts_record_set_lli(contacts_record_h record, unsigned int property_id, long long int value)
+API int contacts_record_set_lli(contacts_record_h record, unsigned int property_id,
+               long long int value)
 {
        RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
 
@@ -480,11 +481,12 @@ API int contacts_record_set_lli(contacts_record_h record, unsigned int property_
        return ctsvc_record_set_lli(record, property_id, value);
 }
 
-int ctsvc_record_set_lli(contacts_record_h record, unsigned int property_id, long long int value)
+int ctsvc_record_set_lli(contacts_record_h record, unsigned int property_id,
+               long long int value)
 {
        int ret;
        ctsvc_record_s *s_record;
-       s_record = (ctsvc_record_s *)record;
+       s_record = (ctsvc_record_s*)record;
        __CHECK_PROJECTED_PROPERTY();
 
        if (s_record->plugin_cbs && s_record->plugin_cbs->set_lli) {
@@ -498,7 +500,8 @@ int ctsvc_record_set_lli(contacts_record_h record, unsigned int property_id, lon
        __INVALID_PARAMETER_ERROR_HANDLING();
 }
 
-API int contacts_record_set_double(contacts_record_h record, unsigned int property_id, double value)
+API int contacts_record_set_double(contacts_record_h record, unsigned int property_id,
+               double value)
 {
        RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
 
@@ -507,12 +510,13 @@ API int contacts_record_set_double(contacts_record_h record, unsigned int proper
        return ctsvc_record_set_double(record, property_id, value);
 }
 
-int ctsvc_record_set_double(contacts_record_h record, unsigned int property_id, double value)
+int ctsvc_record_set_double(contacts_record_h record, unsigned int property_id,
+               double value)
 {
        int ret;
        ctsvc_record_s *s_record;
 
-       s_record = (ctsvc_record_s *)record;
+       s_record = (ctsvc_record_s*)record;
        __CHECK_PROJECTED_PROPERTY();
 
        if (s_record->plugin_cbs && s_record->plugin_cbs->set_double) {
@@ -534,7 +538,7 @@ API int contacts_record_add_child_record(contacts_record_h record,
 
        RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == child_record, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_record = (ctsvc_record_s *)record;
+       s_record = (ctsvc_record_s*)record;
 
        if (s_record->plugin_cbs && s_record->plugin_cbs->add_child_record)
                return s_record->plugin_cbs->add_child_record(record, property_id, child_record);
@@ -549,7 +553,7 @@ API int contacts_record_remove_child_record(contacts_record_h record,
 
        RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == child_record, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_record = (ctsvc_record_s *)record;
+       s_record = (ctsvc_record_s*)record;
 
        if (s_record->plugin_cbs && s_record->plugin_cbs->remove_child_record)
                return s_record->plugin_cbs->remove_child_record(record, property_id, child_record);
@@ -566,7 +570,7 @@ API int contacts_record_get_child_record_count(contacts_record_h record,
        *count = 0;
 
        RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_record = (ctsvc_record_s *)record;
+       s_record = (ctsvc_record_s*)record;
 
        if (s_record->plugin_cbs && s_record->plugin_cbs->get_child_record_count)
                return s_record->plugin_cbs->get_child_record_count(record, property_id, count);
@@ -575,7 +579,7 @@ API int contacts_record_get_child_record_count(contacts_record_h record,
 }
 
 API int contacts_record_get_child_record_at_p(contacts_record_h record,
-               unsigned int property_id, int index, contacts_record_hout_record)
+               unsigned int property_id, int index, contacts_record_h *out_record)
 {
        ctsvc_record_s *s_record;
 
@@ -583,7 +587,7 @@ API int contacts_record_get_child_record_at_p(contacts_record_h record,
        *out_record = NULL;
 
        RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_record = (ctsvc_record_s *)record;
+       s_record = (ctsvc_record_s*)record;
 
        if (s_record->plugin_cbs && s_record->plugin_cbs->get_child_record_at_p)
                return s_record->plugin_cbs->get_child_record_at_p(record, property_id, index, out_record);
@@ -592,7 +596,7 @@ API int contacts_record_get_child_record_at_p(contacts_record_h record,
 }
 
 API int contacts_record_clone_child_record_list(contacts_record_h record,
-               unsigned int property_id, contacts_list_hout_list)
+               unsigned int property_id, contacts_list_h *out_list)
 {
        ctsvc_record_s *s_record;
 
@@ -600,7 +604,7 @@ API int contacts_record_clone_child_record_list(contacts_record_h record,
        *out_list = NULL;
 
        RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_record = (ctsvc_record_s *)record;
+       s_record = (ctsvc_record_s*)record;
 
        if (s_record->plugin_cbs && s_record->plugin_cbs->clone_child_record_list)
                return s_record->plugin_cbs->clone_child_record_list(record, property_id, out_list);
@@ -608,26 +612,32 @@ API int contacts_record_clone_child_record_list(contacts_record_h record,
        __INVALID_PARAMETER_ERROR_HANDLING();
 }
 
-int ctsvc_record_set_projection_flags(contacts_record_h record, const unsigned int *projection, const unsigned int projection_count, const unsigned int property_max_count)
+int ctsvc_record_set_projection_flags(contacts_record_h record,
+               const unsigned int *projection,
+               const unsigned int projection_count,
+               const unsigned int property_max_count)
 {
        int i;
 
        RETV_IF(record == NULL, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       ctsvc_record_s *_record = (ctsvc_record_s *)record;
+       ctsvc_record_s *_record = (ctsvc_record_s*)record;
 
-       CONTACTS_FREE(_record->properties_flags);
+       free(_record->properties_flags);
+       _record->properties_flags = NULL;
 
        _record->properties_flags = calloc(property_max_count, sizeof(char));
-
-       RETVM_IF(NULL == _record->properties_flags, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc fail");
+       if (NULL == _record->properties_flags) {
+               ERR("calloc fail");
+               return CONTACTS_ERROR_OUT_OF_MEMORY;
+       }
 
        _record->property_max_count = property_max_count;
 
-       if (CTSVC_RECORD_RESULT == _record->r_type)
+       if (CTSVC_RECORD_RESULT == _record->r_type) {
                _record->property_flag |= CTSVC_PROPERTY_FLAG_PROJECTION;
-       else {
-               for (i=0;i<projection_count;i++)
+       else {
+               for (i = 0; i < projection_count; i++)
                        ctsvc_record_set_property_flag(_record, projection[i], CTSVC_PROPERTY_FLAG_PROJECTION);
        }
 
index 3e499be..105c9c7 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
@@ -41,7 +37,7 @@ static inline int ctsvc_record_copy_base(ctsvc_record_s *dest, ctsvc_record_s *s
        if (src->properties_flags) {
                dest->properties_flags = calloc(dest->property_max_count, sizeof(char));
                if (NULL == dest->properties_flags) {
-                       CTS_ERR("calloc() Fail");
+                       ERR("calloc() Fail");
                        return CONTACTS_ERROR_OUT_OF_MEMORY;
                }
                if (dest->properties_flags) {
@@ -61,13 +57,13 @@ static inline int ctsvc_record_copy_base(ctsvc_record_s *dest, ctsvc_record_s *s
        }\
 } while (0)
 
-int ctsvc_record_set_property_flag(ctsvc_record_s_record, int property_id, contacts_property_flag_e flag);
+int ctsvc_record_set_property_flag(ctsvc_record_s *_record, int property_id, contacts_property_flag_e flag);
 int ctsvc_record_set_projection_flags(contacts_record_h record, const unsigned int *projection, const unsigned int projection_count, const unsigned int property_max_count);
-int ctsvc_record_set_str(contacts_record_h record, unsigned int property_id, const charvalue);
+int ctsvc_record_set_str(contacts_record_h record, unsigned int property_id, const char *value);
 int ctsvc_record_set_bool(contacts_record_h record, unsigned int property_id, bool value);
 int ctsvc_record_set_int(contacts_record_h record, unsigned int property_id, int value);
 int ctsvc_record_set_lli(contacts_record_h record, unsigned int property_id, long long int value);
 int ctsvc_record_set_double(contacts_record_h record, unsigned int property_id, double value);
-bool ctsvc_record_check_property_flag(const ctsvc_record_ss_record, unsigned int property_id, contacts_property_flag_e flag);
+bool ctsvc_record_check_property_flag(const ctsvc_record_s *s_record, unsigned int property_id, contacts_property_flag_e flag);
 
 #endif /* __CTSVC_RECORD_H__ */
index 59aba49..2768817 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
 
 static int __ctsvc_addressbook_create(contacts_record_h *out_record);
 static int __ctsvc_addressbook_destroy(contacts_record_h record, bool delete_child);
-static int __ctsvc_addressbook_clone(contacts_record_h record, contacts_record_hout_record);
+static int __ctsvc_addressbook_clone(contacts_record_h record, contacts_record_h *out_record);
 static int __ctsvc_addressbook_get_int(contacts_record_h record, unsigned int property_id, int *out);
-static int __ctsvc_addressbook_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_addressbook_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_addressbook_get_str(contacts_record_h record, unsigned int property_id, char **out_str);
+static int __ctsvc_addressbook_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str);
 static int __ctsvc_addressbook_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
-static int __ctsvc_addressbook_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty);
+static int __ctsvc_addressbook_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty);
 
 ctsvc_record_plugin_cb_s addressbook_plugin_cbs = {
        .create = __ctsvc_addressbook_create,
@@ -61,9 +57,8 @@ static int __ctsvc_addressbook_create(contacts_record_h *out_record)
 {
        ctsvc_addressbook_s *addressbook;
 
-       addressbook = (ctsvc_addressbook_s*)calloc(1, sizeof(ctsvc_addressbook_s));
-       RETVM_IF(NULL == addressbook, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memory : calloc is Fail");
+       addressbook = calloc(1, sizeof(ctsvc_addressbook_s));
+       RETVM_IF(NULL == addressbook, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        *out_record = (contacts_record_h)addressbook;
        return CONTACTS_ERROR_NONE;
@@ -81,18 +76,18 @@ static int __ctsvc_addressbook_destroy(contacts_record_h record, bool delete_chi
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_addressbook_clone(contacts_record_h record, contacts_record_hout_record)
+static int __ctsvc_addressbook_clone(contacts_record_h record, contacts_record_h *out_record)
 {
        ctsvc_addressbook_s *src = (ctsvc_addressbook_s*)record;
        ctsvc_addressbook_s *dest;
 
        dest = calloc(1, sizeof(ctsvc_addressbook_s));
        RETVM_IF(NULL == dest, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memory : calloc is Fail");
+                       "calloc() Fail");
 
        int ret = ctsvc_record_copy_base(&(dest->base), &(src->base));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_record_copy_base() Fail");
+               ERR("ctsvc_record_copy_base() Fail");
                free(dest);
                return ret;
        }
@@ -108,43 +103,43 @@ static int __ctsvc_addressbook_clone(contacts_record_h record, contacts_record_h
 }
 
 static int __ctsvc_addressbook_get_str_real(contacts_record_h record,
-               unsigned int property_id, char** out_str, bool copy)
+               unsigned int property_id, char **out_str, bool copy)
 {
        ctsvc_addressbook_s *addressbook = (ctsvc_addressbook_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_ADDRESSBOOK_NAME:
                *out_str = GET_STR(copy, addressbook->name);
                break;
-       default :
-               CTS_ERR("This field(%d) is not supported in value(addressbook)", property_id);
+       default:
+               ERR("This field(%d) is not supported in value(addressbook)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_addressbook_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_addressbook_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_addressbook_get_str_real(record, property_id, out_str, false);
 }
 
-static int __ctsvc_addressbook_get_str(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_addressbook_get_str(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_addressbook_get_str_real(record, property_id, out_str, true);
 }
 
 static int __ctsvc_addressbook_set_str(contacts_record_h record,
-               unsigned int property_id, const char* str, bool *is_dirty )
+               unsigned int property_id, const char *str, bool *is_dirty)
 {
        ctsvc_addressbook_s *addressbook = (ctsvc_addressbook_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_ADDRESSBOOK_NAME:
                CHECK_DIRTY_STR(addressbook->name, str, is_dirty);
                FREEandSTRDUP(addressbook->name, str);
                break;
-       default :
-               CTS_ERR("This field(%d) is not supported in value(addressbook)", property_id);
+       default:
+               ERR("This field(%d) is not supported in value(addressbook)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -155,7 +150,7 @@ static int __ctsvc_addressbook_get_int(contacts_record_h record,
 {
        ctsvc_addressbook_s *addressbook = (ctsvc_addressbook_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_ADDRESSBOOK_ID:
                *out = addressbook->id;
                break;
@@ -166,7 +161,7 @@ static int __ctsvc_addressbook_get_int(contacts_record_h record,
                *out = addressbook->mode;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(addressbook)", property_id);
+               ERR("property_id(%d) is not supported in value(addressbook)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -177,26 +172,26 @@ static int __ctsvc_addressbook_set_int(contacts_record_h record,
 {
        ctsvc_addressbook_s *addressbook = (ctsvc_addressbook_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_ADDRESSBOOK_ID:
                CHECK_DIRTY_VAL(addressbook->id, value, is_dirty);
                addressbook->id = value;
                break;
        case CTSVC_PROPERTY_ADDRESSBOOK_MODE:
                RETVM_IF(value != CONTACTS_ADDRESS_BOOK_MODE_NONE
-                                               && value != CONTACTS_ADDRESS_BOOK_MODE_READONLY,
-                               CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : address_book mode is %d", value);
+                               && value != CONTACTS_ADDRESS_BOOK_MODE_READONLY,
+                               CONTACTS_ERROR_INVALID_PARAMETER, "address_book mode is %d", value);
                CHECK_DIRTY_VAL(addressbook->mode, value, is_dirty);
                addressbook->mode = value;
                break;
        case CTSVC_PROPERTY_ADDRESSBOOK_ACCOUNT_ID:
                RETVM_IF(0 < addressbook->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is a read-only value (addressbook)", property_id);
+                               "property_id(%d) is a read-only value (addressbook)", property_id);
                CHECK_DIRTY_VAL(addressbook->account_id, value, is_dirty);
                addressbook->account_id = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(addressbook)", property_id);
+               ERR("property_id(%d) is not supported in value(addressbook)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
index 9fc0fe3..f85503f 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
@@ -35,58 +31,58 @@ static int __ctsvc_activity_create(contacts_record_h *out_record);
 static int __ctsvc_activity_destroy(contacts_record_h record, bool delete_child);
 static int __ctsvc_activity_clone(contacts_record_h record, contacts_record_h *out_record);
 static int __ctsvc_activity_get_int(contacts_record_h record, unsigned int property_id, int *out);
-static int __ctsvc_activity_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_activity_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_activity_get_str(contacts_record_h record, unsigned int property_id, char **out_str);
+static int __ctsvc_activity_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str);
 static int __ctsvc_activity_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
-static int __ctsvc_activity_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty);
+static int __ctsvc_activity_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty);
 static int __ctsvc_activity_add_child_record(contacts_record_h record, unsigned int property_id, contacts_record_h child_record);
 static int __ctsvc_activity_remove_child_record(contacts_record_h record, unsigned int property_id, contacts_record_h child_record);
 static int __ctsvc_activity_get_child_record_count(contacts_record_h record, unsigned int property_id, int *count);
-static int __ctsvc_activity_get_child_record_at_p(contacts_record_h record, unsigned int property_id, int index, contacts_record_hout_record);
-static int __ctsvc_activity_clone_child_record_list(contacts_record_h record, unsigned int property_id, contacts_list_hout_list);
+static int __ctsvc_activity_get_child_record_at_p(contacts_record_h record, unsigned int property_id, int index, contacts_record_h *out_record);
+static int __ctsvc_activity_clone_child_record_list(contacts_record_h record, unsigned int property_id, contacts_list_h *out_list);
 
 static int __ctsvc_activity_photo_create(contacts_record_h *out_record);
 static int __ctsvc_activity_photo_destroy(contacts_record_h record, bool delete_child);
 static int __ctsvc_activity_photo_clone(contacts_record_h record, contacts_record_h *out_record);
 static int __ctsvc_activity_photo_get_int(contacts_record_h record, unsigned int property_id, int *out);
-static int __ctsvc_activity_photo_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_activity_photo_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_activity_photo_get_str(contacts_record_h record, unsigned int property_id, char **out_str);
+static int __ctsvc_activity_photo_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str);
 static int __ctsvc_activity_photo_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
-static int __ctsvc_activity_photo_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty);
+static int __ctsvc_activity_photo_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty);
 
 
 static int __ctsvc_address_create(contacts_record_h *out_ecord);
 static int __ctsvc_address_destroy(contacts_record_h record, bool delete_child);
 static int __ctsvc_address_clone(contacts_record_h record, contacts_record_h *out_record);
 static int __ctsvc_address_get_int(contacts_record_h record, unsigned int property_id, int *out);
-static int __ctsvc_address_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_address_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_address_get_str(contacts_record_h record, unsigned int property_id, char **out_str);
+static int __ctsvc_address_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str);
 static int __ctsvc_address_get_bool(contacts_record_h record, unsigned int property_id, bool *value);
 static int __ctsvc_address_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
-static int __ctsvc_address_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty);
+static int __ctsvc_address_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty);
 static int __ctsvc_address_set_bool(contacts_record_h record, unsigned int property_id, bool value, bool *is_dirty);
 
 static int __ctsvc_company_create(contacts_record_h *out_record);
 static int __ctsvc_company_destroy(contacts_record_h record, bool delete_child);
 static int __ctsvc_company_clone(contacts_record_h record, contacts_record_h *out_record);
 static int __ctsvc_company_get_int(contacts_record_h record, unsigned int property_id, int *out);
-static int __ctsvc_company_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_company_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_company_get_str(contacts_record_h record, unsigned int property_id, char **out_str);
+static int __ctsvc_company_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str);
 static int __ctsvc_company_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
-static int __ctsvc_company_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty);
+static int __ctsvc_company_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty);
 
 static int __ctsvc_contact_create(contacts_record_h *out_record);
 static int __ctsvc_contact_destroy(contacts_record_h record, bool delete_child);
 static int __ctsvc_contact_clone(contacts_record_h record, contacts_record_h *out_record);
 static int __ctsvc_contact_get_int(contacts_record_h record, unsigned int property_id, int *out);
-static int __ctsvc_contact_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_contact_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_contact_get_str(contacts_record_h record, unsigned int property_id, char **out_str);
+static int __ctsvc_contact_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str);
 static int __ctsvc_contact_get_bool(contacts_record_h record, unsigned int property_id, bool *value);
 static int __ctsvc_contact_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
-static int __ctsvc_contact_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty);
+static int __ctsvc_contact_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty);
 static int __ctsvc_contact_set_bool(contacts_record_h record, unsigned int property_id, bool value, bool *is_dirty);
-static int __ctsvc_contact_clone_child_record_list(contacts_record_h record, unsigned int property_id, contacts_list_hout_list);
-static int __ctsvc_contact_get_child_record_at_p(contacts_record_h record, unsigned int property_id, int index, contacts_record_hout_record);
+static int __ctsvc_contact_clone_child_record_list(contacts_record_h record, unsigned int property_id, contacts_list_h *out_list);
+static int __ctsvc_contact_get_child_record_at_p(contacts_record_h record, unsigned int property_id, int index, contacts_record_h *out_record);
 static int __ctsvc_contact_get_child_record_count(contacts_record_h record, unsigned int property_id, int *count);
 static int __ctsvc_contact_add_child_record(contacts_record_h record, unsigned int property_id, contacts_record_h child_record);
 static int __ctsvc_contact_remove_child_record(contacts_record_h record, unsigned int property_id, contacts_record_h child_record);
@@ -95,116 +91,116 @@ static int __ctsvc_email_create(contacts_record_h *out_record);
 static int __ctsvc_email_destroy(contacts_record_h record, bool delete_child);
 static int __ctsvc_email_clone(contacts_record_h record, contacts_record_h *out_record);
 static int __ctsvc_email_get_int(contacts_record_h record, unsigned int property_id, int *out);
-static int __ctsvc_email_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_email_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_email_get_str(contacts_record_h record, unsigned int property_id, char **out_str);
+static int __ctsvc_email_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str);
 static int __ctsvc_email_get_bool(contacts_record_h record, unsigned int property_id, bool *value);
 static int __ctsvc_email_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
-static int __ctsvc_email_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty);
+static int __ctsvc_email_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty);
 static int __ctsvc_email_set_bool(contacts_record_h record, unsigned int property_id, bool value, bool *is_dirty);
 
 static int __ctsvc_event_create(contacts_record_h *out_record);
 static int __ctsvc_event_destroy(contacts_record_h record, bool delete_child);
 static int __ctsvc_event_clone(contacts_record_h record, contacts_record_h *out_record);
 static int __ctsvc_event_get_int(contacts_record_h record, unsigned int property_id, int *out);
-static int __ctsvc_event_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_event_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_event_get_str(contacts_record_h record, unsigned int property_id, char **out_str);
+static int __ctsvc_event_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str);
 static int __ctsvc_event_get_bool(contacts_record_h record, unsigned int property_id, bool *value);
 static int __ctsvc_event_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
-static int __ctsvc_event_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty);
+static int __ctsvc_event_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty);
 static int __ctsvc_event_set_bool(contacts_record_h record, unsigned int property_id, bool value, bool *is_dirty);
 
 static int __ctsvc_extension_create(contacts_record_h *out_record);
 static int __ctsvc_extension_destroy(contacts_record_h record, bool delete_child);
 static int __ctsvc_extension_clone(contacts_record_h record, contacts_record_h *out_record);
 static int __ctsvc_extension_get_int(contacts_record_h record, unsigned int property_id, int *out);
-static int __ctsvc_extension_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_extension_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_extension_get_str(contacts_record_h record, unsigned int property_id, char **out_str);
+static int __ctsvc_extension_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str);
 static int __ctsvc_extension_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
-static int __ctsvc_extension_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty);
+static int __ctsvc_extension_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty);
 
 static int __ctsvc_group_relation_create(contacts_record_h *out_record);
 static int __ctsvc_group_relation_destroy(contacts_record_h record, bool delete_child);
 static int __ctsvc_group_relation_clone(contacts_record_h record, contacts_record_h *out_record);
 static int __ctsvc_group_relation_get_int(contacts_record_h record, unsigned int property_id, int *out);
-static int __ctsvc_group_relation_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_group_relation_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_group_relation_get_str(contacts_record_h record, unsigned int property_id, char **out_str);
+static int __ctsvc_group_relation_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str);
 static int __ctsvc_group_relation_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
-static int __ctsvc_group_relation_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty);
+static int __ctsvc_group_relation_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty);
 
 static int __ctsvc_messenger_create(contacts_record_h *out_record);
 static int __ctsvc_messenger_destroy(contacts_record_h record, bool delete_child);
 static int __ctsvc_messenger_clone(contacts_record_h record, contacts_record_h *out_record);
 static int __ctsvc_messenger_get_int(contacts_record_h record, unsigned int property_id, int *out);
-static int __ctsvc_messenger_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_messenger_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_messenger_get_str(contacts_record_h record, unsigned int property_id, char **out_str);
+static int __ctsvc_messenger_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str);
 static int __ctsvc_messenger_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
-static int __ctsvc_messenger_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty);
+static int __ctsvc_messenger_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty);
 
 static int __ctsvc_name_create(contacts_record_h *out_record);
 static int __ctsvc_name_destroy(contacts_record_h record, bool delete_child);
 static int __ctsvc_name_clone(contacts_record_h record, contacts_record_h *out_record);
 static int __ctsvc_name_get_int(contacts_record_h record, unsigned int property_id, int *out);
-static int __ctsvc_name_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_name_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_name_get_str(contacts_record_h record, unsigned int property_id, char **out_str);
+static int __ctsvc_name_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str);
 static int __ctsvc_name_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
-static int __ctsvc_name_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty);
+static int __ctsvc_name_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty);
 
 static int __ctsvc_nickname_create(contacts_record_h *out_record);
 static int __ctsvc_nickname_destroy(contacts_record_h record, bool delete_child);
 static int __ctsvc_nickname_clone(contacts_record_h record, contacts_record_h *out_record);
 static int __ctsvc_nickname_get_int(contacts_record_h record, unsigned int property_id, int *out);
-static int __ctsvc_nickname_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_nickname_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_nickname_get_str(contacts_record_h record, unsigned int property_id, char **out_str);
+static int __ctsvc_nickname_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str);
 static int __ctsvc_nickname_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
-static int __ctsvc_nickname_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty);
+static int __ctsvc_nickname_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty);
 
 static int __ctsvc_note_create(contacts_record_h *out_record);
 static int __ctsvc_note_destroy(contacts_record_h record, bool delete_child);
 static int __ctsvc_note_clone(contacts_record_h record, contacts_record_h *out_record);
 static int __ctsvc_note_get_int(contacts_record_h record, unsigned int property_id, int *out);
-static int __ctsvc_note_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_note_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_note_get_str(contacts_record_h record, unsigned int property_id, char **out_str);
+static int __ctsvc_note_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str);
 static int __ctsvc_note_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
-static int __ctsvc_note_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty);
+static int __ctsvc_note_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty);
 
 static int __ctsvc_number_create(contacts_record_h *out_record);
 static int __ctsvc_number_destroy(contacts_record_h record, bool delete_child);
 static int __ctsvc_number_clone(contacts_record_h record, contacts_record_h *out_record);
 static int __ctsvc_number_get_int(contacts_record_h record, unsigned int property_id, int *out);
-static int __ctsvc_number_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_number_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_number_get_str(contacts_record_h record, unsigned int property_id, char **out_str);
+static int __ctsvc_number_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str);
 static int __ctsvc_number_get_bool(contacts_record_h record, unsigned int property_id, bool *value);
 static int __ctsvc_number_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
-static int __ctsvc_number_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty);
+static int __ctsvc_number_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty);
 static int __ctsvc_number_set_bool(contacts_record_h record, unsigned int property_id, bool value, bool *is_dirty);
 
 static int __ctsvc_profile_create(contacts_record_h *out_record);
 static int __ctsvc_profile_destroy(contacts_record_h record, bool delete_child);
 static int __ctsvc_profile_clone(contacts_record_h record, contacts_record_h *out_reord);
 static int __ctsvc_profile_get_int(contacts_record_h record, unsigned int property_id, int *out);
-static int __ctsvc_profile_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_profile_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_profile_get_str(contacts_record_h record, unsigned int property_id, char **out_str);
+static int __ctsvc_profile_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str);
 static int __ctsvc_profile_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
-static int __ctsvc_profile_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty);
+static int __ctsvc_profile_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty);
 
 static int __ctsvc_relationship_create(contacts_record_h *out_record);
 static int __ctsvc_relationship_destroy(contacts_record_h record, bool delete_child);
 static int __ctsvc_relationship_clone(contacts_record_h record, contacts_record_h *out_record);
 static int __ctsvc_relationship_get_int(contacts_record_h record, unsigned int property_id, int *out);
-static int __ctsvc_relationship_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_relationship_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_relationship_get_str(contacts_record_h record, unsigned int property_id, char **out_str);
+static int __ctsvc_relationship_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str);
 static int __ctsvc_relationship_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
-static int __ctsvc_relationship_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty);
+static int __ctsvc_relationship_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty);
 
 static int __ctsvc_image_create(contacts_record_h *out_record);
 static int __ctsvc_image_destroy(contacts_record_h record, bool delete_child);
 static int __ctsvc_image_clone(contacts_record_h record, contacts_record_h *out_record);
 static int __ctsvc_image_get_int(contacts_record_h record, unsigned int property_id, int *out);
-static int __ctsvc_image_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_image_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_image_get_str(contacts_record_h record, unsigned int property_id, char **out_str);
+static int __ctsvc_image_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str);
 static int __ctsvc_image_get_bool(contacts_record_h record, unsigned int property_id, bool *value);
 static int __ctsvc_image_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
-static int __ctsvc_image_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty);
+static int __ctsvc_image_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty);
 static int __ctsvc_image_set_bool(contacts_record_h record, unsigned int property_id, bool value, bool *is_dirty);
 
 static int __ctsvc_simple_contact_create(contacts_record_h *out_record);
@@ -212,19 +208,19 @@ static int __ctsvc_simple_contact_destroy(contacts_record_h record, bool delete_
 static int __ctsvc_simple_contact_clone(contacts_record_h record, contacts_record_h *out_record);
 static int __ctsvc_simple_contact_get_bool(contacts_record_h record, unsigned int property_id, bool *out);
 static int __ctsvc_simple_contact_get_int(contacts_record_h record, unsigned int property_id, int *out);
-static int __ctsvc_simple_contact_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_simple_contact_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_simple_contact_get_str(contacts_record_h record, unsigned int property_id, char **out_str);
+static int __ctsvc_simple_contact_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str);
 static int __ctsvc_simple_contact_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
-static int __ctsvc_simple_contact_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty);
+static int __ctsvc_simple_contact_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty);
 
 static int __ctsvc_url_create(contacts_record_h *out_record);
 static int __ctsvc_url_destroy(contacts_record_h record, bool delete_child);
 static int __ctsvc_url_clone(contacts_record_h record, contacts_record_h *out_record);
 static int __ctsvc_url_get_int(contacts_record_h record, unsigned int property_id, int *out);
-static int __ctsvc_url_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_url_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_url_get_str(contacts_record_h record, unsigned int property_id, char **out_str);
+static int __ctsvc_url_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str);
 static int __ctsvc_url_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
-static int __ctsvc_url_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty);
+static int __ctsvc_url_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty);
 
 static GHashTable *__ctsvc_temp_image_file_hash_table = NULL;
 
@@ -651,11 +647,11 @@ static int __ctsvc_activity_create(contacts_record_h *out_record)
        ctsvc_activity_s *activity;
        activity = calloc(1, sizeof(ctsvc_activity_s));
        RETVM_IF(NULL == activity, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memory : calloc is Fail");
+                       "calloc() Fail");
 
        activity->photos = calloc(1, sizeof(ctsvc_list_s));
        if (NULL == activity->photos) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                free(activity);
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
@@ -670,7 +666,7 @@ static int __ctsvc_activity_photo_create(contacts_record_h *out_record)
        ctsvc_activity_photo_s *photo;
        photo = calloc(1, sizeof(ctsvc_activity_photo_s));
        RETVM_IF(NULL == photo, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memory : calloc is Fail");
+                       "calloc() Fail");
 
        *out_record = (contacts_record_h)photo;
        return CONTACTS_ERROR_NONE;
@@ -681,7 +677,7 @@ static int __ctsvc_address_create(contacts_record_h *out_record)
        ctsvc_address_s *address;
        address = calloc(1, sizeof(ctsvc_address_s));
        RETVM_IF(NULL == address, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memory : calloc is Fail");
+                       "calloc() Fail");
 
        *out_record = (contacts_record_h)address;
        return CONTACTS_ERROR_NONE;
@@ -692,7 +688,7 @@ static int __ctsvc_company_create(contacts_record_h *out_record)
        ctsvc_company_s *company;
        company = calloc(1, sizeof(ctsvc_company_s));
        RETVM_IF(NULL == company, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memory : calloc is Fail");
+                       "calloc() Fail");
 
        *out_record = (contacts_record_h)company;
        return CONTACTS_ERROR_NONE;
@@ -703,7 +699,7 @@ static int __ctsvc_email_create(contacts_record_h *out_record)
        ctsvc_email_s *email;
        email = calloc(1, sizeof(ctsvc_email_s));
        RETVM_IF(NULL == email, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memory : calloc is Fail");
+                       "calloc() Fail");
 
        *out_record = (contacts_record_h)email;
        return CONTACTS_ERROR_NONE;
@@ -714,7 +710,7 @@ static int __ctsvc_event_create(contacts_record_h *out_record)
        ctsvc_event_s *event;
        event = calloc(1, sizeof(ctsvc_event_s));
        RETVM_IF(NULL == event, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memory : calloc is Fail");
+                       "calloc() Fail");
 
        *out_record = (contacts_record_h)event;
        return CONTACTS_ERROR_NONE;
@@ -725,7 +721,7 @@ static int __ctsvc_extension_create(contacts_record_h *out_record)
        ctsvc_extension_s *extension;
        extension = calloc(1, sizeof(ctsvc_extension_s));
        RETVM_IF(NULL == extension, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memory : calloc is Fail");
+                       "calloc() Fail");
 
        *out_record = (contacts_record_h)extension;
        return CONTACTS_ERROR_NONE;
@@ -736,7 +732,7 @@ static int __ctsvc_group_relation_create(contacts_record_h *out_record)
        ctsvc_group_relation_s *group_relation;
        group_relation = calloc(1, sizeof(ctsvc_group_relation_s));
        RETVM_IF(NULL == group_relation, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memory : calloc is Fail");
+                       "calloc() Fail");
 
        *out_record = (contacts_record_h)group_relation;
        return CONTACTS_ERROR_NONE;
@@ -747,7 +743,7 @@ static int __ctsvc_messenger_create(contacts_record_h *out_record)
        ctsvc_messenger_s *messenger;
        messenger = calloc(1, sizeof(ctsvc_messenger_s));
        RETVM_IF(NULL == messenger, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memory : calloc is Fail");
+                       "calloc() Fail");
 
        *out_record = (contacts_record_h)messenger;
        return CONTACTS_ERROR_NONE;
@@ -758,7 +754,7 @@ static int __ctsvc_name_create(contacts_record_h *out_record)
        ctsvc_name_s *name;
        name = calloc(1, sizeof(ctsvc_name_s));
        RETVM_IF(NULL == name, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memory : calloc is Fail");
+                       "calloc() Fail");
 
        *out_record = (contacts_record_h)name;
        return CONTACTS_ERROR_NONE;
@@ -769,7 +765,7 @@ static int __ctsvc_nickname_create(contacts_record_h *out_record)
        ctsvc_nickname_s *nickname;
        nickname = calloc(1, sizeof(ctsvc_nickname_s));
        RETVM_IF(NULL == nickname, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memory : calloc is Fail");
+                       "calloc() Fail");
 
        *out_record = (contacts_record_h)nickname;
        return CONTACTS_ERROR_NONE;
@@ -780,7 +776,7 @@ static int __ctsvc_note_create(contacts_record_h *out_record)
        ctsvc_note_s *note;
        note = calloc(1, sizeof(ctsvc_note_s));
        RETVM_IF(NULL == note, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memory : calloc is Fail");
+                       "calloc() Fail");
 
        *out_record = (contacts_record_h)note;
        return CONTACTS_ERROR_NONE;
@@ -791,7 +787,7 @@ static int __ctsvc_number_create(contacts_record_h *out_record)
        ctsvc_number_s *number;
        number = calloc(1, sizeof(ctsvc_number_s));
        RETVM_IF(NULL == number, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memory : calloc is Fail");
+                       "calloc() Fail");
 
        *out_record = (contacts_record_h)number;
        return CONTACTS_ERROR_NONE;
@@ -802,7 +798,7 @@ static int __ctsvc_profile_create(contacts_record_h *out_record)
        ctsvc_profile_s *profile;
        profile = calloc(1, sizeof(ctsvc_profile_s));
        RETVM_IF(NULL == profile, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memory : calloc is Fail");
+                       "calloc() Fail");
 
        *out_record = (contacts_record_h)profile;
        return CONTACTS_ERROR_NONE;
@@ -813,7 +809,7 @@ static int __ctsvc_relationship_create(contacts_record_h *out_record)
        ctsvc_relationship_s *relationship;
        relationship = calloc(1, sizeof(ctsvc_relationship_s));
        RETVM_IF(NULL == relationship, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memory : calloc is Fail");
+                       "calloc() Fail");
 
        *out_record = (contacts_record_h)relationship;
        return CONTACTS_ERROR_NONE;
@@ -824,7 +820,7 @@ static int __ctsvc_image_create(contacts_record_h *out_record)
        ctsvc_image_s *image;
        image = calloc(1, sizeof(ctsvc_image_s));
        RETVM_IF(NULL == image, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memory : calloc is Fail");
+                       "calloc() Fail");
 
        *out_record = (contacts_record_h)image;
        return CONTACTS_ERROR_NONE;
@@ -835,7 +831,7 @@ static int __ctsvc_simple_contact_create(contacts_record_h *out_record)
        ctsvc_simple_contact_s *simple_contact;
        simple_contact = calloc(1, sizeof(ctsvc_simple_contact_s));
        RETVM_IF(NULL == simple_contact, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memory : calloc is Fail");
+                       "calloc() Fail");
 
        *out_record = (contacts_record_h)simple_contact;
        return CONTACTS_ERROR_NONE;
@@ -846,7 +842,7 @@ static int __ctsvc_url_create(contacts_record_h *out_record)
        ctsvc_url_s *url;
        url = calloc(1, sizeof(ctsvc_url_s));
        RETVM_IF(NULL == url, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memory : calloc is Fail");
+                       "calloc() Fail");
 
        *out_record = (contacts_record_h)url;
        return CONTACTS_ERROR_NONE;
@@ -888,26 +884,22 @@ static void __ctsvc_temp_image_hash_table_remove(char *filename)
        int count = 0;
 
        if (NULL == __ctsvc_temp_image_file_hash_table) {
-               if (unlink(filename) < 0) {
-                       CTS_WARN("unlink Fail(%d)", errno);
-               }
+               if (unlink(filename) < 0)
+                       WARN("unlink Fail(%d)", errno);
                return;
        }
 
        count = GPOINTER_TO_INT(g_hash_table_lookup(__ctsvc_temp_image_file_hash_table, filename));
        if (count < 1) {
-               if (unlink(filename) < 0) {
-                       CTS_WARN("unlink Fail(%d)", errno);
-               }
-       }
-       else if (1 == count) {
+               if (unlink(filename) < 0)
+                       WARN("unlink Fail(%d)", errno);
+       } else if (1 == count) {
                g_hash_table_remove(__ctsvc_temp_image_file_hash_table, filename);
                if (0 == g_hash_table_size(__ctsvc_temp_image_file_hash_table)) {
                        g_hash_table_destroy(__ctsvc_temp_image_file_hash_table);
                        __ctsvc_temp_image_file_hash_table = NULL;
                }
-       }
-       else {
+       } else {
                g_hash_table_insert(__ctsvc_temp_image_file_hash_table, filename, GINT_TO_POINTER(count-1));
        }
 }
@@ -1154,10 +1146,12 @@ static int __ctsvc_extension_destroy(contacts_record_h record, bool delete_child
 
 static int __ctsvc_simple_contact_destroy(contacts_record_h record, bool delete_child)
 {
-       ctsvc_simple_contact_s *contact= (ctsvc_simple_contact_s*)record;
-       contact->base.plugin_cbs = NULL; /* help to find double destroy bug (refer to the contacts_record_destroy) */
-       free(contact->base.properties_flags);
+       ctsvc_simple_contact_s *contact = (ctsvc_simple_contact_s*)record;
 
+       /* help to find double destroy bug (refer to the contacts_record_destroy) */
+       contact->base.plugin_cbs = NULL;
+
+       free(contact->base.properties_flags);
        free(contact->display_name);
        free(contact->image_thumbnail_path);
        free(contact->ringtone_path);
@@ -1175,7 +1169,7 @@ static int __ctsvc_contact_create(contacts_record_h *out_record)
 
        contact = calloc(1, sizeof(ctsvc_contact_s));
        RETVM_IF(NULL == contact, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memory : calloc is Fail");
+                       "calloc() Fail");
 
        do {
                contact->name = calloc(1, sizeof(ctsvc_list_s));
@@ -1257,7 +1251,7 @@ static int __ctsvc_contact_create(contacts_record_h *out_record)
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("calloc() Fail");
+       ERR("calloc() Fail");
        free(contact->extensions);
        free(contact->images);
        free(contact->relationships);
@@ -1332,9 +1326,9 @@ static int __ctsvc_contact_destroy(contacts_record_h record, bool delete_child)
 
 static int __ctsvc_contact_get_int(contacts_record_h record, unsigned int property_id, int *out)
 {
-       ctsvc_contact_s *contact = (ctsvc_contact_s *)record;
+       ctsvc_contact_s *contact = (ctsvc_contact_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_CONTACT_ID:
                *out = contact->id;
                break;
@@ -1354,7 +1348,7 @@ static int __ctsvc_contact_get_int(contacts_record_h record, unsigned int proper
                *out = contact->link_mode;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(contact)", property_id);
+               ERR("property_id(%d) is not supported in value(contact)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -1362,9 +1356,9 @@ static int __ctsvc_contact_get_int(contacts_record_h record, unsigned int proper
 
 static int __ctsvc_simple_contact_get_int(contacts_record_h record, unsigned int property_id, int *out)
 {
-       ctsvc_simple_contact_s *contact = (ctsvc_simple_contact_s *)record;
+       ctsvc_simple_contact_s *contact = (ctsvc_simple_contact_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_CONTACT_ID:
                *out = contact->contact_id;
                break;
@@ -1381,7 +1375,7 @@ static int __ctsvc_simple_contact_get_int(contacts_record_h record, unsigned int
                *out = contact->changed_time;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(simple contact)", property_id);
+               ERR("property_id(%d) is not supported in value(simple contact)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -1389,9 +1383,9 @@ static int __ctsvc_simple_contact_get_int(contacts_record_h record, unsigned int
 
 static int __ctsvc_name_get_int(contacts_record_h record, unsigned int property_id, int *out)
 {
-       ctsvc_name_s *name = (ctsvc_name_s *)record;
+       ctsvc_name_s *name = (ctsvc_name_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_NAME_ID:
                *out = name->id;
                break;
@@ -1399,7 +1393,7 @@ static int __ctsvc_name_get_int(contacts_record_h record, unsigned int property_
                *out = name->contact_id;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(name)", property_id);
+               ERR("property_id(%d) is not supported in value(name)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -1407,9 +1401,9 @@ static int __ctsvc_name_get_int(contacts_record_h record, unsigned int property_
 
 static int __ctsvc_company_get_int(contacts_record_h record, unsigned int property_id, int *out)
 {
-       ctsvc_company_s *company = (ctsvc_company_s *)record;
+       ctsvc_company_s *company = (ctsvc_company_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_COMPANY_ID:
                *out = company->id;
                break;
@@ -1420,7 +1414,7 @@ static int __ctsvc_company_get_int(contacts_record_h record, unsigned int proper
                *out = company->type;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(company)", property_id);
+               ERR("property_id(%d) is not supported in value(company)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -1428,9 +1422,9 @@ static int __ctsvc_company_get_int(contacts_record_h record, unsigned int proper
 
 static int __ctsvc_note_get_int(contacts_record_h record, unsigned int property_id, int *out)
 {
-       ctsvc_note_s *note = (ctsvc_note_s *)record;
+       ctsvc_note_s *note = (ctsvc_note_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_NOTE_ID:
                *out = note->id;
                break;
@@ -1438,7 +1432,7 @@ static int __ctsvc_note_get_int(contacts_record_h record, unsigned int property_
                *out = note->contact_id;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(note)", property_id);
+               ERR("property_id(%d) is not supported in value(note)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -1448,7 +1442,7 @@ static int __ctsvc_number_get_int(contacts_record_h record, unsigned int propert
 {
        ctsvc_number_s *number = (ctsvc_number_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_NUMBER_ID:
                *out = number->id;
                break;
@@ -1459,7 +1453,7 @@ static int __ctsvc_number_get_int(contacts_record_h record, unsigned int propert
                *out = number->type;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(number)", property_id);
+               ERR("property_id(%d) is not supported in value(number)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -1467,9 +1461,9 @@ static int __ctsvc_number_get_int(contacts_record_h record, unsigned int propert
 
 static int __ctsvc_email_get_int(contacts_record_h record, unsigned int property_id, int *out)
 {
-       ctsvc_email_s *email = (ctsvc_email_s *)record;
+       ctsvc_email_s *email = (ctsvc_email_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_EMAIL_ID:
                *out = email->id;
                break;
@@ -1480,7 +1474,7 @@ static int __ctsvc_email_get_int(contacts_record_h record, unsigned int property
                *out = email->type;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(email)", property_id);
+               ERR("property_id(%d) is not supported in value(email)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -1488,9 +1482,9 @@ static int __ctsvc_email_get_int(contacts_record_h record, unsigned int property
 
 static int __ctsvc_url_get_int(contacts_record_h record, unsigned int property_id, int *out)
 {
-       ctsvc_url_s *url = (ctsvc_url_s *)record;
+       ctsvc_url_s *url = (ctsvc_url_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_URL_ID:
                *out = url->id;
                break;
@@ -1501,7 +1495,7 @@ static int __ctsvc_url_get_int(contacts_record_h record, unsigned int property_i
                *out = url->type;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(url)", property_id);
+               ERR("property_id(%d) is not supported in value(url)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -1509,9 +1503,9 @@ static int __ctsvc_url_get_int(contacts_record_h record, unsigned int property_i
 
 static int __ctsvc_event_get_int(contacts_record_h record, unsigned int property_id, int *out)
 {
-       ctsvc_event_s *event = (ctsvc_event_s *)record;
+       ctsvc_event_s *event = (ctsvc_event_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_EVENT_ID:
                *out = event->id;
                break;
@@ -1528,7 +1522,7 @@ static int __ctsvc_event_get_int(contacts_record_h record, unsigned int property
                *out = event->calendar_type;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(event)", property_id);
+               ERR("property_id(%d) is not supported in value(event)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -1536,9 +1530,9 @@ static int __ctsvc_event_get_int(contacts_record_h record, unsigned int property
 
 static int __ctsvc_nickname_get_int(contacts_record_h record, unsigned int property_id, int *out)
 {
-       ctsvc_nickname_s *nickname = (ctsvc_nickname_s *)record;
+       ctsvc_nickname_s *nickname = (ctsvc_nickname_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_NICKNAME_ID:
                *out = nickname->id;
                break;
@@ -1546,7 +1540,7 @@ static int __ctsvc_nickname_get_int(contacts_record_h record, unsigned int prope
                *out = nickname->contact_id;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(nickname)", property_id);
+               ERR("property_id(%d) is not supported in value(nickname)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -1554,9 +1548,9 @@ static int __ctsvc_nickname_get_int(contacts_record_h record, unsigned int prope
 
 static int __ctsvc_address_get_int(contacts_record_h record, unsigned int property_id, int *out)
 {
-       ctsvc_address_s *address = (ctsvc_address_s *)record;
+       ctsvc_address_s *address = (ctsvc_address_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_ADDRESS_ID:
                *out = address->id;
                break;
@@ -1567,7 +1561,7 @@ static int __ctsvc_address_get_int(contacts_record_h record, unsigned int proper
                *out = address->type;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(address)", property_id);
+               ERR("property_id(%d) is not supported in value(address)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -1575,9 +1569,9 @@ static int __ctsvc_address_get_int(contacts_record_h record, unsigned int proper
 
 static int __ctsvc_messenger_get_int(contacts_record_h record, unsigned int property_id, int *out)
 {
-       ctsvc_messenger_s *messenger = (ctsvc_messenger_s *)record;
+       ctsvc_messenger_s *messenger = (ctsvc_messenger_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_MESSENGER_ID:
                *out = messenger->id;
                break;
@@ -1588,7 +1582,7 @@ static int __ctsvc_messenger_get_int(contacts_record_h record, unsigned int prop
                *out = messenger->type;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(messenger)", property_id);
+               ERR("property_id(%d) is not supported in value(messenger)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -1596,9 +1590,9 @@ static int __ctsvc_messenger_get_int(contacts_record_h record, unsigned int prop
 
 static int __ctsvc_group_relation_get_int(contacts_record_h record, unsigned int property_id, int *out)
 {
-       ctsvc_group_relation_s *group = (ctsvc_group_relation_s *)record;
+       ctsvc_group_relation_s *group = (ctsvc_group_relation_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_GROUP_RELATION_ID:
                *out = group->id;
                break;
@@ -1609,7 +1603,7 @@ static int __ctsvc_group_relation_get_int(contacts_record_h record, unsigned int
                *out = group->group_id;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(group)", property_id);
+               ERR("property_id(%d) is not supported in value(group)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -1617,9 +1611,9 @@ static int __ctsvc_group_relation_get_int(contacts_record_h record, unsigned int
 
 static int __ctsvc_activity_get_int(contacts_record_h record, unsigned int property_id, int *out)
 {
-       ctsvc_activity_s *activity = (ctsvc_activity_s *)record;
+       ctsvc_activity_s *activity = (ctsvc_activity_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_ACTIVITY_ID:
                *out = activity->id;
                break;
@@ -1630,7 +1624,7 @@ static int __ctsvc_activity_get_int(contacts_record_h record, unsigned int prope
                *out = activity->timestamp;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(activity)", property_id);
+               ERR("property_id(%d) is not supported in value(activity)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -1639,11 +1633,17 @@ static int __ctsvc_activity_get_int(contacts_record_h record, unsigned int prope
 static int __ctsvc_activity_add_child_record(contacts_record_h record,
                unsigned int property_id, contacts_record_h child_record)
 {
-       ctsvc_activity_s *s_activity = (ctsvc_activity_s *)record;
-       ctsvc_activity_photo_s *s_activity_photo = (ctsvc_activity_photo_s *)child_record;
-
-       RETVM_IF(property_id != CTSVC_PROPERTY_ACTIVITY_ACTIVITY_PHOTO, CONTACTS_ERROR_INVALID_PARAMETER, "property_id(%d) is not supported", property_id);
-       RETVM_IF(s_activity_photo->base.r_type != CTSVC_RECORD_ACTIVITY_PHOTO, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter: r_type(%d) is wrong", s_activity_photo->base.r_type);
+       ctsvc_activity_s *s_activity = (ctsvc_activity_s*)record;
+       ctsvc_activity_photo_s *s_activity_photo = (ctsvc_activity_photo_s*)child_record;
+
+       RETVM_IF(property_id != CTSVC_PROPERTY_ACTIVITY_ACTIVITY_PHOTO,
+                       CONTACTS_ERROR_INVALID_PARAMETER,
+                       "property_id(%d) is not supported",
+                       property_id);
+       RETVM_IF(s_activity_photo->base.r_type != CTSVC_RECORD_ACTIVITY_PHOTO,
+                       CONTACTS_ERROR_INVALID_PARAMETER,
+                       "r_type(%d) is wrong",
+                       s_activity_photo->base.r_type);
        s_activity_photo->id = 0;
 
        return ctsvc_list_add_child((contacts_list_h)s_activity->photos, child_record);
@@ -1652,12 +1652,16 @@ static int __ctsvc_activity_add_child_record(contacts_record_h record,
 static int __ctsvc_activity_remove_child_record(contacts_record_h record,
                unsigned int property_id, contacts_record_h child_record)
 {
-       ctsvc_activity_s *s_activity = (ctsvc_activity_s *)record;
-       ctsvc_activity_photo_s *s_activity_photo = (ctsvc_activity_photo_s *)child_record;
+       ctsvc_activity_s *s_activity = (ctsvc_activity_s*)record;
+       ctsvc_activity_photo_s *s_activity_photo = (ctsvc_activity_photo_s*)child_record;
 
-       RETVM_IF(property_id != CTSVC_PROPERTY_ACTIVITY_ACTIVITY_PHOTO, CONTACTS_ERROR_INVALID_PARAMETER, "property_id(%d) is not supported", property_id);
+       RETVM_IF(property_id != CTSVC_PROPERTY_ACTIVITY_ACTIVITY_PHOTO,
+                       CONTACTS_ERROR_INVALID_PARAMETER,
+                       "property_id(%d) is not supported",
+                       property_id);
 
-       ctsvc_list_remove_child((contacts_list_h)s_activity->photos, child_record, (s_activity_photo->id?true:false));
+       ctsvc_list_remove_child((contacts_list_h)s_activity->photos, child_record,
+                       s_activity_photo->id ? true : false);
 
        return CONTACTS_ERROR_NONE;
 }
@@ -1665,7 +1669,7 @@ static int __ctsvc_activity_remove_child_record(contacts_record_h record,
 static int __ctsvc_activity_get_child_record_count(contacts_record_h record,
                unsigned int property_id, int *count)
 {
-       ctsvc_activity_s *s_activity = (ctsvc_activity_s *)record;
+       ctsvc_activity_s *s_activity = (ctsvc_activity_s*)record;
        RETVM_IF(property_id != CTSVC_PROPERTY_ACTIVITY_ACTIVITY_PHOTO, CONTACTS_ERROR_INVALID_PARAMETER, "property_id(%d) is not supported", property_id);
 
        if (s_activity->photos)
@@ -1675,10 +1679,10 @@ static int __ctsvc_activity_get_child_record_count(contacts_record_h record,
 }
 
 static int __ctsvc_activity_get_child_record_at_p(contacts_record_h record,
-               unsigned int property_id, int index, contacts_record_hout_record)
+               unsigned int property_id, int index, contacts_record_h *out_record)
 {
        int count = 0;
-       ctsvc_activity_s *s_activity = (ctsvc_activity_s *)record;
+       ctsvc_activity_s *s_activity = (ctsvc_activity_s*)record;
 
        RETVM_IF(property_id != CTSVC_PROPERTY_ACTIVITY_ACTIVITY_PHOTO, CONTACTS_ERROR_INVALID_PARAMETER, "property_id(%d) is not supported", property_id);
 
@@ -1686,7 +1690,7 @@ static int __ctsvc_activity_get_child_record_at_p(contacts_record_h record,
                contacts_list_get_count((contacts_list_h)s_activity->photos, &count);
 
        if (count < index) {
-               CTS_ERR("The index(%d) is greather than total length(%d)", index, count);
+               ERR("The index(%d) is greather than total length(%d)", index, count);
                *out_record = NULL;
                return CONTACTS_ERROR_NO_DATA;
        }
@@ -1696,10 +1700,10 @@ static int __ctsvc_activity_get_child_record_at_p(contacts_record_h record,
 
 
 static int __ctsvc_activity_clone_child_record_list(contacts_record_h record,
-               unsigned int property_id, contacts_list_hout_list)
+               unsigned int property_id, contacts_list_h *out_list)
 {
        int count;
-       ctsvc_activity_s *s_activity = (ctsvc_activity_s *)record;
+       ctsvc_activity_s *s_activity = (ctsvc_activity_s*)record;
 
        RETVM_IF(property_id != CTSVC_PROPERTY_ACTIVITY_ACTIVITY_PHOTO, CONTACTS_ERROR_INVALID_PARAMETER, "property_id(%d) is not supported", property_id);
 
@@ -1714,9 +1718,9 @@ static int __ctsvc_activity_clone_child_record_list(contacts_record_h record,
 
 static int __ctsvc_activity_photo_get_int(contacts_record_h record, unsigned int property_id, int *out)
 {
-       ctsvc_activity_photo_s *photo = (ctsvc_activity_photo_s *)record;
+       ctsvc_activity_photo_s *photo = (ctsvc_activity_photo_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_ACTIVITY_PHOTO_ID:
                *out = photo->id;
                break;
@@ -1727,7 +1731,7 @@ static int __ctsvc_activity_photo_get_int(contacts_record_h record, unsigned int
                *out = photo->sort_index;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(activity)", property_id);
+               ERR("property_id(%d) is not supported in value(activity)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -1735,9 +1739,9 @@ static int __ctsvc_activity_photo_get_int(contacts_record_h record, unsigned int
 
 static int __ctsvc_profile_get_int(contacts_record_h record, unsigned int property_id, int *out)
 {
-       ctsvc_profile_s *profile = (ctsvc_profile_s *)record;
+       ctsvc_profile_s *profile = (ctsvc_profile_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_PROFILE_ID:
                *out = profile->id;
                break;
@@ -1748,7 +1752,7 @@ static int __ctsvc_profile_get_int(contacts_record_h record, unsigned int proper
                *out = profile->order;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(profile)", property_id);
+               ERR("property_id(%d) is not supported in value(profile)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -1756,9 +1760,9 @@ static int __ctsvc_profile_get_int(contacts_record_h record, unsigned int proper
 
 static int __ctsvc_relationship_get_int(contacts_record_h record, unsigned int property_id, int *out)
 {
-       ctsvc_relationship_s *relationship = (ctsvc_relationship_s *)record;
+       ctsvc_relationship_s *relationship = (ctsvc_relationship_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_RELATIONSHIP_ID:
                *out = relationship->id;
                break;
@@ -1769,7 +1773,7 @@ static int __ctsvc_relationship_get_int(contacts_record_h record, unsigned int p
                *out = relationship->type;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(relationship)", property_id);
+               ERR("property_id(%d) is not supported in value(relationship)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -1777,9 +1781,9 @@ static int __ctsvc_relationship_get_int(contacts_record_h record, unsigned int p
 
 static int __ctsvc_image_get_int(contacts_record_h record, unsigned int property_id, int *out)
 {
-       ctsvc_image_s *image = (ctsvc_image_s *)record;
+       ctsvc_image_s *image = (ctsvc_image_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_IMAGE_ID:
                *out = image->id;
                break;
@@ -1790,7 +1794,7 @@ static int __ctsvc_image_get_int(contacts_record_h record, unsigned int property
                *out = image->type;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(image)", property_id);
+               ERR("property_id(%d) is not supported in value(image)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -1798,9 +1802,9 @@ static int __ctsvc_image_get_int(contacts_record_h record, unsigned int property
 
 static int __ctsvc_extension_get_int(contacts_record_h record, unsigned int property_id, int *out)
 {
-       ctsvc_extension_s *extension = (ctsvc_extension_s *)record;
+       ctsvc_extension_s *extension = (ctsvc_extension_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_EXTENSION_ID:
                *out = extension->id;
                break;
@@ -1811,7 +1815,7 @@ static int __ctsvc_extension_get_int(contacts_record_h record, unsigned int prop
                *out = extension->data1;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(extension)", property_id);
+               ERR("property_id(%d) is not supported in value(extension)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -1820,9 +1824,9 @@ static int __ctsvc_extension_get_int(contacts_record_h record, unsigned int prop
 
 static int __ctsvc_contact_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty)
 {
-       ctsvc_contact_s *contact = (ctsvc_contact_s *)record;
+       ctsvc_contact_s *contact = (ctsvc_contact_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_CONTACT_ID:
                CHECK_DIRTY_VAL(contact->id, value, is_dirty);
                contact->id = value;
@@ -1833,7 +1837,7 @@ static int __ctsvc_contact_set_int(contacts_record_h record, unsigned int proper
                break;
        case CTSVC_PROPERTY_CONTACT_PERSON_ID:
                RETVM_IF(0 < contact->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is a read-only value (contact)", property_id);
+                               "property_id(%d) is a read-only value (contact)", property_id);
                CHECK_DIRTY_VAL(contact->person_id, value, is_dirty);
                contact->person_id = value;
                break;
@@ -1843,21 +1847,21 @@ static int __ctsvc_contact_set_int(contacts_record_h record, unsigned int proper
                break;
        case CTSVC_PROPERTY_CONTACT_ADDRESSBOOK_ID:
                RETVM_IF(0 < contact->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is a read-only value (contact)", property_id);
+                               "property_id(%d) is a read-only value (contact)", property_id);
                CHECK_DIRTY_VAL(contact->addressbook_id, value, is_dirty);
                contact->addressbook_id = value;
                break;
        case CTSVC_PROPERTY_CONTACT_LINK_MODE:
                RETVM_IF(value != CONTACTS_CONTACT_LINK_MODE_NONE
-                                               && value != CONTACTS_CONTACT_LINK_MODE_IGNORE_ONCE,
-                               CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : link mode is in invalid range (%d)", value);
+                               && value != CONTACTS_CONTACT_LINK_MODE_IGNORE_ONCE,
+                               CONTACTS_ERROR_INVALID_PARAMETER, "link mode is in invalid range (%d)", value);
                RETVM_IF(0 < contact->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is a read-only value (contact)", property_id);
+                               "property_id(%d) is a read-only value (contact)", property_id);
                CHECK_DIRTY_VAL(contact->link_mode, value, is_dirty);
                contact->link_mode = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value (contact)", property_id);
+               ERR("property_id(%d) is not supported in value (contact)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -1865,9 +1869,9 @@ static int __ctsvc_contact_set_int(contacts_record_h record, unsigned int proper
 
 static int __ctsvc_simple_contact_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty)
 {
-       ctsvc_simple_contact_s *contact = (ctsvc_simple_contact_s *)record;
+       ctsvc_simple_contact_s *contact = (ctsvc_simple_contact_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_CONTACT_ID:
                CHECK_DIRTY_VAL(contact->contact_id, value, is_dirty);
                contact->contact_id = value;
@@ -1887,7 +1891,7 @@ static int __ctsvc_simple_contact_set_int(contacts_record_h record, unsigned int
                contact->addressbook_id = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(simple contact)", property_id);
+               ERR("property_id(%d) is not supported in value(simple contact)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -1895,21 +1899,21 @@ static int __ctsvc_simple_contact_set_int(contacts_record_h record, unsigned int
 
 static int __ctsvc_name_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty)
 {
-       ctsvc_name_s *name = (ctsvc_name_s *)record;
+       ctsvc_name_s *name = (ctsvc_name_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_NAME_ID:
                CHECK_DIRTY_VAL(name->id, value, is_dirty);
                name->id = value;
                break;
        case CTSVC_PROPERTY_NAME_CONTACT_ID:
                RETVM_IF(0 < name->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is a read-only value (name)", property_id);
+                               "property_id(%d) is a read-only value (name)", property_id);
                CHECK_DIRTY_VAL(name->contact_id, value, is_dirty);
                name->contact_id = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(name)", property_id);
+               ERR("property_id(%d) is not supported in value(name)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -1917,29 +1921,29 @@ static int __ctsvc_name_set_int(contacts_record_h record, unsigned int property_
 
 static int __ctsvc_company_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty)
 {
-       ctsvc_company_s *company = (ctsvc_company_s *)record;
+       ctsvc_company_s *company = (ctsvc_company_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_COMPANY_ID:
                CHECK_DIRTY_VAL(company->id, value, is_dirty);
                company->id = value;
                break;
        case CTSVC_PROPERTY_COMPANY_CONTACT_ID:
                RETVM_IF(0 < company->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is a read-only value (company)", property_id);
+                               "property_id(%d) is a read-only value (company)", property_id);
                CHECK_DIRTY_VAL(company->contact_id, value, is_dirty);
                company->contact_id = value;
                break;
        case CTSVC_PROPERTY_COMPANY_TYPE:
                RETVM_IF(value < CONTACTS_COMPANY_TYPE_OTHER
-                                               || CONTACTS_COMPANY_TYPE_WORK < value,
-                               CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : company type is in invalid range (%d)", value);
+                               || CONTACTS_COMPANY_TYPE_WORK < value,
+                               CONTACTS_ERROR_INVALID_PARAMETER, "company type is in invalid range (%d)", value);
 
                CHECK_DIRTY_VAL(company->type, value, is_dirty);
                company->type = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(company)", property_id);
+               ERR("property_id(%d) is not supported in value(company)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -1947,21 +1951,21 @@ static int __ctsvc_company_set_int(contacts_record_h record, unsigned int proper
 
 static int __ctsvc_note_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty)
 {
-       ctsvc_note_s *note = (ctsvc_note_s *)record;
+       ctsvc_note_s *note = (ctsvc_note_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_NOTE_ID:
                CHECK_DIRTY_VAL(note->id, value, is_dirty);
                note->id = value;
                break;
        case CTSVC_PROPERTY_NOTE_CONTACT_ID:
                RETVM_IF(0 < note->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is a read-only value (note)", property_id);
+                               "property_id(%d) is a read-only value (note)", property_id);
                CHECK_DIRTY_VAL(note->contact_id, value, is_dirty);
                note->contact_id = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(note)", property_id);
+               ERR("property_id(%d) is not supported in value(note)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -1971,14 +1975,14 @@ static int __ctsvc_number_set_int(contacts_record_h record, unsigned int propert
 {
        ctsvc_number_s *number = (ctsvc_number_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_NUMBER_ID:
                CHECK_DIRTY_VAL(number->id, value, is_dirty);
                number->id = value;
                break;
        case CTSVC_PROPERTY_NUMBER_CONTACT_ID:
                RETVM_IF(0 < number->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is a read-only value (number)", property_id);
+                               "property_id(%d) is a read-only value (number)", property_id);
                CHECK_DIRTY_VAL(number->contact_id, value, is_dirty);
                number->contact_id = value;
                break;
@@ -1987,7 +1991,7 @@ static int __ctsvc_number_set_int(contacts_record_h record, unsigned int propert
                number->type = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(number)", property_id);
+               ERR("property_id(%d) is not supported in value(number)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -1995,29 +1999,29 @@ static int __ctsvc_number_set_int(contacts_record_h record, unsigned int propert
 
 static int __ctsvc_email_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty)
 {
-       ctsvc_email_s *email = (ctsvc_email_s *)record;
+       ctsvc_email_s *email = (ctsvc_email_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_EMAIL_ID:
                CHECK_DIRTY_VAL(email->id, value, is_dirty);
                email->id = value;
                break;
        case CTSVC_PROPERTY_EMAIL_CONTACT_ID:
                RETVM_IF(0 < email->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is a read-only value (email)", property_id);
+                               "property_id(%d) is a read-only value (email)", property_id);
                CHECK_DIRTY_VAL(email->contact_id, value, is_dirty);
                email->contact_id = value;
                break;
        case CTSVC_PROPERTY_EMAIL_TYPE:
                RETVM_IF(value < CONTACTS_EMAIL_TYPE_OTHER
-                                               || CONTACTS_EMAIL_TYPE_MOBILE < value,
-                               CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : email type is in invalid range (%d)", value);
+                               || CONTACTS_EMAIL_TYPE_MOBILE < value,
+                               CONTACTS_ERROR_INVALID_PARAMETER, "email type is in invalid range (%d)", value);
 
                CHECK_DIRTY_VAL(email->type, value, is_dirty);
                email->type = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(email)", property_id);
+               ERR("property_id(%d) is not supported in value(email)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -2025,29 +2029,29 @@ static int __ctsvc_email_set_int(contacts_record_h record, unsigned int property
 
 static int __ctsvc_url_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty)
 {
-       ctsvc_url_s *url = (ctsvc_url_s *)record;
+       ctsvc_url_s *url = (ctsvc_url_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_URL_ID:
                CHECK_DIRTY_VAL(url->id, value, is_dirty);
                url->id = value;
                break;
        case CTSVC_PROPERTY_URL_CONTACT_ID:
                RETVM_IF(0 < url->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is a read-only value (url)", property_id);
+                               "property_id(%d) is a read-only value (url)", property_id);
                CHECK_DIRTY_VAL(url->contact_id, value, is_dirty);
                url->contact_id = value;
                break;
        case CTSVC_PROPERTY_URL_TYPE:
                RETVM_IF(value < CONTACTS_URL_TYPE_OTHER
-                                               || CONTACTS_URL_TYPE_WORK < value,
-                               CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : url type is in invalid range (%d)", value);
+                               || CONTACTS_URL_TYPE_WORK < value,
+                               CONTACTS_ERROR_INVALID_PARAMETER, "url type is in invalid range (%d)", value);
 
                CHECK_DIRTY_VAL(url->type, value, is_dirty);
                url->type = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(url)", property_id);
+               ERR("property_id(%d) is not supported in value(url)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -2055,23 +2059,23 @@ static int __ctsvc_url_set_int(contacts_record_h record, unsigned int property_i
 
 static int __ctsvc_event_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty)
 {
-       ctsvc_event_s *event = (ctsvc_event_s *)record;
+       ctsvc_event_s *event = (ctsvc_event_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_EVENT_ID:
                CHECK_DIRTY_VAL(event->id, value, is_dirty);
                event->id = value;
                break;
        case CTSVC_PROPERTY_EVENT_CONTACT_ID:
                RETVM_IF(0 < event->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is a read-only value (event)", property_id);
+                               "property_id(%d) is a read-only value (event)", property_id);
                CHECK_DIRTY_VAL(event->contact_id, value, is_dirty);
                event->contact_id = value;
                break;
        case CTSVC_PROPERTY_EVENT_TYPE:
                RETVM_IF(value < CONTACTS_EVENT_TYPE_OTHER
-                                               || CONTACTS_EVENT_TYPE_ANNIVERSARY < value,
-                               CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : event type is in invalid range (%d)", value);
+                               || CONTACTS_EVENT_TYPE_ANNIVERSARY < value,
+                               CONTACTS_ERROR_INVALID_PARAMETER, "event type is in invalid range (%d)", value);
                CHECK_DIRTY_VAL(event->type, value, is_dirty);
                event->type = value;
                break;
@@ -2084,7 +2088,7 @@ static int __ctsvc_event_set_int(contacts_record_h record, unsigned int property
                event->calendar_type = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(event)", property_id);
+               ERR("property_id(%d) is not supported in value(event)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -2092,21 +2096,21 @@ static int __ctsvc_event_set_int(contacts_record_h record, unsigned int property
 
 static int __ctsvc_nickname_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty)
 {
-       ctsvc_nickname_s *nickname = (ctsvc_nickname_s *)record;
+       ctsvc_nickname_s *nickname = (ctsvc_nickname_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_NICKNAME_ID:
                CHECK_DIRTY_VAL(nickname->id, value, is_dirty);
                nickname->id = value;
                break;
        case CTSVC_PROPERTY_NICKNAME_CONTACT_ID:
                RETVM_IF(0 < nickname->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is a read-only value (nickname)", property_id);
+                               "property_id(%d) is a read-only value (nickname)", property_id);
                CHECK_DIRTY_VAL(nickname->contact_id, value, is_dirty);
                nickname->contact_id = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(nickname)", property_id);
+               ERR("property_id(%d) is not supported in value(nickname)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -2114,28 +2118,28 @@ static int __ctsvc_nickname_set_int(contacts_record_h record, unsigned int prope
 
 static int __ctsvc_address_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty)
 {
-       ctsvc_address_s *address = (ctsvc_address_s *)record;
+       ctsvc_address_s *address = (ctsvc_address_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_ADDRESS_ID:
                CHECK_DIRTY_VAL(address->id, value, is_dirty);
                address->id = value;
                break;
        case CTSVC_PROPERTY_ADDRESS_CONTACT_ID:
                RETVM_IF(0 < address->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is a read-only value (address)", property_id);
+                               "property_id(%d) is a read-only value (address)", property_id);
                CHECK_DIRTY_VAL(address->contact_id, value, is_dirty);
                address->contact_id = value;
                break;
        case CTSVC_PROPERTY_ADDRESS_TYPE:
                RETVM_IF(value < CONTACTS_ADDRESS_TYPE_OTHER
-                                               || CONTACTS_ADDRESS_TYPE_PARCEL < value,
-                               CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : address type is %d", value);
+                               || CONTACTS_ADDRESS_TYPE_PARCEL < value,
+                               CONTACTS_ERROR_INVALID_PARAMETER, "address type is %d", value);
                CHECK_DIRTY_VAL(address->type, value, is_dirty);
                address->type = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(address)", property_id);
+               ERR("property_id(%d) is not supported in value(address)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -2143,29 +2147,29 @@ static int __ctsvc_address_set_int(contacts_record_h record, unsigned int proper
 
 static int __ctsvc_messenger_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty)
 {
-       ctsvc_messenger_s *messenger = (ctsvc_messenger_s *)record;
+       ctsvc_messenger_s *messenger = (ctsvc_messenger_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_MESSENGER_ID:
                CHECK_DIRTY_VAL(messenger->id, value, is_dirty);
                messenger->id = value;
                break;
        case CTSVC_PROPERTY_MESSENGER_CONTACT_ID:
                RETVM_IF(0 < messenger->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is a read-only value (messenger)", property_id);
+                               "property_id(%d) is a read-only value (messenger)", property_id);
                CHECK_DIRTY_VAL(messenger->contact_id, value, is_dirty);
                messenger->contact_id = value;
                break;
        case CTSVC_PROPERTY_MESSENGER_TYPE:
                RETVM_IF(value < CONTACTS_MESSENGER_TYPE_OTHER
-                                                       || CONTACTS_MESSENGER_TYPE_IRC < value,
-                                       CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : messenger type is in invalid range (%d)", value);
+                               || CONTACTS_MESSENGER_TYPE_IRC < value,
+                               CONTACTS_ERROR_INVALID_PARAMETER, "messenger type is in invalid range (%d)", value);
 
                CHECK_DIRTY_VAL(messenger->type, value, is_dirty);
                messenger->type = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(messenger)", property_id);
+               ERR("property_id(%d) is not supported in value(messenger)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -2173,27 +2177,27 @@ static int __ctsvc_messenger_set_int(contacts_record_h record, unsigned int prop
 
 static int __ctsvc_group_relation_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty)
 {
-       ctsvc_group_relation_s *group = (ctsvc_group_relation_s *)record;
+       ctsvc_group_relation_s *group = (ctsvc_group_relation_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_GROUP_RELATION_ID:
                CHECK_DIRTY_VAL(group->id, value, is_dirty);
                group->id = value;
                break;
        case CTSVC_PROPERTY_GROUP_RELATION_CONTACT_ID:
                RETVM_IF(0 < group->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is a read-only value (group)", property_id);
+                               "property_id(%d) is a read-only value (group)", property_id);
                CHECK_DIRTY_VAL(group->contact_id, value, is_dirty);
                group->contact_id = value;
                break;
        case CTSVC_PROPERTY_GROUP_RELATION_GROUP_ID:
                RETVM_IF(0 < group->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is a read-only value (group)", property_id);
+                               "property_id(%d) is a read-only value (group)", property_id);
                CHECK_DIRTY_VAL(group->group_id, value, is_dirty);
                group->group_id = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(group relation)", property_id);
+               ERR("property_id(%d) is not supported in value(group relation)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -2201,16 +2205,16 @@ static int __ctsvc_group_relation_set_int(contacts_record_h record, unsigned int
 
 static int __ctsvc_activity_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty)
 {
-       ctsvc_activity_s *activity = (ctsvc_activity_s *)record;
+       ctsvc_activity_s *activity = (ctsvc_activity_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_ACTIVITY_ID:
                CHECK_DIRTY_VAL(activity->id, value, is_dirty);
                activity->id = value;
                break;
        case CTSVC_PROPERTY_ACTIVITY_CONTACT_ID:
                RETVM_IF(0 < activity->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is a read-only value (activity)", property_id);
+                               "property_id(%d) is a read-only value (activity)", property_id);
                CHECK_DIRTY_VAL(activity->contact_id, value, is_dirty);
                activity->contact_id = value;
                break;
@@ -2219,7 +2223,7 @@ static int __ctsvc_activity_set_int(contacts_record_h record, unsigned int prope
                activity->timestamp = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(activity)", property_id);
+               ERR("property_id(%d) is not supported in value(activity)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -2227,9 +2231,9 @@ static int __ctsvc_activity_set_int(contacts_record_h record, unsigned int prope
 
 static int __ctsvc_activity_photo_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty)
 {
-       ctsvc_activity_photo_s *photo = (ctsvc_activity_photo_s *)record;
+       ctsvc_activity_photo_s *photo = (ctsvc_activity_photo_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_ACTIVITY_PHOTO_ID:
                CHECK_DIRTY_VAL(photo->id, value, is_dirty);
                photo->id = value;
@@ -2243,7 +2247,7 @@ static int __ctsvc_activity_photo_set_int(contacts_record_h record, unsigned int
                photo->sort_index = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(activity)", property_id);
+               ERR("property_id(%d) is not supported in value(activity)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -2251,16 +2255,16 @@ static int __ctsvc_activity_photo_set_int(contacts_record_h record, unsigned int
 
 static int __ctsvc_profile_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty)
 {
-       ctsvc_profile_s *profile = (ctsvc_profile_s *)record;
+       ctsvc_profile_s *profile = (ctsvc_profile_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_PROFILE_ID:
                CHECK_DIRTY_VAL(profile->id, value, is_dirty);
                profile->id = value;
                break;
        case CTSVC_PROPERTY_PROFILE_CONTACT_ID:
                RETVM_IF(0 < profile->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is a read-only value (profile)", property_id);
+                               "property_id(%d) is a read-only value (profile)", property_id);
                CHECK_DIRTY_VAL(profile->contact_id, value, is_dirty);
                profile->contact_id = value;
                break;
@@ -2269,7 +2273,7 @@ static int __ctsvc_profile_set_int(contacts_record_h record, unsigned int proper
                profile->order = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(profile)", property_id);
+               ERR("property_id(%d) is not supported in value(profile)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -2277,28 +2281,28 @@ static int __ctsvc_profile_set_int(contacts_record_h record, unsigned int proper
 
 static int __ctsvc_relationship_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty)
 {
-       ctsvc_relationship_s *relationship = (ctsvc_relationship_s *)record;
+       ctsvc_relationship_s *relationship = (ctsvc_relationship_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_RELATIONSHIP_ID:
                CHECK_DIRTY_VAL(relationship->id, value, is_dirty);
                relationship->id = value;
                break;
        case CTSVC_PROPERTY_RELATIONSHIP_CONTACT_ID:
                RETVM_IF(0 < relationship->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is a read-only value (relationship)", property_id);
+                               "property_id(%d) is a read-only value (relationship)", property_id);
                CHECK_DIRTY_VAL(relationship->contact_id, value, is_dirty);
                relationship->contact_id = value;
                break;
        case CTSVC_PROPERTY_RELATIONSHIP_TYPE:
                RETVM_IF(value < CONTACTS_RELATIONSHIP_TYPE_OTHER
-                                               || CONTACTS_RELATIONSHIP_TYPE_CUSTOM < value,
-                               CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : relationship type is in invalid range (%d)", value);
+                               || CONTACTS_RELATIONSHIP_TYPE_CUSTOM < value,
+                               CONTACTS_ERROR_INVALID_PARAMETER, "relationship type is in invalid range (%d)", value);
                CHECK_DIRTY_VAL(relationship->type, value, is_dirty);
                relationship->type = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(relationship)", property_id);
+               ERR("property_id(%d) is not supported in value(relationship)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -2306,28 +2310,28 @@ static int __ctsvc_relationship_set_int(contacts_record_h record, unsigned int p
 
 static int __ctsvc_image_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty)
 {
-       ctsvc_image_s *image = (ctsvc_image_s *)record;
+       ctsvc_image_s *image = (ctsvc_image_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_IMAGE_ID:
                CHECK_DIRTY_VAL(image->id, value, is_dirty);
                image->id = value;
                break;
        case CTSVC_PROPERTY_IMAGE_CONTACT_ID:
                RETVM_IF(0 < image->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is a read-only value (image)", property_id);
+                               "property_id(%d) is a read-only value (image)", property_id);
                CHECK_DIRTY_VAL(image->contact_id, value, is_dirty);
                image->contact_id = value;
                break;
        case CTSVC_PROPERTY_IMAGE_TYPE:
                RETVM_IF(value < CONTACTS_IMAGE_TYPE_OTHER || CONTACTS_IMAGE_TYPE_CUSTOM < value,
                                CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : image type is in invalid range (%d)", value);
+                               "image type is in invalid range (%d)", value);
                CHECK_DIRTY_VAL(image->type, value, is_dirty);
                image->type = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(image)", property_id);
+               ERR("property_id(%d) is not supported in value(image)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -2335,16 +2339,16 @@ static int __ctsvc_image_set_int(contacts_record_h record, unsigned int property
 
 static int __ctsvc_extension_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty)
 {
-       ctsvc_extension_s *extension = (ctsvc_extension_s *)record;
+       ctsvc_extension_s *extension = (ctsvc_extension_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_EXTENSION_ID:
                CHECK_DIRTY_VAL(extension->id, value, is_dirty);
                extension->id = value;
                break;
        case CTSVC_PROPERTY_EXTENSION_CONTACT_ID:
                RETVM_IF(0 < extension->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is a read-only value (extension)", property_id);
+                               "property_id(%d) is a read-only value (extension)", property_id);
                CHECK_DIRTY_VAL(extension->contact_id, value, is_dirty);
                extension->contact_id = value;
                break;
@@ -2353,16 +2357,16 @@ static int __ctsvc_extension_set_int(contacts_record_h record, unsigned int prop
                extension->data1 = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(extension)", property_id);
+               ERR("property_id(%d) is not supported in value(extension)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_contact_get_str_real(contacts_record_h record, unsigned int property_id, char** out_str, bool copy)
+static int __ctsvc_contact_get_str_real(contacts_record_h record, unsigned int property_id, char **out_str, bool copy)
 {
        ctsvc_contact_s *contact = (ctsvc_contact_s*)record;
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_CONTACT_DISPLAY_NAME:
                *out_str = GET_STR(copy, contact->display_name);
                break;
@@ -2381,19 +2385,19 @@ static int __ctsvc_contact_get_str_real(contacts_record_h record, unsigned int p
        case CTSVC_PROPERTY_CONTACT_MESSAGE_ALERT:
                *out_str = GET_STR(copy, contact->message_alert);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(contact)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(contact)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_contact_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_contact_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_contact_get_str_real(record, property_id, out_str, false);
 }
 
-static int __ctsvc_contact_get_str(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_contact_get_str(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_contact_get_str_real(record, property_id, out_str, true);
 }
@@ -2401,9 +2405,9 @@ static int __ctsvc_contact_get_str(contacts_record_h record, unsigned int proper
 static int __ctsvc_contact_get_record_list_p(contacts_record_h record,
                unsigned int property_id, contacts_list_h *list)
 {
-       ctsvc_contact_s *contact = (ctsvc_contact_s *)record;
+       ctsvc_contact_s *contact = (ctsvc_contact_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_CONTACT_NAME:
                *list = (contacts_list_h)contact->name;
                break;
@@ -2449,8 +2453,8 @@ static int __ctsvc_contact_get_record_list_p(contacts_record_h record,
        case CTSVC_PROPERTY_CONTACT_EXTENSION:
                *list = (contacts_list_h)contact->extensions;
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(contact)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(contact)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -2474,7 +2478,7 @@ static int __ctsvc_contact_get_child_record_count(contacts_record_h record,
 }
 
 static int __ctsvc_contact_get_child_record_at_p(contacts_record_h record,
-               unsigned int property_id, int index, contacts_record_hout_record)
+               unsigned int property_id, int index, contacts_record_h *out_record)
 {
        int ret;
        int count;
@@ -2486,16 +2490,16 @@ static int __ctsvc_contact_get_child_record_at_p(contacts_record_h record,
 
        contacts_list_get_count(list, &count);
        if (count < index) {
-               CTS_ERR("The index(%d) is greather than total length(%d)", index, count);
+               ERR("The index(%d) is greather than total length(%d)", index, count);
                *out_record = NULL;
                return CONTACTS_ERROR_NO_DATA;
-       }
-       else
+       } else {
                return ctsvc_list_get_nth_record_p(list, index, out_record);
+       }
 }
 
 static int __ctsvc_contact_clone_child_record_list(contacts_record_h record,
-               unsigned int property_id, contacts_list_hout_list)
+               unsigned int property_id, contacts_list_h *out_list)
 {
        int ret;
        int count;
@@ -2520,57 +2524,57 @@ static int __ctsvc_contact_reset_child_record_id(contacts_record_h child_record)
 {
        ctsvc_record_s *record = (ctsvc_record_s*)child_record;
 
-       switch(record->r_type) {
+       switch (record->r_type) {
        case CTSVC_RECORD_NAME:
-               ((ctsvc_name_s *)record)->id = 0;
+               ((ctsvc_name_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_COMPANY:
-               ((ctsvc_company_s *)record)->id = 0;
+               ((ctsvc_company_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_NOTE:
-               ((ctsvc_note_s *)record)->id = 0;
+               ((ctsvc_note_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_NUMBER:
-               ((ctsvc_number_s *)record)->id = 0;
+               ((ctsvc_number_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_EMAIL:
-               ((ctsvc_email_s *)record)->id = 0;
+               ((ctsvc_email_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_URL:
-               ((ctsvc_url_s *)record)->id = 0;
+               ((ctsvc_url_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_EVENT:
-               ((ctsvc_event_s *)record)->id = 0;
+               ((ctsvc_event_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_NICKNAME:
-               ((ctsvc_nickname_s *)record)->id = 0;
+               ((ctsvc_nickname_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_ADDRESS:
-               ((ctsvc_address_s *)record)->id = 0;
+               ((ctsvc_address_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_MESSENGER:
-               ((ctsvc_messenger_s *)record)->id = 0;
+               ((ctsvc_messenger_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_GROUP_RELATION:
-               ((ctsvc_group_relation_s *)record)->id = 0;
+               ((ctsvc_group_relation_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_ACTIVITY:
-               ((ctsvc_activity_s *)record)->id = 0;
+               ((ctsvc_activity_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_PROFILE:
-               ((ctsvc_profile_s *)record)->id = 0;
+               ((ctsvc_profile_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_RELATIONSHIP:
-               ((ctsvc_relationship_s *)record)->id = 0;
+               ((ctsvc_relationship_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_IMAGE:
-               ((ctsvc_image_s *)record)->id = 0;
+               ((ctsvc_image_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_EXTENSION:
-               ((ctsvc_extension_s *)record)->id = 0;
+               ((ctsvc_extension_s*)record)->id = 0;
                break;
-       default :
-               CTS_ERR("Invalid parameter : record(%d) is not child of contact", record->r_type);
+       default:
+               ERR("record(%d) is not child of contact", record->r_type);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -2580,41 +2584,41 @@ static int __ctsvc_contact_get_child_record_id(contacts_record_h child_record)
 {
        ctsvc_record_s *record = (ctsvc_record_s*)child_record;
 
-       switch(record->r_type) {
+       switch (record->r_type) {
        case CTSVC_RECORD_NAME:
-               return ((ctsvc_name_s *)record)->id;
+               return ((ctsvc_name_s*)record)->id;
        case CTSVC_RECORD_COMPANY:
-               return ((ctsvc_company_s *)record)->id;
+               return ((ctsvc_company_s*)record)->id;
        case CTSVC_RECORD_NOTE:
-               return ((ctsvc_note_s *)record)->id;
+               return ((ctsvc_note_s*)record)->id;
        case CTSVC_RECORD_NUMBER:
-               return ((ctsvc_number_s *)record)->id;
+               return ((ctsvc_number_s*)record)->id;
        case CTSVC_RECORD_EMAIL:
-               return ((ctsvc_email_s *)record)->id;
+               return ((ctsvc_email_s*)record)->id;
        case CTSVC_RECORD_URL:
-               return ((ctsvc_url_s *)record)->id;
+               return ((ctsvc_url_s*)record)->id;
        case CTSVC_RECORD_EVENT:
-               return ((ctsvc_event_s *)record)->id;
+               return ((ctsvc_event_s*)record)->id;
        case CTSVC_RECORD_NICKNAME:
-               return ((ctsvc_nickname_s *)record)->id;
+               return ((ctsvc_nickname_s*)record)->id;
        case CTSVC_RECORD_ADDRESS:
-               return ((ctsvc_address_s *)record)->id;
+               return ((ctsvc_address_s*)record)->id;
        case CTSVC_RECORD_MESSENGER:
-               return ((ctsvc_messenger_s *)record)->id;
+               return ((ctsvc_messenger_s*)record)->id;
        case CTSVC_RECORD_GROUP_RELATION:
-               return ((ctsvc_group_relation_s *)record)->id;
+               return ((ctsvc_group_relation_s*)record)->id;
        case CTSVC_RECORD_ACTIVITY:
-               return ((ctsvc_activity_s *)record)->id;
+               return ((ctsvc_activity_s*)record)->id;
        case CTSVC_RECORD_PROFILE:
-               return ((ctsvc_profile_s *)record)->id;
+               return ((ctsvc_profile_s*)record)->id;
        case CTSVC_RECORD_RELATIONSHIP:
-               return ((ctsvc_relationship_s *)record)->id;
+               return ((ctsvc_relationship_s*)record)->id;
        case CTSVC_RECORD_IMAGE:
-               return ((ctsvc_image_s *)record)->id;
+               return ((ctsvc_image_s*)record)->id;
        case CTSVC_RECORD_EXTENSION:
-               return ((ctsvc_extension_s *)record)->id;
-       default :
-               CTS_ERR("Invalid parameter : record(%d) is not child of contact", record->r_type);
+               return ((ctsvc_extension_s*)record)->id;
+       default:
+               ERR("record(%d) is not child of contact", record->r_type);
                return 0;
        }
        return 0;
@@ -2625,14 +2629,14 @@ static int __ctsvc_contact_add_child_record(contacts_record_h record,
 {
        int ret;
        contacts_list_h list = NULL;
-       ctsvc_record_s *s_record = (ctsvc_record_s *)child_record;
+       ctsvc_record_s *s_record = (ctsvc_record_s*)child_record;
 
        ret = __ctsvc_contact_get_record_list_p(record, property_id, &list);
        if (CONTACTS_ERROR_INVALID_PARAMETER == ret)
                return ret;
 
-       if (CTSVC_RECORD_NAME == s_record->r_type && 1 == ((ctsvc_list_s *)list)->count) {
-               CTS_ERR("This type(%d) of child_record can not be added anymore", s_record->r_type);
+       if (CTSVC_RECORD_NAME == s_record->r_type && 1 == ((ctsvc_list_s*)list)->count) {
+               ERR("This type(%d) of child_record can not be added anymore", s_record->r_type);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
@@ -2657,17 +2661,17 @@ static int __ctsvc_contact_remove_child_record(contacts_record_h record,
                return ret;
 
        id = __ctsvc_contact_get_child_record_id(child_record);
-       ctsvc_list_remove_child(list, child_record, (id?true:false));
+       ctsvc_list_remove_child(list, child_record, id ? true : false);
 
        return CONTACTS_ERROR_NONE;
 }
 
 static int __ctsvc_simple_contact_get_str_real(contacts_record_h record,
-               unsigned int property_id, char** out_str, bool copy)
+               unsigned int property_id, char **out_str, bool copy)
 {
-       ctsvc_simple_contact_s *contact = (ctsvc_simple_contact_s *)record;
+       ctsvc_simple_contact_s *contact = (ctsvc_simple_contact_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_CONTACT_DISPLAY_NAME:
                *out_str = GET_STR(copy, contact->display_name);
                break;
@@ -2686,28 +2690,28 @@ static int __ctsvc_simple_contact_get_str_real(contacts_record_h record,
        case CTSVC_PROPERTY_CONTACT_MESSAGE_ALERT:
                *out_str = GET_STR(copy, contact->message_alert);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(simple_contact)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(simple_contact)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_simple_contact_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_simple_contact_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_simple_contact_get_str_real(record, property_id, out_str, false);
 }
 
-static int __ctsvc_simple_contact_get_str(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_simple_contact_get_str(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_simple_contact_get_str_real(record, property_id, out_str, true);
 }
 
-static int __ctsvc_name_get_str_real(contacts_record_h record, unsigned int property_id, char** out_str, bool copy)
+static int __ctsvc_name_get_str_real(contacts_record_h record, unsigned int property_id, char **out_str, bool copy)
 {
-       ctsvc_name_s *name = (ctsvc_name_s *)record;
+       ctsvc_name_s *name = (ctsvc_name_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_NAME_FIRST:
                *out_str = GET_STR(copy, name->first);
                break;
@@ -2732,28 +2736,28 @@ static int __ctsvc_name_get_str_real(contacts_record_h record, unsigned int prop
        case CTSVC_PROPERTY_NAME_PHONETIC_LAST:
                *out_str = GET_STR(copy, name->phonetic_last);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(name)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(name)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_name_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_name_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_name_get_str_real(record, property_id, out_str, false);
 }
 
-static int __ctsvc_name_get_str(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_name_get_str(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_name_get_str_real(record, property_id, out_str, true);
 }
 
-static int __ctsvc_company_get_str_real(contacts_record_h record, unsigned int property_id, char** out_str, bool copy)
+static int __ctsvc_company_get_str_real(contacts_record_h record, unsigned int property_id, char **out_str, bool copy)
 {
-       ctsvc_company_s *company = (ctsvc_company_s *)record;
+       ctsvc_company_s *company = (ctsvc_company_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_COMPANY_LABEL:
                *out_str = GET_STR(copy, company->label);
                break;
@@ -2784,187 +2788,187 @@ static int __ctsvc_company_get_str_real(contacts_record_h record, unsigned int p
        case CTSVC_PROPERTY_COMPANY_PHONETIC_NAME:
                *out_str = GET_STR(copy, company->phonetic_name);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(company)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(company)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_company_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_company_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_company_get_str_real(record, property_id, out_str, false);
 }
 
-static int __ctsvc_company_get_str(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_company_get_str(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_company_get_str_real(record, property_id, out_str, true);
 }
 
-static int __ctsvc_note_get_str_real(contacts_record_h record, unsigned int property_id, char** out_str, bool copy)
+static int __ctsvc_note_get_str_real(contacts_record_h record, unsigned int property_id, char **out_str, bool copy)
 {
-       ctsvc_note_s *note = (ctsvc_note_s *)record;
+       ctsvc_note_s *note = (ctsvc_note_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_NOTE_NOTE:
                *out_str = GET_STR(copy, note->note);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(note)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(note)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_note_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_note_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_note_get_str_real(record, property_id, out_str, false);
 }
 
-static int __ctsvc_note_get_str(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_note_get_str(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_note_get_str_real(record, property_id, out_str, true);
 }
 
-static int __ctsvc_number_get_str_real(contacts_record_h record, unsigned int property_id, char** out_str, bool copy)
+static int __ctsvc_number_get_str_real(contacts_record_h record, unsigned int property_id, char **out_str, bool copy)
 {
        ctsvc_number_s *number = (ctsvc_number_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_NUMBER_LABEL:
                *out_str = GET_STR(copy, number->label);
                break;
        case CTSVC_PROPERTY_NUMBER_NUMBER:
                *out_str = GET_STR(copy, number->number);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(number)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(number)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_number_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_number_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_number_get_str_real(record, property_id, out_str, false);
 }
 
-static int __ctsvc_number_get_str(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_number_get_str(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_number_get_str_real(record, property_id, out_str, true);
 }
 
-static int __ctsvc_email_get_str_real(contacts_record_h record, unsigned int property_id, char** out_str, bool copy)
+static int __ctsvc_email_get_str_real(contacts_record_h record, unsigned int property_id, char **out_str, bool copy)
 {
        ctsvc_email_s *email = (ctsvc_email_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_EMAIL_EMAIL:
                *out_str = GET_STR(copy, email->email_addr);
                break;
        case CTSVC_PROPERTY_EMAIL_LABEL:
                *out_str = GET_STR(copy, email->label);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(email)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(email)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_email_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_email_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_email_get_str_real(record, property_id, out_str, false);
 }
 
-static int __ctsvc_email_get_str(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_email_get_str(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_email_get_str_real(record, property_id, out_str, true);
 }
 
-static int __ctsvc_url_get_str_real(contacts_record_h record, unsigned int property_id, char** out_str, bool copy)
+static int __ctsvc_url_get_str_real(contacts_record_h record, unsigned int property_id, char **out_str, bool copy)
 {
-       ctsvc_url_s *url = (ctsvc_url_s *)record;
+       ctsvc_url_s *url = (ctsvc_url_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_URL_URL:
                *out_str = GET_STR(copy, url->url);
                break;
        case CTSVC_PROPERTY_URL_LABEL:
                *out_str = GET_STR(copy, url->label);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(url)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(url)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_url_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_url_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_url_get_str_real(record, property_id, out_str, false);
 }
 
-static int __ctsvc_url_get_str(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_url_get_str(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_url_get_str_real(record, property_id, out_str, true);
 }
 
-static int __ctsvc_event_get_str_real(contacts_record_h record, unsigned int property_id, char** out_str, bool copy)
+static int __ctsvc_event_get_str_real(contacts_record_h record, unsigned int property_id, char **out_str, bool copy)
 {
-       ctsvc_event_s *event = (ctsvc_event_s *)record;
+       ctsvc_event_s *event = (ctsvc_event_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_EVENT_LABEL:
                *out_str = GET_STR(copy, event->label);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(event)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(event)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_event_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_event_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_event_get_str_real(record, property_id, out_str, false);
 }
 
-static int __ctsvc_event_get_str(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_event_get_str(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_event_get_str_real(record, property_id, out_str, true);
 }
 
-static int __ctsvc_nickname_get_str_real(contacts_record_h record, unsigned int property_id, char** out_str, bool copy)
+static int __ctsvc_nickname_get_str_real(contacts_record_h record, unsigned int property_id, char **out_str, bool copy)
 {
-       ctsvc_nickname_s *nickname = (ctsvc_nickname_s *)record;
+       ctsvc_nickname_s *nickname = (ctsvc_nickname_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_NICKNAME_NAME:
                *out_str = GET_STR(copy, nickname->nickname);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(nickname)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(nickname)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_nickname_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_nickname_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_nickname_get_str_real(record, property_id, out_str, false);
 }
 
-static int __ctsvc_nickname_get_str(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_nickname_get_str(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_nickname_get_str_real(record, property_id, out_str, true);
 }
 
-static int __ctsvc_address_get_str_real(contacts_record_h record, unsigned int property_id, char** out_str, bool copy)
+static int __ctsvc_address_get_str_real(contacts_record_h record, unsigned int property_id, char **out_str, bool copy)
 {
-       ctsvc_address_s *address = (ctsvc_address_s *)record;
+       ctsvc_address_s *address = (ctsvc_address_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_ADDRESS_LABEL:
                *out_str = GET_STR(copy, address->label);
                break;
@@ -2989,83 +2993,83 @@ static int __ctsvc_address_get_str_real(contacts_record_h record, unsigned int p
        case CTSVC_PROPERTY_ADDRESS_EXTENDED:
                *out_str = GET_STR(copy, address->extended);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(address)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(address)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_address_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_address_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_address_get_str_real(record, property_id, out_str, false);
 }
 
-static int __ctsvc_address_get_str(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_address_get_str(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_address_get_str_real(record, property_id, out_str, true);
 }
 
-static int __ctsvc_messenger_get_str_real(contacts_record_h record, unsigned int property_id, char** out_str, bool copy)
+static int __ctsvc_messenger_get_str_real(contacts_record_h record, unsigned int property_id, char **out_str, bool copy)
 {
-       ctsvc_messenger_s *messenger = (ctsvc_messenger_s *)record;
+       ctsvc_messenger_s *messenger = (ctsvc_messenger_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_MESSENGER_LABEL:
                *out_str = GET_STR(copy, messenger->label);
                break;
        case CTSVC_PROPERTY_MESSENGER_IM_ID:
                *out_str = GET_STR(copy, messenger->im_id);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(messenger)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(messenger)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_messenger_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_messenger_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_messenger_get_str_real(record, property_id, out_str, false);
 }
 
-static int __ctsvc_messenger_get_str(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_messenger_get_str(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_messenger_get_str_real(record, property_id, out_str, true);
 }
 
 static int __ctsvc_group_relation_get_str_real(contacts_record_h record,
-               unsigned int property_id, char** out_str, bool copy)
+               unsigned int property_id, char **out_str, bool copy)
 {
-       ctsvc_group_relation_s *group_relation = (ctsvc_group_relation_s *)record;
+       ctsvc_group_relation_s *group_relation = (ctsvc_group_relation_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_GROUP_RELATION_GROUP_NAME:
                *out_str = GET_STR(copy, group_relation->group_name);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(group_relation)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(group_relation)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
 static int __ctsvc_group_relation_get_str_p(contacts_record_h record,
-               unsigned int property_id, char** out_str)
+               unsigned int property_id, char **out_str)
 {
        return __ctsvc_group_relation_get_str_real(record, property_id, out_str, false);
 }
 
-static int __ctsvc_group_relation_get_str(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_group_relation_get_str(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_group_relation_get_str_real(record, property_id, out_str, true);
 }
 
-static int __ctsvc_activity_get_str_real(contacts_record_h record, unsigned int property_id, char** out_str, bool copy)
+static int __ctsvc_activity_get_str_real(contacts_record_h record, unsigned int property_id, char **out_str, bool copy)
 {
-       ctsvc_activity_s *activity = (ctsvc_activity_s *)record;
+       ctsvc_activity_s *activity = (ctsvc_activity_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_ACTIVITY_SOURCE_NAME:
                *out_str = GET_STR(copy, activity->source_name);
                break;
@@ -3078,53 +3082,53 @@ static int __ctsvc_activity_get_str_real(contacts_record_h record, unsigned int
        case CTSVC_PROPERTY_ACTIVITY_URI:
                *out_str = GET_STR(copy, activity->uri);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(activity)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(activity)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_activity_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_activity_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_activity_get_str_real(record, property_id, out_str, false);
 }
 
-static int __ctsvc_activity_get_str(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_activity_get_str(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_activity_get_str_real(record, property_id, out_str, true);
 }
 
-static int __ctsvc_activity_photo_get_str_real(contacts_record_h record, unsigned int property_id, char** out_str, bool copy)
+static int __ctsvc_activity_photo_get_str_real(contacts_record_h record, unsigned int property_id, char **out_str, bool copy)
 {
-       ctsvc_activity_photo_s *photo = (ctsvc_activity_photo_s *)record;
+       ctsvc_activity_photo_s *photo = (ctsvc_activity_photo_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_ACTIVITY_PHOTO_URL:
                *out_str = GET_STR(copy, photo->photo_url);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(activity)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(activity)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_activity_photo_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_activity_photo_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_activity_photo_get_str_real(record, property_id, out_str, false);
 }
 
-static int __ctsvc_activity_photo_get_str(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_activity_photo_get_str(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_activity_photo_get_str_real(record, property_id, out_str, true);
 }
 
-static int __ctsvc_profile_get_str_real(contacts_record_h record, unsigned int property_id, char** out_str, bool copy)
+static int __ctsvc_profile_get_str_real(contacts_record_h record, unsigned int property_id, char **out_str, bool copy)
 {
-       ctsvc_profile_s *profile = (ctsvc_profile_s *)record;
+       ctsvc_profile_s *profile = (ctsvc_profile_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_PROFILE_UID:
                *out_str = GET_STR(copy, profile->uid);
                break;
@@ -3149,84 +3153,84 @@ static int __ctsvc_profile_get_str_real(contacts_record_h record, unsigned int p
        case CTSVC_PROPERTY_PROFILE_EXTRA_DATA:
                *out_str = GET_STR(copy, profile->extra_data);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(profile)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(profile)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_profile_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_profile_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_profile_get_str_real(record, property_id, out_str, false);
 }
 
-static int __ctsvc_profile_get_str(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_profile_get_str(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_profile_get_str_real(record, property_id, out_str, true);
 }
 
-static int __ctsvc_relationship_get_str_real(contacts_record_h record, unsigned int property_id, char** out_str, bool copy)
+static int __ctsvc_relationship_get_str_real(contacts_record_h record, unsigned int property_id, char **out_str, bool copy)
 {
-       ctsvc_relationship_s *relationship = (ctsvc_relationship_s *)record;
+       ctsvc_relationship_s *relationship = (ctsvc_relationship_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_RELATIONSHIP_LABEL:
                *out_str = GET_STR(copy, relationship->label);
                break;
        case CTSVC_PROPERTY_RELATIONSHIP_NAME:
                *out_str = GET_STR(copy, relationship->name);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(relationship)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(relationship)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_relationship_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_relationship_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_relationship_get_str_real(record, property_id, out_str, false);
 }
 
-static int __ctsvc_relationship_get_str(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_relationship_get_str(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_relationship_get_str_real(record, property_id, out_str, true);
 }
 
-static int __ctsvc_image_get_str_real(contacts_record_h record, unsigned int property_id, char** out_str, bool copy)
+static int __ctsvc_image_get_str_real(contacts_record_h record, unsigned int property_id, char **out_str, bool copy)
 {
-       ctsvc_image_s *image = (ctsvc_image_s *)record;
+       ctsvc_image_s *image = (ctsvc_image_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_IMAGE_LABEL:
                *out_str = GET_STR(copy, image->label);
                break;
        case CTSVC_PROPERTY_IMAGE_PATH:
                *out_str = GET_STR(copy, image->path);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(image)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(image)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_image_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_image_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_image_get_str_real(record, property_id, out_str, false);
 }
 
-static int __ctsvc_image_get_str(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_image_get_str(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_image_get_str_real(record, property_id, out_str, true);
 }
 
-static int __ctsvc_extension_get_str_real(contacts_record_h record, unsigned int property_id, char** out_str, bool copy)
+static int __ctsvc_extension_get_str_real(contacts_record_h record, unsigned int property_id, char **out_str, bool copy)
 {
-       ctsvc_extension_s *extension = (ctsvc_extension_s *)record;
+       ctsvc_extension_s *extension = (ctsvc_extension_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_EXTENSION_DATA2:
                *out_str = GET_STR(copy, extension->data2);
                break;
@@ -3260,36 +3264,37 @@ static int __ctsvc_extension_get_str_real(contacts_record_h record, unsigned int
        case CTSVC_PROPERTY_EXTENSION_DATA12:
                *out_str = GET_STR(copy, extension->data12);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(extension)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(extension)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_extension_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_extension_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_extension_get_str_real(record, property_id, out_str, false);
 }
 
-static int __ctsvc_extension_get_str(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_extension_get_str(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_extension_get_str_real(record, property_id, out_str, true);
 }
 
-static int __ctsvc_contact_set_str(contacts_record_h record, unsigned int property_id, const char* str, bool *is_dirty )
+static int __ctsvc_contact_set_str(contacts_record_h record, unsigned int property_id,
+               const char *str, bool *is_dirty)
 {
-       ctsvc_contact_s *contact = (ctsvc_contact_s *)record;
+       ctsvc_contact_s *contact = (ctsvc_contact_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_CONTACT_DISPLAY_NAME:
                CHECK_DIRTY_STR(contact->display_name, str, is_dirty);
                FREEandSTRDUP(contact->display_name, str);
                break;
-/*
-               CTS_ERR("Invalid parameter : property_id(%d) is a read-only value (contact)", property_id);
-               return CONTACTS_ERROR_INVALID_PARAMETER;
-*/
+               /*
+                  ERR("property_id(%d) is a read-only value (contact)", property_id);
+                  return CONTACTS_ERROR_INVALID_PARAMETER;
+                  */
        case CTSVC_PROPERTY_CONTACT_RINGTONE:
                CHECK_DIRTY_STR(contact->ringtone_path, str, is_dirty);
                FREEandSTRDUP(contact->ringtone_path, str);
@@ -3310,27 +3315,27 @@ static int __ctsvc_contact_set_str(contacts_record_h record, unsigned int proper
                CHECK_DIRTY_STR(contact->message_alert, str, is_dirty);
                FREEandSTRDUP(contact->message_alert, str);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(contact)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(contact)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
 
-static int __ctsvc_simple_contact_set_str(contacts_record_h record, unsigned int property_id, const char* str, bool *is_dirty )
+static int __ctsvc_simple_contact_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty)
 {
-       ctsvc_simple_contact_s *contact = (ctsvc_simple_contact_s *)record;
+       ctsvc_simple_contact_s *contact = (ctsvc_simple_contact_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_CONTACT_DISPLAY_NAME:
                CHECK_DIRTY_STR(contact->display_name, str, is_dirty);
                FREEandSTRDUP(contact->display_name, str);
                break;
-/*
-               CTS_ERR("Invalid parameter : property_id(%d) is a read-only value (contact)", property_id);
-               return CONTACTS_ERROR_INVALID_PARAMETER;
-*/
+               /*
+                  ERR("property_id(%d) is a read-only value (contact)", property_id);
+                  return CONTACTS_ERROR_INVALID_PARAMETER;
+                  */
        case CTSVC_PROPERTY_CONTACT_RINGTONE:
                CHECK_DIRTY_STR(contact->ringtone_path, str, is_dirty);
                FREEandSTRDUP(contact->ringtone_path, str);
@@ -3351,18 +3356,18 @@ static int __ctsvc_simple_contact_set_str(contacts_record_h record, unsigned int
                CHECK_DIRTY_STR(contact->message_alert, str, is_dirty);
                FREEandSTRDUP(contact->message_alert, str);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(simple_contact)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(simple_contact)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_name_set_str(contacts_record_h record, unsigned int property_id, const char* str, bool *is_dirty )
+static int __ctsvc_name_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty)
 {
-       ctsvc_name_s *name = (ctsvc_name_s *)record;
+       ctsvc_name_s *name = (ctsvc_name_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_NAME_FIRST:
                CHECK_DIRTY_STR(name->first, str, is_dirty);
                FREEandSTRDUP(name->first, str);
@@ -3395,18 +3400,18 @@ static int __ctsvc_name_set_str(contacts_record_h record, unsigned int property_
                CHECK_DIRTY_STR(name->phonetic_last, str, is_dirty);
                FREEandSTRDUP(name->phonetic_last, str);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(name)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(name)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_company_set_str(contacts_record_h record, unsigned int property_id, const char* str, bool *is_dirty )
+static int __ctsvc_company_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty)
 {
-       ctsvc_company_s *company = (ctsvc_company_s *)record;
+       ctsvc_company_s *company = (ctsvc_company_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_COMPANY_LABEL:
                CHECK_DIRTY_STR(company->label, str, is_dirty);
                FREEandSTRDUP(company->label, str);
@@ -3451,34 +3456,34 @@ static int __ctsvc_company_set_str(contacts_record_h record, unsigned int proper
                CHECK_DIRTY_STR(company->phonetic_name, str, is_dirty);
                FREEandSTRDUP(company->phonetic_name, str);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(company)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(company)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_note_set_str(contacts_record_h record, unsigned int property_id, const char* str, bool *is_dirty )
+static int __ctsvc_note_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty)
 {
-       ctsvc_note_s *note = (ctsvc_note_s *)record;
+       ctsvc_note_s *note = (ctsvc_note_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_NOTE_NOTE:
                CHECK_DIRTY_STR(note->note, str, is_dirty);
                FREEandSTRDUP(note->note, str);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(note)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(note)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_number_set_str(contacts_record_h record, unsigned int property_id, const char* str, bool *is_dirty )
+static int __ctsvc_number_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty)
 {
        ctsvc_number_s *number = (ctsvc_number_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_NUMBER_LABEL:
                CHECK_DIRTY_STR(number->label, str, is_dirty);
                FREEandSTRDUP(number->label, str);
@@ -3487,18 +3492,18 @@ static int __ctsvc_number_set_str(contacts_record_h record, unsigned int propert
                CHECK_DIRTY_STR(number->number, str, is_dirty);
                FREEandSTRDUP(number->number, str);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(number)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(number)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_email_set_str(contacts_record_h record, unsigned int property_id, const char* str, bool *is_dirty )
+static int __ctsvc_email_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty)
 {
-       ctsvc_email_s *email = (ctsvc_email_s *)record;
+       ctsvc_email_s *email = (ctsvc_email_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_EMAIL_EMAIL:
                CHECK_DIRTY_STR(email->email_addr, str, is_dirty);
                FREEandSTRDUP(email->email_addr, str);
@@ -3507,18 +3512,18 @@ static int __ctsvc_email_set_str(contacts_record_h record, unsigned int property
                CHECK_DIRTY_STR(email->label, str, is_dirty);
                FREEandSTRDUP(email->label, str);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(email)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(email)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_url_set_str(contacts_record_h record, unsigned int property_id, const char* str, bool *is_dirty )
+static int __ctsvc_url_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty)
 {
-       ctsvc_url_s *url = (ctsvc_url_s *)record;
+       ctsvc_url_s *url = (ctsvc_url_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_URL_URL:
                CHECK_DIRTY_STR(url->url, str, is_dirty);
                FREEandSTRDUP(url->url, str);
@@ -3527,50 +3532,50 @@ static int __ctsvc_url_set_str(contacts_record_h record, unsigned int property_i
                CHECK_DIRTY_STR(url->label, str, is_dirty);
                FREEandSTRDUP(url->label, str);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(url)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(url)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_event_set_str(contacts_record_h record, unsigned int property_id, const char* str, bool *is_dirty )
+static int __ctsvc_event_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty)
 {
-       ctsvc_event_s *event = (ctsvc_event_s *)record;
+       ctsvc_event_s *event = (ctsvc_event_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_EVENT_LABEL:
                CHECK_DIRTY_STR(event->label, str, is_dirty);
                FREEandSTRDUP(event->label, str);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(event)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(event)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_nickname_set_str(contacts_record_h record, unsigned int property_id, const char* str, bool *is_dirty )
+static int __ctsvc_nickname_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty)
 {
-       ctsvc_nickname_s *nickname = (ctsvc_nickname_s *)record;
+       ctsvc_nickname_s *nickname = (ctsvc_nickname_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_NICKNAME_NAME:
                CHECK_DIRTY_STR(nickname->nickname, str, is_dirty);
                FREEandSTRDUP(nickname->nickname, str);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(nickname)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(nickname)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_address_set_str(contacts_record_h record, unsigned int property_id, const char* str, bool *is_dirty )
+static int __ctsvc_address_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty)
 {
-       ctsvc_address_s *address = (ctsvc_address_s *)record;
+       ctsvc_address_s *address = (ctsvc_address_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_ADDRESS_LABEL:
                CHECK_DIRTY_STR(address->label, str, is_dirty);
                FREEandSTRDUP(address->label, str);
@@ -3603,18 +3608,18 @@ static int __ctsvc_address_set_str(contacts_record_h record, unsigned int proper
                CHECK_DIRTY_STR(address->extended, str, is_dirty);
                FREEandSTRDUP(address->extended, str);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(address)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(address)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_messenger_set_str(contacts_record_h record, unsigned int property_id, const char* str, bool *is_dirty )
+static int __ctsvc_messenger_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty)
 {
-       ctsvc_messenger_s *messenger = (ctsvc_messenger_s *)record;
+       ctsvc_messenger_s *messenger = (ctsvc_messenger_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_MESSENGER_LABEL:
                CHECK_DIRTY_STR(messenger->label, str, is_dirty);
                FREEandSTRDUP(messenger->label, str);
@@ -3623,38 +3628,38 @@ static int __ctsvc_messenger_set_str(contacts_record_h record, unsigned int prop
                CHECK_DIRTY_STR(messenger->im_id, str, is_dirty);
                FREEandSTRDUP(messenger->im_id, str);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(messenger)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(messenger)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_group_relation_set_str(contacts_record_h record, unsigned int property_id, const char* str, bool *is_dirty )
+static int __ctsvc_group_relation_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty)
 {
-       ctsvc_group_relation_s *group_relation = (ctsvc_group_relation_s *)record;
+       ctsvc_group_relation_s *group_relation = (ctsvc_group_relation_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_GROUP_RELATION_GROUP_NAME:
                CHECK_DIRTY_STR(group_relation->group_name, str, is_dirty);
                FREEandSTRDUP(group_relation->group_name, str);
                break;
-/*
-               CTS_ERR("Invalid parameter : property_id(%d) is a read-only value (group_relation)", property_id);
-               return CONTACTS_ERROR_INVALID_PARAMETER;
-*/
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(group_relation)", property_id);
+               /*
+                  ERR("property_id(%d) is a read-only value (group_relation)", property_id);
+                  return CONTACTS_ERROR_INVALID_PARAMETER;
+                  */
+       default:
+               ERR("property_id(%d) is not supported in value(group_relation)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_activity_set_str(contacts_record_h record, unsigned int property_id, const char* str, bool *is_dirty )
+static int __ctsvc_activity_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty)
 {
-       ctsvc_activity_s *activity = (ctsvc_activity_s *)record;
+       ctsvc_activity_s *activity = (ctsvc_activity_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_ACTIVITY_SOURCE_NAME:
                CHECK_DIRTY_STR(activity->source_name, str, is_dirty);
                FREEandSTRDUP(activity->source_name, str);
@@ -3671,34 +3676,36 @@ static int __ctsvc_activity_set_str(contacts_record_h record, unsigned int prope
                CHECK_DIRTY_STR(activity->uri, str, is_dirty);
                FREEandSTRDUP(activity->uri, str);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(activity)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(activity)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_activity_photo_set_str(contacts_record_h record, unsigned int property_id, const char* str, bool *is_dirty )
+static int __ctsvc_activity_photo_set_str(contacts_record_h record, unsigned int property_id,
+               const char *str, bool *is_dirty)
 {
-       ctsvc_activity_photo_s *photo = (ctsvc_activity_photo_s *)record;
+       ctsvc_activity_photo_s *photo = (ctsvc_activity_photo_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_ACTIVITY_PHOTO_URL:
                CHECK_DIRTY_STR(photo->photo_url, str, is_dirty);
                FREEandSTRDUP(photo->photo_url, str);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(activity)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(activity)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_profile_set_str(contacts_record_h record, unsigned int property_id, const char* str, bool *is_dirty )
+static int __ctsvc_profile_set_str(contacts_record_h record, unsigned int property_id,
+               const char *str, bool *is_dirty)
 {
-       ctsvc_profile_s *profile = (ctsvc_profile_s *)record;
+       ctsvc_profile_s *profile = (ctsvc_profile_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_PROFILE_UID:
                CHECK_DIRTY_STR(profile->uid, str, is_dirty);
                FREEandSTRDUP(profile->uid, str);
@@ -3731,18 +3738,19 @@ static int __ctsvc_profile_set_str(contacts_record_h record, unsigned int proper
                CHECK_DIRTY_STR(profile->extra_data, str, is_dirty);
                FREEandSTRDUP(profile->extra_data, str);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(profile)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(profile)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_relationship_set_str(contacts_record_h record, unsigned int property_id, const char* str, bool *is_dirty )
+static int __ctsvc_relationship_set_str(contacts_record_h record, unsigned int property_id,
+               const char *str, bool *is_dirty)
 {
-       ctsvc_relationship_s *relationship = (ctsvc_relationship_s *)record;
+       ctsvc_relationship_s *relationship = (ctsvc_relationship_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_RELATIONSHIP_LABEL:
                CHECK_DIRTY_STR(relationship->label, str, is_dirty);
                FREEandSTRDUP(relationship->label, str);
@@ -3751,42 +3759,45 @@ static int __ctsvc_relationship_set_str(contacts_record_h record, unsigned int p
                CHECK_DIRTY_STR(relationship->name, str, is_dirty);
                FREEandSTRDUP(relationship->name, str);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(relationship)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(relationship)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_image_set_str(contacts_record_h record, unsigned int property_id, const char* str, bool *is_dirty )
+static int __ctsvc_image_set_str(contacts_record_h record, unsigned int property_id,
+               const char *str, bool *is_dirty)
 {
-       ctsvc_image_s *image = (ctsvc_image_s *)record;
+       ctsvc_image_s *image = (ctsvc_image_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_IMAGE_LABEL:
                CHECK_DIRTY_STR(image->label, str, is_dirty);
                FREEandSTRDUP(image->label, str);
                break;
        case CTSVC_PROPERTY_IMAGE_PATH:
-               if (image->path && image->is_vcard && (NULL == str || STRING_EQUAL != strcmp(image->path, str))) {
+               if (image->path && image->is_vcard
+                               && (NULL == str || STRING_EQUAL != strcmp(image->path, str))) {
                        image->is_vcard = false;
                        __ctsvc_temp_image_hash_table_remove(image->path);
                }
                CHECK_DIRTY_STR(image->path, str, is_dirty);
                FREEandSTRDUP(image->path, str);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(image)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(image)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_extension_set_str(contacts_record_h record, unsigned int property_id, const char* str, bool *is_dirty )
+static int __ctsvc_extension_set_str(contacts_record_h record, unsigned int property_id,
+               const char *str, bool *is_dirty)
 {
-       ctsvc_extension_s *extension = (ctsvc_extension_s *)record;
+       ctsvc_extension_s *extension = (ctsvc_extension_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_EXTENSION_DATA2:
                CHECK_DIRTY_STR(extension->data2, str, is_dirty);
                FREEandSTRDUP(extension->data2, str);
@@ -3831,8 +3842,8 @@ static int __ctsvc_extension_set_str(contacts_record_h record, unsigned int prop
                CHECK_DIRTY_STR(extension->data12, str, is_dirty);
                FREEandSTRDUP(extension->data12, str);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(extension)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(extension)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -3840,7 +3851,7 @@ static int __ctsvc_extension_set_str(contacts_record_h record, unsigned int prop
 
 static int __ctsvc_contact_get_bool(contacts_record_h record, unsigned int property_id, bool *value)
 {
-       ctsvc_contact_s *contact = (ctsvc_contact_s *)record;
+       ctsvc_contact_s *contact = (ctsvc_contact_s*)record;
        switch (property_id) {
        case CTSVC_PROPERTY_CONTACT_IS_FAVORITE:
                *value = contact->is_favorite;
@@ -3852,7 +3863,7 @@ static int __ctsvc_contact_get_bool(contacts_record_h record, unsigned int prope
                *value = contact->has_email;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(0x%x) is not supported in value(contact)", property_id);
+               ERR("property_id(0x%x) is not supported in value(contact)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -3860,7 +3871,7 @@ static int __ctsvc_contact_get_bool(contacts_record_h record, unsigned int prope
 
 static int __ctsvc_simple_contact_get_bool(contacts_record_h record, unsigned int property_id, bool *value)
 {
-       ctsvc_simple_contact_s *contact = (ctsvc_simple_contact_s *)record;
+       ctsvc_simple_contact_s *contact = (ctsvc_simple_contact_s*)record;
        switch (property_id) {
        case CTSVC_PROPERTY_CONTACT_IS_FAVORITE:
                *value = contact->is_favorite;
@@ -3872,7 +3883,7 @@ static int __ctsvc_simple_contact_get_bool(contacts_record_h record, unsigned in
                *value = contact->has_email;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(0x%x) is not supported in value(contact)", property_id);
+               ERR("property_id(0x%x) is not supported in value(contact)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -3887,7 +3898,7 @@ static int __ctsvc_number_get_bool(contacts_record_h record, unsigned int proper
                *value = number->is_default;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(0x%x) is not supported in value(number)", property_id);
+               ERR("property_id(0x%x) is not supported in value(number)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -3895,13 +3906,13 @@ static int __ctsvc_number_get_bool(contacts_record_h record, unsigned int proper
 
 static int __ctsvc_email_get_bool(contacts_record_h record, unsigned int property_id, bool *value)
 {
-       ctsvc_email_s *email = (ctsvc_email_s *)record;
+       ctsvc_email_s *email = (ctsvc_email_s*)record;
        switch (property_id) {
        case CTSVC_PROPERTY_EMAIL_IS_DEFAULT:
                *value = email->is_default;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(0x%x) is not supported in value(email)", property_id);
+               ERR("property_id(0x%x) is not supported in value(email)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -3909,13 +3920,13 @@ static int __ctsvc_email_get_bool(contacts_record_h record, unsigned int propert
 
 static int __ctsvc_event_get_bool(contacts_record_h record, unsigned int property_id, bool *value)
 {
-       ctsvc_event_s *event = (ctsvc_event_s *)record;
+       ctsvc_event_s *event = (ctsvc_event_s*)record;
        switch (property_id) {
        case CTSVC_PROPERTY_EVENT_IS_LEAP_MONTH: /* deprecated */
                *value = event->is_leap_month;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(0x%x) is not supported in value(event)", property_id);
+               ERR("property_id(0x%x) is not supported in value(event)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -3923,13 +3934,13 @@ static int __ctsvc_event_get_bool(contacts_record_h record, unsigned int propert
 
 static int __ctsvc_image_get_bool(contacts_record_h record, unsigned int property_id, bool *value)
 {
-       ctsvc_image_s *image = (ctsvc_image_s *)record;
+       ctsvc_image_s *image = (ctsvc_image_s*)record;
        switch (property_id) {
        case CTSVC_PROPERTY_IMAGE_IS_DEFAULT:
                *value = image->is_default;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(0x%x) is not supported in value(image)", property_id);
+               ERR("property_id(0x%x) is not supported in value(image)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -3937,13 +3948,13 @@ static int __ctsvc_image_get_bool(contacts_record_h record, unsigned int propert
 
 static int __ctsvc_address_get_bool(contacts_record_h record, unsigned int property_id, bool *value)
 {
-       ctsvc_address_s *address = (ctsvc_address_s *)record;
+       ctsvc_address_s *address = (ctsvc_address_s*)record;
        switch (property_id) {
        case CTSVC_PROPERTY_ADDRESS_IS_DEFAULT:
                *value = address->is_default;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(0x%x) is not supported in value(address)", property_id);
+               ERR("property_id(0x%x) is not supported in value(address)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -3951,9 +3962,9 @@ static int __ctsvc_address_get_bool(contacts_record_h record, unsigned int prope
 
 static int __ctsvc_contact_set_bool(contacts_record_h record, unsigned int property_id, bool value, bool *is_dirty)
 {
-       ctsvc_contact_s *contact = (ctsvc_contact_s *)record;
+       ctsvc_contact_s *contact = (ctsvc_contact_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_CONTACT_IS_FAVORITE:
                CHECK_DIRTY_VAL(contact->is_favorite, value, is_dirty);
                contact->is_favorite = value;
@@ -3966,12 +3977,12 @@ static int __ctsvc_contact_set_bool(contacts_record_h record, unsigned int prope
                CHECK_DIRTY_VAL(contact->has_email, value, is_dirty);
                contact->has_email = value;
                break;
-/*
-               CTS_ERR("Invalid parameter : property_id(%d) is a read-only value(contact)", property_id);
-               break;
-*/
+               /*
+                  ERR("property_id(%d) is a read-only value(contact)", property_id);
+                  break;
+                  */
        default:
-               CTS_ERR("Invalid parameter : property_id(0x%x) is not supported in value(contact)", property_id);
+               ERR("property_id(0x%x) is not supported in value(contact)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -3981,13 +3992,13 @@ static int __ctsvc_number_set_bool(contacts_record_h record, unsigned int proper
 {
        ctsvc_number_s *number = (ctsvc_number_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_NUMBER_IS_DEFAULT:
                CHECK_DIRTY_VAL(number->is_default, value, is_dirty);
                number->is_default = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(number)", property_id);
+               ERR("property_id(%d) is not supported in value(number)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -3995,15 +4006,15 @@ static int __ctsvc_number_set_bool(contacts_record_h record, unsigned int proper
 
 static int __ctsvc_email_set_bool(contacts_record_h record, unsigned int property_id, bool value, bool *is_dirty)
 {
-       ctsvc_email_s *email = (ctsvc_email_s *)record;
+       ctsvc_email_s *email = (ctsvc_email_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_EMAIL_IS_DEFAULT:
                CHECK_DIRTY_VAL(email->is_default, value, is_dirty);
                email->is_default = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(email)", property_id);
+               ERR("property_id(%d) is not supported in value(email)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -4011,15 +4022,15 @@ static int __ctsvc_email_set_bool(contacts_record_h record, unsigned int propert
 
 static int __ctsvc_event_set_bool(contacts_record_h record, unsigned int property_id, bool value, bool *is_dirty)
 {
-       ctsvc_event_s *event = (ctsvc_event_s *)record;
+       ctsvc_event_s *event = (ctsvc_event_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_EVENT_IS_LEAP_MONTH:
                CHECK_DIRTY_VAL(event->is_leap_month, value, is_dirty);
                event->is_leap_month = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(event)", property_id);
+               ERR("property_id(%d) is not supported in value(event)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -4027,15 +4038,15 @@ static int __ctsvc_event_set_bool(contacts_record_h record, unsigned int propert
 
 static int __ctsvc_image_set_bool(contacts_record_h record, unsigned int property_id, bool value, bool *is_dirty)
 {
-       ctsvc_image_s *image = (ctsvc_image_s *)record;
+       ctsvc_image_s *image = (ctsvc_image_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_IMAGE_IS_DEFAULT:
                CHECK_DIRTY_VAL(image->is_default, value, is_dirty);
                image->is_default = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(0x%x) is not supported in value(image)", property_id);
+               ERR("property_id(0x%x) is not supported in value(image)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -4043,15 +4054,15 @@ static int __ctsvc_image_set_bool(contacts_record_h record, unsigned int propert
 
 static int __ctsvc_address_set_bool(contacts_record_h record, unsigned int property_id, bool value, bool *is_dirty)
 {
-       ctsvc_address_s *address = (ctsvc_address_s *)record;
+       ctsvc_address_s *address = (ctsvc_address_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_ADDRESS_IS_DEFAULT:
                CHECK_DIRTY_VAL(address->is_default, value, is_dirty);
                address->is_default = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(address)", property_id);
+               ERR("property_id(%d) is not supported in value(address)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -4064,8 +4075,7 @@ static int __ctsvc_contact_clone(contacts_record_h record, contacts_record_h *ou
 
        src_data = (ctsvc_contact_s*)record;
        out_data = calloc(1, sizeof(ctsvc_contact_s));
-       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memeory : calloc(ctsvc_contact_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
+       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        out_data->id = src_data->id;
        out_data->person_id = src_data->person_id;
@@ -4139,7 +4149,7 @@ static int __ctsvc_contact_clone(contacts_record_h record, contacts_record_h *ou
 
        int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_record_copy_base() Fail");
+               ERR("ctsvc_record_copy_base() Fail");
                __ctsvc_contact_destroy((contacts_record_h)out_data, true);
                return ret;
        }
@@ -4157,8 +4167,7 @@ static int __ctsvc_activity_clone(contacts_record_h record, contacts_record_h *o
 
        src_data = (ctsvc_activity_s*)record;
        out_data = calloc(1, sizeof(ctsvc_activity_s));
-       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memeory : calloc(ctsvc_activity_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
+       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        out_data->id = src_data->id;
        out_data->contact_id = src_data->contact_id;
@@ -4173,7 +4182,7 @@ static int __ctsvc_activity_clone(contacts_record_h record, contacts_record_h *o
 
        int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_record_copy_base() Fail");
+               ERR("ctsvc_record_copy_base() Fail");
                __ctsvc_activity_destroy((contacts_record_h)out_data, true);
                return ret;
        }
@@ -4189,8 +4198,7 @@ static int __ctsvc_activity_photo_clone(contacts_record_h record, contacts_recor
 
        src_data = (ctsvc_activity_photo_s*)record;
        out_data = calloc(1, sizeof(ctsvc_activity_photo_s));
-       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memeory : calloc(ctsvc_activity_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
+       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        out_data->id = src_data->id;
        out_data->activity_id = src_data->activity_id;
@@ -4199,7 +4207,7 @@ static int __ctsvc_activity_photo_clone(contacts_record_h record, contacts_recor
 
        int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_record_copy_base() Fail");
+               ERR("ctsvc_record_copy_base() Fail");
                __ctsvc_activity_photo_destroy((contacts_record_h)out_data, true);
                return ret;
        }
@@ -4215,8 +4223,7 @@ static int __ctsvc_address_clone(contacts_record_h record, contacts_record_h *ou
 
        src_data = (ctsvc_address_s*)record;
        out_data = calloc(1, sizeof(ctsvc_address_s));
-       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memeory : calloc(ctsvc_address_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
+       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        out_data->id = src_data->id;
        out_data->contact_id = src_data->contact_id;
@@ -4233,7 +4240,7 @@ static int __ctsvc_address_clone(contacts_record_h record, contacts_record_h *ou
 
        int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_record_copy_base() Fail");
+               ERR("ctsvc_record_copy_base() Fail");
                __ctsvc_address_destroy((contacts_record_h)out_data, true);
                return ret;
        }
@@ -4249,8 +4256,7 @@ static int __ctsvc_company_clone(contacts_record_h record, contacts_record_h *ou
 
        src_data = (ctsvc_company_s*)record;
        out_data = calloc(1, sizeof(ctsvc_company_s));
-       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memeory : calloc(ctsvc_company_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
+       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        out_data->id = src_data->id;
        out_data->contact_id = src_data->contact_id;
@@ -4272,7 +4278,7 @@ static int __ctsvc_company_clone(contacts_record_h record, contacts_record_h *ou
 
        int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_record_copy_base() Fail");
+               ERR("ctsvc_record_copy_base() Fail");
                __ctsvc_company_destroy((contacts_record_h)out_data, true);
                return ret;
        }
@@ -4288,8 +4294,7 @@ static int __ctsvc_email_clone(contacts_record_h record, contacts_record_h *out_
 
        src_data = (ctsvc_email_s*)record;
        out_data = calloc(1, sizeof(ctsvc_email_s));
-       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memeory : calloc(ctsvc_email_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
+       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        out_data->id = src_data->id;
        out_data->is_default = src_data->is_default;
@@ -4300,7 +4305,7 @@ static int __ctsvc_email_clone(contacts_record_h record, contacts_record_h *out_
 
        int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_record_copy_base() Fail");
+               ERR("ctsvc_record_copy_base() Fail");
                __ctsvc_email_destroy((contacts_record_h)out_data, true);
                return ret;
        }
@@ -4316,8 +4321,7 @@ static int __ctsvc_event_clone(contacts_record_h record, contacts_record_h *out_
 
        src_data = (ctsvc_event_s*)record;
        out_data = calloc(1, sizeof(ctsvc_event_s));
-       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memeory : calloc(ctsvc_event_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
+       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        out_data->id = src_data->id;
        out_data->contact_id = src_data->contact_id;
@@ -4329,7 +4333,7 @@ static int __ctsvc_event_clone(contacts_record_h record, contacts_record_h *out_
 
        int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_record_copy_base() Fail");
+               ERR("ctsvc_record_copy_base() Fail");
                __ctsvc_event_destroy((contacts_record_h)out_data, true);
                return ret;
        }
@@ -4345,8 +4349,7 @@ static int __ctsvc_extension_clone(contacts_record_h record, contacts_record_h *
 
        src_data = (ctsvc_extension_s*)record;
        out_data = calloc(1, sizeof(ctsvc_extension_s));
-       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memeory : calloc(ctsvc_extension_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
+       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        out_data->id = src_data->id;
        out_data->contact_id = src_data->contact_id;
@@ -4366,7 +4369,7 @@ static int __ctsvc_extension_clone(contacts_record_h record, contacts_record_h *
 
        int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_record_copy_base() Fail");
+               ERR("ctsvc_record_copy_base() Fail");
                __ctsvc_extension_destroy((contacts_record_h)out_data, true);
                return ret;
        }
@@ -4382,8 +4385,7 @@ static int __ctsvc_group_relation_clone(contacts_record_h record, contacts_recor
 
        src_data = (ctsvc_group_relation_s*)record;
        out_data = calloc(1, sizeof(ctsvc_group_relation_s));
-       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memeory : calloc(ctsvc_group_relation_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
+       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        out_data->id = src_data->id;
        out_data->group_id = src_data->group_id;
@@ -4392,7 +4394,7 @@ static int __ctsvc_group_relation_clone(contacts_record_h record, contacts_recor
 
        int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_record_copy_base() Fail");
+               ERR("ctsvc_record_copy_base() Fail");
                __ctsvc_group_relation_destroy((contacts_record_h)out_data, true);
                return ret;
        }
@@ -4408,8 +4410,7 @@ static int __ctsvc_messenger_clone(contacts_record_h record, contacts_record_h *
 
        src_data = (ctsvc_messenger_s*)record;
        out_data = calloc(1, sizeof(ctsvc_messenger_s));
-       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memeory : calloc(ctsvc_messenger_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
+       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        out_data->id = src_data->id;
        out_data->contact_id = src_data->contact_id;
@@ -4419,7 +4420,7 @@ static int __ctsvc_messenger_clone(contacts_record_h record, contacts_record_h *
 
        int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_record_copy_base() Fail");
+               ERR("ctsvc_record_copy_base() Fail");
                __ctsvc_messenger_destroy((contacts_record_h)out_data, true);
                return ret;
        }
@@ -4434,13 +4435,13 @@ static int __ctsvc_name_clone(contacts_record_h record, contacts_record_h *out_r
        ctsvc_name_s *src_data = NULL;
 
        src_data = (ctsvc_name_s*)record;
+
        out_data = calloc(1, sizeof(ctsvc_name_s));
-       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memeory : calloc(ctsvc_name_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
+       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        out_data->is_default = src_data->is_default;
        out_data->id = src_data->id;
-       out_data->contact_id= src_data->contact_id;
+       out_data->contact_id = src_data->contact_id;
        out_data->language_type = src_data->language_type;
        out_data->first = SAFE_STRDUP(src_data->first);
        out_data->last = SAFE_STRDUP(src_data->last);
@@ -4455,7 +4456,7 @@ static int __ctsvc_name_clone(contacts_record_h record, contacts_record_h *out_r
 
        int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_record_copy_base() Fail");
+               ERR("ctsvc_record_copy_base() Fail");
                __ctsvc_name_destroy((contacts_record_h)out_data, true);
                return ret;
        }
@@ -4471,8 +4472,7 @@ static int __ctsvc_nickname_clone(contacts_record_h record, contacts_record_h *o
 
        src_data = (ctsvc_nickname_s*)record;
        out_data = calloc(1, sizeof(ctsvc_nickname_s));
-       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memeory : calloc(ctsvc_nickname_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
+       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        out_data->id = src_data->id;
        out_data->contact_id = src_data->contact_id;
@@ -4482,7 +4482,7 @@ static int __ctsvc_nickname_clone(contacts_record_h record, contacts_record_h *o
 
        int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_record_copy_base() Fail");
+               ERR("ctsvc_record_copy_base() Fail");
                __ctsvc_nickname_destroy((contacts_record_h)out_data, true);
                return ret;
        }
@@ -4498,8 +4498,7 @@ static int __ctsvc_note_clone(contacts_record_h record, contacts_record_h *out_r
 
        src_data = (ctsvc_note_s*)record;
        out_data = calloc(1, sizeof(ctsvc_note_s));
-       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memeory : calloc(ctsvc_note_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
+       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        out_data->id = src_data->id;
        out_data->contact_id = src_data->contact_id;
@@ -4507,7 +4506,7 @@ static int __ctsvc_note_clone(contacts_record_h record, contacts_record_h *out_r
 
        int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_record_copy_base() Fail");
+               ERR("ctsvc_record_copy_base() Fail");
                __ctsvc_note_destroy((contacts_record_h)out_data, true);
                return ret;
        }
@@ -4523,8 +4522,7 @@ static int __ctsvc_number_clone(contacts_record_h record, contacts_record_h *out
 
        src_data = (ctsvc_number_s*)record;
        out_data = calloc(1, sizeof(ctsvc_number_s));
-       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memeory : calloc(ctsvc_number_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
+       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        out_data->is_default = src_data->is_default;
        out_data->id = src_data->id;
@@ -4536,7 +4534,7 @@ static int __ctsvc_number_clone(contacts_record_h record, contacts_record_h *out
 
        int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_record_copy_base() Fail");
+               ERR("ctsvc_record_copy_base() Fail");
                __ctsvc_number_destroy((contacts_record_h)out_data, true);
                return ret;
        }
@@ -4552,8 +4550,7 @@ static int __ctsvc_profile_clone(contacts_record_h record, contacts_record_h *ou
 
        src_data = (ctsvc_profile_s*)record;
        out_data = calloc(1, sizeof(ctsvc_profile_s));
-       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memeory : calloc(ctsvc_profile_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
+       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        out_data->id = src_data->id;
        out_data->contact_id = src_data->contact_id;
@@ -4569,7 +4566,7 @@ static int __ctsvc_profile_clone(contacts_record_h record, contacts_record_h *ou
 
        int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_record_copy_base() Fail");
+               ERR("ctsvc_record_copy_base() Fail");
                __ctsvc_profile_destroy((contacts_record_h)out_data, true);
                return ret;
        }
@@ -4586,8 +4583,7 @@ static int __ctsvc_relationship_clone(contacts_record_h record, contacts_record_
 
        src_data = (ctsvc_relationship_s*)record;
        out_data = calloc(1, sizeof(ctsvc_relationship_s));
-       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memeory : calloc(ctsvc_relationship_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
+       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        out_data->id = src_data->id;
        out_data->contact_id = src_data->contact_id;
@@ -4597,7 +4593,7 @@ static int __ctsvc_relationship_clone(contacts_record_h record, contacts_record_
 
        int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_record_copy_base() Fail");
+               ERR("ctsvc_record_copy_base() Fail");
                __ctsvc_relationship_destroy((contacts_record_h)out_data, true);
                return ret;
        }
@@ -4613,8 +4609,7 @@ static int __ctsvc_image_clone(contacts_record_h record, contacts_record_h *out_
 
        src_data = (ctsvc_image_s*)record;
        out_data = calloc(1, sizeof(ctsvc_image_s));
-       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memeory : calloc(ctsvc_image_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
+       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        out_data->is_default = src_data->is_default;
        out_data->id = src_data->id;
@@ -4628,7 +4623,7 @@ static int __ctsvc_image_clone(contacts_record_h record, contacts_record_h *out_
 
        int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_record_copy_base() Fail");
+               ERR("ctsvc_record_copy_base() Fail");
                __ctsvc_image_destroy((contacts_record_h)out_data, true);
                return ret;
        }
@@ -4644,8 +4639,7 @@ static int __ctsvc_simple_contact_clone(contacts_record_h record, contacts_recor
 
        src_data = (ctsvc_simple_contact_s*)record;
        out_data = calloc(1, sizeof(ctsvc_simple_contact_s));
-       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memeory : calloc(ctsvc_simple_contact_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
+       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        out_data->contact_id = src_data->contact_id;
        out_data->person_id = src_data->person_id;
@@ -4665,7 +4659,7 @@ static int __ctsvc_simple_contact_clone(contacts_record_h record, contacts_recor
 
        int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_record_copy_base() Fail");
+               ERR("ctsvc_record_copy_base() Fail");
                __ctsvc_simple_contact_destroy((contacts_record_h)out_data, true);
                return ret;
        }
@@ -4681,8 +4675,7 @@ static int __ctsvc_url_clone(contacts_record_h record, contacts_record_h *out_re
 
        src_data = (ctsvc_url_s*)record;
        out_data = calloc(1, sizeof(ctsvc_url_s));
-       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memeory : calloc(ctsvc_url_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
+       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        out_data->id = src_data->id;
        out_data->contact_id = src_data->contact_id;
@@ -4692,7 +4685,7 @@ static int __ctsvc_url_clone(contacts_record_h record, contacts_record_h *out_re
 
        int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_record_copy_base() Fail");
+               ERR("ctsvc_record_copy_base() Fail");
                __ctsvc_url_destroy((contacts_record_h)out_data, true);
                return ret;
        }
index 4a2e333..484628a 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
@@ -30,11 +26,11 @@ static int __ctsvc_group_create(contacts_record_h *out_record);
 static int __ctsvc_group_destroy(contacts_record_h record, bool delete_child);
 static int __ctsvc_group_clone(contacts_record_h record, contacts_record_h *out_record);
 static int __ctsvc_group_get_int(contacts_record_h record, unsigned int property_id, int *out);
-static int __ctsvc_group_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_group_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_group_get_str(contacts_record_h record, unsigned int property_id, char **out_str);
+static int __ctsvc_group_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str);
 static int __ctsvc_group_get_bool(contacts_record_h record, unsigned int property_id, bool *value);
 static int __ctsvc_group_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
-static int __ctsvc_group_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty);
+static int __ctsvc_group_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty);
 static int __ctsvc_group_set_bool(contacts_record_h record, unsigned int property_id, bool value, bool *is_dirty);
 
 
@@ -64,9 +60,8 @@ static int __ctsvc_group_create(contacts_record_h *out_record)
 {
        ctsvc_group_s *group;
 
-       group = (ctsvc_group_s*)calloc(1, sizeof(ctsvc_group_s));
-       RETVM_IF(NULL == group, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "calloc is Fail");
+       group = calloc(1, sizeof(ctsvc_group_s));
+       RETVM_IF(NULL == group, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        *out_record = (contacts_record_h)group;
        return CONTACTS_ERROR_NONE;
@@ -97,8 +92,8 @@ static int __ctsvc_group_clone(contacts_record_h record, contacts_record_h *out_
        src_data = (ctsvc_group_s*)record;
        out_data = calloc(1, sizeof(ctsvc_group_s));
        RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
-               "Out of memeory : calloc(ctsvc_group_s) Fail(%d)",
-               CONTACTS_ERROR_OUT_OF_MEMORY);
+                       "Out of memeory : calloc(ctsvc_group_s) Fail(%d)",
+                       CONTACTS_ERROR_OUT_OF_MEMORY);
 
        out_data->id = src_data->id;
        out_data->addressbook_id = src_data->addressbook_id;
@@ -112,7 +107,7 @@ static int __ctsvc_group_clone(contacts_record_h record, contacts_record_h *out_
 
        int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_record_copy_base() Fail");
+               ERR("ctsvc_record_copy_base() Fail");
                __ctsvc_group_destroy((contacts_record_h)out_data, true);
                return ret;
        }
@@ -125,7 +120,7 @@ static int __ctsvc_group_get_int(contacts_record_h record, unsigned int property
 {
        ctsvc_group_s *group = (ctsvc_group_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_GROUP_ID:
                *out = group->id;
                break;
@@ -133,17 +128,17 @@ static int __ctsvc_group_get_int(contacts_record_h record, unsigned int property
                *out = group->addressbook_id;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(group)", property_id);
+               ERR("property_id(%d) is not supported in value(group)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_group_get_str_real(contacts_record_h record, unsigned int property_id, char** out_str, bool copy)
+static int __ctsvc_group_get_str_real(contacts_record_h record, unsigned int property_id, char **out_str, bool copy)
 {
        ctsvc_group_s *group = (ctsvc_group_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_GROUP_NAME:
                *out_str = GET_STR(copy, group->name);
                break;
@@ -162,19 +157,19 @@ static int __ctsvc_group_get_str_real(contacts_record_h record, unsigned int pro
        case CTSVC_PROPERTY_GROUP_EXTRA_DATA:
                *out_str = GET_STR(copy, group->extra_data);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(group)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(group)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_group_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_group_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_group_get_str_real(record, property_id, out_str, false);
 }
 
-static int __ctsvc_group_get_str(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_group_get_str(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_group_get_str_real(record, property_id, out_str, true);
 }
@@ -183,29 +178,29 @@ static int __ctsvc_group_set_int(contacts_record_h record, unsigned int property
 {
        ctsvc_group_s *group = (ctsvc_group_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_GROUP_ID:
                CHECK_DIRTY_VAL(group->id, value, is_dirty);
                group->id = value;
                break;
        case CTSVC_PROPERTY_GROUP_ADDRESSBOOK_ID:
                RETVM_IF(0 < group->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is a read-only value (group)", property_id);
+                               "property_id(%d) is a read-only value (group)", property_id);
                CHECK_DIRTY_VAL(group->addressbook_id, value, is_dirty);
                group->addressbook_id = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(group)", property_id);
+               ERR("property_id(%d) is not supported in value(group)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_group_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty)
+static int __ctsvc_group_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty)
 {
        ctsvc_group_s *group = (ctsvc_group_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_GROUP_NAME:
                CHECK_DIRTY_STR(group->name, str, is_dirty);
                FREEandSTRDUP(group->name, str);
@@ -230,8 +225,8 @@ static int __ctsvc_group_set_str(contacts_record_h record, unsigned int property
                CHECK_DIRTY_STR(group->extra_data, str, is_dirty);
                FREEandSTRDUP(group->extra_data, str);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(group)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(group)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -245,7 +240,7 @@ static int __ctsvc_group_get_bool(contacts_record_h record, unsigned int propert
                *value = group->is_read_only;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(group)", property_id);
+               ERR("property_id(%d) is not supported in value(group)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -255,15 +250,15 @@ static int __ctsvc_group_set_bool(contacts_record_h record, unsigned int propert
 {
        ctsvc_group_s *group = (ctsvc_group_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_GROUP_IS_READ_ONLY:
                RETVM_IF(0 < group->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is a read-only value (group)", property_id);
+                               "property_id(%d) is a read-only value (group)", property_id);
                CHECK_DIRTY_VAL(group->is_read_only, value, is_dirty);
                group->is_read_only = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(group)", property_id);
+               ERR("property_id(%d) is not supported in value(group)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
index 5a002a0..ad9a21f 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
@@ -31,12 +27,12 @@ static int __ctsvc_my_profile_create(contacts_record_h *out_record);
 static int __ctsvc_my_profile_destroy(contacts_record_h record, bool delete_child);
 static int __ctsvc_my_profile_clone(contacts_record_h record, contacts_record_h *out_record);
 static int __ctsvc_my_profile_get_int(contacts_record_h record, unsigned int property_id, int *out);
-static int __ctsvc_my_profile_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_my_profile_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_my_profile_get_str(contacts_record_h record, unsigned int property_id, char **out_str);
+static int __ctsvc_my_profile_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str);
 static int __ctsvc_my_profile_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
-static int __ctsvc_my_profile_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty);
-static int __ctsvc_my_profile_clone_child_record_list(contacts_record_h record, unsigned int property_id, contacts_list_hout_list);
-static int __ctsvc_my_profile_get_child_record_at_p(contacts_record_h record, unsigned int property_id, int index, contacts_record_hout_record);
+static int __ctsvc_my_profile_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty);
+static int __ctsvc_my_profile_clone_child_record_list(contacts_record_h record, unsigned int property_id, contacts_list_h *out_list);
+static int __ctsvc_my_profile_get_child_record_at_p(contacts_record_h record, unsigned int property_id, int index, contacts_record_h *out_record);
 static int __ctsvc_my_profile_get_child_record_count(contacts_record_h record, unsigned int property_id, int *count);
 static int __ctsvc_my_profile_add_child_record(contacts_record_h record, unsigned int property_id, contacts_record_h child_record);
 static int __ctsvc_my_profile_remove_child_record(contacts_record_h record, unsigned int property_id, contacts_record_h child_record);
@@ -69,7 +65,7 @@ static int __ctsvc_my_profile_create(contacts_record_h *out_record)
 
        my_profile = calloc(1, sizeof(ctsvc_my_profile_s));
        RETVM_IF(NULL == my_profile, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memory : calloc is Fail");
+                       "calloc() Fail");
 
        do {
                my_profile->name = calloc(1, sizeof(ctsvc_list_s));
@@ -146,7 +142,7 @@ static int __ctsvc_my_profile_create(contacts_record_h *out_record)
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("calloc() Fail");
+       ERR("calloc() Fail");
        free(my_profile->extensions);
        free(my_profile->images);
        free(my_profile->relationships);
@@ -168,7 +164,9 @@ static int __ctsvc_my_profile_create(contacts_record_h *out_record)
 static int __ctsvc_my_profile_destroy(contacts_record_h record, bool delete_child)
 {
        ctsvc_my_profile_s *my_profile = (ctsvc_my_profile_s*)record;
-       my_profile->base.plugin_cbs = NULL; /* help to find double destroy bug (refer to the contacts_record_destroy) */
+
+       /* help to find double destroy bug (refer to the contacts_record_destroy) */
+       my_profile->base.plugin_cbs = NULL;
        free(my_profile->base.properties_flags);
 
        free(my_profile->display_name);
@@ -211,9 +209,9 @@ static int __ctsvc_my_profile_destroy(contacts_record_h record, bool delete_chil
 
 static int __ctsvc_my_profile_get_int(contacts_record_h record, unsigned int property_id, int *out)
 {
-       ctsvc_my_profile_s *my_profile = (ctsvc_my_profile_s *)record;
+       ctsvc_my_profile_s *my_profile = (ctsvc_my_profile_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_MY_PROFILE_ID:
                *out = my_profile->id;
                break;
@@ -224,7 +222,7 @@ static int __ctsvc_my_profile_get_int(contacts_record_h record, unsigned int pro
                *out = my_profile->changed_time;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(my_profile)", property_id);
+               ERR("property_id(%d) is not supported in value(my_profile)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -232,9 +230,9 @@ static int __ctsvc_my_profile_get_int(contacts_record_h record, unsigned int pro
 
 static int __ctsvc_my_profile_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty)
 {
-       ctsvc_my_profile_s *my_profile = (ctsvc_my_profile_s *)record;
+       ctsvc_my_profile_s *my_profile = (ctsvc_my_profile_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_MY_PROFILE_ID:
                CHECK_DIRTY_VAL(my_profile->id, value, is_dirty);
                my_profile->id = value;
@@ -245,21 +243,22 @@ static int __ctsvc_my_profile_set_int(contacts_record_h record, unsigned int pro
                break;
        case CTSVC_PROPERTY_MY_PROFILE_ADDRESSBOOK_ID:
                RETVM_IF(0 < my_profile->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is a read-only value (my_profile)", property_id);
+                               "property_id(%d) is a read-only value (my_profile)", property_id);
                CHECK_DIRTY_VAL(my_profile->addressbook_id, value, is_dirty);
                my_profile->addressbook_id = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in valuecontact)", property_id);
+               ERR("property_id(%d) is not supported in valuecontact)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_my_profile_get_str_real(contacts_record_h record, unsigned int property_id, char** out_str, bool copy)
+static int __ctsvc_my_profile_get_str_real(contacts_record_h record,
+               unsigned int property_id, char **out_str, bool copy)
 {
        ctsvc_my_profile_s *my_profile = (ctsvc_my_profile_s*)record;
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_MY_PROFILE_DISPLAY_NAME:
                *out_str = GET_STR(copy, my_profile->display_name);
                break;
@@ -269,19 +268,21 @@ static int __ctsvc_my_profile_get_str_real(contacts_record_h record, unsigned in
        case CTSVC_PROPERTY_MY_PROFILE_UID:
                *out_str = GET_STR(copy, my_profile->uid);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(my_profile)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(my_profile)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_my_profile_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_my_profile_get_str_p(contacts_record_h record,
+               unsigned int property_id, char **out_str)
 {
        return __ctsvc_my_profile_get_str_real(record, property_id, out_str, false);
 }
 
-static int __ctsvc_my_profile_get_str(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_my_profile_get_str(contacts_record_h record, unsigned int property_id,
+               char **out_str)
 {
        return __ctsvc_my_profile_get_str_real(record, property_id, out_str, true);
 }
@@ -289,9 +290,9 @@ static int __ctsvc_my_profile_get_str(contacts_record_h record, unsigned int pro
 static int __ctsvc_my_profile_get_record_list_p(contacts_record_h record,
                unsigned int property_id, contacts_list_h *list)
 {
-       ctsvc_my_profile_s *contact = (ctsvc_my_profile_s *)record;
+       ctsvc_my_profile_s *contact = (ctsvc_my_profile_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_MY_PROFILE_NAME:
                *list = (contacts_list_h)contact->name;
                break;
@@ -334,8 +335,8 @@ static int __ctsvc_my_profile_get_record_list_p(contacts_record_h record,
        case CTSVC_PROPERTY_MY_PROFILE_EXTENSION:
                *list = (contacts_list_h)contact->extensions;
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(contact)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(contact)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -359,7 +360,7 @@ static int __ctsvc_my_profile_get_child_record_count(contacts_record_h record,
 }
 
 static int __ctsvc_my_profile_get_child_record_at_p(contacts_record_h record,
-               unsigned int property_id, int index, contacts_record_hout_record)
+               unsigned int property_id, int index, contacts_record_h *out_record)
 {
        int ret;
        int count;
@@ -371,18 +372,16 @@ static int __ctsvc_my_profile_get_child_record_at_p(contacts_record_h record,
 
        contacts_list_get_count(list, &count);
        if (count < index) {
-               CTS_ERR("The index(%d) is greather than total length(%d)", index, count);
+               ERR("The index(%d) is greather than total length(%d)", index, count);
                *out_record = NULL;
                return CONTACTS_ERROR_NO_DATA;
-       }
-       else
+       } else {
                return ctsvc_list_get_nth_record_p(list, index, out_record);
-
-       return CONTACTS_ERROR_NONE;
+       }
 }
 
 static int __ctsvc_my_profile_clone_child_record_list(contacts_record_h record,
-               unsigned int property_id, contacts_list_hout_list)
+               unsigned int property_id, contacts_list_h *out_list)
 {
        int ret;
        int count;
@@ -406,57 +405,57 @@ static int __ctsvc_my_profile_reset_child_record_id(contacts_record_h child_reco
 {
        ctsvc_record_s *record = (ctsvc_record_s*)child_record;
 
-       switch(record->r_type) {
+       switch (record->r_type) {
        case CTSVC_RECORD_NAME:
-               ((ctsvc_name_s *)record)->id = 0;
+               ((ctsvc_name_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_COMPANY:
-               ((ctsvc_company_s *)record)->id = 0;
+               ((ctsvc_company_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_NOTE:
-               ((ctsvc_note_s *)record)->id = 0;
+               ((ctsvc_note_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_NUMBER:
-               ((ctsvc_number_s *)record)->id = 0;
+               ((ctsvc_number_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_EMAIL:
-               ((ctsvc_email_s *)record)->id = 0;
+               ((ctsvc_email_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_URL:
-               ((ctsvc_url_s *)record)->id = 0;
+               ((ctsvc_url_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_EVENT:
-               ((ctsvc_event_s *)record)->id = 0;
+               ((ctsvc_event_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_NICKNAME:
-               ((ctsvc_nickname_s *)record)->id = 0;
+               ((ctsvc_nickname_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_ADDRESS:
-               ((ctsvc_address_s *)record)->id = 0;
+               ((ctsvc_address_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_MESSENGER:
-               ((ctsvc_messenger_s *)record)->id = 0;
+               ((ctsvc_messenger_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_GROUP_RELATION:
-               ((ctsvc_group_relation_s *)record)->id = 0;
+               ((ctsvc_group_relation_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_ACTIVITY:
-               ((ctsvc_activity_s *)record)->id = 0;
+               ((ctsvc_activity_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_PROFILE:
-               ((ctsvc_profile_s *)record)->id = 0;
+               ((ctsvc_profile_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_RELATIONSHIP:
-               ((ctsvc_relationship_s *)record)->id = 0;
+               ((ctsvc_relationship_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_IMAGE:
-               ((ctsvc_image_s *)record)->id = 0;
+               ((ctsvc_image_s*)record)->id = 0;
                break;
        case CTSVC_RECORD_EXTENSION:
-               ((ctsvc_extension_s *)record)->id = 0;
+               ((ctsvc_extension_s*)record)->id = 0;
                break;
-       default :
-               CTS_ERR("Invalid parameter : record(%d) is not child of contact", record->r_type);
+       default:
+               ERR("record(%d) is not child of contact", record->r_type);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -468,19 +467,19 @@ static int __ctsvc_my_profile_add_child_record(contacts_record_h record,
 {
        int ret;
        contacts_list_h list = NULL;
-       ctsvc_record_s *s_record = (ctsvc_record_s *)child_record;
+       ctsvc_record_s *s_record = (ctsvc_record_s*)child_record;
 
        ret = __ctsvc_my_profile_get_record_list_p(record, property_id, &list);
        if (CONTACTS_ERROR_INVALID_PARAMETER == ret)
                return ret;
 
-       if (CTSVC_RECORD_NAME == s_record->r_type && 1 == ((ctsvc_list_s *)list)->count) {
-               CTS_ERR("This type(%d) of child_record can not be added anymore", s_record->r_type);
+       if (CTSVC_RECORD_NAME == s_record->r_type && 1 == ((ctsvc_list_s*)list)->count) {
+               ERR("This type(%d) of child_record can not be added anymore", s_record->r_type);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
-       if (CTSVC_RECORD_IMAGE == s_record->r_type && 1 == ((ctsvc_list_s *)list)->count) {
-               CTS_ERR("This type(%d) of child_record can not be added anymore", s_record->r_type);
+       if (CTSVC_RECORD_IMAGE == s_record->r_type && 1 == ((ctsvc_list_s*)list)->count) {
+               ERR("This type(%d) of child_record can not be added anymore", s_record->r_type);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
@@ -497,41 +496,41 @@ static int __ctsvc_my_profile_get_child_record_id(contacts_record_h child_record
 {
        ctsvc_record_s *record = (ctsvc_record_s*)child_record;
 
-       switch(record->r_type) {
+       switch (record->r_type) {
        case CTSVC_RECORD_NAME:
-               return ((ctsvc_name_s *)record)->id;
+               return ((ctsvc_name_s*)record)->id;
        case CTSVC_RECORD_COMPANY:
-               return ((ctsvc_company_s *)record)->id;
+               return ((ctsvc_company_s*)record)->id;
        case CTSVC_RECORD_NOTE:
-               return ((ctsvc_note_s *)record)->id;
+               return ((ctsvc_note_s*)record)->id;
        case CTSVC_RECORD_NUMBER:
-               return ((ctsvc_number_s *)record)->id;
+               return ((ctsvc_number_s*)record)->id;
        case CTSVC_RECORD_EMAIL:
-               return ((ctsvc_email_s *)record)->id;
+               return ((ctsvc_email_s*)record)->id;
        case CTSVC_RECORD_URL:
-               return ((ctsvc_url_s *)record)->id;
+               return ((ctsvc_url_s*)record)->id;
        case CTSVC_RECORD_EVENT:
-               return ((ctsvc_event_s *)record)->id;
+               return ((ctsvc_event_s*)record)->id;
        case CTSVC_RECORD_NICKNAME:
-               return ((ctsvc_nickname_s *)record)->id;
+               return ((ctsvc_nickname_s*)record)->id;
        case CTSVC_RECORD_ADDRESS:
-               return ((ctsvc_address_s *)record)->id;
+               return ((ctsvc_address_s*)record)->id;
        case CTSVC_RECORD_MESSENGER:
-               return ((ctsvc_messenger_s *)record)->id;
+               return ((ctsvc_messenger_s*)record)->id;
        case CTSVC_RECORD_GROUP_RELATION:
-               return ((ctsvc_group_relation_s *)record)->id;
+               return ((ctsvc_group_relation_s*)record)->id;
        case CTSVC_RECORD_ACTIVITY:
-               return ((ctsvc_activity_s *)record)->id;
+               return ((ctsvc_activity_s*)record)->id;
        case CTSVC_RECORD_PROFILE:
-               return ((ctsvc_profile_s *)record)->id;
+               return ((ctsvc_profile_s*)record)->id;
        case CTSVC_RECORD_RELATIONSHIP:
-               return ((ctsvc_relationship_s *)record)->id;
+               return ((ctsvc_relationship_s*)record)->id;
        case CTSVC_RECORD_IMAGE:
-               return ((ctsvc_image_s *)record)->id;
+               return ((ctsvc_image_s*)record)->id;
        case CTSVC_RECORD_EXTENSION:
-               return ((ctsvc_extension_s *)record)->id;
-       default :
-               CTS_ERR("Invalid parameter : record(%d) is not child of contact", record->r_type);
+               return ((ctsvc_extension_s*)record)->id;
+       default:
+               ERR("record(%d) is not child of contact", record->r_type);
                return 0;
        }
        return 0;
@@ -550,16 +549,17 @@ static int __ctsvc_my_profile_remove_child_record(contacts_record_h record,
                return ret;
 
        id = __ctsvc_my_profile_get_child_record_id(child_record);
-       ctsvc_list_remove_child(list, child_record, (id?true:false));
+       ctsvc_list_remove_child(list, child_record, id ? true : false);
 
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_my_profile_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty )
+static int __ctsvc_my_profile_set_str(contacts_record_h record, unsigned int property_id,
+               const char *str, bool *is_dirty)
 {
-       ctsvc_my_profile_s *my_profile = (ctsvc_my_profile_s *)record;
+       ctsvc_my_profile_s *my_profile = (ctsvc_my_profile_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_MY_PROFILE_DISPLAY_NAME:
                CHECK_DIRTY_STR(my_profile->display_name, str, is_dirty);
                FREEandSTRDUP(my_profile->display_name, str);
@@ -572,22 +572,22 @@ static int __ctsvc_my_profile_set_str(contacts_record_h record, unsigned int pro
                CHECK_DIRTY_STR(my_profile->uid, str, is_dirty);
                FREEandSTRDUP(my_profile->uid, str);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(my_profile)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(my_profile)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_my_profile_clone(contacts_record_h record, contacts_record_h *out_record)
+static int __ctsvc_my_profile_clone(contacts_record_h record,
+               contacts_record_h *out_record)
 {
        ctsvc_my_profile_s *out_data = NULL;
        ctsvc_my_profile_s *src_data = NULL;
 
        src_data = (ctsvc_my_profile_s*)record;
        out_data = calloc(1, sizeof(ctsvc_my_profile_s));
-       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memeory : calloc(ctsvc_my_profile_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
+       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        out_data->id = src_data->id;
        out_data->addressbook_id = src_data->addressbook_id;
@@ -642,7 +642,7 @@ static int __ctsvc_my_profile_clone(contacts_record_h record, contacts_record_h
 
        int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_record_copy_base() Fail");
+               ERR("ctsvc_record_copy_base() Fail");
                __ctsvc_my_profile_destroy((contacts_record_h)out_data, true);
                return ret;
        }
index 1a31ed3..4f8ebab 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
 #include "ctsvc_record.h"
 #include "ctsvc_view.h"
 
-static int __ctsvc_person_create(contacts_record_hout_record);
+static int __ctsvc_person_create(contacts_record_h *out_record);
 static int __ctsvc_person_destroy(contacts_record_h record, bool delete_child);
 static int __ctsvc_person_clone(contacts_record_h record, contacts_record_h *out_record);
 static int __ctsvc_person_get_int(contacts_record_h record, unsigned int property_id, int *out);
-static int __ctsvc_person_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_person_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_person_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str);
+static int __ctsvc_person_get_str(contacts_record_h record, unsigned int property_id, char **out_str);
 static int __ctsvc_person_get_bool(contacts_record_h record, unsigned int property_id, bool *value);
 static int __ctsvc_person_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
-static int __ctsvc_person_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty);
+static int __ctsvc_person_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty);
 static int __ctsvc_person_set_bool(contacts_record_h record, unsigned int property_id, bool value, bool *is_dirty);
 
 ctsvc_record_plugin_cb_s person_plugin_cbs = {
@@ -55,12 +55,11 @@ ctsvc_record_plugin_cb_s person_plugin_cbs = {
        .clone_child_record_list = NULL,
 };
 
-static int __ctsvc_person_create(contacts_record_hout_record)
+static int __ctsvc_person_create(contacts_record_h *out_record)
 {
        ctsvc_person_s *person;
-       person = (ctsvc_person_s*)calloc(1, sizeof(ctsvc_person_s));
-       RETVM_IF(NULL == person, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memory : calloc is Fail");
+       person = calloc(1, sizeof(ctsvc_person_s));
+       RETVM_IF(NULL == person, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        *out_record = (contacts_record_h)person;
        return CONTACTS_ERROR_NONE;
@@ -69,9 +68,11 @@ static int __ctsvc_person_create(contacts_record_h* out_record)
 static int __ctsvc_person_destroy(contacts_record_h record, bool delete_child)
 {
        ctsvc_person_s *person = (ctsvc_person_s*)record;
-       person->base.plugin_cbs = NULL; /* help to find double-destroy bug (refer to the contacts_record_destroy) */
-       free(person->base.properties_flags);
 
+       /* help to find double-destroy bug (refer to the contacts_record_destroy) */
+       person->base.plugin_cbs = NULL;
+
+       free(person->base.properties_flags);
        free(person->display_name);
        free(person->display_name_index);
        free(person->ringtone_path);
@@ -87,13 +88,12 @@ static int __ctsvc_person_destroy(contacts_record_h record, bool delete_child)
 
 static int __ctsvc_person_clone(contacts_record_h record, contacts_record_h *out_record)
 {
-    ctsvc_person_s *out_data = NULL;
-    ctsvc_person_s *src_data = NULL;
+       ctsvc_person_s *out_data = NULL;
+       ctsvc_person_s *src_data = NULL;
 
-    src_data = (ctsvc_person_s*)record;
-    out_data = calloc(1, sizeof(ctsvc_person_s));
-    RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
-                        "Out of memeory : calloc(ctsvc_person_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
+       src_data = (ctsvc_person_s*)record;
+       out_data = calloc(1, sizeof(ctsvc_person_s));
+       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        out_data->is_favorite = src_data->is_favorite;
        out_data->has_phonenumber = src_data->has_phonenumber;
@@ -112,7 +112,7 @@ static int __ctsvc_person_clone(contacts_record_h record, contacts_record_h *out
 
        int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_record_copy_base() Fail");
+               ERR("ctsvc_record_copy_base() Fail");
                __ctsvc_person_destroy((contacts_record_h)out_data, true);
                return ret;
        }
@@ -121,10 +121,11 @@ static int __ctsvc_person_clone(contacts_record_h record, contacts_record_h *out
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_person_get_int(contacts_record_h record, unsigned int property_id, int *out)
+static int __ctsvc_person_get_int(contacts_record_h record, unsigned int property_id,
+               int *out)
 {
-       ctsvc_person_s *person = (ctsvc_person_s *)record;
-       switch(property_id) {
+       ctsvc_person_s *person = (ctsvc_person_s*)record;
+       switch (property_id) {
        case CTSVC_PROPERTY_PERSON_ID:
                *out = person->person_id;
                break;
@@ -135,16 +136,17 @@ static int __ctsvc_person_get_int(contacts_record_h record, unsigned int propert
                *out = person->link_count;
                break;
        default:
-               CTS_ERR("This field(%d) is not supported in value(person)", property_id);
+               ERR("This field(%d) is not supported in value(person)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_person_get_str_real(contacts_record_h record, unsigned int property_id, char** out_str, bool copy)
+static int __ctsvc_person_get_str_real(contacts_record_h record, unsigned int property_id,
+               char **out_str, bool copy)
 {
-       ctsvc_person_s *person = (ctsvc_person_s *)record;
-       switch(property_id) {
+       ctsvc_person_s *person = (ctsvc_person_s*)record;
+       switch (property_id) {
        case CTSVC_PROPERTY_PERSON_DISPLAY_NAME:
                *out_str = GET_STR(copy, person->display_name);
                break;
@@ -169,26 +171,29 @@ static int __ctsvc_person_get_str_real(contacts_record_h record, unsigned int pr
        case CTSVC_PROPERTY_PERSON_ADDRESSBOOK_IDS:
                *out_str = GET_STR(copy, person->addressbook_ids);
                break;
-       default :
-               CTS_ERR("This field(%d) is not supported in value(person)", property_id);
+       default:
+               ERR("This field(%d) is not supported in value(person)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_person_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_person_get_str_p(contacts_record_h record, unsigned int property_id,
+               char **out_str)
 {
        return __ctsvc_person_get_str_real(record, property_id, out_str, false);
 }
 
-static int __ctsvc_person_get_str(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_person_get_str(contacts_record_h record, unsigned int property_id,
+               char **out_str)
 {
        return __ctsvc_person_get_str_real(record, property_id, out_str, true);
 }
 
-static int __ctsvc_person_get_bool(contacts_record_h record, unsigned int property_id, bool *value)
+static int __ctsvc_person_get_bool(contacts_record_h record, unsigned int property_id,
+               bool *value)
 {
-       ctsvc_person_s *person = (ctsvc_person_s *)record;
+       ctsvc_person_s *person = (ctsvc_person_s*)record;
        switch (property_id) {
        case CTSVC_PROPERTY_PERSON_IS_FAVORITE:
                *value = person->is_favorite;
@@ -200,17 +205,18 @@ static int __ctsvc_person_get_bool(contacts_record_h record, unsigned int proper
                *value = person->has_email;
                break;
        default:
-               CTS_ERR("This field(%d) is not supported in value(company)", property_id);
+               ERR("This field(%d) is not supported in value(company)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_person_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty)
+static int __ctsvc_person_set_int(contacts_record_h record, unsigned int property_id,
+               int value, bool *is_dirty)
 {
-       ctsvc_person_s *person = (ctsvc_person_s *)record;
+       ctsvc_person_s *person = (ctsvc_person_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_PERSON_DISPLAY_CONTACT_ID:
                CHECK_DIRTY_VAL(person->name_contact_id, value, is_dirty);
                person->name_contact_id = value;
@@ -224,24 +230,25 @@ static int __ctsvc_person_set_int(contacts_record_h record, unsigned int propert
                person->link_count = value;
                break;
        default:
-               CTS_ERR("This field(0x%0x) is not supported in value(person)", property_id);
+               ERR("This field(0x%0x) is not supported in value(person)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_person_set_str(contacts_record_h record, unsigned int property_id, const char* str, bool *is_dirty)
+static int __ctsvc_person_set_str(contacts_record_h record, unsigned int property_id,
+               const char *str, bool *is_dirty)
 {
-       ctsvc_person_s *person = (ctsvc_person_s *)record;
+       ctsvc_person_s *person = (ctsvc_person_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_PERSON_DISPLAY_NAME:
                CHECK_DIRTY_STR(person->display_name, str, is_dirty);
-               FREEandSTRDUP( person->display_name, str);
+               FREEandSTRDUP(person->display_name, str);
                break;
        case CTSVC_PROPERTY_PERSON_DISPLAY_NAME_INDEX:
                CHECK_DIRTY_STR(person->display_name_index, str, is_dirty);
-               FREEandSTRDUP( person->display_name_index, str);
+               FREEandSTRDUP(person->display_name_index, str);
                break;
        case CTSVC_PROPERTY_PERSON_IMAGE_THUMBNAIL:
                CHECK_DIRTY_STR(person->image_thumbnail_path, str, is_dirty);
@@ -259,26 +266,26 @@ static int __ctsvc_person_set_str(contacts_record_h record, unsigned int propert
                CHECK_DIRTY_STR(person->message_alert, str, is_dirty);
                FREEandSTRDUP(person->message_alert, str);
                break;
-       default :
-               CTS_ERR("This field(%d) is not supported in value(person)", property_id);
+       default:
+               ERR("This field(%d) is not supported in value(person)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_person_set_bool(contacts_record_h record, unsigned int property_id, bool value, bool *is_dirty)
+static int __ctsvc_person_set_bool(contacts_record_h record, unsigned int property_id,
+               bool value, bool *is_dirty)
 {
-       ctsvc_person_s *person = (ctsvc_person_s *)record;
+       ctsvc_person_s *person = (ctsvc_person_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_PERSON_IS_FAVORITE:
                CHECK_DIRTY_VAL(person->is_favorite, value, is_dirty);
-               if (person->is_favorite != value) {
+               if (person->is_favorite != value)
                        person->is_favorite = value;
-               }
                break;
        default:
-               CTS_ERR("This field(%d) is not supported in value(person)", property_id);
+               ERR("This field(%d) is not supported in value(person)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
index 5ffbcf3..e79abb5 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
@@ -31,10 +27,10 @@ static int __ctsvc_phonelog_create(contacts_record_h *out_record);
 static int __ctsvc_phonelog_destroy(contacts_record_h record, bool delete_child);
 static int __ctsvc_phonelog_clone(contacts_record_h record, contacts_record_h *out_record);
 static int __ctsvc_phonelog_get_int(contacts_record_h record, unsigned int property_id, int *out);
-static int __ctsvc_phonelog_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_phonelog_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_phonelog_get_str(contacts_record_h record, unsigned int property_id, char **out_str);
+static int __ctsvc_phonelog_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str);
 static int __ctsvc_phonelog_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
-static int __ctsvc_phonelog_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty);
+static int __ctsvc_phonelog_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty);
 
 ctsvc_record_plugin_cb_s phonelog_plugin_cbs = {
        .create = __ctsvc_phonelog_create,
@@ -62,9 +58,8 @@ static int __ctsvc_phonelog_create(contacts_record_h *out_record)
 {
        ctsvc_phonelog_s *phonelog;
 
-       phonelog = (ctsvc_phonelog_s*)calloc(1, sizeof(ctsvc_phonelog_s));
-       RETVM_IF(NULL == phonelog, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memory : calloc is Fail");
+       phonelog = calloc(1, sizeof(ctsvc_phonelog_s));
+       RETVM_IF(NULL == phonelog, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        *out_record = (contacts_record_h)phonelog;
 
@@ -73,7 +68,7 @@ static int __ctsvc_phonelog_create(contacts_record_h *out_record)
 
 static int __ctsvc_phonelog_destroy(contacts_record_h record, bool delete_child)
 {
-       ctsvc_phonelog_sphonelog = (ctsvc_phonelog_s*)record;
+       ctsvc_phonelog_s *phonelog = (ctsvc_phonelog_s*)record;
        phonelog->base.plugin_cbs = NULL; /* help to find double destroy bug (refer to the contacts_record_destroy) */
        free(phonelog->base.properties_flags);
 
@@ -86,13 +81,13 @@ static int __ctsvc_phonelog_destroy(contacts_record_h record, bool delete_child)
 
 static int __ctsvc_phonelog_clone(contacts_record_h record, contacts_record_h *out_record)
 {
-    ctsvc_phonelog_s *out_data = NULL;
-    ctsvc_phonelog_s *src_data = NULL;
+       ctsvc_phonelog_s *out_data = NULL;
+       ctsvc_phonelog_s *src_data = NULL;
 
-    src_data = (ctsvc_phonelog_s*)record;
-    out_data = calloc(1, sizeof(ctsvc_phonelog_s));
-    RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
-                        "Out of memeory : calloc(ctsvc_phonelog_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
+       src_data = (ctsvc_phonelog_s*)record;
+       out_data = calloc(1, sizeof(ctsvc_phonelog_s));
+       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
+                       "Out of memeory : calloc(ctsvc_phonelog_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
 
        out_data->id = src_data->id;
        out_data->address = SAFE_STRDUP(src_data->address);
@@ -105,7 +100,7 @@ static int __ctsvc_phonelog_clone(contacts_record_h record, contacts_record_h *o
 
        int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_record_copy_base() Fail");
+               ERR("ctsvc_record_copy_base() Fail");
                __ctsvc_phonelog_destroy((contacts_record_h)out_data, true);
                return ret;
        }
@@ -116,9 +111,9 @@ static int __ctsvc_phonelog_clone(contacts_record_h record, contacts_record_h *o
 
 static int __ctsvc_phonelog_get_int(contacts_record_h record, unsigned int property_id, int *out)
 {
-       ctsvc_phonelog_sphonelog = (ctsvc_phonelog_s*)record;
+       ctsvc_phonelog_s *phonelog = (ctsvc_phonelog_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_PHONELOG_ID:
                *out = phonelog->id;
                break;
@@ -138,58 +133,58 @@ static int __ctsvc_phonelog_get_int(contacts_record_h record, unsigned int prope
                *out = phonelog->sim_slot_no;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(phonelog)", property_id);
+               ERR("property_id(%d) is not supported in value(phonelog)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_phonelog_get_str_real(contacts_record_h record, unsigned int property_id, char** out_str, bool copy)
+static int __ctsvc_phonelog_get_str_real(contacts_record_h record, unsigned int property_id, char **out_str, bool copy)
 {
-       ctsvc_phonelog_sphonelog = (ctsvc_phonelog_s*)record;
+       ctsvc_phonelog_s *phonelog = (ctsvc_phonelog_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_PHONELOG_ADDRESS:
                *out_str = GET_STR(copy, phonelog->address);
                break;
        case CTSVC_PROPERTY_PHONELOG_EXTRA_DATA2:
                *out_str = GET_STR(copy, phonelog->extra_data2);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(phonelog)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(phonelog)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_phonelog_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_phonelog_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_phonelog_get_str_real(record, property_id, out_str, false);
 }
 
-static int __ctsvc_phonelog_get_str(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_phonelog_get_str(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_phonelog_get_str_real(record, property_id, out_str, true);
 }
 
 static int __ctsvc_phonelog_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty)
 {
-       ctsvc_phonelog_sphonelog = (ctsvc_phonelog_s*)record;
+       ctsvc_phonelog_s *phonelog = (ctsvc_phonelog_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_PHONELOG_ID:
                CHECK_DIRTY_VAL(phonelog->id, value, is_dirty);
                phonelog->id = value;
                break;
        case CTSVC_PROPERTY_PHONELOG_PERSON_ID:
                RETVM_IF(0 < phonelog->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is a read-only value (phonelog)", property_id);
+                               "property_id(%d) is a read-only value (phonelog)", property_id);
                CHECK_DIRTY_VAL(phonelog->person_id, value, is_dirty);
                phonelog->person_id = value;
                break;
        case CTSVC_PROPERTY_PHONELOG_LOG_TIME:
                RETVM_IF(0 < phonelog->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is a read-only value (phonelog)", property_id);
+                               "property_id(%d) is a read-only value (phonelog)", property_id);
                CHECK_DIRTY_VAL(phonelog->log_time, value, is_dirty);
                phonelog->log_time = value;
                break;
@@ -200,42 +195,41 @@ static int __ctsvc_phonelog_set_int(contacts_record_h record, unsigned int prope
                                        && value <= CONTACTS_PLOG_TYPE_MMS_BLOCKED)
                                || (CONTACTS_PLOG_TYPE_EMAIL_RECEIVED <= value
                                        && value <= CONTACTS_PLOG_TYPE_EMAIL_SENT)
-                       ) {
+                  ) {
                        CHECK_DIRTY_VAL(phonelog->log_type, value, is_dirty);
                        phonelog->log_type = value;
-               }
-               else {
-                       CTS_ERR("Invalid parameter : log type is in invalid range (%d)", value);
+               } else {
+                       ERR("log type is in invalid range (%d)", value);
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
                break;
        case CTSVC_PROPERTY_PHONELOG_EXTRA_DATA1:
                RETVM_IF(0 < phonelog->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is a read-only value (phonelog)", property_id);
+                               "property_id(%d) is a read-only value (phonelog)", property_id);
                CHECK_DIRTY_VAL(phonelog->extra_data1, value, is_dirty);
                phonelog->extra_data1 = value;
                break;
        case CTSVC_PROPERTY_PHONELOG_SIM_SLOT_NO:
                RETVM_IF(0 < phonelog->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : property_id(%d) is a read-only value (phonelog)", property_id);
+                               "property_id(%d) is a read-only value (phonelog)", property_id);
                CHECK_DIRTY_VAL(phonelog->sim_slot_no, value, is_dirty);
                phonelog->sim_slot_no = value;
                break;
        default:
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(phonelog)", property_id);
+               ERR("property_id(%d) is not supported in value(phonelog)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_phonelog_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty)
+static int __ctsvc_phonelog_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty)
 {
-       ctsvc_phonelog_sphonelog = (ctsvc_phonelog_s*)record;
+       ctsvc_phonelog_s *phonelog = (ctsvc_phonelog_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_PHONELOG_ADDRESS:
                RETVM_IF(0 < phonelog->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : property_id(%d) is a read-only value (phonelog)", property_id);
+                               "property_id(%d) is a read-only value (phonelog)", property_id);
                CHECK_DIRTY_STR(phonelog->address, str, is_dirty);
                FREEandSTRDUP(phonelog->address, str);
                break;
@@ -243,8 +237,8 @@ static int __ctsvc_phonelog_set_str(contacts_record_h record, unsigned int prope
                CHECK_DIRTY_STR(phonelog->extra_data2, str, is_dirty);
                FREEandSTRDUP(phonelog->extra_data2, str);
                break;
-       default :
-               CTS_ERR("Invalid parameter : property_id(%d) is not supported in value(phonelog)", property_id);
+       default:
+               ERR("property_id(%d) is not supported in value(phonelog)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
index 8626fb3..a3d87bb 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
 #include "ctsvc_server_sim.h"
 #endif /* _CONTACTS_IPC_SERVER */
 
-static int __ctsvc_result_create(contacts_record_hout_record);
+static int __ctsvc_result_create(contacts_record_h *out_record);
 static int __ctsvc_result_destroy(contacts_record_h record, bool delete_child);
 static int __ctsvc_result_clone(contacts_record_h record, contacts_record_h *out_record);
-static int __ctsvc_result_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_result_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_result_get_int(contacts_record_h record, unsigned int property_id, intout_value);
-static int __ctsvc_result_get_bool(contacts_record_h record, unsigned int property_id, boolout_value);
-static int __ctsvc_result_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty );
-static int __ctsvc_result_set_bool(contacts_record_h record, unsigned int property_id, bool value, bool *is_dirty );
+static int __ctsvc_result_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str);
+static int __ctsvc_result_get_str(contacts_record_h record, unsigned int property_id, char **out_str);
+static int __ctsvc_result_get_int(contacts_record_h record, unsigned int property_id, int *out_value);
+static int __ctsvc_result_get_bool(contacts_record_h record, unsigned int property_id, bool *out_value);
+static int __ctsvc_result_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
+static int __ctsvc_result_set_bool(contacts_record_h record, unsigned int property_id, bool value, bool *is_dirty);
 static int __ctsvc_result_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty);
 
 ctsvc_record_plugin_cb_s result_plugin_cbs = {
@@ -60,12 +60,11 @@ ctsvc_record_plugin_cb_s result_plugin_cbs = {
        .clone_child_record_list = NULL,
 };
 
-static int __ctsvc_result_create(contacts_record_hout_record)
+static int __ctsvc_result_create(contacts_record_h *out_record)
 {
        ctsvc_result_s *result;
-       result = (ctsvc_result_s*)calloc(1, sizeof(ctsvc_result_s));
-       RETVM_IF(NULL == result, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memory : calloc is Fail");
+       result = calloc(1, sizeof(ctsvc_result_s));
+       RETVM_IF(NULL == result, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        *out_record = (contacts_record_h)result;
        return CONTACTS_ERROR_NONE;
@@ -74,9 +73,9 @@ static int __ctsvc_result_create(contacts_record_h* out_record)
 static int __ctsvc_result_destroy(contacts_record_h record, bool delete_child)
 {
        GSList *cursor;
-       ctsvc_result_sresult = (ctsvc_result_s*)record;
+       ctsvc_result_s *result = (ctsvc_result_s*)record;
 
-       for (cursor = result->values;cursor;cursor=cursor->next) {
+       for (cursor = result->values; cursor; cursor = cursor->next) {
                ctsvc_result_value_s *data = cursor->data;
                if (data->type == CTSVC_VIEW_DATA_TYPE_STR)
                        free(data->value.s);
@@ -93,27 +92,27 @@ static int __ctsvc_result_destroy(contacts_record_h record, bool delete_child)
 
 static int __ctsvc_result_clone(contacts_record_h record, contacts_record_h *out_record)
 {
-    ctsvc_result_s *out_data = NULL;
-    ctsvc_result_s *src_data = NULL;
-    GSList *cursor;
+       ctsvc_result_s *out_data = NULL;
+       ctsvc_result_s *src_data = NULL;
+       GSList *cursor;
 
-    src_data = (ctsvc_result_s*)record;
-    out_data = calloc(1, sizeof(ctsvc_result_s));
-    RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
-                        "Out of memeory : calloc(ctsvc_result_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
+       src_data = (ctsvc_result_s*)record;
+       out_data = calloc(1, sizeof(ctsvc_result_s));
+       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
+                       "Out of memeory : calloc(ctsvc_result_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
 
-       for (cursor=src_data->values;cursor;cursor=cursor->next) {
+       for (cursor = src_data->values; cursor; cursor = cursor->next) {
                ctsvc_result_value_s *src = cursor->data;
                ctsvc_result_value_s *dest = calloc(1, sizeof(ctsvc_result_value_s));
                if (NULL == dest) {
-                       CTS_ERR("calloc() Fail");
+                       ERR("calloc() Fail");
                        __ctsvc_result_destroy((contacts_record_h)out_data, true);
                        return CONTACTS_ERROR_OUT_OF_MEMORY;
                }
 
                dest->property_id = src->property_id;
                dest->type = src->type;
-               switch(src->type) {
+               switch (src->type) {
                case CTSVC_VIEW_DATA_TYPE_BOOL:
                        dest->value.b = src->value.b;
                        break;
@@ -137,7 +136,7 @@ static int __ctsvc_result_clone(contacts_record_h record, contacts_record_h *out
 
        int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_record_copy_base() Fail");
+               ERR("ctsvc_record_copy_base() Fail");
                __ctsvc_result_destroy((contacts_record_h)out_data, true);
                return ret;
        }
@@ -148,18 +147,18 @@ static int __ctsvc_result_clone(contacts_record_h record, contacts_record_h *out
 }
 
 static int __ctsvc_result_get_str_real(contacts_record_h record, unsigned int property_id,
-               char** out_str, bool copy)
+               char **out_str, bool copy)
 {
-       ctsvc_result_s* result = (ctsvc_result_s *)record;
+       ctsvc_result_s *result = (ctsvc_result_s*)record;
 
        GSList *cursor;
 
        if (CTSVC_VIEW_DATA_TYPE_STR != (CTSVC_VIEW_DATA_TYPE_STR & property_id)) {
-               CTS_ERR("property_id is not str type.");
+               ERR("property_id is not str type.");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
-       for (cursor = result->values;cursor;cursor=cursor->next) {
+       for (cursor = result->values; cursor; cursor = cursor->next) {
                ctsvc_result_value_s *data = cursor->data;
                if (data->property_id == property_id) {
                        *out_str = GET_STR(copy, data->value.s);
@@ -170,28 +169,28 @@ static int __ctsvc_result_get_str_real(contacts_record_h record, unsigned int pr
        return CONTACTS_ERROR_NO_DATA;
 }
 
-static int __ctsvc_result_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_result_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_result_get_str_real(record, property_id, out_str, false);
 }
 
-static int __ctsvc_result_get_str(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_result_get_str(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_result_get_str_real(record, property_id, out_str, true);
 }
 
-static int __ctsvc_result_get_int(contacts_record_h record, unsigned int property_id, intout_value)
+static int __ctsvc_result_get_int(contacts_record_h record, unsigned int property_id, int *out_value)
 {
-       ctsvc_result_s* result = (ctsvc_result_s *)record;
+       ctsvc_result_s *result = (ctsvc_result_s*)record;
 
        GSList *cursor;
 
        if (CTSVC_VIEW_DATA_TYPE_INT != (CTSVC_VIEW_DATA_TYPE_INT & property_id)) {
-               CTS_ERR("property_id is not int type.");
+               ERR("property_id is not int type.");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
-       for (cursor = result->values;cursor;cursor=cursor->next) {
+       for (cursor = result->values; cursor; cursor = cursor->next) {
                ctsvc_result_value_s *data = cursor->data;
                if (data->property_id == property_id) {
                        *out_value = data->value.i;
@@ -204,24 +203,23 @@ static int __ctsvc_result_get_int(contacts_record_h record, unsigned int propert
 
 static int __ctsvc_result_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty)
 {
-       ctsvc_result_s* result = (ctsvc_result_s *)record;
+       ctsvc_result_s *result = (ctsvc_result_s*)record;
        GSList *cursor;
        ctsvc_result_value_s *data;
 
        if (CTSVC_VIEW_DATA_TYPE_INT != (CTSVC_VIEW_DATA_TYPE_INT & property_id)) {
-               CTS_ERR("property_id is not int type.");
+               ERR("property_id is not int type.");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
-       for (cursor = result->values;cursor;cursor=cursor->next) {
+       for (cursor = result->values; cursor; cursor = cursor->next) {
                data = cursor->data;
                if (data->property_id == property_id) {
 #ifdef _CONTACTS_IPC_SERVER
                        if (property_id == CTSVC_PROPERTY_PHONELOG_SIM_SLOT_NO) {
                                CHECK_DIRTY_VAL(data->value.i, value, is_dirty);
                                data->value.i = ctsvc_server_sim_get_sim_slot_no_by_info_id(value);
-                       }
-                       else
+                       } else
 #endif /* _CONTACTS_IPC_SERVER */
                        {
                                CHECK_DIRTY_VAL(data->value.i, value, is_dirty);
@@ -233,7 +231,7 @@ static int __ctsvc_result_set_int(contacts_record_h record, unsigned int propert
 
        data = calloc(1, sizeof(ctsvc_result_value_s));
        if (NULL == data) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
        data->property_id = property_id;
@@ -242,8 +240,7 @@ static int __ctsvc_result_set_int(contacts_record_h record, unsigned int propert
        if (property_id == CTSVC_PROPERTY_PHONELOG_SIM_SLOT_NO) {
                CHECK_DIRTY_VAL(data->value.i, value, is_dirty);
                data->value.i = ctsvc_server_sim_get_sim_slot_no_by_info_id(value);
-       }
-       else
+       } else
 #endif /* _CONTACTS_IPC_SERVER */
        {
                CHECK_DIRTY_VAL(data->value.i, value, is_dirty);
@@ -255,21 +252,20 @@ static int __ctsvc_result_set_int(contacts_record_h record, unsigned int propert
 
 static int __ctsvc_result_set_bool(contacts_record_h record, unsigned int property_id, bool value, bool *is_dirty)
 {
-       ctsvc_result_s* result = (ctsvc_result_s *)record;
+       ctsvc_result_s *result = (ctsvc_result_s*)record;
        GSList *cursor;
        ctsvc_result_value_s *data;
 
        /* TODO: check the value type of property_id is int */
-       for(cursor = result->values;cursor;cursor=cursor->next){
+       for (cursor = result->values; cursor; cursor = cursor->next) {
                data = cursor->data;
                if (data->property_id == property_id) {
                        if (data->type == CTSVC_VIEW_DATA_TYPE_BOOL) {
                                CHECK_DIRTY_VAL(data->value.b, value, is_dirty);
                                data->value.b = value;
                                return CONTACTS_ERROR_NONE;
-                       }
-                       else {
-                               CTS_ERR("use another get_type API, (type : %d)", data->type);
+                       } else {
+                               ERR("use another get_type API, (type : %d)", data->type);
                                return CONTACTS_ERROR_INVALID_PARAMETER;
                        }
                }
@@ -277,7 +273,7 @@ static int __ctsvc_result_set_bool(contacts_record_h record, unsigned int proper
 
        data = calloc(1, sizeof(ctsvc_result_value_s));
        if (NULL == data) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
        data->property_id = property_id;
@@ -290,18 +286,18 @@ static int __ctsvc_result_set_bool(contacts_record_h record, unsigned int proper
 
 static int __ctsvc_result_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty)
 {
-       ctsvc_result_s* result = (ctsvc_result_s *)record;
+       ctsvc_result_s *result = (ctsvc_result_s*)record;
        GSList *cursor;
        ctsvc_result_value_s *data;
        char *full_path = NULL;
        int str_len;
 
        if (CTSVC_VIEW_DATA_TYPE_STR != (CTSVC_VIEW_DATA_TYPE_STR & property_id)) {
-               CTS_ERR("property_id is not str type.");
+               ERR("property_id is not str type.");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
-       for (cursor = result->values;cursor;cursor=cursor->next) {
+       for (cursor = result->values; cursor; cursor = cursor->next) {
                data = cursor->data;
                if (data->property_id == property_id) {
                        switch (property_id) {
@@ -311,7 +307,7 @@ static int __ctsvc_result_set_str(contacts_record_h record, unsigned int propert
                                        str_len = strlen(CTSVC_CONTACT_IMG_FULL_LOCATION) + strlen(str) + 2;
                                        full_path = calloc(1, str_len);
                                        if (NULL == full_path) {
-                                               CTS_ERR("calloc() Fail");
+                                               ERR("calloc() Fail");
                                                return CONTACTS_ERROR_OUT_OF_MEMORY;
                                        }
                                        snprintf(full_path, str_len, "%s/%s", CTSVC_CONTACT_IMG_FULL_LOCATION, str);
@@ -330,7 +326,7 @@ static int __ctsvc_result_set_str(contacts_record_h record, unsigned int propert
 
        data = calloc(1, sizeof(ctsvc_result_value_s));
        if (NULL == data) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
        data->property_id = property_id;
@@ -342,7 +338,7 @@ static int __ctsvc_result_set_str(contacts_record_h record, unsigned int propert
                        str_len = strlen(CTSVC_CONTACT_IMG_FULL_LOCATION) + strlen(str) + 2;
                        full_path = calloc(1, str_len);
                        if (NULL == full_path) {
-                               CTS_ERR("calloc() Fail");
+                               ERR("calloc() Fail");
                                free(data);
                                return CONTACTS_ERROR_OUT_OF_MEMORY;
                        }
@@ -362,19 +358,18 @@ static int __ctsvc_result_set_str(contacts_record_h record, unsigned int propert
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_result_get_bool(contacts_record_h record, unsigned int property_id, boolout_value)
+static int __ctsvc_result_get_bool(contacts_record_h record, unsigned int property_id, bool *out_value)
 {
-       ctsvc_result_s* result = (ctsvc_result_s *)record;
+       ctsvc_result_s *result = (ctsvc_result_s*)record;
        GSList *cursor;
-       for (cursor = result->values;cursor;cursor=cursor->next) {
+       for (cursor = result->values; cursor; cursor = cursor->next) {
                ctsvc_result_value_s *data = cursor->data;
                if (data->property_id == property_id) {
                        if (data->type == CTSVC_VIEW_DATA_TYPE_BOOL) {
                                *out_value = data->value.b;
                                return CONTACTS_ERROR_NONE;
-                       }
-                       else {
-                               CTS_ERR("use another get_type API, (type : %d)", data->type);
+                       } else {
+                               ERR("use another get_type API, (type : %d)", data->type);
                                return CONTACTS_ERROR_INVALID_PARAMETER;
                        }
                }
index 88cb4b9..db6b43a 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
 #include "ctsvc_record.h"
 #include "ctsvc_view.h"
 
-static int __ctsvc_sdn_create(contacts_record_hout_record);
+static int __ctsvc_sdn_create(contacts_record_h *out_record);
 static int __ctsvc_sdn_destroy(contacts_record_h record, bool delete_child);
 static int __ctsvc_sdn_clone(contacts_record_h record, contacts_record_h *out_record);
 static int __ctsvc_sdn_get_int(contacts_record_h record, unsigned int property_id, int *out);
-static int __ctsvc_sdn_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_sdn_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_sdn_get_str(contacts_record_h record, unsigned int property_id, char **out_str);
+static int __ctsvc_sdn_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str);
 static int __ctsvc_sdn_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
-static int __ctsvc_sdn_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty);
+static int __ctsvc_sdn_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty);
 
 ctsvc_record_plugin_cb_s sdn_plugin_cbs = {
        .create = __ctsvc_sdn_create,
@@ -57,12 +53,11 @@ ctsvc_record_plugin_cb_s sdn_plugin_cbs = {
        .clone_child_record_list = NULL,
 };
 
-static int __ctsvc_sdn_create(contacts_record_hout_record)
+static int __ctsvc_sdn_create(contacts_record_h *out_record)
 {
        ctsvc_sdn_s *sdn;
-       sdn = (ctsvc_sdn_s*)calloc(1, sizeof(ctsvc_sdn_s));
-       RETVM_IF(NULL == sdn, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memory calloc is Fail");
+       sdn = calloc(1, sizeof(ctsvc_sdn_s));
+       RETVM_IF(NULL == sdn, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        *out_record = (contacts_record_h)sdn;
        return CONTACTS_ERROR_NONE;
@@ -70,7 +65,7 @@ static int __ctsvc_sdn_create(contacts_record_h* out_record)
 
 static int __ctsvc_sdn_destroy(contacts_record_h record, bool delete_child)
 {
-       ctsvc_sdn_ssdn = (ctsvc_sdn_s*)record;
+       ctsvc_sdn_s *sdn = (ctsvc_sdn_s*)record;
        sdn->base.plugin_cbs = NULL; /* help to find double destroy bug (refer to the contacts_record_destroy) */
        free(sdn->base.properties_flags);
 
@@ -83,13 +78,13 @@ static int __ctsvc_sdn_destroy(contacts_record_h record, bool delete_child)
 
 static int __ctsvc_sdn_clone(contacts_record_h record, contacts_record_h *out_record)
 {
-    ctsvc_sdn_s *out_data = NULL;
-    ctsvc_sdn_s *src_data = NULL;
+       ctsvc_sdn_s *out_data = NULL;
+       ctsvc_sdn_s *src_data = NULL;
 
-    src_data = (ctsvc_sdn_s*)record;
-    out_data = calloc(1, sizeof(ctsvc_sdn_s));
-    RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
-                        "Out of memeory : calloc(ctsvc_sdn_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
+       src_data = (ctsvc_sdn_s*)record;
+       out_data = calloc(1, sizeof(ctsvc_sdn_s));
+       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
+                       "Out of memeory : calloc(ctsvc_sdn_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
 
        out_data->id = src_data->id;
        out_data->name = SAFE_STRDUP(src_data->name);
@@ -98,7 +93,7 @@ static int __ctsvc_sdn_clone(contacts_record_h record, contacts_record_h *out_re
 
        int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_record_copy_base() Fail");
+               ERR("ctsvc_record_copy_base() Fail");
                __ctsvc_sdn_destroy((contacts_record_h)out_data, true);
                return ret;
        }
@@ -109,9 +104,9 @@ static int __ctsvc_sdn_clone(contacts_record_h record, contacts_record_h *out_re
 
 static int __ctsvc_sdn_get_int(contacts_record_h record, unsigned int property_id, int *out)
 {
-       ctsvc_sdn_ssdn = (ctsvc_sdn_s*)record;
+       ctsvc_sdn_s *sdn = (ctsvc_sdn_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_SDN_ID:
                *out = sdn->id;
                break;
@@ -119,45 +114,45 @@ static int __ctsvc_sdn_get_int(contacts_record_h record, unsigned int property_i
                *out = sdn->sim_slot_no;
                break;
        default:
-               CTS_ERR("This field(%d) is not supported in value(sdn)", property_id);
+               ERR("This field(%d) is not supported in value(sdn)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_sdn_get_str_real(contacts_record_h record, unsigned int property_id, char** out_str, bool copy)
+static int __ctsvc_sdn_get_str_real(contacts_record_h record, unsigned int property_id, char **out_str, bool copy)
 {
-       ctsvc_sdn_ssdn = (ctsvc_sdn_s*)record;
+       ctsvc_sdn_s *sdn = (ctsvc_sdn_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_SDN_NAME:
                *out_str = GET_STR(copy, sdn->name);
                break;
        case CTSVC_PROPERTY_SDN_NUMBER:
                *out_str = GET_STR(copy, sdn->number);
                break;
-       default :
-               CTS_ERR("This field(%d) is not supported in value(sdn)", property_id);
+       default:
+               ERR("This field(%d) is not supported in value(sdn)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_sdn_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_sdn_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_sdn_get_str_real(record, property_id, out_str, false);
 }
 
-static int __ctsvc_sdn_get_str(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_sdn_get_str(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_sdn_get_str_real(record, property_id, out_str, true);
 }
 
 static int __ctsvc_sdn_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty)
 {
-       ctsvc_sdn_ssdn = (ctsvc_sdn_s*)record;
+       ctsvc_sdn_s *sdn = (ctsvc_sdn_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_SDN_ID:
                CHECK_DIRTY_VAL(sdn->id, value, is_dirty);
                sdn->id = value;
@@ -167,17 +162,17 @@ static int __ctsvc_sdn_set_int(contacts_record_h record, unsigned int property_i
                sdn->sim_slot_no = value;
                break;
        default:
-               CTS_ERR("This field(%d) is not supported in value(sdn)", property_id);
+               ERR("This field(%d) is not supported in value(sdn)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_sdn_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty)
+static int __ctsvc_sdn_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty)
 {
-       ctsvc_sdn_ssdn = (ctsvc_sdn_s*)record;
+       ctsvc_sdn_s *sdn = (ctsvc_sdn_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_SDN_NAME:
                CHECK_DIRTY_STR(sdn->name, str, is_dirty);
                FREEandSTRDUP(sdn->name, str);
@@ -186,8 +181,8 @@ static int __ctsvc_sdn_set_str(contacts_record_h record, unsigned int property_i
                CHECK_DIRTY_STR(sdn->number, str, is_dirty);
                FREEandSTRDUP(sdn->number, str);
                break;
-       default :
-               CTS_ERR("This field(%d) is not supported in value(sdn)", property_id);
+       default:
+               ERR("This field(%d) is not supported in value(sdn)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
index cf0138f..e252cb9 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_record.h"
 #include "ctsvc_view.h"
 
-static int __ctsvc_speeddial_create(contacts_record_hout_record);
+static int __ctsvc_speeddial_create(contacts_record_h *out_record);
 static int __ctsvc_speeddial_destroy(contacts_record_h record, bool delete_child);
 static int __ctsvc_speeddial_clone(contacts_record_h record, contacts_record_h *out_record);
 static int __ctsvc_speeddial_get_int(contacts_record_h record, unsigned int property_id, int *out);
-static int __ctsvc_speeddial_get_str(contacts_record_h record, unsigned int property_id, char** out_str);
-static int __ctsvc_speeddial_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str);
+static int __ctsvc_speeddial_get_str(contacts_record_h record, unsigned int property_id, char **out_str);
+static int __ctsvc_speeddial_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str);
 static int __ctsvc_speeddial_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
-static int __ctsvc_speeddial_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty);
+static int __ctsvc_speeddial_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty);
 
 
 ctsvc_record_plugin_cb_s speeddial_plugin_cbs = {
@@ -58,12 +53,11 @@ ctsvc_record_plugin_cb_s speeddial_plugin_cbs = {
        .clone_child_record_list = NULL,
 };
 
-static int __ctsvc_speeddial_create(contacts_record_hout_record)
+static int __ctsvc_speeddial_create(contacts_record_h *out_record)
 {
        ctsvc_speeddial_s *speeddial;
-       speeddial = (ctsvc_speeddial_s*)calloc(1, sizeof(ctsvc_speeddial_s));
-       RETVM_IF(NULL == speeddial, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memory : calloc is Fail");
+       speeddial = calloc(1, sizeof(ctsvc_speeddial_s));
+       RETVM_IF(NULL == speeddial, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail");
 
        *out_record = (contacts_record_h)speeddial;
        return CONTACTS_ERROR_NONE;
@@ -71,7 +65,7 @@ static int __ctsvc_speeddial_create(contacts_record_h* out_record)
 
 static int __ctsvc_speeddial_destroy(contacts_record_h record, bool delete_child)
 {
-       ctsvc_speeddial_sspeeddial = (ctsvc_speeddial_s*)record;
+       ctsvc_speeddial_s *speeddial = (ctsvc_speeddial_s*)record;
        speeddial->base.plugin_cbs = NULL; /* help to find double destroy bug (refer to the contacts_record_destroy) */
        free(speeddial->base.properties_flags);
 
@@ -86,13 +80,13 @@ static int __ctsvc_speeddial_destroy(contacts_record_h record, bool delete_child
 
 static int __ctsvc_speeddial_clone(contacts_record_h record, contacts_record_h *out_record)
 {
-    ctsvc_speeddial_s *out_data = NULL;
-    ctsvc_speeddial_s *src_data = NULL;
+       ctsvc_speeddial_s *out_data = NULL;
+       ctsvc_speeddial_s *src_data = NULL;
 
-    src_data = (ctsvc_speeddial_s*)record;
-    out_data = calloc(1, sizeof(ctsvc_speeddial_s));
-    RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
-                        "Out of memeory : calloc(ctsvc_speeddial_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
+       src_data = (ctsvc_speeddial_s*)record;
+       out_data = calloc(1, sizeof(ctsvc_speeddial_s));
+       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
+                       "Out of memeory : calloc(ctsvc_speeddial_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
 
        out_data->id = src_data->id;
        out_data->dial_number = src_data->dial_number;
@@ -106,7 +100,7 @@ static int __ctsvc_speeddial_clone(contacts_record_h record, contacts_record_h *
 
        int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_record_copy_base() Fail");
+               ERR("ctsvc_record_copy_base() Fail");
                __ctsvc_speeddial_destroy((contacts_record_h)out_data, true);
                return ret;
        }
@@ -119,7 +113,7 @@ static int __ctsvc_speeddial_get_int(contacts_record_h record, unsigned int prop
 {
        ctsvc_speeddial_s *speeddial = (ctsvc_speeddial_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_SPEEDDIAL_DIAL_NUMBER:
                *out = speeddial->dial_number;
                break;
@@ -133,17 +127,17 @@ static int __ctsvc_speeddial_get_int(contacts_record_h record, unsigned int prop
                *out = speeddial->person_id;
                break;
        default:
-               CTS_ERR("This field(%d) is not supported in value(speeddial)", property_id);
+               ERR("This field(%d) is not supported in value(speeddial)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_speeddial_get_str_real(contacts_record_h record, unsigned int property_id, char** out_str, bool copy)
+static int __ctsvc_speeddial_get_str_real(contacts_record_h record, unsigned int property_id, char **out_str, bool copy)
 {
        ctsvc_speeddial_s *speeddial = (ctsvc_speeddial_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_SPEEDDIAL_DISPLAY_NAME:
                *out_str = GET_STR(copy, speeddial->display_name);
                break;
@@ -156,19 +150,19 @@ static int __ctsvc_speeddial_get_str_real(contacts_record_h record, unsigned int
        case CTSVC_PROPERTY_SPEEDDIAL_NUMBER_LABEL:
                *out_str = GET_STR(copy, speeddial->label);
                break;
-       default :
-               CTS_ERR("This field(%d) is not supported in value(speeddial)", property_id);
+       default:
+               ERR("This field(%d) is not supported in value(speeddial)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_speeddial_get_str_p(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_speeddial_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_speeddial_get_str_real(record, property_id, out_str, false);
 }
 
-static int __ctsvc_speeddial_get_str(contacts_record_h record, unsigned int property_id, char** out_str)
+static int __ctsvc_speeddial_get_str(contacts_record_h record, unsigned int property_id, char **out_str)
 {
        return __ctsvc_speeddial_get_str_real(record, property_id, out_str, true);
 }
@@ -177,7 +171,7 @@ static int __ctsvc_speeddial_set_int(contacts_record_h record, unsigned int prop
 {
        ctsvc_speeddial_s *speeddial = (ctsvc_speeddial_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_SPEEDDIAL_NUMBER_TYPE:
                CHECK_DIRTY_VAL(speeddial->number_type, value, is_dirty);
                speeddial->number_type = value;
@@ -188,7 +182,7 @@ static int __ctsvc_speeddial_set_int(contacts_record_h record, unsigned int prop
                break;
        case CTSVC_PROPERTY_SPEEDDIAL_DIAL_NUMBER:
                RETVM_IF(0 < speeddial->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : property_id(%d) is a read-only value (speeddial)", property_id);
+                               "property_id(%d) is a read-only value (speeddial)", property_id);
                CHECK_DIRTY_VAL(speeddial->dial_number, value, is_dirty);
                speeddial->dial_number = value;
                break;
@@ -197,17 +191,17 @@ static int __ctsvc_speeddial_set_int(contacts_record_h record, unsigned int prop
                speeddial->number_id = value;
                break;
        default:
-               CTS_ERR("This field(%d) is not supported in value(speeddial)", property_id);
+               ERR("This field(%d) is not supported in value(speeddial)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_speeddial_set_str(contacts_record_h record, unsigned int property_id, const charstr, bool *is_dirty)
+static int __ctsvc_speeddial_set_str(contacts_record_h record, unsigned int property_id, const char *str, bool *is_dirty)
 {
        ctsvc_speeddial_s *speeddial = (ctsvc_speeddial_s*)record;
 
-       switch(property_id) {
+       switch (property_id) {
        case CTSVC_PROPERTY_SPEEDDIAL_DISPLAY_NAME:
                CHECK_DIRTY_STR(speeddial->display_name, str, is_dirty);
                FREEandSTRDUP(speeddial->display_name, str);
@@ -224,8 +218,8 @@ static int __ctsvc_speeddial_set_str(contacts_record_h record, unsigned int prop
                CHECK_DIRTY_STR(speeddial->label, str, is_dirty);
                FREEandSTRDUP(speeddial->label, str);
                break;
-       default :
-               CTS_ERR("This field(%d) is not supported in value(speeddial)", property_id);
+       default:
+               ERR("This field(%d) is not supported in value(speeddial)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
index 588810d..3b2d9bb 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_record.h"
 #include "ctsvc_view.h"
 
-static int __ctsvc_updated_info_create(contacts_record_hout_record);
+static int __ctsvc_updated_info_create(contacts_record_h *out_record);
 static int __ctsvc_updated_info_destroy(contacts_record_h record, bool delete_child);
 static int __ctsvc_updated_info_clone(contacts_record_h record, contacts_record_h *out_record);
 static int __ctsvc_updated_info_get_int(contacts_record_h record, unsigned int property_id, int *out);
@@ -52,12 +51,11 @@ ctsvc_record_plugin_cb_s updated_info_plugin_cbs = {
        .clone_child_record_list = NULL,
 };
 
-static int __ctsvc_updated_info_create(contacts_record_hout_record)
+static int __ctsvc_updated_info_create(contacts_record_h *out_record)
 {
        ctsvc_updated_info_s *updated_info;
-       updated_info = (ctsvc_updated_info_s*)calloc(1, sizeof(ctsvc_updated_info_s));
-       RETVM_IF(NULL == updated_info, CONTACTS_ERROR_OUT_OF_MEMORY,
-                       "Out of memory calloc is Fail");
+       updated_info = calloc(1, sizeof(ctsvc_updated_info_s));
+       RETVM_IF(NULL == updated_info, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() is Fail");
 
        *out_record = (contacts_record_h)updated_info;
        return CONTACTS_ERROR_NONE;
@@ -65,7 +63,7 @@ static int __ctsvc_updated_info_create(contacts_record_h* out_record)
 
 static int __ctsvc_updated_info_destroy(contacts_record_h record, bool delete_child)
 {
-       ctsvc_updated_info_supdated_info = (ctsvc_updated_info_s*)record;
+       ctsvc_updated_info_s *updated_info = (ctsvc_updated_info_s*)record;
        updated_info->base.plugin_cbs = NULL; /* help to find double destroy bug (refer to the contacts_record_destroy) */
        free(updated_info->base.properties_flags);
        free(updated_info);
@@ -75,13 +73,13 @@ static int __ctsvc_updated_info_destroy(contacts_record_h record, bool delete_ch
 
 static int __ctsvc_updated_info_clone(contacts_record_h record, contacts_record_h *out_record)
 {
-    ctsvc_updated_info_s *out_data = NULL;
-    ctsvc_updated_info_s *src_data = NULL;
+       ctsvc_updated_info_s *out_data = NULL;
+       ctsvc_updated_info_s *src_data = NULL;
 
-    src_data = (ctsvc_updated_info_s*)record;
-    out_data = calloc(1, sizeof(ctsvc_updated_info_s));
-    RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
-                        "Out of memeory : calloc(ctsvc_updated_info_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
+       src_data = (ctsvc_updated_info_s*)record;
+       out_data = calloc(1, sizeof(ctsvc_updated_info_s));
+       RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY,
+                       "Out of memeory : calloc(ctsvc_updated_info_s) Fail(%d)", CONTACTS_ERROR_OUT_OF_MEMORY);
 
        out_data->id = src_data->id;
        out_data->changed_type = src_data->changed_type;
@@ -92,7 +90,7 @@ static int __ctsvc_updated_info_clone(contacts_record_h record, contacts_record_
 
        int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_record_copy_base() Fail");
+               ERR("ctsvc_record_copy_base() Fail");
                __ctsvc_updated_info_destroy((contacts_record_h)out_data, true);
                return ret;
        }
@@ -103,10 +101,10 @@ static int __ctsvc_updated_info_clone(contacts_record_h record, contacts_record_
 
 static int __ctsvc_updated_info_get_int(contacts_record_h record, unsigned int property_id, int *out)
 {
-       ctsvc_updated_info_supdated_info = (ctsvc_updated_info_s*)record;
+       ctsvc_updated_info_s *updated_info = (ctsvc_updated_info_s*)record;
 
-       switch(property_id) {
-       case CTSVC_PROPERTY_UPDATE_INFO_ID :
+       switch (property_id) {
+       case CTSVC_PROPERTY_UPDATE_INFO_ID:
                *out = updated_info->id;
                break;
        case CTSVC_PROPERTY_UPDATE_INFO_ADDRESSBOOK_ID:
@@ -122,7 +120,7 @@ static int __ctsvc_updated_info_get_int(contacts_record_h record, unsigned int p
                *out = updated_info->last_changed_type;
                break;
        default:
-               CTS_ERR("This field(%d) is not supported in value(updated_info)", property_id);
+               ERR("This field(%d) is not supported in value(updated_info)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -130,10 +128,10 @@ static int __ctsvc_updated_info_get_int(contacts_record_h record, unsigned int p
 
 static int __ctsvc_updated_info_set_int(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty)
 {
-       ctsvc_updated_info_supdated_info = (ctsvc_updated_info_s*)record;
+       ctsvc_updated_info_s *updated_info = (ctsvc_updated_info_s*)record;
 
-       switch(property_id) {
-       case CTSVC_PROPERTY_UPDATE_INFO_ID :
+       switch (property_id) {
+       case CTSVC_PROPERTY_UPDATE_INFO_ID:
                CHECK_DIRTY_VAL(updated_info->id, value, is_dirty);
                updated_info->id = value;
                break;
@@ -143,8 +141,8 @@ static int __ctsvc_updated_info_set_int(contacts_record_h record, unsigned int p
                break;
        case CTSVC_PROPERTY_UPDATE_INFO_TYPE:
                RETVM_IF(value < CONTACTS_CHANGE_INSERTED
-                                               || CONTACTS_CHANGE_DELETED < value,
-                               CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : update info type is in invalid range (%d)", value);
+                               || CONTACTS_CHANGE_DELETED < value,
+                               CONTACTS_ERROR_INVALID_PARAMETER, "update info type is in invalid range (%d)", value);
                CHECK_DIRTY_VAL(updated_info->changed_type, value, is_dirty);
                updated_info->changed_type = value;
                break;
@@ -157,7 +155,7 @@ static int __ctsvc_updated_info_set_int(contacts_record_h record, unsigned int p
                updated_info->last_changed_type = value;
                break;
        default:
-               CTS_ERR("This field(%d) is not supported in value(updated_info)", property_id);
+               ERR("This field(%d) is not supported in value(updated_info)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -165,14 +163,14 @@ static int __ctsvc_updated_info_set_int(contacts_record_h record, unsigned int p
 
 static int __ctsvc_updated_info_get_bool(contacts_record_h record, unsigned int property_id, bool *out)
 {
-       ctsvc_updated_info_supdated_info = (ctsvc_updated_info_s*)record;
+       ctsvc_updated_info_s *updated_info = (ctsvc_updated_info_s*)record;
 
-       switch(property_id) {
-       case CTSVC_PROPERTY_UPDATE_INFO_IMAGE_CHANGED :
+       switch (property_id) {
+       case CTSVC_PROPERTY_UPDATE_INFO_IMAGE_CHANGED:
                *out = updated_info->image_changed;
                break;
        default:
-               CTS_ERR("This field(%d) is not supported in value(updated_info)", property_id);
+               ERR("This field(%d) is not supported in value(updated_info)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
@@ -180,15 +178,15 @@ static int __ctsvc_updated_info_get_bool(contacts_record_h record, unsigned int
 
 static int __ctsvc_updated_info_set_bool(contacts_record_h record, unsigned int property_id, bool value, bool *is_dirty)
 {
-       ctsvc_updated_info_supdated_info = (ctsvc_updated_info_s*)record;
+       ctsvc_updated_info_s *updated_info = (ctsvc_updated_info_s*)record;
 
-       switch(property_id) {
-       case CTSVC_PROPERTY_UPDATE_INFO_IMAGE_CHANGED :
+       switch (property_id) {
+       case CTSVC_PROPERTY_UPDATE_INFO_IMAGE_CHANGED:
                CHECK_DIRTY_VAL(updated_info->image_changed, value, is_dirty);
                updated_info->image_changed = value;
                break;
        default:
-               CTS_ERR("This field(%d) is not supported in value(updated_info)", property_id);
+               ERR("This field(%d) is not supported in value(updated_info)", property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
index 0ab3684..ba07bea 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
@@ -41,8 +37,8 @@ API int contacts_sim_get_initialization_status(bool *completed)
 {
        int ret;
 
-       RETVM_IF(completed == NULL, CONTACTS_ERROR_INVALID_PARAMETER,
-                                       "parameter is NULL");
+       RETV_IF(NULL == completed, CONTACTS_ERROR_INVALID_PARAMETER);
+
        ctsvc_mutex_lock(CTS_MUTEX_SOCKET_FD);
        ret = ctsvc_request_sim_get_initialization_status(0, completed);
        ctsvc_mutex_unlock(CTS_MUTEX_SOCKET_FD);
index 35b56dd..3f07578 100644 (file)
@@ -1,8 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
+ * 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.
@@ -54,7 +53,7 @@ int ctsvc_socket_init(void)
 
        ret = connect(__ctsvc_sockfd, (struct sockaddr *)&caddr, sizeof(caddr));
        if (-1 == ret) {
-               CTS_ERR("connect() Fail(errno = %d)", errno);
+               ERR("connect() Fail(errno = %d)", errno);
                close(__ctsvc_sockfd);
                __ctsvc_sockfd = -1;
                return CONTACTS_ERROR_IPC;
@@ -67,12 +66,11 @@ int ctsvc_socket_init(void)
 void ctsvc_socket_final(void)
 {
        if (1 < __ctsvc_conn_refcnt) {
-               CTS_DBG("socket ref count : %d", __ctsvc_conn_refcnt);
+               DBG("socket ref count : %d", __ctsvc_conn_refcnt);
                __ctsvc_conn_refcnt--;
                return;
-       }
-       else if (__ctsvc_conn_refcnt < 1) {
-               CTS_DBG("Please call connection API. socket ref count : %d", __ctsvc_conn_refcnt);
+       } else if (__ctsvc_conn_refcnt < 1) {
+               DBG("Please call connection API. socket ref count : %d", __ctsvc_conn_refcnt);
                return;
        }
        __ctsvc_conn_refcnt--;
@@ -83,7 +81,7 @@ void ctsvc_socket_final(void)
 
 static inline int __ctsvc_safe_write(int fd, const char *buf, int buf_size)
 {
-       int ret, writed=0;
+       int ret, writed = 0;
        while (buf_size) {
                ret = write(fd, buf+writed, buf_size);
                if (-1 == ret) {
@@ -100,7 +98,7 @@ static inline int __ctsvc_safe_write(int fd, const char *buf, int buf_size)
 
 static inline int __ctsvc_safe_read(int fd, char *buf, int buf_size)
 {
-       int ret, read_size=0;
+       int ret, read_size = 0;
        while (buf_size) {
                ret = read(fd, buf+read_size, buf_size);
                if (-1 == ret) {
@@ -127,7 +125,7 @@ static int __ctsvc_socket_handle_return(int fd, ctsvc_socket_msg_s *msg)
                        "Unknown Type(%d), ret=%d, attach_num= %d,"
                        "attach1 = %d, attach2 = %d, attach3 = %d, attach4 = %d",
                        msg->type, msg->val, msg->attach_num,
-                       msg->attach_sizes[0],msg->attach_sizes[1],msg->attach_sizes[2],
+                       msg->attach_sizes[0], msg->attach_sizes[1], msg->attach_sizes[2],
                        msg->attach_sizes[3]);
 
        RETVM_IF(CTSVC_SOCKET_MSG_REQUEST_MAX_ATTACH < msg->attach_num, CONTACTS_ERROR_IPC,
@@ -151,8 +149,7 @@ static void __ctsvc_remove_invalid_msg(int fd, int size)
                                        return;
                        }
                        size -= ret;
-               }
-               else {
+               } else {
                        ret = read(fd, dummy, size);
                        if (-1 == ret) {
                                if (EINTR == errno)
@@ -187,9 +184,9 @@ int ctsvc_request_sim_import(int sim_slot_no)
 
        ret = __ctsvc_socket_handle_return(__ctsvc_sockfd, &msg);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "__ctsvc_socket_handle_return() Fail(%d)", ret);
-       CTS_DBG("attach_num = %d", msg.attach_num);
+       DBG("attach_num = %d", msg.attach_num);
 
-       for (i=0;i<msg.attach_num;i++)
+       for (i = 0; i < msg.attach_num; i++)
                __ctsvc_remove_invalid_msg(__ctsvc_sockfd, msg.attach_sizes[i]);
 
        return msg.val;
@@ -218,17 +215,17 @@ int ctsvc_request_sim_get_initialization_status(int sim_slot_no, bool *completed
 
        ret = __ctsvc_socket_handle_return(__ctsvc_sockfd, &msg);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "__ctsvc_socket_handle_return() Fail(%d)", ret);
-       CTS_DBG("attach_num = %d", msg.attach_num);
+       DBG("attach_num = %d", msg.attach_num);
 
        ret = __ctsvc_safe_read(__ctsvc_sockfd, dest, msg.attach_sizes[0]);
        RETVM_IF(-1 == ret, CONTACTS_ERROR_IPC, "__ctsvc_safe_read() Fail(errno = %d)", errno);
 
-       if (atoi(dest) ==0)
+       if (atoi(dest) == 0)
                *completed = false;
        else
                *completed = true;
 
-       CTS_INFO("sim init complete : %d", *completed);
+       INFO("sim init complete : %d", *completed);
 
        return msg.val;
 }
index 9ac52e0..da987bd 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
@@ -31,7 +27,7 @@
 
 /* for use current contacts-svc-helper daemon */
 /* Message type */
-enum{
+enum {
        CTSVC_SOCKET_MSG_TYPE_REQUEST_RETURN_VALUE,
        CTSVC_SOCKET_MSG_TYPE_REQUEST_IMPORT_SIM,
        CTSVC_SOCKET_MSG_TYPE_REQUEST_SIM_INIT_COMPLETE,
@@ -44,10 +40,10 @@ typedef struct{
        int val;
        int attach_num;
        int attach_sizes[CTSVC_SOCKET_MSG_REQUEST_MAX_ATTACH];
-}ctsvc_socket_msg_s;
+} ctsvc_socket_msg_s;
 
 int ctsvc_request_sim_import(int sim_slot_no);
-int ctsvc_request_sim_get_initialization_status(int sim_slot_no, boolcompleted);
+int ctsvc_request_sim_get_initialization_status(int sim_slot_no, bool *completed);
 int ctsvc_socket_init(void);
 void ctsvc_socket_final(void);
 
index af86260..03d9b68 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
@@ -118,7 +114,7 @@ typedef enum {
        CTSVC_RECORD_SPEEDDIAL,
        CTSVC_RECORD_SDN,
        CTSVC_RECORD_RESULT,
-}ctsvc_record_type_e;
+} ctsvc_record_type_e;
 
 typedef enum {
        CTSVC_FILTER_BOOL,
@@ -127,26 +123,26 @@ typedef enum {
        CTSVC_FILTER_STR,
        CTSVC_FILTER_DOUBLE,
        CTSVC_FILTER_COMPOSITE,
-}ctsvc_filter_type_e;
+} ctsvc_filter_type_e;
 
 typedef struct{
        unsigned int property_id;
        int property_type;
-       voidfields;
+       void *fields;
 }property_info_s;
 
-typedef int (*__ctsvc_record_create_cb)(contacts_record_hout_record);
+typedef int (*__ctsvc_record_create_cb)(contacts_record_h *out_record);
 typedef int (*__ctsvc_record_destroy_cb)(contacts_record_h record, bool delete_child);
-typedef int (*__ctsvc_record_clone_cb)(contacts_record_h record, contacts_record_hout_record);
+typedef int (*__ctsvc_record_clone_cb)(contacts_record_h record, contacts_record_h *out_record);
 
-typedef int (*__ctsvc_record_get_str_cb)(contacts_record_h record, unsigned int property_id,char** out_str);
-typedef int (*__ctsvc_record_get_str_p_cb)(contacts_record_h record, unsigned int property_id,char** out_str);
-typedef int (*__ctsvc_record_get_int_cb)(contacts_record_h record, unsigned int property_id, intout_value);
+typedef int (*__ctsvc_record_get_str_cb)(contacts_record_h record, unsigned int property_id,char **out_str);
+typedef int (*__ctsvc_record_get_str_p_cb)(contacts_record_h record, unsigned int property_id,char **out_str);
+typedef int (*__ctsvc_record_get_int_cb)(contacts_record_h record, unsigned int property_id, int *out_value);
 typedef int (*__ctsvc_record_get_bool_cb)(contacts_record_h record, unsigned int property_id, bool *value);
 typedef int (*__ctsvc_record_get_lli_cb)(contacts_record_h record, unsigned int property_id, long long int *value);
 typedef int (*__ctsvc_record_get_double_cb)(contacts_record_h record, unsigned int property_id, double *value);
 
-typedef int (*__ctsvc_record_set_str_cb)(contacts_record_h record, unsigned int property_id, const charvalue, bool *is_dirty);
+typedef int (*__ctsvc_record_set_str_cb)(contacts_record_h record, unsigned int property_id, const char *value, bool *is_dirty);
 typedef int (*__ctsvc_record_set_int_cb)(contacts_record_h record, unsigned int property_id, int value, bool *is_dirty);
 typedef int (*__ctsvc_record_set_bool_cb)(contacts_record_h record, unsigned int property_id, bool value, bool *is_dirty);
 typedef int (*__ctsvc_record_set_lli_cb)(contacts_record_h record, unsigned int property_id, long long int value, bool *is_dirty);
@@ -155,8 +151,8 @@ typedef int (*__ctsvc_record_set_double_cb)(contacts_record_h record, unsigned i
 typedef int (*__ctsvc_record_add_child_record_cb)(contacts_record_h record, unsigned int property_id, contacts_record_h child_record);
 typedef int (*__ctsvc_record_remove_child_record_cb)(contacts_record_h record, unsigned int property_id, contacts_record_h child_record);
 typedef int (*__ctsvc_record_get_child_record_count_cb)(contacts_record_h record, unsigned int property_id, int *count);
-typedef int (*__ctsvc_record_get_child_record_at_p_cb)(contacts_record_h record, unsigned int property_id, int index, contacts_record_hout_record);
-typedef int (*__ctsvc_record_clone_child_record_list_cb)(contacts_record_h record, unsigned int property_id, contacts_list_hout_list);
+typedef int (*__ctsvc_record_get_child_record_at_p_cb)(contacts_record_h record, unsigned int property_id, int index, contacts_record_h *out_record);
+typedef int (*__ctsvc_record_clone_child_record_list_cb)(contacts_record_h record, unsigned int property_id, contacts_list_h *out_list);
 
 typedef struct {
        __ctsvc_record_create_cb create;
@@ -178,20 +174,20 @@ typedef struct {
        __ctsvc_record_get_child_record_count_cb get_child_record_count;
        __ctsvc_record_get_child_record_at_p_cb get_child_record_at_p;
        __ctsvc_record_clone_child_record_list_cb clone_child_record_list;
-}ctsvc_record_plugin_cb_s;
+} ctsvc_record_plugin_cb_s;
 
 typedef struct {
        int r_type;
        const ctsvc_record_plugin_cb_s *plugin_cbs;
-       const charview_uri;
+       const char *view_uri;
        unsigned int property_max_count;
-       unsigned charproperties_flags;
+       unsigned char *properties_flags;
        unsigned char property_flag;
-}ctsvc_record_s;
+} ctsvc_record_s;
 
-typedef struct  {
+typedef struct {
        int filter_type;
-}ctsvc_filter_s;
+} ctsvc_filter_s;
 
 typedef struct {
        int filter_type;
@@ -200,9 +196,9 @@ typedef struct {
        GSList *filters;    /* ctsvc_filter_h l_filter; */
        property_info_s *properties;
        unsigned int property_count;
-}ctsvc_composite_filter_s;
+} ctsvc_composite_filter_s;
 
-typedef struct  {
+typedef struct {
        int filter_type;
        int property_id;
        int match;
@@ -213,10 +209,10 @@ typedef struct  {
                long long int l;
                double d;
        }value;
-}ctsvc_attribute_filter_s;
+} ctsvc_attribute_filter_s;
 
-typedef struct  {
-       charview_uri;
+typedef struct {
+       char *view_uri;
        ctsvc_composite_filter_s *filter;
        unsigned int *projection;
        unsigned int projection_count;
@@ -225,7 +221,7 @@ typedef struct  {
        property_info_s *properties;
        unsigned int property_count;
        bool distinct;
-}ctsvc_query_s;
+} ctsvc_query_s;
 
 typedef struct {
        int l_type;
@@ -233,7 +229,7 @@ typedef struct {
        GList *records;
        GList *deleted_records;
        GList *cursor;
-}ctsvc_list_s;
+} ctsvc_list_s;
 
 typedef struct {
        ctsvc_record_s base;
@@ -241,7 +237,7 @@ typedef struct {
        char *name;
        int account_id;
        int mode;
-}ctsvc_addressbook_s;
+} ctsvc_addressbook_s;
 
 typedef struct {
        ctsvc_record_s base;
@@ -254,7 +250,7 @@ typedef struct {
        char *vibration;
        char *image_thumbnail_path;
        char *message_alert;
-}ctsvc_group_s;
+} ctsvc_group_s;
 
 typedef struct {
        ctsvc_record_s base;
@@ -272,7 +268,7 @@ typedef struct {
        char *status;
        int link_count;
        char *addressbook_ids;
-}ctsvc_person_s;
+} ctsvc_person_s;
 
 typedef struct {
        ctsvc_record_s base;
@@ -290,7 +286,7 @@ typedef struct {
        char *display_name;
        char *uid;
        int display_source_type;
-}ctsvc_simple_contact_s;
+} ctsvc_simple_contact_s;
 
 typedef struct {
        ctsvc_record_s base;
@@ -308,7 +304,7 @@ typedef struct {
        char *phonetic_last;
        char *lookup;
        char *reverse_lookup;
-}ctsvc_name_s;
+} ctsvc_name_s;
 
 typedef struct {
        ctsvc_record_s base;
@@ -321,7 +317,7 @@ typedef struct {
        char *cleaned;     /* internally used */
        char *normalized;  /* internally used */
        char *lookup;      /* internally used : for min match */
-}ctsvc_number_s;
+} ctsvc_number_s;
 
 typedef struct {
        ctsvc_record_s base;
@@ -331,7 +327,7 @@ typedef struct {
        int type;
        char *label;
        char *email_addr;
-}ctsvc_email_s;
+} ctsvc_email_s;
 
 typedef struct {
        ctsvc_record_s base;
@@ -340,7 +336,7 @@ typedef struct {
        int type;
        char *label;
        char *url;
-}ctsvc_url_s;
+} ctsvc_url_s;
 
 typedef struct {
        ctsvc_record_s base;
@@ -356,7 +352,7 @@ typedef struct {
        char *street;
        char *extended;
        char *country;
-}ctsvc_address_s;
+} ctsvc_address_s;
 
 typedef struct {
        ctsvc_record_s base;
@@ -367,7 +363,7 @@ typedef struct {
        int date;
        bool is_leap_month;  /* deprecated */
        int calendar_type;
-}ctsvc_event_s;
+} ctsvc_event_s;
 
 typedef struct {
        ctsvc_record_s base;
@@ -376,7 +372,7 @@ typedef struct {
        int type;
        char *label;
        char *im_id;
-}ctsvc_messenger_s;
+} ctsvc_messenger_s;
 
 typedef struct {
        ctsvc_record_s base;
@@ -384,7 +380,7 @@ typedef struct {
        int contact_id;
        int group_id;
        char *group_name;
-}ctsvc_group_relation_s;
+} ctsvc_group_relation_s;
 
 typedef struct {
        ctsvc_record_s base;
@@ -393,7 +389,7 @@ typedef struct {
        int type;
        char *label;
        char *nickname;
-}ctsvc_nickname_s;
+} ctsvc_nickname_s;
 
 typedef struct {
        ctsvc_record_s base;
@@ -408,7 +404,7 @@ typedef struct {
        char *uri;
        char *category;
        char *extra_data;
-}ctsvc_profile_s;
+} ctsvc_profile_s;
 
 typedef struct {
        ctsvc_record_s base;
@@ -417,7 +413,7 @@ typedef struct {
        int type;
        char *label;
        char *name;
-}ctsvc_relationship_s;
+} ctsvc_relationship_s;
 
 typedef struct {
        ctsvc_record_s base;
@@ -428,14 +424,14 @@ typedef struct {
        int type;
        char *label;
        char *path;
-}ctsvc_image_s;
+} ctsvc_image_s;
 
 typedef struct {
        ctsvc_record_s base;
        int id;
        int contact_id;
        char *note;
-}ctsvc_note_s;
+} ctsvc_note_s;
 
 typedef struct {
        ctsvc_record_s base;
@@ -444,10 +440,10 @@ typedef struct {
        char *source_name;
        char *status;
        int timestamp;
-       ctsvc_list_sphotos;
+       ctsvc_list_s *photos;
        char *service_operation;
        char *uri;
-}ctsvc_activity_s;
+} ctsvc_activity_s;
 
 typedef struct {
        ctsvc_record_s base;
@@ -455,7 +451,7 @@ typedef struct {
        int activity_id;
        char *photo_url;
        int sort_index;
-}ctsvc_activity_photo_s;
+} ctsvc_activity_photo_s;
 
 typedef struct {
        ctsvc_record_s base;
@@ -474,7 +470,7 @@ typedef struct {
        char *location;
        char *description;
        char *phonetic_name;
-}ctsvc_company_s;
+} ctsvc_company_s;
 
 typedef struct {
        ctsvc_record_s base;
@@ -486,7 +482,7 @@ typedef struct {
        int extra_data1; /* duration, message_id */
        char *extra_data2; /*short message*/
        int sim_slot_no;
-}ctsvc_phonelog_s;
+} ctsvc_phonelog_s;
 
 typedef struct {
        ctsvc_record_s base;
@@ -504,7 +500,7 @@ typedef struct {
        char *data10;
        char *data11;
        char *data12;
-}ctsvc_extension_s;
+} ctsvc_extension_s;
 
 typedef struct {
        ctsvc_record_s base;
@@ -531,22 +527,22 @@ typedef struct {
        char *ringtone_path;
        char *vibration;
        char *message_alert;
-       ctsvc_list_sname;
-       ctsvc_list_snote;
-       ctsvc_list_scompany;
-       ctsvc_list_snumbers;
-       ctsvc_list_semails;
-       ctsvc_list_sgrouprelations;
-       ctsvc_list_sevents;
-       ctsvc_list_smessengers;
-       ctsvc_list_spostal_addrs;
-       ctsvc_list_surls;
-       ctsvc_list_snicknames;
-       ctsvc_list_sprofiles;
-       ctsvc_list_srelationships;
-       ctsvc_list_simages;
-       ctsvc_list_sextensions;
-}ctsvc_contact_s;
+       ctsvc_list_s *name;
+       ctsvc_list_s *note;
+       ctsvc_list_s *company;
+       ctsvc_list_s *numbers;
+       ctsvc_list_s *emails;
+       ctsvc_list_s *grouprelations;
+       ctsvc_list_s *events;
+       ctsvc_list_s *messengers;
+       ctsvc_list_s *postal_addrs;
+       ctsvc_list_s *urls;
+       ctsvc_list_s *nicknames;
+       ctsvc_list_s *profiles;
+       ctsvc_list_s *relationships;
+       ctsvc_list_s *images;
+       ctsvc_list_s *extensions;
+} ctsvc_contact_s;
 
 typedef struct {
        ctsvc_record_s base;
@@ -557,21 +553,21 @@ typedef struct {
        char *reverse_display_name;
        char *uid;
        char *image_thumbnail_path;
-       ctsvc_list_sname;
-       ctsvc_list_snote;
-       ctsvc_list_scompany;
-       ctsvc_list_snumbers;
-       ctsvc_list_semails;
-       ctsvc_list_sevents;
-       ctsvc_list_smessengers;
-       ctsvc_list_spostal_addrs;
-       ctsvc_list_surls;
-       ctsvc_list_snicknames;
-       ctsvc_list_sprofiles;
-       ctsvc_list_srelationships;
-       ctsvc_list_simages;
-       ctsvc_list_sextensions;
-}ctsvc_my_profile_s;
+       ctsvc_list_s *name;
+       ctsvc_list_s *note;
+       ctsvc_list_s *company;
+       ctsvc_list_s *numbers;
+       ctsvc_list_s *emails;
+       ctsvc_list_s *events;
+       ctsvc_list_s *messengers;
+       ctsvc_list_s *postal_addrs;
+       ctsvc_list_s *urls;
+       ctsvc_list_s *nicknames;
+       ctsvc_list_s *profiles;
+       ctsvc_list_s *relationships;
+       ctsvc_list_s *images;
+       ctsvc_list_s *extensions;
+} ctsvc_my_profile_s;
 
 
 typedef struct {
@@ -580,7 +576,7 @@ typedef struct {
        char *name;
        char *number;
        int sim_slot_no;
-}ctsvc_sdn_s;
+} ctsvc_sdn_s;
 
 typedef struct {
        ctsvc_record_s base;
@@ -590,7 +586,7 @@ typedef struct {
        int addressbook_id;
        bool image_changed;
        int last_changed_type;  /* it is used for _contacts_my_profile_updated_info */
-}ctsvc_updated_info_s;
+} ctsvc_updated_info_s;
 
 typedef struct {
        ctsvc_record_s base;
@@ -603,7 +599,7 @@ typedef struct {
        char *label;
        char *number;
        int dial_number;
-}ctsvc_speeddial_s;
+} ctsvc_speeddial_s;
 
 typedef struct {
        int property_id;
@@ -615,16 +611,16 @@ typedef struct {
                long long int l;
                double d;
        }value;
-}ctsvc_result_value_s;
+} ctsvc_result_value_s;
 
 typedef struct {
        ctsvc_record_s base;
        GSList *values;
-}ctsvc_result_s;
+} ctsvc_result_s;
 
 typedef struct {
        int version;
        int connection_count;
-}ctsvc_base_s;
+} ctsvc_base_s;
 
 #endif /* __CTSVC_STRUCT_H__ */
index 587980c..d631692 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
  * limitations under the License.
  *
  */
-
 #include <glib.h>
 #include <errno.h>
 #include <ctype.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include <sys/time.h>
 #include <unicode/ucnv.h>
 #include <unicode/ustring.h>
 #include <tzplatform_config.h>
 
 #define DEFAULT_ADDRESS_BOOK_ID 0
 
-#define SMART_STRDUP(src) (src && *src)?strdup(src):NULL
+#define SMART_STRDUP(src) (src && *src) ? strdup(src) : NULL
 #define CTSVC_VCARD_PHOTO_MAX_SIZE 1024*1024
 
 #define CTSVC_VCARD_APPEND_STR(buf, buf_size, len, str) do { \
        if ((len = __ctsvc_vcard_append_str(buf, buf_size, len, str, false)) < 0) { \
-               CTS_ERR("__ctsvc_vcard_append_str() Fail"); \
+               ERR("__ctsvc_vcard_append_str() Fail"); \
                return CONTACTS_ERROR_OUT_OF_MEMORY; \
        } \
 } while (0)
@@ -117,7 +113,7 @@ enum {
        CTSVC_VCARD_VALUE_MAX
 };
 
-enum{
+enum {
        CTSVC_VCARD_IMG_NONE,
        CTSVC_VCARD_IMG_PNG,    /* Portable Network Graphics */
        /* vcard  2.1 spec */
@@ -233,8 +229,7 @@ static int __ctsvc_vcard_append_str(char **buf, int *buf_size, int len, const ch
                                        *r = '\\';
                                        r++;
                                        *r = 'n';
-                               }
-                               else {
+                               } else {
                                        *r = *s;
                                }
                                break;
@@ -242,11 +237,11 @@ static int __ctsvc_vcard_append_str(char **buf, int *buf_size, int len, const ch
                                *r = '\\';
                                r++;
                                str_len++;
-                               if (*buf_size<str_len+len+1) {
+                               if (*buf_size < str_len+len+1) {
                                        *buf_size = *buf_size * 2;
-                                       if (NULL == (tmp = realloc(*buf, *buf_size)))
+                                       if (NULL == (tmp = realloc(*buf, *buf_size))) {
                                                return -1;
-                                       else {
+                                       else {
                                                *buf = tmp;
                                                r = (char *)(*buf+len+str_len);
                                        }
@@ -262,11 +257,11 @@ static int __ctsvc_vcard_append_str(char **buf, int *buf_size, int len, const ch
                                *r = '\\';
                                r++;
                                str_len++;
-                               if (*buf_size<str_len+len+1) {
+                               if (*buf_size < str_len+len+1) {
                                        *buf_size = *buf_size * 2;
-                                       if (NULL == (tmp = realloc(*buf, *buf_size)))
+                                       if (NULL == (tmp = realloc(*buf, *buf_size))) {
                                                return -1;
-                                       else {
+                                       else {
                                                *buf = tmp;
                                                r = (char *)(*buf+len+str_len);
                                        }
@@ -278,11 +273,11 @@ static int __ctsvc_vcard_append_str(char **buf, int *buf_size, int len, const ch
                                        *r = '\\';
                                        r++;
                                        str_len++;
-                                       if (*buf_size<str_len+len+1) {
+                                       if (*buf_size < str_len+len+1) {
                                                *buf_size = *buf_size * 2;
-                                               if (NULL == (tmp = realloc(*buf, *buf_size)))
+                                               if (NULL == (tmp = realloc(*buf, *buf_size))) {
                                                        return -1;
-                                               else {
+                                               else {
                                                        *buf = tmp;
                                                        r = (char *)(*buf+len+str_len);
                                                }
@@ -291,18 +286,17 @@ static int __ctsvc_vcard_append_str(char **buf, int *buf_size, int len, const ch
                                        *r = *s;
                                        r++;
                                        s++;
-                                       if (*buf_size<str_len+len+1) {
+                                       if (*buf_size < str_len+len+1) {
                                                *buf_size = *buf_size * 2;
-                                               if (NULL == (tmp = realloc(*buf, *buf_size)))
+                                               if (NULL == (tmp = realloc(*buf, *buf_size))) {
                                                        return -1;
-                                               else {
+                                               else {
                                                        *buf = tmp;
                                                        r = (char *)(*buf+len+str_len);
                                                }
                                        }
                                        *r = *s;
-                               }
-                               else {
+                               } else {
                                        *r = *s;
                                }
                                break;
@@ -311,11 +305,11 @@ static int __ctsvc_vcard_append_str(char **buf, int *buf_size, int len, const ch
                                        *r = '\\';
                                        r++;
                                        str_len++;
-                                       if (*buf_size<str_len+len+1) {
+                                       if (*buf_size < str_len+len+1) {
                                                *buf_size = *buf_size * 2;
-                                               if (NULL == (tmp = realloc(*buf, *buf_size)))
+                                               if (NULL == (tmp = realloc(*buf, *buf_size))) {
                                                        return -1;
-                                               else {
+                                               else {
                                                        *buf = tmp;
                                                        r = (char *)(*buf+len+str_len);
                                                }
@@ -324,18 +318,17 @@ static int __ctsvc_vcard_append_str(char **buf, int *buf_size, int len, const ch
                                        *r = *s;
                                        r++;
                                        s++;
-                                       if (*buf_size<str_len+len+1) {
+                                       if (*buf_size < str_len+len+1) {
                                                *buf_size = *buf_size * 2;
-                                               if (NULL == (tmp = realloc(*buf, *buf_size)))
+                                               if (NULL == (tmp = realloc(*buf, *buf_size))) {
                                                        return -1;
-                                               else {
+                                               else {
                                                        *buf = tmp;
                                                        r = (char *)(*buf+len+str_len);
                                                }
                                        }
                                        *r = *s;
-                               }
-                               else {
+                               } else {
                                        *r = *s;
                                }
                                break;
@@ -347,8 +340,7 @@ static int __ctsvc_vcard_append_str(char **buf, int *buf_size, int len, const ch
                        s++;
                }
                len_temp = str_len;
-       }
-       else {
+       } else {
                len_temp = snprintf(*buf+len, *buf_size-len+1, "%s", safe_str);
        }
        len += len_temp;
@@ -369,7 +361,7 @@ static inline int __ctsvc_vcard_add_folding(char **buf, int *buf_size, int buf_l
 
        buf_copy = calloc(1, *buf_size);
        if (NULL == buf_copy) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                return 0;
        }
 
@@ -384,8 +376,7 @@ static inline int __ctsvc_vcard_add_folding(char **buf, int *buf_size, int buf_l
                        if (NULL == (tmp = realloc(buf_copy, *buf_size))) {
                                free(buf_copy);
                                return -1;
-                       }
-                       else {
+                       } else {
                                buf_copy = tmp;
                                r = (buf_copy + result_len);
                        }
@@ -398,9 +389,9 @@ static inline int __ctsvc_vcard_add_folding(char **buf, int *buf_size, int buf_l
                                encode_64 = true;
                }
 
-               if ('\r' == *s)
+               if ('\r' == *s) {
                        len--;
-               else if ('\n' == *s) {
+               else if ('\n' == *s) {
                        len = -1;
                        char_len = 0;
                        content_start = false;
@@ -446,7 +437,7 @@ static inline int __ctsvc_vcard_append_name(ctsvc_list_s *names, char **buf, int
 
        RETV_IF(NULL == cursor, len);
 
-       name = (ctsvc_name_s *)cursor->data;
+       name = cursor->data;
 
        CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_N]);
 
@@ -471,14 +462,13 @@ static inline int __ctsvc_vcard_append_name(ctsvc_list_s *names, char **buf, int
 #endif
                if (CONTACTS_NAME_DISPLAY_ORDER_FIRSTLAST == order) {
                        snprintf(display, sizeof(display), "%s %s", name->first, name->last);
-               }
-               else {
+               } else {
                        /* CONTACTS_NAME_DISPLAY_ORDER_LASTFIRST */
                        snprintf(display, sizeof(display), "%s, %s", name->last, name->first);
                }
-       }
-       else
+       } else {
                snprintf(display, sizeof(display), "%s%s", SAFE_STR(name->first), SAFE_STR(name->last));
+       }
 
        CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_FN]);
        CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, display);
@@ -712,16 +702,14 @@ static bool __ctsvc_vcard_is_valid_custom_label(char *label)
        return true;
 }
 
-static inline int __ctsvc_vcard_put_company_type(int type, char *label, char **buf, intbuf_size, int len)
+static inline int __ctsvc_vcard_put_company_type(int type, char *label, char **buf, int *buf_size, int len)
 {
        if (type == CONTACTS_COMPANY_TYPE_WORK) {
-               CTSVC_VCARD_APPEND_STR(buf,buf_size,len,";TYPE=WORK");
-       }
-
-       else if (type == CONTACTS_COMPANY_TYPE_CUSTOM) {
+               CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=WORK");
+       } else if (type == CONTACTS_COMPANY_TYPE_CUSTOM) {
                if (__ctsvc_vcard_is_valid_custom_label(label)) {
-                       CTSVC_VCARD_APPEND_STR(buf,buf_size,len,";TYPE=X-");
-                       CTSVC_VCARD_APPEND_STR(buf,buf_size,len, label);
+                       CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=X-");
+                       CTSVC_VCARD_APPEND_STR(buf, buf_size, len, label);
                }
        }
        return len;
@@ -732,9 +720,9 @@ static inline int __ctsvc_vcard_append_company(ctsvc_list_s *company_list, char
        GList *cursor;
        ctsvc_company_s *company;
 
-       for (cursor=company_list->records;cursor;cursor=cursor->next) {
+       for (cursor = company_list->records; cursor; cursor = cursor->next) {
 
-               company = (ctsvc_company_s *)cursor->data;
+               company = cursor->data;
 
                CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_ORG]);
 
@@ -742,42 +730,42 @@ static inline int __ctsvc_vcard_append_company(ctsvc_list_s *company_list, char
                RETV_IF(len < 0, CONTACTS_ERROR_OUT_OF_MEMORY);
 
                CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";CHARSET=UTF-8");
-               CTSVC_VCARD_APPEND_STR(buf,buf_size,len,":");
-               CTSVC_VCARD_APPEND_CONTENT_STR(buf,buf_size,len,company->name);
+               CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ":");
+               CTSVC_VCARD_APPEND_CONTENT_STR(buf, buf_size, len, company->name);
                if (company->department) {
-                       CTSVC_VCARD_APPEND_STR(buf,buf_size,len,";");
-                       CTSVC_VCARD_APPEND_CONTENT_STR(buf,buf_size,len,company->department);
+                       CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";");
+                       CTSVC_VCARD_APPEND_CONTENT_STR(buf, buf_size, len, company->department);
                }
 
-               CTSVC_VCARD_APPEND_STR(buf,buf_size,len,CTSVC_CRLF);
+               CTSVC_VCARD_APPEND_STR(buf, buf_size, len, CTSVC_CRLF);
 
                if (company->job_title) {
-                       CTSVC_VCARD_APPEND_STR(buf,buf_size,len,content_name[CTSVC_VCARD_VALUE_TITLE]);
+                       CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_TITLE]);
                        CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, company->job_title);
                }
 
                if (company->role) {
-                       CTSVC_VCARD_APPEND_STR(buf,buf_size,len,content_name[CTSVC_VCARD_VALUE_ROLE]);
+                       CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_ROLE]);
                        CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, company->role);
                }
 
                if (company->location) {
-                       CTSVC_VCARD_APPEND_STR(buf,buf_size,len,content_name[CTSVC_VCARD_VALUE_X_TIZEN_COMPANY_LOCATION]);
+                       CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_X_TIZEN_COMPANY_LOCATION]);
                        CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, company->location);
                }
 
                if (company->description) {
-                       CTSVC_VCARD_APPEND_STR(buf,buf_size,len,content_name[CTSVC_VCARD_VALUE_X_TIZEN_COMPANY_DESCRIPTION]);
+                       CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_X_TIZEN_COMPANY_DESCRIPTION]);
                        CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, company->description);
                }
 
                if (company->phonetic_name) {
-                       CTSVC_VCARD_APPEND_STR(buf,buf_size,len,content_name[CTSVC_VCARD_VALUE_X_TIZEN_COMPANY_PHONETIC_NAME]);
+                       CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_X_TIZEN_COMPANY_PHONETIC_NAME]);
                        CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, company->phonetic_name);
                }
 
                if (company->assistant_name) {
-                       CTSVC_VCARD_APPEND_STR(buf,buf_size,len,content_name[CTSVC_VCARD_VALUE_X_TIZEN_COMPANY_ASSISTANT_NAME]);
+                       CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_X_TIZEN_COMPANY_ASSISTANT_NAME]);
                        CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, company->assistant_name);
                }
 
@@ -795,8 +783,8 @@ static inline int __ctsvc_vcard_append_note(ctsvc_list_s *note_list, char **buf,
        GList *cursor;
        ctsvc_note_s *note;
 
-       for (cursor=note_list->records;cursor;cursor=cursor->next) {
-               note = (ctsvc_note_s *)cursor->data;
+       for (cursor = note_list->records; cursor; cursor = cursor->next) {
+               note = cursor->data;
                if (note->note) {
                        CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_NOTE]);
                        CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, note->note);
@@ -857,12 +845,12 @@ static inline int __ctsvc_vcard_put_postal_type(int type, char *label, char **bu
        return len;
 }
 
-static inline int __ctsvc_vcard_append_postals(ctsvc_list_s *address_list, char **buf, intbuf_size, int len)
+static inline int __ctsvc_vcard_append_postals(ctsvc_list_s *address_list, char **buf, int *buf_size, int len)
 {
        GList *cursor;
        ctsvc_address_s *address;
 
-       for (cursor = address_list->records;cursor;cursor=cursor->next) {
+       for (cursor = address_list->records; cursor; cursor = cursor->next) {
                address = cursor->data;
                if (address) {
                        CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_ADR]);
@@ -870,9 +858,8 @@ static inline int __ctsvc_vcard_append_postals(ctsvc_list_s *address_list, char
                        len = __ctsvc_vcard_put_postal_type(address->type, SAFE_STR(address->label), buf, buf_size, len);
                        RETV_IF(len < 0, CONTACTS_ERROR_OUT_OF_MEMORY);
 
-                       if (address->is_default) {
+                       if (address->is_default)
                                CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";PREF");
-                       }
 
                        CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";CHARSET=UTF-8");
                        CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ":");
@@ -897,14 +884,14 @@ static inline int __ctsvc_vcard_append_postals(ctsvc_list_s *address_list, char
        return len;
 }
 
-static inline int __ctsvc_vcard_append_nicknames(ctsvc_list_s *nickname_list, char **buf, intbuf_size, int len)
+static inline int __ctsvc_vcard_append_nicknames(ctsvc_list_s *nickname_list, char **buf, int *buf_size, int len)
 {
        bool first;
        GList *cursor;
        ctsvc_nickname_s *nickname;
 
        first = true;
-       for (cursor=nickname_list->records;cursor;cursor=cursor->next) {
+       for (cursor = nickname_list->records; cursor; cursor = cursor->next) {
                nickname = cursor->data;
                if (nickname->nickname && *nickname->nickname) {
                        if (first) {
@@ -913,8 +900,7 @@ static inline int __ctsvc_vcard_append_nicknames(ctsvc_list_s *nickname_list, ch
                                CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ":");
                                CTSVC_VCARD_APPEND_CONTENT_STR(buf, buf_size, len, nickname->nickname);
                                first = false;
-                       }
-                       else {
+                       } else {
                                CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ",");
                                CTSVC_VCARD_APPEND_CONTENT_STR(buf, buf_size, len, nickname->nickname);
                        }
@@ -1028,7 +1014,7 @@ static int __ctsvc_vcard_check_utf8(char c)
 static void __ctsvc_vcard_get_clean_number_for_export(char *str, char *dest)
 {
        int char_len = 0;
-       char *s= SAFE_STR(str);
+       char *s = SAFE_STR(str);
        char *r = NULL;
 
        r = dest;
@@ -1038,126 +1024,120 @@ static void __ctsvc_vcard_get_clean_number_for_export(char *str, char *dest)
                if (3 == char_len) {
                        if (*s == 0xef) {
                                if (*(s+1) == 0xbc) {
-                                       if (0x90 <= *(s+2) && *(s+2) <= 0x99) {  /* ef bc 90 : '0' ~ ef bc 99 : '9' */
+                                       if (0x90 <= *(s+2) && *(s+2) <= 0x99) {
+                                               /* ef bc 90 : '0' ~ ef bc 99 : '9' */
                                                *r = '0' + (*(s+2) - 0x90);
                                                r++;
-                                               s+=3;
-                                       }
-                                       else if (0x8b == *(s+2)) {   /* ef bc 8b : '+' */
+                                               s += 3;
+                                       } else if (0x8b == *(s+2)) {
+                                               /* ef bc 8b : '+' */
                                                *r = '+';
                                                r++;
-                                               s+=3;
-                                       }
-                                       else if (0x8a == *(s+2)) {   /* ef bc 8a : '*' */
+                                               s += 3;
+                                       } else if (0x8a == *(s+2)) {
+                                               /* ef bc 8a : '*' */
                                                *r = '*';
                                                r++;
-                                               s+=3;
-                                       }
-                                       else if (0x83 == *(s+2)) {   /* ef bc 83 : '#' */
+                                               s += 3;
+                                       } else if (0x83 == *(s+2)) {
+                                               /* ef bc 83 : '#' */
                                                *r = '#';
                                                r++;
-                                               s+=3;
-                                       }
-                                       else if (0x8c == *(s+2)) {   /* ef bc 8c : ',' */
+                                               s += 3;
+                                       } else if (0x8c == *(s+2)) {
+                                               /* ef bc 8c : ',' */
                                                *r = 'p';
                                                r++;
-                                               s+=3;
-                                       }
-                                       else if (0x9b == *(s+2)) {   /* ef bc 9b : ';' */
+                                               s += 3;
+                                       } else if (0x9b == *(s+2)) {
+                                               /* ef bc 9b : ';' */
                                                *r = 'w';
                                                r++;
-                                               s+=3;
-                                       }
-                                       else {
-                                               s+=char_len;
+                                               s += 3;
+                                       } else {
+                                               s += char_len;
                                        }
+                               } else {
+                                       s += char_len;
                                }
-                               else {
-                                       s+=char_len;
-                               }
-                       }
-                       else {
-                               s+=char_len;
+                       } else {
+                               s += char_len;
                        }
-               }
-               else if (1 == char_len) {
+               } else if (1 == char_len) {
                        switch (*s) {
-                               case '/':
-                               case '.':
-                               case '0' ... '9':
-                               case '#':
-                               case '*':
-                               case '(':
-                               case ')':
-                               case '+':
-                                       *r = *s;
-                                       r++;
-                                       s++;
-                                       break;
-                               case ',':
-                               case 'p':
-                               case 'P':
-                                       *r = 'p';
-                                       r++;
-                                       s++;
-                                       break;
-                               case ';':
-                               case 'w':
-                               case 'W':
-                                       *r = 'w';
-                                       r++;
-                                       s++;
-                                       break;
-                               case 'a' ... 'o':
-                               case 'q' ... 'v':
-                               case 'x' ... 'z':
-                                       *r = *s - 0x20;
-                                       r++;
-                                       s++;
-                                       break;
-                               case 'A' ... 'O':
-                               case 'Q' ... 'V':
-                               case 'X' ... 'Z':
-                                       *r = *s;
-                                       r++;
-                                       s++;
-                                       break;
-                               default:
-                                       s++;
-                                       break;
+                       case '/':
+                       case '.':
+                       case '0' ... '9':
+                       case '#':
+                       case '*':
+                       case '(':
+                       case ')':
+                       case '+':
+                               *r = *s;
+                               r++;
+                               s++;
+                               break;
+                       case ',':
+                       case 'p':
+                       case 'P':
+                               *r = 'p';
+                               r++;
+                               s++;
+                               break;
+                       case ';':
+                       case 'w':
+                       case 'W':
+                               *r = 'w';
+                               r++;
+                               s++;
+                               break;
+                       case 'a' ... 'o':
+                       case 'q' ... 'v':
+                       case 'x' ... 'z':
+                               *r = *s - 0x20;
+                               r++;
+                               s++;
+                               break;
+                       case 'A' ... 'O':
+                       case 'Q' ... 'V':
+                       case 'X' ... 'Z':
+                               *r = *s;
+                               r++;
+                               s++;
+                               break;
+                       default:
+                               s++;
+                               break;
                        }
-               }
-               else {
-                       s+=char_len;
+               } else {
+                       s += char_len;
                }
        }
        *r = '\0';
        return;
 }
 
-static inline int __ctsvc_vcard_append_numbers(ctsvc_list_s *number_list, char **buf, intbuf_size, int len)
+static inline int __ctsvc_vcard_append_numbers(ctsvc_list_s *number_list, char **buf, int *buf_size, int len)
 {
        GList *cursor;
        ctsvc_number_s *number;
 
-       for (cursor=number_list->records;cursor;cursor=cursor->next) {
+       for (cursor = number_list->records; cursor; cursor = cursor->next) {
                number = cursor->data;
                if (number->number) {
                        char clean_number[strlen(number->number)+1];
                        clean_number[0] = '\0';
-                       CTSVC_VCARD_APPEND_STR(buf,buf_size,len,content_name[CTSVC_VCARD_VALUE_TEL]);
+                       CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_TEL]);
 
                        len = __ctsvc_vcard_put_number_type(number->type, SAFE_STR(number->label), buf, buf_size, len);
                        RETV_IF(len < 0, CONTACTS_ERROR_OUT_OF_MEMORY);
 
-                       if (number->is_default) {
-                               CTSVC_VCARD_APPEND_STR(buf,buf_size,len,";PREF");
-                       }
+                       if (number->is_default)
+                               CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";PREF");
 
                        __ctsvc_vcard_get_clean_number_for_export(number->number, clean_number);
-                       if (*clean_number) {
+                       if (*clean_number)
                                CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, clean_number);
-                       }
                }
        }
        return len;
@@ -1178,13 +1158,13 @@ static inline int __ctsvc_vcard_2_put_email_type(int type, char *dest, int dest_
 static inline int __ctsvc_vcard_put_email_type(int type, char *label, char **buf, int *buf_size, int len)
 {
        char *type_str = NULL;
-       if (CONTACTS_EMAIL_TYPE_HOME == type)
+       if (CONTACTS_EMAIL_TYPE_HOME == type) {
                type_str = "HOME";
-       else if (CONTACTS_EMAIL_TYPE_WORK == type)
+       } else if (CONTACTS_EMAIL_TYPE_WORK == type) {
                type_str = "WORK";
-       else if (CONTACTS_EMAIL_TYPE_MOBILE == type)
+       } else if (CONTACTS_EMAIL_TYPE_MOBILE == type) {
                type_str = "CELL";
-       else if (CONTACTS_EMAIL_TYPE_CUSTOM == type) {
+       else if (CONTACTS_EMAIL_TYPE_CUSTOM == type) {
                if (__ctsvc_vcard_is_valid_custom_label(label)) {
                        CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=X-");
                        CTSVC_VCARD_APPEND_STR(buf, buf_size, len, label);
@@ -1204,7 +1184,7 @@ static inline int __ctsvc_vcard_append_emails(ctsvc_list_s *email_list, char **b
        GList *cursor;
        ctsvc_email_s *email;
 
-       for (cursor=email_list->records;cursor;cursor=cursor->next) {
+       for (cursor = email_list->records; cursor; cursor = cursor->next) {
                email = cursor->data;
                if (email->email_addr) {
                        CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_EMAIL]);
@@ -1212,9 +1192,9 @@ static inline int __ctsvc_vcard_append_emails(ctsvc_list_s *email_list, char **b
                        len = __ctsvc_vcard_put_email_type(email->type, SAFE_STR(email->label), buf, buf_size, len);
                        RETV_IF(len < 0, CONTACTS_ERROR_OUT_OF_MEMORY);
 
-                       if (email->is_default) {
+                       if (email->is_default)
                                CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";PREF");
-                       }
+
                        CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, email->email_addr);
                }
        }
@@ -1225,11 +1205,11 @@ static inline int __ctsvc_vcard_put_url_type(int type, char *label, char **buf,
 {
        char *type_str = NULL;
 
-       if (CONTACTS_URL_TYPE_HOME == type)
+       if (CONTACTS_URL_TYPE_HOME == type) {
                type_str = "HOME";
-       else if (CONTACTS_URL_TYPE_WORK == type)
+       } else if (CONTACTS_URL_TYPE_WORK == type) {
                type_str = "WORK";
-       else if (CONTACTS_URL_TYPE_CUSTOM == type) {
+       else if (CONTACTS_URL_TYPE_CUSTOM == type) {
                if (__ctsvc_vcard_is_valid_custom_label(label)) {
                        CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=X-");
                        CTSVC_VCARD_APPEND_STR(buf, buf_size, len, label);
@@ -1248,7 +1228,7 @@ static inline int __ctsvc_vcard_append_webs(ctsvc_list_s *url_list, char **buf,
        GList *cursor;
        ctsvc_url_s *url;
 
-       for (cursor=url_list->records;cursor;cursor=cursor->next) {
+       for (cursor = url_list->records; cursor; cursor = cursor->next) {
                url = cursor->data;
 
                CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_URL]);
@@ -1271,7 +1251,7 @@ static inline int __ctsvc_vcard_append_events(ctsvc_list_s *event_list, char **b
        ctsvc_event_s *data;
        char event[VCARD_ITEM_LENGTH] = {0};
 
-       for (cursor=event_list->records;cursor;cursor=cursor->next) {
+       for (cursor = event_list->records; cursor; cursor = cursor->next) {
                data = cursor->data;
                if (0 == data->date) continue;
 
@@ -1281,29 +1261,25 @@ static inline int __ctsvc_vcard_append_events(ctsvc_list_s *event_list, char **b
                                        content_name[CTSVC_VCARD_VALUE_BDAY],
                                        data->date/10000, (data->date%10000)/100, data->date%100,
                                        CTSVC_CRLF);
-               }
-               else if (CONTACTS_EVENT_TYPE_ANNIVERSARY == data->type) {
+               } else if (CONTACTS_EVENT_TYPE_ANNIVERSARY == data->type) {
                        snprintf(event, sizeof(event), "%s;TYPE=ANNIVERSARY:%d-%02d-%02d%s",
                                        content_name[CTSVC_VCARD_VALUE_X_TIZEN_EVENT],
                                        data->date/10000, (data->date%10000)/100, data->date%100,
                                        CTSVC_CRLF);
-               }
-               else if (CONTACTS_EVENT_TYPE_CUSTOM == data->type) {
+               } else if (CONTACTS_EVENT_TYPE_CUSTOM == data->type) {
                        if (__ctsvc_vcard_is_valid_custom_label(data->label)) {
                                snprintf(event, sizeof(event), "%s;TYPE=X-%s:%d-%02d-%02d%s",
                                                content_name[CTSVC_VCARD_VALUE_X_TIZEN_EVENT],
                                                SAFE_STR(data->label),
                                                data->date/10000, (data->date%10000)/100, data->date%100,
                                                CTSVC_CRLF);
-                       }
-                       else {
+                       } else {
                                snprintf(event, sizeof(event), "%s:%d-%02d-%02d%s",
                                                content_name[CTSVC_VCARD_VALUE_X_TIZEN_EVENT],
                                                data->date/10000, (data->date%10000)/100, data->date%100,
                                                CTSVC_CRLF);
                        }
-               }
-               else {
+               } else {
                        snprintf(event, sizeof(event), "%s:%d-%02d-%02d%s",
                                        content_name[CTSVC_VCARD_VALUE_X_TIZEN_EVENT],
                                        data->date/10000, (data->date%10000)/100, data->date%100,
@@ -1322,7 +1298,7 @@ static inline int __ctsvc_vcard_append_messengers(ctsvc_list_s *messenger_list,
        const char *content_name_messenger = NULL;
        const char *content_name_x_type = NULL;
 
-       for (cursor=messenger_list->records;cursor;cursor=cursor->next) {
+       for (cursor = messenger_list->records; cursor; cursor = cursor->next) {
                messenger = cursor->data;
 
                content_name_messenger = NULL;
@@ -1377,8 +1353,7 @@ static inline int __ctsvc_vcard_append_messengers(ctsvc_list_s *messenger_list,
                        if (content_name_messenger) {
                                CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name_messenger);
                                CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, messenger->im_id);
-                       }
-                       else if (content_name_x_type) {
+                       } else if (content_name_x_type) {
                                CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_X_TIZEN_MESSENGER]);
                                CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";TYPE=");
                                CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name_x_type);
@@ -1389,7 +1364,7 @@ static inline int __ctsvc_vcard_append_messengers(ctsvc_list_s *messenger_list,
        return len;
 }
 
-static inline int __ctsvc_vcard_put_relationship_type(int type, char *label, char **buf, intbuf_size, int len)
+static inline int __ctsvc_vcard_put_relationship_type(int type, char *label, char **buf, int *buf_size, int len)
 {
        const char *type_str = NULL;
 
@@ -1457,7 +1432,7 @@ static inline int __ctsvc_vcard_append_relationships(ctsvc_list_s *relationship_
        GList *cursor;
        ctsvc_relationship_s *relationship;
 
-       for (cursor=relationship_list->records;cursor;cursor=cursor->next) {
+       for (cursor = relationship_list->records; cursor; cursor = cursor->next) {
                relationship = cursor->data;
 
                if (relationship->name) {
@@ -1483,7 +1458,7 @@ static inline int __ctsvc_vcard_put_photo(ctsvc_list_s *image_list, char **buf,
        GList *cursor;
        ctsvc_image_s *data;
 
-       for (cursor=image_list->records;cursor;cursor=cursor->next) {
+       for (cursor = image_list->records; cursor; cursor = cursor->next) {
                data = cursor->data;
                if (NULL == data->path) continue;
 
@@ -1592,7 +1567,7 @@ static inline int __ctsvc_vcard_append_contact(ctsvc_contact_s *contact, char **
                CTSVC_VCARD_APPEND_STR(buf, buf_size, len, temp);
        }
 #if 0
-       ctsvc_list_sprofile;
+       ctsvc_list_s *profile;
 #endif
        return len;
 }
@@ -1667,7 +1642,7 @@ static inline int __ctsvc_vcard_append_my_profile(ctsvc_my_profile_s *my_profile
        }
 
 #if 0
-               ctsvc_list_s* profile;
+       ctsvc_list_s *profile;
 #endif
        return len;
 }
@@ -1698,7 +1673,7 @@ static int __ctsvc_vcard_make(ctsvc_contact_s *contact, char **vcard_stream)
 
        buf = calloc(1, buf_size);
        if (NULL == buf) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
 
@@ -1740,7 +1715,7 @@ static int __ctsvc_vcard_make_from_my_profile(ctsvc_my_profile_s *my_profile, ch
 
        buf = calloc(1, buf_size);
        if (NULL == buf) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
 
@@ -1780,11 +1755,11 @@ API int contacts_vcard_make_from_contact(contacts_record_h record, char **vcard_
        *vcard_stream = NULL;
 
        RETVM_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER,
-               "Invalid parameter : contact(%p), vcard_stream(%p)", record, vcard_stream);
+                       "contact(%p), vcard_stream(%p)", record, vcard_stream);
 
        contact = (ctsvc_contact_s*)record;
        RETVM_IF(CTSVC_RECORD_CONTACT != contact->base.r_type, CONTACTS_ERROR_INVALID_PARAMETER,
-               "Invalid parameter : The record is not conatct record (type : %d)", contact->base.r_type);
+                       "The record is not conatct record (type : %d)", contact->base.r_type);
 
        return __ctsvc_vcard_make(contact, vcard_stream);
 }
@@ -1796,11 +1771,11 @@ API int contacts_vcard_make_from_my_profile(contacts_record_h record, char **vca
        *vcard_stream = NULL;
 
        RETVM_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER,
-               "Invalid parameter : my_profile(%p), vcard_stream(%p)", record, vcard_stream);
+                       "my_profile(%p), vcard_stream(%p)", record, vcard_stream);
 
        my_profile = (ctsvc_my_profile_s*)record;
        RETVM_IF(CTSVC_RECORD_MY_PROFILE != my_profile->base.r_type, CONTACTS_ERROR_INVALID_PARAMETER,
-               "Invalid parameter : The record is not conatct record (type : %d)", my_profile->base.r_type);
+                       "The record is not conatct record (type : %d)", my_profile->base.r_type);
 
        return __ctsvc_vcard_make_from_my_profile(my_profile, vcard_stream);
 }
@@ -1812,113 +1787,113 @@ static int __ctsvc_vcard_append_person(ctsvc_person_s *person, ctsvc_list_s *lis
        ctsvc_contact_s *contact;
        GList *cursor = NULL;
 
-       for (cursor=list_contacts->records;cursor;cursor=cursor->next) {
-               contact = (ctsvc_contact_s *)cursor->data;
+       for (cursor = list_contacts->records; cursor; cursor = cursor->next) {
+               contact = cursor->data;
                if (contact && contact->id == person->name_contact_id && contact->name) {
                        len = __ctsvc_vcard_append_name(contact->name, buf, buf_size, len);
                        RETV_IF(len < 0, len);
                }
        }
 
-       for (cursor=list_contacts->records;cursor;cursor=cursor->next) {
-               contact = (ctsvc_contact_s *)cursor->data;
+       for (cursor = list_contacts->records; cursor; cursor = cursor->next) {
+               contact = cursor->data;
                if (contact && contact->company && contact->company->cursor) {
                        len = __ctsvc_vcard_append_company(contact->company, buf, buf_size, len);
                        RETV_IF(len < 0, len);
                }
        }
 
-       for (cursor=list_contacts->records;cursor;cursor=cursor->next) {
-               contact = (ctsvc_contact_s *)cursor->data;
+       for (cursor = list_contacts->records; cursor; cursor = cursor->next) {
+               contact = cursor->data;
                if (contact && contact->note && contact->note->cursor) {
                        len = __ctsvc_vcard_append_note(contact->note, buf, buf_size, len);
                        RETV_IF(len < 0, len);
                }
        }
-       for (cursor=list_contacts->records;cursor;cursor=cursor->next) {
-               contact = (ctsvc_contact_s *)cursor->data;
+       for (cursor = list_contacts->records; cursor; cursor = cursor->next) {
+               contact = cursor->data;
                if (contact && contact->postal_addrs && contact->postal_addrs->cursor) {
                        len = __ctsvc_vcard_append_postals(contact->postal_addrs, buf, buf_size, len);
                        RETV_IF(len < 0, len);
                }
        }
-       for (cursor=list_contacts->records;cursor;cursor=cursor->next) {
-               contact = (ctsvc_contact_s *)cursor->data;
+       for (cursor = list_contacts->records; cursor; cursor = cursor->next) {
+               contact = cursor->data;
                if (contact && contact->numbers && contact->numbers->cursor) {
                        len = __ctsvc_vcard_append_numbers(contact->numbers, buf, buf_size, len);
                        RETV_IF(len < 0, len);
                }
        }
 
-       for (cursor=list_contacts->records;cursor;cursor=cursor->next) {
-               contact = (ctsvc_contact_s *)cursor->data;
+       for (cursor = list_contacts->records; cursor; cursor = cursor->next) {
+               contact = cursor->data;
                if (contact && contact->emails && contact->emails->cursor) {
                        len = __ctsvc_vcard_append_emails(contact->emails, buf, buf_size, len);
                        RETV_IF(len < 0, len);
                }
        }
 
-       for (cursor=list_contacts->records;cursor;cursor=cursor->next) {
-               contact = (ctsvc_contact_s *)cursor->data;
+       for (cursor = list_contacts->records; cursor; cursor = cursor->next) {
+               contact = cursor->data;
                if (contact && contact->nicknames && contact->nicknames->cursor) {
                        len = __ctsvc_vcard_append_nicknames(contact->nicknames, buf, buf_size, len);
                        RETV_IF(len < 0, len);
                }
        }
-       for (cursor=list_contacts->records;cursor;cursor=cursor->next) {
-               contact = (ctsvc_contact_s *)cursor->data;
+       for (cursor = list_contacts->records; cursor; cursor = cursor->next) {
+               contact = cursor->data;
                if (contact && contact->urls && contact->urls->cursor) {
                        len = __ctsvc_vcard_append_webs(contact->urls, buf, buf_size, len);
                        RETV_IF(len < 0, len);
                }
        }
 
-       for (cursor=list_contacts->records;cursor;cursor=cursor->next) {
-               contact = (ctsvc_contact_s *)cursor->data;
+       for (cursor = list_contacts->records; cursor; cursor = cursor->next) {
+               contact = cursor->data;
                if (contact && contact->events && contact->events->cursor) {
                        len = __ctsvc_vcard_append_events(contact->events, buf, buf_size, len);
                        RETV_IF(len < 0, len);
                }
        }
-       for (cursor=list_contacts->records;cursor;cursor=cursor->next) {
-               contact = (ctsvc_contact_s *)cursor->data;
+       for (cursor = list_contacts->records; cursor; cursor = cursor->next) {
+               contact = cursor->data;
                if (contact && contact->images && contact->images->cursor) {
                        len = __ctsvc_vcard_put_photo(contact->images, buf, buf_size, len);
                        RETV_IF(len < 0, len);
                }
        }
-       for (cursor=list_contacts->records;cursor;cursor=cursor->next) {
-               contact = (ctsvc_contact_s *)cursor->data;
+       for (cursor = list_contacts->records; cursor; cursor = cursor->next) {
+               contact = cursor->data;
                if (contact && contact->messengers && contact->messengers->cursor) {
                        len = __ctsvc_vcard_append_messengers(contact->messengers, buf, buf_size, len);
                        RETV_IF(len < 0, len);
                }
        }
 
-       for (cursor=list_contacts->records;cursor;cursor=cursor->next) {
-               contact = (ctsvc_contact_s *)cursor->data;
+       for (cursor = list_contacts->records; cursor; cursor = cursor->next) {
+               contact = cursor->data;
                if (contact && contact->relationships && contact->relationships->cursor) {
                        len = __ctsvc_vcard_append_relationships(contact->relationships, buf, buf_size, len);
                        RETV_IF(len < 0, len);
                }
        }
 
-       for (cursor=list_contacts->records;cursor;cursor=cursor->next) {
-               contact = (ctsvc_contact_s *)cursor->data;
+       for (cursor = list_contacts->records; cursor; cursor = cursor->next) {
+               contact = cursor->data;
                if (contact && contact->uid && DEFAULT_ADDRESS_BOOK_ID == contact->addressbook_id) {
                        CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_UID]);
                        CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, contact->uid);
                }
        }
-       for (cursor=list_contacts->records;cursor;cursor=cursor->next) {
-               contact = (ctsvc_contact_s *)cursor->data;
+       for (cursor = list_contacts->records; cursor; cursor = cursor->next) {
+               contact = cursor->data;
                if (contact && changed_time < contact->changed_time)
                        changed_time = contact->changed_time;
        }
 
        if (changed_time) {
                struct tm ts;
-               gmtime_r((time_t *)&changed_time, &ts);
+               gmtime_r((time_t*)&changed_time, &ts);
                char temp[VCARD_ITEM_LENGTH] = {0};
                snprintf(temp, sizeof(temp), "%s:%04d-%02d-%02dT%02d:%02d:%02dZ%s",
                                content_name[CTSVC_VCARD_VALUE_REV],
@@ -1930,11 +1905,11 @@ static int __ctsvc_vcard_append_person(ctsvc_person_s *person, ctsvc_list_s *lis
        }
 
 #if 0
-       ctsvc_list_sprofile;
+       ctsvc_list_s *profile;
 #endif
        return len;
 }
-#endif // _CONTACTS_IPC_CLIENT
+#endif /* _CONTACTS_IPC_CLIENT */
 
 #ifdef _CONTACTS_IPC_CLIENT
 static int __ctsvc_vcard_make_from_person(ctsvc_person_s *person, ctsvc_list_s *list_contacts,
@@ -1951,7 +1926,7 @@ static int __ctsvc_vcard_make_from_person(ctsvc_person_s *person, ctsvc_list_s *
 
        buf = calloc(1, buf_size);
        if (NULL == buf) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
 
@@ -1982,7 +1957,7 @@ static int __ctsvc_vcard_make_from_person(ctsvc_person_s *person, ctsvc_list_s *
 
        return CONTACTS_ERROR_NONE;
 }
-#endif // _CONTACTS_IPC_CLIENT
+#endif /* _CONTACTS_IPC_CLIENT */
 
 #ifdef _CONTACTS_IPC_CLIENT
 API int contacts_vcard_make_from_person(contacts_record_h record, char **vcard_stream)
@@ -1994,13 +1969,13 @@ API int contacts_vcard_make_from_person(contacts_record_h record, char **vcard_s
        contacts_list_h list = NULL;
 
        RETVM_IF(NULL == record || NULL == vcard_stream, CONTACTS_ERROR_INVALID_PARAMETER,
-               "Invalid parameter : person(%p), vcard_stream(%p)", record, vcard_stream);
+                       "person(%p), vcard_stream(%p)", record, vcard_stream);
        *vcard_stream = NULL;
 
-       person = (ctsvc_person_s *)record;
+       person = (ctsvc_person_s*)record;
 
        RETVM_IF(CTSVC_RECORD_PERSON != person->base.r_type, CONTACTS_ERROR_INVALID_PARAMETER,
-               "Invalid parameter : The record is not conatct record (type : %d)", person->base.r_type);
+                       "The record is not conatct record (type : %d)", person->base.r_type);
 
        do {
                if (CONTACTS_ERROR_NONE != (ret = contacts_filter_create(_contacts_contact._uri, &filter))) break;
@@ -2008,7 +1983,7 @@ API int contacts_vcard_make_from_person(contacts_record_h record, char **vcard_s
                if (CONTACTS_ERROR_NONE != (ret = contacts_query_create(_contacts_contact._uri, &query))) break;
                if (CONTACTS_ERROR_NONE != (ret = contacts_query_set_filter(query, filter))) break;
                if (CONTACTS_ERROR_NONE != (ret = contacts_db_get_records_with_query(query, 0, 0, &list))) break;
-               if (CONTACTS_ERROR_NONE != (ret = __ctsvc_vcard_make_from_person(person, (ctsvc_list_s *)list, vcard_stream))) break;
+               if (CONTACTS_ERROR_NONE != (ret = __ctsvc_vcard_make_from_person(person, (ctsvc_list_s*)list, vcard_stream))) break;
        } while (0);
        WARN_IF(CONTACTS_ERROR_NONE != ret, "__ctsvc_vcard_make_from_person() Fail(%d)", ret);
        contacts_query_destroy(query);
@@ -2032,7 +2007,7 @@ static char* __ctsvc_vcard_check_word(char *src, const char *word)
 {
        bool start = false;
 
-       RETVM_IF(NULL == src, NULL, "The src is NULL.");
+       RETV_IF(NULL == src, NULL);
 
        src = __ctsvc_vcard_remove_empty_line(src);
 
@@ -2069,15 +2044,15 @@ static int __ctsvc_vcard_check_content_type(char **vcard)
        int i;
        char *new_start;
 
-       for (i=CTSVC_VCARD_VALUE_NONE+1;i<CTSVC_VCARD_VALUE_MAX;i++) {
+       for (i = CTSVC_VCARD_VALUE_NONE+1; i < CTSVC_VCARD_VALUE_MAX; i++) {
                new_start = __ctsvc_vcard_check_word(*vcard, content_name[i]);
                if (new_start && (':' == *new_start || ';' == *new_start))
                        break;
        }
 
-       if (CTSVC_VCARD_VALUE_MAX == i)
+       if (CTSVC_VCARD_VALUE_MAX == i) {
                return CTSVC_VCARD_VALUE_NONE;
-       else {
+       else {
                *vcard = new_start;
                return i;
        }
@@ -2139,7 +2114,7 @@ static inline int __ctsvc_vcard_check_quoted(char *src, int max, int *quoted)
                                *quoted = TRUE;
                                return TRUE;
                        }
-               }else if (':' == *src) {
+               } else if (':' == *src) {
                        break;
                }
                src++;
@@ -2228,8 +2203,7 @@ static inline char* __ctsvc_vcard_translate_charset(char *src, int len)
                                val += sizeof("CHARSET");
                                break;
                        }
-               }
-               else if (':' == *val) {
+               } else if (':' == *val) {
                        return NULL;
                }
                val++;
@@ -2244,9 +2218,9 @@ static inline char* __ctsvc_vcard_translate_charset(char *src, int len)
                int src_len, i = 0;
                char enc[32] = {0}, *dest;
 
-               while (';' != *val && ':' != *val) {
+               while (';' != *val && ':' != *val)
                        enc[i++] = *val++;
-               }
+
                enc[i] = '\0';
                if (0 == strcasecmp("UTF-8", enc))
                        return NULL;
@@ -2259,7 +2233,7 @@ static inline char* __ctsvc_vcard_translate_charset(char *src, int len)
                temp_size = (src_len+1) * sizeof(UChar);
                temp = malloc(temp_size);
                if (NULL == temp) {
-                       CTS_ERR("malloc() Fail");
+                       ERR("malloc() Fail");
                        return NULL;
                }
                conv = ucnv_open(enc, &err);
@@ -2271,7 +2245,7 @@ static inline char* __ctsvc_vcard_translate_charset(char *src, int len)
                dest_size = temp_size*2;
                dest = malloc(dest_size);
                if (NULL == dest) {
-                       CTS_ERR("malloc() Fail");
+                       ERR("malloc() Fail");
                        free(temp);
                        return NULL;
                }
@@ -2295,8 +2269,7 @@ static void __ctsvc_vcard_get_prefix(char **prefix, char *src)
                *prefix = calloc(len+1, sizeof(char));
                if (*prefix)
                        snprintf(*prefix, len+1, "%s", src);
-       }
-       else {
+       } else {
                *prefix = NULL;
        }
 }
@@ -2307,8 +2280,8 @@ static char* __ctsvc_vcard_get_val(int ver, char *src, char **prefix, char **des
        bool start = false;
        char *cursor;
 
-       RETVM_IF(NULL == src, NULL, "Invalid parameter : The src is NULL.");
-       RETVM_IF(NULL == dest, NULL, "sInvalid parameter : The dest is NULL.");
+       RETV_IF(NULL == src, NULL);
+       RETV_IF(NULL == dest, NULL);
 
        while (*src) {
                switch (*src) {
@@ -2341,8 +2314,7 @@ static char* __ctsvc_vcard_get_val(int ver, char *src, char **prefix, char **des
 
                        cursor++;
                }
-       }
-       else {
+       } else {
                while (*cursor) {
                        if ('\r' == *cursor && '\n' == *(cursor+1) && ' ' != *(cursor+2))
                                break;
@@ -2357,8 +2329,7 @@ static char* __ctsvc_vcard_get_val(int ver, char *src, char **prefix, char **des
        if (src == cursor) {
                *dest = NULL;
                return NULL;
-       }
-       else {
+       } else {
                int len = 0;
                char temp = *cursor;
                char *new_dest;
@@ -2369,7 +2340,7 @@ static char* __ctsvc_vcard_get_val(int ver, char *src, char **prefix, char **des
                *cursor = '\0';
                *dest = strdup(src);
                if (NULL == *dest) {
-                       CTS_ERR("strdup() Fail");
+                       ERR("strdup() Fail");
                        return NULL;
                }
                if (CTSVC_VCARD_VER_2_1 != ver)
@@ -2400,7 +2371,7 @@ static inline char* __ctsvc_get_content_value(char *val)
                temp = val;
 
        RETVM_IF('\0' == *(temp) || '\r' == *(temp) || '\n' == *(temp),
-               NULL, "Invalid vcard content");
+                       NULL, "Invalid vcard content");
 
        return temp;
 }
@@ -2432,7 +2403,7 @@ static char* __ctsvc_vcard_remove_escape_char(char *str)
                                        *r = *n;
                                        r++;
                                        *r = *(n+1);
-                                       s+=2;
+                                       s += 2;
                                }
                                break;
                        case 0x81:  /* en/em backslash */
@@ -2440,7 +2411,7 @@ static char* __ctsvc_vcard_remove_escape_char(char *str)
                                        *r = *n;
                                        r++;
                                        *r = *(n+1);
-                                       s+=2;
+                                       s += 2;
                                }
                                break;
                        default:
@@ -2449,8 +2420,7 @@ static char* __ctsvc_vcard_remove_escape_char(char *str)
                        }
                        r++;
                        s++;
-               }
-               else {
+               } else {
                        *r = *s;
                        r++;
                        s++;
@@ -2470,15 +2440,14 @@ static inline int __ctsvc_vcard_get_display_name(ctsvc_list_s *name_list, char *
        contacts_record_h name;
 
        temp = __ctsvc_get_content_value(val);
-       RETVM_IF(NULL == temp, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : vcard");
+       RETVM_IF(NULL == temp, CONTACTS_ERROR_INVALID_PARAMETER, "vcard");
 
        contacts_list_get_count((contacts_list_h)name_list, &count);
        if (count <= 0) {
                ret = contacts_record_create(_contacts_name._uri, &name);
                RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create is Fail(%d)", ret);
                contacts_list_add((contacts_list_h)name_list, name);
-       }
-       else {
+       } else {
                contacts_list_get_current_record_p((contacts_list_h)name_list, &name);
        }
 
@@ -2494,7 +2463,7 @@ static inline int __ctsvc_vcard_get_display_name(ctsvc_list_s *name_list, char *
 }
 
 #define CTS_GET_MULTIPLE_COMPONENT(dest, src, src_temp, separator) \
-src_temp = src; \
+       src_temp = src; \
 separator = false; \
 while (src_temp && *src_temp) { \
        if (*src_temp == ';') { \
@@ -2506,7 +2475,7 @@ while (src_temp && *src_temp) { \
                break; \
        } \
        else if (*src_temp == '\\') {\
-               src_temp+=2; \
+               src_temp += 2; \
                continue; \
        } \
        src_temp++; \
@@ -2530,10 +2499,9 @@ static inline int __ctsvc_vcard_get_name(ctsvc_list_s *name_list, char *val)
        contacts_list_get_count((contacts_list_h)name_list, &count);
        if (count <= 0) {
                ret = contacts_record_create(_contacts_name._uri, &name);
-               RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create is Fail(%d)", ret);
+               RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create() Fail(%d)", ret);
                contacts_list_add((contacts_list_h)name_list, name);
-       }
-       else {
+       } else {
                contacts_list_get_current_record_p((contacts_list_h)name_list, &name);
        }
 
@@ -2549,7 +2517,7 @@ static inline int __ctsvc_vcard_get_name(ctsvc_list_s *name_list, char *val)
                CTS_GET_MULTIPLE_COMPONENT(((ctsvc_name_s*)name)->prefix, start, start_temp, separator);
                CTS_GET_MULTIPLE_COMPONENT(((ctsvc_name_s*)name)->suffix, start, start_temp, separator);
 
-               CTS_ERR("invalid name type");
+               ERR("invalid name type");
                break;
        }
 
@@ -2570,10 +2538,9 @@ static inline int __ctsvc_vcard_get_phonetic_name(ctsvc_list_s *name_list, int t
        contacts_list_get_count((contacts_list_h)name_list, &count);
        if (count <= 0) {
                ret = contacts_record_create(_contacts_name._uri, &name);
-               RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create is Fail(%d)", ret);
+               RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create() Fail(%d)", ret);
                contacts_list_add((contacts_list_h)name_list, name);
-       }
-       else {
+       } else {
                contacts_list_get_current_record_p((contacts_list_h)name_list, &name);
        }
 
@@ -2606,8 +2573,8 @@ static inline int __ctsvc_vcard_get_nickname(ctsvc_list_s *nickname_list, char *
                ret = contacts_record_create(_contacts_nickname._uri, &nickname);
                if (ret < CONTACTS_ERROR_NONE) {
                        GList *cursor = NULL;
-                       CTS_ERR("contacts_record_create is Fail(%d)", ret);
-                       for (cursor = nickname_list->records;cursor;cursor=cursor->next)
+                       ERR("contacts_record_create() Fail(%d)", ret);
+                       for (cursor = nickname_list->records; cursor; cursor = cursor->next)
                                contacts_record_destroy((contacts_record_h)(cursor->data), true);
                        g_list_free(nickname_list->records);
                        nickname_list->records = NULL;
@@ -2635,7 +2602,7 @@ static inline int __ctsvc_vcard_get_photo(contacts_record_h contact, ctsvc_list_
        struct timeval tv;
 
        temp = strchr(val, ':');
-       RETVM_IF(NULL == temp, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : val is invalid");
+       RETVM_IF(NULL == temp, CONTACTS_ERROR_INVALID_PARAMETER, "val is invalid");
 
        *temp = '\0';
 
@@ -2657,10 +2624,10 @@ static inline int __ctsvc_vcard_get_photo(contacts_record_h contact, ctsvc_list_
        while (0 < size) {
                ret = write(fd, buf, size);
                if (ret <= 0) {
-                       if (EINTR == errno)
+                       if (EINTR == errno) {
                                continue;
-                       else {
-                               CTS_ERR("write() Fail(%d)", errno);
+                       else {
+                               ERR("write() Fail(%d)", errno);
                                close(fd);
                                if (ENOSPC == errno)
                                        return CONTACTS_ERROR_FILE_NO_SPACE;   /* No space */
@@ -2675,15 +2642,15 @@ static inline int __ctsvc_vcard_get_photo(contacts_record_h contact, ctsvc_list_
        g_free(buf);
 
        ret = contacts_record_create(_contacts_image._uri, &image);
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create is Fail(%d)", ret);
+       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create() Fail(%d)", ret);
 
        contacts_record_set_str(image, _contacts_image.path, dest);
-       ((ctsvc_image_s *)image)->is_vcard = true;
+       ((ctsvc_image_s*)image)->is_vcard = true;
 
        contacts_list_add((contacts_list_h)image_list, image);
 
        /* _contacts_contact.image_thumbnail_path is a read-only property */
-       ((ctsvc_contact_s *)contact)->image_thumbnail_path = strdup(dest);
+       ((ctsvc_contact_s*)contact)->image_thumbnail_path = strdup(dest);
 
        return CONTACTS_ERROR_NONE;
 
@@ -2699,7 +2666,7 @@ static inline void __ctsvc_vcard_get_event_type(contacts_record_h event, char *v
        while (temp) {
                lower = strdup(temp);
                if (NULL == lower) {
-                       CTS_ERR("strdup() Fail");
+                       ERR("strdup() Fail");
                        break;
                }
                lower_temp = lower;
@@ -2707,9 +2674,9 @@ static inline void __ctsvc_vcard_get_event_type(contacts_record_h event, char *v
                        *lower_temp = tolower(*lower_temp);
                        lower_temp++;
                }
-               if (strstr(lower, "anniversary"))
+               if (strstr(lower, "anniversary")) {
                        type = CONTACTS_EVENT_TYPE_ANNIVERSARY;
-               else if ((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);
                }
@@ -2729,7 +2696,7 @@ static inline int __ctsvc_vcard_get_event(ctsvc_list_s *event_list, int type, ch
 
        date = __ctsvc_get_content_value(val);
        if (NULL == date) {
-               CTS_ERR("Invalid parameter : vcard");
+               ERR("vcard");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
@@ -2745,13 +2712,13 @@ static inline int __ctsvc_vcard_get_event(ctsvc_list_s *event_list, int type, ch
        }
        *dest = '\0';
        if ('\0' == *date) {
-               CTS_ERR("Invalid parameter : date(%d)", date);
+               ERR("date(%d)", date);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
        ret = contacts_record_create(_contacts_event._uri, &event);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("contacts_record_create is Fail(%d)", ret);
+               ERR("contacts_record_create() Fail(%d)", ret);
                return ret;
        }
 
@@ -2761,9 +2728,9 @@ static inline int __ctsvc_vcard_get_event(ctsvc_list_s *event_list, int type, ch
                contacts_record_set_int(event, _contacts_event.type, CONTACTS_EVENT_TYPE_BIRTH);
        else if (CTSVC_VCARD_VALUE_X_ANNIVERSARY == type)
                contacts_record_set_int(event, _contacts_event.type, CONTACTS_EVENT_TYPE_ANNIVERSARY);
-       else if (CTSVC_VCARD_VALUE_X_TIZEN_EVENT == type) {
+       else if (CTSVC_VCARD_VALUE_X_TIZEN_EVENT == type)
                __ctsvc_vcard_get_event_type(event, prefix);
-       }
+
        contacts_list_add((contacts_list_h)event_list, event);
        return CONTACTS_ERROR_NONE;
 }
@@ -2779,7 +2746,7 @@ static inline void __ctsvc_vcard_get_company_type(contacts_record_h company, cha
        while (temp) {
                lower = strdup(temp);
                if (NULL == lower) {
-                       CTS_ERR("strdup() Fail");
+                       ERR("strdup() Fail");
                        break;
                }
                lower_temp = lower;
@@ -2832,7 +2799,7 @@ static inline int __ctsvc_vcard_get_company_value(ctsvc_list_s *company_list, in
        company = __ctsvc_vcard_get_company_empty_record(company_list, property_id);
        if (NULL == company) {
                int ret = contacts_record_create(_contacts_company._uri, &company);
-               RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create is Fail(%d)", ret);
+               RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create() Fail(%d)", ret);
                contacts_list_add((contacts_list_h)company_list, company);
        }
 
@@ -2853,7 +2820,7 @@ static inline int __ctsvc_vcard_get_company(ctsvc_list_s *company_list, char *pr
        company = __ctsvc_vcard_get_company_empty_record(company_list, _contacts_company.name);
        if (NULL == company) {
                int ret = contacts_record_create(_contacts_company._uri, &company);
-               RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create is Fail(%d)", ret);
+               RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create() Fail(%d)", ret);
                contacts_list_add((contacts_list_h)company_list, company);
        }
 
@@ -2886,12 +2853,12 @@ static inline int __ctsvc_vcard_get_company_logo(ctsvc_list_s *company_list, cha
        company = __ctsvc_vcard_get_company_empty_record(company_list, _contacts_company.logo);
        if (NULL == company) {
                ret = contacts_record_create(_contacts_company._uri, &company);
-               RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create is Fail(%d)", ret);
+               RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create() Fail(%d)", ret);
                contacts_list_add((contacts_list_h)company_list, company);
        }
 
        temp = strchr(val, ':');
-       RETVM_IF(NULL == temp, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : val is invalid");
+       RETVM_IF(NULL == temp, CONTACTS_ERROR_INVALID_PARAMETER, "val is invalid");
 
        *temp = '\0';
        type = __ctsvc_vcard_get_image_type(prefix);
@@ -2912,10 +2879,10 @@ static inline int __ctsvc_vcard_get_company_logo(ctsvc_list_s *company_list, cha
        while (0 < size) {
                ret = write(fd, buf, size);
                if (ret <= 0) {
-                       if (EINTR == errno)
+                       if (EINTR == errno) {
                                continue;
-                       else {
-                               CTS_ERR("write() Fail(%d)", errno);
+                       else {
+                               ERR("write() Fail(%d)", errno);
                                close(fd);
                                if (ENOSPC == errno)
                                        return CONTACTS_ERROR_FILE_NO_SPACE;   /* No space */
@@ -2929,7 +2896,7 @@ static inline int __ctsvc_vcard_get_company_logo(ctsvc_list_s *company_list, cha
        close(fd);
        g_free(buf);
 
-       ((ctsvc_company_s *)company)->is_vcard = true;
+       ((ctsvc_company_s*)company)->is_vcard = true;
        contacts_record_set_str(company, _contacts_company.logo, dest);
 
        return CONTACTS_ERROR_NONE;
@@ -2942,7 +2909,7 @@ static inline int __ctsvc_vcard_get_note(ctsvc_list_s *note_list, char *val)
        contacts_record_h note;
 
        ret = contacts_record_create(_contacts_note._uri, &note);
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create is Fail(%d)", ret);
+       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create() Fail(%d)", ret);
        contacts_list_add((contacts_list_h)note_list, note);
 
        temp = __ctsvc_get_content_value(val);
@@ -2964,7 +2931,7 @@ static inline int __ctsvc_vcard_get_time(char *val)
        while (*val) {
                tmp[i++] = *val;
                val++;
-               if (4<=i || *val < '0' || '9' < *val) break;
+               if (4 <= i || *val < '0' || '9' < *val) break;
        }
        tmp[i] = 0;
        ts.tm_year = atoi(tmp)-1900;
@@ -2974,7 +2941,7 @@ static inline int __ctsvc_vcard_get_time(char *val)
        while (*val) {
                tmp[i++] = *val;
                val++;
-               if (2<=i || *val < '0' || '9' < *val) break;
+               if (2 <= i || *val < '0' || '9' < *val) break;
        }
        tmp[i] = 0;
        ts.tm_mon = atoi(tmp)-1;
@@ -2984,7 +2951,7 @@ static inline int __ctsvc_vcard_get_time(char *val)
        while (*val) {
                tmp[i++] = *val;
                val++;
-               if (2<=i || *val < '0' || '9' < *val) break;
+               if (2 <= i || *val < '0' || '9' < *val) break;
        }
        tmp[i] = 0;
        ts.tm_mday = atoi(tmp);
@@ -2994,7 +2961,7 @@ static inline int __ctsvc_vcard_get_time(char *val)
        while (*val) {
                tmp[i++] = *val;
                val++;
-               if (2<=i || *val < '0' || '9' < *val) break;
+               if (2 <= i || *val < '0' || '9' < *val) break;
        }
        tmp[i] = 0;
        ts.tm_hour = atoi(tmp);
@@ -3004,7 +2971,7 @@ static inline int __ctsvc_vcard_get_time(char *val)
        while (*val) {
                tmp[i++] = *val;
                val++;
-               if (2<=i || *val < '0' || '9' < *val) break;
+               if (2 <= i || *val < '0' || '9' < *val) break;
        }
        tmp[i] = 0;
        ts.tm_min = atoi(tmp);
@@ -3014,7 +2981,7 @@ static inline int __ctsvc_vcard_get_time(char *val)
        while (*val) {
                tmp[i++] = *val;
                val++;
-               if (2<=i || *val < '0' || '9' < *val) break;
+               if (2 <= i || *val < '0' || '9' < *val) break;
        }
        tmp[i] = 0;
        ts.tm_sec = atoi(tmp);
@@ -3032,7 +2999,7 @@ static inline void __ctsvc_vcard_get_url_type(contacts_record_h url, char *val)
        while (temp) {
                lower = strdup(temp);
                if (NULL == lower) {
-                       CTS_ERR("strdup() Fail");
+                       ERR("strdup() Fail");
                        break;
                }
                lower_temp = lower;
@@ -3056,17 +3023,17 @@ static inline void __ctsvc_vcard_get_url_type(contacts_record_h url, char *val)
        contacts_record_set_int(url, _contacts_url.type, type);
 }
 
-static inline int __ctsvc_vcard_get_url(ctsvc_list_surl_list, char *prefix, char *val)
+static inline int __ctsvc_vcard_get_url(ctsvc_list_s *url_list, char *prefix, char *val)
 {
        int ret;
        contacts_record_h url;
        char *temp;
 
        temp = __ctsvc_get_content_value(val);
-       RETVM_IF(NULL == temp, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : vcard");
+       RETVM_IF(NULL == temp, CONTACTS_ERROR_INVALID_PARAMETER, "vcard");
 
        ret = contacts_record_create(_contacts_url._uri, &url);
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create is Fail(%d)", ret);
+       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create() Fail(%d)", ret);
 
        contacts_record_set_str(url, _contacts_url.url, __ctsvc_vcard_remove_escape_char(temp));
        __ctsvc_vcard_get_url_type(url, prefix);
@@ -3086,7 +3053,7 @@ static inline bool __ctsvc_vcard_get_number_type(contacts_record_h number, char
        while (temp) {
                lower = strdup(temp);
                if (NULL == lower) {
-                       CTS_ERR("strdup() Fail");
+                       ERR("strdup() Fail");
                        break;
                }
                lower_temp = lower;
@@ -3124,15 +3091,15 @@ static inline bool __ctsvc_vcard_get_number_type(contacts_record_h number, char
                if (result) type |= CONTACTS_NUMBER_TYPE_PCS;
                result = strstr(lower, "x-");
                if (result) {
-                       if (strstr(lower, "x-assistant"))
+                       if (strstr(lower, "x-assistant")) {
                                type |= CONTACTS_NUMBER_TYPE_ASSISTANT;
-                       else if (strstr(lower, "x-radio"))
+                       } else if (strstr(lower, "x-radio")) {
                                type |= CONTACTS_NUMBER_TYPE_RADIO;
-                       else if (strstr(lower, "x-company-main"))
+                       } else if (strstr(lower, "x-company-main")) {
                                type |= CONTACTS_NUMBER_TYPE_COMPANY_MAIN;
-                       else if (strstr(lower, "x-main"))
+                       } else if (strstr(lower, "x-main")) {
                                type |= CONTACTS_NUMBER_TYPE_MAIN;
-                       else {
+                       else {
                                type = CONTACTS_NUMBER_TYPE_CUSTOM;
                                contacts_record_set_str(number, _contacts_number.label, temp+(result-lower)+2);
                        }
@@ -3159,106 +3126,94 @@ static char* __ctsvc_vcard_get_clean_number_for_import(char *str)
                                        if (0x90 <= *(s+2) && *(s+2) <= 0x99) {   /* ef bc 90 : '0' ~ ef bc 99 : '9' */
                                                *r = '0' + (*(s+2) - 0x90);
                                                r++;
-                                               s+=3;
-                                       }
-                                       else if (0x8b == *(s+2)) {   /* ef bc 8b : '+' */
+                                               s += 3;
+                                       } else if (0x8b == *(s+2)) {   /* ef bc 8b : '+' */
                                                *r = '+';
                                                r++;
-                                               s+=3;
-                                       }
-                                       else if (0x8a == *(s+2)) {   /* ef bc 8a : '*' */
+                                               s += 3;
+                                       } else if (0x8a == *(s+2)) {   /* ef bc 8a : '*' */
                                                *r = '*';
                                                r++;
-                                               s+=3;
-                                       }
-                                       else if (0x83 == *(s+2)) {   /* ef bc 83 : '#' */
+                                               s += 3;
+                                       } else if (0x83 == *(s+2)) {   /* ef bc 83 : '#' */
                                                *r = '#';
                                                r++;
-                                               s+=3;
-                                       }
-                                       else if (0xb0 == *(s+2) || 0x8c == *(s+2)) {   /* ef bc b0 : 'P', ef bc 8c : ',' */
+                                               s += 3;
+                                       } else if (0xb0 == *(s+2) || 0x8c == *(s+2)) {   /* ef bc b0 : 'P', ef bc 8c : ',' */
                                                *r = ',';
                                                r++;
-                                               s+=3;
-                                       }
-                                       else if (0xb7 == *(s+2) || 0x9b == *(s+2)) {   /* ef bc b7 : 'W', ef bc 9b : ';' */
+                                               s += 3;
+                                       } else if (0xb7 == *(s+2) || 0x9b == *(s+2)) {   /* ef bc b7 : 'W', ef bc 9b : ';' */
                                                *r = ';';
                                                r++;
-                                               s+=3;
+                                               s += 3;
+                                       } else {
+                                               s += char_len;
                                        }
-                                       else {
-                                               s+=char_len;
-                                       }
-                               }
-                               else if (*(s+1) == 0xbd) {
+                               } else if (*(s+1) == 0xbd) {
                                        if (0x90 == *(s+2)) {
                                                *r = ',';
                                                r++;
-                                               s+=3;
-                                       }
-                                       else if (0x97 == *(s+2)) {
+                                               s += 3;
+                                       } else if (0x97 == *(s+2)) {
                                                *r = ';';
                                                r++;
-                                               s+=3;
+                                               s += 3;
                                        }
+                               } else {
+                                       s += char_len;
                                }
-                               else {
-                                       s+=char_len;
-                               }
-                       }
-                       else {
-                               s+=char_len;
+                       } else {
+                               s += char_len;
                        }
-               }
-               else if (1 == char_len) {
+               } else if (1 == char_len) {
                        switch (*s) {
-                               case '/':
-                               case '.':
-                               case '0' ... '9':
-                               case '#':
-                               case '*':
-                               case '(':
-                               case ')':
-                               case ',':
-                               case ';':
-                               case '+':
-                                       *r = *s;
-                                       r++;
-                                       s++;
-                                       break;
-                               case 'p':
-                               case 'P':
-                                       *r = ',';
-                                       r++;
-                                       s++;
-                                       break;
-                               case 'w':
-                               case 'W':
-                                       *r = ';';
-                                       r++;
-                                       s++;
-                                       break;
-                               case 'a' ... 'o':
-                               case 'q' ... 'v':
-                               case 'x' ... 'z':
-                                       *r = *s - 0x20;
-                                       r++;
-                                       s++;
-                                       break;
-                               case 'A' ... 'O':
-                               case 'Q' ... 'V':
-                               case 'X' ... 'Z':
-                                       *r = *s;
-                                       r++;
-                                       s++;
-                                       break;
-                               default:
-                                       s++;
-                                       break;
+                       case '/':
+                       case '.':
+                       case '0' ... '9':
+                       case '#':
+                       case '*':
+                       case '(':
+                       case ')':
+                       case ',':
+                       case ';':
+                       case '+':
+                               *r = *s;
+                               r++;
+                               s++;
+                               break;
+                       case 'p':
+                       case 'P':
+                               *r = ',';
+                               r++;
+                               s++;
+                               break;
+                       case 'w':
+                       case 'W':
+                               *r = ';';
+                               r++;
+                               s++;
+                               break;
+                       case 'a' ... 'o':
+                       case 'q' ... 'v':
+                       case 'x' ... 'z':
+                               *r = *s - 0x20;
+                               r++;
+                               s++;
+                               break;
+                       case 'A' ... 'O':
+                       case 'Q' ... 'V':
+                       case 'X' ... 'Z':
+                               *r = *s;
+                               r++;
+                               s++;
+                               break;
+                       default:
+                               s++;
+                               break;
                        }
-               }
-               else {
-                       s+=char_len;
+               } else {
+                       s += char_len;
                }
        }
        *r = '\0';
@@ -3273,16 +3228,16 @@ static inline int __ctsvc_vcard_get_number(ctsvc_list_s *numbers, char *prefix,
        contacts_record_h number;
 
        temp = __ctsvc_get_content_value(val);
-       RETVM_IF(NULL == temp, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : vcard");
+       RETVM_IF(NULL == temp, CONTACTS_ERROR_INVALID_PARAMETER, "vcard");
 
        ret = contacts_record_create(_contacts_number._uri, &number);
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create is Fail(%d)", ret);
+       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create() Fail(%d)", ret);
 
        temp = __ctsvc_vcard_remove_escape_char(temp);
        contacts_record_set_str(number, _contacts_number.number, __ctsvc_vcard_get_clean_number_for_import(temp));
 
        is_default = __ctsvc_vcard_get_number_type(number, prefix);
-               contacts_record_set_bool(number, _contacts_number.is_default, is_default);
+       contacts_record_set_bool(number, _contacts_number.is_default, is_default);
        contacts_list_add((contacts_list_h)numbers, number);
 
        return CONTACTS_ERROR_NONE;
@@ -3299,7 +3254,7 @@ static inline bool __ctsvc_vcard_get_email_type(contacts_record_h email, char *v
        while (temp) {
                lower = strdup(temp);
                if (NULL == lower) {
-                       CTS_ERR("strdup() Fail");
+                       ERR("strdup() Fail");
                        break;
                }
                lower_temp = lower;
@@ -3309,13 +3264,14 @@ static inline bool __ctsvc_vcard_get_email_type(contacts_record_h email, char *v
                }
                if (strstr(lower, "pref"))
                        pref = true;
-               if (strstr(lower, "home"))
+
+               if (strstr(lower, "home")) {
                        type = CONTACTS_EMAIL_TYPE_HOME;
-               else if (strstr(lower, "work"))
+               } else if (strstr(lower, "work")) {
                        type = CONTACTS_EMAIL_TYPE_WORK;
-               else if (strstr(lower, "cell"))
+               } else if (strstr(lower, "cell")) {
                        type = CONTACTS_EMAIL_TYPE_MOBILE;
-               else if ((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);
                }
@@ -3328,7 +3284,7 @@ static inline bool __ctsvc_vcard_get_email_type(contacts_record_h email, char *v
        return pref;
 }
 
-static inline int __ctsvc_vcard_get_email(ctsvc_list_semails, char *prefix, char *val)
+static inline int __ctsvc_vcard_get_email(ctsvc_list_s *emails, char *prefix, char *val)
 {
        bool is_default;
        int ret;
@@ -3336,14 +3292,14 @@ static inline int __ctsvc_vcard_get_email(ctsvc_list_s* emails, char *prefix, ch
        contacts_record_h email;
 
        temp = __ctsvc_get_content_value(val);
-       RETVM_IF(NULL == temp, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : vcard");
+       RETVM_IF(NULL == temp, CONTACTS_ERROR_INVALID_PARAMETER, "vcard");
 
        ret = contacts_record_create(_contacts_email._uri, &email);
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create is Fail(%d)", ret);
+       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create() Fail(%d)", ret);
 
        contacts_record_set_str(email, _contacts_email.email, __ctsvc_vcard_remove_escape_char(temp));
        is_default = __ctsvc_vcard_get_email_type(email, prefix);
-               contacts_record_set_bool(email, _contacts_email.is_default, is_default);
+       contacts_record_set_bool(email, _contacts_email.is_default, is_default);
        contacts_list_add((contacts_list_h)emails, email);
 
        return CONTACTS_ERROR_NONE;
@@ -3360,7 +3316,7 @@ static inline bool __ctsvc_vcard_get_postal_type(contacts_record_h address, char
        while (temp) {
                lower = strdup(temp);
                if (NULL == lower) {
-                       CTS_ERR("strdup() Fail");
+                       ERR("strdup() Fail");
                        break;
                }
                lower_temp = lower;
@@ -3410,9 +3366,9 @@ static inline int __ctsvc_vcard_get_address(ctsvc_list_s *address_list, char *pr
                if (text) {
                        text++;
                        *(text-1) = '\0';
-               }
-               else
+               } else {
                        text = val;
+               }
 
                while (true) {
                        bool separator = false;
@@ -3425,7 +3381,7 @@ static inline int __ctsvc_vcard_get_address(ctsvc_list_s *address_list, char *pr
                        CTS_GET_MULTIPLE_COMPONENT(((ctsvc_address_s*)address)->postalcode, text, text_temp, separator);
                        CTS_GET_MULTIPLE_COMPONENT(((ctsvc_address_s*)address)->country, text, text_temp, separator);
 
-                       CTS_ERR("invalid ADR type");
+                       ERR("invalid ADR type");
                        break;
                }
 
@@ -3435,7 +3391,7 @@ static inline int __ctsvc_vcard_get_address(ctsvc_list_s *address_list, char *pr
                                || ((ctsvc_address_s*)address)->country) {
                        contacts_record_set_bool(address, _contacts_address.is_default, __ctsvc_vcard_get_postal_type(address, prefix));
                } else {
-                       CTS_ERR("Invalid vcard");
+                       ERR("Invalid vcard");
                        contacts_record_destroy(address, true);
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
@@ -3455,7 +3411,7 @@ static inline void __ctsvc_vcard_get_messenger_type(contacts_record_h messenger,
        while (temp) {
                lower = strdup(temp);
                if (NULL == lower) {
-                       CTS_ERR("strdup() Fail");
+                       ERR("strdup() Fail");
                        break;
                }
                lower_temp = lower;
@@ -3478,17 +3434,17 @@ static inline void __ctsvc_vcard_get_messenger_type(contacts_record_h messenger,
        contacts_record_set_int(messenger, _contacts_messenger.type, type);
 }
 
-static inline int __ctsvc_vcard_get_messenger(ctsvc_list_smessenger_list, int type, char *prefix, char *val)
+static inline int __ctsvc_vcard_get_messenger(ctsvc_list_s *messenger_list, int type, char *prefix, char *val)
 {
        int ret;
        contacts_record_h messenger;
        char *temp;
 
        temp = __ctsvc_get_content_value(val);
-       RETVM_IF(NULL == temp, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : vcard");
+       RETVM_IF(NULL == temp, CONTACTS_ERROR_INVALID_PARAMETER, "vcard");
 
        ret = contacts_record_create(_contacts_messenger._uri, &messenger);
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create is Fail(%d)", ret);
+       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create() Fail(%d)", ret);
 
        contacts_record_set_str(messenger, _contacts_messenger.im_id, __ctsvc_vcard_remove_escape_char(temp));
 
@@ -3537,7 +3493,7 @@ static inline void __ctsvc_vcard_get_relationship_type(contacts_record_h relatio
        while (temp) {
                lower = strdup(temp);
                if (NULL == lower) {
-                       CTS_ERR("strdup() Fail");
+                       ERR("strdup() Fail");
                        break;
                }
                lower_temp = lower;
@@ -3545,35 +3501,36 @@ static inline void __ctsvc_vcard_get_relationship_type(contacts_record_h relatio
                        *lower_temp = tolower(*lower_temp);
                        lower_temp++;
                }
-               if (strstr(lower, "assistant"))
+
+               if (strstr(lower, "assistant")) {
                        type = CONTACTS_RELATIONSHIP_TYPE_ASSISTANT;
-               else if (strstr(lower, "brother"))
+               } else if (strstr(lower, "brother")) {
                        type = CONTACTS_RELATIONSHIP_TYPE_BROTHER;
-               else if (strstr(lower, "child"))
+               } else if (strstr(lower, "child")) {
                        type = CONTACTS_RELATIONSHIP_TYPE_CHILD;
-               else if (strstr(lower, "domestic_partner"))
+               } else if (strstr(lower, "domestic_partner")) {
                        type = CONTACTS_RELATIONSHIP_TYPE_DOMESTIC_PARTNER;
-               else if (strstr(lower, "father"))
+               } else if (strstr(lower, "father")) {
                        type = CONTACTS_RELATIONSHIP_TYPE_FATHER;
-               else if (strstr(lower, "friend"))
+               } else if (strstr(lower, "friend")) {
                        type = CONTACTS_RELATIONSHIP_TYPE_FRIEND;
-               else if (strstr(lower, "manager"))
+               } else if (strstr(lower, "manager")) {
                        type = CONTACTS_RELATIONSHIP_TYPE_MANAGER;
-               else if (strstr(lower, "mother"))
+               } else if (strstr(lower, "mother")) {
                        type = CONTACTS_RELATIONSHIP_TYPE_MOTHER;
-               else if (strstr(lower, "parent"))
+               } else if (strstr(lower, "parent")) {
                        type = CONTACTS_RELATIONSHIP_TYPE_PARENT;
-               else if (strstr(lower, "partner"))
+               } else if (strstr(lower, "partner")) {
                        type = CONTACTS_RELATIONSHIP_TYPE_PARTNER;
-               else if (strstr(lower, "referred_by"))
+               } else if (strstr(lower, "referred_by")) {
                        type = CONTACTS_RELATIONSHIP_TYPE_REFERRED_BY;
-               else if (strstr(lower, "relative"))
+               } else if (strstr(lower, "relative")) {
                        type = CONTACTS_RELATIONSHIP_TYPE_RELATIVE;
-               else if (strstr(lower, "sister"))
+               } else if (strstr(lower, "sister")) {
                        type = CONTACTS_RELATIONSHIP_TYPE_SISTER;
-               else if (strstr(lower, "spouse"))
+               } else if (strstr(lower, "spouse")) {
                        type = CONTACTS_RELATIONSHIP_TYPE_SPOUSE;
-               else if ((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);
                }
@@ -3584,17 +3541,17 @@ static inline void __ctsvc_vcard_get_relationship_type(contacts_record_h relatio
 }
 
 
-static inline int __ctsvc_vcard_get_relationship(ctsvc_list_srelationship_list, int type, char *prefix, char *val)
+static inline int __ctsvc_vcard_get_relationship(ctsvc_list_s *relationship_list, int type, char *prefix, char *val)
 {
        int ret;
        char *temp;
        contacts_record_h relationship;
 
        temp = __ctsvc_get_content_value(val);
-       RETVM_IF(NULL == temp, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : vcard");
+       RETVM_IF(NULL == temp, CONTACTS_ERROR_INVALID_PARAMETER, "vcard");
 
        ret = contacts_record_create(_contacts_relationship._uri, &relationship);
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create is Fail(%d)", ret);
+       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create() Fail(%d)", ret);
 
        contacts_record_set_str(relationship, _contacts_relationship.name, __ctsvc_vcard_remove_escape_char(temp));
        __ctsvc_vcard_get_relationship_type(relationship, prefix);
@@ -3621,7 +3578,7 @@ static char* __ctsvc_vcard_decode_base64_val(char *val)
 
        dest = calloc((src-val)+size+1, sizeof(char));
        if (NULL == dest) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                return NULL;
        }
 
@@ -3650,9 +3607,9 @@ static inline int __ctsvc_vcard_get_contact(int ver, char *vcard, contacts_recor
                        if (new_start) {
                                cursor = new_start;
                                continue;
-                       }
-                       else
+                       } else {
                                break;
+                       }
                }
 
                if (CTSVC_VCARD_VALUE_PHOTO != type && CTSVC_VCARD_VALUE_LOGO != type)
@@ -3675,7 +3632,7 @@ static inline int __ctsvc_vcard_get_contact(int ver, char *vcard, contacts_recor
                if (base64_encoded) {
                        char *temp = __ctsvc_vcard_decode_base64_val(val);
                        if (NULL == temp) {
-                               CTS_ERR("__ctsvc_vcard_decode_base64_val() Fail");
+                               ERR("__ctsvc_vcard_decode_base64_val() Fail");
                                free(prefix);
                                free(val);
                                return CONTACTS_ERROR_OUT_OF_MEMORY;
@@ -3774,7 +3731,7 @@ static inline int __ctsvc_vcard_get_contact(int ver, char *vcard, contacts_recor
                        free(prefix);
                        return CONTACTS_ERROR_NONE;
                default:
-                       CTS_ERR("Invalid parameter : __ctsvc_vcard_check_content_type() Fail(%d)", type);
+                       ERR("__ctsvc_vcard_check_content_type() Fail(%d)", type);
                        free(val);
                        free(prefix);
                        return CONTACTS_ERROR_INVALID_PARAMETER;
@@ -3784,7 +3741,7 @@ static inline int __ctsvc_vcard_get_contact(int ver, char *vcard, contacts_recor
                cursor = new_start;
        }
 
-       CTS_ERR("Invalid vcard");
+       ERR("Invalid vcard");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
@@ -3824,11 +3781,13 @@ 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 && contact->name->records->data) {
-               name = (ctsvc_name_s *)contact->name->records->data;
+       if (0 < contact->name->count && contact->name->records
+                       && contact->name->records->data) {
+               name = (ctsvc_name_s*)contact->name->records->data;
        }
 
-       if (name && (name->first || name->last || name->prefix || name->addition || name->suffix)) {
+       if (name && (name->first || name->last || name->prefix || name->addition
+                               || name->suffix)) {
                int reverse_lang_type = -1;
                char *display = NULL;
                char *reverse_display = NULL;
@@ -3846,25 +3805,24 @@ static inline void __ctsvc_vcard_make_contact_display_name(ctsvc_contact_s *cont
                 *    But, if there is only prefix, reverse sort_name is prefix
                 */
                temp_display_len = SAFE_STRLEN(name->first)
-                                               + SAFE_STRLEN(name->addition)
-                                               + SAFE_STRLEN(name->last)
-                                               + SAFE_STRLEN(name->suffix);
+                       + SAFE_STRLEN(name->addition)
+                       + SAFE_STRLEN(name->last)
+                       + SAFE_STRLEN(name->suffix);
                if (0 < temp_display_len) {
                        temp_display_len += 7;
                        temp_display = calloc(1, temp_display_len);
                        if (NULL == temp_display) {
-                               CTS_ERR("calloc() Fail");
+                               ERR("calloc() Fail");
                                return;
                        }
 
-                       len=0;
+                       len = 0;
 
                        if (name->last) {
                                len += snprintf(temp_display + len, temp_display_len - len, "%s", name->last);
 
-                               if (reverse_lang_type < 0) {
+                               if (reverse_lang_type < 0)
                                        reverse_lang_type = ctsvc_check_language_type(temp_display);
-                               }
 
                                if (reverse_lang_type != CTSVC_LANG_KOREAN &&
                                                reverse_lang_type != CTSVC_LANG_CHINESE &&
@@ -3875,15 +3833,12 @@ static inline void __ctsvc_vcard_make_contact_display_name(ctsvc_contact_s *cont
                        }
 
                        if (reverse_lang_type < 0) {
-                               if (*temp_display) {
+                               if (*temp_display)
                                        reverse_lang_type = ctsvc_check_language_type(temp_display);
-                               }
-                               else if (name->first) {
+                               else if (name->first)
                                        reverse_lang_type = ctsvc_check_language_type(name->first);
-                               }
-                               else if (name->addition) {
+                               else if (name->addition)
                                        reverse_lang_type = ctsvc_check_language_type(name->addition);
-                               }
                        }
 
                        if (reverse_lang_type == CTSVC_LANG_JAPANESE) {
@@ -3899,14 +3854,12 @@ static inline void __ctsvc_vcard_make_contact_display_name(ctsvc_contact_s *cont
                                                len += snprintf(temp_display + len, temp_display_len - len, " ");
                                        len += snprintf(temp_display + len, temp_display_len - len, "%s", name->first);
                                }
-                       }
-                       else {
+                       } else {
                                /* make temp_display name Prefix - Last - First -Middle - Suffix */
                                if (name->first) {
                                        if (*temp_display) {
-                                               if (reverse_lang_type < 0) {
+                                               if (reverse_lang_type < 0)
                                                        reverse_lang_type = ctsvc_check_language_type(temp_display);
-                                               }
 
                                                if (reverse_lang_type != CTSVC_LANG_KOREAN &&
                                                                reverse_lang_type != CTSVC_LANG_CHINESE)
@@ -3917,9 +3870,8 @@ static inline void __ctsvc_vcard_make_contact_display_name(ctsvc_contact_s *cont
 
                                if (name->addition) {
                                        if (*temp_display) {
-                                               if (reverse_lang_type < 0) {
+                                               if (reverse_lang_type < 0)
                                                        reverse_lang_type = ctsvc_check_language_type(temp_display);
-                                               }
 
                                                if (reverse_lang_type != CTSVC_LANG_KOREAN &&
                                                                reverse_lang_type != CTSVC_LANG_CHINESE)
@@ -3931,15 +3883,15 @@ static inline void __ctsvc_vcard_make_contact_display_name(ctsvc_contact_s *cont
 
                        if (name->suffix) {
                                if (*temp_display) {
-                                       if (reverse_lang_type < 0) {
+                                       if (reverse_lang_type < 0)
                                                reverse_lang_type = ctsvc_check_language_type(temp_display);
-                                       }
 
-                                       if (reverse_lang_type == CTSVC_LANG_JAPANESE)
+                                       if (reverse_lang_type == CTSVC_LANG_JAPANESE) {
                                                len += snprintf(temp_display + len, temp_display_len - len, " ");
-                                       else if (reverse_lang_type != CTSVC_LANG_KOREAN &&
-                                                                       reverse_lang_type != CTSVC_LANG_CHINESE)
+                                       else if (reverse_lang_type != CTSVC_LANG_KOREAN &&
+                                                       reverse_lang_type != CTSVC_LANG_CHINESE)  {
                                                len += snprintf(temp_display + len, temp_display_len - len, ", ");
+                                       }
                                }
                                len += snprintf(temp_display + len, temp_display_len - len, "%s", name->suffix);
                        }
@@ -3949,17 +3901,15 @@ static inline void __ctsvc_vcard_make_contact_display_name(ctsvc_contact_s *cont
                        display_len = SAFE_STRLEN(name->prefix) + temp_display_len + 2;
                        reverse_display = calloc(1, display_len);
                        if (NULL == reverse_display) {
-                               CTS_ERR("calloc() Fail");
+                               ERR("calloc() Fail");
                                free(temp_display);
                                return;
                        }
                        snprintf(reverse_display, display_len, "%s %s", name->prefix, temp_display);
                        free(temp_display);
-               }
-               else if (temp_display) {
+               } else if (temp_display) {
                        reverse_display = temp_display;
-               }
-               else if (name->prefix) {
+               } else if (name->prefix) {
                        reverse_display = strdup(name->prefix);
                }
 
@@ -3973,21 +3923,21 @@ static inline void __ctsvc_vcard_make_contact_display_name(ctsvc_contact_s *cont
                 */
 
                if (reverse_lang_type == CTSVC_LANG_KOREAN ||
-                       reverse_lang_type == CTSVC_LANG_CHINESE)
+                               reverse_lang_type == CTSVC_LANG_CHINESE) {
                        display = strdup(reverse_display);
-               else {
+               else {
                        int lang_type = -1;
                        temp_display = NULL;
                        temp_display_len = SAFE_STRLEN(name->first)
-                                                               + SAFE_STRLEN(name->addition)
-                                                               + SAFE_STRLEN(name->last)
-                                                               + SAFE_STRLEN(name->suffix);
+                               + SAFE_STRLEN(name->addition)
+                               + SAFE_STRLEN(name->last)
+                               + SAFE_STRLEN(name->suffix);
                        if (0 < temp_display_len) {
                                temp_display_len += 6;
                                /* make reverse_temp_display_name */
                                temp_display = calloc(1, temp_display_len);
                                if (NULL == temp_display) {
-                                       CTS_ERR("calloc() Fail");
+                                       ERR("calloc() Fail");
                                        free(reverse_display);
                                        return;
                                }
@@ -4028,18 +3978,16 @@ static inline void __ctsvc_vcard_make_contact_display_name(ctsvc_contact_s *cont
                                display_len = SAFE_STRLEN(name->prefix) + temp_display_len + 2;
                                display = calloc(1, display_len);
                                if (NULL == display) {
-                                       CTS_ERR("calloc() Fail");
+                                       ERR("calloc() Fail");
                                        free(temp_display);
                                        free(reverse_display);
                                        return;
                                }
                                snprintf(display, display_len, "%s %s", name->prefix, temp_display);
                                free(temp_display);
-                       }
-                       else if (temp_display) {
+                       } else if (temp_display) {
                                display = temp_display;
-                       }
-                       else if (name->prefix) {
+                       } else if (name->prefix) {
                                display = strdup(name->prefix);
                        }
                }
@@ -4050,20 +3998,19 @@ static inline void __ctsvc_vcard_make_contact_display_name(ctsvc_contact_s *cont
                if (CONTACTS_NAME_DISPLAY_ORDER_FIRSTLAST == name_display_order) {
                        contact->display_name = display;
                        free(reverse_display);
-               }
-               else {
+#ifdef _CONTACTS_IPC_CLIENT
+               else {
                        contact->display_name = reverse_display;
                        free(display);
+#endif
                }
-
                contact->display_source_type = CONTACTS_DISPLAY_NAME_SOURCE_TYPE_NAME;
-       }
-       else {
+       } else {
                GList *cur;
                bool set_display_name = false;
                if (contact->company && contact->company->records) {
-                       for (cur=contact->company->records;cur;cur=cur->next) {
-                               ctsvc_company_s *company = (ctsvc_company_s *)cur->data;
+                       for (cur = contact->company->records; cur; cur = cur->next) {
+                               ctsvc_company_s *company = cur->data;
                                if (company && company->name) {
                                        set_display_name = true;
                                        contact->display_name = SAFE_STRDUP(company->name);
@@ -4075,8 +4022,8 @@ static inline void __ctsvc_vcard_make_contact_display_name(ctsvc_contact_s *cont
 
                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;
+                       for (cur = contact->nicknames->records; cur; cur = cur->next) {
+                               ctsvc_nickname_s *nickname = cur->data;
                                if (nickname && nickname->nickname) {
                                        set_display_name = true;
                                        contact->display_name = SAFE_STRDUP(nickname->nickname);
@@ -4088,8 +4035,8 @@ static inline void __ctsvc_vcard_make_contact_display_name(ctsvc_contact_s *cont
 
                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;
+                       for (cur = contact->numbers->records; cur; cur = cur->next) {
+                               ctsvc_number_s *number = cur->data;
                                if (number && number->number) {
                                        set_display_name = true;
                                        contact->display_name = SAFE_STRDUP(number->number);
@@ -4101,8 +4048,8 @@ static inline void __ctsvc_vcard_make_contact_display_name(ctsvc_contact_s *cont
 
                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;
+                       for (cur = contact->emails->records; cur; cur = cur->next) {
+                               ctsvc_email_s *email = cur->data;
                                if (email && email->email_addr) {
                                        set_display_name = true;
                                        contact->display_name = SAFE_STRDUP(email->email_addr);
@@ -4136,30 +4083,25 @@ static int __ctsvc_vcard_parse(const void *vcard_stream, contacts_record_h *reco
        __ctsvc_vcard_initial();
 
        vcard = __ctsvc_vcard_check_word(vcard, "BEGIN:VCARD");
-       RETVM_IF(NULL == vcard, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : The vcard is invalid.");
+       RETVM_IF(NULL == vcard, CONTACTS_ERROR_INVALID_PARAMETER, "The vcard is invalid.");
 
        val_begin = __ctsvc_vcard_check_word(vcard, "VERSION:");
        new_start = __ctsvc_vcard_get_val(CTSVC_VCARD_VER_NONE, val_begin, NULL, &val);
-       if (NULL == new_start || NULL == val)
+       if (NULL == new_start || NULL == val) {
                ver = CTSVC_VCARD_VER_2_1;
-       else {
+       else {
                ver = __ctsvc_vcard_check_version(val);
                free(val);
                vcard = new_start;
        }
 
-       contacts_record_create(_contacts_contact._uri, (contacts_record_h *)&contact);
+       contacts_record_create(_contacts_contact._uri, (contacts_record_h*)&contact);
        RETVM_IF(NULL == contact, CONTACTS_ERROR_OUT_OF_MEMORY, "Out of memory : contacts_record_create() Fail");
 
-       ret = __ctsvc_vcard_get_contact(ver, vcard, (contacts_record_h *)&contact);
-       if (CONTACTS_ERROR_NONE!= ret) {
+       ret = __ctsvc_vcard_get_contact(ver, vcard, (contacts_record_h*)&contact);
+       if (CONTACTS_ERROR_NONE != ret) {
+               ERR("cts_vcard_get_contact() Fail(%d)", ret);
                contacts_record_destroy((contacts_record_h)contact, true);
-               if (CONTACTS_ERROR_INVALID_PARAMETER == ret) {
-                       CTS_ERR("cts_vcard_get_contact() Fail(%d)", ret);
-               }
-               else
-                       CTS_ERR("cts_vcard_get_contact() Fail(%d)", ret);
-
                return ret;
        }
        __ctsvc_vcard_make_contact_display_name(contact);
@@ -4174,7 +4116,7 @@ static const char* __contacts_vcard_remove_line_break(const char *c)
 {
        while (c) {
                if ('\r' == *c && '\n' == *(c+1))
-                       c+=2;
+                       c += 2;
                else if ('\n' == *c)
                        c++;
                else
@@ -4194,7 +4136,7 @@ static void __contacts_vcard_free_sub_vcard_info_list(GList *list)
                return;
 
        GList *cursor;
-       for (cursor=list;cursor;cursor=cursor->next) {
+       for (cursor = list; cursor; cursor = cursor->next) {
                sub_vcard_info_s *vcard_info = cursor->data;
                free(vcard_info);
        }
@@ -4207,7 +4149,7 @@ static void __contacts_vcard_free_vcard_object_list(GList *list)
                return;
 
        GList *cursor;
-       for (cursor=list;cursor;cursor=cursor->next) {
+       for (cursor = list; cursor; cursor = cursor->next) {
                char *vcard_object = cursor->data;
                free(vcard_object);
        }
@@ -4225,7 +4167,8 @@ static const char* __contacts_vcard_parse_get_vcard_object(const char *cursor, G
        const char *vcard_cursor = NULL;
        GList *sub_vcard_list = NULL;
 
-       RETVM_IF(NULL == plist_vcard_object, cursor, "Invalid parameter(pvcard_object) is NULL");
+       RETV_IF(NULL == plist_vcard_object, cursor);
+
        *plist_vcard_object = NULL;
 
        vcard_start_cursor = __contacts_vcard_remove_line_break(vcard_start_cursor);
@@ -4249,7 +4192,7 @@ static const char* __contacts_vcard_parse_get_vcard_object(const char *cursor, G
                                vcard_cursor = __contacts_vcard_remove_line_break(vcard_cursor);
 
                                pos_start = vcard_start_cursor;
-                               for (sub_vcard_cursor=sub_vcard_list;sub_vcard_cursor;sub_vcard_cursor=sub_vcard_cursor->next) {
+                               for (sub_vcard_cursor = sub_vcard_list; sub_vcard_cursor; sub_vcard_cursor = sub_vcard_cursor->next) {
                                        sub_vcard_info_s *sub_vcard_info = sub_vcard_cursor->data;
                                        const char *pos_end = sub_vcard_info->pos_start;
                                        vcard_len += (pos_end - pos_start);
@@ -4258,14 +4201,14 @@ static const char* __contacts_vcard_parse_get_vcard_object(const char *cursor, G
                                vcard_len += (vcard_cursor - pos_start);
                                vcard_object = calloc(vcard_len + 1, sizeof(char));
                                if (NULL == vcard_object) {
-                                       CTS_ERR("calloc() Fail");
+                                       ERR("calloc() Fail");
                                        __contacts_vcard_free_sub_vcard_info_list(sub_vcard_list);
                                        return NULL;
                                }
 
                                vcard_len = 0;
                                pos_start = vcard_start_cursor;
-                               for (sub_vcard_cursor=sub_vcard_list;sub_vcard_cursor;sub_vcard_cursor=sub_vcard_cursor->next) {
+                               for (sub_vcard_cursor = sub_vcard_list; sub_vcard_cursor; sub_vcard_cursor = sub_vcard_cursor->next) {
                                        sub_vcard_info_s *sub_vcard_info = sub_vcard_cursor->data;
                                        const char *pos_end = sub_vcard_info->pos_start;
                                        memcpy(vcard_object+vcard_len, pos_start, pos_end - pos_start);
@@ -4277,11 +4220,11 @@ static const char* __contacts_vcard_parse_get_vcard_object(const char *cursor, G
                                *plist_vcard_object = g_list_append(*plist_vcard_object, vcard_object);
 
                                return vcard_cursor;
-                       }
-                       else if (STRING_EQUAL == 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));
                                if (NULL == sub_vcard_info) {
-                                       CTS_ERR("calloc() Fail");
+                                       ERR("calloc() Fail");
                                        __contacts_vcard_free_sub_vcard_info_list(sub_vcard_list);
                                        return NULL;
                                }
@@ -4327,14 +4270,14 @@ API int contacts_vcard_parse_to_contacts(const char *vcard_stream, contacts_list
                if (NULL == list_vcard_object)
                        break;
 
-               for (vcard_cursor=list_vcard_object;vcard_cursor;vcard_cursor=vcard_cursor->next) {
+               for (vcard_cursor = list_vcard_object; vcard_cursor; vcard_cursor = vcard_cursor->next) {
                        vcard_object = vcard_cursor->data;
                        if (NULL == vcard_object)
                                continue;
 
                        ret = __ctsvc_vcard_parse(vcard_object, &record);
                        if (ret < CONTACTS_ERROR_NONE) {
-                               CTS_ERR("Invalid parameter : vcard stream parsing error");
+                               ERR("__ctsvc_vcard_parse() Fail(%d)", ret);
                                __contacts_vcard_free_vcard_object_list(list_vcard_object);
                                contacts_list_destroy(list, true);
                                return ret;
@@ -4366,13 +4309,13 @@ API int contacts_vcard_parse_to_contact_foreach(const char *vcard_file_name,
        RETV_IF(NULL == cb, CONTACTS_ERROR_INVALID_PARAMETER);
 
        file = fopen(vcard_file_name, "r");
-       RETVM_IF(NULL == file, CONTACTS_ERROR_SYSTEM, "System : fopen() Fail(%d)", errno);
+       RETVM_IF(NULL == file, CONTACTS_ERROR_SYSTEM, "fopen() Fail(%d)", errno);
 
        len = 0;
        buf_size = CTSVC_VCARD_MAX_SIZE;
        stream = malloc(CTSVC_VCARD_MAX_SIZE);
        if (NULL == stream) {
-               CTS_ERR("Out of memory : malloc() Fail");
+               ERR("Out of memory : malloc() Fail");
                fclose(file);
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
@@ -4382,15 +4325,15 @@ API int contacts_vcard_parse_to_contact_foreach(const char *vcard_file_name,
                        if (STRING_EQUAL != strncmp(line, "BEGIN:VCARD", strlen("BEGIN:VCARD")))
                                continue;
 
-               if (len + sizeof(line) < buf_size)
+               if (len + sizeof(line) < buf_size) {
                        len += snprintf(stream + len, buf_size - len, "%s", line);
-               else {
+               else {
                        char *new_stream;
                        buf_size += sizeof(line) * 2;
                        new_stream = realloc(stream, buf_size);
-                       if (new_stream)
+                       if (new_stream) {
                                stream = new_stream;
-                       else {
+                       else {
                                free(stream);
                                fclose(file);
                                return CONTACTS_ERROR_OUT_OF_MEMORY;
@@ -4413,7 +4356,7 @@ API int contacts_vcard_parse_to_contact_foreach(const char *vcard_file_name,
                                        if (NULL == list_vcard_object)
                                                break;
 
-                                       for (vcard_cursor=list_vcard_object;vcard_cursor;vcard_cursor=vcard_cursor->next) {
+                                       for (vcard_cursor = list_vcard_object; vcard_cursor; vcard_cursor = vcard_cursor->next) {
                                                char *vcard_object = vcard_cursor->data;
 
                                                if (NULL == vcard_object)
@@ -4421,7 +4364,7 @@ API int contacts_vcard_parse_to_contact_foreach(const char *vcard_file_name,
 
                                                ret = __ctsvc_vcard_parse(vcard_object, &record);
                                                if (ret < CONTACTS_ERROR_NONE) {
-                                                       CTS_ERR("Invalid parameter : vcard stream parsing error");
+                                                       ERR("vcard stream parsing error");
                                                        free(stream);
                                                        fclose(file);
                                                        __contacts_vcard_free_vcard_object_list(list_vcard_object);
@@ -4441,8 +4384,7 @@ API int contacts_vcard_parse_to_contact_foreach(const char *vcard_file_name,
                                        list_vcard_object = NULL;
                                }
                        }
-               }
-               else if (STRING_EQUAL == strncmp(line, "BEGIN:VCARD", 11)) { /* sub vcard object */
+               } else if (STRING_EQUAL == strncmp(line, "BEGIN:VCARD", 11)) { /* sub vcard object */
                        vcard_depth++;
                }
        }
index f2f87e2..255ad48 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
@@ -20,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 
 #include "ctsvc_internal.h"
@@ -152,7 +147,7 @@ API const _contacts_name_property_ids _contacts_name = {
        .suffix                 = CTSVC_PROPERTY_NAME_SUFFIX,
        .prefix                 = CTSVC_PROPERTY_NAME_PREFIX,
        .phonetic_first = CTSVC_PROPERTY_NAME_PHONETIC_FIRST,
-       .phonetic_middle= CTSVC_PROPERTY_NAME_PHONETIC_MIDDLE,
+       .phonetic_middle = CTSVC_PROPERTY_NAME_PHONETIC_MIDDLE,
        .phonetic_last  = CTSVC_PROPERTY_NAME_PHONETIC_LAST
 };
 
@@ -684,17 +679,17 @@ const property_info_s __property_group[] = {
 };
 
 const property_info_s __property_person[] = {
-       {CTSVC_PROPERTY_PERSON_ID,                                      CTSVC_SEARCH_PROPERTY_ALL,      "person_id"},
-       {CTSVC_PROPERTY_PERSON_DISPLAY_NAME,            CTSVC_SEARCH_PROPERTY_ALL,      NULL},         /* "dispaly_name" or "reverse_dispaly_name" */
+       {CTSVC_PROPERTY_PERSON_ID,                                      CTSVC_SEARCH_PROPERTY_ALL, "person_id"},
+       {CTSVC_PROPERTY_PERSON_DISPLAY_NAME,            CTSVC_SEARCH_PROPERTY_ALL, NULL},         /* "dispaly_name" or "reverse_dispaly_name" */
        {CTSVC_PROPERTY_PERSON_DISPLAY_NAME_INDEX,      CTSVC_SEARCH_PROPERTY_PROJECTION,       NULL}, /* "dispaly_name" or "reverse_dispaly_name" */
-       {CTSVC_PROPERTY_PERSON_DISPLAY_CONTACT_ID,CTSVC_SEARCH_PROPERTY_ALL,    "name_contact_id"},
-       {CTSVC_PROPERTY_PERSON_RINGTONE,                        CTSVC_SEARCH_PROPERTY_ALL,      "ringtone_path"},
-       {CTSVC_PROPERTY_PERSON_IMAGE_THUMBNAIL, CTSVC_SEARCH_PROPERTY_ALL,      "image_thumbnail_path"},
-       {CTSVC_PROPERTY_PERSON_VIBRATION,               CTSVC_SEARCH_PROPERTY_ALL,      "vibration"},
-       {CTSVC_PROPERTY_PERSON_MESSAGE_ALERT,   CTSVC_SEARCH_PROPERTY_ALL,      "message_alert"},
-       {CTSVC_PROPERTY_PERSON_STATUS,                  CTSVC_SEARCH_PROPERTY_ALL,      "status"},
-       {CTSVC_PROPERTY_PERSON_IS_FAVORITE,             CTSVC_SEARCH_PROPERTY_ALL,      "is_favorite"},
-       {CTSVC_PROPERTY_PERSON_FAVORITE_PRIORITY,       CTSVC_SEARCH_PROPERTY_FILTER,   "favorite_prio"},
+       {CTSVC_PROPERTY_PERSON_DISPLAY_CONTACT_ID, CTSVC_SEARCH_PROPERTY_ALL, "name_contact_id"},
+       {CTSVC_PROPERTY_PERSON_RINGTONE,                        CTSVC_SEARCH_PROPERTY_ALL, "ringtone_path"},
+       {CTSVC_PROPERTY_PERSON_IMAGE_THUMBNAIL, CTSVC_SEARCH_PROPERTY_ALL, "image_thumbnail_path"},
+       {CTSVC_PROPERTY_PERSON_VIBRATION,               CTSVC_SEARCH_PROPERTY_ALL, "vibration"},
+       {CTSVC_PROPERTY_PERSON_MESSAGE_ALERT,   CTSVC_SEARCH_PROPERTY_ALL, "message_alert"},
+       {CTSVC_PROPERTY_PERSON_STATUS,                  CTSVC_SEARCH_PROPERTY_ALL, "status"},
+       {CTSVC_PROPERTY_PERSON_IS_FAVORITE,             CTSVC_SEARCH_PROPERTY_ALL, "is_favorite"},
+       {CTSVC_PROPERTY_PERSON_FAVORITE_PRIORITY,       CTSVC_SEARCH_PROPERTY_FILTER, "favorite_prio"},
        {CTSVC_PROPERTY_PERSON_LINK_COUNT,              CTSVC_SEARCH_PROPERTY_ALL,      "link_count"},
        {CTSVC_PROPERTY_PERSON_ADDRESSBOOK_IDS, CTSVC_SEARCH_PROPERTY_PROJECTION,       "addressbook_ids"},
        {CTSVC_PROPERTY_PERSON_HAS_PHONENUMBER, CTSVC_SEARCH_PROPERTY_ALL,      "has_phonenumber"},
@@ -707,7 +702,7 @@ const property_info_s __property_simple_contact[] = {
        {CTSVC_PROPERTY_CONTACT_DISPLAY_SOURCE_DATA_ID, CTSVC_SEARCH_PROPERTY_ALL,      "display_name_source"},
        {CTSVC_PROPERTY_CONTACT_ADDRESSBOOK_ID, CTSVC_SEARCH_PROPERTY_ALL,      "addressbook_id"},
        {CTSVC_PROPERTY_CONTACT_RINGTONE,               CTSVC_SEARCH_PROPERTY_ALL,      "ringtone_path"},
-       {CTSVC_PROPERTY_CONTACT_IMAGE_THUMBNAIL,CTSVC_SEARCH_PROPERTY_ALL,      "image_thumbnail_path"},
+       {CTSVC_PROPERTY_CONTACT_IMAGE_THUMBNAIL, CTSVC_SEARCH_PROPERTY_ALL,     "image_thumbnail_path"},
        {CTSVC_PROPERTY_CONTACT_IS_FAVORITE,            CTSVC_SEARCH_PROPERTY_ALL,      "is_favorite"},
        {CTSVC_PROPERTY_CONTACT_HAS_PHONENUMBER, CTSVC_SEARCH_PROPERTY_ALL,     "has_phonenumber"},
        {CTSVC_PROPERTY_CONTACT_HAS_EMAIL,              CTSVC_SEARCH_PROPERTY_ALL,      "has_email"},
@@ -758,7 +753,7 @@ const property_info_s __property_address[] = {
        {CTSVC_PROPERTY_ADDRESS_TYPE,                   CTSVC_SEARCH_PROPERTY_ALL,      "data1"},
        {CTSVC_PROPERTY_ADDRESS_LABEL,          CTSVC_SEARCH_PROPERTY_ALL,      "data2"},
        {CTSVC_PROPERTY_ADDRESS_POSTBOX,                CTSVC_SEARCH_PROPERTY_ALL,      "data3"},
-       {CTSVC_PROPERTY_ADDRESS_POSTAL_CODE,CTSVC_SEARCH_PROPERTY_ALL,  "data4"},
+       {CTSVC_PROPERTY_ADDRESS_POSTAL_CODE, CTSVC_SEARCH_PROPERTY_ALL, "data4"},
        {CTSVC_PROPERTY_ADDRESS_REGION,         CTSVC_SEARCH_PROPERTY_ALL,      "data5"},
        {CTSVC_PROPERTY_ADDRESS_LOCALITY,       CTSVC_SEARCH_PROPERTY_ALL,      "data6"},
        {CTSVC_PROPERTY_ADDRESS_STREET,         CTSVC_SEARCH_PROPERTY_ALL,      "data7"},
@@ -788,7 +783,7 @@ const property_info_s __property_event[] = {
 const property_info_s __property_group_relation[] = {
        {CTSVC_PROPERTY_GROUP_RELATION_GROUP_ID,        CTSVC_SEARCH_PROPERTY_ALL,      "group_id"},
        {CTSVC_PROPERTY_GROUP_RELATION_CONTACT_ID,      CTSVC_SEARCH_PROPERTY_ALL,      "contact_id"},
-       {CTSVC_PROPERTY_GROUP_RELATION_GROUP_NAME,CTSVC_SEARCH_PROPERTY_ALL,    "group_name"},
+       {CTSVC_PROPERTY_GROUP_RELATION_GROUP_NAME, CTSVC_SEARCH_PROPERTY_ALL,   "group_name"},
 };
 
 const property_info_s __property_relationship[] = {
@@ -873,7 +868,7 @@ const property_info_s __property_activity[] = {
        {CTSVC_PROPERTY_ACTIVITY_TIMESTAMP,             CTSVC_SEARCH_PROPERTY_ALL,      "timestamp"},
        {CTSVC_PROPERTY_ACTIVITY_SERVICE_OPERATION, CTSVC_SEARCH_PROPERTY_ALL,  "service_operation"},
        {CTSVC_PROPERTY_ACTIVITY_URI,                           CTSVC_SEARCH_PROPERTY_ALL,      "uri"},
-       {CTSVC_PROPERTY_ACTIVITY_ACTIVITY_PHOTO,CTSVC_SEARCH_PROPERTY_NONE,     (void*)__property_activity_photo},
+       {CTSVC_PROPERTY_ACTIVITY_ACTIVITY_PHOTO, CTSVC_SEARCH_PROPERTY_NONE,    (void*)__property_activity_photo},
 };
 
 const property_info_s __property_extension[] = {
@@ -909,21 +904,21 @@ const property_info_s __property_contact[] = {
        {CTSVC_PROPERTY_CONTACT_MESSAGE_ALERT,          CTSVC_SEARCH_PROPERTY_ALL,      "message_alert"},
        {CTSVC_PROPERTY_CONTACT_CHANGED_TIME,           CTSVC_SEARCH_PROPERTY_ALL,      "changed_time"},
        {CTSVC_PROPERTY_CONTACT_LINK_MODE,                      CTSVC_SEARCH_PROPERTY_ALL,      "link_mode"},
-       {CTSVC_PROPERTY_CONTACT_NAME,                                   CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_name},
-       {CTSVC_PROPERTY_CONTACT_COMPANY,                                CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_company},
-       {CTSVC_PROPERTY_CONTACT_NOTE,                                   CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_note},
-       {CTSVC_PROPERTY_CONTACT_NUMBER,                         CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_number},
-       {CTSVC_PROPERTY_CONTACT_EMAIL,                          CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_email},
-       {CTSVC_PROPERTY_CONTACT_EVENT,                          CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_event},
-       {CTSVC_PROPERTY_CONTACT_MESSENGER,                      CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_messenger},
-       {CTSVC_PROPERTY_CONTACT_ADDRESS,                                CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_address},
-       {CTSVC_PROPERTY_CONTACT_URL,                                    CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_url},
-       {CTSVC_PROPERTY_CONTACT_NICKNAME,                       CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_nickname},
-       {CTSVC_PROPERTY_CONTACT_PROFILE,                                CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_profile},
-       {CTSVC_PROPERTY_CONTACT_RELATIONSHIP,           CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_relationship},
-       {CTSVC_PROPERTY_CONTACT_IMAGE,                          CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_image},
-       {CTSVC_PROPERTY_CONTACT_GROUP_RELATION,         CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_group_relation},
-       {CTSVC_PROPERTY_CONTACT_EXTENSION,                      CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_extension},
+       {CTSVC_PROPERTY_CONTACT_NAME,                                   CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_name},
+       {CTSVC_PROPERTY_CONTACT_COMPANY,                                CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_company},
+       {CTSVC_PROPERTY_CONTACT_NOTE,                                   CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_note},
+       {CTSVC_PROPERTY_CONTACT_NUMBER,                         CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_number},
+       {CTSVC_PROPERTY_CONTACT_EMAIL,                          CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_email},
+       {CTSVC_PROPERTY_CONTACT_EVENT,                          CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_event},
+       {CTSVC_PROPERTY_CONTACT_MESSENGER,                      CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_messenger},
+       {CTSVC_PROPERTY_CONTACT_ADDRESS,                                CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_address},
+       {CTSVC_PROPERTY_CONTACT_URL,                                    CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_url},
+       {CTSVC_PROPERTY_CONTACT_NICKNAME,                       CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_nickname},
+       {CTSVC_PROPERTY_CONTACT_PROFILE,                                CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_profile},
+       {CTSVC_PROPERTY_CONTACT_RELATIONSHIP,           CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_relationship},
+       {CTSVC_PROPERTY_CONTACT_IMAGE,                          CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_image},
+       {CTSVC_PROPERTY_CONTACT_GROUP_RELATION,         CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_group_relation},
+       {CTSVC_PROPERTY_CONTACT_EXTENSION,                      CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_extension},
 };
 
 const property_info_s __property_my_profile[] = {
@@ -933,20 +928,20 @@ const property_info_s __property_my_profile[] = {
        {CTSVC_PROPERTY_MY_PROFILE_IMAGE_THUMBNAIL,     CTSVC_SEARCH_PROPERTY_ALL,      "image_thumbnail_path"},
        {CTSVC_PROPERTY_MY_PROFILE_UID,                                 CTSVC_SEARCH_PROPERTY_ALL,      "uid"},
        {CTSVC_PROPERTY_MY_PROFILE_CHANGED_TIME,                CTSVC_SEARCH_PROPERTY_ALL,      "changed_time"},
-       {CTSVC_PROPERTY_MY_PROFILE_NAME,                                        CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_name},
-       {CTSVC_PROPERTY_MY_PROFILE_COMPANY,                             CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_company},
-       {CTSVC_PROPERTY_MY_PROFILE_NOTE,                                        CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_note},
-       {CTSVC_PROPERTY_MY_PROFILE_NUMBER,                              CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_number},
-       {CTSVC_PROPERTY_MY_PROFILE_EMAIL,                               CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_email},
-       {CTSVC_PROPERTY_MY_PROFILE_EVENT,                               CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_event},
-       {CTSVC_PROPERTY_MY_PROFILE_MESSENGER,                   CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_messenger},
-       {CTSVC_PROPERTY_MY_PROFILE_ADDRESS,                             CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_address},
-       {CTSVC_PROPERTY_MY_PROFILE_URL,                                 CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_url},
-       {CTSVC_PROPERTY_MY_PROFILE_NICKNAME,                            CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_nickname},
-       {CTSVC_PROPERTY_MY_PROFILE_PROFILE,                             CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_profile},
-       {CTSVC_PROPERTY_MY_PROFILE_RELATIONSHIP,                CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_relationship},
-       {CTSVC_PROPERTY_MY_PROFILE_IMAGE,                               CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_image},
-       {CTSVC_PROPERTY_MY_PROFILE_EXTENSION,                   CTSVC_SEARCH_PROPERTY_NONE,(void*)__property_extension},
+       {CTSVC_PROPERTY_MY_PROFILE_NAME,                                        CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_name},
+       {CTSVC_PROPERTY_MY_PROFILE_COMPANY,                             CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_company},
+       {CTSVC_PROPERTY_MY_PROFILE_NOTE,                                        CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_note},
+       {CTSVC_PROPERTY_MY_PROFILE_NUMBER,                              CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_number},
+       {CTSVC_PROPERTY_MY_PROFILE_EMAIL,                               CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_email},
+       {CTSVC_PROPERTY_MY_PROFILE_EVENT,                               CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_event},
+       {CTSVC_PROPERTY_MY_PROFILE_MESSENGER,                   CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_messenger},
+       {CTSVC_PROPERTY_MY_PROFILE_ADDRESS,                             CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_address},
+       {CTSVC_PROPERTY_MY_PROFILE_URL,                                 CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_url},
+       {CTSVC_PROPERTY_MY_PROFILE_NICKNAME,                            CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_nickname},
+       {CTSVC_PROPERTY_MY_PROFILE_PROFILE,                             CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_profile},
+       {CTSVC_PROPERTY_MY_PROFILE_RELATIONSHIP,                CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_relationship},
+       {CTSVC_PROPERTY_MY_PROFILE_IMAGE,                               CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_image},
+       {CTSVC_PROPERTY_MY_PROFILE_EXTENSION,                   CTSVC_SEARCH_PROPERTY_NONE, (void*)__property_extension},
 };
 
 const property_info_s __property_speeddial[] = {   /* _contacts_speeddial */
@@ -1231,7 +1226,7 @@ typedef struct {
        ctsvc_record_type_e type;
        property_info_s *properties;
        unsigned int property_count;
-}view_uri_info_s;
+} view_uri_info_s;
 
 #define PTR_COUNT(X)   (void*)(X), sizeof(X)/sizeof(property_info_s)
 
@@ -1315,7 +1310,7 @@ void ctsvc_view_uri_init()
 
        i = 0;
        count = sizeof(__tables)/sizeof(view_uri_info_s);
-       for (i=0;i<count;i++)
+       for (i = 0; i < count; i++)
                g_hash_table_insert(__ctsvc_view_uri_hash, __tables[i].view_uri, GINT_TO_POINTER(&__tables[i]));
 }
 
@@ -1328,7 +1323,7 @@ void ctsvc_view_uri_deinit()
                return;
 
        if (NULL == __ctsvc_view_uri_hash) {
-               CTS_ERR("contacts-service is not initialized");
+               ERR("contacts-service is not initialized");
                return;
        }
 
@@ -1337,13 +1332,13 @@ void ctsvc_view_uri_deinit()
 #endif
 }
 
-ctsvc_record_type_e ctsvc_view_get_record_type(const charview_uri)
+ctsvc_record_type_e ctsvc_view_get_record_type(const char *view_uri)
 {
-       view_uri_info_sview_uri_info = NULL;
+       view_uri_info_s *view_uri_info = NULL;
        ctsvc_record_type_e type = CTSVC_RECORD_INVALID;
 
        if (NULL == __ctsvc_view_uri_hash) {
-               CTS_ERR("contacts-service is not initialized");
+               ERR("contacts-service is not initialized");
                return type;
        }
 
@@ -1354,12 +1349,12 @@ ctsvc_record_type_e ctsvc_view_get_record_type(const char* view_uri)
        return type;
 }
 
-const char* ctsvc_view_get_uri(const charview_uri)
+const char* ctsvc_view_get_uri(const char *view_uri)
 {
-       view_uri_info_sview_uri_info = NULL;
+       view_uri_info_s *view_uri_info = NULL;
 
        if (NULL == __ctsvc_view_uri_hash) {
-               CTS_ERR("contacts-service is not initialized");
+               ERR("contacts-service is not initialized");
                return NULL;
        }
 
@@ -1372,10 +1367,10 @@ const char* ctsvc_view_get_uri(const char* view_uri)
 
 const property_info_s* ctsvc_view_get_all_property_infos(const char *view_uri, unsigned int *count)
 {
-       view_uri_info_sview_uri_info = NULL;
+       view_uri_info_s *view_uri_info = NULL;
 
        if (NULL == __ctsvc_view_uri_hash) {
-               CTS_ERR("contacts-service is not initialized");
+               ERR("contacts-service is not initialized");
                return NULL;
        }
 
index 5e58638..6e61540 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
@@ -460,13 +456,13 @@ typedef enum {
        CTSVC_PROPERTY_PHONELOG_STAT_LOG_COUNT = (CTSVC_PROPERTY_PHONELOG_STAT | CTSVC_VIEW_DATA_TYPE_INT | CTSVC_READ_ONLY_PROPERTY),
        CTSVC_PROPERTY_PHONELOG_STAT_LOG_TYPE = (CTSVC_PROPERTY_PHONELOG_STAT | CTSVC_VIEW_DATA_TYPE_INT | CTSVC_READ_ONLY_PROPERTY) +1,
 
-}ctsvc_property_ids_e;
+} ctsvc_property_ids_e;
 
 void ctsvc_view_uri_init();
 void ctsvc_view_uri_deinit();
 
-const char* ctsvc_view_get_uri(const charview_uri);
-ctsvc_record_type_e ctsvc_view_get_record_type(const charview_uri);
+const char* ctsvc_view_get_uri(const char *view_uri);
+ctsvc_record_type_e ctsvc_view_get_record_type(const char *view_uri);
 const property_info_s* ctsvc_view_get_all_property_infos(const char *view_uri, unsigned int *count);
 
 #endif /* __CTSVC_VIEW_H__ */
index c7c5f74..0fc3389 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "ctsvc_internal.h"
 #include "ctsvc_ipc_marshal.h"
 #include "contacts_record.h"
 
-static int __ctsvc_ipc_unmarshal_activity(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
-static int __ctsvc_ipc_marshal_activity(const contacts_record_h record, pims_ipc_data_h ipc_data);
-
-ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_activity_plugin_cb = {
-       .unmarshal_record = __ctsvc_ipc_unmarshal_activity,
-       .marshal_record = __ctsvc_ipc_marshal_activity
-};
-
 
-static int __ctsvc_ipc_unmarshal_activity(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+static int __ctsvc_ipc_unmarshal_activity(pims_ipc_data_h ipc_data, const char *view_uri,
+               contacts_record_h record)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_INTERNAL);
-       RETV_IF(record==NULL,CONTACTS_ERROR_INTERNAL);
+       ctsvc_activity_s *activity_p = (ctsvc_activity_s*)record;
 
-       ctsvc_activity_s* activity_p = (ctsvc_activity_s*) record;
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_INTERNAL);
+       RETV_IF(NULL == record, CONTACTS_ERROR_INTERNAL);
 
        do {
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &activity_p->id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &activity_p->contact_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &activity_p->source_name) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &activity_p->status) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &activity_p->timestamp) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &activity_p->service_operation) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &activity_p->uri) != CONTACTS_ERROR_NONE) break;
-
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&activity_p->photos) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &activity_p->id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &activity_p->contact_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &activity_p->source_name) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &activity_p->status) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &activity_p->timestamp) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &activity_p->service_operation) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &activity_p->uri) != CONTACTS_ERROR_NONE)
+                       break;
+
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&activity_p->photos) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
 
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_unmarshal fail");
+       ERR("__ctsvc_ipc_unmarshal_activity() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_ipc_marshal_activity(const contacts_record_h record, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_activity(const contacts_record_h record,
+               pims_ipc_data_h ipc_data)
 {
-       ctsvc_activity_s* activity_p = (ctsvc_activity_s*)record;
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(activity_p==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_activity_s *activity_p = (ctsvc_activity_s*)record;
 
-       do {
-               if (ctsvc_ipc_marshal_int((activity_p->id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((activity_p->contact_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((activity_p->source_name),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((activity_p->status),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((activity_p->timestamp),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((activity_p->service_operation),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((activity_p->uri),ipc_data) != CONTACTS_ERROR_NONE) break;
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(activity_p == NULL, CONTACTS_ERROR_NO_DATA);
 
-               if (ctsvc_ipc_marshal_list((contacts_list_h)activity_p->photos, ipc_data) != CONTACTS_ERROR_NONE) break;
+       do {
+               if (ctsvc_ipc_marshal_int((activity_p->id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((activity_p->contact_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((activity_p->source_name), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((activity_p->status), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((activity_p->timestamp), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((activity_p->service_operation), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((activity_p->uri), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+
+               if (ctsvc_ipc_marshal_list((contacts_list_h)activity_p->photos, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_marshal fail");
+       ERR("_ctsvc_ipc_marshal() Fail");
 
        return CONTACTS_ERROR_INVALID_PARAMETER;
 
 }
 
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_activity_plugin_cb = {
+       .unmarshal_record = __ctsvc_ipc_unmarshal_activity,
+       .marshal_record = __ctsvc_ipc_marshal_activity
+};
+
index 5be53cd..1238123 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "ctsvc_internal.h"
 #include "ctsvc_ipc_marshal.h"
 #include "contacts_record.h"
 
-static int __ctsvc_ipc_unmarshal_activity_photo(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
-static int __ctsvc_ipc_marshal_activity_photo(const contacts_record_h record, pims_ipc_data_h ipc_data);
-
-ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_activity_photo_plugin_cb = {
-       .unmarshal_record = __ctsvc_ipc_unmarshal_activity_photo,
-       .marshal_record = __ctsvc_ipc_marshal_activity_photo
-};
-
 
-static int __ctsvc_ipc_unmarshal_activity_photo(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+static int __ctsvc_ipc_unmarshal_activity_photo(pims_ipc_data_h ipc_data,
+               const char *view_uri, contacts_record_h record)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(record==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_activity_photo_s *photo_p = (ctsvc_activity_photo_s*)record;
 
-       ctsvc_activity_photo_s* photo_p = (ctsvc_activity_photo_s*) record;
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == record, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &photo_p->id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &photo_p->activity_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &photo_p->photo_url) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &photo_p->sort_index) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &photo_p->id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &photo_p->activity_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &photo_p->photo_url) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &photo_p->sort_index) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
 
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_unmarshal fail");
+       ERR("__ctsvc_ipc_unmarshal_activity_photo() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_ipc_marshal_activity_photo(const contacts_record_h record, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_activity_photo(const contacts_record_h record,
+               pims_ipc_data_h ipc_data)
 {
-       ctsvc_activity_photo_s* photo_p = (ctsvc_activity_photo_s*)record;
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(photo_p==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_activity_photo_s *photo_p = (ctsvc_activity_photo_s*)record;
+
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(photo_p == NULL, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_marshal_int((photo_p->id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((photo_p->activity_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((photo_p->photo_url),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((photo_p->sort_index),ipc_data) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_marshal_int((photo_p->id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((photo_p->activity_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((photo_p->photo_url), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((photo_p->sort_index), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_marshal fail");
+       ERR("_ctsvc_ipc_marshal() Fail");
 
        return CONTACTS_ERROR_INVALID_PARAMETER;
 
 }
 
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_activity_photo_plugin_cb = {
+       .unmarshal_record = __ctsvc_ipc_unmarshal_activity_photo,
+       .marshal_record = __ctsvc_ipc_marshal_activity_photo
+};
+
index 93e29ab..db06be9 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "ctsvc_internal.h"
 #include "ctsvc_ipc_marshal.h"
 #include "contacts_record.h"
 
-static int __ctsvc_ipc_unmarshal_address(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
-static int __ctsvc_ipc_marshal_address(const contacts_record_h record, pims_ipc_data_h ipc_data);
-
-ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_address_plugin_cb = {
-       .unmarshal_record = __ctsvc_ipc_unmarshal_address,
-       .marshal_record = __ctsvc_ipc_marshal_address
-};
-
 
-static int __ctsvc_ipc_unmarshal_address(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+static int __ctsvc_ipc_unmarshal_address(pims_ipc_data_h ipc_data,
+               const char *view_uri, contacts_record_h record)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(record==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_address_s *address_p = (ctsvc_address_s*)record;
 
-       ctsvc_address_s* address_p = (ctsvc_address_s*) record;
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == record, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_unmarshal_bool(ipc_data, &address_p->is_default) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &address_p->id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &address_p->contact_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &address_p->type) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &address_p->label) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &address_p->pobox) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &address_p->postalcode) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &address_p->region) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &address_p->locality) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &address_p->street) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &address_p->extended) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &address_p->country) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_bool(ipc_data, &address_p->is_default) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &address_p->id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &address_p->contact_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &address_p->type) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &address_p->label) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &address_p->pobox) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &address_p->postalcode) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &address_p->region) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &address_p->locality) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &address_p->street) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &address_p->extended) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &address_p->country) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_unmarshal fail");
+       ERR("__ctsvc_ipc_unmarshal_address() Fail");
 
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_ipc_marshal_address(const contacts_record_h record, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_address(const contacts_record_h record,
+               pims_ipc_data_h ipc_data)
 {
-       ctsvc_address_s* address_p = (ctsvc_address_s*)record;
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(address_p==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_address_s *address_p = (ctsvc_address_s*)record;
+
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == address_p, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_marshal_bool((address_p->is_default),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((address_p->id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((address_p->contact_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((address_p->type),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((address_p->label),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((address_p->pobox),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((address_p->postalcode),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((address_p->region),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((address_p->locality),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((address_p->street),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((address_p->extended),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((address_p->country),ipc_data) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_marshal_bool((address_p->is_default), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((address_p->id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((address_p->contact_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((address_p->type), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((address_p->label), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((address_p->pobox), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((address_p->postalcode), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((address_p->region), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((address_p->locality), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((address_p->street), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((address_p->extended), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((address_p->country), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_marshal fail");
+       ERR("_ctsvc_ipc_marshal() Fail");
 
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_address_plugin_cb = {
+       .unmarshal_record = __ctsvc_ipc_unmarshal_address,
+       .marshal_record = __ctsvc_ipc_marshal_address
+};
+
index 4642a21..2af7ae5 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "ctsvc_internal.h"
 #include "ctsvc_ipc_marshal.h"
 #include "contacts_record.h"
 
-static int __ctsvc_ipc_unmarshal_addressbook(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
-static int __ctsvc_ipc_marshal_addressbook(const contacts_record_h record, pims_ipc_data_h ipc_data);
-
-ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_addressbook_plugin_cb = {
-       .unmarshal_record = __ctsvc_ipc_unmarshal_addressbook,
-       .marshal_record = __ctsvc_ipc_marshal_addressbook
-};
-
 
-static int __ctsvc_ipc_unmarshal_addressbook(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+static int __ctsvc_ipc_unmarshal_addressbook(pims_ipc_data_h ipc_data,
+               const char *view_uri, contacts_record_h record)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(record==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_addressbook_s *addressbook_p = (ctsvc_addressbook_s*)record;
 
-       ctsvc_addressbook_s* addressbook_p = (ctsvc_addressbook_s*) record;
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == record, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &addressbook_p->id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &addressbook_p->name) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &addressbook_p->account_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &addressbook_p->mode) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &addressbook_p->id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &addressbook_p->name) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &addressbook_p->account_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &addressbook_p->mode) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_unmarshal fail");
+       ERR("__ctsvc_ipc_unmarshal_addressbook() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_ipc_marshal_addressbook(const contacts_record_h record, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_addressbook(const contacts_record_h record,
+               pims_ipc_data_h ipc_data)
 {
-       ctsvc_addressbook_s* addressbook_p = (ctsvc_addressbook_s*)record;
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(addressbook_p==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_addressbook_s *addressbook_p = (ctsvc_addressbook_s*)record;
+
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(addressbook_p == NULL, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_marshal_int((addressbook_p->id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((addressbook_p->name),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((addressbook_p->account_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((addressbook_p->mode),ipc_data) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_marshal_int((addressbook_p->id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((addressbook_p->name), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((addressbook_p->account_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((addressbook_p->mode), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_marshal fail");
+       ERR("_ctsvc_ipc_marshal() Fail");
 
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_addressbook_plugin_cb = {
+       .unmarshal_record = __ctsvc_ipc_unmarshal_addressbook,
+       .marshal_record = __ctsvc_ipc_marshal_addressbook
+};
+
index d877392..498cbd9 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "ctsvc_internal.h"
 #include "ctsvc_ipc_marshal.h"
 #include "contacts_record.h"
 
-static int __ctsvc_ipc_unmarshal_company(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
-static int __ctsvc_ipc_marshal_company(const contacts_record_h record, pims_ipc_data_h ipc_data);
-
-ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_company_plugin_cb = {
-       .unmarshal_record = __ctsvc_ipc_unmarshal_company,
-       .marshal_record = __ctsvc_ipc_marshal_company
-};
-
 
-static int __ctsvc_ipc_unmarshal_company(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+static int __ctsvc_ipc_unmarshal_company(pims_ipc_data_h ipc_data,
+               const char *view_uri, contacts_record_h record)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(record==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_company_s *company_p = (ctsvc_company_s*)record;
 
-       ctsvc_company_s* company_p = (ctsvc_company_s*) record;
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == record, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &company_p->id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &company_p->contact_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_bool(ipc_data, &company_p->is_default) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &company_p->type) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &company_p->id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &company_p->contact_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_bool(ipc_data, &company_p->is_default) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &company_p->type) != CONTACTS_ERROR_NONE)
+                       break;
 
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &company_p->label) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &company_p->name) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &company_p->department) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &company_p->job_title) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &company_p->role) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &company_p->assistant_name) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &company_p->logo) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &company_p->location) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &company_p->description) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &company_p->phonetic_name) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &company_p->label) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &company_p->name) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &company_p->department) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &company_p->job_title) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &company_p->role) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &company_p->assistant_name) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &company_p->logo) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &company_p->location) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &company_p->description) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &company_p->phonetic_name) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_unmarshal fail");
+       ERR("__ctsvc_ipc_unmarshal_company() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_ipc_marshal_company(const contacts_record_h record, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_company(const contacts_record_h record,
+               pims_ipc_data_h ipc_data)
 {
-       ctsvc_company_s* company_p = (ctsvc_company_s*)record;
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(company_p==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_company_s *company_p = (ctsvc_company_s*)record;
+
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(company_p == NULL, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_marshal_int((company_p->id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((company_p->contact_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_bool((company_p->is_default),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((company_p->type),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((company_p->label),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((company_p->name),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((company_p->department),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((company_p->job_title),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((company_p->role),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((company_p->assistant_name),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((company_p->logo),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((company_p->location),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((company_p->description),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((company_p->phonetic_name),ipc_data) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_marshal_int((company_p->id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((company_p->contact_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_bool((company_p->is_default), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((company_p->type), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((company_p->label), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((company_p->name), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((company_p->department), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((company_p->job_title), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((company_p->role), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((company_p->assistant_name), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((company_p->logo), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((company_p->location), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((company_p->description), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((company_p->phonetic_name), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_marshal fail");
+       ERR("_ctsvc_ipc_marshal() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_company_plugin_cb = {
+       .unmarshal_record = __ctsvc_ipc_unmarshal_company,
+       .marshal_record = __ctsvc_ipc_marshal_company
+};
+
index af67bfc..09b2d47 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "ctsvc_internal.h"
 #include "ctsvc_ipc_marshal.h"
 
-static int __ctsvc_ipc_unmarshal_contact(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
-static int __ctsvc_ipc_marshal_contact(const contacts_record_h record, pims_ipc_data_h ipc_data);
-
-ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_contact_plugin_cb = {
-       .unmarshal_record = __ctsvc_ipc_unmarshal_contact,
-       .marshal_record = __ctsvc_ipc_marshal_contact
-};
 
-static int __ctsvc_ipc_unmarshal_contact(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+static int __ctsvc_ipc_unmarshal_contact(pims_ipc_data_h ipc_data,
+               const char *view_uri, contacts_record_h record)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(record==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_contact_s *pcontact = (ctsvc_contact_s*)record;
 
-       ctsvc_contact_s* pcontact = (ctsvc_contact_s*) record;
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == record, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_unmarshal_bool(ipc_data, &pcontact->is_favorite) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &pcontact->id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &pcontact->person_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &pcontact->changed_time) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &pcontact->link_mode) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &pcontact->addressbook_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_bool(ipc_data, &pcontact->has_phonenumber) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_bool(ipc_data, &pcontact->has_email) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->display_name) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->reverse_display_name) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &pcontact->display_source_type) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &pcontact->display_name_language) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &pcontact->reverse_display_name_language) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->sort_name) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->reverse_sort_name) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->sortkey) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->reverse_sortkey) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->uid) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->image_thumbnail_path) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->ringtone_path) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->vibration) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->message_alert) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &pcontact->changed_ver) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_bool(ipc_data, &pcontact->is_favorite) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &pcontact->id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &pcontact->person_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &pcontact->changed_time) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &pcontact->link_mode) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &pcontact->addressbook_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_bool(ipc_data, &pcontact->has_phonenumber) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_bool(ipc_data, &pcontact->has_email) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->display_name) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->reverse_display_name) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &pcontact->display_source_type) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &pcontact->display_name_language) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &pcontact->reverse_display_name_language) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->sort_name) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->reverse_sort_name) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->sortkey) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->reverse_sortkey) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->uid) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->image_thumbnail_path) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->ringtone_path) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->vibration) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->message_alert) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &pcontact->changed_ver) != CONTACTS_ERROR_NONE)
+                       break;
 
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->name) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->note) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->company) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->numbers) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->emails) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->grouprelations) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->events) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->messengers) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->postal_addrs) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->urls) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->nicknames) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->profiles) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->relationships) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->images) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->extensions) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->name) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->note) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->company) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->numbers) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->emails) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->grouprelations) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->events) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->messengers) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->postal_addrs) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->urls) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->nicknames) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->profiles) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->relationships) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->images) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pcontact->extensions) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_unmarshal fail");
+       ERR("__ctsvc_ipc_unmarshal_contact() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_ipc_marshal_contact(const contacts_record_h record, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_contact(const contacts_record_h record,
+               pims_ipc_data_h ipc_data)
 {
-       ctsvc_contact_s* pcontact = (ctsvc_contact_s*)record;
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(pcontact==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_contact_s *pcontact = (ctsvc_contact_s*)record;
+
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == pcontact, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_marshal_bool((pcontact->is_favorite),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((pcontact->id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((pcontact->person_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((pcontact->changed_time),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((pcontact->link_mode),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((pcontact->addressbook_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_bool((pcontact->has_phonenumber),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_bool((pcontact->has_email),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((pcontact->display_name),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((pcontact->reverse_display_name),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((pcontact->display_source_type),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((pcontact->display_name_language),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((pcontact->reverse_display_name_language),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((pcontact->sort_name),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((pcontact->reverse_sort_name),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((pcontact->sortkey),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((pcontact->reverse_sortkey),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((pcontact->uid),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((pcontact->image_thumbnail_path),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((pcontact->ringtone_path),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((pcontact->vibration),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((pcontact->message_alert),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((pcontact->changed_ver),ipc_data) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_marshal_bool((pcontact->is_favorite), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((pcontact->id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((pcontact->person_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((pcontact->changed_time), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((pcontact->link_mode), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((pcontact->addressbook_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_bool((pcontact->has_phonenumber), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_bool((pcontact->has_email), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((pcontact->display_name), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((pcontact->reverse_display_name), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((pcontact->display_source_type), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((pcontact->display_name_language), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((pcontact->reverse_display_name_language), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((pcontact->sort_name), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((pcontact->reverse_sort_name), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((pcontact->sortkey), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((pcontact->reverse_sortkey), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((pcontact->uid), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((pcontact->image_thumbnail_path), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((pcontact->ringtone_path), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((pcontact->vibration), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((pcontact->message_alert), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((pcontact->changed_ver), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->name, ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->note, ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->company, ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->numbers, ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->emails, ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->grouprelations, ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->events, ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->messengers, ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->postal_addrs, ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->urls, ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->nicknames, ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->profiles, ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->relationships, ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->images, ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->extensions, ipc_data) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->name, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->note, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->company, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->numbers, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->emails, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->grouprelations, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->events, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->messengers, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->postal_addrs, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->urls, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->nicknames, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->profiles, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->relationships, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->images, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->extensions, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_marshal fail");
+       ERR("_ctsvc_ipc_marshal() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_contact_plugin_cb = {
+       .unmarshal_record = __ctsvc_ipc_unmarshal_contact,
+       .marshal_record = __ctsvc_ipc_marshal_contact
+};
+
index f39efb9..7d03797 100644 (file)
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #ifndef __CTSVC_IPC_DEFINE_H__
 #define __CTSVC_IPC_DEFINE_H__
 
index 233658a..5749ce3 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "ctsvc_internal.h"
 #include "ctsvc_ipc_marshal.h"
 #include "contacts_record.h"
 
-static int __ctsvc_ipc_unmarshal_email(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
-static int __ctsvc_ipc_marshal_email(const contacts_record_h record, pims_ipc_data_h ipc_data);
-
-ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_email_plugin_cb = {
-       .unmarshal_record = __ctsvc_ipc_unmarshal_email,
-       .marshal_record = __ctsvc_ipc_marshal_email
-};
-
 
-static int __ctsvc_ipc_unmarshal_email(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+static int __ctsvc_ipc_unmarshal_email(pims_ipc_data_h ipc_data,
+               const char *view_uri, contacts_record_h record)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(record==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_email_s *email_p = (ctsvc_email_s*)record;
 
-       ctsvc_email_s* email_p = (ctsvc_email_s*) record;
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == record, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_unmarshal_bool(ipc_data, &email_p->is_default) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &email_p->id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &email_p->contact_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &email_p->type) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &email_p->label) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &email_p->email_addr) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_bool(ipc_data, &email_p->is_default) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &email_p->id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &email_p->contact_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &email_p->type) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &email_p->label) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &email_p->email_addr) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
 
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_unmarshal fail");
+       ERR("__ctsvc_ipc_unmarshal_email() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_ipc_marshal_email(const contacts_record_h record, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_email(const contacts_record_h record,
+               pims_ipc_data_h ipc_data)
 {
-       ctsvc_email_s* email_p = (ctsvc_email_s*)record;
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(email_p==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_email_s *email_p = (ctsvc_email_s*)record;
+
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == email_p, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_marshal_bool((email_p->is_default),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((email_p->id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((email_p->contact_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((email_p->type),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((email_p->label),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((email_p->email_addr),ipc_data) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_marshal_bool((email_p->is_default), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((email_p->id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((email_p->contact_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((email_p->type), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((email_p->label), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((email_p->email_addr), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
 
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_marshal fail");
+       ERR("_ctsvc_ipc_marshal() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_email_plugin_cb = {
+       .unmarshal_record = __ctsvc_ipc_unmarshal_email,
+       .marshal_record = __ctsvc_ipc_marshal_email
+};
+
index 499a49f..2b57184 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "ctsvc_internal.h"
 #include "ctsvc_ipc_marshal.h"
 #include "contacts_record.h"
 
-static int __ctsvc_ipc_unmarshal_event(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
-static int __ctsvc_ipc_marshal_event(const contacts_record_h record, pims_ipc_data_h ipc_data);
-
-ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_event_plugin_cb = {
-       .unmarshal_record = __ctsvc_ipc_unmarshal_event,
-       .marshal_record = __ctsvc_ipc_marshal_event
-};
-
 
-static int __ctsvc_ipc_unmarshal_event(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+static int __ctsvc_ipc_unmarshal_event(pims_ipc_data_h ipc_data,
+               const char *view_uri, contacts_record_h record)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(record==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_event_s *event_p = (ctsvc_event_s*)record;
 
-       ctsvc_event_s* event_p = (ctsvc_event_s*) record;
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == record, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &event_p->id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &event_p->contact_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &event_p->type) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &event_p->label) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &event_p->date) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &event_p->calendar_type) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_bool(ipc_data, &event_p->is_leap_month) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &event_p->id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &event_p->contact_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &event_p->type) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &event_p->label) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &event_p->date) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &event_p->calendar_type) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_bool(ipc_data, &event_p->is_leap_month) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_unmarshal fail");
+       ERR("__ctsvc_ipc_unmarshal_event() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_ipc_marshal_event(const contacts_record_h record, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_event(const contacts_record_h record,
+               pims_ipc_data_h ipc_data)
 {
-       ctsvc_event_s* event_p = (ctsvc_event_s*)record;
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(event_p==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_event_s *event_p = (ctsvc_event_s*)record;
+
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(event_p == NULL, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_marshal_int((event_p->id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((event_p->contact_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((event_p->type),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((event_p->label),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((event_p->date),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((event_p->calendar_type),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_bool((event_p->is_leap_month),ipc_data) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_marshal_int((event_p->id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((event_p->contact_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((event_p->type), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((event_p->label), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((event_p->date), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((event_p->calendar_type), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_bool((event_p->is_leap_month), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_marshal fail");
+       ERR("_ctsvc_ipc_marshal() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_event_plugin_cb = {
+       .unmarshal_record = __ctsvc_ipc_unmarshal_event,
+       .marshal_record = __ctsvc_ipc_marshal_event
+};
+
index 19cea2b..893c8eb 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "ctsvc_internal.h"
 #include "ctsvc_ipc_marshal.h"
 #include "contacts_record.h"
 
-static int __ctsvc_ipc_unmarshal_extension(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
-static int __ctsvc_ipc_marshal_extension(const contacts_record_h record, pims_ipc_data_h ipc_data);
-
-ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_extension_plugin_cb = {
-       .unmarshal_record = __ctsvc_ipc_unmarshal_extension,
-       .marshal_record = __ctsvc_ipc_marshal_extension
-};
-
 
-static int __ctsvc_ipc_unmarshal_extension(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+static int __ctsvc_ipc_unmarshal_extension(pims_ipc_data_h ipc_data,
+               const char *view_uri, contacts_record_h record)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(record==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_extension_s *extend_p = (ctsvc_extension_s*)record;
 
-       ctsvc_extension_s* extend_p = (ctsvc_extension_s*) record;
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == record, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &extend_p->id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &extend_p->contact_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &extend_p->data1) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &extend_p->data2) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &extend_p->data3) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &extend_p->data4) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &extend_p->data5) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &extend_p->data6) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &extend_p->data7) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &extend_p->data8) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &extend_p->data9) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &extend_p->data10) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &extend_p->data11) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &extend_p->data12) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &extend_p->id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &extend_p->contact_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &extend_p->data1) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &extend_p->data2) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &extend_p->data3) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &extend_p->data4) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &extend_p->data5) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &extend_p->data6) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &extend_p->data7) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &extend_p->data8) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &extend_p->data9) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &extend_p->data10) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &extend_p->data11) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &extend_p->data12) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
 
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_unmarshal fail");
+       ERR("__ctsvc_ipc_unmarshal_extension() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_ipc_marshal_extension(const contacts_record_h record, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_extension(const contacts_record_h record,
+               pims_ipc_data_h ipc_data)
 {
-       ctsvc_extension_s* extend_p = (ctsvc_extension_s*)record;
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(extend_p==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_extension_s *extend_p = (ctsvc_extension_s*)record;
+
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(extend_p == NULL, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_marshal_int((extend_p->id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((extend_p->contact_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((extend_p->data1),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((extend_p->data2),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((extend_p->data3),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((extend_p->data4),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((extend_p->data5),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((extend_p->data6),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((extend_p->data7),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((extend_p->data8),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((extend_p->data9),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((extend_p->data10),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((extend_p->data11),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((extend_p->data12),ipc_data) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_marshal_int((extend_p->id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((extend_p->contact_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((extend_p->data1), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((extend_p->data2), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((extend_p->data3), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((extend_p->data4), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((extend_p->data5), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((extend_p->data6), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((extend_p->data7), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((extend_p->data8), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((extend_p->data9), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((extend_p->data10), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((extend_p->data11), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((extend_p->data12), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
 
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_marshal fail");
+       ERR("_ctsvc_ipc_marshal() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_extension_plugin_cb = {
+       .unmarshal_record = __ctsvc_ipc_unmarshal_extension,
+       .marshal_record = __ctsvc_ipc_marshal_extension
+};
index 40c2b9b..e433cee 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "ctsvc_internal.h"
 #include "ctsvc_ipc_marshal.h"
 #include "contacts_record.h"
 
-static int __ctsvc_ipc_unmarshal_group(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
-static int __ctsvc_ipc_marshal_group(const contacts_record_h record, pims_ipc_data_h ipc_data);
-
-ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_group_plugin_cb = {
-       .unmarshal_record = __ctsvc_ipc_unmarshal_group,
-       .marshal_record = __ctsvc_ipc_marshal_group
-};
-
 
-static int __ctsvc_ipc_unmarshal_group(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+static int __ctsvc_ipc_unmarshal_group(pims_ipc_data_h ipc_data,
+               const char *view_uri, contacts_record_h record)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(record==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_group_s *group_p = (ctsvc_group_s*)record;
 
-       ctsvc_group_s* group_p = (ctsvc_group_s*) record;
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == record, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &group_p->id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &group_p->addressbook_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_bool(ipc_data, &group_p->is_read_only) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &group_p->name) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &group_p->extra_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &group_p->ringtone_path) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &group_p->vibration) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &group_p->message_alert) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &group_p->image_thumbnail_path) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &group_p->id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &group_p->addressbook_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_bool(ipc_data, &group_p->is_read_only) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &group_p->name) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &group_p->extra_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &group_p->ringtone_path) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &group_p->vibration) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &group_p->message_alert) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &group_p->image_thumbnail_path) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
 
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_unmarshal fail");
+       ERR("__ctsvc_ipc_unmarshal_group() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_ipc_marshal_group(const contacts_record_h record, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_group(const contacts_record_h record,
+               pims_ipc_data_h ipc_data)
 {
-       ctsvc_group_s* group_p = (ctsvc_group_s*)record;
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(group_p==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_group_s *group_p = (ctsvc_group_s*)record;
+
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(group_p == NULL, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_marshal_int((group_p->id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((group_p->addressbook_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_bool((group_p->is_read_only),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((group_p->name),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((group_p->extra_data),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((group_p->ringtone_path),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((group_p->vibration),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((group_p->message_alert),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((group_p->image_thumbnail_path),ipc_data) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_marshal_int((group_p->id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((group_p->addressbook_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_bool((group_p->is_read_only), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((group_p->name), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((group_p->extra_data), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((group_p->ringtone_path), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((group_p->vibration), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((group_p->message_alert), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((group_p->image_thumbnail_path), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_marshal fail");
+       ERR("_ctsvc_ipc_marshal() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_group_plugin_cb = {
+       .unmarshal_record = __ctsvc_ipc_unmarshal_group,
+       .marshal_record = __ctsvc_ipc_marshal_group
+};
+
index ce9fa8e..45d575e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "ctsvc_internal.h"
 #include "ctsvc_ipc_marshal.h"
 #include "contacts_record.h"
 
-static int __ctsvc_ipc_unmarshal_group_relation(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
-static int __ctsvc_ipc_marshal_group_relation(const contacts_record_h record, pims_ipc_data_h ipc_data);
-
-ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_group_relation_plugin_cb = {
-       .unmarshal_record = __ctsvc_ipc_unmarshal_group_relation,
-       .marshal_record = __ctsvc_ipc_marshal_group_relation
-};
-
 
-static int __ctsvc_ipc_unmarshal_group_relation(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+static int __ctsvc_ipc_unmarshal_group_relation(pims_ipc_data_h ipc_data,
+               const char *view_uri, contacts_record_h record)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(record==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_group_relation_s *group_relation_p = (ctsvc_group_relation_s*)record;
 
-       ctsvc_group_relation_s* group_relation_p = (ctsvc_group_relation_s*) record;
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == record, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &group_relation_p->id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &group_relation_p->contact_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &group_relation_p->group_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &group_relation_p->group_name) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &group_relation_p->id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &group_relation_p->contact_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &group_relation_p->group_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &group_relation_p->group_name) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
 
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_unmarshal fail");
+       ERR("__ctsvc_ipc_unmarshal_group_relation() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_ipc_marshal_group_relation(const contacts_record_h record, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_group_relation(const contacts_record_h record,
+               pims_ipc_data_h ipc_data)
 {
-       ctsvc_group_relation_s* group_relation_p = (ctsvc_group_relation_s*)record;
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(group_relation_p==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_group_relation_s *group_relation_p = (ctsvc_group_relation_s*)record;
+
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(group_relation_p == NULL, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_marshal_int((group_relation_p->id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((group_relation_p->contact_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((group_relation_p->group_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((group_relation_p->group_name),ipc_data) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_marshal_int((group_relation_p->id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((group_relation_p->contact_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((group_relation_p->group_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((group_relation_p->group_name), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
 
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_marshal fail");
+       ERR("_ctsvc_ipc_marshal() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_group_relation_plugin_cb = {
+       .unmarshal_record = __ctsvc_ipc_unmarshal_group_relation,
+       .marshal_record = __ctsvc_ipc_marshal_group_relation
+};
+
index d7ceeca..73e2bdc 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "ctsvc_internal.h"
 #include "ctsvc_ipc_marshal.h"
 #include "contacts_record.h"
 
-static int __ctsvc_ipc_unmarshal_image(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
-static int __ctsvc_ipc_marshal_image(const contacts_record_h record, pims_ipc_data_h ipc_data);
-
-ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_image_plugin_cb = {
-       .unmarshal_record = __ctsvc_ipc_unmarshal_image,
-       .marshal_record = __ctsvc_ipc_marshal_image
-};
-
 
-static int __ctsvc_ipc_unmarshal_image(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+static int __ctsvc_ipc_unmarshal_image(pims_ipc_data_h ipc_data,
+               const char *view_uri, contacts_record_h record)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(record==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_image_s *image_p = (ctsvc_image_s*)record;
 
-       ctsvc_image_s* image_p = (ctsvc_image_s*) record;
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == record, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &image_p->id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &image_p->contact_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &image_p->type) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &image_p->label) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &image_p->path) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_bool(ipc_data, &image_p->is_default) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &image_p->id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &image_p->contact_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &image_p->type) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &image_p->label) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &image_p->path) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_bool(ipc_data, &image_p->is_default) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_unmarshal fail");
+       ERR("__ctsvc_ipc_unmarshal_image() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_ipc_marshal_image(const contacts_record_h record, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_image(const contacts_record_h record,
+               pims_ipc_data_h ipc_data)
 {
-       ctsvc_image_s* image_p = (ctsvc_image_s*)record;
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(image_p==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_image_s *image_p = (ctsvc_image_s*)record;
+
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == image_p, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_marshal_int((image_p->id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((image_p->contact_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((image_p->type),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((image_p->label),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((image_p->path),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_bool((image_p->is_default),ipc_data) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_marshal_int((image_p->id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((image_p->contact_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((image_p->type), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((image_p->label), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((image_p->path), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_bool((image_p->is_default), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_marshal fail");
+       ERR("_ctsvc_ipc_marshal() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_image_plugin_cb = {
+       .unmarshal_record = __ctsvc_ipc_unmarshal_image,
+       .marshal_record = __ctsvc_ipc_marshal_image
+};
+
index eb6b87d..a6254fa 100644 (file)
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include <stdlib.h>
 #include <string.h>
 #include "ctsvc_ipc_marshal.h"
@@ -63,10 +62,10 @@ extern ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_image_plugin_cb;
 static ctsvc_ipc_marshal_record_plugin_cb_s* __ctsvc_ipc_marshal_get_plugin_cb(ctsvc_record_type_e type);
 
 
-static int __ctsvc_ipc_unmarshal_composite_filter(const pims_ipc_data_h ipc_data, ctsvc_composite_filter_sfilter);
-static int __ctsvc_ipc_marshal_composite_filter(const ctsvc_composite_filter_sfilter, pims_ipc_data_h ipc_data);
-static int __ctsvc_ipc_unmarshal_attribute_filter(const pims_ipc_data_h ipc_data, const ctsvc_filter_type_e filter_type, ctsvc_attribute_filter_sfilter);
-static int __ctsvc_ipc_marshal_attribute_filter(const ctsvc_attribute_filter_sfilter, pims_ipc_data_h ipc_data);
+static int __ctsvc_ipc_unmarshal_composite_filter(const pims_ipc_data_h ipc_data, ctsvc_composite_filter_s *filter);
+static int __ctsvc_ipc_marshal_composite_filter(const ctsvc_composite_filter_s *filter, pims_ipc_data_h ipc_data);
+static int __ctsvc_ipc_unmarshal_attribute_filter(const pims_ipc_data_h ipc_data, const ctsvc_filter_type_e filter_type, ctsvc_attribute_filter_s *filter);
+static int __ctsvc_ipc_marshal_attribute_filter(const ctsvc_attribute_filter_s *filter, pims_ipc_data_h ipc_data);
 
 
 static ctsvc_ipc_marshal_record_plugin_cb_s* __ctsvc_ipc_marshal_get_plugin_cb(ctsvc_record_type_e type)
@@ -136,16 +135,16 @@ static ctsvc_ipc_marshal_record_plugin_cb_s* __ctsvc_ipc_marshal_get_plugin_cb(c
        }
 }
 
-static void __ctsvc_ipc_unmarshal_composite_filter_free(ctsvc_composite_filter_sfilter)
+static void __ctsvc_ipc_unmarshal_composite_filter_free(ctsvc_composite_filter_s *filter)
 {
        if (filter->filters) {
                GSList *cursor = NULL;
-               for (cursor=filter->filters;cursor;cursor=cursor->next) {
-                       ctsvc_filter_s *src = (ctsvc_filter_s*)cursor->data;
-                       if (src->filter_type == CTSVC_FILTER_COMPOSITE)
-                               __ctsvc_ipc_unmarshal_composite_filter_free((ctsvc_composite_filter_s *)src);
-                       else {
-                               ctsvc_attribute_filter_s *attr = (ctsvc_attribute_filter_s *)src;
+               for (cursor = filter->filters; cursor; cursor = cursor->next) {
+                       ctsvc_filter_s *src = cursor->data;
+                       if (src->filter_type == CTSVC_FILTER_COMPOSITE) {
+                               __ctsvc_ipc_unmarshal_composite_filter_free((ctsvc_composite_filter_s*)src);
+                       else {
+                               ctsvc_attribute_filter_s *attr = (ctsvc_attribute_filter_s*)src;
                                if (attr->filter_type == CTSVC_FILTER_STR)
                                        free(attr->value.s);
                        }
@@ -154,83 +153,81 @@ static void __ctsvc_ipc_unmarshal_composite_filter_free(ctsvc_composite_filter_s
                g_slist_free(filter->filters);
        }
 
-       if (filter->filter_ops) {
+       if (filter->filter_ops)
                g_slist_free(filter->filter_ops);
-       }
 
        free(filter->view_uri);
 }
 
-static int __ctsvc_ipc_unmarshal_composite_filter(const pims_ipc_data_h ipc_data, ctsvc_composite_filter_sfilter)
+static int __ctsvc_ipc_unmarshal_composite_filter(const pims_ipc_data_h ipc_data, ctsvc_composite_filter_s *filter)
 {
        unsigned int size = 0;
-       charstr = NULL;
-       int count =0, i=0;
+       char *str = NULL;
+       int count = 0, i = 0;
        ctsvc_filter_type_e filter_type = CTSVC_FILTER_COMPOSITE;
        contacts_filter_operator_e op = CONTACTS_FILTER_OPERATOR_AND;
 
        filter->filter_type = CTSVC_FILTER_COMPOSITE;
 
        /* view_uri */
-       str = (char*)pims_ipc_data_get(ipc_data,&size);
+       str = (char*)pims_ipc_data_get(ipc_data, &size);
        filter->view_uri = (char*)SAFE_STRDUP(str);
 
        /* filters */
-       if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data,&count)) {
-               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+       if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data, &count)) {
+               ERR("ctsvc_ipc_unmarshal_int() Fail");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
-       for (i=0;i<count;i++) {
+       for (i = 0; i < count; i++) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data, (int*)&filter_type)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        __ctsvc_ipc_unmarshal_composite_filter_free(filter);
                        return CONTACTS_ERROR_IPC;
                }
                if (filter_type == CTSVC_FILTER_COMPOSITE) {
                        ctsvc_composite_filter_s *com_filter = NULL;
-                       com_filter = (ctsvc_composite_filter_s*)calloc(1,sizeof(ctsvc_composite_filter_s));
+                       com_filter = calloc(1, sizeof(ctsvc_composite_filter_s));
                        if (com_filter == NULL) {
-                               CTS_ERR("calloc() Fail");
+                               ERR("calloc() Fail");
                                __ctsvc_ipc_unmarshal_composite_filter_free(filter);
                                return CONTACTS_ERROR_OUT_OF_MEMORY;
                        }
                        if (CONTACTS_ERROR_NONE != __ctsvc_ipc_unmarshal_composite_filter(ipc_data, com_filter)) {
-                               CTS_ERR("__ctsvc_ipc_unmarshal_composite_filter() Fail");
-                               CONTACTS_FREE(com_filter);
+                               ERR("__ctsvc_ipc_unmarshal_composite_filter() Fail");
+                               free(com_filter);
                                __ctsvc_ipc_unmarshal_composite_filter_free(filter);
                                return CONTACTS_ERROR_IPC;
                        }
                        filter->filters = g_slist_append(filter->filters, com_filter);
-               }
-               else {
+               } else {
                        ctsvc_attribute_filter_s *attr_filter = NULL;
-                       attr_filter = (ctsvc_attribute_filter_s*)calloc(1,sizeof(ctsvc_attribute_filter_s));
+                       attr_filter = calloc(1, sizeof(ctsvc_attribute_filter_s));
                        if (attr_filter == NULL) {
-                               CTS_ERR("calloc() Fail");
+                               ERR("calloc() Fail");
                                __ctsvc_ipc_unmarshal_composite_filter_free(filter);
                                return CONTACTS_ERROR_OUT_OF_MEMORY;
                        }
                        if (CONTACTS_ERROR_NONE != __ctsvc_ipc_unmarshal_attribute_filter(ipc_data, filter_type, attr_filter)) {
-                               CTS_ERR("__ctsvc_ipc_unmarshal_attribute_filter() Fail");
-                               CONTACTS_FREE(attr_filter);
+                               free(attr_filter);
+                               ERR("__ctsvc_ipc_unmarshal_attribute_filter() Fail");
                                __ctsvc_ipc_unmarshal_composite_filter_free(filter);
                                return CONTACTS_ERROR_IPC;
                        }
-                       filter->filters = g_slist_append(filter->filters,attr_filter);
+                       filter->filters = g_slist_append(filter->filters, attr_filter);
                }
        }
 
        /* filters */
        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data, &count)) {
-               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+               ERR("ctsvc_ipc_unmarshal_int() Fail");
                __ctsvc_ipc_unmarshal_composite_filter_free(filter);
                return CONTACTS_ERROR_IPC;
        }
 
-       for (i=0;i<count;i++) {
+       for (i = 0; i < count; i++) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data, (int *)&op)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        __ctsvc_ipc_unmarshal_composite_filter_free(filter);
                        return CONTACTS_ERROR_IPC;
                }
@@ -238,55 +235,53 @@ static int __ctsvc_ipc_unmarshal_composite_filter(const pims_ipc_data_h ipc_data
        }
 
        /* properties  property_count */
-       filter->properties = (property_info_s *)ctsvc_view_get_all_property_infos(filter->view_uri, &filter->property_count);
+       filter->properties = (property_info_s*)ctsvc_view_get_all_property_infos(filter->view_uri, &filter->property_count);
 
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_ipc_marshal_composite_filter(const ctsvc_composite_filter_sfilter, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_composite_filter(const ctsvc_composite_filter_s *filter, pims_ipc_data_h ipc_data)
 {
-       if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int((filter->filter_type),ipc_data)) {
-               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+       if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int((filter->filter_type), ipc_data)) {
+               ERR("ctsvc_ipc_marshal_int() Fail");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
        /* view_uri */
        int length = strlen(filter->view_uri);
-       if (pims_ipc_data_put(ipc_data,(void*)filter->view_uri,length+1) < 0) {
-               CTS_ERR("pims_ipc_data_put() Fail");
+       if (pims_ipc_data_put(ipc_data, (void*)filter->view_uri, length+1) < 0) {
+               ERR("pims_ipc_data_put() Fail");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        /* filter->filters */
        if (filter->filters) {
                int count = g_slist_length(filter->filters);
                GSList *cursor = filter->filters;
-               ctsvc_filter_schild_filter;
+               ctsvc_filter_s *child_filter;
 
-               if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(count,ipc_data)) {
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+               if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(count, ipc_data)) {
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
                while (cursor) {
-                       child_filter = (ctsvc_filter_s*)cursor->data;
+                       child_filter = cursor->data;
 
                        if (child_filter->filter_type == CTSVC_FILTER_COMPOSITE) {
                                if (CONTACTS_ERROR_NONE != __ctsvc_ipc_marshal_composite_filter((ctsvc_composite_filter_s*)child_filter, ipc_data)) {
-                                       CTS_ERR("__ctsvc_ipc_marshal_composite_filter() Fail");
+                                       ERR("__ctsvc_ipc_marshal_composite_filter() Fail");
                                        return CONTACTS_ERROR_INVALID_PARAMETER;
                                }
-                       }
-                       else {
+                       } else {
                                if (CONTACTS_ERROR_NONE != __ctsvc_ipc_marshal_attribute_filter((ctsvc_attribute_filter_s*)child_filter, ipc_data)) {
-                                       CTS_ERR("__ctsvc_ipc_marshal_attribute_filter() Fail");
+                                       ERR("__ctsvc_ipc_marshal_attribute_filter() Fail");
                                        return CONTACTS_ERROR_INVALID_PARAMETER;
                                }
                        }
                        cursor = g_slist_next(cursor);
                }
-       }
-       else {
-               if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(0,ipc_data)) {
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+       } else {
+               if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(0, ipc_data)) {
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
        }
@@ -295,24 +290,23 @@ static int __ctsvc_ipc_marshal_composite_filter(const ctsvc_composite_filter_s*
                int count = g_slist_length(filter->filter_ops);
                GSList *cursor = filter->filter_ops;
 
-               if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(count,ipc_data)) {
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+               if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(count, ipc_data)) {
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
                while (cursor) {
                        contacts_filter_operator_e op = (contacts_filter_operator_e)cursor->data;
 
-                       if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(op,ipc_data)) {
-                               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(op, ipc_data)) {
+                               ERR("ctsvc_ipc_marshal_int() Fail");
                                return CONTACTS_ERROR_INVALID_PARAMETER;
                        }
 
                        cursor = g_slist_next(cursor);
                }
-       }
-       else {
-               if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(0,ipc_data)) {
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+       } else {
+               if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(0, ipc_data)) {
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
        }
@@ -320,33 +314,33 @@ static int __ctsvc_ipc_marshal_composite_filter(const ctsvc_composite_filter_s*
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_ipc_unmarshal_attribute_filter(const pims_ipc_data_h ipc_data, const ctsvc_filter_type_e filter_type, ctsvc_attribute_filter_sfilter)
+static int __ctsvc_ipc_unmarshal_attribute_filter(const pims_ipc_data_h ipc_data, const ctsvc_filter_type_e filter_type, ctsvc_attribute_filter_s *filter)
 {
        filter->filter_type = filter_type;
-       if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data,&filter->property_id)) {
-               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+       if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data, &filter->property_id)) {
+               ERR("ctsvc_ipc_unmarshal_int() Fail");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
-       if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data,&filter->match)) {
-               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+       if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data, &filter->match)) {
+               ERR("ctsvc_ipc_unmarshal_int() Fail");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
-       switch(filter->filter_type) {
+       switch (filter->filter_type) {
        case CTSVC_FILTER_STR:
-               if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_string(ipc_data,&filter->value.s)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_string() Fail");
+               if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_string(ipc_data, &filter->value.s)) {
+                       ERR("ctsvc_ipc_unmarshal_string() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
                break;
        case CTSVC_FILTER_INT:
-               if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data,&filter->value.i)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+               if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data, &filter->value.i)) {
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
                break;
        case CTSVC_FILTER_BOOL:
-               if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_bool(ipc_data,&filter->value.b)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_bool() Fail");
+               if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_bool(ipc_data, &filter->value.b)) {
+                       ERR("ctsvc_ipc_unmarshal_bool() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
                break;
@@ -358,36 +352,36 @@ static int __ctsvc_ipc_unmarshal_attribute_filter(const pims_ipc_data_h ipc_data
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_ipc_marshal_attribute_filter(const ctsvc_attribute_filter_sfilter, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_attribute_filter(const ctsvc_attribute_filter_s *filter, pims_ipc_data_h ipc_data)
 {
-       if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int((filter->filter_type),ipc_data)) {
-               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+       if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int((filter->filter_type), ipc_data)) {
+               ERR("ctsvc_ipc_marshal_int() Fail");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
-       if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int((filter->property_id),ipc_data)) {
-               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+       if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int((filter->property_id), ipc_data)) {
+               ERR("ctsvc_ipc_marshal_int() Fail");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
-       if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int((filter->match),ipc_data)) {
-               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+       if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int((filter->match), ipc_data)) {
+               ERR("ctsvc_ipc_marshal_int() Fail");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
-       switch(filter->filter_type) {
+       switch (filter->filter_type) {
        case CTSVC_FILTER_STR:
-               if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_string((filter->value.s),ipc_data)) {
-                       CTS_ERR("ctsvc_ipc_marshal_string() Fail");
+               if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_string((filter->value.s), ipc_data)) {
+                       ERR("ctsvc_ipc_marshal_string() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
                break;
        case CTSVC_FILTER_INT:
-               if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int((filter->value.i),ipc_data)) {
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+               if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int((filter->value.i), ipc_data)) {
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
                break;
        case CTSVC_FILTER_BOOL:
-               if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_bool((filter->value.b),ipc_data)) {
-                       CTS_ERR("ctsvc_ipc_marshal_bool() Fail");
+               if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_bool((filter->value.b), ipc_data)) {
+                       ERR("ctsvc_ipc_marshal_bool() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
                break;
@@ -403,7 +397,7 @@ static int __ctsvc_ipc_marshal_attribute_filter(const ctsvc_attribute_filter_s*
 int ctsvc_ipc_marshal_handle(const contacts_h contact, pims_ipc_data_h ipc_data)
 {
        int ret;
-       ctsvc_base_s *base = (ctsvc_base_s *)contact;
+       ctsvc_base_s *base = (ctsvc_base_s*)contact;
 
        ret = ctsvc_ipc_marshal_int(base->version, ipc_data);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_ipc_marshal_int() Fail(%d)", ret);
@@ -422,7 +416,7 @@ int ctsvc_ipc_unmarshal_handle(const pims_ipc_data_h ipc_data, contacts_h *pcont
        ret = ctsvc_handle_create(pcontact);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_handle_create() Fail(%d)", ret);
 
-       base = (ctsvc_base_s *)*pcontact;
+       base = (ctsvc_base_s*)*pcontact;
 
        ret = ctsvc_ipc_unmarshal_int(ipc_data, &(base->version));
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_ipc_unmarshal_int() Fail(%d)", ret);
@@ -433,42 +427,43 @@ int ctsvc_ipc_unmarshal_handle(const pims_ipc_data_h ipc_data, contacts_h *pcont
        return CONTACTS_ERROR_NONE;
 }
 
-int ctsvc_ipc_unmarshal_record(const pims_ipc_data_h ipc_data, contacts_record_hprecord)
+int ctsvc_ipc_unmarshal_record(const pims_ipc_data_h ipc_data, contacts_record_h *precord)
 {
        int ret = CONTACTS_ERROR_NONE;
        ctsvc_record_s common = {0,};
        ctsvc_record_s *precord_common = NULL;
        ctsvc_ipc_marshal_record_plugin_cb_s *plugin_cb;
 
-       RETVM_IF(NULL == precord || NULL == ipc_data, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter");
+       RETV_IF(NULL == precord, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_INVALID_PARAMETER);
 
        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_record_common(ipc_data, &common)) {
-               CTS_ERR("ctsvc_ipc_unmarshal_record_common() Fail");
+               ERR("ctsvc_ipc_unmarshal_record_common() Fail");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
        plugin_cb = __ctsvc_ipc_marshal_get_plugin_cb(common.r_type);
        if (NULL == plugin_cb || NULL == plugin_cb->unmarshal_record) {
-               CTS_ERR("Invalid parameter");
+               ERR("Invalid parameter");
                free(common.properties_flags);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
        ret = contacts_record_create(common.view_uri, precord);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("contacts_record_create() Fail");
+               ERR("contacts_record_create() Fail");
                free(common.properties_flags);
                return ret;
        }
 
-       precord_common = (ctsvc_record_s *)(*precord);
+       precord_common = (ctsvc_record_s*)(*precord);
        precord_common->property_max_count = common.property_max_count;
        precord_common->properties_flags = common.properties_flags;
        precord_common->property_flag = common.property_flag;
 
        ret = plugin_cb->unmarshal_record(ipc_data, common.view_uri, *precord);
        if (CONTACTS_ERROR_NONE != ret) {
-               contacts_record_destroy(*precord,true);
+               contacts_record_destroy(*precord, true);
                *precord = NULL;
                return CONTACTS_ERROR_IPC;
        }
@@ -478,25 +473,26 @@ int ctsvc_ipc_unmarshal_record(const pims_ipc_data_h ipc_data, contacts_record_h
 
 int ctsvc_ipc_marshal_record(const contacts_record_h record, pims_ipc_data_h ipc_data)
 {
-       RETVM_IF(NULL == record || NULL == ipc_data, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter");
-
        ctsvc_record_s *common = (ctsvc_record_s*)(record);
 
+       RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_INVALID_PARAMETER);
+
        if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_record_common(common, ipc_data)) {
-               CTS_ERR("ctsvc_ipc_marshal_record_common() Fail");
+               ERR("ctsvc_ipc_marshal_record_common() Fail");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
        ctsvc_ipc_marshal_record_plugin_cb_s *plugin_cb = __ctsvc_ipc_marshal_get_plugin_cb(common->r_type);
-
-       RETVM_IF(NULL == plugin_cb || NULL == plugin_cb->marshal_record, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter");
+       RETV_IF(NULL == plugin_cb, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == plugin_cb->marshal_record, CONTACTS_ERROR_INVALID_PARAMETER);
 
        int ret = plugin_cb->marshal_record(record, ipc_data);
 
        return ret;
 }
 
-int ctsvc_ipc_unmarshal_string(const pims_ipc_data_h ipc_data, char** ppbufchar)
+int ctsvc_ipc_unmarshal_string(const pims_ipc_data_h ipc_data, char **ppbufchar)
 {
        int ret = CONTACTS_ERROR_NONE;
 
@@ -506,43 +502,42 @@ int ctsvc_ipc_unmarshal_string(const pims_ipc_data_h ipc_data, char** ppbufchar)
 
        int length = 0;
 
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_INVALID_PARAMETER);
-       RETV_IF(ppbufchar==NULL,CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == ppbufchar, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       tmp = pims_ipc_data_get(ipc_data,&size);
+       tmp = pims_ipc_data_get(ipc_data, &size);
        if (tmp == NULL) {
-               CTS_ERR("pims_ipc_data_get() Fail");
+               ERR("pims_ipc_data_get() Fail");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        length = *(int*)tmp;
 
        if (length == -1) {
+               DBG("string is null");
                ret = CONTACTS_ERROR_NONE;
-               CTS_VERBOSE("string is null");
                *ppbufchar = NULL;
                return ret;
        }
 
-       str = (char*)pims_ipc_data_get(ipc_data,&size);
-       if (str) {
+       str = (char*)pims_ipc_data_get(ipc_data, &size);
+       if (str)
                *ppbufchar = SAFE_STRDUP(str);
-       }
 
        return ret;
 }
 
 int ctsvc_ipc_unmarshal_int(const pims_ipc_data_h data, int *pout)
 {
-       RETV_IF(data==NULL,CONTACTS_ERROR_INVALID_PARAMETER);
-       RETV_IF(pout==NULL,CONTACTS_ERROR_INVALID_PARAMETER);
-
        unsigned int size = 0;
-       void *tmp = pims_ipc_data_get(data,&size);
+
+       RETV_IF(NULL == data, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == pout, CONTACTS_ERROR_INVALID_PARAMETER);
+
+       void *tmp = pims_ipc_data_get(data, &size);
        if (tmp == NULL) {
-               CTS_ERR("pims_ipc_data_get() Fail");
+               ERR("pims_ipc_data_get() Fail");
                return CONTACTS_ERROR_NO_DATA;
-       }
-       else {
+       } else {
                *pout = *(int*)tmp;
        }
        return CONTACTS_ERROR_NONE;
@@ -550,16 +545,16 @@ int ctsvc_ipc_unmarshal_int(const pims_ipc_data_h data, int *pout)
 
 int ctsvc_ipc_unmarshal_unsigned_int(const pims_ipc_data_h data, unsigned int *pout)
 {
-       RETV_IF(data==NULL,CONTACTS_ERROR_INVALID_PARAMETER);
-       RETV_IF(pout==NULL,CONTACTS_ERROR_INVALID_PARAMETER);
-
        unsigned int size = 0;
-       void *tmp = pims_ipc_data_get(data,&size);
+
+       RETV_IF(NULL == data, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == pout, CONTACTS_ERROR_INVALID_PARAMETER);
+
+       void *tmp = pims_ipc_data_get(data, &size);
        if (tmp == NULL) {
-               CTS_ERR("pims_ipc_data_get() Fail");
+               ERR("pims_ipc_data_get() Fail");
                return CONTACTS_ERROR_NO_DATA;
-       }
-       else {
+       } else {
                *pout = *(unsigned int*)tmp;
        }
        return CONTACTS_ERROR_NONE;
@@ -567,47 +562,47 @@ int ctsvc_ipc_unmarshal_unsigned_int(const pims_ipc_data_h data, unsigned int *p
 
 int ctsvc_ipc_unmarshal_bool(const pims_ipc_data_h data, bool *pout)
 {
-       RETV_IF(data==NULL,CONTACTS_ERROR_INVALID_PARAMETER);
-       RETV_IF(pout==NULL,CONTACTS_ERROR_INVALID_PARAMETER);
-
        unsigned int size = 0;
-       void *tmp = pims_ipc_data_get(data,&size);
+
+       RETV_IF(NULL == data, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == pout, CONTACTS_ERROR_INVALID_PARAMETER);
+
+       void *tmp = pims_ipc_data_get(data, &size);
        if (tmp == NULL) {
-               CTS_ERR("pims_ipc_data_get() Fail");
+               ERR("pims_ipc_data_get() Fail");
                return CONTACTS_ERROR_NO_DATA;
-       }
-       else {
+       } else {
                *pout = *(bool*)tmp;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-int ctsvc_ipc_unmarshal_record_common(const pims_ipc_data_h ipc_data, ctsvc_record_scommon)
+int ctsvc_ipc_unmarshal_record_common(const pims_ipc_data_h ipc_data, ctsvc_record_s *common)
 {
        void *tmp = NULL;
        unsigned int size = 0;
-       const char* str = NULL;
+       const char *str = NULL;
+
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
 
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       tmp = pims_ipc_data_get(ipc_data,&size);
+       tmp = pims_ipc_data_get(ipc_data, &size);
        if (tmp == NULL) {
-               CTS_ERR("pims_ipc_data_get() Fail");
+               ERR("pims_ipc_data_get() Fail");
                return CONTACTS_ERROR_NO_DATA;
-       }
-       else {
+       } else {
                common->r_type = *(ctsvc_record_type_e*)tmp;
        }
 
-       str = (char*)pims_ipc_data_get(ipc_data,&size);
+       str = (char*)pims_ipc_data_get(ipc_data, &size);
        if (NULL == str) {
-               CTS_ERR("pims_ipc_data_get() Fail");
+               ERR("pims_ipc_data_get() Fail");
                return CONTACTS_ERROR_NO_DATA;
        }
        common->view_uri = ctsvc_view_get_uri(str);
 
-       tmp = pims_ipc_data_get(ipc_data,&size);
+       tmp = pims_ipc_data_get(ipc_data, &size);
        if (NULL == tmp) {
-               CTS_ERR("pims_ipc_data_get() Fail");
+               ERR("pims_ipc_data_get() Fail");
                return CONTACTS_ERROR_NO_DATA;
        }
        common->property_max_count = *(unsigned int*)tmp;
@@ -616,20 +611,20 @@ int ctsvc_ipc_unmarshal_record_common(const pims_ipc_data_h ipc_data, ctsvc_reco
                unsigned char *tmp_properties_flags;
                tmp_properties_flags = (unsigned char*)pims_ipc_data_get(ipc_data, &size);
                if (NULL == tmp_properties_flags) {
-                       CTS_ERR("pims_ipc_data_get() Fail");
+                       ERR("pims_ipc_data_get() Fail");
                        return CONTACTS_ERROR_NO_DATA;
                }
 
                common->properties_flags  = calloc(common->property_max_count, sizeof(char));
                if (common->properties_flags == NULL) {
-                       CTS_ERR("calloc() Fail");
+                       ERR("calloc() Fail");
                        return CONTACTS_ERROR_OUT_OF_MEMORY;
                }
                memcpy(common->properties_flags, tmp_properties_flags, sizeof(char)*common->property_max_count);
        }
-       tmp = pims_ipc_data_get(ipc_data,&size);
+       tmp = pims_ipc_data_get(ipc_data, &size);
        if (NULL == tmp) {
-               CTS_ERR("pims_ipc_data_get() Fail");
+               ERR("pims_ipc_data_get() Fail");
                return CONTACTS_ERROR_NO_DATA;
        }
        common->property_flag = *(unsigned char*)tmp;
@@ -637,93 +632,88 @@ int ctsvc_ipc_unmarshal_record_common(const pims_ipc_data_h ipc_data, ctsvc_reco
        return CONTACTS_ERROR_NONE;
 }
 
-int ctsvc_ipc_marshal_string(const charbufchar, pims_ipc_data_h ipc_data)
+int ctsvc_ipc_marshal_string(const char *bufchar, pims_ipc_data_h ipc_data)
 {
        int ret = CONTACTS_ERROR_NONE;
 
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_INVALID_PARAMETER);
 
        if (bufchar) {
                int length = strlen(bufchar);
-               if (pims_ipc_data_put(ipc_data,(void*)&length,sizeof(int)) != 0) {
+               if (pims_ipc_data_put(ipc_data, (void*)&length, sizeof(int)) != 0)
                        ret = CONTACTS_ERROR_OUT_OF_MEMORY;
-               }
 
-               if (pims_ipc_data_put(ipc_data,(void*)bufchar,length+1) != 0) {
+               if (pims_ipc_data_put(ipc_data, (void*)bufchar, length+1) != 0) {
                        ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                        return ret;
                }
-       }
-       else {
+       } else {
                int length = -1;
 
-               if (pims_ipc_data_put(ipc_data,(void*)&length,sizeof(int)) != 0) {
+               if (pims_ipc_data_put(ipc_data, (void*)&length, sizeof(int)) != 0)
                        ret = CONTACTS_ERROR_OUT_OF_MEMORY;
-               }
        }
        return ret;
 }
 
 int ctsvc_ipc_marshal_int(const int in, pims_ipc_data_h ipc_data)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       if (pims_ipc_data_put(ipc_data,(void*)&in,sizeof(int)) != 0) {
+       if (pims_ipc_data_put(ipc_data, (void*)&in, sizeof(int)) != 0)
                return CONTACTS_ERROR_OUT_OF_MEMORY;
-       }
+
        return CONTACTS_ERROR_NONE;
 }
 
 int ctsvc_ipc_marshal_unsigned_int(const unsigned int in, pims_ipc_data_h ipc_data)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       if (pims_ipc_data_put(ipc_data,(void*)&in,sizeof(unsigned int)) != 0) {
+       if (pims_ipc_data_put(ipc_data, (void*)&in, sizeof(unsigned int)) != 0)
                return CONTACTS_ERROR_OUT_OF_MEMORY;
-       }
+
        return CONTACTS_ERROR_NONE;
 }
 
 int ctsvc_ipc_marshal_bool(const bool in, pims_ipc_data_h ipc_data)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       if (pims_ipc_data_put(ipc_data,(void*)&in,sizeof(bool)) != 0) {
+       if (pims_ipc_data_put(ipc_data, (void*)&in, sizeof(bool)) != 0)
                return CONTACTS_ERROR_OUT_OF_MEMORY;
-       }
+
        return CONTACTS_ERROR_NONE;
 }
 
-int ctsvc_ipc_marshal_record_common(const ctsvc_record_scommon, pims_ipc_data_h ipc_data)
+int ctsvc_ipc_marshal_record_common(const ctsvc_record_s *common, pims_ipc_data_h ipc_data)
 {
 
        RETV_IF(NULL == common, CONTACTS_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == ipc_data, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       if (pims_ipc_data_put(ipc_data,(void*)&common->r_type,sizeof(int)) < 0) {
+       if (pims_ipc_data_put(ipc_data, (void*)&common->r_type, sizeof(int)) < 0)
                return CONTACTS_ERROR_NO_DATA;
-       }
 
        int length = strlen(common->view_uri);
-       if (pims_ipc_data_put(ipc_data,(void*)common->view_uri,length+1) < 0) {
-               CTS_ERR("pims_ipc_data_put() Fail");
+       if (pims_ipc_data_put(ipc_data, (void*)common->view_uri, length+1) < 0) {
+               ERR("pims_ipc_data_put() Fail");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
-       if (pims_ipc_data_put(ipc_data,(void*)&common->property_max_count,sizeof(unsigned int)) < 0) {
+       if (pims_ipc_data_put(ipc_data, (void*)&common->property_max_count, sizeof(unsigned int)) < 0)
                return CONTACTS_ERROR_NO_DATA;
-       }
 
        if (0 < common->property_max_count) {
-               if (pims_ipc_data_put(ipc_data,(void*)common->properties_flags,sizeof(unsigned char)*common->property_max_count) < 0) {
-                       CTS_ERR("pims_ipc_data_put() Fail");
+               if (pims_ipc_data_put(ipc_data, (void*)common->properties_flags, sizeof(unsigned char)*common->property_max_count) < 0) {
+                       ERR("pims_ipc_data_put() Fail");
                        return CONTACTS_ERROR_NO_DATA;
                }
        }
 
-       if (pims_ipc_data_put(ipc_data,(void*)&common->property_flag,sizeof(char)) < 0) {
+       if (pims_ipc_data_put(ipc_data, (void*)&common->property_flag, sizeof(char)) < 0)
                return CONTACTS_ERROR_NO_DATA;
-       }
+
        return CONTACTS_ERROR_NONE;
 }
 
@@ -731,7 +721,7 @@ int ctsvc_ipc_unmarshal_query(const pims_ipc_data_h ipc_data, contacts_query_h *
 {
        ctsvc_query_s *query = NULL;
        unsigned int size = 0;
-       charstr = NULL;
+       char *str = NULL;
        unsigned int count = 0, i = 0;
        int ret = CONTACTS_ERROR_NONE;
 
@@ -743,13 +733,13 @@ int ctsvc_ipc_unmarshal_query(const pims_ipc_data_h ipc_data, contacts_query_h *
 
        ret = contacts_query_create(str, out_query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("contacts_query_create() Fail");
+               ERR("contacts_query_create() Fail");
                return ret;
        }
-       query = (ctsvc_query_s *)*out_query;
+       query = (ctsvc_query_s*)*out_query;
 
        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_unsigned_int(ipc_data, &count)) {
-               CTS_ERR("contacts_query_create() Fail");
+               ERR("contacts_query_create() Fail");
                contacts_query_destroy(*out_query);
                *out_query = NULL;
                return CONTACTS_ERROR_IPC;
@@ -757,30 +747,29 @@ int ctsvc_ipc_unmarshal_query(const pims_ipc_data_h ipc_data, contacts_query_h *
 
        if (0 == count) {
                query->filter = NULL;
-       }
-       else {
+       } else {
                ctsvc_composite_filter_s *filter = NULL;
-               filter = (ctsvc_composite_filter_s *)calloc(1, sizeof(ctsvc_composite_filter_s));
+               filter = calloc(1, sizeof(ctsvc_composite_filter_s));
                if (NULL == filter) {
-                       CTS_ERR("calloc() Fail");
+                       ERR("calloc() Fail");
                        contacts_query_destroy(*out_query);
                        *out_query = NULL;
                        return CONTACTS_ERROR_OUT_OF_MEMORY;
                }
                filter->filter_type = CTSVC_FILTER_COMPOSITE;
-               filter->properties = (property_info_s *)ctsvc_view_get_all_property_infos(query->view_uri, &filter->property_count);
+               filter->properties = (property_info_s*)ctsvc_view_get_all_property_infos(query->view_uri, &filter->property_count);
                query->filter = filter;
 
                /* for filter_type */
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_unsigned_int(ipc_data, &count)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_unsigned_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_unsigned_int() Fail");
                        contacts_query_destroy(*out_query);
                        *out_query = NULL;
                        return CONTACTS_ERROR_IPC;
                }
 
                if (CONTACTS_ERROR_NONE != __ctsvc_ipc_unmarshal_composite_filter(ipc_data, query->filter)) {
-                       CTS_ERR("__ctsvc_ipc_unmarshal_composite_filter() Fail");
+                       ERR("__ctsvc_ipc_unmarshal_composite_filter() Fail");
                        contacts_query_destroy(*out_query);
                        *out_query = NULL;
                        return CONTACTS_ERROR_IPC;
@@ -788,49 +777,48 @@ int ctsvc_ipc_unmarshal_query(const pims_ipc_data_h ipc_data, contacts_query_h *
        }
 
        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_unsigned_int(ipc_data, &(query->projection_count))) {
-               CTS_ERR("ctsvc_ipc_unmarshal_unsigned_int() Fail");
+               ERR("ctsvc_ipc_unmarshal_unsigned_int() Fail");
                contacts_query_destroy(*out_query);
                *out_query = NULL;
                return CONTACTS_ERROR_IPC;
        }
 
        if (0 < query->projection_count) {
-               query->projection = (unsigned int*)malloc(sizeof(unsigned int)*query->projection_count);
+               query->projection = malloc(sizeof(unsigned int)*query->projection_count);
                if (query->projection == NULL) {
-                       CTS_ERR("malloc() Fail");
+                       ERR("malloc() Fail");
                        contacts_query_destroy(*out_query);
                        *out_query = NULL;
                        return CONTACTS_ERROR_OUT_OF_MEMORY;
                }
-               for (i=0;i<query->projection_count;i++) {
-                       if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_unsigned_int(ipc_data,&(query->projection[i]))) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_unsigned_int() Fail");
+               for (i = 0; i < query->projection_count; i++) {
+                       if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_unsigned_int(ipc_data, &(query->projection[i]))) {
+                               ERR("ctsvc_ipc_unmarshal_unsigned_int() Fail");
                                contacts_query_destroy(*out_query);
                                *out_query = NULL;
                                return CONTACTS_ERROR_IPC;
                        }
                }
-       }
-       else {
+       } else {
                query->projection = NULL;
        }
 
-       if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_unsigned_int(ipc_data,&(query->sort_property_id))) {
-               CTS_ERR("ctsvc_ipc_unmarshal_unsigned_int() Fail");
+       if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_unsigned_int(ipc_data, &(query->sort_property_id))) {
+               ERR("ctsvc_ipc_unmarshal_unsigned_int() Fail");
                contacts_query_destroy(*out_query);
                *out_query = NULL;
                return CONTACTS_ERROR_IPC;
        }
 
-       if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_bool(ipc_data,&(query->sort_asc))) {
-               CTS_ERR("ctsvc_ipc_unmarshal_bool() Fail");
+       if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_bool(ipc_data, &(query->sort_asc))) {
+               ERR("ctsvc_ipc_unmarshal_bool() Fail");
                contacts_query_destroy(*out_query);
                *out_query = NULL;
                return CONTACTS_ERROR_IPC;
        }
 
-       if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_bool(ipc_data,&(query->distinct))) {
-               CTS_ERR("ctsvc_ipc_unmarshal_bool() Fail");
+       if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_bool(ipc_data, &(query->distinct))) {
+               ERR("ctsvc_ipc_unmarshal_bool() Fail");
                contacts_query_destroy(*out_query);
                *out_query = NULL;
                return CONTACTS_ERROR_IPC;
@@ -847,63 +835,62 @@ int ctsvc_ipc_marshal_query(const contacts_query_h query, pims_ipc_data_h ipc_da
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == ipc_data, CONTACTS_ERROR_INVALID_PARAMETER);
-       que = (ctsvc_query_s *)query;
+       que = (ctsvc_query_s*)query;
 
        /* view_uri */
        length = strlen(que->view_uri);
-       if (pims_ipc_data_put(ipc_data,(void*)que->view_uri,length+1) < 0) {
-               CTS_ERR("pims_ipc_data_put() Fail");
+       if (pims_ipc_data_put(ipc_data, (void*)que->view_uri, length+1) < 0) {
+               ERR("pims_ipc_data_put() Fail");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
        if (que->filter) {
-               if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(1,ipc_data)) {
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+               if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(1, ipc_data)) {
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
 
-               if (CONTACTS_ERROR_NONE != __ctsvc_ipc_marshal_composite_filter(que->filter,ipc_data)) {
-                       CTS_ERR("__ctsvc_ipc_marshal_composite_filter() Fail");
+               if (CONTACTS_ERROR_NONE != __ctsvc_ipc_marshal_composite_filter(que->filter, ipc_data)) {
+                       ERR("__ctsvc_ipc_marshal_composite_filter() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
-       }
-       else {
-               if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(0,ipc_data)) {
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+       } else {
+               if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(0, ipc_data)) {
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
        }
 
-       if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_unsigned_int(que->projection_count,ipc_data)) {
-               CTS_ERR("ctsvc_ipc_marshal_unsigned_int() Fail");
+       if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_unsigned_int(que->projection_count, ipc_data)) {
+               ERR("ctsvc_ipc_marshal_unsigned_int() Fail");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
-       for (i=0;i<que->projection_count;i++) {
-               if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_unsigned_int(que->projection[i],ipc_data)) {
-                       CTS_ERR("ctsvc_ipc_marshal_unsigned_int() Fail");
+       for (i = 0; i < que->projection_count; i++) {
+               if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_unsigned_int(que->projection[i], ipc_data)) {
+                       ERR("ctsvc_ipc_marshal_unsigned_int() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
        }
 
-       if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_unsigned_int(que->sort_property_id,ipc_data)) {
-               CTS_ERR("ctsvc_ipc_marshal_unsigned_int() Fail");
+       if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_unsigned_int(que->sort_property_id, ipc_data)) {
+               ERR("ctsvc_ipc_marshal_unsigned_int() Fail");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
-       if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_bool(que->sort_asc,ipc_data)) {
-               CTS_ERR("ctsvc_ipc_marshal_bool() Fail");
+       if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_bool(que->sort_asc, ipc_data)) {
+               ERR("ctsvc_ipc_marshal_bool() Fail");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
-       if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_bool(que->distinct,ipc_data)) {
-               CTS_ERR("ctsvc_ipc_marshal_bool() Fail");
+       if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_bool(que->distinct, ipc_data)) {
+               ERR("ctsvc_ipc_marshal_bool() Fail");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
        return CONTACTS_ERROR_NONE;
 }
 
-int ctsvc_ipc_unmarshal_list(const pims_ipc_data_h ipc_data, contacts_list_hlist)
+int ctsvc_ipc_unmarshal_list(const pims_ipc_data_h ipc_data, contacts_list_h *list)
 {
        int count = 0;
        unsigned int deleted_count = 0;
@@ -913,28 +900,28 @@ int ctsvc_ipc_unmarshal_list(const pims_ipc_data_h ipc_data, contacts_list_h* li
        RETV_IF(NULL == ipc_data, CONTACTS_ERROR_INVALID_PARAMETER);
 
        if (CONTACTS_ERROR_NONE != contacts_list_create(list)) {
-               CTS_ERR("contacts_list_create() Fail");
+               ERR("contacts_list_create() Fail");
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
 
        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data, &(count))) {
-               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+               ERR("ctsvc_ipc_unmarshal_int() Fail");
                contacts_list_destroy(*list, true);
                *list = NULL;
                return CONTACTS_ERROR_IPC;
        }
 
        unsigned int i = 0;
-       for (i=0;i<count;i++) {
+       for (i = 0; i < count; i++) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_record(ipc_data, &record)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_record() Fail");
+                       ERR("ctsvc_ipc_unmarshal_record() Fail");
                        contacts_list_destroy(*list, true);
                        *list = NULL;
                        return CONTACTS_ERROR_IPC;
                }
 
                if (CONTACTS_ERROR_NONE != contacts_list_add(*list, record)) {
-                       CTS_ERR("contacts_list_add() Fail");
+                       ERR("contacts_list_add() Fail");
                        contacts_list_destroy(*list, true);
                        *list = NULL;
                        return CONTACTS_ERROR_INVALID_PARAMETER;
@@ -942,23 +929,23 @@ int ctsvc_ipc_unmarshal_list(const pims_ipc_data_h ipc_data, contacts_list_h* li
        }
 
        if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_unsigned_int(ipc_data, &deleted_count)) {
-               CTS_ERR("ctsvc_ipc_unmarshal_unsigned_int() Fail");
+               ERR("ctsvc_ipc_unmarshal_unsigned_int() Fail");
                contacts_list_destroy(*list, true);
                *list = NULL;
                return CONTACTS_ERROR_IPC;
        }
 
        i = 0;
-       for (i=0;i<deleted_count;i++) {
+       for (i = 0; i < deleted_count; i++) {
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_record(ipc_data, &record)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_record() Fail");
+                       ERR("ctsvc_ipc_unmarshal_record() Fail");
                        contacts_list_destroy(*list, true);
                        *list = NULL;
                        return CONTACTS_ERROR_IPC;
                }
 
                if (CONTACTS_ERROR_NONE != ctsvc_list_append_deleted_record(*list, record)) {
-                       CTS_ERR("ctsvc_list_append_deleted_record() Fail");
+                       ERR("ctsvc_list_append_deleted_record() Fail");
                        contacts_list_destroy(*list, true);
                        *list = NULL;
                        return CONTACTS_ERROR_IPC;
@@ -968,7 +955,7 @@ int ctsvc_ipc_unmarshal_list(const pims_ipc_data_h ipc_data, contacts_list_h* li
        return CONTACTS_ERROR_NONE;
 }
 
-int ctsvc_ipc_unmarshal_child_list(const pims_ipc_data_h ipc_data, contacts_list_hlist)
+int ctsvc_ipc_unmarshal_child_list(const pims_ipc_data_h ipc_data, contacts_list_h *list)
 {
        unsigned int i = 0;
        int count = 0;
@@ -978,37 +965,37 @@ int ctsvc_ipc_unmarshal_child_list(const pims_ipc_data_h ipc_data, contacts_list
        RETV_IF(NULL == list, CONTACTS_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == ipc_data, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data,&(count))) {
-               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+       if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data, &(count))) {
+               ERR("ctsvc_ipc_unmarshal_int() Fail");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
-       for (i=0;i<count;i++) {
-               if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_record(ipc_data,&record)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_record() Fail");
+       for (i = 0; i < count; i++) {
+               if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_record(ipc_data, &record)) {
+                       ERR("ctsvc_ipc_unmarshal_record() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
 
-               if (CONTACTS_ERROR_NONE != contacts_list_add(*list,record)) {
-                       CTS_ERR("contacts_list_add() Fail");
+               if (CONTACTS_ERROR_NONE != contacts_list_add(*list, record)) {
+                       ERR("contacts_list_add() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
        }
 
-       if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_unsigned_int(ipc_data,&deleted_count)) {
-               CTS_ERR("ctsvc_ipc_unmarshal_unsigned_int() Fail");
+       if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_unsigned_int(ipc_data, &deleted_count)) {
+               ERR("ctsvc_ipc_unmarshal_unsigned_int() Fail");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
        i = 0;
-       for (i=0;i<deleted_count;i++) {
-               if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_record(ipc_data,&record)) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_record() Fail");
+       for (i = 0; i < deleted_count; i++) {
+               if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_record(ipc_data, &record)) {
+                       ERR("ctsvc_ipc_unmarshal_record() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
 
-               if (CONTACTS_ERROR_NONE != ctsvc_list_append_deleted_record(*list,record)) {
-                       CTS_ERR("ctsvc_list_append_deleted_record() Fail");
+               if (CONTACTS_ERROR_NONE != ctsvc_list_append_deleted_record(*list, record)) {
+                       ERR("ctsvc_list_append_deleted_record() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
        }
@@ -1027,49 +1014,49 @@ int ctsvc_ipc_marshal_list(const contacts_list_h list, pims_ipc_data_h ipc_data)
 
        /* count */
        if (CONTACTS_ERROR_NONE != contacts_list_get_count(list, &count)) {
-               CTS_ERR("contacts_list_get_count() Fail");
+               ERR("contacts_list_get_count() Fail");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
-       if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(count,ipc_data)) {
-               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+       if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(count, ipc_data)) {
+               ERR("ctsvc_ipc_marshal_int() Fail");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
        contacts_list_first(list);
 
        unsigned int i = 0;
-       for (i=0;i<count;i++) {
-               if (CONTACTS_ERROR_NONE != contacts_list_get_current_record_p(list,&record)) {
-                       CTS_ERR("contacts_list_get_current_record_p() Fail");
+       for (i = 0; i < count; i++) {
+               if (CONTACTS_ERROR_NONE != contacts_list_get_current_record_p(list, &record)) {
+                       ERR("contacts_list_get_current_record_p() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
-               if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_record(record,ipc_data)) {
-                       CTS_ERR("ctsvc_ipc_marshal_record() Fail");
+               if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_record(record, ipc_data)) {
+                       ERR("ctsvc_ipc_marshal_record() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
-               if (CONTACTS_ERROR_NO_DATA == contacts_list_next(list)) {
+
+               if (CONTACTS_ERROR_NO_DATA == contacts_list_next(list))
                        break;
-               }
        }
 
        /* count */
        if (ctsvc_list_get_deleted_count(list, &deleted_count)) {
-               CTS_ERR("ctsvc_list_get_deleted_count() Fail");
+               ERR("ctsvc_list_get_deleted_count() Fail");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
-       if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(deleted_count,ipc_data)) {
-               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+       if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(deleted_count, ipc_data)) {
+               ERR("ctsvc_ipc_marshal_int() Fail");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
        i = 0;
-       for (i=0;i<deleted_count;i++) {
+       for (i = 0; i < deleted_count; i++) {
                if (CONTACTS_ERROR_NONE != ctsvc_list_get_deleted_nth_record_p(list, i, &record)) {
-                       CTS_ERR("ctsvc_list_get_deleted_nth_record_p() Fail");
+                       ERR("ctsvc_list_get_deleted_nth_record_p() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
-               if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_record(record,ipc_data)) {
-                       CTS_ERR("ctsvc_ipc_marshal_record() Fail");
+               if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_record(record, ipc_data)) {
+                       ERR("ctsvc_ipc_marshal_record() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
        }
index a8eb41f..c69b60b 100644 (file)
@@ -31,7 +31,7 @@
  * unmarshal : cal_common_s 는 먼저 marshal 하여, view_uri 만 넘겨준 이후,
  *              각 plug in에서 cal_common_s를 제외 한 사항에 대하여 unmarshal
  */
-typedef int (*ctsvc_ipc_unmarshal_record_cb)(const pims_ipc_data_h ipc_data, const charview_uri, contacts_record_h precord);
+typedef int (*ctsvc_ipc_unmarshal_record_cb)(const pims_ipc_data_h ipc_data, const char *view_uri, contacts_record_h precord);
 typedef int (*ctsvc_ipc_marshal_record_cb)(const contacts_record_h record, pims_ipc_data_h ipc_data);
 
 typedef struct {
@@ -39,7 +39,7 @@ typedef struct {
     ctsvc_ipc_marshal_record_cb marshal_record;
 } ctsvc_ipc_marshal_record_plugin_cb_s;
 
-int ctsvc_ipc_unmarshal_record(const pims_ipc_data_h ipc_data, contacts_record_hprecord);
+int ctsvc_ipc_unmarshal_record(const pims_ipc_data_h ipc_data, contacts_record_h *precord);
 int ctsvc_ipc_marshal_record(const contacts_record_h record, pims_ipc_data_h ipc_data);
 
 int ctsvc_ipc_marshal_handle(const contacts_h contact, pims_ipc_data_h ipc_data);
@@ -49,20 +49,20 @@ int ctsvc_ipc_unmarshal_handle(const pims_ipc_data_h ipc_data, contacts_h *pcont
  * string
  * char의 경우 NULL 설정의 이슈로 인하여, [int:string length]+[char*] 로 넘길 수 있도록 설정..
  */
-int ctsvc_ipc_unmarshal_string(const pims_ipc_data_h ipc_data, char** ppbufchar);
+int ctsvc_ipc_unmarshal_string(const pims_ipc_data_h ipc_data, char **ppbufchar);
 int ctsvc_ipc_unmarshal_bool(const pims_ipc_data_h data, bool *pout);
 int ctsvc_ipc_unmarshal_int(const pims_ipc_data_h data, int *pout);
 int ctsvc_ipc_unmarshal_unsigned_int(const pims_ipc_data_h data, unsigned int *pout);
-int ctsvc_ipc_unmarshal_record_common(const pims_ipc_data_h ipc_data, ctsvc_record_scommon);
+int ctsvc_ipc_unmarshal_record_common(const pims_ipc_data_h ipc_data, ctsvc_record_s *common);
 
 /*
  * NULL 이슈로 ctsvc_ipc_unmarshal_string / ctsvc_ipc_marshal_string 는 pair 를 이루어야함.
  */
-int ctsvc_ipc_marshal_string(const charbufchar, pims_ipc_data_h ipc_data);
+int ctsvc_ipc_marshal_string(const char *bufchar, pims_ipc_data_h ipc_data);
 int ctsvc_ipc_marshal_bool(const bool in, pims_ipc_data_h ipc_data);
 int ctsvc_ipc_marshal_int(const int in, pims_ipc_data_h ipc_data);
 int ctsvc_ipc_marshal_unsigned_int(const unsigned int in, pims_ipc_data_h ipc_data);
-int ctsvc_ipc_marshal_record_common(const ctsvc_record_scommon, pims_ipc_data_h ipc_data);
+int ctsvc_ipc_marshal_record_common(const ctsvc_record_s *common, pims_ipc_data_h ipc_data);
 
 /*
  * filter, query
@@ -73,7 +73,7 @@ int ctsvc_ipc_marshal_record_common(const ctsvc_record_s* common, pims_ipc_data_
 int ctsvc_ipc_unmarshal_query(const pims_ipc_data_h ipc_data, contacts_query_h *query);
 int ctsvc_ipc_marshal_query(const contacts_query_h query, pims_ipc_data_h ipc_data);
 int ctsvc_ipc_unmarshal_list(const pims_ipc_data_h ipc_data, contacts_list_h *list);
-int ctsvc_ipc_unmarshal_child_list(const pims_ipc_data_h ipc_data, contacts_list_hlist);
+int ctsvc_ipc_unmarshal_child_list(const pims_ipc_data_h ipc_data, contacts_list_h *list);
 int ctsvc_ipc_marshal_list(const contacts_list_h list, pims_ipc_data_h ipc_data);
 
 #endif /* __ctsvc_ipc_marshal__ */
index 2ac114f..fc7aab1 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "ctsvc_internal.h"
 #include "ctsvc_ipc_marshal.h"
 #include "contacts_record.h"
 
-static int __ctsvc_ipc_unmarshal_messenger(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
-static int __ctsvc_ipc_marshal_messenger(const contacts_record_h record, pims_ipc_data_h ipc_data);
-
-ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_messenger_plugin_cb = {
-       .unmarshal_record = __ctsvc_ipc_unmarshal_messenger,
-       .marshal_record = __ctsvc_ipc_marshal_messenger
-};
-
 
-static int __ctsvc_ipc_unmarshal_messenger(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+static int __ctsvc_ipc_unmarshal_messenger(pims_ipc_data_h ipc_data,
+               const char *view_uri, contacts_record_h record)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(record==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_messenger_s *messenger_p = (ctsvc_messenger_s*)record;
 
-       ctsvc_messenger_s* messenger_p = (ctsvc_messenger_s*) record;
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == record, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &messenger_p->id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &messenger_p->contact_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &messenger_p->type) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &messenger_p->label) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &messenger_p->im_id) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &messenger_p->id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &messenger_p->contact_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &messenger_p->type) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &messenger_p->label) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &messenger_p->im_id) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_unmarshal fail");
+       ERR("__ctsvc_ipc_unmarshal_messenger() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_ipc_marshal_messenger(const contacts_record_h record, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_messenger(const contacts_record_h record,
+               pims_ipc_data_h ipc_data)
 {
-       ctsvc_messenger_s* messenger_p = (ctsvc_messenger_s*)record;
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(messenger_p==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_messenger_s *messenger_p = (ctsvc_messenger_s*)record;
+
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(messenger_p == NULL, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_marshal_int((messenger_p->id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((messenger_p->contact_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((messenger_p->type),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((messenger_p->label),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((messenger_p->im_id),ipc_data) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_marshal_int((messenger_p->id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((messenger_p->contact_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((messenger_p->type), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((messenger_p->label), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((messenger_p->im_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
 
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_marshal fail");
+       ERR("_ctsvc_ipc_marshal() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_messenger_plugin_cb = {
+       .unmarshal_record = __ctsvc_ipc_unmarshal_messenger,
+       .marshal_record = __ctsvc_ipc_marshal_messenger
+};
+
index bd13078..1a69d4f 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "ctsvc_internal.h"
 #include "ctsvc_ipc_marshal.h"
 #include "ctsvc_view.h"
 
-static int __ctsvc_ipc_unmarshal_my_profile(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
-static int __ctsvc_ipc_marshal_my_profile(const contacts_record_h record, pims_ipc_data_h ipc_data);
-
-ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_my_profile_plugin_cb = {
-       .unmarshal_record = __ctsvc_ipc_unmarshal_my_profile,
-       .marshal_record = __ctsvc_ipc_marshal_my_profile
-};
 
-static int __ctsvc_ipc_unmarshal_my_profile(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+static int __ctsvc_ipc_unmarshal_my_profile(pims_ipc_data_h ipc_data,
+               const char *view_uri, contacts_record_h record)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(record==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_my_profile_s *pmy_profile = (ctsvc_my_profile_s*)record;
 
-       ctsvc_my_profile_s* pmy_profile = (ctsvc_my_profile_s*) record;
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == record, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &pmy_profile->id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &pmy_profile->changed_time) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &pmy_profile->addressbook_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &pmy_profile->display_name) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &pmy_profile->reverse_display_name) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &pmy_profile->uid) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &pmy_profile->image_thumbnail_path) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &pmy_profile->id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &pmy_profile->changed_time) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &pmy_profile->addressbook_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &pmy_profile->display_name) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &pmy_profile->reverse_display_name) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &pmy_profile->uid) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &pmy_profile->image_thumbnail_path) != CONTACTS_ERROR_NONE)
+                       break;
 
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pmy_profile->name) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pmy_profile->note) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pmy_profile->company) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pmy_profile->numbers) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pmy_profile->emails) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pmy_profile->events) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pmy_profile->messengers) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pmy_profile->postal_addrs) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pmy_profile->urls) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pmy_profile->nicknames) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pmy_profile->profiles) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pmy_profile->relationships) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pmy_profile->images) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pmy_profile->extensions) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pmy_profile->name) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pmy_profile->note) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pmy_profile->company) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pmy_profile->numbers) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pmy_profile->emails) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pmy_profile->events) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pmy_profile->messengers) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pmy_profile->postal_addrs) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pmy_profile->urls) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pmy_profile->nicknames) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pmy_profile->profiles) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pmy_profile->relationships) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pmy_profile->images) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_child_list(ipc_data, (contacts_list_h*)&pmy_profile->extensions) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_unmarshal fail");
+       ERR("__ctsvc_ipc_unmarshal_my_profile() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_ipc_marshal_my_profile(const contacts_record_h record, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_my_profile(const contacts_record_h record,
+               pims_ipc_data_h ipc_data)
 {
-       ctsvc_my_profile_s* pcontact = (ctsvc_my_profile_s*)record;
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(pcontact==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_my_profile_s *pcontact = (ctsvc_my_profile_s*)record;
+
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == pcontact, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_marshal_int((pcontact->id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((pcontact->changed_time),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((pcontact->addressbook_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((pcontact->display_name),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((pcontact->reverse_display_name),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((pcontact->uid),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((pcontact->image_thumbnail_path),ipc_data) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_marshal_int((pcontact->id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((pcontact->changed_time), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((pcontact->addressbook_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((pcontact->display_name), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((pcontact->reverse_display_name), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((pcontact->uid), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((pcontact->image_thumbnail_path), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->name, ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->note, ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->company, ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->numbers, ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->emails, ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->events, ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->messengers, ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->postal_addrs, ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->urls, ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->nicknames, ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->profiles, ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->relationships, ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->images, ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->extensions, ipc_data) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->name, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->note, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->company, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->numbers, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->emails, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->events, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->messengers, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->postal_addrs, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->urls, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->nicknames, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->profiles, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->relationships, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->images, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_list((contacts_list_h)pcontact->extensions, ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_marshal fail");
+       ERR("_ctsvc_ipc_marshal() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_my_profile_plugin_cb = {
+       .unmarshal_record = __ctsvc_ipc_unmarshal_my_profile,
+       .marshal_record = __ctsvc_ipc_marshal_my_profile
+};
+
index 608a858..2547b7e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "ctsvc_internal.h"
 #include "ctsvc_ipc_marshal.h"
 #include "contacts_record.h"
 
-static int __ctsvc_ipc_unmarshal_name(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
-static int __ctsvc_ipc_marshal_name(const contacts_record_h record, pims_ipc_data_h ipc_data);
-
-ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_name_plugin_cb = {
-       .unmarshal_record = __ctsvc_ipc_unmarshal_name,
-       .marshal_record = __ctsvc_ipc_marshal_name
-};
-
 
-static int __ctsvc_ipc_unmarshal_name(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+static int __ctsvc_ipc_unmarshal_name(pims_ipc_data_h ipc_data, const char *view_uri,
+               contacts_record_h record)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(record==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_name_s *name_p = (ctsvc_name_s*)record;
 
-       ctsvc_name_s* name_p = (ctsvc_name_s*) record;
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == record, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_unmarshal_bool(ipc_data, &name_p->is_default) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &name_p->id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &name_p->contact_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &name_p->language_type) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->first) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->last) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->addition) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->prefix) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->suffix) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->phonetic_first) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->phonetic_middle) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->phonetic_last) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->lookup) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->reverse_lookup) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_bool(ipc_data, &name_p->is_default) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &name_p->id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &name_p->contact_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &name_p->language_type) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->first) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->last) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->addition) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->prefix) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->suffix) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->phonetic_first) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->phonetic_middle) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->phonetic_last) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->lookup) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &name_p->reverse_lookup) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
 
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_unmarshal fail");
+       ERR("__ctsvc_ipc_unmarshal_name() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_ipc_marshal_name(const contacts_record_h record, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_name(const contacts_record_h record,
+               pims_ipc_data_h ipc_data)
 {
-       ctsvc_name_s* name_p = (ctsvc_name_s*)record;
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(name_p==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_name_s *name_p = (ctsvc_name_s*)record;
+
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(name_p == NULL, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_marshal_bool((name_p->is_default),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((name_p->id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((name_p->contact_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((name_p->language_type),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((name_p->first),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((name_p->last),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((name_p->addition),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((name_p->prefix),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((name_p->suffix),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((name_p->phonetic_first),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((name_p->phonetic_middle),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((name_p->phonetic_last),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((name_p->lookup),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((name_p->reverse_lookup),ipc_data) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_marshal_bool((name_p->is_default), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((name_p->id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((name_p->contact_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((name_p->language_type), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((name_p->first), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((name_p->last), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((name_p->addition), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((name_p->prefix), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((name_p->suffix), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((name_p->phonetic_first), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((name_p->phonetic_middle), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((name_p->phonetic_last), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((name_p->lookup), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((name_p->reverse_lookup), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
 
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_marshal fail");
+       ERR("_ctsvc_ipc_marshal() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_name_plugin_cb = {
+       .unmarshal_record = __ctsvc_ipc_unmarshal_name,
+       .marshal_record = __ctsvc_ipc_marshal_name
+};
+
index fdaeed1..e4f4ecc 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "ctsvc_internal.h"
 #include "ctsvc_ipc_marshal.h"
 #include "contacts_record.h"
 
-static int __ctsvc_ipc_unmarshal_nickname(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
-static int __ctsvc_ipc_marshal_nickname(const contacts_record_h record, pims_ipc_data_h ipc_data);
-
-ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_nickname_plugin_cb = {
-       .unmarshal_record = __ctsvc_ipc_unmarshal_nickname,
-       .marshal_record = __ctsvc_ipc_marshal_nickname
-};
-
 
-static int __ctsvc_ipc_unmarshal_nickname(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+static int __ctsvc_ipc_unmarshal_nickname(pims_ipc_data_h ipc_data, const char *view_uri,
+               contacts_record_h record)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(record==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_nickname_s *nickname_p = (ctsvc_nickname_s*)record;
 
-       ctsvc_nickname_s* nickname_p = (ctsvc_nickname_s*) record;
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == record, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &nickname_p->id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &nickname_p->contact_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &nickname_p->type) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &nickname_p->label) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &nickname_p->nickname) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &nickname_p->id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &nickname_p->contact_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &nickname_p->type) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &nickname_p->label) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &nickname_p->nickname) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_unmarshal fail");
+       ERR("__ctsvc_ipc_unmarshal_nickname() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_ipc_marshal_nickname(const contacts_record_h record, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_nickname(const contacts_record_h record,
+               pims_ipc_data_h ipc_data)
 {
-       ctsvc_nickname_s* nickname_p = (ctsvc_nickname_s*)record;
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(nickname_p==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_nickname_s *nickname_p = (ctsvc_nickname_s*)record;
+
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(nickname_p == NULL, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_marshal_int((nickname_p->id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((nickname_p->contact_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((nickname_p->type),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((nickname_p->label),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((nickname_p->nickname),ipc_data) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_marshal_int((nickname_p->id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((nickname_p->contact_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((nickname_p->type), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((nickname_p->label), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((nickname_p->nickname), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
 
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_marshal fail");
+       ERR("_ctsvc_ipc_marshal() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_nickname_plugin_cb = {
+       .unmarshal_record = __ctsvc_ipc_unmarshal_nickname,
+       .marshal_record = __ctsvc_ipc_marshal_nickname
+};
+
index d4ed96b..729362a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "ctsvc_internal.h"
 #include "ctsvc_ipc_marshal.h"
 #include "contacts_record.h"
 
-static int __ctsvc_ipc_unmarshal_note(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
-static int __ctsvc_ipc_marshal_note(const contacts_record_h record, pims_ipc_data_h ipc_data);
-
-ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_note_plugin_cb = {
-       .unmarshal_record = __ctsvc_ipc_unmarshal_note,
-       .marshal_record = __ctsvc_ipc_marshal_note
-};
-
 
-static int __ctsvc_ipc_unmarshal_note(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+static int __ctsvc_ipc_unmarshal_note(pims_ipc_data_h ipc_data, const char *view_uri,
+               contacts_record_h record)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(record==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_note_s * note_p = (ctsvc_note_s*)record;
 
-       ctsvc_note_s*  note_p = (ctsvc_note_s*) record;
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == record, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &note_p->id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &note_p->contact_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &note_p->note) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &note_p->id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &note_p->contact_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &note_p->note) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
 
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_unmarshal fail");
+       ERR("__ctsvc_ipc_unmarshal_note() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_ipc_marshal_note(const contacts_record_h record, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_note(const contacts_record_h record,
+               pims_ipc_data_h ipc_data)
 {
-       ctsvc_note_s* note_p = (ctsvc_note_s*)record;
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(note_p==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_note_s *note_p = (ctsvc_note_s*)record;
+
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(note_p == NULL, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_marshal_int((note_p->id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((note_p->contact_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((note_p->note),ipc_data) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_marshal_int((note_p->id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((note_p->contact_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((note_p->note), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_marshal fail");
+       ERR("_ctsvc_ipc_marshal() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_note_plugin_cb = {
+       .unmarshal_record = __ctsvc_ipc_unmarshal_note,
+       .marshal_record = __ctsvc_ipc_marshal_note
+};
+
index 7a54f9c..f68af81 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "ctsvc_internal.h"
 #include "ctsvc_ipc_marshal.h"
 #include "contacts_record.h"
 
-static int __ctsvc_ipc_unmarshal_number(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
-static int __ctsvc_ipc_marshal_number(const contacts_record_h record, pims_ipc_data_h ipc_data);
-
-ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_number_plugin_cb = {
-       .unmarshal_record = __ctsvc_ipc_unmarshal_number,
-       .marshal_record = __ctsvc_ipc_marshal_number
-};
 
-static int __ctsvc_ipc_unmarshal_number(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+static int __ctsvc_ipc_unmarshal_number(pims_ipc_data_h ipc_data, const char *view_uri,
+               contacts_record_h record)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(record==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_number_s * number_p = (ctsvc_number_s*)record;
 
-       ctsvc_number_s*  number_p = (ctsvc_number_s*) record;
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == record, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_unmarshal_bool(ipc_data, &number_p->is_default) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &number_p->id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &number_p->contact_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &number_p->type) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &number_p->label) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &number_p->number) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_bool(ipc_data, &number_p->is_default) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &number_p->id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &number_p->contact_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &number_p->type) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &number_p->label) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &number_p->number) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
 
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_unmarshal fail");
+       ERR("__ctsvc_ipc_unmarshal_number() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_ipc_marshal_number(const contacts_record_h record, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_number(const contacts_record_h record,
+               pims_ipc_data_h ipc_data)
 {
-       ctsvc_number_s* number_p = (ctsvc_number_s*)record;
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(number_p==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_number_s *number_p = (ctsvc_number_s*)record;
+
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(number_p == NULL, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_marshal_bool((number_p->is_default),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((number_p->id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((number_p->contact_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((number_p->type),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((number_p->label),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((number_p->number),ipc_data) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_marshal_bool((number_p->is_default), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((number_p->id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((number_p->contact_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((number_p->type), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((number_p->label), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((number_p->number), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_marshal fail");
+       ERR("_ctsvc_ipc_marshal() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_number_plugin_cb = {
+       .unmarshal_record = __ctsvc_ipc_unmarshal_number,
+       .marshal_record = __ctsvc_ipc_marshal_number
+};
+
index d795151..06cc761 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "ctsvc_internal.h"
 #include "ctsvc_ipc_marshal.h"
 #include "contacts_record.h"
 
-static int __ctsvc_ipc_unmarshal_person(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
-static int __ctsvc_ipc_marshal_person(const contacts_record_h record, pims_ipc_data_h ipc_data);
-
-ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_person_plugin_cb = {
-       .unmarshal_record = __ctsvc_ipc_unmarshal_person,
-       .marshal_record = __ctsvc_ipc_marshal_person
-};
-
 
-static int __ctsvc_ipc_unmarshal_person(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+static int __ctsvc_ipc_unmarshal_person(pims_ipc_data_h ipc_data, const char *view_uri,
+               contacts_record_h record)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(record==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_person_s * person_p = (ctsvc_person_s*)record;
 
-       ctsvc_person_s*  person_p = (ctsvc_person_s*) record;
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == record, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_unmarshal_bool(ipc_data, &person_p->is_favorite) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_bool(ipc_data, &person_p->has_phonenumber) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_bool(ipc_data, &person_p->has_email) != CONTACTS_ERROR_NONE) break;
-
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &person_p->person_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &person_p->name_contact_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &person_p->display_name) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &person_p->display_name_index) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &person_p->image_thumbnail_path) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &person_p->ringtone_path) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &person_p->vibration) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &person_p->message_alert) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &person_p->status) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &person_p->link_count) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &person_p->addressbook_ids) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_bool(ipc_data, &person_p->is_favorite) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_bool(ipc_data, &person_p->has_phonenumber) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_bool(ipc_data, &person_p->has_email) != CONTACTS_ERROR_NONE)
+                       break;
+
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &person_p->person_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &person_p->name_contact_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &person_p->display_name) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &person_p->display_name_index) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &person_p->image_thumbnail_path) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &person_p->ringtone_path) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &person_p->vibration) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &person_p->message_alert) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &person_p->status) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &person_p->link_count) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &person_p->addressbook_ids) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_unmarshal fail");
+       ERR("__ctsvc_ipc_unmarshal_person() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_ipc_marshal_person(const contacts_record_h record, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_person(const contacts_record_h record,
+               pims_ipc_data_h ipc_data)
 {
-       ctsvc_person_s* person_p = (ctsvc_person_s*)record;
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(person_p==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_person_s *person_p = (ctsvc_person_s*)record;
 
-       do {
-               if (ctsvc_ipc_marshal_bool((person_p->is_favorite),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_bool((person_p->has_phonenumber),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_bool((person_p->has_email),ipc_data) != CONTACTS_ERROR_NONE) break;
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(person_p == NULL, CONTACTS_ERROR_NO_DATA);
 
-               if (ctsvc_ipc_marshal_int((person_p->person_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((person_p->name_contact_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((person_p->display_name),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((person_p->display_name_index),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((person_p->image_thumbnail_path),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((person_p->ringtone_path),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((person_p->vibration),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((person_p->message_alert),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((person_p->status),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((person_p->link_count),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((person_p->addressbook_ids),ipc_data) != CONTACTS_ERROR_NONE) break;
+       do {
+               if (ctsvc_ipc_marshal_bool((person_p->is_favorite), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_bool((person_p->has_phonenumber), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_bool((person_p->has_email), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+
+               if (ctsvc_ipc_marshal_int((person_p->person_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((person_p->name_contact_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((person_p->display_name), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((person_p->display_name_index), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((person_p->image_thumbnail_path), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((person_p->ringtone_path), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((person_p->vibration), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((person_p->message_alert), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((person_p->status), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((person_p->link_count), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((person_p->addressbook_ids), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_marshal fail");
+       ERR("_ctsvc_ipc_marshal() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_person_plugin_cb = {
+       .unmarshal_record = __ctsvc_ipc_unmarshal_person,
+       .marshal_record = __ctsvc_ipc_marshal_person
+};
+
index 903fa85..5324a59 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "ctsvc_internal.h"
 #include "ctsvc_ipc_marshal.h"
 #include "contacts_record.h"
 
-static int __ctsvc_ipc_unmarshal_phonelog(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
-static int __ctsvc_ipc_marshal_phonelog(const contacts_record_h record, pims_ipc_data_h ipc_data);
-
-ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_phonelog_plugin_cb = {
-       .unmarshal_record = __ctsvc_ipc_unmarshal_phonelog,
-       .marshal_record = __ctsvc_ipc_marshal_phonelog
-};
-
 
-static int __ctsvc_ipc_unmarshal_phonelog(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+static int __ctsvc_ipc_unmarshal_phonelog(pims_ipc_data_h ipc_data, const char *view_uri,
+               contacts_record_h record)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(record==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_phonelog_s *phonelog_p = (ctsvc_phonelog_s*)record;
 
-       ctsvc_phonelog_s* phonelog_p = (ctsvc_phonelog_s*) record;
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == record, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &phonelog_p->id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &phonelog_p->address) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &phonelog_p->person_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &phonelog_p->log_time) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &phonelog_p->log_type) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &phonelog_p->extra_data1) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &phonelog_p->extra_data2) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &phonelog_p->sim_slot_no) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &phonelog_p->id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &phonelog_p->address) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &phonelog_p->person_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &phonelog_p->log_time) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &phonelog_p->log_type) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &phonelog_p->extra_data1) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &phonelog_p->extra_data2) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &phonelog_p->sim_slot_no) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_unmarshal fail");
+       ERR("__ctsvc_ipc_unmarshal_phonelog() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_ipc_marshal_phonelog(const contacts_record_h record, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_phonelog(const contacts_record_h record,
+               pims_ipc_data_h ipc_data)
 {
-       ctsvc_phonelog_s* phonelog_p = (ctsvc_phonelog_s*)record;
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(phonelog_p==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_phonelog_s *phonelog_p = (ctsvc_phonelog_s*)record;
 
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(phonelog_p == NULL, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_marshal_int((phonelog_p->id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((phonelog_p->address),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((phonelog_p->person_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((phonelog_p->log_time),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((phonelog_p->log_type),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((phonelog_p->extra_data1),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((phonelog_p->extra_data2),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((phonelog_p->sim_slot_no),ipc_data) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_marshal_int((phonelog_p->id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((phonelog_p->address), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((phonelog_p->person_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((phonelog_p->log_time), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((phonelog_p->log_type), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((phonelog_p->extra_data1), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((phonelog_p->extra_data2), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((phonelog_p->sim_slot_no), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_marshal fail");
+       ERR("_ctsvc_ipc_marshal() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_phonelog_plugin_cb = {
+       .unmarshal_record = __ctsvc_ipc_unmarshal_phonelog,
+       .marshal_record = __ctsvc_ipc_marshal_phonelog
+};
+
index d559bc4..d5588ad 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "ctsvc_internal.h"
 #include "ctsvc_ipc_marshal.h"
 #include "contacts_record.h"
 
-static int __ctsvc_ipc_unmarshal_profile(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
-static int __ctsvc_ipc_marshal_profile(const contacts_record_h record, pims_ipc_data_h ipc_data);
-
-ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_profile_plugin_cb = {
-       .unmarshal_record = __ctsvc_ipc_unmarshal_profile,
-       .marshal_record = __ctsvc_ipc_marshal_profile
-};
 
 
-static int __ctsvc_ipc_unmarshal_profile(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+static int __ctsvc_ipc_unmarshal_profile(pims_ipc_data_h ipc_data, const char *view_uri,
+               contacts_record_h record)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(record==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_profile_s *profile_p = (ctsvc_profile_s*)record;
 
-       ctsvc_profile_s* profile_p = (ctsvc_profile_s*) record;
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == record, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &profile_p->id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &profile_p->contact_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->uid) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->text) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &profile_p->order) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->service_operation) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->mime) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->app_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->uri) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->category) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->extra_data) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &profile_p->id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &profile_p->contact_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->uid) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->text) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &profile_p->order) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->service_operation) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->mime) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->app_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->uri) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->category) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &profile_p->extra_data) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_unmarshal fail");
+       ERR("__ctsvc_ipc_unmarshal_profile() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_ipc_marshal_profile(const contacts_record_h record, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_profile(const contacts_record_h record,
+               pims_ipc_data_h ipc_data)
 {
-       ctsvc_profile_s* profile_p = (ctsvc_profile_s*)record;
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(profile_p==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_profile_s *profile_p = (ctsvc_profile_s*)record;
+
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(profile_p == NULL, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_marshal_int((profile_p->id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((profile_p->contact_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((profile_p->uid),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((profile_p->text),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((profile_p->order),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((profile_p->service_operation),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((profile_p->mime),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((profile_p->app_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((profile_p->uri),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((profile_p->category),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((profile_p->extra_data),ipc_data) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_marshal_int((profile_p->id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((profile_p->contact_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((profile_p->uid), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((profile_p->text), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((profile_p->order), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((profile_p->service_operation), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((profile_p->mime), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((profile_p->app_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((profile_p->uri), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((profile_p->category), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((profile_p->extra_data), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
 
-       CTS_ERR("_ctsvc_ipc_marshal fail");
+       ERR("_ctsvc_ipc_marshal() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_profile_plugin_cb = {
+       .unmarshal_record = __ctsvc_ipc_unmarshal_profile,
+       .marshal_record = __ctsvc_ipc_marshal_profile
+};
+
index 68c8b7d..fbc1b4e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "ctsvc_internal.h"
 #include "ctsvc_ipc_marshal.h"
 #include "contacts_record.h"
 
-static int __ctsvc_ipc_unmarshal_relationship(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
-static int __ctsvc_ipc_marshal_relationship(const contacts_record_h record, pims_ipc_data_h ipc_data);
-
-ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_relationship_plugin_cb = {
-       .unmarshal_record = __ctsvc_ipc_unmarshal_relationship,
-       .marshal_record = __ctsvc_ipc_marshal_relationship
-};
-
 
-static int __ctsvc_ipc_unmarshal_relationship(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+static int __ctsvc_ipc_unmarshal_relationship(pims_ipc_data_h ipc_data,
+               const char *view_uri, contacts_record_h record)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(record==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_relationship_s *relationship_p = (ctsvc_relationship_s*)record;
 
-       ctsvc_relationship_s* relationship_p = (ctsvc_relationship_s*) record;
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == record, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &relationship_p->id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &relationship_p->contact_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &relationship_p->type) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &relationship_p->label) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &relationship_p->name) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &relationship_p->id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &relationship_p->contact_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &relationship_p->type) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &relationship_p->label) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &relationship_p->name) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_unmarshal fail");
+       ERR("__ctsvc_ipc_unmarshal_relationship() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_ipc_marshal_relationship(const contacts_record_h record, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_relationship(const contacts_record_h record,
+               pims_ipc_data_h ipc_data)
 {
-       ctsvc_relationship_s* relationship_p = (ctsvc_relationship_s*)record;
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(relationship_p==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_relationship_s *relationship_p = (ctsvc_relationship_s*)record;
+
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(relationship_p == NULL, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_marshal_int((relationship_p->id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((relationship_p->contact_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((relationship_p->type),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((relationship_p->label),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((relationship_p->name),ipc_data) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_marshal_int((relationship_p->id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((relationship_p->contact_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((relationship_p->type), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((relationship_p->label), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((relationship_p->name), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_marshal fail");
+       ERR("_ctsvc_ipc_marshal() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_relationship_plugin_cb = {
+       .unmarshal_record = __ctsvc_ipc_unmarshal_relationship,
+       .marshal_record = __ctsvc_ipc_marshal_relationship
+};
+
index 860dff6..de1debe 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "ctsvc_internal.h"
 #include "ctsvc_ipc_marshal.h"
 #include "contacts_record.h"
 
-static int __ctsvc_ipc_unmarshal_result(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
-static int __ctsvc_ipc_marshal_result(const contacts_record_h record, pims_ipc_data_h ipc_data);
-
-ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_result_plugin_cb = {
-       .unmarshal_record = __ctsvc_ipc_unmarshal_result,
-       .marshal_record = __ctsvc_ipc_marshal_result
-};
-
 
-static int __ctsvc_ipc_unmarshal_search_value(pims_ipc_data_h ipc_data, ctsvc_result_value_s* pvalue)
+static int __ctsvc_ipc_unmarshal_search_value(pims_ipc_data_h ipc_data,
+               ctsvc_result_value_s *pvalue)
 {
-       if (ctsvc_ipc_unmarshal_int(ipc_data,&pvalue->property_id) != CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_ipc_unmarshal fail");
+       int ret;
+
+       ret = ctsvc_ipc_unmarshal_int(ipc_data, &pvalue->property_id);
+       if (ret != CONTACTS_ERROR_NONE) {
+               ERR("ctsvc_ipc_unmarshal_int() Fail(%d)", ret);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
-       if (ctsvc_ipc_unmarshal_int(ipc_data,&pvalue->type) != CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_ipc_unmarshal fail");
+       ret = ctsvc_ipc_unmarshal_int(ipc_data, &pvalue->type);
+       if (ret != CONTACTS_ERROR_NONE) {
+               ERR("ctsvc_ipc_unmarshal_int() Fail(%d)", ret);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
 
        if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_STR) == true) {
-               if (ctsvc_ipc_unmarshal_string(ipc_data,&pvalue->value.s) != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_marshal fail");
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &pvalue->value.s) != CONTACTS_ERROR_NONE) {
+                       ERR("ctsvc_ipc_unmarshal_string() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
-       }
-       else if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_BOOL) == true) {
-               if (ctsvc_ipc_unmarshal_bool(ipc_data,&pvalue->value.b) != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_marshal fail");
+       } else if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_BOOL) == true) {
+               if (ctsvc_ipc_unmarshal_bool(ipc_data, &pvalue->value.b) != CONTACTS_ERROR_NONE) {
+                       ERR("ctsvc_ipc_unmarshal_bool() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
-       }
-       else if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_INT) == true) {
-               if (ctsvc_ipc_unmarshal_int(ipc_data,&pvalue->value.i) != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_marshal fail");
+       } else if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_INT) == true) {
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &pvalue->value.i) != CONTACTS_ERROR_NONE) {
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
-       }
-       else if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_DOUBLE) == true) {
+       } else if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_DOUBLE) == true) {
                return CONTACTS_ERROR_NONE;
-       }
-       else if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_LLI) == true) {
+       } else if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_LLI) == true) {
                return CONTACTS_ERROR_NONE;
-       }
-       else {
-               ASSERT_NOT_REACHED("invalid parameter (property:%d)",pvalue->property_id);
+       } else {
+               ASSERT_NOT_REACHED("invalid parameter (property:%d)", pvalue->property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_ipc_marshal_search_value(const ctsvc_result_value_s* pvalue, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_search_value(const ctsvc_result_value_s *pvalue,
+               pims_ipc_data_h ipc_data)
 {
-       if (ctsvc_ipc_marshal_int(pvalue->property_id,ipc_data) != CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_ipc_marshal fail");
+       if (ctsvc_ipc_marshal_int(pvalue->property_id, ipc_data) != CONTACTS_ERROR_NONE) {
+               ERR("ctsvc_ipc_marshal() Fail");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
-       if (ctsvc_ipc_marshal_int(pvalue->type,ipc_data) != CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_ipc_marshal fail");
+       if (ctsvc_ipc_marshal_int(pvalue->type, ipc_data) != CONTACTS_ERROR_NONE) {
+               ERR("ctsvc_ipc_marshal() Fail");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
 
 
        if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_STR) == true) {
-               if (ctsvc_ipc_marshal_string(pvalue->value.s,ipc_data) != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_marshal fail");
+               if (ctsvc_ipc_marshal_string(pvalue->value.s, ipc_data) != CONTACTS_ERROR_NONE) {
+                       ERR("ctsvc_ipc_marshal() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
-       }
-       else if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_BOOL) == true) {
-               if (ctsvc_ipc_marshal_bool(pvalue->value.b,ipc_data) != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_marshal fail");
+       } else if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_BOOL) == true) {
+               if (ctsvc_ipc_marshal_bool(pvalue->value.b, ipc_data) != CONTACTS_ERROR_NONE) {
+                       ERR("ctsvc_ipc_marshal() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
-       }
-       else if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_INT) == true) {
-               if (ctsvc_ipc_marshal_int(pvalue->value.i,ipc_data) != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_marshal fail");
+       } else if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_INT) == true) {
+               if (ctsvc_ipc_marshal_int(pvalue->value.i, ipc_data) != CONTACTS_ERROR_NONE) {
+                       ERR("ctsvc_ipc_marshal() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
-       }
-       else if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_DOUBLE) == true) {
+       } else if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_DOUBLE) == true) {
                return CONTACTS_ERROR_NONE;
-       }
-       else if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_LLI) == true) {
+       } else if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_LLI) == true) {
                return CONTACTS_ERROR_NONE;
-       }
-       else {
-               ASSERT_NOT_REACHED("invalid parameter (property:%d)",pvalue->property_id);
+       } else {
+               ASSERT_NOT_REACHED("invalid parameter (property:%d)", pvalue->property_id);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        return CONTACTS_ERROR_NONE;
 }
 
 
-static int __ctsvc_ipc_unmarshal_result(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+static int __ctsvc_ipc_unmarshal_result(pims_ipc_data_h ipc_data, const char *view_uri,
+               contacts_record_h record)
 {
-       RETV_IF(ipc_data==NULL, CONTACTS_ERROR_NO_DATA);
-       RETV_IF(record==NULL, CONTACTS_ERROR_NO_DATA);
+       ctsvc_result_s *result_p = (ctsvc_result_s*)record;
 
-       ctsvc_result_s* result_p = (ctsvc_result_s*)record;
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == record, CONTACTS_ERROR_NO_DATA);
 
        unsigned int count = 0;
        if (ctsvc_ipc_unmarshal_unsigned_int(ipc_data, &count) != CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_ipc_unmarshal fail");
+               ERR("ctsvc_ipc_unmarshal_unsigned_int() fail");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
        unsigned int i = 0;
-       for (i=0; i<count; i++) {
-               ctsvc_result_value_svalue_data = NULL;
+       for (i = 0; i < count; i++) {
+               ctsvc_result_value_s *value_data = NULL;
                value_data = calloc(1, sizeof(ctsvc_result_value_s));
-               if (value_data == NULL) {
+               if (value_data == NULL)
                        return CONTACTS_ERROR_OUT_OF_MEMORY;
-               }
 
                if (__ctsvc_ipc_unmarshal_search_value(ipc_data, value_data) != CONTACTS_ERROR_NONE) {
-                       CONTACTS_FREE(value_data);
-                       CTS_ERR("ctsvc_ipc_unmarshal fail");
+                       ERR("__ctsvc_ipc_unmarshal_search_value() Fail");
+                       free(value_data);
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
                result_p->values = g_slist_append(result_p->values, value_data);
@@ -150,37 +137,37 @@ static int __ctsvc_ipc_unmarshal_result(pims_ipc_data_h ipc_data, const char* vi
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_ipc_marshal_result(const contacts_record_h record, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_result(const contacts_record_h record,
+               pims_ipc_data_h ipc_data)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_result_s *result_p = (ctsvc_result_s*)record;
 
-       ctsvc_result_s* result_p = (ctsvc_result_s*)record;
-       RETV_IF(result_p==NULL,CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(result_p == NULL, CONTACTS_ERROR_NO_DATA);
 
        if (result_p->values) {
                unsigned int count = g_slist_length(result_p->values);
                if (ctsvc_ipc_marshal_unsigned_int(count, ipc_data) != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_marshal fail");
+                       ERR("ctsvc_ipc_marshal() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
 
                GSList *cursor = result_p->values;
                while (cursor) {
-                       ctsvc_result_value_s* value_data = (ctsvc_result_value_s *)cursor->data;
+                       ctsvc_result_value_s *value_data = cursor->data;
                        if (value_data == NULL) {
                                cursor = g_slist_next(cursor);
                                continue;
                        }
-                       if (__ctsvc_ipc_marshal_search_value((const ctsvc_result_value_s*)value_data, ipc_data) != CONTACTS_ERROR_NONE) {
-                               CTS_ERR("ctsvc_ipc_marshal fail");
+                       if (__ctsvc_ipc_marshal_search_value(value_data, ipc_data) != CONTACTS_ERROR_NONE) {
+                               ERR("ctsvc_ipc_marshal() Fail");
                                return CONTACTS_ERROR_INVALID_PARAMETER;
                        }
                        cursor = g_slist_next(cursor);
                }
-       }
-       else {
+       } else {
                if (ctsvc_ipc_marshal_int(0, ipc_data) != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_marshal fail");
+                       ERR("ctsvc_ipc_marshal() Fail");
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
        }
@@ -188,3 +175,8 @@ static int __ctsvc_ipc_marshal_result(const contacts_record_h record, pims_ipc_d
        return CONTACTS_ERROR_NONE;
 }
 
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_result_plugin_cb = {
+       .unmarshal_record = __ctsvc_ipc_unmarshal_result,
+       .marshal_record = __ctsvc_ipc_marshal_result
+};
+
index 6ed7466..69c24af 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "ctsvc_internal.h"
 #include "ctsvc_ipc_marshal.h"
 #include "contacts_record.h"
 
-static int __ctsvc_ipc_unmarshal_sdn(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
-static int __ctsvc_ipc_marshal_sdn(const contacts_record_h record, pims_ipc_data_h ipc_data);
-
-ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_sdn_plugin_cb = {
-       .unmarshal_record = __ctsvc_ipc_unmarshal_sdn,
-       .marshal_record = __ctsvc_ipc_marshal_sdn
-};
-
 
-static int __ctsvc_ipc_unmarshal_sdn(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+static int __ctsvc_ipc_unmarshal_sdn(pims_ipc_data_h ipc_data, const char *view_uri,
+               contacts_record_h record)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(record==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_sdn_s * sdn_p = (ctsvc_sdn_s*)record;
+
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == record, CONTACTS_ERROR_NO_DATA);
 
-       ctsvc_sdn_s*  sdn_p = (ctsvc_sdn_s*) record;
        do {
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &sdn_p->id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &sdn_p->name) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &sdn_p->number) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &sdn_p->sim_slot_no) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &sdn_p->id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &sdn_p->name) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &sdn_p->number) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &sdn_p->sim_slot_no) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_unmarshal fail");
+       ERR("__ctsvc_ipc_unmarshal_sdn() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_ipc_marshal_sdn(const contacts_record_h record, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_sdn(const contacts_record_h record,
+               pims_ipc_data_h ipc_data)
 {
-       ctsvc_sdn_s* sdn_p = (ctsvc_sdn_s*)record;
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(sdn_p==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_sdn_s *sdn_p = (ctsvc_sdn_s*)record;
+
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(sdn_p == NULL, CONTACTS_ERROR_NO_DATA);
+
        do {
-               if (ctsvc_ipc_marshal_int((sdn_p->id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((sdn_p->name),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((sdn_p->number),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((sdn_p->sim_slot_no),ipc_data) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_marshal_int((sdn_p->id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((sdn_p->name), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((sdn_p->number), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((sdn_p->sim_slot_no), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_marshal fail");
+       ERR("_ctsvc_ipc_marshal() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_sdn_plugin_cb = {
+       .unmarshal_record = __ctsvc_ipc_unmarshal_sdn,
+       .marshal_record = __ctsvc_ipc_marshal_sdn
+};
+
index 102f482..c1e7199 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
-
 #include "ctsvc_internal.h"
 #include "ctsvc_ipc_marshal.h"
 
-static int __ctsvc_ipc_unmarshal_simple_contact(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
-static int __ctsvc_ipc_marshal_simple_contact(const contacts_record_h record, pims_ipc_data_h ipc_data);
-
-ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_simple_contact_plugin_cb = {
-       .unmarshal_record = __ctsvc_ipc_unmarshal_simple_contact,
-       .marshal_record = __ctsvc_ipc_marshal_simple_contact
-};
 
-static int __ctsvc_ipc_unmarshal_simple_contact(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+static int __ctsvc_ipc_unmarshal_simple_contact(pims_ipc_data_h ipc_data,
+               const char *view_uri, contacts_record_h record)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(record==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_simple_contact_s *pcontact = (ctsvc_simple_contact_s*)record;
+
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == record, CONTACTS_ERROR_NO_DATA);
 
-       ctsvc_simple_contact_s* pcontact = (ctsvc_simple_contact_s*) record;
        do {
-               if (ctsvc_ipc_unmarshal_bool(ipc_data, &pcontact->is_favorite) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &pcontact->changed_time) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_bool(ipc_data, &pcontact->has_phonenumber) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_bool(ipc_data, &pcontact->has_email) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &pcontact->person_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &pcontact->contact_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &pcontact->addressbook_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->image_thumbnail_path) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->ringtone_path) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->vibration) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->message_alert) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->display_name) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->uid) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &pcontact->display_source_type) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_bool(ipc_data, &pcontact->is_favorite) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &pcontact->changed_time) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_bool(ipc_data, &pcontact->has_phonenumber) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_bool(ipc_data, &pcontact->has_email) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &pcontact->person_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &pcontact->contact_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &pcontact->addressbook_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->image_thumbnail_path) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->ringtone_path) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->vibration) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->message_alert) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->display_name) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &pcontact->uid) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &pcontact->display_source_type) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_unmarshal fail");
+       ERR("__ctsvc_ipc_unmarshal_simple_contact() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_ipc_marshal_simple_contact(const contacts_record_h record, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_simple_contact(const contacts_record_h record,
+               pims_ipc_data_h ipc_data)
 {
-       ctsvc_simple_contact_s* pcontact = (ctsvc_simple_contact_s*)record;
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(pcontact==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_simple_contact_s *pcontact = (ctsvc_simple_contact_s*)record;
+
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == pcontact, CONTACTS_ERROR_NO_DATA);
+
        do {
-               if (ctsvc_ipc_marshal_bool((pcontact->is_favorite),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((pcontact->changed_time),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_bool((pcontact->has_phonenumber),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_bool((pcontact->has_email),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((pcontact->person_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((pcontact->contact_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((pcontact->addressbook_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((pcontact->image_thumbnail_path),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((pcontact->ringtone_path),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((pcontact->vibration),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((pcontact->message_alert),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((pcontact->display_name),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((pcontact->uid),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((pcontact->display_source_type),ipc_data) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_marshal_bool((pcontact->is_favorite), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((pcontact->changed_time), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_bool((pcontact->has_phonenumber), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_bool((pcontact->has_email), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((pcontact->person_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((pcontact->contact_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((pcontact->addressbook_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((pcontact->image_thumbnail_path), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((pcontact->ringtone_path), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((pcontact->vibration), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((pcontact->message_alert), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((pcontact->display_name), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((pcontact->uid), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((pcontact->display_source_type), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_marshal fail");
+       ERR("_ctsvc_ipc_marshal() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_simple_contact_plugin_cb = {
+       .unmarshal_record = __ctsvc_ipc_unmarshal_simple_contact,
+       .marshal_record = __ctsvc_ipc_marshal_simple_contact
+};
+
index 841551a..045d2f0 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "ctsvc_internal.h"
 #include "ctsvc_ipc_marshal.h"
 #include "contacts_record.h"
 
-static int __ctsvc_ipc_unmarshal_speeddial(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
-static int __ctsvc_ipc_marshal_speeddial(const contacts_record_h record, pims_ipc_data_h ipc_data);
-
-ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_speeddial_plugin_cb = {
-       .unmarshal_record = __ctsvc_ipc_unmarshal_speeddial,
-       .marshal_record = __ctsvc_ipc_marshal_speeddial
-};
-
 
-static int __ctsvc_ipc_unmarshal_speeddial(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+static int __ctsvc_ipc_unmarshal_speeddial(pims_ipc_data_h ipc_data,
+               const char *view_uri, contacts_record_h record)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(record==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_speeddial_s *speeddial_p = (ctsvc_speeddial_s*)record;
+
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == record, CONTACTS_ERROR_NO_DATA);
 
-       ctsvc_speeddial_s* speeddial_p = (ctsvc_speeddial_s*) record;
        do {
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &speeddial_p->id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &speeddial_p->number_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &speeddial_p->person_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &speeddial_p->display_name) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &speeddial_p->image_thumbnail_path) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &speeddial_p->number_type) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &speeddial_p->label) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &speeddial_p->number) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &speeddial_p->dial_number) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &speeddial_p->id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &speeddial_p->number_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &speeddial_p->person_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &speeddial_p->display_name) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &speeddial_p->image_thumbnail_path) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &speeddial_p->number_type) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &speeddial_p->label) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &speeddial_p->number) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &speeddial_p->dial_number) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_unmarshal fail");
+       ERR("__ctsvc_ipc_unmarshal_speeddial() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_ipc_marshal_speeddial(const contacts_record_h record, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_speeddial(const contacts_record_h record,
+               pims_ipc_data_h ipc_data)
 {
-       ctsvc_speeddial_s* speeddial_p = (ctsvc_speeddial_s*)record;
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(speeddial_p==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_speeddial_s *speeddial_p = (ctsvc_speeddial_s*)record;
+
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(speeddial_p == NULL, CONTACTS_ERROR_NO_DATA);
+
        do {
-               if (ctsvc_ipc_marshal_int((speeddial_p->id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((speeddial_p->number_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((speeddial_p->person_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((speeddial_p->display_name),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((speeddial_p->image_thumbnail_path),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((speeddial_p->number_type),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((speeddial_p->label),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((speeddial_p->number),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((speeddial_p->dial_number),ipc_data) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_marshal_int((speeddial_p->id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((speeddial_p->number_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((speeddial_p->person_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((speeddial_p->display_name), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((speeddial_p->image_thumbnail_path), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((speeddial_p->number_type), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((speeddial_p->label), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((speeddial_p->number), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((speeddial_p->dial_number), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_marshal fail");
+       ERR("_ctsvc_ipc_marshal() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_speeddial_plugin_cb = {
+       .unmarshal_record = __ctsvc_ipc_unmarshal_speeddial,
+       .marshal_record = __ctsvc_ipc_marshal_speeddial
+};
+
index 07fae84..1f3cf15 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "ctsvc_internal.h"
 #include "ctsvc_ipc_marshal.h"
 #include "contacts_record.h"
 
-static int __ctsvc_ipc_unmarshal_updated_info(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
-static int __ctsvc_ipc_marshal_updated_info(const contacts_record_h record, pims_ipc_data_h ipc_data);
-
-ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_updated_info_plugin_cb = {
-       .unmarshal_record = __ctsvc_ipc_unmarshal_updated_info,
-       .marshal_record = __ctsvc_ipc_marshal_updated_info
-};
-
 
-static int __ctsvc_ipc_unmarshal_updated_info(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+static int __ctsvc_ipc_unmarshal_updated_info(pims_ipc_data_h ipc_data,
+               const char *view_uri, contacts_record_h record)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(record==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_updated_info_s * updated_info_p = (ctsvc_updated_info_s*)record;
 
-       ctsvc_updated_info_s*  updated_info_p = (ctsvc_updated_info_s*) record;
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == record, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_unmarshal_int(ipc_data,&updated_info_p->changed_type) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data,&updated_info_p->id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data,&updated_info_p->changed_ver) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data,&updated_info_p->addressbook_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_bool(ipc_data,&updated_info_p->image_changed) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data,&updated_info_p->last_changed_type) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &updated_info_p->changed_type) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &updated_info_p->id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &updated_info_p->changed_ver) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &updated_info_p->addressbook_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_bool(ipc_data, &updated_info_p->image_changed) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &updated_info_p->last_changed_type) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_unmarshal fail");
+       ERR("__ctsvc_ipc_unmarshal_updated_info() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_ipc_marshal_updated_info(const contacts_record_h record, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_updated_info(const contacts_record_h record,
+               pims_ipc_data_h ipc_data)
 {
-       ctsvc_updated_info_s* updated_info_p = (ctsvc_updated_info_s*)record;
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(updated_info_p==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_updated_info_s *updated_info_p = (ctsvc_updated_info_s*)record;
 
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(updated_info_p == NULL, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_marshal_int((updated_info_p->changed_type),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((updated_info_p->id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((updated_info_p->changed_ver),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((updated_info_p->addressbook_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_bool((updated_info_p->image_changed),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((updated_info_p->last_changed_type),ipc_data) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_marshal_int((updated_info_p->changed_type), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((updated_info_p->id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((updated_info_p->changed_ver), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((updated_info_p->addressbook_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_bool((updated_info_p->image_changed), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((updated_info_p->last_changed_type), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_marshal fail");
+       ERR("_ctsvc_ipc_marshal() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
+
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_updated_info_plugin_cb = {
+       .unmarshal_record = __ctsvc_ipc_unmarshal_updated_info,
+       .marshal_record = __ctsvc_ipc_marshal_updated_info
+};
index 88d800f..3863ee0 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #include "ctsvc_internal.h"
 #include "ctsvc_ipc_marshal.h"
 #include "contacts_record.h"
 
-static int __ctsvc_ipc_unmarshal_url(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record);
-static int __ctsvc_ipc_marshal_url(const contacts_record_h record, pims_ipc_data_h ipc_data);
-
-ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_url_plugin_cb = {
-       .unmarshal_record = __ctsvc_ipc_unmarshal_url,
-       .marshal_record = __ctsvc_ipc_marshal_url
-};
-
 
-static int __ctsvc_ipc_unmarshal_url(pims_ipc_data_h ipc_data, const char* view_uri, contacts_record_h record)
+static int __ctsvc_ipc_unmarshal_url(pims_ipc_data_h ipc_data, const char *view_uri,
+               contacts_record_h record)
 {
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(record==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_url_s *url_p = (ctsvc_url_s*) record;
 
-       ctsvc_url_s* url_p = (ctsvc_url_s*) record;
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(NULL == record, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &url_p->id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &url_p->contact_id) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_int(ipc_data, &url_p->type) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &url_p->label) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_unmarshal_string(ipc_data, &url_p->url) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &url_p->id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &url_p->contact_id) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_int(ipc_data, &url_p->type) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &url_p->label) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_unmarshal_string(ipc_data, &url_p->url) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_unmarshal fail");
+       ERR("__ctsvc_ipc_unmarshal_url() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_ipc_marshal_url(const contacts_record_h record, pims_ipc_data_h ipc_data)
+static int __ctsvc_ipc_marshal_url(const contacts_record_h record,
+               pims_ipc_data_h ipc_data)
 {
-       ctsvc_url_s* url_p = (ctsvc_url_s*)record;
-       RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
-       RETV_IF(url_p==NULL,CONTACTS_ERROR_NO_DATA);
+       ctsvc_url_s *url_p = (ctsvc_url_s*)record;
+
+       RETV_IF(NULL == ipc_data, CONTACTS_ERROR_NO_DATA);
+       RETV_IF(url_p == NULL, CONTACTS_ERROR_NO_DATA);
 
        do {
-               if (ctsvc_ipc_marshal_int((url_p->id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((url_p->contact_id),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_int((url_p->type),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((url_p->label),ipc_data) != CONTACTS_ERROR_NONE) break;
-               if (ctsvc_ipc_marshal_string((url_p->url),ipc_data) != CONTACTS_ERROR_NONE) break;
+               if (ctsvc_ipc_marshal_int((url_p->id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((url_p->contact_id), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_int((url_p->type), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((url_p->label), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
+               if (ctsvc_ipc_marshal_string((url_p->url), ipc_data) != CONTACTS_ERROR_NONE)
+                       break;
 
                return CONTACTS_ERROR_NONE;
        } while (0);
 
-       CTS_ERR("_ctsvc_ipc_marshal fail");
+       ERR("_ctsvc_ipc_marshal() Fail");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
+ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_url_plugin_cb = {
+       .unmarshal_record = __ctsvc_ipc_unmarshal_url,
+       .marshal_record = __ctsvc_ipc_marshal_url
+};
+
index faeefcd..e90886b 100644 (file)
  * int i = 0;
  * contacts_db_get_record(_contacts_contact._uri, contact_id, &contact);
  * contacts_record_get_child_record_count(contact, _contacts_contact.address, &address_num);
- * for (i=0; i<address_num; i++) {
+ * for (i = 0; i < address_num; i++) {
  *     contacts_record_h address = NULL;
  *     contacts_record_get_child_record_at_p(contact, _contacts_contact.address, i, &address);
  *     contacts_record_set_str(address, _contacts_address.country, "Korea");
index 3ce47ab..8f6152c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
index 24ea462..dd31734 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -19,9 +19,6 @@
 #ifndef __TIZEN_SOCIAL_CONTACTS_ACTIVITY_H__
 #define __TIZEN_SOCIAL_CONTACTS_ACTIVITY_H__
 
-#ifndef API
-#define API __attribute__ ((visibility("default")))
-#endif
 
 #ifdef __cplusplus
 extern "C"
index 4e01a58..70b5e14 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
 #ifndef __TIZEN_SOCIAL_CONTACTS_DB_H__
 #define __TIZEN_SOCIAL_CONTACTS_DB_H__
 
-#ifndef API
-#define API __attribute__ ((visibility("default")))
-#endif
-
 #ifdef __cplusplus
 extern "C"
 {
@@ -70,7 +66,7 @@ typedef enum
  *
  * @see contacts_db_add_changed_cb()
  */
-typedef void (*contacts_db_changed_cb)(const char* view_uri, void* user_data);
+typedef void (*contacts_db_changed_cb)(const char *view_uri, void *user_data);
 
 /**
  * @brief Inserts a record to the contacts database.
@@ -159,7 +155,7 @@ int contacts_db_insert_record(contacts_record_h record, int *id);
  * @see contacts_connect()
  * @see contacts_record_destroy()
  */
-int contacts_db_get_record(const char* view_uri, int record_id, contacts_record_h* record);
+int contacts_db_get_record(const char *view_uri, int record_id, contacts_record_h *record);
 
 /**
  * @brief Updates a record in the contacts database.
@@ -240,7 +236,7 @@ int contacts_db_update_record(contacts_record_h record);
  * @see contacts_connect()
  * @see contacts_db_insert_record()
  */
-int contacts_db_delete_record(const charview_uri, int record_id);
+int contacts_db_delete_record(const char *view_uri, int record_id);
 
 /**
  * @brief Replaces an id-identified record with the given record.
@@ -322,7 +318,7 @@ int contacts_db_replace_record(contacts_record_h record, int id);
  * @see contacts_connect()
  * @see contacts_list_destroy()
  */
-int contacts_db_get_all_records(const char* view_uri, int offset, int limit, contacts_list_h* record_list);
+int contacts_db_get_all_records(const char *view_uri, int offset, int limit, contacts_list_h *record_list);
 
 /**
  * @brief Uses a query to find records.
@@ -366,7 +362,7 @@ int contacts_db_get_all_records(const char* view_uri, int offset, int limit, con
  * @see contacts_connect()
  * @see contacts_list_destroy()
  */
-int contacts_db_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_hrecord_list);
+int contacts_db_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h *record_list);
 
 /**
  * @brief Inserts multiple records to the contacts database.
@@ -490,7 +486,7 @@ int contacts_db_update_records(contacts_list_h record_list);
  * @see contacts_db_insert_records()
  * @see contacts_db_update_records()
  */
-int contacts_db_delete_records(const charview_uri, int record_id_array[], int count);
+int contacts_db_delete_records(const char *view_uri, int record_id_array[], int count);
 
 /**
  * @brief Replaces database records identified by given ids with a given record list.
@@ -555,7 +551,7 @@ int contacts_db_replace_records(contacts_list_h list, int record_id_array[], int
  * @see contacts_connect()
  * @see contacts_db_get_changes_by_version()
  */
-int contacts_db_get_current_version(intcontacts_db_version);
+int contacts_db_get_current_version(int *contacts_db_version);
 
 /**
  * @brief Registers a callback function to be invoked when a record changes.
@@ -599,7 +595,7 @@ int contacts_db_get_current_version(int* contacts_db_version);
  * @see contacts_db_changed_cb()
  * @see contacts_db_remove_changed_cb()
  */
-int contacts_db_add_changed_cb(const char* view_uri, contacts_db_changed_cb callback, void* user_data);
+int contacts_db_add_changed_cb(const char *view_uri, contacts_db_changed_cb callback, void *user_data);
 
 /**
  * @brief Unregisters a callback function.
@@ -626,7 +622,7 @@ int contacts_db_add_changed_cb(const char* view_uri, contacts_db_changed_cb call
  * @see contacts_db_changed_cb()
  * @see contacts_db_add_changed_cb()
  */
-int contacts_db_remove_changed_cb(const char* view_uri, contacts_db_changed_cb callback, void* user_data);
+int contacts_db_remove_changed_cb(const char *view_uri, contacts_db_changed_cb callback, void *user_data);
 
 /**
  * @brief Retrieves records changes since the given database version.
@@ -665,8 +661,11 @@ int contacts_db_remove_changed_cb(const char* view_uri, contacts_db_changed_cb c
  * @see contacts_connect()
  * @see contacts_list_destroy()
  */
-int contacts_db_get_changes_by_version(const char* view_uri, int address_book_id, int contacts_db_version,
-                        contacts_list_h* change_record_list, int* current_contacts_db_version);
+int contacts_db_get_changes_by_version(const char *view_uri,
+               int address_book_id,
+               int contacts_db_version,
+               contacts_list_h *change_record_list,
+               int *current_contacts_db_version);
 
 /**
  * @brief Finds records based on a given keyword.
@@ -702,7 +701,7 @@ int contacts_db_get_changes_by_version(const char* view_uri, int address_book_id
  * @see contacts_connect()
  * @see contacts_list_destroy()
  */
-int contacts_db_search_records(const char* view_uri, const char *keyword, int offset, int limit, contacts_list_h* record_list);
+int contacts_db_search_records(const char *view_uri, const char *keyword, int offset, int limit, contacts_list_h *record_list);
 
 /**
  * @brief Finds records based on given query and keyword.
@@ -739,7 +738,7 @@ int contacts_db_search_records(const char* view_uri, const char *keyword, int of
  * @see contacts_connect()
  * @see contacts_list_destroy()
  */
-int contacts_db_search_records_with_query(contacts_query_h query, const char *keyword, int offset, int limit, contacts_list_hrecord_list);
+int contacts_db_search_records_with_query(contacts_query_h query, const char *keyword, int offset, int limit, contacts_list_h *record_list);
 
 /**
  * @brief Finds records based on a keyword and range.
@@ -778,7 +777,7 @@ int contacts_db_search_records_with_query(contacts_query_h query, const char *ke
  * @see contacts_connect()
  * @see contacts_list_destroy()
  */
-int contacts_db_search_records_with_range(const char* view_uri, const char *keyword, int offset, int limit, int range, contacts_list_h* record_list);
+int contacts_db_search_records_with_range(const char *view_uri, const char *keyword, int offset, int limit, int range, contacts_list_h *record_list);
 
 /**
  * @brief Gets the number of records in a specific view.
@@ -817,7 +816,7 @@ int contacts_db_search_records_with_range(const char* view_uri, const char *keyw
  *
  * @see contacts_connect()
  */
-int contacts_db_get_count(const charview_uri, int *count);
+int contacts_db_get_count(const char *view_uri, int *count);
 
 /**
  * @brief Gets the number of records matching a query.
@@ -881,7 +880,7 @@ int contacts_db_get_count_with_query(contacts_query_h query, int *count);
  * @see contacts_connect()
  * @see contacts_db_get_current_version()
  */
-int contacts_db_get_last_change_version(intlast_change_version);
+int contacts_db_get_last_change_version(int *last_change_version);
 
 /**
  * @}
index caaa58f..2f60c90 100644 (file)
@@ -20,9 +20,6 @@
 #ifndef __TIZEN_SOCIAL_CONTACTS_DB_EXTENSION_H__
 #define __TIZEN_SOCIAL_CONTACTS_DB_EXTENSION_H__
 
-#ifndef API
-#define API __attribute__ ((visibility("default")))
-#endif
 
 #ifdef __cplusplus
 extern "C"
@@ -45,7 +42,7 @@ extern "C"
  * @see contacts_db_add_changed_cb_with_info()
  */
 
-typedef void (*contacts_db_change_cb_with_info)(const char* view_uri, char *changes, void* user_data);
+typedef void (*contacts_db_change_cb_with_info)(const char *view_uri, char *changes, void *user_data);
 
 /**
  * @brief Registers a callback function.
@@ -80,7 +77,7 @@ typedef void (*contacts_db_change_cb_with_info)(const char* view_uri, char *chan
  * @see contacts_db_changed_cb_with_info()
  * @see contacts_db_remove_changed_cb_with_info()
  */
-int contacts_db_add_changed_cb_with_info(const char* view_uri, contacts_db_change_cb_with_info callback, void* user_data);
+int contacts_db_add_changed_cb_with_info(const char *view_uri, contacts_db_change_cb_with_info callback, void *user_data);
 
 /**
  * @brief Unregisters a callback function.
@@ -105,7 +102,7 @@ int contacts_db_add_changed_cb_with_info(const char* view_uri, contacts_db_chang
  * @see contacts_db_changed_cb_with_info()
  * @see contacts_db_add_changed_cb_with_info()
  */
-int contacts_db_remove_changed_cb_with_info(const char* view_uri, contacts_db_change_cb_with_info callback, void* user_data);
+int contacts_db_remove_changed_cb_with_info(const char *view_uri, contacts_db_change_cb_with_info callback, void *user_data);
 
 
 #ifdef __cplusplus
index fc4a197..cefdde4 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -19,9 +19,6 @@
 #ifndef __TIZEN_SOCIAL_CONTACTS_DB_STATUS_H__
 #define __TIZEN_SOCIAL_CONTACTS_DB_STATUS_H__
 
-#ifndef API
-#define API __attribute__ ((visibility("default")))
-#endif
 
 #ifdef __cplusplus
 extern "C"
@@ -82,7 +79,7 @@ int contacts_db_get_status(contacts_db_status_e *status);
  * @see contacts_db_add_status_changed_cb()
  */
 
-typedef void (*contacts_db_status_changed_cb)(contacts_db_status_e status, voiduser_data);
+typedef void (*contacts_db_status_changed_cb)(contacts_db_status_e status, void *user_data);
 
 /**
  * @brief  Registers a callback function.
@@ -104,7 +101,7 @@ typedef void (*contacts_db_status_changed_cb)(contacts_db_status_e status, void*
  * @see contacts_db_remove_status_changed_cb()
  */
 
-int contacts_db_add_status_changed_cb(contacts_db_status_changed_cb callback, voiduser_data);
+int contacts_db_add_status_changed_cb(contacts_db_status_changed_cb callback, void *user_data);
 
 /**
  * @brief  Unregisters a callback function.
@@ -126,7 +123,7 @@ int contacts_db_add_status_changed_cb(contacts_db_status_changed_cb callback, vo
  * @see contacts_db_add_status_changed_cb()
  */
 
-int contacts_db_remove_status_changed_cb(contacts_db_status_changed_cb callback, voiduser_data);
+int contacts_db_remove_status_changed_cb(contacts_db_status_changed_cb callback, void *user_data);
 
 /**
  * @}
index ef80f2b..66575e3 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
index 8bd2e08..728e8d4 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -19,9 +19,6 @@
 #ifndef __TIZEN_SOCIAL_CONTACTS_FILTER_H__
 #define __TIZEN_SOCIAL_CONTACTS_FILTER_H__
 
-#ifndef API
-#define API __attribute__ ((visibility("default")))
-#endif
 
 #ifdef __cplusplus
 extern "C"
@@ -112,7 +109,7 @@ typedef enum {
  *
  * @see contacts_filter_destroy()
  */
-int contacts_filter_create(const char* view_uri, contacts_filter_h* filter);
+int contacts_filter_create(const char *view_uri, contacts_filter_h *filter);
 
 /**
  * @brief Destroys a filter.
@@ -150,7 +147,7 @@ int contacts_filter_destroy(contacts_filter_h filter);
  *
  * @see contacts_filter_add_operator()
  */
-int contacts_filter_add_str(contacts_filter_h filter, unsigned int property_id, contacts_match_str_flag_e match, const charmatch_value);
+int contacts_filter_add_str(contacts_filter_h filter, unsigned int property_id, contacts_match_str_flag_e match, const char *match_value);
 
 /**
  * @brief Adds a condition for an integer type property.
index fbbb9c5..bdd5fa2 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
 #ifndef __TIZEN_SOCIAL_CONTACTS_GROUP_H__
 #define __TIZEN_SOCIAL_CONTACTS_GROUP_H__
 
-#ifndef API
-#define API __attribute__ ((visibility("default")))
-#endif
-
 
 #ifdef __cplusplus
 extern "C"
index 19cf4cf..8872450 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
index c05eab1..cb57aa8 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -19,9 +19,6 @@
 #ifndef __TIZEN_SOCIAL_CONTACTS_LIST_H__
 #define __TIZEN_SOCIAL_CONTACTS_LIST_H__
 
-#ifndef API
-#define API __attribute__ ((visibility("default")))
-#endif
 
 #ifdef __cplusplus
 extern "C"
@@ -64,7 +61,7 @@ extern "C"
  *
  * @see contacts_list_destroy()
  */
-int contacts_list_create(contacts_list_hcontacts_list);
+int contacts_list_create(contacts_list_h *contacts_list);
 
 /**
  * @brief Destroys a contacts list and releases its all resources.
@@ -165,7 +162,7 @@ int contacts_list_remove(contacts_list_h contacts_list, contacts_record_h record
  * @retval  #CONTACTS_ERROR_INVALID_PARAMETER   Invalid parameter
  * @retval  #CONTACTS_ERROR_NO_DATA             Requested data does not exist
  */
-int contacts_list_get_current_record_p(contacts_list_h contacts_list, contacts_record_hrecord);
+int contacts_list_get_current_record_p(contacts_list_h contacts_list, contacts_record_h *record);
 
 /**
  * @brief Moves a contacts list to the previous position.
index dba951a..96edac5 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -19,9 +19,6 @@
 #ifndef __TIZEN_SOCIAL_CONTACTS_PERSON_H__
 #define __TIZEN_SOCIAL_CONTACTS_PERSON_H__
 
-#ifndef API
-#define API __attribute__ ((visibility("default")))
-#endif
 
 #ifdef __cplusplus
 extern "C"
@@ -99,7 +96,7 @@ int contacts_person_link_person(int base_person_id, int person_id);
  *
  * @see  contacts_connect()
  */
-int contacts_person_unlink_contact(int person_id, int contact_id, intunlinked_person_id);
+int contacts_person_unlink_contact(int person_id, int contact_id, int *unlinked_person_id);
 
 /**
  * @brief Resets a person's usage count.
index 6d886ac..2b3f6b0 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -19,9 +19,6 @@
 #ifndef __TIZEN_SOCIAL_CONTACTS_PHONELOG_H__
 #define __TIZEN_SOCIAL_CONTACTS_PHONELOG_H__
 
-#ifndef API
-#define API __attribute__ ((visibility("default")))
-#endif
 
 #ifdef __cplusplus
 extern "C"
index 8a76051..9281527 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -19,9 +19,6 @@
 #ifndef __TIZEN_SOCIAL_CONTACTS_PHONELOG_INTERNAL_H__
 #define __TIZEN_SOCIAL_CONTACTS_PHONELOG_INTERNAL_H__
 
-#ifndef API
-#define API __attribute__ ((visibility("default")))
-#endif
 
 #ifdef __cplusplus
 extern "C"
index b07029b..837470e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -19,9 +19,6 @@
 #ifndef __TIZEN_SOCIAL_CONTACTS_QUERY_H__
 #define __TIZEN_SOCIAL_CONTACTS_QUERY_H__
 
-#ifndef API
-#define API __attribute__ ((visibility("default")))
-#endif
 
 #ifdef __cplusplus
 extern "C"
@@ -67,7 +64,7 @@ extern "C"
  *
  * @see contacts_query_destroy()
  */
-int contacts_query_create(const char* view_uri, contacts_query_h* query);
+int contacts_query_create(const char *view_uri, contacts_query_h *query);
 
 /**
  * @brief Destroys a query.
index b7311f7..3dd0b3a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -19,9 +19,6 @@
 #ifndef __TIZEN_SOCIAL_CONTACTS_RECORD_H__
 #define __TIZEN_SOCIAL_CONTACTS_RECORD_H__
 
-#ifndef API
-#define API __attribute__ ((visibility("default")))
-#endif
 
 #ifdef __cplusplus
 extern "C"
@@ -68,7 +65,7 @@ extern "C"
  *
  * @see contacts_record_destroy()
  */
-int contacts_record_create(const char* view_uri, contacts_record_h* record);
+int contacts_record_create(const char *view_uri, contacts_record_h *record);
 
 /**
  * @brief Destroys a record and releases its all resources.
@@ -108,7 +105,7 @@ int contacts_record_destroy(contacts_record_h record, bool delete_child);
  *
  * @see contacts_record_destroy()
  */
-int contacts_record_clone(contacts_record_h record, contacts_record_hcloned_record);
+int contacts_record_clone(contacts_record_h record, contacts_record_h *cloned_record);
 
 /**
  * @brief Gets a string from the record handle.
@@ -131,7 +128,7 @@ int contacts_record_clone(contacts_record_h record, contacts_record_h* cloned_re
  * @see contacts_record_get_str_p()
  * @see contacts_record_set_str()
  */
-int contacts_record_get_str(contacts_record_h record, unsigned int property_id, char** value);
+int contacts_record_get_str(contacts_record_h record, unsigned int property_id, char **value);
 
 /**
  * @brief Gets a string pointer from the record handle.
@@ -154,7 +151,7 @@ int contacts_record_get_str(contacts_record_h record, unsigned int property_id,
  * @see contacts_record_get_str()
  * @see contacts_record_set_str()
  */
-int contacts_record_get_str_p(contacts_record_h record, unsigned int property_id, char** value);
+int contacts_record_get_str_p(contacts_record_h record, unsigned int property_id, char **value);
 
 /**
  * @brief Sets a string to a record.
@@ -175,7 +172,7 @@ int contacts_record_get_str_p(contacts_record_h record, unsigned int property_id
  * @see contacts_record_get_str()
  * @see contacts_record_get_str_p()
  */
-int contacts_record_set_str(contacts_record_h record, unsigned int property_id, const charvalue);
+int contacts_record_set_str(contacts_record_h record, unsigned int property_id, const char *value);
 
 /**
  * @brief Gets a record's integer value.
@@ -195,7 +192,7 @@ int contacts_record_set_str(contacts_record_h record, unsigned int property_id,
  *
  * @see contacts_record_set_int()
  */
-int contacts_record_get_int(contacts_record_h record, unsigned int property_id, intvalue);
+int contacts_record_get_int(contacts_record_h record, unsigned int property_id, int *value);
 
 /**
  * @brief Sets an integer value to a record.
@@ -422,7 +419,7 @@ int contacts_record_get_child_record_count(contacts_record_h record, unsigned in
  * @see contacts_record_remove_child_record()
  * @see contacts_record_get_child_record_count()
  */
-int contacts_record_get_child_record_at_p(contacts_record_h record, unsigned int property_id, int index, contacts_record_hchild_record);
+int contacts_record_get_child_record_at_p(contacts_record_h record, unsigned int property_id, int index, contacts_record_h *child_record);
 
 /**
  * @brief Clones a child record list of the given parent record.
@@ -444,7 +441,7 @@ int contacts_record_get_child_record_at_p(contacts_record_h record, unsigned int
  *
  * @see contacts_list_destroy()
  */
-int contacts_record_clone_child_record_list(contacts_record_h record, unsigned int property_id, contacts_list_hcloned_list);
+int contacts_record_clone_child_record_list(contacts_record_h record, unsigned int property_id, contacts_list_h *cloned_list);
 
 /**
  * @brief Gets URI string from a record.
@@ -461,7 +458,7 @@ int contacts_record_clone_child_record_list(contacts_record_h record, unsigned i
  * @retval  #CONTACTS_ERROR_INVALID_PARAMETER    Invalid parameter
  * @retval  #CONTACTS_ERROR_NOT_SUPPORTED       Not supported
  */
-int contacts_record_get_uri_p(contacts_record_h record, const char** view_uri);
+int contacts_record_get_uri_p(contacts_record_h record, const char **view_uri);
 
 /**
  * @}
index 42b2891..fa1563b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -19,9 +19,6 @@
 #ifndef __TIZEN_SOCIAL_CONTACTS_SERVICE_H__
 #define __TIZEN_SOCIAL_CONTACTS_SERVICE_H__
 
-#ifndef API
-#define API __attribute__ ((visibility("default")))
-#endif
 
 #ifdef __cplusplus
 extern "C"
index 31ecaba..e834e69 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -19,9 +19,6 @@
 #ifndef __TIZEN_SOCIAL_CONTACTS_SETTING_H__
 #define __TIZEN_SOCIAL_CONTACTS_SETTING_H__
 
-#ifndef API
-#define API __attribute__ ((visibility("default")))
-#endif
 
 #ifdef __cplusplus
 extern "C"
@@ -185,7 +182,7 @@ int contacts_setting_set_name_sorting_order(contacts_name_sorting_order_e name_s
  * @see contacts_setting_add_name_display_order_changed_cb()
  * @see contacts_setting_remove_name_display_order_changed_cb()
  */
-typedef void (*contacts_setting_name_display_order_changed_cb)(contacts_name_display_order_e name_display_order, voiduser_data);
+typedef void (*contacts_setting_name_display_order_changed_cb)(contacts_name_display_order_e name_display_order, void *user_data);
 
 
 /**
@@ -214,7 +211,7 @@ typedef void (*contacts_setting_name_display_order_changed_cb)(contacts_name_dis
  * @see contacts_setting_remove_name_display_order_changed_cb()
  */
 
-int contacts_setting_add_name_display_order_changed_cb(contacts_setting_name_display_order_changed_cb callback, voiduser_data);
+int contacts_setting_add_name_display_order_changed_cb(contacts_setting_name_display_order_changed_cb callback, void *user_data);
 
 /**
  * @brief Unregisters a callback function.
@@ -236,7 +233,7 @@ int contacts_setting_add_name_display_order_changed_cb(contacts_setting_name_dis
  * @see contacts_setting_add_name_display_order_changed_cb()
  */
 
-int contacts_setting_remove_name_display_order_changed_cb(contacts_setting_name_display_order_changed_cb callback, voiduser_data);
+int contacts_setting_remove_name_display_order_changed_cb(contacts_setting_name_display_order_changed_cb callback, void *user_data);
 
 /**
  * @brief Called when a designated view changes.
@@ -251,7 +248,7 @@ int contacts_setting_remove_name_display_order_changed_cb(contacts_setting_name_
  * @see contacts_setting_add_name_sorting_order_changed_cb()
  * @see contacts_setting_remove_name_sorting_order_changed_cb()
  */
-typedef void (*contacts_setting_name_sorting_order_changed_cb)(contacts_name_sorting_order_e name_sorting_order, voiduser_data);
+typedef void (*contacts_setting_name_sorting_order_changed_cb)(contacts_name_sorting_order_e name_sorting_order, void *user_data);
 
 
 /**
@@ -280,7 +277,7 @@ typedef void (*contacts_setting_name_sorting_order_changed_cb)(contacts_name_sor
  * @see contacts_setting_remove_name_sorting_order_changed_cb()
  */
 
-int contacts_setting_add_name_sorting_order_changed_cb(contacts_setting_name_sorting_order_changed_cb callback, voiduser_data);
+int contacts_setting_add_name_sorting_order_changed_cb(contacts_setting_name_sorting_order_changed_cb callback, void *user_data);
 
 /**
  * @brief Unregisters a callback function.
@@ -302,7 +299,7 @@ int contacts_setting_add_name_sorting_order_changed_cb(contacts_setting_name_sor
  * @see contacts_setting_add_name_sorting_order_changed_cb()
  */
 
-int contacts_setting_remove_name_sorting_order_changed_cb(contacts_setting_name_sorting_order_changed_cb callback, voiduser_data);
+int contacts_setting_remove_name_sorting_order_changed_cb(contacts_setting_name_sorting_order_changed_cb callback, void *user_data);
 
 /**
  * @}
index 2b337ae..eb708df 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -19,9 +19,6 @@
 #ifndef __TIZEN_SOCIAL_CONTACTS_SIM_H__
 #define __TIZEN_SOCIAL_CONTACTS_SIM_H__
 
-#ifndef API
-#define API __attribute__ ((visibility("default")))
-#endif
 
 #ifdef __cplusplus
 extern "C"
index bfcb53e..59c7893 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
 #ifndef __TIZEN_SOCIAL_CONTACTS_TYPES_H__
 #define __TIZEN_SOCIAL_CONTACTS_TYPES_H__
 
-#ifndef API
-#define API __attribute__ ((visibility("default")))
-#endif
-
 #ifdef __cplusplus
 extern "C"
 {
 #endif
 
 #define _CONTACTS_BEGIN_VIEW() \
-    typedef struct{ \
+    typedef struct { \
         const char* const _uri;
 #define _CONTACTS_BEGIN_READ_ONLY_VIEW() _CONTACTS_BEGIN_VIEW()
 #define _CONTACTS_PROPERTY_INT(property_id_name)    unsigned int property_id_name;
@@ -59,7 +51,7 @@ extern "C"
 #define _CONTACTS_PROPERTY_PROJECTION_LLI(property_id_name)     unsigned int property_id_name;
 #define _CONTACTS_END_VIEW(name) \
     } name##_property_ids; \
-    extern API const name##_property_ids name;
+    extern __attribute__ ((visibility("default"))) const name##_property_ids name;
 #define _CONTACTS_END_READ_ONLY_VIEW(name) _CONTACTS_END_VIEW(name)
 
 #define _CONTACTS_HANDLE(A) typedef struct __##A{}* A;
@@ -173,7 +165,7 @@ typedef enum {
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
  *
  */
-typedef enum{
+typedef enum {
     CONTACTS_MESSENGER_TYPE_OTHER,      /**< Other messenger type */
     CONTACTS_MESSENGER_TYPE_CUSTOM,     /**< Custom messenger type */
     CONTACTS_MESSENGER_TYPE_GOOGLE,     /**< Google messenger type */
@@ -305,7 +297,7 @@ typedef enum {
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
  *
  */
-typedef enum{
+typedef enum {
     CONTACTS_CONTACT_LINK_MODE_NONE,            /**< Auto link immediately */
     CONTACTS_CONTACT_LINK_MODE_IGNORE_ONCE,     /**< Do not auto link when the contact is inserted */
 }contacts_contact_link_mode_e;
@@ -343,9 +335,9 @@ typedef enum {
  */
 typedef enum {
     CONTACTS_SEARCH_RANGE_NAME = 0x00000001,     /**< Search record from name */
-    CONTACTS_SEARCH_RANGE_NUMBER  = 0x00000002,  /**< Search record from name and number */
-    CONTACTS_SEARCH_RANGE_DATA  = 0x00000004,    /**< Search record from name,number and data */
-    CONTACTS_SEARCH_RANGE_EMAIL  = 0x00000008,   /**< Search record from name,number,data and email. Now, support only _contacts_person_email view_uri*/
+    CONTACTS_SEARCH_RANGE_NUMBER = 0x00000002,  /**< Search record from name and number */
+    CONTACTS_SEARCH_RANGE_DATA = 0x00000004,    /**< Search record from name,number and data */
+    CONTACTS_SEARCH_RANGE_EMAIL = 0x00000008,   /**< Search record from name,number,data and email. Now, support only _contacts_person_email view_uri*/
 }contacts_search_range_e;
 
 /**
index 1f69a7e..8775755 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -19,9 +19,6 @@
 #ifndef __TIZEN_SOCIAL_CONTACTS_VCARD_H__
 #define __TIZEN_SOCIAL_CONTACTS_VCARD_H__
 
-#ifndef API
-#define API __attribute__ ((visibility("default")))
-#endif
 
 #ifdef __cplusplus
 extern "C"
index 83b6179..90289da 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
index 438cafd..1c8c360 100644 (file)
@@ -1,33 +1,33 @@
 Name:       contacts-service
 Summary:    Contacts Service
-Version:    0.13.43
-Release:    1
-Group:      Social & Content/Pim
+Version:    0.13.44
+Release:    0
+Group:      Social & Content/Service
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
-Source1:    contacts-service.service
-Source2:    contacts-service.socket
-BuildRequires:  cmake
-BuildRequires:  pkgconfig(db-util)
-BuildRequires:  pkgconfig(vconf)
-BuildRequires:  pkgconfig(dlog)
-BuildRequires:  pkgconfig(sqlite3)
-BuildRequires:  pkgconfig(tapi)
-BuildRequires:  pkgconfig(glib-2.0)
-BuildRequires:  pkgconfig(capi-base-common)
-BuildRequires:  pkgconfig(capi-media-image-util)
-BuildRequires:  pkgconfig(pims-ipc)
-BuildRequires:  pkgconfig(accounts-svc)
-BuildRequires:  pkgconfig(libexif)
-BuildRequires:  pkgconfig(libsmack)
-BuildRequires:  pkgconfig(libtzplatform-config)
-BuildRequires:  pkgconfig(cynara-client)
-BuildRequires:  pkgconfig(cynara-session)
-BuildRequires:  pkgconfig(cynara-creds-socket)
-BuildRequires:  pkgconfig(capi-system-info)
-BuildRequires:  pkgconfig(icu-uc)
-BuildRequires:  pkgconfig(phonenumber-utils)
-Requires(post): /usr/bin/sqlite3, /bin/chmod, /bin/chown
+Source1:    %{name}.service
+Source2:    %{name}.socket
+Source1001: %{name}.manifest
+BuildRequires: cmake
+BuildRequires: pkgconfig(db-util)
+BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(sqlite3)
+BuildRequires: pkgconfig(tapi)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(capi-base-common)
+BuildRequires: pkgconfig(capi-media-image-util)
+BuildRequires: pkgconfig(pims-ipc)
+BuildRequires: pkgconfig(accounts-svc)
+BuildRequires: pkgconfig(libexif)
+BuildRequires: pkgconfig(libsmack)
+BuildRequires: pkgconfig(libtzplatform-config)
+BuildRequires: pkgconfig(cynara-client)
+BuildRequires: pkgconfig(cynara-session)
+BuildRequires: pkgconfig(cynara-creds-socket)
+BuildRequires: pkgconfig(capi-system-info)
+BuildRequires: pkgconfig(icu-uc)
+BuildRequires: pkgconfig(phonenumber-utils)
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
 
@@ -35,21 +35,24 @@ Requires(postun): /sbin/ldconfig
 Contacts Service Library
 
 %package -n contacts-service2
-Summary:              New Contacts service library
+Summary:       New Contacts service library
 
 %description -n contacts-service2
-New Contact Serivce Library files
+New Contact Serivce 2 Client Library
 
 
 %package -n contacts-service2-devel
-Summary:    New Contacts Service  (devel)
-Requires:   %{name}2 = %{version}-%{release}
+Summary:  New Contacts Service(devel)
+Group:    Social & Content/Development
+Requires: %{name}2 = %{version}-%{release}
 
 %description -n contacts-service2-devel
 New Contacts Service Library (devel) files
 
 %prep
 %setup -q
+chmod g-w %_sourcedir/*
+cp %{SOURCE1001} ./%{name}.manifest
 
 
 %build
@@ -58,10 +61,9 @@ export CXXFLAGS="$CXXFLAGS -DTIZEN_ENGINEER_MODE"
 export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE"
 
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-%cmake . -DTZ_SYS_ETC=%TZ_SYS_ETC \
--DENABLE_LOG_FEATURE:BOOL=ON \
--DMAJORVER=${MAJORVER} \
--DFULLVER=%{version}
+%cmake . -DCMAKE_VERBOSE_MAKEFILE=OFF -DMAJORVER=${MAJORVER} -DFULLVER=%{version} -DBIN_INSTALL_DIR:PATH=%{_bindir} \
+               -DTZ_SYS_ETC=%TZ_SYS_ETC -DENABLE_LOG_FEATURE:BOOL=ON
+
 %__make %{?_smp_mflags}
 
 %install
@@ -76,17 +78,12 @@ mkdir -p %{buildroot}%{_unitdir_user}/sockets.target.wants
 install -m 0644 %SOURCE2 %{buildroot}%{_unitdir_user}/contacts-service.socket
 ln -s ../contacts-service.socket %{buildroot}%{_unitdir_user}/sockets.target.wants/contacts-service.socket
 
-mkdir -p %{buildroot}/usr/share/license
-cp LICENSE.APLv2 %{buildroot}/usr/share/license/contacts-service2
-cp LICENSE.APLv2 %{buildroot}/usr/share/license/contacts-service2-devel
-
-%post -n contacts-service2
-/sbin/ldconfig
+%post -n contacts-service2 -p /sbin/ldconfig
 
-%postun -p /sbin/ldconfig
+%postun -n contacts-service2 -p /sbin/ldconfig
 
 %files -n contacts-service2
-%manifest contacts-service2.manifest
+%manifest %{name}.manifest
 %defattr(-,root,root,-)
 %{_libdir}/libcontacts-service2.so.*
 %{_bindir}/contacts-service-ipcd*
@@ -94,7 +91,8 @@ cp LICENSE.APLv2 %{buildroot}/usr/share/license/contacts-service2-devel
 %{_unitdir_user}/default.target.wants/contacts-service.service
 %{_unitdir_user}/sockets.target.wants/contacts-service.socket
 %{_unitdir_user}/contacts-service.socket
-/usr/share/license/%{name}2
+%license LICENSE.APLv2
+
 
 %files -n contacts-service2-devel
 %defattr(-,root,root,-)
@@ -102,4 +100,5 @@ cp LICENSE.APLv2 %{buildroot}/usr/share/license/contacts-service2-devel
 %{_libdir}/pkgconfig/contacts-service2.pc
 %{_includedir}/contacts-svc/contacts.h
 %{_includedir}/contacts-svc/contacts_*.h
-/usr/share/license/contacts-service2-devel
+%license LICENSE.APLv2
+
old mode 100755 (executable)
new mode 100644 (file)
index bdcedd2..4ad5528
@@ -1,7 +1,7 @@
 --
 -- Contacts Service
 --
--- Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+-- Copyright (c) 2010 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
 --
 -- Contact: Jongwon Lee <gogosing.lee@samsung.com>
 --
index 0331042..1105104 100644 (file)
@@ -3,8 +3,6 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/server)
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/server/db)
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common)
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/ipc)
-LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
-LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/server)
 
 SET(DAEMON contacts-service-ipcd)
 
@@ -148,37 +146,20 @@ SET(SRCS ${SRCS}
 )
 ENDIF(ENABLE_LOG_FEATURE)
 
+pkg_check_modules(daemon_pkgs REQUIRED glib-2.0 pims-ipc sqlite3 tapi capi-media-image-util
+       accounts-svc libexif libsmack cynara-client cynara-session cynara-creds-socket capi-system-info
+       phonenumber-utils vconf db-util libtzplatform-config icu-uc)
+INCLUDE_DIRECTORIES(${daemon_pkgs_INCLUDE_DIRS})
+LINK_DIRECTORIES(${daemon_pkgs_LIBRARY_DIRS})
 
-INCLUDE(FindPkgConfig)
-pkg_check_modules(ctsvc_server_pkgs REQUIRED
-       sqlite3
-       tapi
-       capi-media-image-util
-       accounts-svc
-       libexif
-       libsmack
-       cynara-client
-       cynara-session
-       cynara-creds-socket
-       capi-system-info
-       phonenumber-utils
-)
-
-FOREACH(flag ${ctsvc_server_pkgs_CFLAGS})
-       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE")
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -Wall -g -fPIC -std=c++0x -fPIE")
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
-SET(ctsvc_server_pkgs_LDFLAGS "${pkgs_LDFLAGS} ${ctsvc_server_pkgs_LDFLAGS}")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS} -std=c++0x")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--hash-style=both -pie")
 
 ADD_DEFINITIONS("-D_CONTACTS_IPC_SERVER")
-ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
 
 #cmake_policy(SET CMP0002 OLD)
 ADD_EXECUTABLE(${DAEMON} ${SRCS})
-SET_TARGET_PROPERTIES(${DAEMON} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS})
-TARGET_LINK_LIBRARIES(${DAEMON} ${ctsvc_server_pkgs_LDFLAGS})
+TARGET_LINK_LIBRARIES(${DAEMON} ${daemon_pkgs_LIBRARIES})
 
-INSTALL(TARGETS ${DAEMON} DESTINATION bin)
+INSTALL(TARGETS ${DAEMON} DESTINATION ${BIN_INSTALL_DIR})
index 8fdcad8..f7316aa 100644 (file)
@@ -42,12 +42,11 @@ void ctsvc_ipc_server_connect(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_d
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle() Fail");
+                       ERR("ctsvc_ipc_unmarshal_handle() Fail");
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("There is no indata Fail");
+       } else {
+               ERR("There is no indata Fail");
                ret = CONTACTS_ERROR_SYSTEM;
                goto ERROR_RETURN;
        }
@@ -57,7 +56,7 @@ void ctsvc_ipc_server_connect(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_d
        if (CONTACTS_ERROR_NONE == ret) {
                char *smack = NULL;
                if (0 != pims_ipc_svc_get_smack_label(ipc, &smack))
-                       CTS_ERR("pims_ipc_svc_get_smack_label() Fail()");
+                       ERR("pims_ipc_svc_get_smack_label() Fail()");
                ctsvc_set_client_access_info(ipc, smack);
                free(smack);
        }
@@ -66,19 +65,18 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
 
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto DATA_FREE;
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 DATA_FREE:
        ctsvc_handle_destroy(contact);
@@ -92,7 +90,7 @@ void ctsvc_ipc_server_disconnect(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ip
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
                        ret = CONTACTS_ERROR_IPC;
                        goto ERROR_RETURN;
                }
@@ -104,18 +102,17 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 DATA_FREE:
        ctsvc_handle_destroy(contact);
@@ -132,13 +129,13 @@ void ctsvc_ipc_server_check_permission(pims_ipc_h ipc, pims_ipc_data_h indata,
 
        if (NULL == indata) {
                ret = CONTACTS_ERROR_INVALID_PARAMETER;
-               CTS_ERR("check permission Fail");
+               ERR("check permission Fail");
                goto ERROR_RETURN;
        }
 
        ret = ctsvc_ipc_unmarshal_int(indata, &permission);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+               ERR("ctsvc_ipc_unmarshal_int() Fail");
                goto ERROR_RETURN;
        }
 
@@ -147,7 +144,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 (NULL == *outdata) {
-               CTS_ERR("pims_ipc_data_create() Fail");
+               ERR("pims_ipc_data_create() Fail");
                ctsvc_server_start_timeout();
                return;
        }
@@ -155,7 +152,7 @@ ERROR_RETURN:
        if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                pims_ipc_data_destroy(*outdata);
                *outdata = NULL;
-               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+               ERR("ctsvc_ipc_marshal_int() Fail");
                ctsvc_server_start_timeout();
                return;
        }
@@ -164,7 +161,7 @@ ERROR_RETURN:
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_bool(result, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_bool() Fail");
+                       ERR("ctsvc_ipc_marshal_bool() Fail");
                        ctsvc_server_start_timeout();
                        return;
                }
@@ -182,24 +179,23 @@ void ctsvc_ipc_server_db_insert_record(pims_ipc_h ipc, pims_ipc_data_h indata, p
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
                        ret = CONTACTS_ERROR_IPC;
                        goto ERROR_RETURN;
                }
 
-               ret = ctsvc_ipc_unmarshal_record(indata,&record);
+               ret = ctsvc_ipc_unmarshal_record(indata, &record);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_record() Fail");
+                       ERR("ctsvc_ipc_unmarshal_record() Fail");
                        record = NULL;
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_server_db_insert_record Fail");
+       } else {
+               ERR("ctsvc_ipc_server_db_insert_record() Fail");
                goto ERROR_RETURN;
        }
 
-       if (!ctsvc_have_permission(ipc, ctsvc_required_write_permission(((ctsvc_record_s *)record)->view_uri))) {
+       if (!ctsvc_have_permission(ipc, ctsvc_required_write_permission(((ctsvc_record_s*)record)->view_uri))) {
                ret = CONTACTS_ERROR_PERMISSION_DENIED;
                goto ERROR_RETURN;
        }
@@ -209,13 +205,13 @@ 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 (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
                if (ret == CONTACTS_ERROR_NONE) {
@@ -223,20 +219,19 @@ void ctsvc_ipc_server_db_insert_record(pims_ipc_h ipc, pims_ipc_data_h indata, p
                        if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
                                pims_ipc_data_destroy(*outdata);
                                *outdata = NULL;
-                               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                               ERR("ctsvc_ipc_marshal_int() Fail");
                                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                                goto ERROR_RETURN;
                        }
-                       if (ctsvc_ipc_marshal_int(id,*outdata) != CONTACTS_ERROR_NONE) {
+                       if (ctsvc_ipc_marshal_int(id, *outdata) != CONTACTS_ERROR_NONE) {
                                pims_ipc_data_destroy(*outdata);
-                               CTS_ERR("ctsvc_ipc_marshal Fail");
+                               ERR("ctsvc_ipc_marshal_int() Fail");
                                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                                goto ERROR_RETURN;
                        }
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
        goto DATA_FREE;
 
@@ -244,32 +239,32 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 
 DATA_FREE:
        ctsvc_handle_destroy(contact);
-       contacts_record_destroy(record,true);
+       contacts_record_destroy(record, true);
        ctsvc_server_trim_memory();
        ctsvc_server_start_timeout();
        return;
 }
 
-void ctsvc_ipc_server_db_get_record(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
+void ctsvc_ipc_server_db_get_record(pims_ipc_h ipc, pims_ipc_data_h indata,
+               pims_ipc_data_h *outdata, void *userdata)
 {
        int ret = CONTACTS_ERROR_NONE;
-       charview_uri = NULL;
+       char *view_uri = NULL;
        int id = 0;
        contacts_record_h record = NULL;
        contacts_h contact = NULL;
@@ -277,23 +272,22 @@ void ctsvc_ipc_server_db_get_record(pims_ipc_h ipc, pims_ipc_data_h indata, pims
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
                        ret = CONTACTS_ERROR_IPC;
                        goto ERROR_RETURN;
                }
-               ret = ctsvc_ipc_unmarshal_string(indata,&view_uri);
+               ret = ctsvc_ipc_unmarshal_string(indata, &view_uri);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_string Fail");
+                       ERR("ctsvc_ipc_unmarshal_string Fail");
                        goto ERROR_RETURN;
                }
-               ret = ctsvc_ipc_unmarshal_int(indata,&id);
+               ret = ctsvc_ipc_unmarshal_int(indata, &id);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_server_db_insert_record Fail");
+       } else {
+               ERR("ctsvc_ipc_server_db_insert_record() Fail");
                goto ERROR_RETURN;
        }
 
@@ -302,46 +296,45 @@ void ctsvc_ipc_server_db_get_record(pims_ipc_h ipc, pims_ipc_data_h indata, pims
                goto ERROR_RETURN;
        }
 
-       ret = ctsvc_db_get_record(view_uri,id,&record);
+       ret = ctsvc_db_get_record(view_uri, id, &record);
 
 ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
 
                if (CONTACTS_ERROR_NO_DATA == ret) {
-                       CTS_DBG("no data");
-               }
-               else if (CONTACTS_ERROR_NONE == ret) {
+                       DBG("no data");
+               } else if (CONTACTS_ERROR_NONE == ret) {
                        if (ctsvc_ipc_marshal_record(record, *outdata) != CONTACTS_ERROR_NONE) {
                                pims_ipc_data_destroy(*outdata);
                                *outdata = NULL;
-                               CTS_ERR("ctsvc_ipc_marshal_record Fail");
+                               ERR("ctsvc_ipc_marshal_record() Fail");
                                goto DATA_FREE;
                        }
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 DATA_FREE:
        ctsvc_handle_destroy(contact);
-       contacts_record_destroy(record,true);
-       CONTACTS_FREE(view_uri);
+       contacts_record_destroy(record, true);
+       free(view_uri);
        ctsvc_server_start_timeout();
        return;
 }
 
-void ctsvc_ipc_server_db_update_record(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
+void ctsvc_ipc_server_db_update_record(pims_ipc_h ipc, pims_ipc_data_h indata,
+               pims_ipc_data_h *outdata, void *userdata)
 {
        int ret = CONTACTS_ERROR_NONE;
        contacts_record_h record = NULL;
@@ -350,22 +343,21 @@ void ctsvc_ipc_server_db_update_record(pims_ipc_h ipc, pims_ipc_data_h indata, p
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
                        ret = CONTACTS_ERROR_IPC;
                        goto ERROR_RETURN;
                }
-               ret = ctsvc_ipc_unmarshal_record(indata,&record);
+               ret = ctsvc_ipc_unmarshal_record(indata, &record);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_record() Fail");
+                       ERR("ctsvc_ipc_unmarshal_record() Fail");
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_server_db_insert_record Fail");
+       } else {
+               ERR("ctsvc_ipc_server_db_insert_record() Fail");
                goto ERROR_RETURN;
        }
 
-       if (!ctsvc_have_permission(ipc, ctsvc_required_write_permission(((ctsvc_record_s *)record)->view_uri))) {
+       if (!ctsvc_have_permission(ipc, ctsvc_required_write_permission(((ctsvc_record_s*)record)->view_uri))) {
                ret = CONTACTS_ERROR_PERMISSION_DENIED;
                goto ERROR_RETURN;
        }
@@ -375,13 +367,13 @@ 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 (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
 
@@ -390,7 +382,7 @@ void ctsvc_ipc_server_db_update_record(pims_ipc_h ipc, pims_ipc_data_h indata, p
                        if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
                                pims_ipc_data_destroy(*outdata);
                                *outdata = NULL;
-                               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                               ERR("ctsvc_ipc_marshal_int() Fail");
                                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                                goto ERROR_RETURN;
                        }
@@ -403,54 +395,53 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 DATA_FREE:
        ctsvc_handle_destroy(contact);
-       contacts_record_destroy(record,true);
+       contacts_record_destroy(record, true);
        ctsvc_server_trim_memory();
        ctsvc_server_start_timeout();
        return;
 }
 
-void ctsvc_ipc_server_db_delete_record(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
+void ctsvc_ipc_server_db_delete_record(pims_ipc_h ipc, pims_ipc_data_h indata,
+               pims_ipc_data_h *outdata, void *userdata)
 {
        int ret = CONTACTS_ERROR_NONE;
-       charview_uri = NULL;
+       char *view_uri = NULL;
        int id = 0;
        contacts_h contact = NULL;
 
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
                        ret = CONTACTS_ERROR_IPC;
                        goto ERROR_RETURN;
                }
-               ret = ctsvc_ipc_unmarshal_string(indata,&view_uri);
+               ret = ctsvc_ipc_unmarshal_string(indata, &view_uri);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_record() Fail");
+                       ERR("ctsvc_ipc_unmarshal_record() Fail");
                        goto ERROR_RETURN;
                }
-               ret = ctsvc_ipc_unmarshal_int(indata,&id);
+               ret = ctsvc_ipc_unmarshal_int(indata, &id);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_server_db_insert_record Fail");
+       } else {
+               ERR("ctsvc_ipc_server_db_insert_record() Fail");
                goto ERROR_RETURN;
        }
 
@@ -459,18 +450,18 @@ void ctsvc_ipc_server_db_delete_record(pims_ipc_h ipc, pims_ipc_data_h indata, p
                goto ERROR_RETURN;
        }
 
-       ret = ctsvc_db_delete_record(view_uri,id);
+       ret = ctsvc_db_delete_record(view_uri, id);
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
 
@@ -479,7 +470,7 @@ void ctsvc_ipc_server_db_delete_record(pims_ipc_h ipc, pims_ipc_data_h indata, p
                        if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
                                pims_ipc_data_destroy(*outdata);
                                *outdata = NULL;
-                               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                               ERR("ctsvc_ipc_marshal_int() Fail");
                                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                                goto ERROR_RETURN;
                        }
@@ -492,24 +483,22 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 
 DATA_FREE:
-
        ctsvc_handle_destroy(contact);
-       CONTACTS_FREE(view_uri);
+       free(view_uri);
        ctsvc_server_start_timeout();
        return;
 }
@@ -525,29 +514,28 @@ void ctsvc_ipc_server_db_replace_record(pims_ipc_h ipc, pims_ipc_data_h indata,
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
                        ret = CONTACTS_ERROR_IPC;
                        goto ERROR_RETURN;
                }
 
                ret = ctsvc_ipc_unmarshal_record(indata, &record);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_record() Fail");
+                       ERR("ctsvc_ipc_unmarshal_record() Fail");
                        record = NULL;
                        goto ERROR_RETURN;
                }
                ret = ctsvc_ipc_unmarshal_int(indata, &id);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_server_db_replace_record Fail");
+       } else {
+               ERR("ctsvc_ipc_server_db_replace_record Fail");
                goto ERROR_RETURN;
        }
 
-       if (!ctsvc_have_permission(ipc, ctsvc_required_write_permission(((ctsvc_record_s *)record)->view_uri))) {
+       if (!ctsvc_have_permission(ipc, ctsvc_required_write_permission(((ctsvc_record_s*)record)->view_uri))) {
                ret = CONTACTS_ERROR_PERMISSION_DENIED;
                goto ERROR_RETURN;
        }
@@ -558,14 +546,14 @@ 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 (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
 
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
 
@@ -574,14 +562,13 @@ void ctsvc_ipc_server_db_replace_record(pims_ipc_h ipc, pims_ipc_data_h indata,
                        if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
                                pims_ipc_data_destroy(*outdata);
                                *outdata = NULL;
-                               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                               ERR("ctsvc_ipc_marshal_int() Fail");
                                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                                goto ERROR_RETURN;
                        }
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
        goto DATA_FREE;
 
@@ -589,18 +576,17 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 
 DATA_FREE:
@@ -610,10 +596,11 @@ DATA_FREE:
        return;
 }
 
-void ctsvc_ipc_server_db_get_all_records(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
+void ctsvc_ipc_server_db_get_all_records(pims_ipc_h ipc, pims_ipc_data_h indata,
+               pims_ipc_data_h *outdata, void *userdata)
 {
        int ret = CONTACTS_ERROR_NONE;
-       charview_uri = NULL;
+       char *view_uri = NULL;
        int offset = 0;
        int limit = 0;
        contacts_list_h list = NULL;
@@ -622,29 +609,28 @@ void ctsvc_ipc_server_db_get_all_records(pims_ipc_h ipc, pims_ipc_data_h indata,
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
                        ret = CONTACTS_ERROR_IPC;
                        goto ERROR_RETURN;
                }
 
-               ret = ctsvc_ipc_unmarshal_string(indata,&view_uri);
+               ret = ctsvc_ipc_unmarshal_string(indata, &view_uri);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_record() Fail");
+                       ERR("ctsvc_ipc_unmarshal_record() Fail");
                        goto ERROR_RETURN;
                }
-               ret = ctsvc_ipc_unmarshal_int(indata,&offset);
+               ret = ctsvc_ipc_unmarshal_int(indata, &offset);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
-               ret = ctsvc_ipc_unmarshal_int(indata,&limit);
+               ret = ctsvc_ipc_unmarshal_int(indata, &limit);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_server_db_insert_record Fail");
+       } else {
+               ERR("ctsvc_ipc_server_db_insert_record() Fail");
                goto ERROR_RETURN;
        }
 
@@ -653,36 +639,34 @@ void ctsvc_ipc_server_db_get_all_records(pims_ipc_h ipc, pims_ipc_data_h indata,
                goto ERROR_RETURN;
        }
 
-       ret = ctsvc_db_get_all_records(view_uri,offset,limit,&list);
+       ret = ctsvc_db_get_all_records(view_uri, offset, limit, &list);
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
 
                if (CONTACTS_ERROR_NO_DATA == ret) {
-                       CTS_DBG("no data");
-               }
-               else if (CONTACTS_ERROR_NONE == ret) {
-                       ret = ctsvc_ipc_marshal_list(list,*outdata);
+                       DBG("no data");
+               } else if (CONTACTS_ERROR_NONE == ret) {
+                       ret = ctsvc_ipc_marshal_list(list, *outdata);
 
                        if (ret != CONTACTS_ERROR_NONE) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                goto DATA_FREE;
                        }
                }
 
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 
        goto DATA_FREE;
@@ -691,28 +675,28 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 DATA_FREE:
        ctsvc_handle_destroy(contact);
-       contacts_list_destroy(list,true);
-       CONTACTS_FREE(view_uri);
+       contacts_list_destroy(list, true);
+       free(view_uri);
        ctsvc_server_start_timeout();
        return;
 }
 
-void ctsvc_ipc_server_db_get_records_with_query(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
+void ctsvc_ipc_server_db_get_records_with_query(pims_ipc_h ipc, pims_ipc_data_h indata,
+               pims_ipc_data_h *outdata, void *userdata)
 {
        int ret = CONTACTS_ERROR_NONE;
        contacts_query_h query = NULL;
@@ -724,65 +708,62 @@ void ctsvc_ipc_server_db_get_records_with_query(pims_ipc_h ipc, pims_ipc_data_h
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
 
-               ret = ctsvc_ipc_unmarshal_query(indata,&query);
+               ret = ctsvc_ipc_unmarshal_query(indata, &query);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_record() Fail");
+                       ERR("ctsvc_ipc_unmarshal_record() Fail");
                        goto ERROR_RETURN;
                }
-               ret = ctsvc_ipc_unmarshal_int(indata,&offset);
+               ret = ctsvc_ipc_unmarshal_int(indata, &offset);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
-               ret = ctsvc_ipc_unmarshal_int(indata,&limit);
+               ret = ctsvc_ipc_unmarshal_int(indata, &limit);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_server_db_insert_record Fail");
+       } else {
+               ERR("ctsvc_ipc_server_db_insert_record() Fail");
                goto ERROR_RETURN;
        }
 
-       if (!ctsvc_have_permission(ipc, ctsvc_required_read_permission(((ctsvc_query_s *)query)->view_uri))) {
+       if (!ctsvc_have_permission(ipc, ctsvc_required_read_permission(((ctsvc_query_s*)query)->view_uri))) {
                ret = CONTACTS_ERROR_PERMISSION_DENIED;
                goto ERROR_RETURN;
        }
 
-       ret = ctsvc_db_get_records_with_query(query,offset,limit,&list);
+       ret = ctsvc_db_get_records_with_query(query, offset, limit, &list);
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
 
                if (CONTACTS_ERROR_NO_DATA == ret) {
-                       CTS_DBG("no data");
-               }
-               else if (CONTACTS_ERROR_NONE == ret) {
-                       ret = ctsvc_ipc_marshal_list(list,*outdata);
+                       DBG("no data");
+               } else if (CONTACTS_ERROR_NONE == ret) {
+                       ret = ctsvc_ipc_marshal_list(list, *outdata);
 
                        if (ret != CONTACTS_ERROR_NONE) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                goto DATA_FREE;
                        }
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
        goto DATA_FREE;
 
@@ -790,50 +771,49 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 DATA_FREE:
        ctsvc_handle_destroy(contact);
-       contacts_list_destroy(list,true);
+       contacts_list_destroy(list, true);
        contacts_query_destroy(query);
        ctsvc_server_start_timeout();
        return;
 }
 
 
-void ctsvc_ipc_server_db_get_count(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
+void ctsvc_ipc_server_db_get_count(pims_ipc_h ipc, pims_ipc_data_h indata,
+               pims_ipc_data_h *outdata, void *userdata)
 {
        int ret = CONTACTS_ERROR_NONE;
-       charview_uri = NULL;
+       char *view_uri = NULL;
        int count = 0;
        contacts_h contact = NULL;
 
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
 
-               ret = ctsvc_ipc_unmarshal_string(indata,&view_uri);
+               ret = ctsvc_ipc_unmarshal_string(indata, &view_uri);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_record() Fail");
+                       ERR("ctsvc_ipc_unmarshal_record() Fail");
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_server_db_insert_record Fail");
+       } else {
+               ERR("ctsvc_ipc_server_db_insert_record() Fail");
                goto ERROR_RETURN;
        }
 
@@ -842,35 +822,33 @@ void ctsvc_ipc_server_db_get_count(pims_ipc_h ipc, pims_ipc_data_h indata, pims_
                goto ERROR_RETURN;
        }
 
-       ret = ctsvc_db_get_count(view_uri,&count);
+       ret = ctsvc_db_get_count(view_uri, &count);
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
 
                if (CONTACTS_ERROR_NO_DATA == ret) {
-                       CTS_DBG("no data");
-               }
-               else if (CONTACTS_ERROR_NONE == ret) {
-                       ret = ctsvc_ipc_marshal_int(count,*outdata);
+                       DBG("no data");
+               } else if (CONTACTS_ERROR_NONE == ret) {
+                       ret = ctsvc_ipc_marshal_int(count, *outdata);
 
                        if (ret != CONTACTS_ERROR_NONE) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                goto DATA_FREE;
                        }
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
        goto DATA_FREE;
 
@@ -878,27 +856,27 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 DATA_FREE:
        ctsvc_handle_destroy(contact);
-       CONTACTS_FREE(view_uri);
+       free(view_uri);
        ctsvc_server_start_timeout();
        return;
 }
 
-void ctsvc_ipc_server_db_get_count_with_query(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
+void ctsvc_ipc_server_db_get_count_with_query(pims_ipc_h ipc, pims_ipc_data_h indata,
+               pims_ipc_data_h *outdata, void *userdata)
 {
        int ret = CONTACTS_ERROR_NONE;
        contacts_query_h query = NULL;
@@ -908,55 +886,52 @@ void ctsvc_ipc_server_db_get_count_with_query(pims_ipc_h ipc, pims_ipc_data_h in
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
 
-               ret = ctsvc_ipc_unmarshal_query(indata,&query);
+               ret = ctsvc_ipc_unmarshal_query(indata, &query);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_record() Fail");
+                       ERR("ctsvc_ipc_unmarshal_record() Fail");
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_server_db_insert_record Fail");
+       } else {
+               ERR("ctsvc_ipc_server_db_insert_record() Fail");
                goto ERROR_RETURN;
        }
 
-       if (!ctsvc_have_permission(ipc, ctsvc_required_read_permission(((ctsvc_query_s *)query)->view_uri))) {
+       if (!ctsvc_have_permission(ipc, ctsvc_required_read_permission(((ctsvc_query_s*)query)->view_uri))) {
                ret = CONTACTS_ERROR_PERMISSION_DENIED;
                goto ERROR_RETURN;
        }
 
-       ret = ctsvc_db_get_count_with_query(query,&count);
+       ret = ctsvc_db_get_count_with_query(query, &count);
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
 
                if (CONTACTS_ERROR_NO_DATA == ret) {
-                       CTS_DBG("no data");
-               }
-               else if (CONTACTS_ERROR_NONE == ret) {
-                       ret = ctsvc_ipc_marshal_int(count,*outdata);
+                       DBG("no data");
+               } else if (CONTACTS_ERROR_NONE == ret) {
+                       ret = ctsvc_ipc_marshal_int(count, *outdata);
 
                        if (ret != CONTACTS_ERROR_NONE) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                goto DATA_FREE;
                        }
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
        goto DATA_FREE;
 
@@ -964,18 +939,17 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 DATA_FREE:
        ctsvc_handle_destroy(contact);
@@ -991,24 +965,23 @@ void ctsvc_ipc_server_db_insert_records(pims_ipc_h ipc, pims_ipc_data_h indata,
        contacts_list_h list = NULL;
        int id_count = 0;
        int *ids = NULL;
-       int i=0;
+       int i = 0;
        contacts_h contact = NULL;
 
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
 
-               ret = ctsvc_ipc_unmarshal_list(indata,&list);
+               ret = ctsvc_ipc_unmarshal_list(indata, &list);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_list Fail");
+                       ERR("ctsvc_ipc_unmarshal_list Fail");
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_server_db_insert_record Fail");
+       } else {
+               ERR("ctsvc_ipc_server_db_insert_record() Fail");
                goto ERROR_RETURN;
        }
 
@@ -1018,11 +991,11 @@ void ctsvc_ipc_server_db_insert_records(pims_ipc_h ipc, pims_ipc_data_h indata,
                do {
                        ret = contacts_list_get_current_record_p(list, &record);
                        if (CONTACTS_ERROR_NONE != ret) {
-                               CTS_ERR("contacts_list_get_current_record_p is faild(%d)", ret);
+                               ERR("contacts_list_get_current_record_p() Fail(%d)", ret);
                                goto ERROR_RETURN;
                        }
 
-                       if (!ctsvc_have_permission(ipc, ctsvc_required_write_permission(((ctsvc_record_s *)record)->view_uri))) {
+                       if (!ctsvc_have_permission(ipc, ctsvc_required_write_permission(((ctsvc_record_s*)record)->view_uri))) {
                                ret = CONTACTS_ERROR_PERMISSION_DENIED;
                                goto ERROR_RETURN;
                        }
@@ -1035,13 +1008,13 @@ 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 (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
 
@@ -1050,7 +1023,7 @@ void ctsvc_ipc_server_db_insert_records(pims_ipc_h ipc, pims_ipc_data_h indata,
                        if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
                                pims_ipc_data_destroy(*outdata);
                                *outdata = NULL;
-                               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                               ERR("ctsvc_ipc_marshal_int() Fail");
                                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                                goto ERROR_RETURN;
                        }
@@ -1059,25 +1032,24 @@ void ctsvc_ipc_server_db_insert_records(pims_ipc_h ipc, pims_ipc_data_h indata,
                        if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(id_count, *outdata)) {
                                pims_ipc_data_destroy(*outdata);
                                *outdata = NULL;
-                               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                               ERR("ctsvc_ipc_marshal_int() Fail");
                                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                                goto ERROR_RETURN;
                        }
 
-                       for (i=0;i<id_count;i++) {
+                       for (i = 0; i < id_count; i++) {
                                /* marshal ids */
                                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ids[i], *outdata)) {
                                        pims_ipc_data_destroy(*outdata);
                                        *outdata = NULL;
-                                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                                       ERR("ctsvc_ipc_marshal_int() Fail");
                                        ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                                        goto ERROR_RETURN;
                                }
                        }
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
        goto DATA_FREE;
 
@@ -1085,23 +1057,22 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 DATA_FREE:
        ctsvc_handle_destroy(contact);
-       contacts_list_destroy(list,true);
-       CONTACTS_FREE(ids);
+       contacts_list_destroy(list, true);
+       free(ids);
        ctsvc_server_start_timeout();
        return;
 }
@@ -1116,18 +1087,17 @@ void ctsvc_ipc_server_db_update_records(pims_ipc_h ipc, pims_ipc_data_h indata,
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
 
-               ret = ctsvc_ipc_unmarshal_list(indata,&list);
+               ret = ctsvc_ipc_unmarshal_list(indata, &list);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_list Fail");
+                       ERR("ctsvc_ipc_unmarshal_list Fail");
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_server_db_insert_record Fail");
+       } else {
+               ERR("ctsvc_ipc_server_db_insert_record() Fail");
                goto ERROR_RETURN;
        }
 
@@ -1137,11 +1107,11 @@ void ctsvc_ipc_server_db_update_records(pims_ipc_h ipc, pims_ipc_data_h indata,
                do {
                        ret = contacts_list_get_current_record_p(list, &record);
                        if (CONTACTS_ERROR_NONE != ret) {
-                               CTS_ERR("contacts_list_get_current_record_p is faild(%d)", ret);
+                               ERR("contacts_list_get_current_record_p() Fail(%d)", ret);
                                goto ERROR_RETURN;
                        }
 
-                       if (!ctsvc_have_permission(ipc, ctsvc_required_write_permission(((ctsvc_record_s *)record)->view_uri))) {
+                       if (!ctsvc_have_permission(ipc, ctsvc_required_write_permission(((ctsvc_record_s*)record)->view_uri))) {
                                ret = CONTACTS_ERROR_PERMISSION_DENIED;
                                goto ERROR_RETURN;
                        }
@@ -1154,13 +1124,13 @@ 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 (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
 
@@ -1169,14 +1139,13 @@ void ctsvc_ipc_server_db_update_records(pims_ipc_h ipc, pims_ipc_data_h indata,
                        if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
                                pims_ipc_data_destroy(*outdata);
                                *outdata = NULL;
-                               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                               ERR("ctsvc_ipc_marshal_int() Fail");
                                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                                goto ERROR_RETURN;
                        }
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
        goto DATA_FREE;
 
@@ -1184,22 +1153,21 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 DATA_FREE:
        ctsvc_handle_destroy(contact);
-       contacts_list_destroy(list,true);
+       contacts_list_destroy(list, true);
        ctsvc_server_start_timeout();
        return;
 }
@@ -1217,35 +1185,34 @@ void ctsvc_ipc_server_db_delete_records(pims_ipc_h ipc, pims_ipc_data_h indata,
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
 
-               ret = ctsvc_ipc_unmarshal_string(indata,&uri);
+               ret = ctsvc_ipc_unmarshal_string(indata, &uri);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_string Fail");
+                       ERR("ctsvc_ipc_unmarshal_string Fail");
                        goto ERROR_RETURN;
                }
-               ret = ctsvc_ipc_unmarshal_int(indata,&count);
+               ret = ctsvc_ipc_unmarshal_int(indata, &count);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
-               if (count <=0) {
+               if (count <= 0) {
                        ret = CONTACTS_ERROR_INVALID_PARAMETER;
                        goto ERROR_RETURN;
                }
                ids = (int*)malloc(sizeof(int)*count);
-               for (i=0;i<count;i++) {
-                       ret = ctsvc_ipc_unmarshal_int(indata,&ids[i]);
+               for (i = 0; i < count; i++) {
+                       ret = ctsvc_ipc_unmarshal_int(indata, &ids[i]);
                        if (ret != CONTACTS_ERROR_NONE) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                goto ERROR_RETURN;
                        }
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_server_db_insert_record Fail");
+       } else {
+               ERR("ctsvc_ipc_server_db_insert_record() Fail");
                goto ERROR_RETURN;
        }
 
@@ -1258,13 +1225,13 @@ 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 (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
-               }
+               if (NULL == *outdata)
+                       ERR("pims_ipc_data_create() Fail");
+
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
 
@@ -1273,14 +1240,13 @@ void ctsvc_ipc_server_db_delete_records(pims_ipc_h ipc, pims_ipc_data_h indata,
                        if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
                                pims_ipc_data_destroy(*outdata);
                                *outdata = NULL;
-                               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                               ERR("ctsvc_ipc_marshal_int() Fail");
                                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                                goto ERROR_RETURN;
                        }
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 
        goto DATA_FREE;
@@ -1289,23 +1255,22 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 DATA_FREE:
        ctsvc_handle_destroy(contact);
-       CONTACTS_FREE(uri);
-       CONTACTS_FREE(ids);
+       free(uri);
+       free(ids);
        ctsvc_server_start_timeout();
        return;
 }
@@ -1317,44 +1282,43 @@ void ctsvc_ipc_server_db_replace_records(pims_ipc_h ipc, pims_ipc_data_h indata,
        contacts_list_h list = NULL;
        int count = 0;
        int *ids = NULL;
-       int i=0;
+       int i = 0;
        contacts_h contact = NULL;
 
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
 
                ret = ctsvc_ipc_unmarshal_list(indata, &list);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_list Fail");
+                       ERR("ctsvc_ipc_unmarshal_list Fail");
                        goto ERROR_RETURN;
                }
 
                ret = ctsvc_ipc_unmarshal_int(indata, &count);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
 
-               if (count <=0) {
+               if (count <= 0) {
                        ret = CONTACTS_ERROR_INVALID_PARAMETER;
                        goto ERROR_RETURN;
                }
 
                ids = (int*)malloc(sizeof(int)*count);
-               for (i=0;i<count;i++) {
+               for (i = 0; i < count; i++) {
                        ret = ctsvc_ipc_unmarshal_int(indata, &ids[i]);
                        if (ret != CONTACTS_ERROR_NONE) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                goto ERROR_RETURN;
                        }
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_server_db_repalce_records Fail");
+       } else {
+               ERR("ctsvc_ipc_server_db_repalce_records Fail");
                goto ERROR_RETURN;
        }
 
@@ -1364,11 +1328,11 @@ void ctsvc_ipc_server_db_replace_records(pims_ipc_h ipc, pims_ipc_data_h indata,
                do {
                        ret = contacts_list_get_current_record_p(list, &record);
                        if (CONTACTS_ERROR_NONE != ret) {
-                               CTS_ERR("contacts_list_get_current_record_p is faild(%d)", ret);
+                               ERR("contacts_list_get_current_record_p() Fail(%d)", ret);
                                goto ERROR_RETURN;
                        }
 
-                       if (!ctsvc_have_permission(ipc, ctsvc_required_write_permission(((ctsvc_record_s *)record)->view_uri))) {
+                       if (!ctsvc_have_permission(ipc, ctsvc_required_write_permission(((ctsvc_record_s*)record)->view_uri))) {
                                ret = CONTACTS_ERROR_PERMISSION_DENIED;
                                goto ERROR_RETURN;
                        }
@@ -1381,13 +1345,13 @@ 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 (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
                if (ret == CONTACTS_ERROR_NONE) {
@@ -1395,14 +1359,13 @@ void ctsvc_ipc_server_db_replace_records(pims_ipc_h ipc, pims_ipc_data_h indata,
                        if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
                                pims_ipc_data_destroy(*outdata);
                                *outdata = NULL;
-                               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                               ERR("ctsvc_ipc_marshal_int() Fail");
                                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                                goto ERROR_RETURN;
                        }
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
        goto DATA_FREE;
 
@@ -1410,31 +1373,31 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 DATA_FREE:
        ctsvc_handle_destroy(contact);
-       contacts_list_destroy(list,true);
-       CONTACTS_FREE(ids);
+       contacts_list_destroy(list, true);
+       free(ids);
        ctsvc_server_start_timeout();
        return;
 }
 
-void ctsvc_ipc_server_db_get_changes_by_version(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
+void ctsvc_ipc_server_db_get_changes_by_version(pims_ipc_h ipc, pims_ipc_data_h indata,
+               pims_ipc_data_h *outdata, void *userdata)
 {
        int ret = CONTACTS_ERROR_NONE;
-       charview_uri = NULL;
+       char *view_uri = NULL;
        int address_book_id = 0;
        int contacts_db_version = 0;
        contacts_list_h record_list = NULL;
@@ -1444,28 +1407,27 @@ void ctsvc_ipc_server_db_get_changes_by_version(pims_ipc_h ipc, pims_ipc_data_h
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
 
-               ret = ctsvc_ipc_unmarshal_string(indata,&view_uri);
+               ret = ctsvc_ipc_unmarshal_string(indata, &view_uri);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_string Fail");
+                       ERR("ctsvc_ipc_unmarshal_string Fail");
                        goto ERROR_RETURN;
                }
                ret = ctsvc_ipc_unmarshal_int(indata, &address_book_id);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
-               ret = ctsvc_ipc_unmarshal_int(indata,&contacts_db_version);
+               ret = ctsvc_ipc_unmarshal_int(indata, &contacts_db_version);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_server_db_insert_record Fail");
+       } else {
+               ERR("ctsvc_ipc_server_db_insert_record() Fail");
                goto ERROR_RETURN;
        }
 
@@ -1474,45 +1436,44 @@ void ctsvc_ipc_server_db_get_changes_by_version(pims_ipc_h ipc, pims_ipc_data_h
                goto ERROR_RETURN;
        }
 
-       ret = ctsvc_db_get_changes_by_version(view_uri, address_book_id,contacts_db_version,&record_list,&current_contacts_db_version);
+       ret = ctsvc_db_get_changes_by_version(view_uri, address_book_id, contacts_db_version,
+                       &record_list, &current_contacts_db_version);
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
 
                if (CONTACTS_ERROR_NO_DATA == ret) {
-                       CTS_DBG("no data");
-               }
-               else if (CONTACTS_ERROR_NONE == ret) {
-                       ret = ctsvc_ipc_marshal_list(record_list,*outdata);
+                       DBG("no data");
+               } else if (CONTACTS_ERROR_NONE == ret) {
+                       ret = ctsvc_ipc_marshal_list(record_list, *outdata);
                        if (ret != CONTACTS_ERROR_NONE) {
-                               CTS_ERR("ctsvc_ipc_marshal_list Fail");
+                               ERR("ctsvc_ipc_marshal_list Fail");
                                pims_ipc_data_destroy(*outdata);
                                *outdata = NULL;
                                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                                goto ERROR_RETURN;
                        }
-                       ret = ctsvc_ipc_marshal_int(current_contacts_db_version,*outdata);
+                       ret = ctsvc_ipc_marshal_int(current_contacts_db_version, *outdata);
                        if (ret != CONTACTS_ERROR_NONE) {
-                               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                               ERR("ctsvc_ipc_marshal_int() Fail");
                                pims_ipc_data_destroy(*outdata);
                                *outdata = NULL;
                                ret = CONTACTS_ERROR_OUT_OF_MEMORY;
                                goto ERROR_RETURN;
                        }
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
        goto DATA_FREE;
 
@@ -1520,28 +1481,28 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 DATA_FREE:
        ctsvc_handle_destroy(contact);
-       contacts_list_destroy(record_list,true);
-       CONTACTS_FREE(view_uri);
+       contacts_list_destroy(record_list, true);
+       free(view_uri);
        ctsvc_server_start_timeout();
        return;
 }
 
-void ctsvc_ipc_server_db_get_current_version(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
+void ctsvc_ipc_server_db_get_current_version(pims_ipc_h ipc, pims_ipc_data_h indata,
+               pims_ipc_data_h *outdata, void *userdata)
 {
        int ret = CONTACTS_ERROR_NONE;
        int contacts_db_version = 0;
@@ -1550,7 +1511,7 @@ void ctsvc_ipc_server_db_get_current_version(pims_ipc_h ipc, pims_ipc_data_h ind
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
        }
@@ -1567,29 +1528,27 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
 
                if (CONTACTS_ERROR_NO_DATA == ret) {
-                       CTS_DBG("no data");
-               }
-               else if (CONTACTS_ERROR_NONE == ret) {
-                       ret = ctsvc_ipc_marshal_int(contacts_db_version,*outdata);
+                       DBG("no data");
+               } else if (CONTACTS_ERROR_NONE == ret) {
+                       ret = ctsvc_ipc_marshal_int(contacts_db_version, *outdata);
                        if (ret != CONTACTS_ERROR_NONE) {
-                               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                               ERR("ctsvc_ipc_marshal_int() Fail");
                                goto DATA_FREE;
                        }
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 
 DATA_FREE:
@@ -1598,11 +1557,12 @@ DATA_FREE:
        return;
 }
 
-void ctsvc_ipc_server_db_search_records(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
+void ctsvc_ipc_server_db_search_records(pims_ipc_h ipc, pims_ipc_data_h indata,
+               pims_ipc_data_h *outdata, void *userdata)
 {
        int ret = CONTACTS_ERROR_NONE;
-       charview_uri = NULL;
-       charkeyword = NULL;
+       char *view_uri = NULL;
+       char *keyword = NULL;
        int offset = 0;
        int limit = 0;
        contacts_list_h list = NULL;
@@ -1611,32 +1571,31 @@ void ctsvc_ipc_server_db_search_records(pims_ipc_h ipc, pims_ipc_data_h indata,
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
-               ret = ctsvc_ipc_unmarshal_string(indata,&view_uri);
+               ret = ctsvc_ipc_unmarshal_string(indata, &view_uri);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_record() Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_record() Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
-               ret = ctsvc_ipc_unmarshal_string(indata,&keyword);
+               ret = ctsvc_ipc_unmarshal_string(indata, &keyword);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_record() Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_record() Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
-               ret = ctsvc_ipc_unmarshal_int(indata,&offset);
+               ret = ctsvc_ipc_unmarshal_int(indata, &offset);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_int() Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
-               ret = ctsvc_ipc_unmarshal_int(indata,&limit);
+               ret = ctsvc_ipc_unmarshal_int(indata, &limit);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_int() Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_server_db_insert_record Fail");
+       } else {
+               ERR("ctsvc_ipc_server_db_insert_record() Fail");
                goto ERROR_RETURN;
        }
 
@@ -1645,35 +1604,33 @@ void ctsvc_ipc_server_db_search_records(pims_ipc_h ipc, pims_ipc_data_h indata,
                goto ERROR_RETURN;
        }
 
-       ret = ctsvc_db_search_records(view_uri, keyword, offset,limit,&list);
+       ret = ctsvc_db_search_records(view_uri, keyword, offset, limit, &list);
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
 
                if (CONTACTS_ERROR_NO_DATA == ret) {
-                       CTS_DBG("no data");
-               }
-               else if (CONTACTS_ERROR_NONE == ret) {
-                       ret = ctsvc_ipc_marshal_list(list,*outdata);
+                       DBG("no data");
+               } else if (CONTACTS_ERROR_NONE == ret) {
+                       ret = ctsvc_ipc_marshal_list(list, *outdata);
 
                        if (ret != CONTACTS_ERROR_NONE) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                goto DATA_FREE;
                        }
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
        goto DATA_FREE;
 
@@ -1681,33 +1638,33 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 DATA_FREE:
        ctsvc_handle_destroy(contact);
-       contacts_list_destroy(list,true);
-       CONTACTS_FREE(view_uri);
-       CONTACTS_FREE(keyword);
+       contacts_list_destroy(list, true);
+       free(view_uri);
+       free(keyword);
        ctsvc_server_start_timeout();
        return;
 }
 
-void ctsvc_ipc_server_db_search_records_with_range(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
+void ctsvc_ipc_server_db_search_records_with_range(pims_ipc_h ipc,
+               pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
 {
        int ret = CONTACTS_ERROR_NONE;
-       charview_uri = NULL;
-       charkeyword = NULL;
+       char *view_uri = NULL;
+       char *keyword = NULL;
        int offset = 0;
        int limit = 0;
        int range = 0;
@@ -1717,37 +1674,36 @@ void ctsvc_ipc_server_db_search_records_with_range(pims_ipc_h ipc, pims_ipc_data
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
-               ret = ctsvc_ipc_unmarshal_string(indata,&view_uri);
+               ret = ctsvc_ipc_unmarshal_string(indata, &view_uri);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_record() Fail");
+                       ERR("ctsvc_ipc_unmarshal_record() Fail");
                        goto ERROR_RETURN;
                }
-               ret = ctsvc_ipc_unmarshal_string(indata,&keyword);
+               ret = ctsvc_ipc_unmarshal_string(indata, &keyword);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_record() Fail");
+                       ERR("ctsvc_ipc_unmarshal_record() Fail");
                        goto ERROR_RETURN;
                }
-               ret = ctsvc_ipc_unmarshal_int(indata,&offset);
+               ret = ctsvc_ipc_unmarshal_int(indata, &offset);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
-               ret = ctsvc_ipc_unmarshal_int(indata,&limit);
+               ret = ctsvc_ipc_unmarshal_int(indata, &limit);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
-               ret = ctsvc_ipc_unmarshal_int(indata,&range);
+               ret = ctsvc_ipc_unmarshal_int(indata, &range);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_server_db_insert_record() Fail");
+       } else {
+               ERR("ctsvc_ipc_server_db_insert_record() Fail");
                goto ERROR_RETURN;
        }
 
@@ -1756,35 +1712,34 @@ void ctsvc_ipc_server_db_search_records_with_range(pims_ipc_h ipc, pims_ipc_data
                goto ERROR_RETURN;
        }
 
-       ret = ctsvc_db_search_records_with_range(view_uri, keyword, offset,limit,range, &list);
+       ret = ctsvc_db_search_records_with_range(view_uri, keyword, offset, limit, range,
+                       &list);
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
 
                if (CONTACTS_ERROR_NO_DATA == ret) {
-                       CTS_DBG("no data");
-               }
-               else if (CONTACTS_ERROR_NONE == ret) {
-                       ret = ctsvc_ipc_marshal_list(list,*outdata);
+                       DBG("no data");
+               } else if (CONTACTS_ERROR_NONE == ret) {
+                       ret = ctsvc_ipc_marshal_list(list, *outdata);
 
                        if (ret != CONTACTS_ERROR_NONE) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                goto DATA_FREE;
                        }
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
        goto DATA_FREE;
 
@@ -1792,34 +1747,34 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 
 DATA_FREE:
        ctsvc_handle_destroy(contact);
-       contacts_list_destroy(list,true);
+       contacts_list_destroy(list, true);
        free(view_uri);
        free(keyword);
        ctsvc_server_start_timeout();
        return;
 }
 
-void ctsvc_ipc_server_db_search_records_with_query(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
+void ctsvc_ipc_server_db_search_records_with_query(pims_ipc_h ipc,
+               pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
 {
        int ret = CONTACTS_ERROR_NONE;
        contacts_query_h query = NULL;
-       charkeyword = NULL;
+       char *keyword = NULL;
        int offset = 0;
        int limit = 0;
        contacts_list_h list = NULL;
@@ -1828,71 +1783,68 @@ void ctsvc_ipc_server_db_search_records_with_query(pims_ipc_h ipc, pims_ipc_data
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
-               ret = ctsvc_ipc_unmarshal_query(indata,&query);
+               ret = ctsvc_ipc_unmarshal_query(indata, &query);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_record() Fail");
+                       ERR("ctsvc_ipc_unmarshal_record() Fail");
                        goto ERROR_RETURN;
                }
-               ret = ctsvc_ipc_unmarshal_string(indata,&keyword);
+               ret = ctsvc_ipc_unmarshal_string(indata, &keyword);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_record() Fail");
+                       ERR("ctsvc_ipc_unmarshal_record() Fail");
                        goto ERROR_RETURN;
                }
-               ret = ctsvc_ipc_unmarshal_int(indata,&offset);
+               ret = ctsvc_ipc_unmarshal_int(indata, &offset);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
-               ret = ctsvc_ipc_unmarshal_int(indata,&limit);
+               ret = ctsvc_ipc_unmarshal_int(indata, &limit);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_server_db_insert_record Fail");
+       } else {
+               ERR("ctsvc_ipc_server_db_insert_record() Fail");
                goto ERROR_RETURN;
        }
 
 
-       if (!ctsvc_have_permission(ipc, ctsvc_required_read_permission(((ctsvc_query_s *)query)->view_uri))) {
+       if (!ctsvc_have_permission(ipc, ctsvc_required_read_permission(((ctsvc_query_s*)query)->view_uri))) {
                ret = CONTACTS_ERROR_PERMISSION_DENIED;
                goto ERROR_RETURN;
        }
 
 
-       ret = ctsvc_db_search_records_with_query(query, keyword, offset,limit,&list);
+       ret = ctsvc_db_search_records_with_query(query, keyword, offset, limit, &list);
 
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
 
                if (CONTACTS_ERROR_NO_DATA == ret) {
-                       CTS_DBG("no data");
-               }
-               else if (CONTACTS_ERROR_NONE == ret) {
+                       DBG("no data");
+               } else if (CONTACTS_ERROR_NONE == ret) {
                        ret = ctsvc_ipc_marshal_list(list, *outdata);
 
                        if (ret != CONTACTS_ERROR_NONE) {
-                               CTS_ERR("ctsvc_ipc_marshal_list Fail");
+                               ERR("ctsvc_ipc_marshal_list Fail");
                                goto DATA_FREE;
                        }
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
        goto DATA_FREE;
 
@@ -1900,24 +1852,23 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 DATA_FREE:
        ctsvc_handle_destroy(contact);
-       contacts_list_destroy(list,true);
+       contacts_list_destroy(list, true);
        contacts_query_destroy(query);
-       CONTACTS_FREE(keyword);
+       free(keyword);
        ctsvc_server_start_timeout();
        return;
 }
@@ -1932,7 +1883,7 @@ void ctsvc_ipc_server_db_get_status(pims_ipc_h ipc, pims_ipc_data_h indata,
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
        }
@@ -1943,26 +1894,25 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
 
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
 
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(status, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 DATA_FREE:
        ctsvc_handle_destroy(contact);
index 37ad984..1b45181 100644 (file)
@@ -51,17 +51,16 @@ void ctsvc_ipc_activity_delete_by_contact_id(pims_ipc_h ipc, pims_ipc_data_h ind
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
                ret = ctsvc_ipc_unmarshal_int(indata, &contact_id);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_server_db_insert_record() Fail");
+       } else {
+               ERR("ctsvc_ipc_server_db_insert_record() Fail");
                goto ERROR_RETURN;
        }
 
@@ -77,14 +76,14 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
 
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
 
@@ -93,13 +92,12 @@ ERROR_RETURN:
                        if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
                                pims_ipc_data_destroy(*outdata);
                                *outdata = NULL;
-                               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                               ERR("ctsvc_ipc_marshal_int() Fail");
                                goto DATA_FREE;
                        }
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 DATA_FREE:
        ctsvc_handle_destroy(contact);
@@ -116,17 +114,16 @@ void ctsvc_ipc_activity_delete_by_account_id(pims_ipc_h ipc, pims_ipc_data_h ind
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
                ret = ctsvc_ipc_unmarshal_int(indata, &account_id);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_activity_delete_by_account_id() Fail");
+       } else {
+               ERR("ctsvc_ipc_activity_delete_by_account_id() Fail");
                goto ERROR_RETURN;
        }
 
@@ -141,13 +138,13 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
 
@@ -156,13 +153,12 @@ ERROR_RETURN:
                        if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
                                pims_ipc_data_destroy(*outdata);
                                *outdata = NULL;
-                               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                               ERR("ctsvc_ipc_marshal_int() Fail");
                                goto DATA_FREE;
                        }
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 DATA_FREE:
        ctsvc_handle_destroy(contact);
@@ -180,22 +176,21 @@ void ctsvc_ipc_group_add_contact(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ip
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
                ret = ctsvc_ipc_unmarshal_int(indata, &group_id);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
                ret = ctsvc_ipc_unmarshal_int(indata, &contact_id);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_group_add_contact() Fail");
+       } else {
+               ERR("ctsvc_ipc_group_add_contact() Fail");
                goto ERROR_RETURN;
        }
 
@@ -211,13 +206,13 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
 
@@ -226,13 +221,12 @@ ERROR_RETURN:
                        if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
                                pims_ipc_data_destroy(*outdata);
                                *outdata = NULL;
-                               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                               ERR("ctsvc_ipc_marshal_int() Fail");
                                goto DATA_FREE;
                        }
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 DATA_FREE:
        ctsvc_handle_destroy(contact);
@@ -250,22 +244,21 @@ void ctsvc_ipc_group_remove_contact(pims_ipc_h ipc, pims_ipc_data_h indata, pims
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
                ret = ctsvc_ipc_unmarshal_int(indata, &group_id);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
                ret = ctsvc_ipc_unmarshal_int(indata, &contact_id);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_group_remove_contact() Fail");
+       } else {
+               ERR("ctsvc_ipc_group_remove_contact() Fail");
                goto ERROR_RETURN;
        }
 
@@ -282,13 +275,13 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
                if (ret == CONTACTS_ERROR_NONE) {
@@ -296,14 +289,13 @@ ERROR_RETURN:
                        if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
                                pims_ipc_data_destroy(*outdata);
                                *outdata = NULL;
-                               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                               ERR("ctsvc_ipc_marshal_int() Fail");
                                goto DATA_FREE;
                        }
                }
 
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 DATA_FREE:
        ctsvc_handle_destroy(contact);
@@ -322,27 +314,26 @@ void ctsvc_ipc_group_set_group_order(pims_ipc_h ipc, pims_ipc_data_h indata, pim
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
                ret = ctsvc_ipc_unmarshal_int(indata, &group_id);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
                ret = ctsvc_ipc_unmarshal_int(indata, &previous_group_id);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
                ret = ctsvc_ipc_unmarshal_int(indata, &next_group_id);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_group_link_group() Fail");
+       } else {
+               ERR("ctsvc_ipc_group_link_group() Fail");
                goto ERROR_RETURN;
        }
 
@@ -358,13 +349,13 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
                if (ret == CONTACTS_ERROR_NONE) {
@@ -372,13 +363,12 @@ ERROR_RETURN:
                        if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
                                pims_ipc_data_destroy(*outdata);
                                *outdata = NULL;
-                               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                               ERR("ctsvc_ipc_marshal_int() Fail");
                                goto DATA_FREE;
                        }
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 DATA_FREE:
        ctsvc_handle_destroy(contact);
@@ -396,22 +386,21 @@ void ctsvc_ipc_person_link_person(pims_ipc_h ipc, pims_ipc_data_h indata, pims_i
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
                ret = ctsvc_ipc_unmarshal_int(indata, &base_person_id);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
                ret = ctsvc_ipc_unmarshal_int(indata, &person_id);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_person_link_person() Fail");
+       } else {
+               ERR("ctsvc_ipc_person_link_person() Fail");
                goto ERROR_RETURN;
        }
 
@@ -427,13 +416,13 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
                if (ret == CONTACTS_ERROR_NONE) {
@@ -441,13 +430,12 @@ ERROR_RETURN:
                        if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
                                pims_ipc_data_destroy(*outdata);
                                *outdata = NULL;
-                               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                               ERR("ctsvc_ipc_marshal_int() Fail");
                                goto DATA_FREE;
                        }
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 DATA_FREE:
        ctsvc_handle_destroy(contact);
@@ -464,22 +452,21 @@ void ctsvc_ipc_person_unlink_contact(pims_ipc_h ipc, pims_ipc_data_h indata, pim
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
                ret = ctsvc_ipc_unmarshal_int(indata, &person_id);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
                ret = ctsvc_ipc_unmarshal_int(indata, &contact_id);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_person_link_person() Fail");
+       } else {
+               ERR("ctsvc_ipc_person_link_person() Fail");
                goto ERROR_RETURN;
        }
 
@@ -496,13 +483,13 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
                if (ret == CONTACTS_ERROR_NONE) {
@@ -510,20 +497,19 @@ ERROR_RETURN:
                        if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
                                pims_ipc_data_destroy(*outdata);
                                *outdata = NULL;
-                               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                               ERR("ctsvc_ipc_marshal_int() Fail");
                                goto DATA_FREE;
                        }
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(unlinked_person_id, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
 
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 DATA_FREE:
        ctsvc_handle_destroy(contact);
@@ -540,24 +526,23 @@ void ctsvc_ipc_person_reset_usage(pims_ipc_h ipc, pims_ipc_data_h indata, pims_i
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
                ret = ctsvc_ipc_unmarshal_int(indata, &person_id);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
                int temp = 0;
                ret = ctsvc_ipc_unmarshal_int(indata, &temp);
                type = (int)temp;
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_person_link_person() Fail");
+       } else {
+               ERR("ctsvc_ipc_person_link_person() Fail");
                goto ERROR_RETURN;
        }
 
@@ -573,13 +558,13 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
                if (ret == CONTACTS_ERROR_NONE) {
@@ -587,13 +572,12 @@ ERROR_RETURN:
                        if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
                                pims_ipc_data_destroy(*outdata);
                                *outdata = NULL;
-                               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                               ERR("ctsvc_ipc_marshal_int() Fail");
                                goto DATA_FREE;
                        }
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 DATA_FREE:
        ctsvc_handle_destroy(contact);
@@ -611,27 +595,26 @@ void ctsvc_ipc_person_set_favorite_order(pims_ipc_h ipc, pims_ipc_data_h indata,
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
                ret = ctsvc_ipc_unmarshal_int(indata, &person_id);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
                ret = ctsvc_ipc_unmarshal_int(indata, &previous_person_id);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
                ret = ctsvc_ipc_unmarshal_int(indata, &next_person_id);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_person_link_person() Fail");
+       } else {
+               ERR("ctsvc_ipc_person_link_person() Fail");
                goto ERROR_RETURN;
        }
 
@@ -647,13 +630,13 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
                if (ret == CONTACTS_ERROR_NONE) {
@@ -661,13 +644,12 @@ ERROR_RETURN:
                        if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
                                pims_ipc_data_destroy(*outdata);
                                *outdata = NULL;
-                               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                               ERR("ctsvc_ipc_marshal_int() Fail");
                                goto DATA_FREE;
                        }
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 DATA_FREE:
        ctsvc_handle_destroy(contact);
@@ -686,27 +668,26 @@ void ctsvc_ipc_person_set_default_property(pims_ipc_h ipc, pims_ipc_data_h indat
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
                ret = ctsvc_ipc_unmarshal_int(indata, &person_id);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
                ret = ctsvc_ipc_unmarshal_unsigned_int(indata, &property);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
                ret = ctsvc_ipc_unmarshal_int(indata, &id);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_person_set_default_property() Fail");
+       } else {
+               ERR("ctsvc_ipc_person_set_default_property() Fail");
                goto ERROR_RETURN;
        }
 
@@ -717,13 +698,13 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
                if (ret == CONTACTS_ERROR_NONE) {
@@ -731,13 +712,12 @@ ERROR_RETURN:
                        if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
                                pims_ipc_data_destroy(*outdata);
                                *outdata = NULL;
-                               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                               ERR("ctsvc_ipc_marshal_int() Fail");
                                goto DATA_FREE;
                        }
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 DATA_FREE:
        ctsvc_handle_destroy(contact);
@@ -756,22 +736,21 @@ void ctsvc_ipc_person_get_default_property(pims_ipc_h ipc, pims_ipc_data_h indat
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
                ret = ctsvc_ipc_unmarshal_int(indata, &person_id);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
                ret = ctsvc_ipc_unmarshal_unsigned_int(indata, &op);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_person_get_default_property() Fail");
+       } else {
+               ERR("ctsvc_ipc_person_get_default_property() Fail");
                goto ERROR_RETURN;
        }
 
@@ -787,24 +766,23 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail (return value)");
+                       ERR("ctsvc_ipc_marshal_int() Fail (return value)");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(id, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail (id)");
+                       ERR("ctsvc_ipc_marshal_int() Fail (id)");
                        goto DATA_FREE;
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 DATA_FREE:
        ctsvc_handle_destroy(contact);
@@ -821,7 +799,7 @@ void ctsvc_ipc_phone_log_reset_statistics(pims_ipc_h ipc, pims_ipc_data_h indata
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
        }
@@ -837,13 +815,13 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
                if (ret == CONTACTS_ERROR_NONE) {
@@ -851,13 +829,12 @@ ERROR_RETURN:
                        if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
                                pims_ipc_data_destroy(*outdata);
                                *outdata = NULL;
-                               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                               ERR("ctsvc_ipc_marshal_int() Fail");
                                goto DATA_FREE;
                        }
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 DATA_FREE:
        ctsvc_handle_destroy(contact);
@@ -868,7 +845,7 @@ DATA_FREE:
 void ctsvc_ipc_phone_log_delete(pims_ipc_h ipc, pims_ipc_data_h indata,
                pims_ipc_data_h *outdata, void *userdata)
 {
-       int ret= CONTACTS_ERROR_NONE;
+       int ret = CONTACTS_ERROR_NONE;
        int extra_data1;
        char *number = NULL;
        contacts_phone_log_delete_e op;
@@ -877,25 +854,25 @@ void ctsvc_ipc_phone_log_delete(pims_ipc_h ipc, pims_ipc_data_h indata,
        if (indata) {
                ret = ctsvc_ipc_unmarshal_handle(indata, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret);
+                       ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret);
                        goto ERROR_RETURN;
                }
                ret = ctsvc_ipc_unmarshal_int(indata, (int*)&op);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
-       if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_PHONELOG_WRITE)) {
-               ret = CONTACTS_ERROR_PERMISSION_DENIED;
-               goto ERROR_RETURN;
-       }
+                       if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_PHONELOG_WRITE)) {
+                               ret = CONTACTS_ERROR_PERMISSION_DENIED;
+                               goto ERROR_RETURN;
+                       }
 
                }
 
-               switch(op) {
+               switch (op) {
                case CONTACTS_PHONE_LOG_DELETE_BY_ADDRESS:
                        ret = ctsvc_ipc_unmarshal_string(indata, &number);
                        if (ret != CONTACTS_ERROR_NONE) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_string() Fail");
+                               ERR("ctsvc_ipc_unmarshal_string() Fail");
                                goto ERROR_RETURN;
                        }
                        ret = ctsvc_phone_log_delete(op, number);
@@ -904,13 +881,13 @@ void ctsvc_ipc_phone_log_delete(pims_ipc_h ipc, pims_ipc_data_h indata,
                case CONTACTS_PHONE_LOG_DELETE_BY_EMAIL_EXTRA_DATA1:
                        ret = ctsvc_ipc_unmarshal_int(indata, &extra_data1);
                        if (ret != CONTACTS_ERROR_NONE) {
-                               CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                               ERR("ctsvc_ipc_unmarshal_int() Fail");
                                goto ERROR_RETURN;
                        }
                        ret = ctsvc_phone_log_delete(op, extra_data1);
                        break;
                default:
-                       CTS_ERR("Invalid parameter : the operation is not proper (op : %d)", op);
+                       ERR("the operation is not proper (op : %d)", op);
                        ret = CONTACTS_ERROR_INVALID_PARAMETER;
                        break;
                }
@@ -920,13 +897,13 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        goto DATA_FREE;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        goto DATA_FREE;
                }
                if (ret == CONTACTS_ERROR_NONE) {
@@ -934,7 +911,7 @@ ERROR_RETURN:
                        if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) {
                                pims_ipc_data_destroy(*outdata);
                                *outdata = NULL;
-                               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                               ERR("ctsvc_ipc_marshal_int() Fail");
                                goto DATA_FREE;
                        }
                }
@@ -965,27 +942,26 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        ctsvc_server_start_timeout();
                        return;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail (return value)");
+                       ERR("ctsvc_ipc_marshal_int() Fail (return value)");
                        ctsvc_server_start_timeout();
                        return;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(order, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail (id)");
+                       ERR("ctsvc_ipc_marshal_int() Fail (id)");
                        ctsvc_server_start_timeout();
                        return;
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 
        ctsvc_server_start_timeout();
@@ -1009,26 +985,25 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        ctsvc_server_start_timeout();
                        return;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail (return value)");
+                       ERR("ctsvc_ipc_marshal_int() Fail (return value)");
                        ctsvc_server_start_timeout();
                        return;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(order, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail (id)");
+                       ERR("ctsvc_ipc_marshal_int() Fail (id)");
                        return;
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 
        ctsvc_server_start_timeout();
@@ -1036,7 +1011,7 @@ ERROR_RETURN:
 }
 
 void ctsvc_ipc_setting_set_name_display_order(pims_ipc_h ipc,
-                       pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
+               pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
 {
        int ret = CONTACTS_ERROR_NONE;
        int order;
@@ -1044,12 +1019,11 @@ void ctsvc_ipc_setting_set_name_display_order(pims_ipc_h ipc,
        if (indata) {
                ret = ctsvc_ipc_unmarshal_int(indata, &order);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_person_set_default_property() Fail");
+       } else {
+               ERR("ctsvc_ipc_person_set_default_property() Fail");
                goto ERROR_RETURN;
        }
 
@@ -1064,20 +1038,19 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        ctsvc_server_start_timeout();
                        return;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        ctsvc_server_start_timeout();
                        return;
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 
        ctsvc_server_start_timeout();
@@ -1085,7 +1058,7 @@ ERROR_RETURN:
 }
 
 void ctsvc_ipc_setting_set_name_sorting_order(pims_ipc_h ipc,
-                       pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
+               pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
 {
        int ret = CONTACTS_ERROR_NONE;
        int order;
@@ -1093,12 +1066,11 @@ void ctsvc_ipc_setting_set_name_sorting_order(pims_ipc_h ipc,
        if (indata) {
                ret = ctsvc_ipc_unmarshal_int(indata, &order);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+                       ERR("ctsvc_ipc_unmarshal_int() Fail");
                        goto ERROR_RETURN;
                }
-       }
-       else {
-               CTS_ERR("ctsvc_ipc_person_set_default_property() Fail");
+       } else {
+               ERR("ctsvc_ipc_person_set_default_property() Fail");
                goto ERROR_RETURN;
        }
 
@@ -1113,20 +1085,19 @@ ERROR_RETURN:
        if (outdata) {
                *outdata = pims_ipc_data_create(0);
                if (NULL == *outdata) {
-                       CTS_ERR("pims_ipc_data_create() Fail");
+                       ERR("pims_ipc_data_create() Fail");
                        ctsvc_server_start_timeout();
                        return;
                }
                if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
                        pims_ipc_data_destroy(*outdata);
                        *outdata = NULL;
-                       CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+                       ERR("ctsvc_ipc_marshal_int() Fail");
                        ctsvc_server_start_timeout();
                        return;
                }
-       }
-       else {
-               CTS_ERR("outdata is NULL");
+       } else {
+               ERR("outdata is NULL");
        }
 
        ctsvc_server_start_timeout();
index d529de9..150f240 100644 (file)
 
 void ctsvc_ipc_sim_insert_contact(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
 {
-    return;
+       return;
 }
 
 void ctsvc_ipc_sim_update_contact(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
 {
-    return;
+       return;
 }
 
 void ctsvc_ipc_sim_delete_contact(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_data_h *outdata, void *userdata)
index e1a1342..7ee7a7b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -31,7 +31,7 @@
 
 int ctsvc_get_sort_type_from_language(int language)
 {
-       switch(language) {
+       switch (language) {
        case CTSVC_LANG_CHINESE:
                return CTSVC_SORT_CJK;
        case CTSVC_LANG_JAPANESE:
@@ -126,7 +126,7 @@ int ctsvc_get_name_sort_type(const char *src)
 void ctsvc_extra_normalize(UChar *word, int32_t word_size)
 {
        int i;
-       for (i=0;i<word_size;i++) {
+       for (i = 0; i < word_size; i++) {
                /* FF00 ~ FF60, FFE0~FFE6 : fullwidth -> halfwidth */
                if (CTSVC_COMPARE_BETWEEN((UChar)0xFF00, word[i], (UChar)0xFF60)) {
                        int unicode_value1 = 0;
@@ -134,8 +134,7 @@ void ctsvc_extra_normalize(UChar *word, int32_t word_size)
                        unicode_value1 = 0x0;
                        unicode_value2 = (0xFF & word[i]) + 0x20;
                        word[i] = unicode_value1 << 8 | unicode_value2;
-               }
-               else if (ctsvc_is_hangul(word[i])) {
+               } else if (ctsvc_is_hangul(word[i])) {
                        ctsvc_hangul_compatibility2jamo(&word[i]);
                }
        }
@@ -144,16 +143,15 @@ void ctsvc_extra_normalize(UChar *word, int32_t word_size)
 void ctsvc_extra_index_normalize(UChar *word, int32_t word_size)
 {
        int i;
-       for (i=0;i<word_size;i++) {
-               // FF00 ~ FF60, FFE0~FFE6 : fullwidth -> halfwidth
+       for (i = 0; i < word_size; i++) {
+               /* FF00 ~ FF60, FFE0~FFE6 : fullwidth -> halfwidth */
                if (CTSVC_COMPARE_BETWEEN((UChar)0xFF00, word[i], (UChar)0xFF60)) {
                        int unicode_value1 = 0;
                        int unicode_value2 = 0;
                        unicode_value1 = 0x0;
                        unicode_value2 = (0xFF & word[i]) + 0x20;
                        word[i] = unicode_value1 << 8 | unicode_value2;
-               }
-               else if (ctsvc_is_hangul(word[i])) {
+               } else if (ctsvc_is_hangul(word[i])) {
                        ctsvc_hangul_jamo2compatibility(&word[i]);
                }
        }
@@ -163,7 +161,7 @@ const char *ctsvc_get_language_locale(int lang)
 {
        char *langset = ctsvc_get_langset();
 
-       switch(lang) {
+       switch (lang) {
        case CTSVC_LANG_AZERBAIJAN: /* az, Azerbaijan */
                return "az";
        case CTSVC_LANG_ARABIC: /* ar, Bahrain - Arabic */
@@ -197,15 +195,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 (STRING_EQUAL == strncmp(langset, "hi", strlen("hi"))) {
+               if (STRING_EQUAL == strncmp(langset, "hi", strlen("hi")))
                        return "hi";
-               }
-               else if (STRING_EQUAL == strncmp(langset, "mr", strlen("mr"))) {
+               else if (STRING_EQUAL == strncmp(langset, "mr", strlen("mr")))
                        return "mr";
-               }
-               else if (STRING_EQUAL == strncmp(langset, "ne", strlen("ne"))) {
+               else if (STRING_EQUAL == strncmp(langset, "ne", strlen("ne")))
                        return "ne";
-               }
+
                return "hi";
        case CTSVC_LANG_CROATIAN: /* hr, Bosnia and Herzegovina - Croatian */
                return "hr";
@@ -260,50 +256,49 @@ const char *ctsvc_get_language_locale(int lang)
        case CTSVC_LANG_THAI: /* th_TH, Thai */
                return "th";
        case CTSVC_LANG_BENGALI: /* as, bn */
-               if (STRING_EQUAL == strncmp(langset, "as", strlen("as"))) {
+               if (STRING_EQUAL == strncmp(langset, "as", strlen("as")))
                        return "as";
-               }
                return "bn";
        case CTSVC_LANG_PUNJABI: /* pa, India */
-                       return "pa";
+               return "pa";
        case CTSVC_LANG_MALAYALAM:
-                       return "ml";
+               return "ml";
        case CTSVC_LANG_TELUGU:
-                       return "te";
+               return "te";
        case CTSVC_LANG_TAMIL:
-                       return "ta";
+               return "ta";
        case CTSVC_LANG_ORIYA:
-                       return "or";
+               return "or";
        case CTSVC_LANG_SINHALA:
-                       return "si";
+               return "si";
        case CTSVC_LANG_GUJARATI:
-                       return "gu";
+               return "gu";
        case CTSVC_LANG_KANNADA:
-                       return "kn";
+               return "kn";
        case CTSVC_LANG_LAO:
-                       return "lo";
+               return "lo";
        case CTSVC_LANG_HEBREW:
-                       return "he";
+               return "he";
        case CTSVC_LANG_VIETNAMESE:
-                       return "vi";
+               return "vi";
        case CTSVC_LANG_PERSIAN:
-                       return "fa";
+               return "fa";
        case CTSVC_LANG_UZBEK:
-                       return "uz";
+               return "uz";
        case CTSVC_LANG_URDU:
-                       return "ur";
+               return "ur";
        case CTSVC_LANG_ALBANIAN:
-                       return "sq";
+               return "sq";
        case CTSVC_LANG_BURMESE:
-                       return "my";
+               return "my";
        case CTSVC_LANG_MALAY:
-                       return "ms";
+               return "ms";
        case CTSVC_LANG_KHMER:
-                       return "km";
+               return "km";
        case CTSVC_LANG_INDONESIAN:
-                       return "id";
+               return "id";
        case CTSVC_LANG_TAGALOG:
-                       return "tl";
+               return "tl";
        }
 
        return "";
index eb5be83..80581f8 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
index 690103a..5f7bf54 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -19,7 +19,6 @@
 #include <unicode/uchar.h>
 #include <unicode/ustring.h>
 
-
 #include "ctsvc_internal.h"
 #include "ctsvc_localize_ch.h"
 #include "ctsvc_localize_utils.h"
 #define CHINESE_UNICODE_END                                    0x9FA5
 
 static const char* const pinyin_spell_table[] = {
-       "yi","ding|zheng","kao|qiao|yu","qi","shang","xia","mo","wan|mo","zhang","san",
-       "shang","xia","qi|ji","bu|fou","yu","mian","gai","chou","chou","zhuan",
-       "qie|ju","pi","shi","shi","qiu","bing","ye","cong","dong","si",
-       "cheng","diu","qiu","liang","diu","you","liang","yan","bing","sang",
-       "gun","jiu","ge","ya","pan","zhong","ji","jie","feng","guan|kuang",
-       "chuan","chan","lin","zhuo","zhu","ba","wan","dan","wei","zhu",
-       "jing","li","ju","pie","fu","yi|ji","yi","nai","wu","jiu",
-       "jiu","tuo|zhe","me|yao|mB","yi","ho","zhi","wu","zha","hu","fa",
-       "le|yue","yin","ping","pang","qiao","hu","guai","cheng|sheng","cheng|sheng","yi",
-       "hao","zhe","mie|nie","jiu","qi","ye","xi","xiang","gai","jiu",
-       "hal","hol","shu","dou","shi","ji","nang","kal","keol","tol",
-       "mol","ol","mai","luan","cal","ru","xue","yan","phoi","sha",
-       "na","qian","sol","er","zu","ceor","qian|gan","zhi|luan","gui","qian",
-       "luan","lin","yi","jue","liao|le","ma","yu","zheng","shi","shi",
-       "er","chu","yu","kui","yu","yun","hu","qi","wu","jing",
-       "si","sui","gen","gen","ya","xie|suo","ya","qi|zhai","ya","ji|qi",
-       "tou","wang|wu","kang","da","jiao","hai","yi","chan","heng|peng","mu",
-       "ye","xiang","jing","ting","liang","xiang","jing","ye","qin|qing","bo",
-       "you","xie","dan","lian","duo","wei|men","ren","ren","ji","ji",
-       "wang","yi","shi|shen","ren","le","ding","ze","jin","pu","chou|qiu",
-       "ba","zhang","jin","jie","bing","reng","cong|zong","fo","jin|san","lun",
-       "bing","cang","zi|zai","shi","ta","zhang","fu","xian","xian","tuo|cha|duo",
-       "hong","tong","ren","qian","gan|han","yi|ge","bo","dai","ling","yi",
-       "chao","chang|zhang","sa","chang","yi","mu","men","ren","fan","chao|miao",
-       "yang|ang","qian","zhong","pi","wo","wu","jian","jia|jie","yao|fo","feng",
-       "cang","ren","wang","fen|bin","di","fang","zhong","qi","pei","yu",
-       "diao","dun","wen","yi","xin","kang","yi","ji","ai","wu",
-       "ji|qi","fu","fa","xiu|xu","jin","pi","dan","fu","tang","zhong",
-       "you","huo","hui|kuai","yu","cui","yun","san","wei","chuan|zhuan","che|ju",
-       "ya","qian","shang","chang","lun","cang|chen","xun","xin","wei","zhu",
-       "chi","xian|xuan","nu","bo|bai|ba","gu","ni","ni","xie","ban","xu",
-       "ling","zhou","shen","qu","si|ci","peng","si|shi","qie|jia|ga","pi","zhi",
-       "si","yi|chi","zheng","dian|tian","han|gan","mai","dan","zhu","bu","qu",
-       "bi","zhao|shao","ci","wei","di","zhu","zuo","you","yang","ti|ben",
-       "zhan|dian","he","bi","tuo","she","yu","yi|die","fo|fu|bi|bo","zuo","gou|kou",
-       "ning","tong","ni","xian","qu","yong","wa","qian","shi","ka",
-       "bao","pei","hui|huai","ge","lao","xiang","ge","yang","bai","fa",
-       "ming","jia","er|nai","bing","ji","hen","huo","gui","quan","tiao",
-       "jiao","ci","yi","shi","xing","shen","tuo","kan","zhi","gai",
-       "lai","yi","chi","kua","gong","li","yin","shi","mi","zhu",
-       "xu","you","an","lu","mou","er","lun","dong|tong","cha","chi",
-       "xun","gong","zhou","yi","ru","cun","xia","si","dai","lv",
-       "ta","jiao|yao","zhen","ce|ze|zhai","qiao","kuai","chai","ning","nong","jin",
-       "wu","hou","jiong","cheng|ting","zhen","zuo","hao","qin","lv","jv",
-       "shu|dou","ting","shen","tuo|tui","bo","nan","xiao","bian|pian","tui","yu",
-       "xi","cu","e","qiu","xu","guang","ku","wu","jun","yi",
-       "fu","liang","zu","qiao|xiao","li","yong","hun","jing","qian","san",
-       "pei","su","fu","xi","li","fu","ping","bao","yu|shu","si|qi",
-       "xia","xin|shen","xiu","yu","di","che|ju","chou","zhi","yan","liang|lia",
-       "li","lai","si","jian","xiu","fu","huo","ju","xiao","pai",
-       "jian","biao","chu|ti","fei","feng","ya","an","bei","yu","xin",
-       "bi","hu|chi","chang","zhi","bing","jiu","yao","cui|zu","liang|lia","wan",
-       "lai","cang","zong","ge","guan","bei","tian","shu","shu","men",
-       "dao","tan","jue","chui","xing","peng","tang|chang","hou","yi","qi",
-       "ti","gan","liang|jing","jie","sui","chang","jie","fang","zhi","kong",
-       "juan","zong","ju","qian","ni","lun","zhuo","wo|wei","luo","song",
-       "leng","hun","dong","zi","ben","wu","ju","nai","cai","jian",
-       "zhai","ye","zhi","sha","qing","ning","ying","cheng|chen","qian","yan",
-       "ruan","zhong|tong","chun","jia","ji|jie","wei","yu","bing","ruo","ti",
-       "wei","pian","yan","feng","tang|dang","wo","e","xie","che","sheng",
-       "kan","di","zuo","cha","ting","bei","xie","huang","yao","zhan",
-       "chou|qiao","an","you","jian","xu","zha","ci","fu","bi","zhi",
-       "zong","mian","ji","yi","xie","xun","cai|si","duan","ce|ze|zhai","zhen",
-       "ou","tou","tou","bei","zan|za|zBn","lv|lou","jie","wei","fen","chang",
-       "kui|gui","sou","zhi|si","su","xia","fu","yuan","rong","li","nu",
-       "yun","jiang|gou","ma","bang","dian","tang","hao","jie","xi","shan",
-       "qian|jian","que|jue","cang|chen","chu","san","bei","xiao","rong","yao","ta|tan",
-       "suo","yang","fa","bing","jia","dai","zai","tang","gu","bin",
-       "chu","nuo","can","lei","cui","yong","zao|cao","zong","peng","song",
-       "ao","chuan|zhuan","yu","zhai","qi|cou","shang","chuang","jing","chi","sha",
-       "han","zhang","qing","yan","di","xie","lv|lou","bei","piao|biao","jin",
-       "lian","lu","man","qian","xian","tan","ying","dong","zhuan","xiang",
-       "shan","qiao","jiong","tui","zun","pu","xi","lao","chang","guang",
-       "liao","qi","cheng|deng","zhan|zhuan|chan","wei","ji","bo","hui","chuan","tie|jian",
-       "dan","jiao|yao","jiu","seng","fen","xian","yu|ju","e|wu","jiao","jian",
-       "tong|zhuang","lin","bo","gu","xian","su","xian","jiang","min","ye",
-       "jin","jia|jie","qiao","pi","feng","zhou","ai","sai","yi","jun",
-       "nong","chan|tan|shan","yi","dang","jing","xuan","kuai","jian","chu","dan",
-       "jiao","sha","zai","can","bin","an","ru","tai","chou","chai",
-       "lan","ni|yi","jin","qian","meng","wu","ning","qiong","ni","chang",
-       "lie","lei","lv","kuang","bao","yu","biao","zan","zhi","si",
-       "you","hao","qing","chen","li","teng","wei","long","chu","chan",
-       "rang|xiang","shu","hui|xie","li","luo","zan","nuo","tang","yan","lei",
-       "nang","er","wu","yun","zan","yuan","xiong","chong","zhao","xiong",
-       "xian","guang","dui|rui|yue","ke","dui|rui|yue","mian","tu","chang|zhang","er","dui|rui|yue",
-       "er|ni","jin","tu","si","yan","yan","shi","shike","dang","qibnke",
-       "dou","gongfenPPPU","hboke","shen","dou","baike","jing","gongli","huang","ru",
-       "wang","nei","quan","liang","yu|shu","ba","gong","liu|lu","xi","han",
-       "lan","gong","tian","guan","xing","bing","qi|ji","ju","dian","zi|ci",
-       "bun","yang","jian","shou","ji","yi","ji","chan","jiong","mao",
-       "ran","nei|na","yuan","mao","gang","ran","ce","jiong","ce","zai",
-       "gua","jiong","mao","zhou","mao|mo","gou","xu","mian","mi","rong",
-       "yin|you","xie","kan","jun","nong","yi","shen","shi","guan","meng",
-       "zhong","zui","yuan","ming","kou","lin","fu","xie","mi","bing",
-       "dong","tai","gang","feng|ping","bing","hu","chong","jue","ya","kuang",
-       "ye","leng","pan","fa","min","dong","xian","lie","qia","jian",
-       "jing|cheng","sou","mei","tu","qi","gu","zhun","song","jing|cheng","liang",
-       "qing","diao","ling","dong","gan","jian","yin","cou","ai","li",
-       "cang","ming","zhun","cui","si","duo","jin","lin","lin","ning",
-       "xi","du","ji","fan","fan","fan","feng","ju","chu","yi kB|yi kB no bo li|tB ko",
-       "feng","mu","zhi","fu","feng","ping","feng","kai","huang","kai",
-       "gan","deng","ping","kan|qian","xiong","kuai","tu","ao|wa","chu","ji",
-       "dang","han","han","zao","dao","diao","dao","ren","ren","chuang",
-       "fen","qie","yi","ji","kan","qian","cun","chu","wen","ji",
-       "dan","xing","hua","wan","jue","li","yue","lie","liu","ze",
-       "gang","chuang","fu","chu","qu","diao","shan","min","ling","zhong",
-       "pan","bie","jie","jie","pao|bao","li","shan","bie","chan","jing",
-       "gua","geng","dao","chuang","kui","ku","duo","er","zhi","shua",
-       "quan|xuan","cha|sha","ci","ke","jie","gui","ci","gui","kai","duo",
-       "ji","ti","jing","dou","luo","ze","yuan","cuo","xiao|xue","kei|ke",
-       "la","qian","cha|sha","chuang","gua","jian","cuo","li","ti","fei",
-       "pou","chan","qi","chuang","zi","gang","wan","bao|bo","ji","duo",
-       "qing","yan|shan","du|zhuo","jian","ji","bao|bo","yan","ju","huo","sheng",
-       "jian","duo","zhi|duan","wu","gua","fu|pi","sheng","jian","ge","da|zha",
-       "kai","chuang","chuan","chan","tuan|zhuan","lu|jiu","li","peng","shan","piao",
-       "kou","jiao|chao","gua","qiao","jue","hua","zha","zhuo","lian","ju",
-       "pi","liu","gui","jiao|chao","gui","jian","jian","tang","huo","ji",
-       "jian","yi","jian","zhi","chan","zuan","mo","li","zhu","li",
-       "ya","quan","ban","gong","jia","wu","mai","lie","jin|jing","keng",
-       "xie|lie","zhi","dong","zhu|chu","nu","jie","qu","shao","yi","zhu",
-       "miao","li","jin|jing","lao","lao","juan","kou","yang","wa","xiao",
-       "mou","kuang","jie","lie","he","shi","ke","jin|jing","gao","bo|bei",
-       "min","chi","lang","yong","yong","mian","ke","xun","juan","qing",
-       "lu","bu","meng","chi","le|lei","kai","mian","dong","xu","xu",
-       "kan","wu","yi","xun","weng|yang","sheng","lao","mu","lu","piao",
-       "shi","ji","qin","jiang","jiao|chao","quan","xiang","yi","qiao","fan",
-       "juan","tong|dong","ju","dan","xie","mai","xun","xun","lv","li",
-       "che","rang|xiang","quan","bao","shao","yun","jiu","bao","gou","wu",
-       "yun","mo","xiong","gai","gai","bao","cong","yi","xiong","peng",
-       "ju","tao|yao","ge","pu","e","pao","fu","gong","da","jiu",
-       "gong","bi","hua","bei","nao","chi|shi","fang","jiu","yi","za",
-       "jiang","kang","jiang","kuang","hu","xia","qu","fan","gui","qie",
-       "zang|cang","kuang","fei","hu","yu","gui","kui|gui","hui","dan","kui|gui",
-       "lian","lian","suan","du","jiu","jue","xi","pi","qu|ou","yi",
-       "ke|qia","yan","bian","ni","qu|ou","shi","xun","qian","nian","sa",
-       "zu","sheng","wu","hui","ban","shi","xi","wan","hua","xie",
-       "wan","bei","zu|cu","zhuo","xie","dan|shan|chan","mai","nan|na","dan","ji",
-       "bo","shuai|lv","bu|bo","guan|kuang","bian","bu","zhan","qia|ka","lu","you",
-       "lu","xi","gua","wo","xie","jie","jie","wei","yang|ang","qiong",
-       "zhi","mao","yin","wei","shao","ji","que","luan","chi","juan",
-       "xie","xu","jin","que","wu","ji","e","qing","xi","san",
-       "chang|an|han","wei","e","ting","li","zhe|zhai","han|an","li","ya","ya",
-       "yan","she","di","zha|zhai","pang","ya","qie","ya","zhi|shi","ce",
-       "mang","ti","li","she","hou","ting","zui","cuo","fei","yuan",
-       "ce","yuan","xiang","yan","li","jue","sha|xia","dian","chu","jiu",
-       "jin","ao","gui","yan","si","li","chang","qian|lan","li","yan",
-       "yan","yuan","si|mou","gong|hong","lin|miao","rou|qiu","qu","qu","ke","lei",
-       "du","xian|xuan","zhuan","san","can|shen|cen|san","can|shen|cen|san","can|shen|cen|san","can|shen|cen|san","ai|yi","dai",
-       "you","cha","ji","you","shuang","fan","shou","guai","ba","fa",
-       "ruo","li","shu","zhuo|yi|li|jue","qu","shou","bian","xu","jia","pan",
-       "sou","ji","wei|yu","sou","die","rui","cong","kou","gu","ju|gou",
-       "ling","gua","tao|dao","kou","zhi","jiao","zhao|shao","ba","ding","ke",
-       "tai","chi","shi","you","qiu","po","ye|xie","hao","si","tan",
-       "chi","le","diao","ji","dug","hong","mie","xu|yu","mang","chi",
-       "ge","xuan|song","yao","zi","he|ge","ji","diao","dou|cun","tong","ming",
-       "hou","li","tu","xiang","zha","xia|he","ye","lv","a","ma|mB",
-       "ou","huo","yi","jun","chou","lin","tun","yin","fei","pi|bi",
-       "qin","qin","jie|ge","bu","fou|pi","ba","dun","fen","e|hua","han",
-       "ting","hang|keng","shun","qi","hong","zhi|zi","yin|shen","wu","wu","chao",
-       "na|ne","xue|chuo|jue","xi","chui","dou|ru","wen","hou","hou|hong|ou","wu|yu","gao",
-       "ya|yB","jun","lv","e","ge","wen","dai","qi","cheng","wu",
-       "gao","fu","jiao","hong","chi","sheng","na|ne","tun|tian","fu|?","yi",
-       "dai","ou","li","bei|bai","yuan|yun","wai|he|wo|wa|gua|guo","hua|qi","qiang","wu","e",
-       "shi","juan","pen","wen|min","ne","mou|m","ling","ran","you","di",
-       "zhou","shi","zhou","tie|che","xi","yi","qi|zhi","ping","zi|ci","gua|gu",
-       "zi|ci","wei","xu|hou|gou","he|a|ke","nao","xia","pei","yi","xiao|hao","shen",
-       "hu","ming","da|dan","qu","ju|zui","xian|gan","za","tuo","duo","pou",
-       "pao","bi","fu","yang","he","zha|za","he|huo|hu","hai","jiu","yong",
-       "fu","da","zhou","wa","ka","gu","ka|ga","zuo","bu","long",
-       "dong","ning","tuo","si","xian","huo","qi","er","e","guang",
-       "zha","die|xi","yi","lie","zi","mie","mi","zhi","yao","ji|xi|qia",
-       "zhou","ka|luo|lo|ge","shu|xun","zan|za|zBn","xiao","ke|hai","hui","kua","huai|shi","tao",
-       "xian","e|an","xuan","xiu","wai|he|wo|wa|gua|guo","yan|ye","lao","yi","ai","pin",
-       "shen","tong","hong","xiong","duo","wa|wB","ha","zai","you","die|di",
-       "pai","xiang","ai","gen|hen","kuang","ya","da","xiao","bi","yue|hui",
-       "nian","hua","xing","kuai","duo","po","ji|jie|zhai","nong","mou","yo",
-       "hao","yuan|yun","long","pou","mang","ge","o","chi","shao","li",
-       "na|nei|nB|ne","zu","he","ku","xiao","xian","lao","po|ba|bo","zhe","zha",
-       "liang|lang","ba","mie","lie|lv","sui","fu","bu","han","heng|hng","geng",
-       "chuo|yue","ge|jia","you","yan","gu","gu","bei|bai","han","suo","chun",
-       "yi","ai","jia|qian","tu","dan|xian|yan","wan","li","xi","tang","zuo",
-       "qiu","che","wu","zao","ya","dou","qi","di","qin","ma",
-       "ma","gong|hong","dou","ge","lao","liang","suo","zao","huan","leng",
-       "sha|shB","ji","zu","wo|wei","feng","jin|yin","hu|xia","qi","shou","wei",
-       "shua","chang","er|wa","li","qiang","an","jie|ze|zuo","yo","nian","yu",
-       "tian","lai","sha","xi","tuo","hu","ai","zhou|zhao|tiao","gou","ken",
-       "zhuo","zhuo|zhao","shang","di","heng","lan|lin","a","cai","qiang","zhun|tun|xiang|dui",
-       "wu","wen","cui|qi","sha|jie|die|ti","gu","qi","qi","tao","dan","dan",
-       "yue|wa","zi|ci","bi|tu","cui","chuo|chuai","he","ya","qi","zhe","fei",
-       "liang","xian","pi","sha","lB|la","ze","qing|ying","gua","pa","ze|shi",
-       "se","zhuan","nie","guo","luo","yan","di","quan","tan|chan|tuo","bo",
-       "ding","lang","xiao","ju","tang","chi","ti","an","jiu","dan",
-       "ka","yong","wei","nan","shan","yu","zhe","la","jie","hou",
-       "han","die|zha","zhou","chai","wai","nuo|re","huo|guo|xu","yin","zan|za|zBn","yao",
-       "o|wo","mian","hu","yun","chuan","hui","huan","huan|yuan|xuan|he","xi","he|ye",
-       "ji","kui","zhong|chuang","wei","sha","xu","huang","duo|zha","yan","xuan",
-       "liang","yu","sang","chi","qiao|jiao","yan","dan|shan|chan","pen|ben","can|sun|qi","li",
-       "yo","zha|cha","wei","miao","ying","pen","pbo","kui","xi","yu",
-       "jie","lou","ku","zao|qiao","hu","ti","yao","he|xiao|hu","sha|a","xiu",
-       "qiang","se","yong","su","gong|hong","xie","yi|ai","suo","ma|mB","cha",
-       "hai","ke","ta|da","sang","chen","ru","sou","wa|gu","ji","beng|pang",
-       "wu","xian|qian|qie","shi","ge","zi","jie","lao","weng","wa","si",
-       "chi","hao","suo","jia","hai|hei","suo","qin","nie","he","zi",
-       "sai","ng","ge","na","dia","ai","qiang","tong","bi","ao",
-       "ao","lian","zui|sui","zhe|zhu","mo","sou","sou","tan","di","qi",
-       "jiao","chong","jiao|dao","kai|ge","tan","shan|can","cao","jia","ai","xiao",
-       "piao","lou","ga","gu","xiao|jiao","hu","hui","guo","ou","xian",
-       "ze","chang","xu|shi","po","de|dei","ma","ma","hu","le","du",
-       "ga","tang","ye","beng","ying","sai","jiao","mi","xiao","hua",
-       "mai","ran","zuo","peng","lao","xiao","ji","zhu","chao|zhao","kui",
-       "zui","xiao","si","hao","fu|?","liao","qiao","xi","chu|xu|shou","tan|chan",
-       "dan|tan","hei|mo","xun","e","zun","fan|bo","chi","hui","zan","chuang",
-       "cu|za|he","dan","jue","tun|kuo","ceng","jiao","ye","xi","qi","hao",
-       "lian","xu|shi","deng","hui","yin","pu","jue","qin","xun","nie",
-       "lu","si","yan","ying","da","zhan","o","zhou|zhuo","jin","nong",
-       "yue|hui","xie","qi","e","zao","yi","shi","jiao|qiao|chi","yuan","ai",
-       "yong","jue|xue","kuai","yu","pen","dao","ga","xin|hen","dun","dang",
-       "xin","sai","pi","pi","yin","zui","ning","di","lan","ta",
-       "huo|o","ru","hao","he|xia","yan","duo","xiu|pi","zhou|chou","ji|jie|zhai","jin",
-       "hao","ti","chang","xun","me","ca|cha","ti","lu","hui","bo|pao|bao",
-       "you","nie","yin","hu","mei|me|mo","hong","zhe","li","liu","xie|hai",
-       "nang","xiao","mo","yan","li","lu","long","po","dan","chen",
-       "pin","pi","xiang","huo","me","xi","duo","ku","yan","chan",
-       "ying","rang","dian","la","ta","xiao","jiao|jue","chuo","huan","huo",
-       "zhuan","nie","xiao","ca","li","chan","chai","li","yi","luo",
-       "nang","za|zan|can","su","xi","zeng","jian","yan|za|nie","zhu","lan","nie",
-       "nang","ramo","luo","wei|guo","hui","yin","qiu","si","nin","jian|nan",
-       "hui","xin","yin","nan","tuan","tuan","dun|tun","kang","yuan","jiong",
-       "pian","yun","cong","hu","hui","yuan","e","guo","kun","cong",
-       "wei|tong","tu","wei","lun","guo","qun","ri","ling","gu","guo",
-       "tai","guo","tu","you","guo","yin","hun","pu","yu","han",
-       "yuan","lun","quan|juan","yu","qing","guo","chuan|chui","wei","yuan","quan|juan",
-       "ku","pu","yuan","yuan","ya","tuan","tu","tu","tuan","lve",
-       "hui","yi","huan|yuan","luan","luan","tu","ya","tu","ting","sheng",
-       "pu","lu","kuai","ya","zai","wei|xu","ge","yu|zhun","wu","gui",
-       "pi","yi","di|de","qian|su","qian","zhen","zhuo","dang","qia","xia",
-       "shan","kuang","chang","qi|yin","nie","mo","ji","jia","zhi","zhi",
-       "ban","xun","yi","qin","mei|fen","jun","rong|keng","tun|dun","fang","ben|fen",
-       "ben","tan","kan","huai|pei|pi","zuo","keng","bi","jing","di|lan","jing",
-       "ji","kuai","di","jing","jian","tan","li","ba","wu","fen",
-       "zhui","po","pan|ban","tang","kun","qu","tan","zhi","tuo","gan",
-       "ping","dian","gua","ni","tai","pi","jiong","yang","fo","ao",
-       "lu","qiu","mu","ke","gou","xue","fa","di|chi","che","ling",
-       "zhu","fu","hu","zhi","chui","la","long","long","lu","ao",
-       "dai","pao","min","xing","dong|tong","ji","he","lv","ci","chi",
-       "lei","gai","yin","hou","dui","zhao","fu","guang","yao","duo",
-       "duo","gui","cha","yang","yin","fa","gou","yuan","die","xie",
-       "ken","shang","shou","e","bing","dian","hong","ya","kua","da",
-       "ka","dang","kai","hang","nao","an","xing","xian","yuan|huan","bang",
-       "pou|fu","ba","yi","yin","han","xu","chui","cen","geng","ai",
-       "beng|feng","di|fang","que|jue","yong","jun","xia|jia","di","mai|man","lang","juan",
-       "cheng","yan|shan","qin|jin","zhe","lie","lie","pu|bu","cheng","hua","bu",
-       "shi","xun","guo","jiong","ye","nian","di","yu","bu","ya",
-       "quan","sui|su","pi","qing|zheng","wan","ju","lun","zheng|cheng","kong","chong|shang",
-       "dong","dai","tan","an","cai","chu|tou","beng","xian|kan","zhi","duo",
-       "yi|shi","zhi","yi","pei","ji","zhun","qi","sao","ju","ni",
-       "ku","ke","tang","kun","ni","jian","dui","jin","gang","yu",
-       "e","peng|beng","gu","tu","leng","fang","ya","qian|zan|jian","kun","an",
-       "shen","duo|hui","nao","tu","cheng","yin","huan","bi","lian","guo",
-       "die","zhuan","hou","bao|bu|pu","bao","yu","di","mao|mou|wu","jie","ruan",
-       "e|ai|ye","geng","kan","zong","yu","huang","e","yao","yan","bao",
-       "ji","mei","chang","du","tuo","yin","feng","zhong","jie","jin",
-       "feng","gang","chuan","jian","ping","lei","jiang","huang","leng","duan",
-       "wan","xuan","xi","ji","kuai","ying","ta","cheng","yong","kai",
-       "su","su","shi","mi","ta","weng","cheng","tu","tang","que",
-       "zhong","li","peng","bang","sai|se","zang","dui","tian","wu","zheng",
-       "xun","ge","zhen","ai","gong","yan","xian","tian|zhen","yuan","wen",
-       "xie","liu","hai","lang","chang","peng","beng","chen","lu","lu",
-       "ou|qiu","qian|zan|jian","mei","mo","zhuan|tuan","shuang","shu","lou","chi","man",
-       "biao","jing","qi","shu","zhi|di","zhang","kan","yong","dian","chen",
-       "zhi|zhuo","xi","guo","qiang","jin","shang","shang","mu","cui","yan",
-       "ta","zeng","qian","qiang","liang","wei","zhui","qiao","zeng","xu",
-       "shan","shan","fa","pu","kuai|tui","tuan|dong","fan","qiao|que","mo","dun",
-       "dun","zun|dun","di","sheng","duo|hui","duo","tan","deng","wu","fen",
-       "huang","tan","da","ye","zhu","jian","ao","qiang","ji","qiao|ao",
-       "ken","yi|tu","pi","bi","dian","jiang","ye","yong","xue|bo|jue","tan",
-       "lan","ju","huai","dang","rang","qian","xun","xian|lan","xi","he",
-       "ai","ya","dao","hao","ruan","jin","lei","kuang","lu","yan",
-       "tan","wei","huai","long","long","rui","li","lin","rang","chan",
-       "xun","yan","lei","ba","wan","shi","ren","san","zhuang","zhuang",
-       "sheng","yi","mai","ke|qiao","zhu","zhuang","hu","hu","kun","yi",
-       "hu","xu","kun","shou","mang","dun","shou","yi","zhi|zhong","gu|ying",
-       "chu","jiang|xiang","feng|pang","bei","zhai","bian","sui","qun","ling","fu",
-       "cuo","xia","xiong|xuan","xie","nao","xia","kui","xi","wai","yuan|wan",
-       "mao|wan","su","duo","duo","ye","qing","yi","gou","gou","qi",
-       "meng","meng","yin","huo","chen","da|dai","ce","tian","tai","fu",
-       "guai","yao","yang","hang|ben","gao","shi","tao|ben","tai","tou","yan|tao",
-       "bi","yi","kua","jia|ga|xia","duo","hua","kuang","yun","jia|ga|xia","ba",
-       "en","lian","huan","di|ti","yan","pao","juan","qi|ji","nai","feng",
-       "xie","fen","dian","quan|juan","kui","zou","huan","qi|qie|xie","kai","she|chi|zha",
-       "ben","yi","jiang","tao","zang|zhuang","ben","xi","huang","fei","diao",
-       "xun|zhui","beng","dian","ao","she","weng","po|ha|tai","ao|yu","wu","ao|yu",
-       "jiang","lian","duo","yun","jiang","shi","fen","huo","bi","luan",
-       "duo|che","nv","nu","ding|tian","nai","qian","jian","ta|jie","jiu","nuan",
-       "cha","hao","xian","fan","ji","shuo","ru","fei|pei","wang","hong",
-       "zhuang","fu","ma","dan","ren","fu|you","jing","yan","hai|jie","wen",
-       "zhong","pa","du","ji","keng|hang","zhong","yao","jin","yun","miao",
-       "fou|pei|pi","chi","yue|jue","zhuang","niu","yan","na|nan","xin","fen","bi",
-       "yu","tuo","feng","wan|yuan","fang","wu","yu","gui","du","ba",
-       "ni","zhou","zhuo","zhao","da","ni|nai","yuan","tou","xian|xuan|xu","zhi|yi",
-       "e","mei","mo","qi","bi","shen","qie","e","he","xu",
-       "fa","zheng","min","ban","mu","fu","ling","zi","zi","shi",
-       "ran","shan","yang","gan","jie","gu","si","xing","wei","zi",
-       "ju","shan","pin","ren","yao","dong","jiang","shu","ji","gai",
-       "xiang","hua|huo","juan","jiao|xiao","gou|du","mu|lao","jian","jian","yi","nian",
-       "zhi","zhen","ji","xian","heng","guang","jun|xun","kua|hu","yan","ming",
-       "lie","pei","e","you","yan","cha","shen|xian","yin","shi","gui",
-       "quan","zi","song","wei","hong","wa","lou","ya","rao","jiao",
-       "luan","ping","xian","shao","li","cheng|sheng","xie","mang","fu","suo",
-       "wu|mu","wei","ke","chuo|lai","chuo","ting","niang","xing","nan","yu",
-       "na|nuo","pou|bi","nei|sui","juan","shen","zhi","han","di","zhuang","e",
-       "pin","tui","man","mian","wu|yu","yan","wu","xi|ai","yan","yu",
-       "si","yu","wa","li","xian","ju","qu","zhui|shui","qi","xian",
-       "zhuo","dong","chang","lu","ai|e","e","e","lou","mian","cong",
-       "pou|pei|bu","ju","po","cai","ling","wan","biao","xiao","shu","qi",
-       "hui","fu|fan","wo","wo","tan","fei","fei","jie","tian","ni",
-       "quan|juan","jing","hun","jing","qian|jin","dian","xing","hu","wan|wa","lai",
-       "bi","yin","zhou|chou","chuo|nao","fu","jing","lun","an|n<e","lan","hun|kun",
-       "yin","ya","ju","li","dian","xian","huB|dB tBi","hua","ying","chan",
-       "shen","ting","dang|yang","yao","wu","nan","ruo|chuo","jia","tou|yu","xu",
-       "yu","wei","di|ti","rou","mei","dan","ruan|nen","qin","hui","wo",
-       "qian","chun","miao","fu","jie","duan","yi|pei","zhong","mei","huang",
-       "mian","an","ying","xuan","jie","wei","mei","yuan","zheng","qiu",
-       "ti","xie","tuo|duo","lian","mao","ran","si","pian","wei","wa",
-       "cu","hu","ao|yun|wo","jie","bao","xu","tou|yu","gui","chu|zou","yao",
-       "pi","xi","yuan","ying","rong","ru","chi","liu","mei","pan",
-       "ao|yun|wo","ma","gou","kui","qin|shen","jia","sao","zhen","yuan","jie|suo",
-       "rong","ming","ying","ji","su","niao","xian","tao","pang","lang",
-       "nao","biao","ai","pi","pin","yi","piao","yu","lei","xuan",
-       "man","yi","zhang","kang","yong","ni","li","di","gui","yan",
-       "jin","zhuan","chang","ze","han|nan","nen","lao","mo","zhe","hu",
-       "hu","ao","nen","qiang","ma","pie","gu","wu","qiao","tuo",
-       "zhan","miao","xian","xian","mo","liao","lian","hua","gui","deng",
-       "zhi","xu","yi","hua","xi","kui","rao","xi","yan","chan",
-       "jiao","mei","fan","fan","xian|yan|jin","yi","hui","jiao","fu","shi",
-       "bi","shan","sui","qiang","lian","huan|xuan|qiong","xin","niao","dong","yi",
-       "can","ai","niang","ning","mo","tiao","chou","jin","ci","yu",
-       "pin","rong","ru","nai","yan","tai","ying","qian","niao","yue",
-       "ying","mian","bi","mo","shen","xing","ni","du","liu","yuan",
-       "lan","yan","shuang","ling","jiao","niang","lan","xian|qian","ying","shuang",
-       "xie|hui","huan|quan","mi","li","luan","yan","zhu|chuo","lan","zi","jie",
-       "jue","jue","kong","yun","zi|ma","zi","cun","sun|xun","fu","bei",
-       "zi","xiao","xin","meng","si","tai","bao","ji","gu","nu",
-       "xue","you","zhuan","hai","luan","sun|xun","nao","mie","cong","qian",
-       "shu","chan|can","ya","zi","ni","fu","zi","li","xue","bo",
-       "ru","nai","nie","nie","ying","luan","mian","ning","rong","ta",
-       "gui","zhai","qiong","yu","shou","an","tu|jia","song","wan","rou",
-       "yao","hong","yi","jing","zhun","mi|fu","zhu","dang","hong","zong",
-       "guan","zhou","ding","wan|yuan","yi","bao","shi","shi","chong","shen",
-       "ke","xuan","shi","you","huan","yi","tiao","shi","xian","gong",
-       "cheng","qun","gong","xiao","zai","zha","bao|shi","hai","yan","xiao",
-       "jia|jiB","cai","chen","rong","huang","mi","kou","kuan","bin","su|xiu",
-       "cai","zan","ji","yuan","ji","yin","mi","kou","qing","he",
-       "zhen","jian","fu","ning","bing","huan","mei","qin","han","yu",
-       "shi","ning","jin|qin","ning","zhi","yu","bao","kuan","ning","qin",
-       "mo","cha","ju|lou","gua","qin","hu","wu","liao","shi","ning",
-       "zhai","shen","wei","xie","kuan","hui","liao","jun","huan","yi",
-       "yi","bao","qin","chong","bao","feng","cun","dui","si","xun",
-       "dao","l<e|luo","dui","shou","po","feng","zhuan","fu","she|ye|yi","kei|ke",
-       "jiang","jiang","zhuan","wei|yu","zun","xun","shu|zhu","dui","dao","xiao",
-       "jie|ji","shao","er","er","er","ga","jian","shu","chen","shang",
-       "shang","mo","ga","chang","liao","xian","xian","hun","you","wang",
-       "you","liao","liao","yao","long|mang|meng|pang","wang","wang","wang","ga","yao",
-       "duo","kui","zhong","jiu","gan","gu","gan","tui","gan","gan",
-       "shi","yin","chi|che","kao","ni","jin","wei|yi","niao|sui","ju","pi",
-       "ceng","xi","bi","ju","jie","tian","qu","ti","jie","wu",
-       "diao","shi","shi","ping|bing","ji","xie","zhen","xi","ni","zhan",
-       "xi","wei","man","e","lou","ping|bing","ti","fei","shu|zhu","xie|ti",
-       "tu","lv","lv","xi","ceng","lv","ju","xie","ju","jue",
-       "liao","jue","shu|zhu","xi","che|cao","tun|zhun","ni|ji","shan","wa","xian",
-       "li","an","hui","hui","hong|long","yi","qi","ren","wu","han|an",
-       "shen","yu","chu","sui","qi|kai","yin","yue","ban","yao","ang",
-       "ya","wu","jie","e","ji","qian","fen","wan","qi","cen",
-       "qian","qi","cha","jie","qu","gang","xian","ao","lan","dao",
-       "ba","zuo","zuo","yang","ju","gang","ke","gou","xue","po",
-       "li","tiao","ju","yan","fu","xiu","jia","ling","tuo","pi",
-       "ao","dai","kuang","yue","qu","hu","po","min","an","tiao",
-       "ling","di","ping","dong","zBi|ze mo","kui","xiu","mao","tong","xue",
-       "yi","bian","he","ke|ba","luo","e","fu|nie","xun","die","lu",
-       "en","er","gai","quan","tong|dong","yi","mu","shi","an","wei",
-       "huan","zhi|shi","mi","li","fa","tong","wei","you","qia","xia",
-       "li","yao","jiao|qiao","zheng","luan","jiao","e","e","yu","xie|ye",
-       "bu","qiao","qun","feng","feng","nao","li","you","xian","rong",
-       "dao","shen","cheng","tu","geng","jun","gao","xia","yin","wu",
-       "lang","kan","lao","lai","xian","que","kong","chong","chong","ta",
-       "lin","hua","ju","lai","qi","min","kun","kun","zu|cui","gu",
-       "cui","ya","ya","gang","lun","lun","ling","jue","duo","zheng",
-       "guo","yin","dong","han","zheng","wei","xiao","pi|bi","yan","song",
-       "jie","beng","zu","jue","dong","zhan|chan","gu","yin","zi","ze",
-       "huang","yu","wai|wei","yang|dang","feng","qiu","yang","ti","yi","zhi|shi",
-       "shi|die","zai","yao","e","zhu","kan|zhan","lv","yan","mei","han",
-       "ji","ji","huan","ting","sheng","mei","qian|kan","wu|mao","yu","zong",
-       "lan","ke|jie","yan","yan","wei","zong","cha","sui","rong","ke",
-       "qin","yu","qi","lou","tu","cui","xi","weng","cang","dang|tang",
-       "rong|ying","jie","kai|ai","liu","wu","song","kao|qiao","zi","wei","beng",
-       "dian","cuo","qin|qian","yong","nie","cuo","ji","shi","ruo","song",
-       "zong","jiang","liao","kang","yan","die|di","cen","ding","tu","lou",
-       "zhang","zhan|chan","zhan|chan","ao","cao","qu","qiang","wei","zui","dao",
-       "dao","xi","yu","pi|pei","long","xiang","ceng","bo","qin","jiao",
-       "yan","lao","zhan","lin","liao","liao","qin","deng","tuo","zun",
-       "jiao|qiao","jue|gui","yao","jiao","yao","jue","zhan|shan","yi","xue","nao",
-       "ye","ye","yi","nie","xian","ji","xie|jie","ke|jie","gui|xi|juan","di",
-       "ao","zui","wei","ni","rong","dao","ling","jie","yu","yue",
-       "yin","ru","jie","li|lie","gui|xi|juan","long","long","dian","ying|hong","xi",
-       "ju","chan","ying","kui","yan","wei","nao","quan","chao","cuan",
-       "luan","dian","dian","nie","yan","yan","yan","kui","yan","chuan",
-       "kuai","chuan","zhou","huang","jing|xing","xun","chao","chao","lie","gong",
-       "zuo","qiao","ju","gong","ge","wu","pu","pu","cha|chai|ci","qiu",
-       "qiu","ji","yi","si","ba","zhi","zhao","xiang|hang","yi","jin",
-       "xun","juan","pa","xun","jin","fu","za","bi","shi","bu",
-       "ding","shuai","fan","nie","shi","fen","pa","zhi","xi","hu",
-       "dan","wei","zhang","tang|nu","dai","mo|wa","pei","pa","tie","fu",
-       "lian","zhi","zhou","bo","zhi","di","mo","yi","yi","ping",
-       "qia","juan","ru","shuai","dai","zhen","shui","qiao","zhen","shi",
-       "qun","xi","bang","dai","gui","chou|dao","ping","zhang","jian|san","wan",
-       "dai","wei","chang","sha|qie","qi|ji","ze","guo","mao","zhu","hou",
-       "zhen","zheng","mi","wei","wo","fu","yi","bang","ping","die",
-       "gong","pan","huang","tao","mi","jia","teng","hui","zhong","shan|qiao|shen",
-       "man","mu","biao","guo","ze","mu","bang","zhang","jing","chan",
-       "fu","zhi","hu","fan","chuang|zhuang","bi","bi","zhang","mi","qiao",
-       "chan","fen","meng","bang","chou|dao","mie","chu","jie","xian","lan",
-       "gan","ping","nian","jian","bing","bing","xing","gan","yao","huan",
-       "you","you","ji","guang|an","pi","ting","ze","guang","zhuang","me|mo",
-       "qing","bi","qin","dun|tun","chuang","gui","ya","bai|ting","jie","xu",
-       "lu","wu","zhuang","ku","ying","di|de","pao","dian","ya","miao",
-       "geng","ci","fu","tong","pang","fei","xiang","yi","zhi","tiao",
-       "zhi","xiu","du|duo","zuo","xiao","tu","gui","ku","mang|meng|pang","ting",
-       "you","bu","bing|ping","cheng","lai","bei","ji|cuo","an","shu","kang",
-       "yong","tuo","song","shu","qing","yu","yu","miao","sou","ce",
-       "xiang","fei","jiu","e","gui|wei|hui","liu","sha|xia","lian","lang","sou",
-       "zhi","bu","qing","jiu","jiu","jin|qin","ao","kuo","lou","yin",
-       "liao","dai","lu","yi","chu","chan","tu","si","xin","miao",
-       "chang","wu","fei","guang","kao","kuai","bi","qiang|se","xie","lin",
-       "lin","liao","lu","ji","ying","xian","ting","yong","li","ting",
-       "yin","xun","yan","ting","di","po|pai","jian","hui","nai","hui",
-       "gong","nian","kai","bian","yi","qi","nong|long","fen","ju","yan",
-       "yi","zang","bi","yi","yi","er","san","shi","er","shi",
-       "shi","gong","diao","yin","hu","fu","hong","wu","tui","chi",
-       "jiang","ba","shen","di|ti|tui","zhang","jue|zhang","tao","fu","di","mi",
-       "xian","hu","chao","nu","jing","zhen","yi","mi","juan|quan","wan",
-       "shao","ruo","xuan|yuan","jing","diao","zhang","jiang","qiang|jiang","peng","dan|tan",
-       "qiang|jiang","bi","bi","she","dan|tan","jian","gou","ge","fa","bi",
-       "kou","jian","bie","xiao","dan|tan","guo","qiang|jiang","hong","mi","guo",
-       "wan","jue","xue","ji","gui","dang","lu","lu","tuan","hui",
-       "zhi","hui","hui","yi","yi","yi","yi","huo","huo","shan|xian",
-       "xing","wen","tong","yan","yan","yu","chi","cai","biao","diao",
-       "bin","peng|bang","yong","piao","zhang","ying","chi","chi","zhuo|bo","tuo|yi",
-       "ji","pang|fang","zhong","yi","wang","che","bi","di","ling","fo",
-       "wang","zheng","cu","wang","jing","dai","xi","xun","hen","yang",
-       "huai","lv","hou","wang|jia|wa","cheng|zheng","zhi","xu","jing","tu","cong",
-       "cong","lai","cong","de|dei","pai","xi","dong","ji","chang","zhi",
-       "cong|zong","zhou","lai","yu","xie","jie","jian","shi|ti","jia|xia","bian",
-       "huang","fu","xun","wei","pang","yao","wei","xi","zheng","piao",
-       "ti|chi","de","zhi|zheng","zhi|zheng","bie","de","zhong|chong","che","jiao|yao","hui",
-       "jiao","hui","mei","long","xiang","bao","qu|ju","xin","xin","bi",
-       "yi","le","ren","dao","ding|ting","gai","ji","ren","ren","chan",
-       "tan","te","te|tui","gan|han","yi|qi","shi|tai","cun","zhi","wang","mang",
-       "xi|lie","fan","ying","tian","min|wen","min|wen","zhong","chong","wu","ji",
-       "wu","xi","jia","you","wan","cong","song|zhong","kuai","yu|shu","bian",
-       "zhi","qi|shi","cui","chen","tai","tun|zhun|dun","qian|qin","nian","hun","xiong",
-       "niu","kuang|wang","xian","xin","kang|hang","hu","kai","fen","huai","tai",
-       "song","wu","ou","chang","chuang","ju","yi","bao","chao","min|men",
-       "pei","zuo|zha","zen","yang","kou|ju","ban","nu","nao|niu","zheng","pa",
-       "bu","tie|zhan","hu|gu","hu","cu|ju|zu","da","lian","si|sai","you|chou","di",
-       "dai","yi","tu|die","you","fu","ji","peng","xing","yuan","ni",
-       "guai","fei","xi","bi","you|yao","qie","xuan","cong","bing","huang",
-       "xu|xue","chu","bi|pi","shu","xi|shu","tan","yong","zong","dui","mi",
-       "gi","yi","shi","nen|nin","xun","shi","xi","lao","heng","kuang",
-       "mou","zhi","xie","lian","tiao|yao","huang","die","hao","kong","gui",
-       "heng","xi|qi|xu","xiao|jiao","shu","si","hu|kua","qiu","yang","hui","hui",
-       "chi","jia","yi","xiong","guai","lin","hui","zi","xu","chi",
-       "shang","nv","hen","en","ke","dong","tian","gong","quan|zhuan","xi",
-       "qia","yue","peng","ken","de","hui","e|wu","qiu","tong","yan",
-       "kai","ce","nao","yun","mang","yong","yong","yuan|juan","pi","kun",
-       "qiao","yue","yu|shu","tu","jie|ke","xi","zhe","lin","ti","han",
-       "hao|jiao","qie","ti","bu","yi","qian","hui","xi","bei","man|men",
-       "yi","heng","song","quan","cheng","kui|li","wu","wu","you","li",
-       "liang","huan","cong","yi|nian","yue","li","nin","nao","e","que",
-       "xuan","qian","wu","min","cong","fei","bei","de","cui","chang",
-       "men","li","ji","guan","guan","xing","dao","qi","kong","tian",
-       "lun","xi","kan","gun","ni","qing","chou","dun","guo","zhan",
-       "jing","wan","yuan|wan","jin","ji","lan|lin","yu|xu","huo","he","juan|quan",
-       "tan|dan","ti","ti","nian","wang","chuo|chui","hu","hun|men","xi","chang",
-       "xin","wei","hui","e|wu","suo|rui","zong","jian","yong","dian","ju",
-       "can","cheng","de","bei","qie","can","dan|da","guan","duo","nao",
-       "yun","xiang","zhui","die","huang","chun","qiong","re","xing","ce",
-       "bian","min","zong","ti|shi","qiao","chou","bei","xuan","wei","ge",
-       "qian","wei","yu","yu|tou","bi","xuan","huan","min","bi","yi",
-       "mian","yong","qi|kai","dang|shang|tang|yang","yin","e","chen|xin|dan","mao","ke|qia","ke",
-       "yu","ai","qie","yan","nuo","gan","yun","cong|song","sai|si","leng",
-       "fen","ying","kui","kui","que","gong|hong","yun","su","su|shuo","qi",
-       "yao","song","huang","ji","gu","ju","chuang","ni","xie","kai",
-       "zheng","yong","cao","xun","shen","bo","kai|xi","yuan","xi|xie","hun",
-       "yong","yang","li","cao|sao","tao","yin","ci","xu|chu","qian|qie","tai",
-       "huang","yun","shen","ming","gong|hong","she","cao|cong","piao","mu","mu",
-       "guo","chi","can","can","can","cui","min","te","zhang","tong",
-       "ao","shuang","man","guan","que","zao","jiu","hui","kai","lian",
-       "ou","song","qin|jin","yin","lv","shang","wei","tuan","man","qian",
-       "she","yong","qing","kang","di|chi","zhi|zhe","lou|lv","juan","qi","qi",
-       "yu","ping","liao","cong","you","chong","zhi","tong","cheng","qi",
-       "qu","peng","bei","bie","qiong","jiao","zeng","chi","lian","ping",
-       "kui","hui","qiao","cheng|deng|zheng","yin","yin","xi","xi","dan|da","tan",
-       "duo","dui","dui|dun|tun","su","jue","ce","xiao|jiao","fan","fen","lao",
-       "lao","chong","han","qi","xian","min","jing","liao","wu","can",
-       "jue","cu","xian","tan","sheng","pi","yi","chu","xian","nao|nang",
-       "dan","tan","jing","song","han","jiao|ji","wei","xuan|huan","dong","qin",
-       "qin","ju","cao|sao","ken","xie","ying","ao","mao","yi","lin",
-       "se","jun","huai","men","lan","ai","lin","yan","guo","xia",
-       "chi","yu","yin","dai","meng","ai|yi|ni","meng","dui","qi|ji","mo",
-       "lan|xian","men","chou","zhi","nuo","nuo","yan","yang","bo","zhi",
-       "kuang","kuang","you","fu","liu","mie","cheng","hui","chan","meng",
-       "lan","huai","xuan","rang","chan","ji","ju","huan","she","yi",
-       "lian","nan","mi","tang","jue","gang|zhuang","gang|zhuang","gang|zhuang","ge","yue",
-       "wu","jian","qu","shu","rong","xi|hu","cheng","wo","jie","ge",
-       "jian","qiang","huo","qiang","zhan","dong","qi","jia","die","zei",
-       "jia","ji","zhi","kan","ji","kui","gai","deng","zhan","qiang",
-       "ge","jian","jie","yu","jian","yan","lu","xi|hu","zhan","xi|hu",
-       "xi|hu","chuo","dai","qu","hu","hu","hu","e","shi","ti",
-       "mao","hu","li","fang","suo","bian|pian","dian","jiong","shang|jiong","yi",
-       "yi","shan","hu","fei","yan","shou","shou","cai","za|zha","qiu",
-       "le|li|cai","pu","ba|pa","da","reng","fan|fu","ru","zai","tuo","zhang",
-       "diao|di|yue|li","kang|gang","yu|wu","yu|wu|ku","han","shen","cha","tuo|chi|yi","gu|xi|ge|jie","kou",
-       "wu","den","qian","zhi","ren","kuo","men","sao","yang","niu",
-       "ban","che","rao","xi|cha|qi","qian|qin","ban","jia","yu","fu","ba|ao",
-       "xi|zhe","pi","di","zhi|sun|kan","e","den","zhao","cheng","ji","yan",
-       "kuang|wang|zai","bian","chao","ju","wen","hu|gu","yue","jue","ba","qin",
-       "dan|shen","zheng","yun","wan","ne|ni|rui|na","yi","shu","zhua","pou","tou",
-       "dou","kang","zhe|she","pou|fu","fu","pao","ba","ao|niu","ze|zhBi","tuan",
-       "kou","lun","qiang|cheng","yun","hu","bao","bing","zhi|zhai","peng","nan",
-       "bu|pu","pi","tai","yao|tao","zhen","zha","yang","bao","he|qia","ni",
-       "ye","di","chi","pi|pei","jia","mo|ma","mei","chen","ya","chou",
-       "qu","min","zhu","jia|ya","fu|bi","zha","zhu","dan","chai|ca","mu",
-       "nian","la","fu","pao","ban|pan","pai","lin","na","guai","qian",
-       "ju","tuo|ta|zhi","ba","tuo","tuo","ao|niu","ju|gou","zhuo","pan|pin|fan","zhao",
-       "bai","bai","di","ni","ju","kuo","long","jian","qia","yong",
-       "lan","ning","bo","ze|zhai","qian","hen","kuo|gua","shi","jie|jia","zheng",
-       "nin","gong","gong","quan","shuan","cun|zun","za|zan","kao","yi|chi|hai","xie",
-       "ce|se|chuo","hui","pin","zhuai|ye","shi|she","na","bai","chi","gua","zhi",
-       "kuo|guang","duo","duo","zhi","qie","an","nong","zhen","ge","jiao",
-       "kua|ku","dong","ru|na","tiao","lie","zha","lv","die|she","wa","jue",
-       "lie ri","ju","zhi","luan","ya","zhua|wo","ta","xie|jia","nao","dang",
-       "jiao","zheng","ji","hui","xian","yu","ai","tuo|shui","nuo","cuo",
-       "bo","geng","ti","zhen","cheng","suo|sB|shB","suo|sB|shB","keng|qian","mei","nong",
-       "ju","bang|peng","jian","yi","ting","shan","nuo","wan","xie|jia","cha",
-       "peng","jiao|ku","wu","jun","jiu","tong","kun","huo|chi","tu|shu|cha","zhuo",
-       "pou|fu","luo|lv","ba","han","shao","nie","juan","ze","shu|song|sou","ye|yu",
-       "jue|zhuo","bu","wan","bu|pu|zhi","zun","ye","zhai","lv","sou","tuo|shui",
-       "lao","sun","bang","jian","huan","dao","wei","wan|yu","qin","peng",
-       "she","lie","min","men","fu|bu","bai","ju","dao","wo|luo","ai",
-       "juan|quan","yue","zong","chen","chui","jie","tu","ben","na","nian|nie",
-       "ruo|wei|re","zuo","wo|xia","qi","xian","cheng","dian","sao","lun","qing|qian",
-       "gang","duo","shou","diao","pou","di","zhang","hun","ji","tao",
-       "qia","qi","pai","shu","qian|wan","ling","ye","ya","jue","zheng",
-       "liang","gua","ni|nie|yi","huo|xu","shan|yan","zheng|ding","lve","cai","tan","che",
-       "bing","jie","ti","kong","tui","yan","cuo","zou|zhou|chou","ju","tian",
-       "qian","ken","bai","pa","jie","lu","guai","ming","jie","zhi",
-       "dan|shan","meng","chan|xian|can|shan","sao","guan","peng","yuan","nuo","jian","zheng|keng",
-       "jiu|you","jian","yu","yan","kui","nan","hong","rou","pi|che","wei",
-       "sai|zong|cai","zou","xuan","miao","ti|di","nie","cha","shi","zong|song","zhen",
-       "yi","xun","huang|yong","bian","yang","huan","yan","zan|zuan","an","xu|ju",
-       "ya","wo","ke|qia","chuai|tuan|zhui","ji","ti|di","la","la","cheng","kai",
-       "jiu","jiu","tu","jie|qi","hui","gen","chong|dong","xiao","she|die|ye","xie",
-       "yuan","qian|jian","ye","cha","zha","bei","yao","wei","beng","lan",
-       "wen","qin","chan","ge","lou","zong","gen","jiao","gou","qin",
-       "rong","que","chou|zou","chuai","zhan","sun","sun","bo","chu","rong|nang",
-       "bang|peng","cuo","sao","e","yao","dao","zhi","nu|nuo|nou","la|xie|xian","jian",
-       "sou","qiu","gao","gan","shuo","sang","jin","mie","e","chui",
-       "nuo","shan","ta","jie|zhe","tang","pan|ban|po","ban","da","li","tao",
-       "hu|ku","zhi|nai","wa","hua","qian","wen","qiang|cheng","tian|shen","zhen","e",
-       "xie","na|nuo","quan","cha","zha","ge","wu","en","she","kang",
-       "she|nie","shu","bai","yao","bin","sou","tan","sa|sha|shai","chan|sun","suo",
-       "jiu|liu|liao|jiao|nao","chong","chuang","guai","bing","feng|peng","shuai","di|tu|zhi","qi|ji|cha","sou|song",
-       "zhai","lian","cheng","chi","guan","lu","luo","lou","zong","gai|xi",
-       "hu|chu","zha","qiang","tang","hua","cui","zhi|nai","mo|ma","jiang|qiang","gui",
-       "ying","zhi","ao|qiao","zhi","nie|che","man","chan|can","kou","chu","se|mi|su",
-       "tuan","jiao|chao","mo","mo","zhe","chan|xian|can|shan","keng|qian","biao","jiang","yao",
-       "gou","qian","liao","ji","ying","jue","pie","pie","lao","dun",
-       "xian","ruan","gui","zan|zen|qian","yi","xian","cheng","cheng","sa","nao",
-       "hong","si","han","heng|guang","da","zun","nian","lin","zheng|cheng","hui|wei",
-       "zhuang","jiao","ji","cao","dan","dan|shan","che","bo","che","jue",
-       "xiao|sou","liao","ben","fu","qiao","bo","cuo|zuo","zhuo","zhuan","wei|tuo",
-       "pu","qin","dun","nian","hua","xie","lu","jiao","cuan","ta",
-       "han","qiao|yao|ji","zhua|wo","jian","gan","yong","lei","nang","lu","shan",
-       "zhuo","ze|zhai","pu","chuo","ji","dang","se","cao","qing","qing|jing",
-       "huan","jie","qin","kuai","dan","xie","qia|jia|ye","pi|bo","bo|bai","ao",
-       "ju","ye","e","meng","sou","mi","ji","tai","zhuo","dao",
-       "xing","lan","ca","ju","ye","ru","ye","ye","ni","huo",
-       "jie","bin","ning","ge","zhi","zhi|jie","kuo","mo","jian","xie",
-       "lie|la","tan","bai","sou","lu","li|luo|yue","rao","ti|zhi|zhai","pan","yang",
-       "lei","ca|sa","shu","zan","nian","xian","jun|pei","huo","li|luo","la|lai",
-       "huan","ying","lu|luo","long","qian","qian","zan|cuan","qian","lan","xian|jian",
-       "ying","mei","rang","chan","weng","cuan","xie","she|nie","luo","jun",
-       "mi|mo","chi","zan|cuan","luan","tan","zuan","li|shai","dian","wa","dang",
-       "jiao","jue","lan","li|luo","nang","zhi","gui","gui","qi|yi|ji","xun",
-       "pu","pu","shou","kao","you","gai","yi","gong","gan|han","ban",
-       "fang","zheng","po","dian","kou","min","wu|mou","gu","he","ce",
-       "xiao","mi","chu|shou","ge|guo|e","di","xu","jiao","min","chen","jiu",
-       "shen","duo|dui","yu","chi","ao","bai","xu","jiao","duo|dui","lian",
-       "nie","bi","chang","dian","duo|que","yi","gan","san","ke","yan",
-       "dun|dui","qi|yi|ji","tou","xiao|xue","duo|que","jiao","jing","yang","xia","min",
-       "shu|shuo","ai|zhu","qiao","ai|zhu","zheng","di","chen","fu","shu|shuo","liao",
-       "qu","xiong|xuan","yi","jiao","shan","jiao","zhuo|zhu","yi|du","lian","bi",
-       "li|tai","xiao","xiao","wen","xue","qi","qi","zhai","bin","jue|jiao",
-       "zhai","lang","fei","ban","ban","lan","yu|zhong","lan","wei|men","dou",
-       "sheng","liao","jia","hu","xie","jia","yu","zhen","jiao","wo|guan",
-       "tou|tiao","dou","jin","chi","yin|zhi","fu","qiang","zhan","qu","zhuo",
-       "zhan","duan","zhuo","si","xin","zhuo","zhuo","qin","lin","zhuo",
-       "chu","duan","zhu","fang","chan|jie","hang","yu|wu","shi","pei","liu|you",
-       "mie","pang|bang","qi","zhan","mao","lv","pei","pi|bi","liu","fu",
-       "fang","xuan","jing","jing","ni","zu","zhao","yi","liu","shao",
-       "jian","en","yi","qi","zhi","fan","piao","fan","zhan","kuai",
-       "sui","yu","wu","ji","ji","ji","huo","ri","dan","jiu",
-       "zhi","zao","xie","tiao","xun","xu","ga","la","gan|han","han",
-       "tai|ying","di|de","xu","chan","shi","kuang","yang","shi","wang","min",
-       "min","tun|zhun","chun","wu","yun","bei","ang","ze","ban","jie",
-       "kun","sheng","hu","fang","hao","gui","chang","xuan","ming","hun",
-       "fen","qin","hu","yi","xi","xin","yan","ze","fang","tan",
-       "shen","ju","yang","zan","bing","xing","ying","xuan","po","zhen",
-       "ling","chun","hao","mei","zuo","mo","bian","xu","hun","zhao",
-       "zong","shi","shi","yu","fei","die|yi","mao","ni","chang","wen",
-       "dong","ai","bing","ang","zhou","long","xian","kuang","tiao","chao",
-       "shi","huang","huang","xuan","kui","xu|kua","jiao","jin","zhi","jin",
-       "shang","tong","hong","yan","gai","xiang","shai","xiao","ye","yun",
-       "hui","han","han","jun","wan","xian","kun","zhou","xi","sheng|cheng",
-       "sheng","bu","zhe","zhe","wu","wan","hui","hao","chen","wan",
-       "tian","zhuo","zui","zhou","pu","jing|ying","xi","shan","ni","xi",
-       "qing","qi|du","jing","gui","zheng","yi","zhi","an|yan","wan","lin",
-       "liang","cheng","wang","xiao","zan","fei","xuan","xuan","yi","xia",
-       "yun","hui","xu","min","kui","ye","ying","shu|du","wei","shu",
-       "qing","mao","nan","jian|lan","nuan","an","yang","chun","yao","suo",
-       "pu","ming","jiao","kai","hao","weng","chang","qi","hao","yan",
-       "li","ai","ji","ji","men","zan","xie","hao","mu","mu",
-       "cong","ni","zhang","hui","bao|pu","han","xuan","chuan","liao","xian",
-       "tan","jing","pie","lin","tun","xi","yi","ji","huang","dai",
-       "ye","ye","li","tan","tong","xiao","fei","shen","zhao","hao",
-       "yi","xiang","xing","shen","jiao","bao","jing","yan","ai","ye",
-       "ru","shu","meng","xun","yao","pu|bao","li","chen","kuang","die",
-       "liao","yan","huo","lu","xi","rong","long","nang","luo","luan",
-       "shai","tang","yan","zhu","yue","yue","qu","ye","geng","ye",
-       "hu","he","shu","cao","cao","sheng","man","zeng|ceng","zeng|ceng","ti",
-       "zui","can|qian|jian","xu","hui|kuai","yin","qie|he","fen","bi|pi","yue","you",
-       "ruan","peng","fen|ban","fu","ling","fei|ku","qu|xu|chun","ti","nv|ga","tiao",
-       "shuo","zhen","lang","lang","juan|zui","ming","huang|mang|wang","wang","tun","zhao|chao",
-       "ji","qi|ji","ying","zong","wang","tong|chuang","lang","lao","meng","long",
-       "mu","pin","wei","mo","ben","zha","shu|zhu","shu|zhu","teul","zhu|shu",
-       "ren","ba","piao|pu|po","duo","duo","dao|tiao|mu","li","qiu|gui","ji","jiu",
-       "bi","xiu","cheng","ci","sha","ru","za","quan","qian","yu|wu",
-       "gan","wu","cha","shan|sha","xun","fan","wu","zi","li","xing",
-       "cai","cun","ren|er","shao|biao","tuo|zhe","di|duo","zhang","mang","chi","yi",
-       "gu|gai","gong","du","yi|li|duo|tuo","qi","shu","gang","tiao","jie","mian",
-       "wan","lai","jiu","mang","yang","ma","miao","si|zhi|xi","yuan|wan","hang",
-       "fei|bei","bei","jie","dong","gao","yao","xian","chu","chun","pa",
-       "shu|dui","hua","xin","niu|chou","zhu","chou","song","ban","song","ji",
-       "wo|yue","jin","gou","ji","mao","pi","pi|mi","wang","ang","fang|bing",
-       "fen","yi","fu","nan","xi","hu|di","ya","dou","xin","zhen",
-       "yao","lin","rui","e","mei","zhao","guo","zhi|qi","cong|zong","yun",
-       "hua","sheng","shu","zao","di|duo","li","lu","jian","cheng","song|mB ti su",
-       "qiang","feng","zhan","xiao","xian|zhen","ku","ping","si|tai","xi","zhi",
-       "guai","xiao","jia","jia","ju|gou","bao|fu","mo","yi|xie","ye","ye",
-       "shi","nie","bi","tuo|duo","yi|duo|li","ling","bing","ni|chi","la","he",
-       "pan|ban","fan","zhong","dai","ci","yang|ying","fu","bai|bo","mou","gan",
-       "qi","ran","rou","mao","shao","song","zhe","xia","you","shen",
-       "gui|ju","tuo","zuo|zha","nan","ning","yong","di","zhi|die","zha|zu","cha|zha",
-       "dan","gu","bu|pu","jiu","ao","fu","jian","ba|fu|pei|bo|bie","duo|zuo|wu","ke",
-       "nai","zhu","bi|bie","liu","chai","zha","si","zhu","bei|pei","shi|fei",
-       "guai","cha|zha","yao","cheng","jiu","shi","zhi","liu","mei","li",
-       "rong","zha|shan|shi|ce","zao","biao","zhan","zhi","long","dong","lu","sa",
-       "li|yue","lan","yong","shu","xun","shuan","qi|qie","chen","qi|xi","li",
-       "yi","xiang","zhen","li","se","gua|tian","kan","ben|bing","ren","xiao|jiao",
-       "bai","ren","bing","zi","chou","yi|xie","ci","xu","zhu","jian|zun",
-       "zui","er","er","you|yu","fa","gong","kao","lao","zhan","lie",
-       "yin","yang","he|hu","gen","zhi|yi","shi","ge","zai","luan","fu",
-       "jie","heng|hang","gui","tao","guang","wei","kuang","ru","an","an",
-       "juan","yi|ti","zhuo","ku","zhi","qiong","tong","sang","sang","huan",
-       "jie|ju","jiu","xue","duo","chui","yu|mou","za|zan","kB sei","ying","jie",
-       "liu","zhan","ya","nao","zhen","dang","qi","qiao","hua","gui|hui",
-       "jiang","zhuang","xun","suo","sha","chen|zhen","bei","ting|ying","gua","jing",
-       "bo","ben|fan","fu","rui","tong","jue","xi","lang","liu","feng",
-       "qi","wen","jun","gan","su|yin","liang","qiu","ting","you","mei",
-       "bang","long","peng","zhuang","di","xuan|juan|xie","tu|cha","zao","ao|you","gu",
-       "bi","di","han","zi","zhi","ren|er","bei","geng","jian","huan",
-       "wan","nuo","jia","tiao","ji","xiao","lv","kuan","shao|sao","chen",
-       "fen","song","meng","wu","li","si|qi","dou","qin","ying","suo",
-       "ju","ti","xie","kun","zhuo","shu","chan|yan","fan","wei","jing",
-       "li","bin|bing","xia","fo","chou|tao|dao","zhi","lai","lian","jian","zhuo",
-       "ling","li","qi","bing","lun","cong|song","qian","mian","qi","qi",
-       "cai","gun|hun","chan","de|zhe","fei","pai|bei|pei","bang","bang|pou|bei","hun","zong",
-       "cheng","zao","ji","li|lie","peng","yu","yu","gu","jun","dong",
-       "tang","gang","wang","di|dai|ti","que","fan","cheng","zhan","qi","yuan",
-       "yan","yu","quan|juan","yi","sen","ren|shen","chui","leng|ling","qi","zhuo",
-       "fu|su","ke","lai","zou|sou","zou","zhao|zhuo","guan","fen","fen","chen",
-       "qing","ni","wan","guo","lu","hao","jie|qie","yi","chou|zhou|diao","ju",
-       "ju","cheng|sheng","zu|cui","liang","qiang|kong","zhi","zhui|chui","ya","ju","bei",
-       "jiao","zhuo","zi","bin","peng","ding","chu","chang","men","hua",
-       "jian","gui","xi","du","qian","dao","gui","dian","luo","zhi",
-       "quan|juan","mi eng","fu","geng","peng","shan","yi","tuo","sen","duo|chuan",
-       "ye","fu","wei|hui","wei","duan","jia","zong","jian|han","yi","zhen|shen",
-       "xi","yan|ya","yan","chuan","jian","chun","yu","he","zha|cha","wo",
-       "pian","bi","yao","guo|kua","xu","ruo","yang","la","yan","ben",
-       "hui","kui","jie","kui","si","feng","xie","tuo","ji|zhi","jian",
-       "mu","mao","chu","ku|hu","hu","lian","leng","ting","nan","yu",
-       "you","mei","song|cong","xuan|yuan","xuan","yang|ying","zhen","pian","die|ye","ji",
-       "jie","ye","chu","shun|dun","yu","cou|zou","wei","mei","di|shi","ji",
-       "jie","kai|jie","qiu","ying","rou","huang","lou","le|yue","quan","xiang",
-       "pin","shi","gai","tan","lan","wen|yun","yu","chen","lv","ju",
-       "shen","chu","bi|pi","xie","jia","yi","zhan|nian|zhen","fu|bo","nuo","mi",
-       "lang","rong","gu","jian|jin","ju","ta","yao","zhen","bang","sha|xie",
-       "yuan","zi","ming","su","jia","yao","jie","huang","gan","fei",
-       "zha","qian","ma","sun","yuan","xie","rong","shi","zhi","cui",
-       "wen","ting","liu","rong","tang","que","zhai","si","sheng","ta",
-       "ke","xi","gu","qi","gao","gao","sun","pan","tao","ge",
-       "chun","dian","nou","ji","shuo","gou","chui","qiang","cha","qian|lian|xian",
-       "huai","mei","xu","gang","gao","zhuo","tuo","qiao","yang","dian|zhen",
-       "jia","jian|kan","zui","dao","long","bin|bing","zhu","sang","xi|die","ji|gui",
-       "lian","hui","rong|yong","qian","guo","gai","gai","tuan|shuan|quan","hua","qi|se",
-       "sen","cui|zhi","peng","you|chao","hu","jiang","hu","huan","gui","nie",
-       "yi","gao","kang","gui","gui","cao","man|wan","jin","di","zhuang",
-       "le|yue","lang","chen","cong|zong","li|chi","xiu","qing","shang","fan","tong",
-       "guan","ze","su","lei","lu","liang","mi","lou","chao|jiao","su",
-       "ke","chu","cheng","biao","lu","jiu|liao","zhe","zha","shu","zhang",
-       "man","mo|mu","niao|mu","yang","tiao","peng","zhu","sha|xie","xi","quan",
-       "heng","jian","cong","ji","yan","qiang","xue","ying","er","xun",
-       "zhi","qiao","zui","cong","piao","shu","hua","gui","zhen","zun",
-       "yue","shan","xi","chun","dian","fa|fei","gan","mo","wu","qiao",
-       "rao|nao","lin","liu","qiao","xian","run","fan","zhan|jian","tuo","liao",
-       "yun","shun","tui|dun","cheng","tang|cheng","meng","ju","cheng","su|qiu","jue",
-       "jue","tan|dian","hui","ji","nuo","xiang","tuo","ning","rui","zhu",
-       "tong|chuang","zeng|ceng","fen|fei","qiong","ran|yan","heng","qian","gu","liu","lao",
-       "gao","chu","xi","sheng","zi","zan","ji","dou","jing","lu",
-       "xian","cu|chu","yuan","ta","shu|qiao","jiang","tan","lin","nong","yin",
-       "xi","hui","shan","zui","xuan","cheng","gan","ju","zui","yi",
-       "qin","pu","yan","lei","feng","hui","dang","ji","sui","bo",
-       "ping|bo","cheng","chu","zhua","gui|hui","ji","jie","jia","qing","zhai|shi|tu",
-       "jian","qiang","dao","yi","biao","song","she","lin","li","cha",
-       "meng","yin","chou|tao|dao","tai","mian","qi","tuan","bin|bing","huo","ji",
-       "qian|lian","ni|mi","ning","yi","gao","jian|kan","yin","nou|ruan|ru","qing","yan",
-       "qi","mi","zhao","gui","chun","ji","kui","po","deng","chu",
-       "ge","mian","you","zhi","huang|guo|gu","qian","lei","lei","sa","lu",
-       "li","cuan","lv|chu","mie|mei","hui","ou","lv","zhi","gao","du",
-       "yuan","li|yue","fei","zhuo|zhu","sou","lian","jiang","chu","qing","zhu",
-       "lu","yan","li","zhu","chen","jue|ji","e","su","huai|gui","nie",
-       "yu","long","la|lai","qiao","xian","gui","ju","xiao","ling","ying",
-       "jian","yin","you","ying","xiang","nong","bo","chan|zhan","lan","ju",
-       "shuang","she","wei|zui","cong","quan","qu","cang","jiu","yu","luo",
-       "li","cuan","luan","dang","qu","yan","lan","lan","zhu","lei",
-       "li","ba","nang","yu","ling","guan","qian","ci","huan","xin",
-       "yu","yu|yi","qian|xian","ou","xu","chao","chu|qu|xi","qi","ke|ai","yi|yin",
-       "jue","xi|kai","xu","he","yu","kuai","lang","kuan","shuo|sou","xi",
-       "ei|ai","qi","qi","xu|chua","chi|chuai","qin","kuan","kan|qian","kuan","kan|ke",
-       "chuan","sha","gua","yan|yin","xin","xie","yu","qian","xiao","ye",
-       "ge","wu","tan","jin|qun","ou","hu","ti","huan","xu","pen",
-       "xi","xiao","xu","xi|she","shan","lian|han","chu","yi","e","yu",
-       "chuo","huan","zhi","zheng","ci","bu","wu","qi","bu","bu",
-       "wai","ju","qian","zhi|chi","se","chi","se|sha","zhong","sui","sui",
-       "li","ze","yu","li","gui","dai","dai","si","jian","zhe",
-       "mo|wen","mo","yao","mo","cu","yang","tian","sheng","dai","shang",
-       "xu","xun","shu","can","jing","piao","qia","qiu","su","qing|jing",
-       "yun","lian","yi","fou|bo","zhi|shi","ye|yan","can","hun|mei","dan","ji",
-       "die","zhen","yun","wen","chou","bin","ti","jin","shang","yin",
-       "chi","jiu","kui|hui","cuan","yi","dan","du","jiang","lian","bin",
-       "du","jian","jian","shu","ou","duan","zhu","yin|yan","qing|keng|sheng","yi",
-       "sha","ke|qiao","ke|qiao","xiao|yao","xun","dian","hui","hui","gu","qiao",
-       "ji","yi","ou","hui","duan","yi","xiao","wu","guan|wan","mu",
-       "mei","mei","ai","jie","du|dai","yu","bi","bi","bi","pi",
-       "pi","bi","chan","mao","hao","cai","bi","lie","jia","zhan",
-       "sai","mu","tuo","xun","er","rong","xian","ju","mu","hao",
-       "qiu","dou|nuo","mushiruPPPV","tan","pei","ju","duo","cui","bi","san",
-       "san","mao","sai|sui","shu","shu","tuo","he","jian","ta","san",
-       "lv","mu","mao","tong","rong","chang","pu","lu","zhan","sao",
-       "zhan","meng","lu","qu","die","shi|zhi","di","min","jue","meng|mang",
-       "qi","pie","nai","qi","dao","xian","chuan","fen","yang|ri","nei",
-       "nei","fu","shen","dong","qing","qi","yin","xi","hai","yang",
-       "an","ya","ke","qing","ya","dong","dan","lv","qing","yang",
-       "yun","yun","shui","shui","zheng|cheng","bing","yong","dang","shui","le",
-       "ni","tun","fan","gui|jiu","ting","zhi","qiu","bin|pa","ze","mian",
-       "cuan","hui","diao","han","cha","zhuo|que","chuan","wan","fan","da",
-       "xi","tuo","mang","qiu","qi","shan","pin","han","qian","wu",
-       "wu","xun","si","ru","gong","jiang","chi","wu","tu","jiu",
-       "tang|shang","zhi|ji","zhi","qian","mi","gu|yu","wang","jing","jing","rui",
-       "jun","hong","tai","tai","ji","bian","bian","gan|han|cen","wen|men","zhong",
-       "fang|pang","xiong","jue","hu|huang","niu|you","qi","fen","xu","xu","qin",
-       "yi","wo","yun","yuan","hang","yan","shen|chen","chen","dan","you",
-       "dun","hu","huo","qi","mu","nv|niu","mei|mo","ta|da","mian","mi|wu",
-       "chong","hong|pang","bi","sha","zhi","pei","pan","zhui|zi","za","gou",
-       "pai","mei|mo","ze","feng","ou","li","lun","cang","feng","wei",
-       "hu","mo","mei","shu","ju","za","tuo|duo","tuo","tuo|duo","he",
-       "li","mi|li","yi|chi","fa","fei","you","tian","zhi","zhao","gu",
-       "zhan","yan","si","kuang","jiong","ju","xie|yi","qiu","yi|die","jia",
-       "zhong","quan","bo|po","hui","mi|bi","ben","ze","chu|she","le","you|ao",
-       "gu","hong","gan","fa","mao","si","hu","peng|ping","ci","fan",
-       "zhi","su","ning","cheng","ling","pao","bo","qi","si","ni",
-       "ju","yue|sa","zhu","sheng","lei","xuan","jue|xue","fu","pan","min",
-       "tai","yang","ji","yong","guan","beng","xue","long|shuang","lu","dan",
-       "luo|po","xie","po","ze|shi","jing","yin","pan","jie","yie","hui",
-       "hui","zai","cheng","yin","wei","hou","jian","yang","lie","si",
-       "ji","er","xing","fu","sa|xi","se|qi|zi","zhi","yin","wu","xi|xian",
-       "kao","zhu","jiang","luo","luo","an|yan|e","dong","ti","si","lei",
-       "yi","mi","quan","jin","po","wei","xiao","xie","hong","xu",
-       "su|shuo","kuang","tao","qie|jie","ju","er","zhou","ru","ping","xun",
-       "xiong","zhi","guang","huan","ming","huo","wa","qia","pai","wu",
-       "qu","liu","yi","jia","jing","qian|jian","jiang","jiao","zhen","shi",
-       "zhuo","ce","fa","kuai|hui","ji","liu","chan","hun","hu|xu","nong",
-       "xun","jin","lie","qiu","wei","zhe","jun|xun","han","bang","mang",
-       "zhuo","you|di","xi","bo","dou","huan","hong","yi","pu","ying|cheng",
-       "lan","hao","lang","han","li","geng","fu","wu","li","chun",
-       "feng|hong","yi","yu","tong","lao","hai","jin","jia","chong","jiong",
-       "mei","sui|nei","cheng","pei","xian","shen","tu","kun","ping","nie",
-       "han","jing","xiao","she","nian","tu","yong|chong","xiao","xian","ting",
-       "e","su","tun|yun","juan","cen","ti","li","shui","si","lei",
-       "shui","tao","du","lao","lai","lian","wei","wo|guo","yun","huan",
-       "di","heng","run","jian","zhang","se","fu","guan","xing","shou|tao",
-       "shuan","ya","chuo","zhang","ye","kong|nang","wan|wo|yuan","han","tuo","dong",
-       "he","wo","ju","she","liang","hun","ta","zhuo","dian","qie|ji",
-       "de","juan","zi","xi","xiao","qi","gu","guo|guan","yan","lin",
-       "tang|chang","zhou","peng","hao","chang","shu","qi","fang","zhi","lu",
-       "nao|chuo|zhuo","ju","tao","cong","lei","zhe","ping|peng","fei","song","tian",
-       "pi|pei","dan","yu|xu","ni","yu","lu","gan","mi","jing|cheng","ling",
-       "lun","yin","cui","qu","huai","yu","nian|shen","shen","biao|hu","chun|zhun",
-       "hu","yuan","lai","hun","qing","yan","qian","tian","miao","zhi",
-       "yin","bo","ben","yuan","wen|min","ruo|re|luo","fei","qing","yuan","ke",
-       "ji","she","yuan","se","lu","zi","du|dou","yi","jian","mian|sheng",
-       "pai","xi","yu","yuan","shen","shen","rou","huan","zhu","jian",
-       "nuan","yu","qiu|wu","ting","qu|ju","du","feng","zha","bo","wo",
-       "wo|guo","ti|di","wei","wen","ru","xie","ce","wei","he","gang|jiang",
-       "yan","hong","xuan","mi","ke","mao","ying","yan","you","hong|qing",
-       "miao","sheng","mei","zai","hun","nai","gui","chi","e","pai",
-       "mei","lian","qi","qi","mei","tian","cou","wei","can","tuan",
-       "mian","hui|min|xu","po","xu","ji","pen","jian","jian","hu","feng",
-       "xiang","yi","yin","zhan","shi","jie","zhen","huang","tan","yu",
-       "bi","min|hun","shi","tu","sheng","yong","ju","dong","tuan|nuan","qiu|jiao",
-       "qiu|jiao","qiu","yan|yin","tang|shang","long","huo","yuan","nan","ban|pan","you",
-       "quan","zhuang|hun","liang","chan","xian","chun","nie","zi","wan","shi",
-       "man","ying","la","kui|hui","feng|hong","jian","xu","lou","wei","gai",
-       "bo","ying","po","jin","yan|gui","tang","yuan","suo","yuan","lian|nian|xian",
-       "yao","meng","zhun","cheng","ke","tai","da|ta","wa","liu","gou",
-       "sao","ming","zha","shi","yi","lun","ma","pu","wei","li",
-       "zai","wu","xi","wen","qiang","ze","shi","su","ai","zhen|qin",
-       "sou","yun","xiu","yin","rong","hun","su","suo","ni|niao","ta",
-       "shi","ru","ai","pan","chu|xu","chu","pang","weng","cang","mie",
-       "ge","dian","hao|xue","huang","qi|xi|xie","zi","di","zhi","xing|ying","fu",
-       "jie","hua","ge","zi","tao","teng","sui","bi","jiao","hui",
-       "gun","yin","ze|hao","long","zhi","yan","she","man","ying","chun",
-       "lv","lan","luan","yao","bin","tan","yu","xiu","hu","bi",
-       "biao","zhi","jiang","kou","shen","shang","di","mi","ao","lu",
-       "hu|xu","hu","you","chan","fan","yong","gun","man","qing","yu",
-       "piao","ji","ya","chao","qi","xi","ji","lu","lou","long",
-       "jin","guo","cong|song","lou","zhi","gai","qiang","li","yan","cao",
-       "jiao","cong","chun","tuan|zhuan","ou","teng","ye","xi","mi","tang",
-       "mo","shang","han","lian","lan","wa","chi","gan","feng|peng","xuan",
-       "yi","man","zi","mang","kang","luo|ta","ben|peng","shu","zhang","zhang",
-       "chong|zhuang","xu","huan","huo|kuo","jian","yan","shuang","liao|liu","cui","ti",
-       "yang","jiang","cong|zong","ying","hong","xiu","shu","guan","ying","xiao",
-       "cong|zong","kun","xu","lian","zhi","wei","pi|pie","yu","jiao|qiao","po",
-       "dang|xiang","hui","jie","wu","pa","ji","pan","wei","su","qian",
-       "qian","xi|ya","lu","xi","xun","dun","huang|guang","min","run","su",
-       "lao|liao","zhen","cong|zong","yi","zhi","wan","tan|shan","tan","chao","xun",
-       "kui|hui","ye","shao","tu|zha","zhu","san|sa","hei","bi","shan","chan",
-       "chan","shu","tong","pu","lin","wei","se","se","cheng","jiong",
-       "cheng|deng","hua","jiao","lao","che","gan","cun","jing","si","shu|zhu",
-       "peng","han","yun","liu","hong|gong","fu","hao","he","xian","jian",
-       "shan","xi","ao","lu","lan","ning","yu","lin","mian|sheng","zao",
-       "dang","huan","ze|shi","xie","yu","li","shi","xue","ling","wan|man",
-       "zi","yong","kuai|hui","can","lian","dian","ye","ao","huan","zhen",
-       "chan","man","gan","dan|tan","yi","sui","pi","ju","ta","qin",
-       "ji","zhuo","lian","nong","guo|wo","jin","fen|pen","se","ji|sha","sui",
-       "hui|huo","chu","ta","song","ding|ting","se","zhu","lai","bin","lian",
-       "mi|ni","shi","shu","mi","ning","ying","ying","meng","jin","qi",
-       "bi|pi","ji","hao","ru","cui|zui","wo","tao","yin","yin","dui",
-       "ci","huo|hu","qing","lan","jun|xun","ai|kai|ke","pu","zhuo|zhao","wei","bin",
-       "gu","qian","ying","bin","kuo","fei","cang","me","jian","wei|dui",
-       "luo|po","zan|cuan","lv","li","you","yang","lu","si","zhi","ying",
-       "du|dou","wang","hui","xie","pan","shen","biao","chan","mie|mo","liu",
-       "jian","pu|bao","se","cheng|deng","gu","bin","huo","xian","lu","qin",
-       "han","ying","rong","li","jing","xiao","ying","sui","wei|dui","xie",
-       "huai|wai","xue","zhu","long|shuang","lai","dui","fan","hu","lai","shu",
-       "lian","ying","mi","ji","lian","jian|zun","ying","fen","lin","yi",
-       "jian","yue","chan","dai","rang|nang","jian","lan","fan","shuang","yuan",
-       "zhuo|jiao|ze","feng","she","lei","lan","cong","qu","yong","qian","fa",
-       "guan","jue","yan","hao","ying","sa","zan|cuan","luan","yan","li",
-       "mi","shan","tan","dang|tang","jiao","chan","ying","hao","ba","zhu",
-       "lan","lan","nang","wan","luan","xun|quan","xian","yan","gan","yan",
-       "yu","huo","huo|biao","mie","guang","deng","hui","xiao","xiao","hui",
-       "hong","ling","zao","zhuan","jiu","zha|yu","xie","chi","zhuo","zai",
-       "zai","can","yang","qi","zhong","fen|ben","niu","jiong|gui","wen","pu",
-       "yi","lu","chui","pi","kai","pan","yan","yan","pang|feng","mu",
-       "chao","liao","que","kang","dun","guang","xin","zhi","guang","guang",
-       "wei","qiang","bian","da","xia","zheng","zhu","ke","zhao","fu",
-       "ba","xie","xie","ling","zhuo|chu","xuan","ju","tan","pao|bao","jiong",
-       "pao|fou","tai","tai","bing","yang","tong","shan|qian","zhu","zha","dian",
-       "wei","shi","lian","chi","huang","zhou","hu","shuo","lan","ting",
-       "jiao|yao","xu","heng","quan","lie","huan","yang","xiao","xiu","xian",
-       "yin","wu","zhou","yao","shi","wei","tong|dong","mie","zai","kai",
-       "hong","lao|luo","xia","zhu","xuan","zheng","po","yan","hui","guang",
-       "che","hui","kao","chen","fan","shao","ye","hui","uu","tang",
-       "jin","re","lie","xi","fu|pao","jiong","xie|che","pu","ting","zhuo",
-       "ting","wan","hai","peng","lang","yan","xu","feng","chi","rong",
-       "hu","xi","shu","he","xun|hun","ku","juan|ye","xiao","xi","yan",
-       "han","zhuang","qu|jun","di","xie|che","ji|qi","wu","yan","lv","han",
-       "yan","huan","men","ju","dao","bei","fen","lin","kun","hun",
-       "tun","xi","cui","wu","hong","chao|ju","fu","wo|ai","jiao","zong|cong",
-       "feng","ping","qiong","ruo","xi|yi","qiong","xin","zhuo|chao","yan","yan",
-       "yi","jue","yu","gang","ran","pi","xiong|ying","gang","sheng","chang",
-       "shao","xiong|ying","nem","geng","qu","chen","he","kui","zhong","duan",
-       "xia","hui|yun|xun","feng","lian","xuan","xing","huang","jiao","jian","bi",
-       "ying","zhu","wei","tuan","shan|qian","xi|yi","nuan","nuan","chan","yan",
-       "jiong","jiong","yu","mei","sha","wei","ye|zha","jin","qiong","rou",
-       "mei","huan","xu","zhao","wei","fan","qiu","sui","yang","lie",
-       "zhu","jie","zao","gua","bao","hu","yun","nan","shi","huo",
-       "bian","gou","tui","tang","chao","shan","en|yun","bo","huang","xie",
-       "xi","wu","xi","yun","he","he|xiao","xi","yun","xiong","xiong",
-       "shan","qiong","yao","xun","mi","lian","ying","wu","rong","gong",
-       "yan","qiang","liu","xi","bi","biao","cong|zong","lu|ao","jian","shu",
-       "yi","lou","peng|feng","sui|cui","yi","teng","jue","zong","yun|yu","hu",
-       "yi","zhi","ao","wei","liu","han|ran","ou","re","jiong","man",
-       "kun","shang","cuan","zeng","jian","xi","xi","xi","yi","xiao",
-       "chi","huang","chan|dan","ye","tan","ran","yan","xun","qiao","jun",
-       "deng","dun","shen","jiao|qiao|jue|zhuo","fen","si","liao","yu","lin","tong|dong",
-       "shao","fen","fan","yan","xun","lan","mei","tang","yi","jiong",
-       "men","zhu","jiao","ying","yu","yi","xue","lan","tai|lie","zao",
-       "can","sui","xi","que","zong","lian","hui","zhu","xie","ling",
-       "wei","yi","xie","zhao","hui","da","nong","lan","xu","xian",
-       "he","xun","jin","chou","tao","yao","he","lan","biao","rong|ying",
-       "li|lie","mo","bao","ruo","lv","la|lie","ao","xun","kuang|huang","shuo",
-       "liao","li","lu","jue","liao","yan|xun","xi","xie","long","ye",
-       "can","rang","yue","lan","cong","jue","chong","guan","qu","che",
-       "mi","tang","lan","zhu","lan","ling","cuan","yu","zhao|zhua","zhao|zhua",
-       "pa","zheng","pao","cheng|chen","yuan","ai","wei","han","jue","jue",
-       "fu","ye","ba","die","ye","yao","zu","shuang","er","pan",
-       "chuang","ke","zang","die","qiang","yong","qiang","pian","ban","pan",
-       "chao","jian","pai","du","chuang","yu","zha","bian|mian","die","bang",
-       "bo","chuang","you","you|yong","du","ya","cheng","niu","niu","pin",
-       "jiu|le","mou|mu","ta","mu","lao","ren","mang","fang","mao","mu",
-       "gang","wu","yan","ge|qiu","bei","si","jian","gu","you|chou","ke",
-       "sheng","mu","di","qian","quan","quan","zi","te","xi","mang",
-       "keng","qian","wu","gu","xi","li","li","pou","ji","gang",
-       "zhi|te","ben","quan","chun","du","ju","jia","jian|qian","feng","pian",
-       "ke","ju","kao","chu","xi","bei","luo","jie","ma","san",
-       "wei","mao|li","dun","tong","qiao","jiang","xi","li","du","lie",
-       "bai","piao","bao","xi","chou","wei","kui","chou","quan","quan",
-       "quan|ba","fan","qiu","ji","chai","zhuo|bao","han|an","ge","zhuang","guang",
-       "ma","you","kang|gang","pei|fei","hou","ya","yin","huan|fan","zhuang","yun",
-       "kuang","niu","di","kuang","zhong","mu","bei","pi","ju","yi|quan|chi",
-       "sheng|xing","pao","xia","tuo|yi","hu","ling","fei","pi","ni","yao",
-       "you","gou","xue","ju","dan","bo","ku","xian","ning","huan",
-       "hen","jiao","he","zhao","jie","xun","shan","ta|shi","rong","shou",
-       "tong|dong","lao","du","xia","shi","kuai","zheng","yu","sun","yu",
-       "bi","mang|dou","xi|shi","juan","li","xia","yin","suan","lang","bei",
-       "zhi","yan","sha","li","han","xian","jing","pai","fei","xiao",
-       "bai|pi","qi","ni","biao","yin","lai","lie","jian|yan","qiang","kun",
-       "yan","guo","zong","mi","chang","yi","zhi","zheng","ya|wei","meng",
-       "cai","cu","she","lie","ceon","luo","hu","zong","gui","wei",
-       "feng","wo","yuan","xing","zhu","mao","wei","chuan","xian","tuan",
-       "ya|jia|qie","nao","xie|he|ge|hai","jia","hou","bian|pian","you","you","mei","cha",
-       "yao","sun","bo|po","ming","hua","yuan","sou","ma","huan","dai",
-       "yu","shi","hao","qiang","yi","zhen","cang","hao|gao","man","jing",
-       "jiang","mo","zhang","chan","ao","ao","hao","suo","fen","jue",
-       "bi","bi","huang","pu","lin","xu","tong","yao|xiao","lao","shuo|xi",
-       "xiao","shou","dun","jiao","ge|lie|xie","juan","du","hui","kuai","xian",
-       "xie","ta","xian","xun","ning","bian|pian","huo","nou|ru","meng","lie",
-       "nao|you","guang","shou","lu","ta","xian","mi","rang","huan","nao|you",
-       "luo","xian","qi","jue","xuan","miao","zi","shuai|lv","lu","yu",
-       "su","wang","qiu","ga","ding","le","ba","ji","hong","di",
-       "chuan","gan","jiu","yu","qi","yu","chang|yang","ma","hong","wu",
-       "fu","min|wen","jie","ya","bin|fen","bian","bang","yue","jue","men|yun",
-       "jue","wan","jian|qian","mei","dan","pin","wei","huan","xian","qiang|cang",
-       "ling","dai","yi","an|gan","ping","dian","fu","xuan|xian","xi","bo",
-       "ci","gou","jia","shao","po","ci","ke","ran","sheng","shen",
-       "yi|tai","zu|ju","jia","min","shan","liu","bi","zhen","zhen","jue",
-       "fa","long","jin","jiao","jian","li","guang","xian","zhou","gong",
-       "yan","xiu","yang","xu","luo","su","zhu","qin","yin|ken","xun",
-       "bao","er","xiang","yao","xia","hang","gui","chong","xu","ban",
-       "pei","lao","dang","ying","hun|hui","wen","e","cheng","di|ti","wu",
-       "wu","cheng","jun","mei","bei","ting","xian","chu","han","xuan|qiong",
-       "yan","qiu","xuan","lang","li","xiu","fu","liu","ya","xi",
-       "ling","li","jin","lian","suo","suo","feng","wan","dian","pin|bing",
-       "zhan","cui|se","min","yu","ju","chen","lai","min","sheng","wei|yu",
-       "tian","shu","zhuo|zuo","beng|pei","cheng","hu","qi","e","kun","chang",
-       "qi","beng","wan","lu","cong","guan","yan","diao","bei","lin",
-       "qin","pi","pa","que","zhuo","qin","fa","jin","qiong","du",
-       "jie","hun|hui","yu","mao","mei","chun","xuan","ti","xing","dai",
-       "rou","min","jian","wei","ruan","huan","xie|jie","chuan","jian","zhuan",
-       "chang|yang","lian","quan","xia","duan","yuan","ye","nao","hu","ying",
-       "yu","huang","rui","se","liu","shi","rong","suo","yao","wen",
-       "wu","zhen","jin","ying","ma","tao","liu","tang","li","lang",
-       "gui","tian|zhen","qiang|cang","cuo","jue","zhao","yao","ai","bin|pian","tu|shu",
-       "chang","kun","zhuan","cong","jin","yi","cui","cong","qi","li",
-       "jing","zao|suo","qiu","xuan","ao","lian","men","zhang","yin","ye",
-       "ying","zhi","lu","wu","deng","xiu","zeng","xun","qu","dang",
-       "lin","liao","qiong|jue","su","huang","gui","pu","jing","fan","jin",
-       "liu","ji","hui","jing","ai","bi","can","qu","zao","dang",
-       "jiao","guan","tan","hui|kuai","huan","se","sui","tian","chu","yu",
-       "jin","lu|fu","bin|pian","shu","wen","zui","lan","xi","ji|zi","xuan",
-       "ruan","wo","gai","lei","du","li","zhi","rou","li","zan",
-       "qiong","ti","gui","sui","la","long","lu","li","zan","lan",
-       "ying","mi|xi","xiang","qiong|wei","guan","dao","zan","huan|ye|ya","gua","bo",
-       "die","bo|pao","hu","zhi|hu","piao","ban","rang","li","wa","shiwa",
-       "xiang|hong","qianwa","ban","pen","fang","dan","weng","ou","fenwa","maowa",
-       "ki ro ton|mao wa","hu","ling","yi","ping","ci","bai","juan","chang","chi",
-       "liwa","dang","wa","bu","zhui","ping","bian","zhou","zhen","liwa",
-       "ci","ying","qi","xian","lou","di","ou","meng","zhuan","beng",
-       "lin","zeng","wu","pi","dan","weng","ying","yan","gan","dai",
-       "shen","tian","tian","han","chang","sheng","qing","shen","chan","chan",
-       "rui","sheng","su","shen","yong","shuai","lu","fu","yong","beng",
-       "beng","ning","tian","you","jia","shen","you","dian","fu","nan",
-       "dian|tian|sheng","ping","ting|ding","hua","ting|ding","zhen","zai|zi","meng","bi","bi|qi",
-       "mu","xun","liu","chang","mu","yun","fan","fu","geng","tian",
-       "jie","jie","quan","wei","fu|bi","tian","mu","tap","pan","jiang",
-       "wa","da|fu","nan","liu","ben","zhen","xu|chu","mu","mu","ce|ji",
-       "zai|zi","gai","bi","da","zhi|chou|shi","lve","qi","lve","fan|pan","yi",
-       "fan|pan","hua","she|yu","she","mu","jun","yi","liu","she","die",
-       "chou","hua","dang","zhui","ji","wan","jiang","cheng","chang","tuan",
-       "lei","ji","cha","liu","die","tuan","lin","jiang","jiang|qiang","chou",
-       "pi","die","die","pi|ya|shu","jie|qie","dan","shu","shu","zhi|di","yi|ni",
-       "ne","nai","ding","bi","jie","liao","gang","ge|yi","jiu","zhou",
-       "xia","shan","xu","n<e|yao","li|lai","yang","chen","you","ba","jie",
-       "jue|xue","qi","ya|xia","cui","bi","yi","li","zong","chuang","feng",
-       "zhu","pao","pi","gan","ke","ci","xue","zhi","da","zhen",
-       "fa|bian","zhi","teng","ju","ji","fei","gou","shan|dian","jia","xuan",
-       "zha","bing","nie","zheng","yong","jing","quan","teng|chong","tong","yi",
-       "jie","wei|you|yu","hui","tan|shi","yang","zhi","zhi","hen","ya","mei",
-       "dou","jing","xiao","tong","tu","mang","pi","xiao","suan","pu",
-       "li","zhi","cuo","duo","wu","sha","lao","shou","huan","xian",
-       "yi","beng|peng","zhang","guan","tan","fei","ma","ma|lin","chi","ji",
-       "tian|dian","an|ye|e","chi","bi","bi","min","gu","dui","ke|e","wei",
-       "yu","cui","ya","zhu","cu","dan","shen","zhong","zhi|chi","yu",
-       "hou","feng","la","yang","chen","tu","yu","guo","wen","huan",
-       "ku","jia|xia","yin","yi","lou","sao","jue","chi","xi","guan",
-       "yi","wen","ji","chuang","ban","hui|lei","liu","chai|cuo","shou","n<e|yao",
-       "dian|chen","da|dB","bie","tan","zhang","biao","shen","cu","luo","yi",
-       "zong","chou","zhang","zhai","sou","se","que","diao","lou","lou",
-       "mo","qin","yin","ying","huang","fu","liao","long","qiao|jiao","liu",
-       "lao","xian","fei","dan","yin","he","ai","ban","xian","guan",
-       "gui|wei","nong","yu","wei","yi","yong","pi","lei","li|lai","shu",
-       "dan","lin","dian","lin","la","bie","ji","chi","yang","xuan",
-       "jie","zheng","mo","li","huo","la","ji","dian","xuan","ying",
-       "yin","qu","yong","tan","dian","luo","luan","luan","bo","uu",
-       "gui","ba","fa","deng","fa","bai","bai","qie","ji|bi","zao",
-       "zao","mao","di|de","pa|ba","jie","huang","gui","ci","ling","gao|yao",
-       "mo","ji","jiao","peng","gao|yao","ai","e","hao","han","bi",
-       "wan","chou","qian","xi","ai","xiao","hao","huang","hao","ze",
-       "cui","hao","xiao","ye","po","hao","jiao","ai","xing","huang",
-       "li|luo|bo","piao","he","jiao","pi","gan","pao","zhou","jun","qiu",
-       "cun","que","zha","gu","jun","jun","zhou","zha|cu","gu","zhao|zhan|dan",
-       "du","min","qi","ying","yu","bei","diao","zhong","pen","he",
-       "ying","he","yi","bo","wan","he","ang","zhan","yan","jian",
-       "he","yu","kui","fan","gai|ge|he","dao","pan","fu","qiu","sheng|cheng",
-       "dao","lu","zhan","meng","li","jin","xu","jian","pan","guan",
-       "an","lu","xu","zhou|chou","dang","an","gu","li","mu","ding",
-       "gan","xu","mang","mang|wang","zhi","qi","yuan","xian|tian","xiang","dun",
-       "xin","xi|pan","pan","feng","dun","min","ming","sheng|xing","shi","yun|hun",
-       "mian","pan","fang","miao","dan","mei","mao","kan","xian","kou",
-       "shi","yang|ying","zheng","yao|ao","shen","huo","da","zhen","kuang","ju|xu|kou",
-       "shen","yi|chi","sheng","mei","mo|mie","zhu","zhen","zhen","mian","shi",
-       "yuan","die|ti","ni","zi","zi","chao","zha","xuan","bing|fang","pang|pan",
-       "long","gui|sui","tong","mi","die|zhi","di","ne","ming","xuan|shun|xun","chi",
-       "kuang","juan","mou","zhen","tiao","yang","yan","mo","zhong","mo",
-       "zhuo|zhao|zhe","zheng","mei","suo","qiao|shao|xiao","han","huan","di","cheng","cuo|zhuai",
-       "juan","e","mian","xian","xi","kun","lai","jian","shan","tian",
-       "gun","wan","leng","shi","qiong","li","ya","jing","zheng","li",
-       "lai","sui|zui","juan","shui","sui","du","bi","bi","mu","hun",
-       "ni","lu","yi|ze|gao","jie","cai","zhou","yu","hun","ma","xia",
-       "xing","hui","hun","zai","chun","jian","mei","du","hou","xuan",
-       "ti","kui","gao","rui","mao","xu","fa","wo","miao","chou",
-       "gui|wei|kui","mi","weng","kou|ji","dang","chen","ke","sou","xia","qiong|huan",
-       "mo","ming","man|men","fen","ze","zhang","yi","diao|dou","kou","mo",
-       "shun","cong","lou|lv","chi","man|men","piao","cheng","gui","meng","wan",
-       "run|shun","pie","xi","qiao","pu","zhu","deng","shen","shun","liao",
-       "che","xian|jian","kan","ye","xue","tong","wu|mi","lin","gui|kui","jian",
-       "ye","ai","hui","zhan","jian","gu","zhao","qu|ju","wei","chou",
-       "sao","ning|cheng","xun","yao","huo|yue","meng","mian","pin","mian","lei",
-       "kuang|guo","jue","xuan","mian","huo","lu","meng","long","guan|quan","man",
-       "xi","chu","tang","kan","zhu","mao","jin|qin|guan","jin|qin|guan","yu|xu|jue","shuo",
-       "ze","jue","shi","yi","shen","zhi","hou","shen","ying","ju",
-       "zhou","jiao","cuo","duan","ai","jiao","zeng","yue","ba","shi|dan",
-       "ding","qi","ji","zi","gan","wu","zhe","ku","gang|qiang|kong","xi",
-       "fan","kuang","dang","ma","sha","dan","jue","li","fu","min",
-       "e","xu|hua","kang","zhi","qi|qie","kan","jie","pin|bin|fen","e","ya",
-       "pi","zhe","yan","sui","zhuan","che","dun","wa","yan","jin",
-       "feng","fa","mo","zha","ju","yu","ke|luo","tuo","tuo","di",
-       "zhai","zhen","e","fu|fei","mu","zhu","li|la","bian","nu","ping",
-       "peng","ling","pao","le","po","bo","po","shen","za","ai",
-       "li","long","tong","yong","li","kuang","chu","keng","quan","zhu",
-       "kuang|guang","gui","e","nao","qia","lu","wei|gui","ai","luo|ge","ken|xian|gun|yin",
-       "xing","yan","dong","peng|ping","xi","lao","hong","shuo|shi","xia","qiao",
-       "qing","wei|ai|gai","qiao","ce","keng","xiao","que|ke|ku","chan","lang","hong",
-       "yu","xiao","xia","mang|bang","luo|long","yong|tong","che","che","wo","liu",
-       "ying","mang","que","yan","sha","kun","yu","ze","hua","lu",
-       "chen","jian","nve","song","zhuo","keng","peng","yan","zhui|chui|duo","kong",
-       "cheng","qi","zong|cong","qing","lin","jun","bo","ding","min","diao",
-       "jian|zhan","he","lu|liu","ai","sui","que|xi","leng","bei","yin","dui",
-       "wu","qi","lun","wan","dian","nao|gang","bei","qi","chen","ruan",
-       "yan","die","ding","zhou","tuo","jie|ya","ying","bian","ke","bi",
-       "wei","shuo|shi","zhen","duan","xia","dang","ti|di","nao","peng","jian",
-       "di","tan","cha","tian","qi","dun","feng","xuan","que","que|qiao",
-       "ma","gong","nian","su|xie","e","ci","liu","si|ti","tang","bang|pang",
-       "hua|ke|gu","pi","kui|wei","sang","lei","cuo","tian","xia|qia|ya","xi","lian|qian",
-       "pan","wei|ai|gai","yun","dui","zhe","ke","la","zhuan","yao","gun",
-       "zhuan","chan","qi","ao|qiao","peng","liu","lu","kan","chuang","chen",
-       "yin","lei","biao","qi","mo","qi|zhu","cui","zong","qing","chuo",
-       "lun","ji","shan","lao|luo","qu","zeng","deng","jian","xi","lin",
-       "ding","dian","huang","pan|bo","ji|she","qiao","di","li","jian","jiao",
-       "xi","zhang","qiao","dun","jian","yu","zhui","he|qiao","ke|huo","ze",
-       "lei","jie","chu","ye","que|hu","dang","yi","jiang","pi","pi",
-       "yu","pin","e|qi","ai","ke","jian","yu","ruan","meng","pao",
-       "ci","bo","yang","mie","ca","xian|xin","kuang","lei","lei","zhi",
-       "li","li","fan","que","pao","ying","li","long","long","mo",
-       "bo","shuang","guan","jian","ca","yan","shi","shi","li","reng",
-       "she","yue","si","qi","ta","ma","xie","yao","xian","zhi|qi",
-       "qi","zhi","beng|fang","dui","zhong","ren","yi","shi","you","zhi",
-       "tiao","fu","fu","mi|bi","zu","zhi","suan","mei","zuo","qu",
-       "hu","zhu","shen","sui","ci","chai","mi","lv","yu","xiang",
-       "wu","tiao","piao","zhu","gui","xia","zhi","ji|zhai","gao","zhen",
-       "gao","shui|lei","jin","shen","gai","kun","di","dao","huo","tao",
-       "qi","gu","guan","zui","ling","lu","bing","jin","dao","zhi",
-       "lu","chan|shan","bi|pi","chu","hui","you|chao","xi","yin","zi","huo",
-       "zhen","fu","yuan","xu","xian","shang|yang","ti|zhi","yi","mei","si",
-       "di","bei","zhuo","zhen","ying","ji","gao","tang","si","ma",
-       "ta","fu","xuan","qi","yu","xi","ji","si","shan|chan","dan",
-       "gui","sui","li","nong","mi","dao","li","rang","yue","ti",
-       "zan","lei","rou","yu","yu|ou","li","xie","qin","he","tu",
-       "xiu","si","ren","tu","zi","cha|na","gan","yi|zhi","xian","bing",
-       "nian","qiu","qiu","zhong","fen","hao|mao","yun","ke","miao","zhi",
-       "jing","bi","zhi","yu","mi|bi","ku","ban","pi","ni","li",
-       "you","zu","pi","bo","ling","mo","cheng","nian","qin","yang",
-       "zuo","zhi","di","shu","ju","zi","huo|kuo","ji","cheng|chen","tong",
-       "shi|zhi","huo|kuo","huo","yin","zi","zhi","jie","ren","du","yi",
-       "zhu","hui","nong","fu|pu","xi","gao","lang","fu","xun|ze","shui",
-       "lv","kun","gan","jing","ti","cheng","tu|shu","shao","shui","ya",
-       "lun","lu","gu","zuo","ren","zhun","bang","bai","ji|qi","zhi",
-       "zhi","kun","leng|ling","peng","ke","bing","chou","zui|zu|su","yu","su",
-       "lve","uu","yi","xi|qie","bian","ji","fu","pi|bi","nuo","jie",
-       "zhong","zong","xu","cheng|chen","dao","wen","xian|jian|lian","zi|jiu","yu","ji",
-       "xu","zhen","zhi","dao","jia","ji|qi","gao","gao","gu","rong",
-       "sui","rong","ji","kang","mu","can|shan|cen","men|mei","zhi","ji","lu",
-       "su","ji","ying","wen","qiu","se","kweok","yi","huang","qie",
-       "ji","sui","xiao|rao","pu","jiao","zhuo|bo","tong|zhong","zuo","lu","sui",
-       "nong","se","hui","rang","nuo","yu","pin","ji","tui","wen",
-       "cheng|chen","huo","kuang","lv","biao|pao","se","rang","zhuo|jue","li","cuan|zan",
-       "xue","wa","jiu","qiong","xi","qiong","kong","yu","shen","jing",
-       "yao","chuan","zhun","tu","lao","qie","zhai","yao","bian","bao",
-       "yao","bing","wa","zhu|ku","jiao|liao|liu","qiao","diao","wu","wa|gui","yao",
-       "zhi","chuang","yao","tiao|yao","jiao","chuang","jiong","xiao","cheng","kou",
-       "cuan","wo","dan","ku","ke","zhuo","huo","su","guan","kui",
-       "dou","zhuo","yin|xun","wo","wa","ya|ye","yu","ju","qiong","yao",
-       "yao","tiao","chao","yu","tian|dian|yan","diao","ju","liao","xi","wu",
-       "kui","chuang","chao|ke","kuan|cuan","kuan|cuan","long","cheng","cui","liao","zao",
-       "cuan","qiao","qiong","dou","zao","long","qie","li","chu","shi",
-       "fu","qian","chu|qi","hong","qi","hao","sheng","fen","shu","miao",
-       "qu|kou","zhan","zhu","ling","long","bing","jing","jing","zhang","bai",
-       "si","jun","hong","tong","song","jing|zhen","diao","yi","shu","jing",
-       "qu","jie","ping","duan","li","zhuan","ceng|zeng","deng","cun","wai",
-       "jing","kan","jing","zhu","zhu|du","le|jin","peng","yu","chi","gan",
-       "mang","zhu","wan","du","ji","jiao","ba","suan","ji","qin",
-       "zhao","sun","ya","zhui|rui","yuan","hu","hang","xiao","cen|jin|han","pi|bi",
-       "bi","jian","yi","dong","shan","sheng","da|xia|na","di","zhu","na",
-       "chi","gu","li","qie","min","bao","tiao","si","fu","ce",
-       "ben","fa","da","zi","di","ling","zuo|ze","nu","fu|fei","gou",
-       "fan","jia","ge","fan","shi","mao","po","ti","jian","qiong",
-       "long","min","bian","luo","gui","qu","chi","yin","yao","xian",
-       "bi","qiong","kuo","deng","jiao","jin","quan","sun","ru","fa",
-       "kuang","zhu","tong","ji","da","hang","ce","zhong","kou","lai",
-       "bi","shai","dang","zheng","ce","fu","yun|jun","tu","pa","li",
-       "lang","ju","guan","jian","han","tong","xia","zhi","cheng","suan",
-       "shi","zhu","zuo","xiao","shao","ting","ce","yan","gao","kuai",
-       "gan","chou","kuang","gang","yun","o","qian","xiao","jian","pou|bu|fu|pu",
-       "lai","zou","pai|bei","bi","bi","ge","tai|chi","guai|dai","yu","jian",
-       "zhao|dao","gu","chi","zheng","qing|jing","sha","zhou","lu","bo","ji",
-       "lin","suan","jun|qun","fu","zha","gu","kong","qian","quan","jun",
-       "chui","guan","wan|yuan","ce","zu","po","ze","qie","tuo","luo",
-       "dan","xiao","ruo","jian","xuan","bian","sun","xiang","xian","ping",
-       "zhen","xing","hu","shi|yi","zhu","yue|yao|chuo","chun","lv","wu","dong",
-       "shuo|xiao|qiao","ji","jie","huang","xing","mei","fan","chuan","zhuan","pian",
-       "feng","zhu","hong","qie","hou","qiu","miao","qian","gu","kui",
-       "yi","lou","yun","he","tang","yue","chou","gao","fei","ruo",
-       "zheng","gou","nie","qian","xiao","cuan","gong|gan|long","peng|pang","du","li",
-       "bi","zhuo|huo","chu","shai","chi","zhu","qiang|cang","long","lan","jian",
-       "bu","li","hui","bi","zhu|di","cong","yan","peng","cen|zan|can","zhuan|zuan|suan",
-       "pi","piao|biao","dou","yu","mie","tuan|zhuan","ze","shai","guo|gui","yi",
-       "hu","chan","kou","cu","ping","zao","ji","gui","su","lou",
-       "ce|ji","lu","nian","suo","cuan","diao","suo","le","duan","zhu",
-       "xiao","bo","mi|mie","shai|si","dang","liao","dan","dian","fu","jian",
-       "min","kui","dai","jiao","deng","huang","sun|zhuan","lao","zan","xiao",
-       "lu","shi","zan","qi","pai","qi","pai","gan","ju","lu",
-       "lu","yan","bo","dang","sai","zhua","gou","qian","lian","bu|bo",
-       "zhou","lai","shi","lan","kui","yu","yue","hao","zhen|jian","tai",
-       "ti","nie","chou","ji","yi","qi","teng","zhuan","zhou","fan|pan|bian",
-       "sou|shu","zhou","qian","zhuo","teng","lu","lu","jian","tuo","ying",
-       "yu","lai","long","shen shi|sen si|qie","lian","lan","qian","yue","zhong","qu",
-       "lian","bian","duan","zuan","li","shai","luo","ying","yue","zhuo",
-       "yu","mi","di","fan","shen","zhe","shen","nv","he","lei",
-       "xian","zi","ni","cun","zhang","qian","zhai","bi","ban","wu",
-       "sha|chao","kang|jing","rou","fen","bi","cui","yin","zhe","mi","ta",
-       "hu","ba","li","gan","ju","po","yu","cu","nian","zhou",
-       "chi","su","tiao","li","xi","su","hong","tong","zi|ci","ce|se",
-       "yue","zhou|yu","lin","zhuang","bai","lao","fen","er","qu","he",
-       "liang","xian","fu","liang","can","jing","li","yue","lu","ju",
-       "qi","cui","bai","zhang","lin","zong","jing","guo","hua","san|shen",
-       "shen","tang","bian","rou","mian","hou","xu","zong","hu","jian",
-       "zan","ci","li","xie","fu","nuo","bei","gu|gou","xiu","gao",
-       "tang","qiu","jia","cao","zhuang","tang","mi|mei","san|shen","fen","zao",
-       "kang","jiang","mo","san|shen","san","nuo","xi","liang","jiang","kuai",
-       "bo","huan","shu","zong","xian","nuo","tuan","nie","li","zuo",
-       "di","nie","tiao","lan","mi|si","si","jiu","xi|ji","gong","zheng",
-       "jiu","gong","ji","cha","zhou","xun","yue|yao","hong|gong","yu","he|ge",
-       "wan","ren","wen","wen","qiu","na","zi","tou","niu","fou",
-       "ji|jie","shu","chun","bi","zhen","sha","hong","zhi","ji","fen",
-       "yun","ren","dan","jin","su","fang","suo","cui","jiu","zha|za",
-       "ha","jin","fu","zhi","qi","zi","chou","hong","zha|za","lei",
-       "xi","fu","xie","shen","bo|bi","zhu","qu","ling","zhu","shao",
-       "gan","yang","fu","tuo","zhen|tian","dai","chu","shi","zhong","xian",
-       "zu","jiong","ban","qu","mo","shu","zui","kuang","jing","ren",
-       "hang","xie","jie","zhu","chou","gua|kua","bai|mo","jue","kuang","hu",
-       "ci","huan|geng","geng","tao","xie|jie","ku","jiao","quan|shuan","gai|ai","luo|lao",
-       "xuan","beng|bing|peng","xian","fu","gei|ji","tong|dong","rong","tiao|diao|dao","yin","lei",
-       "xie","juan","xu","gai|hai","die","tong","si","jiang","xiang","hui",
-       "jue","zhi","jian","juan","chi|zhi","mian|wen|man|wan","zhen","lv","cheng","qiu",
-       "shu","bang","tong","xiao","huan|wan","qin|xian","geng","xu","ti","xiu",
-       "xie","hong","xi","fu","ting","sui","dui","kun","fu","jing",
-       "hu","zhi","yan|xian","jiong","feng","ji","xu","ren","zong|zeng","lin|chen",
-       "duo","li|lie","lv","jing","chou","quan","shao","qi","qi","zhun",
-       "ji|qi","wan","qian|qing|zheng","xian","shou","wei","qing|qi","tao","wan","gang",
-       "wang","beng","zhui","cai","guo","cui","lun|guan","liu","qi","zhan",
-       "bi","chuo|chao","ling","mian","qi","ji","tian|tan|chan","zong","gun","zou",
-       "xi","zi","xing","liang","gei|ji","fei","rui","min","yu","zong",
-       "fan","lv|lu","xu","ying","shang","zi","xu","xiang","jian","ke",
-       "xian","ruan","mian","ji|qi","duan","chong|zhong","di","min","miao|mao","yuan",
-       "xie|ye","bao","si","qiu","bian","huan","geng","zong","mian","wei",
-       "fu","wei","tou|xu|shu","gou","miao","xie","lian","zong","bian|pian","gun|yun",
-       "yin","ti","gua|wo","zhi","yun|wen","cheng","chan","dai","xie","yuan",
-       "zong","xu","sheng","wei","geng","seon","ying","jin","yi","zhui",
-       "ni","bang","gu","pan","zhou","jian","ci|cuo|suo","quan","shuang","yun|wen",
-       "xia","cui|sui|shuai","xi","rong","tao","fu","yun","zhen","gao","ru",
-       "hu","zai|zeng","teng","xian|xuan","su","zhen","zong","tao","huang","cai",
-       "bi","feng","cu","li","suo|su","yan|yin","xi","zong","lei","zhuan|juan",
-       "qian","man","zhi","lv","mu|mo","piao","lian","mi","xuan","zong",
-       "ji","shan","sui","fan|po","lv","beng","yi","sao","mou|miu|miao|mu|liao","yao|you|zhou",
-       "qiang","sheng","xian","ji","zong","xiu","ran","xuan","sui","qiao",
-       "zeng","zuo","zhi","shan","san","lin","ju|jue","fan","liao","chuo",
-       "zun","jian","rao","chan","rui","xiu","hui","hua","zuan","xi",
-       "qiang","wen","da","sheng","hui","xi|ji","se","jian","jiang","huan",
-       "qiao|sao","cong","xie","jiao|zhuo","bi","dan|tan|chan","yi","nong","sui","yi",
-       "sha","ru","ji","bin","qian","lan","pu|fu","xun","zuan","zi",
-       "peng","yao|li","mo","lei","xie","zuan","kuang","you","xu","lei",
-       "xian","chan","jiao","lu","chan","ying","cai","xiang|rang","qian","zui",
-       "zuan","luo","li|xi|sa","dao","lan","lei","lian","si","jiu","yu",
-       "hong|gong","zhou","xian|qian","he|ge","yue|yao","ji","wan","kuang","ji","ren",
-       "wei","yun","hong","chun","pi|bi","sha","gang","na","ren","zong",
-       "lun|guan","fen","zhi","wen","fang","zhu","zhen","niu","shu","xian",
-       "gan","xie","fu","lian","zu","shen","xi","zhi","zhong","zhou",
-       "ban","fu","chu","shao","yi","jing","dai","bang","rong","jie",
-       "ku","rao","die","hang","hui","gei|ji","xuan","jiang","luo|lao","jue",
-       "jiao","tong","bing","xiao","juan","xiu","xi","sui","tao","ji",
-       "ti","ji","xu","ling","ying","xu","qi","fei","chuo|chao","shang",
-       "gun","sheng","wei","mian","shou","beng","chou","tao","liu","quan",
-       "zong|zeng","zhan","wan","lv|lu","zhui","zi","ke","xiang","jian","mian",
-       "lan","ti","miao","ji|qi","yun|wen","hui","si","duo","duan","bian|pian",
-       "xian","gou","zhui","huan","di","lv","bian","min","yuan","jin",
-       "fu","ru","zhen","feng","cui|sui|shuai","gao","chan","li","yi","jian",
-       "bin","piao","man","lei","ying","suo|su","mou|miu|miao|mu|liao","sao","xie","liao",
-       "shan","zeng","jiang","qian","qiao|sao","huan","jiao|zhuo","zuan","fou","xie",
-       "gang","fou","que","fou","que","bo","ping","xiang","zhao","gang",
-       "ying","ying","qing","xia","guan","zun","tan","cheng","qi","weng",
-       "ying","lei","tan","lu","guan","wang","wang","wang","wang","han",
-       "rb","luo","fu","shen","fa","gu","zhu","ju","mao","gu",
-       "min","gang","ba|pi","gua","ti","juan","fu","shen","yan","zhao",
-       "zui","guai|gua","zhuo","yu","zhi","an","fa","lan","shu","si",
-       "pi","ma","liu","ba|pi","fa","li","chao","wei","bi","ji",
-       "zeng","chong","liu","ji","juan","mi","zhao","luo","pi","ji",
-       "ji","luan","yang|xiang","mi","qiang","da","mei","yang|xiang","ling","you",
-       "fen","ba","gao","yang","gu","qiang","zang","mei|gao","ling","yi|xi",
-       "zhu","di","xiu","qiang","yi","xian","rong","qun","qun","qiang",
-       "huan","suo","xian","yi","you","qiang|kong","qian|xian|yan","yu","geng","jie",
-       "tang","yuan","xi","fan","shan","fen","shan","lian","lei","geng",
-       "nou","qiang","chan","yu","hong|gong","yi","chong","weng","fen","hong",
-       "chi","chi","cui","fu","xia","ben","yi","la","yi","pi|bi|po",
-       "ling","liu","zhi","qu|yu","xi","xie","xiang","xi","xi","ke",
-       "qiao","hui","hui","xiao","sha","hong","jiang","zhai|di","cui","fei",
-       "dao|zhou","sha","chi","zhu","jian","xuan","chi","pian","zong","wan",
-       "hui","hou","he","he","han","ao","piao","yi","lian","hou|qu",
-       "ao","lin","pen","qiao","ao","fan","yi","hui","xuan","dao",
-       "yao","lao","lao","kao","mao","zhe","qi|shi","gou","gou","gou",
-       "die","die","er","shua","ruan|nuo","er|nai","nai","duan|zhuan","lei","ting",
-       "zi","geng","chao","hao","yun","ba|pa","pi","si|chi","si","qu|chu",
-       "jia","ju","huo","chu","lao","lun","ji|jie","tang","ou","lou",
-       "nou","jiang","pang","zha|ze","lou","ji","lao","huo","you","mo",
-       "huai","er","yi","ding","ye","da","song","qin","yun|ying","chi",
-       "dan","dan","hong","geng","zhi","pan","nie","dan","zhen","che",
-       "ling","zheng","you","wa|tui|zhuo","liao","long","zhi","ning","tiao","er|nv",
-       "ya","tie|zhe","guo","xu","lian","hao","sheng","lie","pin","jing",
-       "ju","bi","di|zhi","guo","wen","xu","ping","cong","ding","ni",
-       "ting","ju","cong","kui","lian","kui","cong","lian","weng","kui",
-       "lian","lian","cong","ao","sheng","song","ting","kui","nie","zhi",
-       "dan","ning","qie","ni|jian","ting","ting","long","yu","yu","zhao",
-       "si","su","yi","su","si","zhao","zhao","rou","yi","lei|le",
-       "ji","qiu","ken","cao","ge","bo|di","huan","huang","chi","ren",
-       "xiao","ru","zhou","yuan","du","gang","rong|chen","gan","chai","wo",
-       "chang","gu","zhi","qin|han","fu","fei","ban","pei","pang|pan","jian",
-       "fang","zhun|chun","you","na","ang","ken","ran","gong","yu","wen",
-       "yao","qi","pi|bi","qian","xi","xi","fei","ken","jing","tai",
-       "shen","zhong","zhang","xie","shen","wei","zhou","die","dan","fei|bi",
-       "ba","bo","qu","tian","bei","gua","tai","zi|fei","fei|ku","zhi",
-       "ni","ping|peng","zi","fu|zhou","pang|pan","zhen","xian","zuo","pei","jia",
-       "sheng","zhi","bao","mu","qu","hu","qia","chi","yin","xu",
-       "yang","long","dong","ka","lu","jing","nu","yan","pang","kua",
-       "yi","guang","hai","ge","dong","chi","jiao","xiong","xiong","er",
-       "an","heng","pian","neng|nai","zi","gui|kui","zheng","tiao","zhi","cui",
-       "mei","xie","cui","xie","mai","mai","ji","xie","nin","kuai",
-       "sa","zang","qi","nao","mi","nong","luan","wan","bo","wen",
-       "wan","xiu","jiao","jing","rou","heng","cuo","lie","shan","ting",
-       "mei","chun","shen","jia","te","juan","cu","xiu","xin","tuo",
-       "pao","cheng","nei","fu","dou","tuo","niao","nao","pi","gu",
-       "luo","li","lian","zhang","cui","jie","liang","shui","pi","biao",
-       "lun","pian","guo","juan","chui","dan","tian","nei","jing","nai",
-       "la","ye","a","ren","shen","zhui","fu","fu","ju","fei",
-       "qiang","wan","dong","pi","guo","zong","ding","wo","mei","ruan",
-       "zhuan","chi","cou","luo","ou","di","an","xing","nao","shu",
-       "shuan","nan","yun","zhong","rou","e","sai","tu","yao","jian",
-       "wei","jiao","yu","jia","duan","bi","chang","fu","xian","ni",
-       "mian","wa","teng","tui","bang","qian","lv","wa","shou","tang",
-       "su","zhui","ge","yi","bo","liao","ji","pi","xie","gao",
-       "lv","bin","ou","chang","lu|biao","guo","pang","chuai","biao","jiang",
-       "fu","tang","mo","xi","zhuan|chuan|chun","lv","jiao","ying","lv","zhi",
-       "xue","cun","lin","tong","peng","ni","chuai","liao","cui","kui",
-       "xiao","teng","fan|pan","zhi","jiao","shan","hu|wu","cui","run","xiang",
-       "sui","fen","ying","shan|dan","zhua","dan","kuai","nong","tun","lian",
-       "bi|bei","yong","jue","chu","yi","juan","la|ge","lian","sao","tun",
-       "gu","qi","cui","bin","xun","nao","wo|yue","zang","xian","biao",
-       "xing","kuan","la","yan","lu","huo","za","luo","qu","zang",
-       "luan","ni|luan","za","chen","qian|xian","wo","guang|jiong","zang|cang","lin","guang|jiong",
-       "zi","jiao","nie","chou|xiu","ji","gao","chou","mian|bian","nie","zhi",
-       "zhi","ge","jian","die|zhi","zhi|jin","xiu","tai","zhen","jiu","xian",
-       "yu","cha","yao","yu","chong","xi","xi","jiu","yu","yu",
-       "xing","ju","jiu","xin","she","she","she","jiu","shi","tan",
-       "shu","shi","tian","tan","pu","pu","guan","hua","tian","chuan",
-       "shun","xia","wu","zhou","dao","chuan","shan","yi","fan","pa",
-       "tai","fan","ban","chuan","hang","fang","ban","bi","lu","zhong",
-       "jian","cang","ling","zhu","ze","duo","bo","xian","ge","chuan",
-       "xia","lu","qiong","pang","xi","kua","fu","zao","feng","li",
-       "shao","yu","lang","ting","yu","wei","bo","meng","nian","ju",
-       "huang","shou","ke","bian","mu","die","dao","bang","cha","yi",
-       "sou","cang","cao","lou","dai","xue","yao","chong","deng","dang",
-       "qiang","lu","yi","ji","jian","huo","meng","qi","lu","lu",
-       "chan","shuang","gen","liang","jian","jian","se","yan","fu","ping",
-       "yan","yan","cao","ao","yi","le","ding","qiu","ai","nai",
-       "tiao","qiu","jie","peng","wan","yi","chai|cha","mian","mi","gan",
-       "qian","yu","yu","shao","xiong","du","hu|xia","qi","mang","zi",
-       "hui|hu","sui","zhi","xiang","bi|pi","fu","tun|chun","wei","wu","zhi",
-       "qi","shan","wen","qian","ren","fu","kou","jie|gai","lu","xu|zhu",
-       "ji","qin","qi","yuan|yan","fen","ba","rui","xin","ji","hua",
-       "lun|hua","fang","wu|hu","jue","gou","zhi","yun","qin","ao","chu",
-       "mao","ya","fei|fu","reng","hang","cong","chan|yin","you","bian","yi",
-       "qie","wei","li","pi","e","xian","chang","cang","zhu","su",
-       "di|ti","yuan","ran","ling","tai","tiao|shao","di","miao","qing","ji",
-       "yong","ke|he","mu","bei","bao","gou","min","yi","yi","ju|qu",
-       "pie","ruo|re","ku","zhu|ning","ni","pa|bo","bing","shan","xiu","yao",
-       "xian","ben","hong","ying","zuo|zha","dong","cha","die","nie","gan",
-       "hu","ping|peng","mei","fu","sheng|rui","gu","bi","wei","fu","zhuo",
-       "mao","fan","jia","mao","mao","ba","ci","mo","zi","zhi",
-       "chi","ji","jing","long","cong","niao","yuan","xue","ying","qiong",
-       "ge","ming","li","rong","yin","gen","qian","chai","chen","yu",
-       "hao","zi","lie","wu","ji","gui","ci","jian","ci","hou",
-       "guang","mang","cha","jiao","jiao","fu","yu","zhu","zi","jiang",
-       "hui","yin","cha","fa","rong","ru","chong","mang","tong","zhong",
-       "qian","zhu","xun","huan","fu","quan","gai","da","jing","xing",
-       "chuan","cao","jing","er","an","qiao","chi","ren","jian","ti",
-       "huang","ping","li","jin","lao","shu","zhuang","da","jia","rao",
-       "bi","ce","qiao","hui","ji","dang","zi","rong","hun","xing",
-       "luo","ying","qian","jin","sun","yin","mai","hong","zhou","yao",
-       "du","wei","li","dou","fu","ren","yin","he","bi","bu",
-       "yun","di","tu","sui","sui","cheng","chen","wu","bie","xi",
-       "geng","li","pu","zhu","mo","li","zhuang","zuo","tuo","qiu",
-       "suo|sha","suo","chen","peng|feng","ju","mei","meng","xing","jing","che",
-       "shen|xin","jun","yan","ting","you","cuo","guan|wan","han","you","cuo",
-       "jia","wang","su|you","niu","shao|xiao","xian","lang|liang","fu|piao","e","mo|mu",
-       "wen|wan|mian","jie","nan","mu","kan","lai","lian","shi","wo","tu",
-       "xian|lian","huo","you","ying","ying","neus","chun","mang","mang","ci",
-       "wan|yun","jing","di","qu","dong","jian","zou|chu","gu","la","lu",
-       "ju","wei","jun","nie|ren","kun","he","pu","zi|zai","gao","guo",
-       "fu","lun","chang","chou","song","chui","zhan","men","cai","ba",
-       "li","tu","bo","han","bao","qin","juan","xi","qin","di",
-       "jie|sha","pu","dang","jin","qiao|zhao","tai|zhi|chi","geng","hua","gu","ling",
-       "fei","qin|jin","an","wang","beng","zhou","yan","zu","jian","lin|ma",
-       "tan","shu","tian","dao","hu","qi","he","cui","tao","chun",
-       "bi","chang","huan","fei","lai","qi","meng","ping","wei","dan",
-       "sha","huan","yan","yi","tiao","qi","wan","ce","nai","zhen",
-       "tuo","jiu","tie","luo","bi","yi","pan","bo","pao","ding",
-       "ying","ying","ying","xiao","sa","qiu","ke","xiang","wan","yu",
-       "yu","fu","lian","xuan","xuan","nan","ce","wo","chun","shao",
-       "yu","bian","mao","an","e","luo|la|lao","ying","kuo","kuo","jiang",
-       "mian","zuo","zuo","zu","bao","rou","xi","ye","an","qu",
-       "jian","fu","lv","jing","pen","feng","hong","hong","hou","xing",
-       "tu","zhu|zhuo|zhe","zi","xiang","ren","ge","qia","qing","mi","huang",
-       "shen","pu","gai","dong","zhou","qian","wei","bo","wei","pa",
-       "ji","hu","zang","jia","duan","yao","jun","cong","quan","wei",
-       "zhen","kui","ting","hun","xi","shi","qi","lan","zong","yao",
-       "yuan","mei","yun","shu","di","zhuan","guan","ran","xue","chan",
-       "kai","kui|kuai","uu","jiang","lou","wei","pai","yong","sou","yin",
-       "shi","chun","shi","yun","zhen","lang","ru|na","meng","li","que",
-       "suan","yuan|huan","li","ju","xi","bang","chu","xu|shu","tu","liu",
-       "huo","dian","qian","ju","po","cuo","yuan","chu","yu","kuai",
-       "pan","pu","pu","na","shuo","xi","fen","yun","zheng","jian",
-       "ji","ruo","cang","en","mi","hao","sun","zhen","ming","sou",
-       "xu","liu","xi","gu","lang","rong","weng","gai|ge|he","cuo","shi",
-       "tang","luo","ru","suo","xuan","bei","yao|zhuo","gui","bi","zong",
-       "gun","zuo","tiao","ce","pei","lan","dan","ji","li","shen",
-       "lang","yu","ling","ying","mo","diao|tiao|di","tiao","mao","tong","zhu",
-       "peng","an","lian","cong","xi","ping","qiu|xu|fu","jin","chun","jie",
-       "wei","tui","cao","yu","yi","zi|ju","liao|lu","bi","lu","xu",
-       "bu","zhang","lei","qiang","man","yan","ling","ji","biao","gun",
-       "han","di","su","lu","she","shang","di","mie","hun","wan",
-       "bu","di","cuo","zhe","shen","xuan","wei","hu","ao","mi",
-       "lou","cu","zhong","cai","po","jiang","mi","cong","niao","hui",
-       "juan","yin","jian","nian","shu","yin","guo","chen","hu","sha",
-       "kou","qian","ma","zang","ze","qiang","dou","lian","lin","kou",
-       "ai","bi","li","wei","ji","qian","sheng","fan","meng","ou",
-       "chan","dian","xun","jiao","rui","rui","lei","yu","qiao","zhu",
-       "hua","jian","mai","yun","bao","you","qu","lu","rao","hui",
-       "e","ti","fei","jue","zui","fa","ru","fen","kui","shun",
-       "rui","ya","xu","fu","jue","dang","wu","dong","si","xiao",
-       "xi","sa","yun","shao","qi","jian","yun","sun","ling","yu",
-       "xia","weng","ji","hong","si","nong","lei","xuan","yun","yu",
-       "xi|xiao","hao","bao|bo","hao","ai","wei","hui","hui","ji","ci",
-       "xiang","wan|luan","mie","yi","leng","jiang","can","shen","qiang|se","lian",
-       "ke","yuan","da","ti","tang","xue","bi","zhan","sun","xian|lian",
-       "fan","ding","xie","gu","xie","shu","jian","hao|kao","hong","sa",
-       "xin","xun","yao","bai","sou","shu","xun","dui","pin","yuan|wei",
-       "ning","chou|zhou","mai|wo","ru","piao","tai","ji","zao","chen","zhen",
-       "er","ni","ying","gao","cong","xiao|hao","qi","fa","jian","xu",
-       "kui","jie|ji","bian","diao|zhuo","mi","lan","jin","cang|zang","miao","qiong",
-       "qi","xian","liao","ou","xian","su","lv","yi","mai","xie",
-       "li","yi","la","lei","jiao","di","zhi","bei","teng","yao|yue",
-       "mo","huan","biao|pao","fan","sou","tan","tui","qiong","qiao","wei",
-       "liu","hui","ou","gao","yun","bao","li","shu","zhu|chu","ai",
-       "lin","zao","xuan","qin","lai","huo","tuo","wu","rui","rui",
-       "qi","heng","lu","su","tui","mang","yun","ping","yu","xun",
-       "ji","jiong","xuan","mo","qiu","su","jiong","peng","nie","nie",
-       "rang","yi","xian","yu","ju","lian","lian","yin","qiang","ying",
-       "long","tou","hua","yue","ling","qu","yao","fan","mi","lan",
-       "gui","lan","ji","dang","man","lei","lei","hui","feng","zhi",
-       "wei","kui","zhan","huai","li","ji","mi","lei","huai","luo",
-       "ji","kui","lu","jian","sal","teng","lei","quan","xiao","yi",
-       "luan","men","bie","hu","hu","lu","nve","lv","si","xiao",
-       "qian","chu","hu","xu","cuo","fu","xu","xu","lu","hu",
-       "yu","hao","jiao","ju","guo","bao","yan","zhan","zhan","kui",
-       "bin","xi","shu","chong","qiu","diao","ji","qiu","ding","shi",
-       "xia","jue","zhe","she","yu","han","zi","hong","hui","meng",
-       "ge","sui","xia","chai","shi","yi","ma","xiang","fang|bang","e",
-       "ba","chi","qian","wen","wen","rui","bang|beng","pi","yue","yue",
-       "jun","qi","tong","yin","qi|zhi","can","yuan|wan","jue|que","hui","qin|qian",
-       "qi","zhong","ya","hao","mu","wang","fen","fen","hang","gong|zhong",
-       "zao","fu","ran","jie","fu","chi","dou","bao","xian","ni",
-       "dai|de","qiu","you","zha","ping","chi","you","he","han","ju",
-       "li","fu","ran","zha","gou|qu|xu","pi","pi|bo","xian","zhu","diao",
-       "bie","bing","gu","zhan","qu","she|yi","tie","ling","gu","dan",
-       "tun","ying","li","cheng","qu","mou","ge|luo","ci","hui","hui",
-       "mang|bang","fu","yang","wa","lie","zhu","yi","xian","kuo","jiao",
-       "li","yi|xu","ping","jie","ge|ha","she","yi","wang","mo","qiong",
-       "qie|ni","gui","qiong","zhi","man","lao","zhe","jia","nao","si",
-       "qi","xing","jie","qiu","xiao","yong","jia","tui","che","bei",
-       "e|yi","han","shu","xuan","feng","shen","shen","fu","xian","zhe",
-       "wu","fu","li","lang","bi","chu","yuan","you","jie","dan",
-       "yan","ting","dian","tui","hui","wo","zhi","zhong","fei","ju",
-       "mi","qi","qi","yu","jun","la","meng","qiang","si","xi",
-       "lun","li","die","tiao","tao","kun","han","han","yu","bang",
-       "fei","pi","wei","dun","yi","yuan","suo","quan","qian","rui",
-       "ni","qing","wei","liang","guo","wan","dong","e","ban","di",
-       "wang","can","yang","ying","guo","chan","ding","la","ke","ji",
-       "xie","ting","mao","xu","mian","yu","jie","shi","xuan","huang",
-       "yan","bian","rou","wei","fu","yuan","mei","wei","fu","ru",
-       "xie","you","qiu","mao","xia","ying","shi","chong","tang","zhu",
-       "zong","di","fu","yuan","kui","meng","la","dai","hu","qiu",
-       "die","li","wo","yun","qu","nan","lou","chun","rong","ying",
-       "jiang","ban","lang","pang","si","xi","ci","xi","yuan","weng",
-       "lian","sou","ban","rong","rong","ji","wu","xiu","han","qin",
-       "yi","bi","hua","tang","yi","du","nai|neng","he|xia","hu","gui|hui",
-       "ma","ming","yi","wen","ying","teng","zhong","cang","sao","qi",
-       "man","dao","shang","shi|zhe","cao","chi","di","ao","lu","wei",
-       "die|zhi","tang","chen","piao","qu|ju","pi","yu","chan|jian","luo","lou",
-       "qin","zhong","yin","jiang","shuai","wen","xiao","wan","zhe","zhe",
-       "ma","ma","guo","liu","mao","xi","cong","li","man","xiao",
-       "chang","zhang","mang|meng","xiang","mo","zui","si","qiu","te","zhi",
-       "peng","peng","jiao","qu","bie","liao","pan","gui","xi","ji",
-       "zhuan","huang","fei|ben","lao|liao","jue","jue","hui","yin|xun","chan","jiao",
-       "shan","nao","xiao","wu","chong","xun","si","chu","cheng","dang",
-       "li","xie","shan","yi","jing","da","chan","qi","ci","xiang",
-       "she","luo","qin","ying","chai","li","zei","xuan","lian","zhu",
-       "ze","xie","mang","xie","qi","rong","jian","meng","hao","ru",
-       "huo","zhuo","jie","pin","he","mie","fan","lei","jie","la",
-       "min","li","chun","li","qiu","nie","lu","du","xiao","zhu",
-       "long","li","long","feng","ye","pi","nang","gu","juan","ying",
-       "shu","xi","can","qu","quan","du","can","man","qu","jie",
-       "zhu","zhuo","xie","huang","nv","pei","nv","xin","zhong","mai",
-       "er","ke","mie","xi","xing|hang|heng","yan","kan","yuan","qu","ling",
-       "xuan","shu","xian","tong","xiang","jie","xian","ya","hu","wei",
-       "dao","chong","wei","dao","zhun","heng","qu","yi","yi","bu",
-       "gan","yu","biao","cha","yi","shan","chen","fu","gun","fen",
-       "shuai","jie","na","zhong","dan","ri","zhong","zhong","jie","zhi",
-       "xie","ran","zhi","ren","qin","jin","jun","yuan","mei","chai",
-       "ao","niao","hui","ran","jia","tuo","ling","dai","bao|pao","pao",
-       "yao","zuo","bi","shao","tan","ju|jie","he|ke","xue","xiu","zhen",
-       "yi","pa","fu","di","wa","fu","gun","zhi","zhi","ran",
-       "pan","yi","mao","tuo","na|jue","gou","xuan","zhe","qu","bei|pi",
-       "yu","xi","mi","bo","uu","fu","chi|nuo","chi|qi|duo|nuo","ku","ren",
-       "peng","jia|jie|qia","jian|zun","bo|mo","jie","er","ge","ru","zhu","gui|gua",
-       "yin","cai","lie","ka","hang","zhuang","dang","xu","kun","ken",
-       "niao","shu","jia","kun","cheng","li","juan","shen","pou","ge|jie",
-       "yi","yu","zhen","liu","qiu","qun","ji","yi","bu","zhuang",
-       "shui","sha","qun","li","lian","lian","ku","jian","bao","chan",
-       "bi|pi","kun","tao","yuan","ling","chi","chang","chou|dao","duo","biao",
-       "liang","chang|shBng","pei","pei","fei","yuan|gun","luo","guo","yan|an","du",
-       "xi|ti","zhi","ju","yi","qi","guo","gua","ken","qi","ti",
-       "ti","fu","chong","xie","bian","die","kun","duan","xiu","xiu",
-       "he","yuan","bao","bao","fu","yu","tuan","yan","hui","bei",
-       "zhu","lv","pao","dan","yun","ta","gou","da","huai","rong",
-       "yuan","ru","nai","jiong","suo","ban","tui","chi","sang","niao",
-       "ying","jie","qian","huai","ku","lian","lan","li","zhe","shi",
-       "lv","yi","die","xie","xian","wei","biao","cao","ji","qiang",
-       "sen","bao","xiang","bi","fu","jian","zhuan","jian","cui","ji",
-       "dan","za","fan","bo","xiang","xin","bie","rao","man","lan",
-       "ao","ze","gui","cao","sui","nong","chan","lian","bi","jin",
-       "dang","shu","tan","bi","lan","fu","ru","zhi","ta","shu",
-       "wa","shi","bai","xie","bo","chen","lai","long","xi","xian",
-       "lan","zhe","dai","ju","zan","shi","jian","pan","yi","lan",
-       "ya","xi","ya","yao","feng","tan|qin","fu","fiao","fu","ba|po",
-       "he","ji","ji","jian|xian","guan","bian","yan","gui","jue|jiao","pian",
-       "mao","mi","mi","pie|mie","shi","si","chan","zhen","jue|jiao","mi",
-       "tiao","lian","yao","zhi","jun","xi","shan","wei","xi","tian",
-       "yu","lan","e","du","qin|qing","pang","ji","ming","ying","gou",
-       "qu","zhan","jin","guan","deng","jian|bian","luo|luan","qu","jian","wei",
-       "jue|jiao","qu","luo","lan","shen","di","guan","jian|xian","guan","yan",
-       "gui","mi","shi","chan","lan","jue|jiao","ji","xi","di","tian",
-       "yu","gou","jin","qu","jiao|jue","qiu","jin","cu","jue","zhi",
-       "chao","ji","gu","dan","zi|zui","di","shang","hua|xie","quan","ge",
-       "shi","jie|xie","gui","gong","chu","jie|xie","hun","qiu","xing","su",
-       "ni","ji|qi","jue","zhi","zha","bi","xing","hu","shang","gong",
-       "zhi","xue|hu","chu","xi","yi","li|lu","jue","xi","yan","xi",
-       "yan","yan","ding","fu","qiu","qiu","jiao","hong","ji","fan",
-       "xun","diao","hong","chai","tao","xu","jie","dan","ren","xun",
-       "yin","shan","qi","tuo","ji","xun","yin","e","fen","ya",
-       "yao","song","shen","yin","xin","jue","xiao","ne","chen","you",
-       "zhi","xiong","fang","xin","chao","she","yan","sa","zhun","xu",
-       "yi","yi","su","chi","he","shen","he","xu","zhen","zhu",
-       "zheng","gou","zi","zi","zhan","gu","fu","jian","die","ling",
-       "di","yang","li","nao","pan","zhou","gan","yi","ju","yao",
-       "zha","tuo","yi","qu","zhao","ping","bi","xiong","qu","ba",
-       "da","zu","tao","zhu","ci","zhe","yong","xu","xun","yi",
-       "huang","he","shi","cha","xiao","shi","hen","cha","gou","gui",
-       "quan","hui","jie","hua","gai","xiang","wei","shen","chou","tong",
-       "mi","zhan","ming","luo","hui","yan","xiong","gua","er","bing",
-       "tiao|diao","yi|chi","lei","zhu","kuang","kua","wu","yu","teng","ji",
-       "zhi","ren","cu","lang","e","kuang","ei|xi","shi","ting","dan",
-       "bei|bo","chan","you","keng","qiao","qin","shua","an","yu","xiao",
-       "cheng","jie","xian","wu","wu","gao","song","bu","hui","jing",
-       "shuo|shui|yue","zhen","shuo|shui|yue","du","hua","chang","shui|shei","jie","ke","qu|jue",
-       "cong","xiao","sui","wang","xian","fei","chi|lai","ta","yi","ni|na",
-       "yin","diao|tiao","pi|bei","zhuo","chan","chen","zhun","ji","qi","tan",
-       "zhui","wei","ju","qing","dong","zheng","ze|zuo|zha|cuo","zou","qian","zhuo",
-       "liang","jian","chu|ji","xia|hao","lun","shen","biao","hua","bian","yu",
-       "die","xu","pian","shi|di","xuan","shi","hun","hua|gua","e","zhong",
-       "di","xie","fu","pu","ting","jian","qi","yu","zi","zhuan",
-       "xi|shai|ai","hui","yin","an","xian","nan","chen","feng","zhu","yang",
-       "yan","huang","xuan","ge","nuo","xu","mou","ye","wei","xing",
-       "teng","zhou","shan","jian","bo","kui","huang","huo","ge","ying",
-       "mi","xiao","mi","xi","qiang","chen","xue","ti","su","bang",
-       "chi","qian","shi","jiang","yuan","xie","he","tao","yao","yao",
-       "lu","yu","biao","cong","qing","li","mo","mo","shang","zhe",
-       "miu","jian","ze","jie","lian","lou","can","ou","gun","xi",
-       "zhuo","ao","ao","jin","zhe","yi","hu","jiang","man","chao",
-       "han","hua","chan","xu","zeng","se","xi","zha","dui","zheng",
-       "nao","lan","e","ying","jue","ji","zun","jiao","bo","hui",
-       "zhuan","wu","zen","zha","shi","qiao","tan","jian","pu","sheng",
-       "xuan","zao","tan","dang","sui","xian","ji","jiao","jing","zhan",
-       "nong","yi","ai","zhan","pi","hui","hua","yi","yi","shan",
-       "rang","rou","qian","dui","ta","hu","zhou","hao","ai","ying",
-       "jian","yu","jian","hui","du","zhe","juan|xuan","zan","lei","shen",
-       "wei","chan","li","yi|tui","bian","zhe","yan","e","chou","wei",
-       "chou","yao","chan","rang","yin","lan","chen","xie","nie","huan",
-       "zan","yi","dang","zhan","yan","du","yan","ji","ding","fu",
-       "ren","ji","jie","hong","tao","rang","shan","qi","tuo","xun",
-       "yi","xun","ji","ren","jiang","hui","ou","ju","ya","ne",
-       "xu|hu","e","lun","xiong","song","feng","she","fang","jue","zheng",
-       "gu","he","ping","zu","shi|zhi","xiong","zha","su","zhen","di",
-       "zhou","ci","qu","zhao","bi","yi","yi|dai","kuang","lei","shi",
-       "gua","shi","jie|ji","hui","cheng","zhu","shen","hua","dan","gou",
-       "quan","gui","xun","yi","zheng","gai","xiang|yang","cha","hun","xu",
-       "zhou|chou","jie","wu","yu","qiao","wu","gao","you","hui","kuang",
-       "shuo|shui|yue","song","ei|xi","qing","zhu","zou","nuo","du|dou","zhuo","fei",
-       "ke","wei","yu","shui","shen","diao","chan","liang","zhun","sui",
-       "tan","shen","yi","mou","chen","die","huang","jian","xie","xue",
-       "ye","wei","e","yu","xuan","chan","zi","an","yan","di",
-       "mi","pian","xu","mo","dang","su","xie","yao","bang","shi",
-       "qian","mi","jin","man","zhe","jian","miu","tan","zen","qiao",
-       "lan","pu","jue","yan","qian","zhan","chen","gu","qian","hong",
-       "xia","ji","hong","han","hong","xi","xi","huo","liao","han",
-       "du","long","dou","jiang","qi","chi","li","deng","wan","bi",
-       "shu","xian","feng","zhi","zhi","yan","yan","shi","chu","hui",
-       "tun","yi","tun","yi","jian","ba","hou","e","chu","xiang",
-       "huan","jian","ken","gai","ju","fu","xi","bin","hao","yu",
-       "zhu","jia","fen","xi","hu","wen","huan","bin","di","zong",
-       "fen","yi","zhi","bao","chai","an","pi","na","pi","gou",
-       "na","you","diao","mo","si","xiu","huan","ken|kun","he|mo","he|hao|mo",
-       "mo","an","mao","li","ni","bi","yu","jia","tuan","mao",
-       "pi","xi","yi","ju|lou","mo","chu","tan","huan","jue","bei",
-       "zhen","yuan|yun","fu","cai","gong","dai","yi","hang","wan","pin",
-       "huo","fan","tan","guan","ze|zhai","zhi","er","zhu","shi","bi",
-       "zi","er","gui","pian","bian","mai","dai|te","sheng","kuang","fei",
-       "tie","yi","chi","mao","he","bi|ben","lu","lin","hui","gai",
-       "pian","zi","jia|gu","xu","zei","jiao","gai","zang","jian","ying",
-       "jun","zhen","she","bin","bin","qiu","she","chuan","zang","zhou",
-       "lai","zan","ci","chen","shang","tian","pei","geng","xian","mai",
-       "jian","sui","fu","dan","cong","cong","zhi","lai","zhang","du",
-       "jin","xiong|min","chun","yun","bao","zai","lai","feng","cang","ji",
-       "sheng","ai","zhuan|zuan","fu","gou","sai","ze","liao","yi","bai",
-       "chen","wan","zhi","zhui","biao","yun","zeng","dan","zan","yan",
-       "pu","shan","wan","ying","jin","gan","xian","zang","bi","du",
-       "shu","yan","shang","xuan","long","gan","zang","bei","zhen","fu",
-       "yuan","gong","cai","ze","xian","bai","zhang","huo","zhi","fan",
-       "tan","pin","bian","gou","zhu","guan","er","jian","bi","shi",
-       "tie","gui","kuang","dai","mao","fei","he","yi","zei","zhi",
-       "jia|gu","hui","zi","lin","lu","zang","zi","gai","jin","qiu",
-       "zhen","lai","she","fu","du","ji","shu","shang","ci","bi",
-       "zhou","geng","pei","dan","lai","feng","zhui","fu","zhuan","sai",
-       "ze","yan","zan","yun","zeng","shan","ying","gan","chi","xi",
-       "she","nan","tong","xi","cheng","he","cheng","zhe","xia","tang",
-       "zou","zou","li","jiu","fu","zhao","gan","qi","shan","qiong",
-       "yin","xian","zi","jue","qin","chi","ci","chen","chen","die|tu",
-       "qie|ju","chao","di","xi","zhan","jue","yue","qu|cu","ji|jie","qu",
-       "chu","gua|huo","xue","zi","tiao","duo","lie","gan","suo","cu",
-       "xi","zhao","su","yin","ju","jian","que|qi|ji","tang","chuo","cui",
-       "lu","qu|cu","dang","qiu","zi","ti","qu|cu","chi","huang","qiao",
-       "qiao","jiao","zao","ti|yue","er","zan","zan","zu","pa","bao|bo",
-       "kua|wu","ke","dun","jue|gui","fu","chen","jian","fang|pang","zhi","ta",
-       "yue","ba|pao","qi","yue","qiang","tuo","tai","yi","jian|chen","ling",
-       "mei","ba","die","ku","tuo","jia","ci","pao","qia","zhu",
-       "ju","dian|tie|die","zhi","fu","pan|ban","ju|qie","shan","bo","ni","ju",
-       "li|luo","gen","yi","ji","dai|duo|chi","xian","jiao","duo","zhu","quan",
-       "kua","zhuai","gui","qiong","kui","xiang","die","lu","pian|beng","zhi",
-       "jie","tiao|tao","cai","jian","da","qiao","bi","xian","duo","ji",
-       "ju","ji","shu|chou","tu","chuo","jing","nie","xiao","bu","xue",
-       "qun","mu","shu","liang","yong","jiao","chou","qiao","mou","ta",
-       "jian","ji","wo","wei","chuo","jie","ji","nie","ju","nie",
-       "lun","lu","leng","huai","ju","chi","wan","quan","ti","bo",
-       "zu","qie","qi","cu","zong","cai","zong","peng","zhi","zheng",
-       "dian","zhi","yu","duo","dun","chuan","yong","zhong","di","zhe",
-       "chen","chuai","jian","gua","tang","ju","fu","cu","die","pian",
-       "rou","nuo","ti","cha","tui","jian","dao","cuo","xi","ta",
-       "qiang","nian","dian","ti","ji","nie","pan","liu","zan","bi",
-       "chong","lu","liao","cu","tang","dai","su","xi","kui","ji",
-       "zhi","qiang","di","pan","zong","lian","beng","zao","nian","bie",
-       "tui","ju","deng","ceng","xian","fan","chu","zhong","dun","bo",
-       "cu","cu","jue","jue","lin","ta","qiao","qiao","pu","liao",
-       "dun","cuan","guan","zao","ta","bi","bi","zhu","ju","chu",
-       "qiao","dun","chou","ji","wu","yue","nian","lin","lie","zhi",
-       "li|luo","zhi","chan","chu","duan","wei","long","lin","xian","wei",
-       "zuan","lan","xie","rang","sa|xie","nie","ta","qu","ji","cuan",
-       "zuan","xi","kui","jue","lin","shen","gong","dan","fen","qu",
-       "ti","duo","duo","gong","lang","ren","luo","ai","ji","ju",
-       "tang","kong","lao","yan","mei","kang","qu","lou","lao","duo",
-       "zhi","yan","ti","dao","ying","yu","che|ju","ya|zha|ga","gui","jun",
-       "wei","yue","xin|xian","dai","xuan","fan|gui","ren","shan","kuang","shu",
-       "tun","chen","dai","e","na","qi","mao","ruan","kuang","qian",
-       "zhuan","hong","hu","qu","kuang","di","ling","dai","ao","zhen",
-       "fan","kuang","yang","peng","bei","gu","gu","pao","zhu","rong",
-       "e","ba","zhou","zhi","yao","ke","yi","qing","shi","ping",
-       "er","gong","ju","jiao","guang","lu","kai","quan","zhou","zai",
-       "zhi","she","liang","yu","shao","you","wan","yin","zhe","wan",
-       "fu","qing","zhou","ni","ling","zhe","han","liang","zi","hui",
-       "wang","chuo","guo","kan","yi","peng","qian","gun","nian","ping",
-       "guan","bei","lun","pai","liang","ruan","rou","ji","yang","xian",
-       "chuan","cou","chun","ge","you","hong","shu","fu","zi","fu",
-       "wen","fan","zhan","yu","wen","tao","gu","zhen","xia","yuan",
-       "lu","jiao","chao","zhuan","wei","hun","xue","zhe","jiao","zhan",
-       "bu","lao","fen","fan","lin","ge","se","kan","huan","yi",
-       "ji","dui","er","yu","jian","hong","lei","pei","li","li",
-       "lu","lin","che","ya","gui","xuan","dai","ren","zhuan","e",
-       "lun","ruan","hong","gu","ke","lu","zhou","zhi","yi","hu",
-       "zhen","li","yao","qing","shi","zai","zhi","jiao","zhou","quan",
-       "lu","jiao","zhe","fu","liang","nian","bei","hui","gun","wang",
-       "liang","chuo","zi","cou","fu","ji","wen","shu","pei","yuan",
-       "xia","zhan|nian","lu","zhe","lin","xin","gu","ci","ci","bi|pi",
-       "zui","bian","la","la","ci","xue","ban","bian","bian","bian",
-       "xue","bian","ban","ci","bian","bian","chen","ru","nong","nong",
-       "zhen","chuo","chuo","yi","reng","bian","dao|bian","shi","yu","liao",
-       "da","chan","gan","qian","yu","yu","qi","xun","yi","guo",
-       "mai","qi","bi","wang|kuang","tu","zhun","ying","da","yun","jin",
-       "hang","ya","fan","wu","da","e","huan|hai","zhe|zhei","da","jin",
-       "yuan","wei","lian","chi","che","chi","tiao","zhi|li","yi","jiong",
-       "jia","chen","dai","er","di","po|pai","zhu|wang","die","ze","tao",
-       "shu","yi","keop","jing","hui","dong","you","mi","beng","ji",
-       "nai","yi","jie","zhui|dui","lie","xun","tui","song","kuo","tao",
-       "pang","hou","ni","dun","jiong","xuan","xun","bu","you","xiao",
-       "qiu","tou","zhu","qiu","di","di","tu","jing","ti","dou",
-       "yi","zhe","tong","guang","wu","shi","cheng","su","zao","qun",
-       "feng","lian","suo","hui","li","gu","lai","ben","cuo","zhu",
-       "beng","huan","dai","lu","you","zhou","jin","yu","chuo","kui",
-       "wei","ti","yi","da","yuan","luo","bi","nuo","yu","dang",
-       "sui","dun","sui","yan","chuan","chi","di","yu","shi","zhen",
-       "you","yun","e","bian","guo","e","xia","huang","qiu","dao",
-       "da","wei","nan","yi","gou","yao","chou","liu","xun","ta",
-       "di","chi","yuan","su","ta","qian","ma","yao","guan","zhang",
-       "ao","shi","ca","chi","su","zao","zhe","dun","di","lou",
-       "chi","cuo","lin","zun","rao","qian","xuan","yu","wei","e",
-       "liao","ju","shi","bi","yao","mai","xie","sui","huan|hai","zhan",
-       "teng","er","miao","bian","bian","la","li|chi","yuan","yao","luo",
-       "li","yi","ting","deng","qi","yong","shan","han","yu","mang",
-       "ru","qiong","xi","kuang","fu","kang|hang","bin","fang","xing","na|nei",
-       "xin","shen","bang","yuan","cun","huo","xie|ya|ye|yu|xu","bang","wu","ju",
-       "you","han","tai","qiu","bi","pi","bing","shao","bei","wa",
-       "di","zou","ye","lin","kuang","gui","zhu","shi","ku","yu",
-       "gai|hai","he","qie|xi","zhi","ji","xun|huan","hou","xing","jiao","xi",
-       "gui","na","lang","jia","kuai","zheng","lang","yun","yan","cheng",
-       "dou","chi","lv","fu","wu","fu","gao","hao","lang","jia",
-       "geng","jun","ying","bo","xi","bei","li|zhi","yun","bu","xiao|ao",
-       "qi","pi","qing","guo","zhou","tan","zou","ping","lai","ni",
-       "chen","you","bu","xiang","dan","ju","yong","qiao","yi","du|dou",
-       "yan","mei","ruo","bei","e","shu","juan","yu","yun","hou",
-       "kui","xiang","xiang","sou","tang","ming","xi","ru","chu","zi",
-       "zou","yi","wu","xiang","yun","hao","yong","bi","mao","chao",
-       "fu","liao","yin","zhuan","hu","qiao","yan","zhang","man","qiao",
-       "xu","deng","bi","xun","bi","zeng","wei","zheng","mao","shan",
-       "lin","po","dan","meng","ye","cao","kuai","feng","meng","zou",
-       "kuang","lian","zan","chan","you","qi","yan","chan","cuo","ling",
-       "huan","xi","feng","cuo","li","you","ding","qiu","zhuo","pei",
-       "zhou","yi","gan","yu","jiu","yan","zui","mao","dan","xu",
-       "dou","zhen","fen","yuan","fu","yun","tai","tian","qia","tuo",
-       "cu","han","gu","su","fa","chou","zai","ming","lao","chuo",
-       "chou","you","tong","zhi","xian","jiang","cheng","yin","tu","jiao",
-       "mei","ku","suan","lei","pu","zui","hai","yan","shai","niang",
-       "wei","lu","lan","yan","tao","pei","zhan","chun","tan|dan","zui",
-       "zhui","cu","kun","ti","xian","du","hu","xu","xing","tan",
-       "qiu|chou","chun","yun","fa","ke","sou","mi","quan","chou","cuo",
-       "yun","yong","ang","zha","hai","tang","jiang","piao","chan|chen","yu",
-       "li","zao","lao","yi","jiang","bu","jiao","xi","tan","po|fa",
-       "nong","yi|shi","li","ju","yan|lian|xian","yi","niang","ru","xun","chou",
-       "yan","ling","mi","mi","niang","xin","jiao","shi","mi","yan",
-       "bian","cai","shi","you","shi","shi","li","zhong|chong","ye","liang",
-       "li","jin","jin","ga","yi","liao","dao","zhao","ding","po",
-       "qiu","he","fu","zhen","zhi","ba","luan","fu","nai","diao",
-       "shan","qiao|jiao","kou","chuan","zi","fan","hua|yu","hua|wu","han","gang",
-       "qi","mang","ri|ren|jian","di|dai","si","xi","yi","chai","shi|yi","tu",
-       "xi","nv","qian","qiu","ri|ren|jian","pi|zhao","ye|ya","jin","ba","fang",
-       "chen","xing","dou","yue","qian","fu","bu","na","xin","e",
-       "jue","dun","gou","yin","qian","ban","sa","ren","chao","niu",
-       "fen","yun","yi","qin","pi","guo","hong","yin","jun","diao",
-       "yi","zhong","xi","gai","ri","huo","tai","kang","yuan","lu",
-       "e","qin","duo","zi","ni","tu","shi","min","gu","ke",
-       "ling","bing","si","gu","bo","pi","yu","si","zuo","bu",
-       "you","dian","jia","zhen","shi","shi","tie","ju","zuan","shi",
-       "ta","xuan","zhao","bao","he","bi","sheng","chu","shi","bo",
-       "zhu","chi","za","po","tong","qian","fu","zhai","mao","qian",
-       "fu","li","yue","pi","yang","ban","bo","jie","gou","shu",
-       "zheng","mu","xi","xi","di","jia","mu","tan","shen","yi",
-       "si","kuang","ka","bei","jian","tong","xing","hong","jiao","chi",
-       "er","ge","bing","shi","mao","ha","yin","jun","zhou","chong",
-       "xiang|jiong","tong","mo","lei","ji","yu|si","xu|hui","ren","zun","zhi",
-       "qiong","shan|shuo","chi|li","xian|xi","xing","quan","pi","tie","zhu","hou|xiang",
-       "ming","kua","diao|tiao|yao","xian|kuo|tian|gua","xian","xiu","jun","cha","lao","ji",
-       "pi","ru","mi","yi","yin","guang","an","diu","you","se",
-       "kao","qian","luan","si","ng","diao","han","rui","shi|zhi","keng",
-       "qiu","xiao","zhe|nie","xiu","zang","ti","cuo","xian|kuo|tian|gua","hong|gong","zhong|yong",
-       "tou|tu|dou","lv","mei|meng","lang","wan|jian","xin","yun|jun","bei","wu","su",
-       "yu","chan","ting|ding","bo","han","jia","hong","juan|jian|cuan","feng","chan",
-       "wan","zhi","si","xuan|juan","hua|wu","wu","tiao","kuang","zhuo|chuo","lve",
-       "xing|jing","qin","shen","han","lve","ye","chu","zeng","ju","xian",
-       "e","mang","pu","li","pan","rui","cheng","gao","li","te",
-       "bing","zhu","zhen","tu","liu","zui|nie","ju","chang","yuan|wan","jian",
-       "gang","diao","tao","shang","lun","ke","ling","pi","lu","li",
-       "qing","pei","juan","min","zui","peng","an","pi","xian","ya",
-       "zhui","lei","a","kong","ta","kun","du","nei","chui","zi",
-       "zheng","ben","nie","cong","chun","tan","ding","qi","qian","zhui",
-       "ji","yu","jin","guan","mao","chang","tian","xi","lian","diao",
-       "gu","cuo","shu","zhen","lu","meng","lu","hua","biao","ga",
-       "lai","ken","fang","bu","nai","wan","zan","hu","de","xian",
-       "uu","huo","liang","fa","men","kai","yang","chi","lian","guo",
-       "xian","du","tu","wei","zong","fu","rou","ji","e","jun",
-       "chen","ti","zha","hu","yang","duan","xia","yu","keng","sheng",
-       "huang","wei","fu","zhao","cha","qie","shi","hong","kui","nuo",
-       "mou","qiao","qiao","hou","tou","cong","huan","ye","min","jian",
-       "duan","jian","si","kui","hu","xuan","zhe","jie","zhen","bian",
-       "zhong","zi","xiu","ye","mei","pai","ai","jie","qian","mei",
-       "cuo|cha","da|ta","bang","xia","lian","suo|se","kai","liu","yao|zu","ye|ta|ge",
-       "nou","weng","rong","tang","suo","qiang|cheng","ge|li","shuo","chui","bo",
-       "pan","da","bi|pi","sang","gang","zi","wu","ying","huang","tiao",
-       "liu","kai","sun","sha","sou","wan|jian","gao|hao","zhen","zhen","lang",
-       "yi","yuan","tang","nie","xi","jia","ge","ma","juan","song",
-       "zu","suo","xia","feng","wen","na","lu","suo","ou","zu|chuo",
-       "tuan","xiu","guan","xuan","lian","shou|sou","ao","man","mo","luo",
-       "bi","wei","liu","di","san|qiao|can","cong","yi","lu|ao","ao","keng",
-       "qiang","cui","qi","shang","tang","man","yong","chan","feng","jing",
-       "biao","shu","lou","xiu","cong","long","zan","jian|zan","cao","li",
-       "xia","xi","kang","shuang","beng","zhang","qian","zheng","lu","hua",
-       "ji","pu","hui|sui|rui","qiang","po","lin","se","xiu","san|xian|sa","cheng",
-       "gui","si","liu","nao","huang","pie","sui","fan","qiao","quan",
-       "xi","tang","xiang","jue","jiao","zun","liao","qi","lao","dui",
-       "xin","zan","ji","jian","zhong","deng","ya","ying","dui","jue",
-       "nou","zan","pu","tie","uu","cheng","ding","shan","kai","jian",
-       "fei","sui","lu","juan","hui","yu","lian","zhuo","qiao","jian",
-       "zhuo","lei","bi","tie","huan","ye","duo","guo","dang","ju",
-       "fen","da","bei","yi","ai","zong","xun","diao","zhu","heng",
-       "zhui","ji","nie","he","huo","qing","bin","ying","gui","ning",
-       "xu","jian","jian","qian","cha","zhi","mie","li","lei","ji",
-       "zuan","kuang","shang","peng","la","du","shuo","chuo","lv","biao",
-       "pao","lu","xian","kuan","long","e","lu","xin","jian","lan",
-       "bo","jian","yao","chan","xiang","jian","xi","guan","cang","nie",
-       "lei","cuan","qu","pan","luo","zuan","luan","zao","nie","jue",
-       "tang","zhu","lan","jin","ga","yi","zhen","ding","zhao","po",
-       "liao","tu","qian","chuan","shan","sa|xi","fan","diao","men","nv",
-       "yang","chai","xing","gai","bu","tai","ju","dun","chao","zhong",
-       "na","bei","gang","ban","qian","yue|yao","qin","jun","wu","gou",
-       "kang","fang","huo","dou","niu","ba|pa","yu","qian","zheng","qian",
-       "gu","bo","ke","po","bu","bo","yue","zuan","mu","tan",
-       "jia","dian|tian","you","tie","bo","ling","shuo","qian|yan","mao","bao",
-       "shi","xuan","ta|tuo","bi","ni","pi","duo","xing","kao","lao",
-       "er","mang","ya","you","cheng","jia","ye","nao","zhi","dang|cheng",
-       "tong","lv","diao","yin","kai","zha","zhu","xian|xi","ting|ding","diu",
-       "xian|kuo|tian|gua","hua","quan","sha","ha|ke","diao|tiao|yao","ge","ming","zheng","se",
-       "jiao","yi","chan","chong","tang","an","yin","ru","zhu","lao",
-       "pu","wu","lai","te","lian","keng","xiao","suo","li","zeng",
-       "chu","guo","gao","e","xiu","cuo","lve","feng","xin","liu",
-       "kai","jian","rui","ti","lang","qin","ju","a","qiang","zhe",
-       "nuo","cuo","mao","ben","qi","de","ke","kun","chang","xi",
-       "gu","luo","chui","zhui","jin","zhi","xian","juan","huo","pei",
-       "tan","ding","jian","ju","meng","zi","qie","ying","kai","qiang",
-       "si","e","cha","qiao","zhong","duan","sou","huang","huan","ai",
-       "du","mei","lou","zi","fei","mei","mo","zhen","bo","ge",
-       "nie","tang","juan","nie","na","liu","gao","bang","yi","jia",
-       "bin","rong","biao","tang","man","luo","beng","yong","jing","di",
-       "zu","xuan","liu","xin","jue","liao","pu","lu","dui","lan",
-       "pu","cuan","qiang","deng","huo","lei","huan","zhuo","lian","yi",
-       "cha","biao","la","chan","xiang","chang","chang","jiu","ao","die",
-       "jie","liao","mi","chang|zhang","men","ma","shuan","shan","huo|shan","men",
-       "yan","bi","han|bi","bi","ci ka Bi lu","kai","kang","beng","hong","run",
-       "san","xian","xian|jian","jian","min","xia","lao","dou","zha","nao",
-       "zhan","peng","xia|ke","ling","bian|guan","bi","run","he","guan","ge",
-       "he","fa","chu","hong|xiang","gui","min","se","kun","lang","lv",
-       "ting","sha","ju","yue","yue","chan","qu","lin","chang","sha",
-       "kun","yan","wen","yan","e|yan","hun","yu","wen","hong","bao",
-       "hong|juan|xiang","qu","yao","wen","ban|pan","an","wei","yin","kuo","que",
-       "lan","du","quan","pBi ying|po he deng","tian","nie","ta","kai","he","que",
-       "chuang","guan","dou","qi","kui","tang|chang","guan","piao","kan|han","xi|se|ta",
-       "hui","chan","bi","dang","huan","ta","wen","ta","men","shuan",
-       "shan","yan","han|bi","bi","wen","chuang","run","wei","xian","hong",
-       "jian","min","kang","men","zha","nao","gui","wen","ta","min",
-       "lv","kai","fa","ge","he","kun","jiu","yue","lang","du",
-       "yu","yan","chang","xi","wen","hun","yan","e","chan","lan",
-       "qu","hui","kuo","que","he","tian","ta","que","kan|han","huan",
-       "fu","fu","le","dui","xin","qian","wu","yi","tuo","yin",
-       "yang","dou","e","sheng","ban","pei","keng","yun","ruan","zhi",
-       "pi","jing","fang","yang","yin","zhen","jie","cheng","e","qu",
-       "di","zu","zuo","dian","lin","a","tuo","tuo","bei","bing",
-       "fu","ji","lu","long","chen","xing","duo","lou","mo","jiang",
-       "shu","duo","xian","er","gui","yu","gai","shan","jun","qiao",
-       "xing","chun","wu","bi","xia","shan","sheng","zhi","pu","dou",
-       "yuan","zhen","chu","xian","dao","nie","yun","xian","pei","fei",
-       "zou","qi","dui","lun","yin","ju","chui","chen","pi","ling",
-       "tao","xian","lu","sheng","xian","yin","zhu","yang","reng","xia",
-       "chong","yan","yin","yu|yao|shu","di","yu","long","wei","wei","nie",
-       "dui|zhui","sui|duo","an","huang","jie","sui","yin","qi|gai|ai","yan","hui|duo",
-       "ge","yun","wu","wei|kui","ai","xi","tang","ji","zhang","dao",
-       "ao","xi","yin","sa","rao","lin","tui","deng","pi","sui",
-       "sui","ao|yu","xian","fen","ni","er","ji","dao","xi","yin",
-       "zhi","hui|duo","long","xi","li|dai","li|dai","li|dai","zhui|cui|wei","hu|he","zhi",
-       "sun","jun|juan","nan|nuo","yi","que|qiao","yan","qin","jian","xiong","ya",
-       "ji","gu","huan","zhi","gou","jun|juan","ci","yong","ju","chu",
-       "hu","za","luo","yu","chou","diao","sui","han","huo","shuang",
-       "guan|huan","chu","za","yong","ji","gui|xi","chou","liu","li","nan|nuo",
-       "yu","za","chou","ji","yu","yu","xue","na","fou","se|xi",
-       "mu","wen","fen","pang","yun","li","chi","yang","ling","lei",
-       "an","bao","wu|meng","dian","dang","hu","wu","diao","xu","ji",
-       "mu","chen","xiao","zha","ting","zhen","pei","mei","ling","qi",
-       "zhou","huo","sha","fei","hong","zhan","yin","ni","shu","tun",
-       "lin","ling","dong","ying","wu","ling","shuang","ling","xia","hong",
-       "yin","mai","mai","yun","liu","meng","bin","wu","wei","kuo",
-       "yin","xi","yi","ai","dan","teng","xian","yu","lu","long",
-       "dai","ji","pang","yang","ba","pi","wei","uu","xi","ji",
-       "mai","meng","meng","lei","li","huo","ai","fei","dai","long",
-       "ling","ai","feng","li","bao","he","he","he","bing","qing",
-       "qing","liang","tian","zheng","jing","cheng","qing","jing","liang","dian",
-       "jing","tian","fei","fei","kao","mi","mian","mian","pao","ye",
-       "mian","hui","ye","ge","ding","cha","jian","ren","di","du",
-       "wu","ren","qin","jin","xue","niu","ba","yin","sa","na",
-       "mo","zu","da","ban","xie","yao","tao","bei","jie","hong",
-       "pao","yang","bing","yin","ge|ta|sa","tao","jie|ji","xie","an","an",
-       "hen","gong","qia","da","qiao","ting","man|men","bian|ying","sui","tiao",
-       "qiao|shao","xuan|juan","kong","beng","ta","shang|zhang","bing|pi|bi|bei","kuo","ju","la",
-       "xie|die","rou","bang","eng","qiu","qiu","he","qiao","mu|mou","ju",
-       "jian","bian","di","jian","wen|yun","tao","gou","ta","bei","xie",
-       "pan","ge","bi|bing","kuo","tang","lou","gui","qiao","xue","ji",
-       "jian","jiang","chan","da","huo","xian","qian","du","wa","jian",
-       "lan","wei","ren","fu","mei|wa","quan","ge","wei","qiao","han",
-       "chang","kuo","rou","yun","she|xie","wei","ge","bai","tao","gou",
-       "yun","gao","bi","wei","sui","du","wa","du","wei","ren",
-       "fu","han","wei","yun|wen","tao","jiu","jiu","xian","xie","xian",
-       "ji","yin","za","yun","shao","le","peng","huang","ying","yun",
-       "peng","an","yin","xiang","hu","ye","ding","qing","qiu","xiang",
-       "shun","han","xu","yi","xu","e","song","kui","qi","hang",
-       "yu","wan","ban","dun","di","dan","pan","po","ling","che",
-       "jing","lei","he","qiao","e","e","wei","jie","kuo","shen",
-       "yi","yi","ke","dui","yu","ping","lei","fu","jia","tou",
-       "hui","kui","jia","luo","ting","cheng","ying","jun","hu","han",
-       "geng","tui","tui","bin","lai","tui","zi","zi","chui","ding",
-       "lai","tan","han","qian","ke","cui","jiong","qin","yi","sai",
-       "ti","e","e","yan","wen","kan","yong","zhuan","yan","xian",
-       "xin","yi","yuan","sang","dian","dian","jiang","kui","lei","lao",
-       "piao","wai","man","cu","yao","hao","qiao","gu","xun","yan",
-       "hui","chan","ru","meng","bin","xian","pin","lu","lan","nie",
-       "quan","ye","ding","qing","han","xiang","shun","xu","xu","wan",
-       "gu","dun","qi","ban","song","hang","yu","lu","ling","po",
-       "jing|geng","jie|xie|jia","jia","ting","he|ge","ying","jiong","ke","yi","pin|bin",
-       "hui","tui","han","ying","ying","ke","ti","yong","e","zhuan",
-       "yan","e","nie","man","dian","sang","hao","lei","chan|zhan","ru",
-       "pin","quan","feng","biao|diu","gua","fu","xia","zhan","biao","sa",
-       "ba|fu","tai","lie","gua","xuan","xiao","ju","biao","si","wei",
-       "yang","yao","sou","kai","sao|sou","fan","liu","xi","liu|liao","piao",
-       "piao","liu","biao","biao","biao","liao","biao","se","feng","xiu",
-       "feng","yang","zhan","biao","sa","ju","si","sou","yao","liu",
-       "piao","biao","biao","fei","fan","fei","fei","shi|si|yi","shi","can",
-       "ji","ding","si","tuo","zhan","sun","xiang","tun","ren","yu",
-       "yang|juan","chi","yin","fan","fan","sun","yin","zhu|tou","si","zuo|ze|zha",
-       "bi","jie","tao","bao","ci","tie","si","bao","shi","duo",
-       "hai","ren","tian","jiao","he","bing","yao","tong","ci","xiang",
-       "yang","juan","er","yan","le","xi","can","bo","nei","e",
-       "bu","jun","dou","su","yu","shi","yao","hun","guo","shi",
-       "jian","chuo","bing","xian","bu","ye","dan","fei","zhang","wei",
-       "guan","e","nuan","yun","hu","huang","tie","hui","jian","hou",
-       "ai","xing","fen","wei","gu","cha","song","tang","bo","gao",
-       "xi","kui","liu","sou","tao","ye","wen","mo","tang","man",
-       "bi","yu","xiu","jin","san","kui","zhuan","shan","xi","dan",
-       "yi","ji","rao","cheng","yong","tao","wei","xiang","zhan","fen",
-       "hai","meng","yan","mo","chan","xiang","luo","zan","nang","shi",
-       "ding","ji","tuo","xing","tun","xi","ren","yu","chi","fan",
-       "yin","jian","shi","bao","si","duo","yi","er","rao","xiang",
-       "he","ge","jiao","xi","bing","bo","dou","e","yu","nei",
-       "jun","guo","hun","xian","guan","cha","kui","gu","sou","chan",
-       "ye","mo","bo","liu","xiu","jin","man","san","zhuan","nang",
-       "shou","kui","guo","xiang","fen","bo","ni","bi","bo","tu",
-       "han","fei","jian","an","ai","fu","xian","yun|wo","xin","fen",
-       "pin","xin","ma","yu","feng|ping","han","di","tuo|duo","tuo|zhe","chi",
-       "xun","zhu","zhi|shi","pei","xin|jin","ri","sa","yun","wen","zhi",
-       "dan","lu","you","bo","bao","jue|kuai","tuo|duo","yi","qu","wen",
-       "qu","jiong","po","zhao","yuan","peng","zhou","ju","zhu","nu",
-       "ju","pi","zang","jia","ling","zhen","tai|dai","fu","yang","shi",
-       "bi","tuo","tuo","si","liu","ma","pian","tao","zhi","rong",
-       "teng","dong","xun|xuan","quan","shen","jiong","er","hai","bo","zhu",
-       "yin","luo","zhou","dan","hai","liu","ju","song","qin","mang",
-       "liang|lang","han","tu","xuan","tui","jun","e","cheng","xing","dai",
-       "lu","zhui","zhou","she","pian","kun","tao","lai","zong","ke",
-       "qi","qi","yan","fei","sao","yan","ge","yao","wu","pian",
-       "cong","pian","qian","fei","huang","qian","huo","yu","ti","quan",
-       "xia","zong","kui","rou","si","gua","tuo","gui","sou","qian",
-       "cheng","zhi","liu","peng","teng","xi","cao","du","yan","yuan",
-       "zou","sao","shan","qi","zhi","shuang","lu","xi","luo","zhang",
-       "mo","ao","can","piao","cong","qu","bi","zhi","yu","xu",
-       "hua","bo","su","xiao","lin","zhan","dun","liu","tuo","ceng",
-       "dian","jiao","tie","yan","luo","zhan","jing","yi","ye","tuo",
-       "pin","zhou","yan","long","lv","teng","xiang","ji","shuang","ju",
-       "xi","huan","li","biao","ma","yu","duo","xun","chi","qu",
-       "ri","bo","lv","zang","shi","si","fu","ju","zou","zhu",
-       "tuo","nu","jia","yi","dai","xiao","ma","yin","jiao","hua",
-       "luo","hai","pian","biao","li","cheng","yan","xing","qin","jun",
-       "qi","qi","ke","zhui","zong","su","can","pian","zhi","kui",
-       "sao","wu","ao","liu","qian","shan","piao|biao","luo","cong","chan",
-       "zhou","ji","shuang","xiang","gu","wei","wei","wei","yu","gan",
-       "yi","ang","tou","jie","bao","bei|mo","ci","ti","di","ku",
-       "hai","qiao|xiao","hou","kua","ge","tui","geng","pian","bi","ke",
-       "qia","ou","sui","lou","bo","xiao","bang","bo|jue","ci","kuan",
-       "bin","mo","liao","lou","xiao","du","zang","sui","ti","bin",
-       "kuan","lu","gao","gao","qiao","kao","qiao","lao","sao","biao",
-       "kun","kun","di","fang","xiu","ran","mao","dan","kun","bin",
-       "fa","tiao","pi","zi","fa","ran","ti","bao","bi|po","mao|meng",
-       "fu","er","er","qu","gong","xiu","kuo|yue","ji","peng","zhua",
-       "shao","sha","ti","li","bin","zong","ti","peng","song","zheng",
-       "quan","zong","shun","jian","duo","hu","la","jiu","qi","lian",
-       "zhen","bin","peng","ma","san","man","man","seng","xu","lie",
-       "qian","qian","nong","huan","kuo","ning","bin","lie","rang","dou",
-       "dou","nao","hong","xi","dou","kan","dou","dou","jiu","chang",
-       "yu","yu","ge","yan","fu","zeng","gui","zong","liu","gui",
-       "shang","yu","gui","mei","ji","qi","ga","kui","hun","ba",
-       "bo","mei","xu","yan","xiao","liang","yu","tui","qi","wang",
-       "liang","wei","gan","chi","piao","bi","mo","ji","xu","chou",
-       "yan","zhan","yu","dao","ren","ji","ba","hong","tuo","diao",
-       "ji","yu","e","ji","sha","hang","tun","mo","jie","shen",
-       "ban","yuan","pi","lu","wen","hu","lu","za","fang","fen",
-       "na","you","pian","mo","he","xia","qu","han","pi","ling",
-       "tuo","ba","qiu","ping","fu","bi","ci|ji","wei","ju","diao",
-       "bo|ba","you","gun","pi","nian","xing","tai","bao","fu","zha",
-       "ju","gu","shi","dong","chou","ta","jie","shu","hou","xiang",
-       "er","an","wei","zhao","zhu","yin","lie","luo|ge","tong","yi",
-       "yi","bing","wei","jiao","ku","gui|xie|wa|kui","xian","ge","hui","lao",
-       "fu","kao","xiu","tuo","jun","ti","mian","shao","zha","suo",
-       "qin","yu","nei","zhe","gun","geng","su","wu","qiu","shan",
-       "pu|bu","huan","tiao","li","sha","sha","kao","meng","cheng","li",
-       "zou","xi","yong","shen","zi","qi","qing","xiang","nei","chun",
-       "ji","diao","qie","gu","zhou","dong","lai","fei","ni","yi|si",
-       "kun","lu","jiu","chang","jing","lun","ling","zou","li","meng",
-       "zong","zhi","nian","hu","yu","di","shi","shen","huan","ti",
-       "hou","xing","zhu","la","zong","ji","bian","bian","huan","quan",
-       "zei","wei","wei","yu","chun","rou","die","huang","lian","yan",
-       "qiu","qiu","jian","bi","e","yang","fu","sai","jian","xia",
-       "tuo","hu","shi","ruo","xuan","wen","jian","hao","wu","pang",
-       "sao","liu","ma","shi","shi","guan","zi","teng","ta","yao",
-       "e","yong","qian","qi","wen","ruo","ha ta ha ta","lian","ao","le",
-       "hui","min","ji","tiao","qu","jian","shen","man","xi","qiu",
-       "piao","ji","ji","zhu","jiang","xiu","zhuan","yong","zhang","kang",
-       "xue","bie","yu","qu","xiang","bo","jiao","xun","su","huang",
-       "zun","shan","shan","fan","gui","lin","xun","yao","xi","zeng",
-       "xiang","fen","guan","hou","kuai","zei","sao","zhan","gan","gui",
-       "ying","li","chang","lei","se","ai","ru","ji","xu","hu",
-       "shu","li","lie","le","mie","zhen","xiang","e","lu","guan",
-       "li","xian","yu","dao","ji","you","tun","lu","fang","ba",
-       "he|ge","ba","ping","nian","lu","you","zha","fu","bo|ba","bao",
-       "hou","pi","tai","gui|xie","jie","kao","wei","er","tong","zei",
-       "hou","kuai","ji","jiao","xian","zha","xiang","xun","geng","li",
-       "lian","jian","li","shi","tiao","gun","sha","huan","jun","ji",
-       "yong","qing","ling","qi","zou","fei","kun","chang","gu","ni",
-       "nian","diao","jing","shen","shi","zi","fen","die","bi","chang",
-       "ti","wen","wei","sai|xi","e","qiu","fu","huang","quan","jiang",
-       "bian","sao","ao","qi","ta","guan","yao","pang","jian","le",
-       "biao","xue","bie","man","min","yong","wei","xi","gui|jue","shan",
-       "lin","zun","hu","gan","li","zhan|shan","guan","niao|diao","yi","fu",
-       "li","jiu","bu","yan","fu","diao|zhao","ji","feng","ru","gan|han|yan",
-       "shi","feng","ming","bao","yuan","zhi","hu","qin","fu|gui","ban|fen",
-       "wen","jian|qian|zhan","shi","yu","fou","yao","jue","jue","pi","huan",
-       "zhen","bao","yan","ya","zheng","fang","feng","wen","ou","dai",
-       "jia","ru","ling","mie","fu","tuo","min","li","bian","zhi",
-       "ge","yuan","ci","qu","xiao","chi","dan","ju","yao","gu",
-       "zhong","yu","yang","yu","ya","die","yu","tian","ying","dui",
-       "wu","er","gua","ai","zhi","yan","heng","xiao","jia","lie",
-       "zhu","yang","yi","hong","lu","ru","mou","ge","ren","jiao",
-       "xiu","zhou","chi","luo","heng","nian","e","luan","jia","ji",
-       "tu","huan","tuo","bu","wu","juan","yu","bo","jun","jun",
-       "bi","xi","jun","ju","tu","jing","ti","e","e","kuang",
-       "hu","wu","shen","lai","zan","pan","lu","pi","shu","fu",
-       "an","zhuo","peng","qin","qian","bei","diao","lu","que","jian",
-       "ju","tu","ya","yuan","qi","li","ye","zhui","kong","duo",
-       "kun","sheng","qi","jing","yi","yi","jing","zi","lai","dong",
-       "qi","chun","geng","ju","qu","yi","zun","ji","shu","ying",
-       "chi","miao","rou","an","qiu","ti|chi","hu","ti|chi","e","jie",
-       "mao","fu|bi","chun","tu","yan","he|jie","yuan","pian|bian","kun","mei",
-       "hu","ying","chuan|zhi","wu","ju","dong","cang|qiang","fang","he|hu","ying",
-       "yuan","xian","weng","shi","he","chu","tang","xia","ruo","liu",
-       "ji","gu|hu","jian","sun|xun","han","ci","ci","yi","yao","yan",
-       "ji","li","tian","kou","ti","ti","yi","tu","ma","xiao",
-       "gao","tian","chen","ji","tuan","zhe","ao","yao","yi","ou",
-       "chi","zhi","liu","yong","lou|lv","bi","shuang","zhuo","yu","wu",
-       "jue","yin","ti","si","jiao","yi","hua","bi","ying","su",
-       "huang","fan","jiao","liao","yan","gao","jiu","xian","xian","tu",
-       "mai","zun","yu","ying","lu","tuan","xian","xue","yi","pi",
-       "zhu","luo","xi","yi","ji","ze","yu","zhan","ye","yang",
-       "pi","ning","hu","mi","ying","meng","di","yue","yu","lei",
-       "bu","lu","he","long","shuang","yue","ying","guan","qu","li",
-       "luan","niao","jiu","ji","yuan","ming","shi","ou","ya","cang",
-       "bao","zhen","gu","dong","lu","ya","xiao","yang","ling","chi",
-       "qu","yuan","xue","tuo","si","zhi","er","gua","xiu","heng",
-       "zhou","ge","luan","hong","wu","bo","li","juan","hu","e",
-       "yu","xian","ti","wu","que","miao","an","kun","bei","peng",
-       "qian","chun","geng","yuan","su","hu","he","e","gu","qiu",
-       "ci","mei","wu","yi","yao","weng","liu","ji","yi","jian",
-       "he","yi","ying","zhe","liu","liao","jiao","jiu","yu","lu",
-       "huan","zhan","ying","hu","meng","guan","shuang","lu","jin","ling",
-       "jian","xian","cuo","jian","jian","yan","cuo","lu","you","cu",
-       "ji","pao|biao","cu","pao","zhu|cu","jun|qun","zhu","jian","mi","mi",
-       "yu","liu","chen","jun","lin","ni","qi","lu","jiu","jun",
-       "jing","li","xiang","xian","jia","mi","li","she","zhang","lin",
-       "jing","qi","ling","yan","cu","mai","mai","he","chao","fu",
-       "mian","mian","fu","pao","qu","qu","mou","fu","xian","lai",
-       "qu","mian","chi","feng","fu","qu","mian","ma","mo|me","mo|me",
-       "hui","mi","zou","nun","fen","huang","huang","jin","guang","tian",
-       "tou","hong","hua","kuang","hong","shu","li","nian","chi","hei",
-       "hei","yi","qian","dan","xi","tun","mo","mo","qian","dai",
-       "chu","you","dian","yi","xia","yan","qu","mei","yan","qing",
-       "yue","li","dang","du","can","yan","yan","yan","dan|shen","an",
-       "zhen|yan","dai","can","yi","mei","dan|zhan","yan","du","lu","zhi",
-       "fen","fu","fu","min|mian|meng","min|mian|meng","yuan","cu","qu","chao","wa",
-       "zhu","zhi","meng","ao","bie","tuo","bi","yuan","chao","tuo",
-       "ding","mi","nai","ding","zi","gu","gu","dong","fen","tao",
-       "yuan","pi","chang","gao","cao","yuan","tang","teng","shu","shu",
-       "fen","fei","wen","ba","diao","tuo","zhong","qu","sheng","shi",
-       "you","shi","ting","wu","ju","jing","hun","ju","yan","tu",
-       "si","xi","xian","yan","lei","bi","yao","qiu","han","wu",
-       "wu","hou","xie","e","zha","xiu","weng","zha","nong","nang",
-       "qi","zhai","ji","zi","ji","ji","qi","ji","chi","chen",
-       "chen","he","ya","yin","xie","bao","ze","xie","zi","chi",
-       "yan","ju","tiao","ling","ling","chu","quan","xie","yin","nie",
-       "jiu","yao","chuo","yun","yu","chu","yi","ni","ze","zou",
-       "qu","yun","yan","yu","e","wo","yi","ci","zou","dian",
-       "chu","jin","ya","chi","chen","he","yin|ken","ju","ling","bao",
-       "tiao","zi","yin|ken","yu","chuo","qu","wo","long","pang","gong|wo",
-       "pang","yan","long","long","gong","kan","da","ling","da","long",
-       "gong","kan","gui|jun|qiu","qiu","bie","gui|jun|qiu","yue","chui","he","jiao",
-       "xie","yu"};
+       "yi", "ding|zheng", "kao|qiao|yu", "qi", "shang", "xia", "mo", "wan|mo", "zhang", "san",
+       "shang", "xia", "qi|ji", "bu|fou", "yu", "mian", "gai", "chou", "chou", "zhuan",
+       "qie|ju", "pi", "shi", "shi", "qiu", "bing", "ye", "cong", "dong", "si",
+       "cheng", "diu", "qiu", "liang", "diu", "you", "liang", "yan", "bing", "sang",
+       "gun", "jiu", "ge", "ya", "pan", "zhong", "ji", "jie", "feng", "guan|kuang",
+       "chuan", "chan", "lin", "zhuo", "zhu", "ba", "wan", "dan", "wei", "zhu",
+       "jing", "li", "ju", "pie", "fu", "yi|ji", "yi", "nai", "wu", "jiu",
+       "jiu", "tuo|zhe", "me|yao|mB", "yi", "ho", "zhi", "wu", "zha", "hu", "fa",
+       "le|yue", "yin", "ping", "pang", "qiao", "hu", "guai", "cheng|sheng", "cheng|sheng", "yi",
+       "hao", "zhe", "mie|nie", "jiu", "qi", "ye", "xi", "xiang", "gai", "jiu",
+       "hal", "hol", "shu", "dou", "shi", "ji", "nang", "kal", "keol", "tol",
+       "mol", "ol", "mai", "luan", "cal", "ru", "xue", "yan", "phoi", "sha",
+       "na", "qian", "sol", "er", "zu", "ceor", "qian|gan", "zhi|luan", "gui", "qian",
+       "luan", "lin", "yi", "jue", "liao|le", "ma", "yu", "zheng", "shi", "shi",
+       "er", "chu", "yu", "kui", "yu", "yun", "hu", "qi", "wu", "jing",
+       "si", "sui", "gen", "gen", "ya", "xie|suo", "ya", "qi|zhai", "ya", "ji|qi",
+       "tou", "wang|wu", "kang", "da", "jiao", "hai", "yi", "chan", "heng|peng", "mu",
+       "ye", "xiang", "jing", "ting", "liang", "xiang", "jing", "ye", "qin|qing", "bo",
+       "you", "xie", "dan", "lian", "duo", "wei|men", "ren", "ren", "ji", "ji",
+       "wang", "yi", "shi|shen", "ren", "le", "ding", "ze", "jin", "pu", "chou|qiu",
+       "ba", "zhang", "jin", "jie", "bing", "reng", "cong|zong", "fo", "jin|san", "lun",
+       "bing", "cang", "zi|zai", "shi", "ta", "zhang", "fu", "xian", "xian", "tuo|cha|duo",
+       "hong", "tong", "ren", "qian", "gan|han", "yi|ge", "bo", "dai", "ling", "yi",
+       "chao", "chang|zhang", "sa", "chang", "yi", "mu", "men", "ren", "fan", "chao|miao",
+       "yang|ang", "qian", "zhong", "pi", "wo", "wu", "jian", "jia|jie", "yao|fo", "feng",
+       "cang", "ren", "wang", "fen|bin", "di", "fang", "zhong", "qi", "pei", "yu",
+       "diao", "dun", "wen", "yi", "xin", "kang", "yi", "ji", "ai", "wu",
+       "ji|qi", "fu", "fa", "xiu|xu", "jin", "pi", "dan", "fu", "tang", "zhong",
+       "you", "huo", "hui|kuai", "yu", "cui", "yun", "san", "wei", "chuan|zhuan", "che|ju",
+       "ya", "qian", "shang", "chang", "lun", "cang|chen", "xun", "xin", "wei", "zhu",
+       "chi", "xian|xuan", "nu", "bo|bai|ba", "gu", "ni", "ni", "xie", "ban", "xu",
+       "ling", "zhou", "shen", "qu", "si|ci", "peng", "si|shi", "qie|jia|ga", "pi", "zhi",
+       "si", "yi|chi", "zheng", "dian|tian", "han|gan", "mai", "dan", "zhu", "bu", "qu",
+       "bi", "zhao|shao", "ci", "wei", "di", "zhu", "zuo", "you", "yang", "ti|ben",
+       "zhan|dian", "he", "bi", "tuo", "she", "yu", "yi|die", "fo|fu|bi|bo", "zuo", "gou|kou",
+       "ning", "tong", "ni", "xian", "qu", "yong", "wa", "qian", "shi", "ka",
+       "bao", "pei", "hui|huai", "ge", "lao", "xiang", "ge", "yang", "bai", "fa",
+       "ming", "jia", "er|nai", "bing", "ji", "hen", "huo", "gui", "quan", "tiao",
+       "jiao", "ci", "yi", "shi", "xing", "shen", "tuo", "kan", "zhi", "gai",
+       "lai", "yi", "chi", "kua", "gong", "li", "yin", "shi", "mi", "zhu",
+       "xu", "you", "an", "lu", "mou", "er", "lun", "dong|tong", "cha", "chi",
+       "xun", "gong", "zhou", "yi", "ru", "cun", "xia", "si", "dai", "lv",
+       "ta", "jiao|yao", "zhen", "ce|ze|zhai", "qiao", "kuai", "chai", "ning", "nong", "jin",
+       "wu", "hou", "jiong", "cheng|ting", "zhen", "zuo", "hao", "qin", "lv", "jv",
+       "shu|dou", "ting", "shen", "tuo|tui", "bo", "nan", "xiao", "bian|pian", "tui", "yu",
+       "xi", "cu", "e", "qiu", "xu", "guang", "ku", "wu", "jun", "yi",
+       "fu", "liang", "zu", "qiao|xiao", "li", "yong", "hun", "jing", "qian", "san",
+       "pei", "su", "fu", "xi", "li", "fu", "ping", "bao", "yu|shu", "si|qi",
+       "xia", "xin|shen", "xiu", "yu", "di", "che|ju", "chou", "zhi", "yan", "liang|lia",
+       "li", "lai", "si", "jian", "xiu", "fu", "huo", "ju", "xiao", "pai",
+       "jian", "biao", "chu|ti", "fei", "feng", "ya", "an", "bei", "yu", "xin",
+       "bi", "hu|chi", "chang", "zhi", "bing", "jiu", "yao", "cui|zu", "liang|lia", "wan",
+       "lai", "cang", "zong", "ge", "guan", "bei", "tian", "shu", "shu", "men",
+       "dao", "tan", "jue", "chui", "xing", "peng", "tang|chang", "hou", "yi", "qi",
+       "ti", "gan", "liang|jing", "jie", "sui", "chang", "jie", "fang", "zhi", "kong",
+       "juan", "zong", "ju", "qian", "ni", "lun", "zhuo", "wo|wei", "luo", "song",
+       "leng", "hun", "dong", "zi", "ben", "wu", "ju", "nai", "cai", "jian",
+       "zhai", "ye", "zhi", "sha", "qing", "ning", "ying", "cheng|chen", "qian", "yan",
+       "ruan", "zhong|tong", "chun", "jia", "ji|jie", "wei", "yu", "bing", "ruo", "ti",
+       "wei", "pian", "yan", "feng", "tang|dang", "wo", "e", "xie", "che", "sheng",
+       "kan", "di", "zuo", "cha", "ting", "bei", "xie", "huang", "yao", "zhan",
+       "chou|qiao", "an", "you", "jian", "xu", "zha", "ci", "fu", "bi", "zhi",
+       "zong", "mian", "ji", "yi", "xie", "xun", "cai|si", "duan", "ce|ze|zhai", "zhen",
+       "ou", "tou", "tou", "bei", "zan|za|zBn", "lv|lou", "jie", "wei", "fen", "chang",
+       "kui|gui", "sou", "zhi|si", "su", "xia", "fu", "yuan", "rong", "li", "nu",
+       "yun", "jiang|gou", "ma", "bang", "dian", "tang", "hao", "jie", "xi", "shan",
+       "qian|jian", "que|jue", "cang|chen", "chu", "san", "bei", "xiao", "rong", "yao", "ta|tan",
+       "suo", "yang", "fa", "bing", "jia", "dai", "zai", "tang", "gu", "bin",
+       "chu", "nuo", "can", "lei", "cui", "yong", "zao|cao", "zong", "peng", "song",
+       "ao", "chuan|zhuan", "yu", "zhai", "qi|cou", "shang", "chuang", "jing", "chi", "sha",
+       "han", "zhang", "qing", "yan", "di", "xie", "lv|lou", "bei", "piao|biao", "jin",
+       "lian", "lu", "man", "qian", "xian", "tan", "ying", "dong", "zhuan", "xiang",
+       "shan", "qiao", "jiong", "tui", "zun", "pu", "xi", "lao", "chang", "guang",
+       "liao", "qi", "cheng|deng", "zhan|zhuan|chan", "wei", "ji", "bo", "hui", "chuan", "tie|jian",
+       "dan", "jiao|yao", "jiu", "seng", "fen", "xian", "yu|ju", "e|wu", "jiao", "jian",
+       "tong|zhuang", "lin", "bo", "gu", "xian", "su", "xian", "jiang", "min", "ye",
+       "jin", "jia|jie", "qiao", "pi", "feng", "zhou", "ai", "sai", "yi", "jun",
+       "nong", "chan|tan|shan", "yi", "dang", "jing", "xuan", "kuai", "jian", "chu", "dan",
+       "jiao", "sha", "zai", "can", "bin", "an", "ru", "tai", "chou", "chai",
+       "lan", "ni|yi", "jin", "qian", "meng", "wu", "ning", "qiong", "ni", "chang",
+       "lie", "lei", "lv", "kuang", "bao", "yu", "biao", "zan", "zhi", "si",
+       "you", "hao", "qing", "chen", "li", "teng", "wei", "long", "chu", "chan",
+       "rang|xiang", "shu", "hui|xie", "li", "luo", "zan", "nuo", "tang", "yan", "lei",
+       "nang", "er", "wu", "yun", "zan", "yuan", "xiong", "chong", "zhao", "xiong",
+       "xian", "guang", "dui|rui|yue", "ke", "dui|rui|yue", "mian", "tu", "chang|zhang", "er", "dui|rui|yue",
+       "er|ni", "jin", "tu", "si", "yan", "yan", "shi", "shike", "dang", "qibnke",
+       "dou", "gongfenPPPU", "hboke", "shen", "dou", "baike", "jing", "gongli", "huang", "ru",
+       "wang", "nei", "quan", "liang", "yu|shu", "ba", "gong", "liu|lu", "xi", "han",
+       "lan", "gong", "tian", "guan", "xing", "bing", "qi|ji", "ju", "dian", "zi|ci",
+       "bun", "yang", "jian", "shou", "ji", "yi", "ji", "chan", "jiong", "mao",
+       "ran", "nei|na", "yuan", "mao", "gang", "ran", "ce", "jiong", "ce", "zai",
+       "gua", "jiong", "mao", "zhou", "mao|mo", "gou", "xu", "mian", "mi", "rong",
+       "yin|you", "xie", "kan", "jun", "nong", "yi", "shen", "shi", "guan", "meng",
+       "zhong", "zui", "yuan", "ming", "kou", "lin", "fu", "xie", "mi", "bing",
+       "dong", "tai", "gang", "feng|ping", "bing", "hu", "chong", "jue", "ya", "kuang",
+       "ye", "leng", "pan", "fa", "min", "dong", "xian", "lie", "qia", "jian",
+       "jing|cheng", "sou", "mei", "tu", "qi", "gu", "zhun", "song", "jing|cheng", "liang",
+       "qing", "diao", "ling", "dong", "gan", "jian", "yin", "cou", "ai", "li",
+       "cang", "ming", "zhun", "cui", "si", "duo", "jin", "lin", "lin", "ning",
+       "xi", "du", "ji", "fan", "fan", "fan", "feng", "ju", "chu", "yi kB|yi kB no bo li|tB ko",
+       "feng", "mu", "zhi", "fu", "feng", "ping", "feng", "kai", "huang", "kai",
+       "gan", "deng", "ping", "kan|qian", "xiong", "kuai", "tu", "ao|wa", "chu", "ji",
+       "dang", "han", "han", "zao", "dao", "diao", "dao", "ren", "ren", "chuang",
+       "fen", "qie", "yi", "ji", "kan", "qian", "cun", "chu", "wen", "ji",
+       "dan", "xing", "hua", "wan", "jue", "li", "yue", "lie", "liu", "ze",
+       "gang", "chuang", "fu", "chu", "qu", "diao", "shan", "min", "ling", "zhong",
+       "pan", "bie", "jie", "jie", "pao|bao", "li", "shan", "bie", "chan", "jing",
+       "gua", "geng", "dao", "chuang", "kui", "ku", "duo", "er", "zhi", "shua",
+       "quan|xuan", "cha|sha", "ci", "ke", "jie", "gui", "ci", "gui", "kai", "duo",
+       "ji", "ti", "jing", "dou", "luo", "ze", "yuan", "cuo", "xiao|xue", "kei|ke",
+       "la", "qian", "cha|sha", "chuang", "gua", "jian", "cuo", "li", "ti", "fei",
+       "pou", "chan", "qi", "chuang", "zi", "gang", "wan", "bao|bo", "ji", "duo",
+       "qing", "yan|shan", "du|zhuo", "jian", "ji", "bao|bo", "yan", "ju", "huo", "sheng",
+       "jian", "duo", "zhi|duan", "wu", "gua", "fu|pi", "sheng", "jian", "ge", "da|zha",
+       "kai", "chuang", "chuan", "chan", "tuan|zhuan", "lu|jiu", "li", "peng", "shan", "piao",
+       "kou", "jiao|chao", "gua", "qiao", "jue", "hua", "zha", "zhuo", "lian", "ju",
+       "pi", "liu", "gui", "jiao|chao", "gui", "jian", "jian", "tang", "huo", "ji",
+       "jian", "yi", "jian", "zhi", "chan", "zuan", "mo", "li", "zhu", "li",
+       "ya", "quan", "ban", "gong", "jia", "wu", "mai", "lie", "jin|jing", "keng",
+       "xie|lie", "zhi", "dong", "zhu|chu", "nu", "jie", "qu", "shao", "yi", "zhu",
+       "miao", "li", "jin|jing", "lao", "lao", "juan", "kou", "yang", "wa", "xiao",
+       "mou", "kuang", "jie", "lie", "he", "shi", "ke", "jin|jing", "gao", "bo|bei",
+       "min", "chi", "lang", "yong", "yong", "mian", "ke", "xun", "juan", "qing",
+       "lu", "bu", "meng", "chi", "le|lei", "kai", "mian", "dong", "xu", "xu",
+       "kan", "wu", "yi", "xun", "weng|yang", "sheng", "lao", "mu", "lu", "piao",
+       "shi", "ji", "qin", "jiang", "jiao|chao", "quan", "xiang", "yi", "qiao", "fan",
+       "juan", "tong|dong", "ju", "dan", "xie", "mai", "xun", "xun", "lv", "li",
+       "che", "rang|xiang", "quan", "bao", "shao", "yun", "jiu", "bao", "gou", "wu",
+       "yun", "mo", "xiong", "gai", "gai", "bao", "cong", "yi", "xiong", "peng",
+       "ju", "tao|yao", "ge", "pu", "e", "pao", "fu", "gong", "da", "jiu",
+       "gong", "bi", "hua", "bei", "nao", "chi|shi", "fang", "jiu", "yi", "za",
+       "jiang", "kang", "jiang", "kuang", "hu", "xia", "qu", "fan", "gui", "qie",
+       "zang|cang", "kuang", "fei", "hu", "yu", "gui", "kui|gui", "hui", "dan", "kui|gui",
+       "lian", "lian", "suan", "du", "jiu", "jue", "xi", "pi", "qu|ou", "yi",
+       "ke|qia", "yan", "bian", "ni", "qu|ou", "shi", "xun", "qian", "nian", "sa",
+       "zu", "sheng", "wu", "hui", "ban", "shi", "xi", "wan", "hua", "xie",
+       "wan", "bei", "zu|cu", "zhuo", "xie", "dan|shan|chan", "mai", "nan|na", "dan", "ji",
+       "bo", "shuai|lv", "bu|bo", "guan|kuang", "bian", "bu", "zhan", "qia|ka", "lu", "you",
+       "lu", "xi", "gua", "wo", "xie", "jie", "jie", "wei", "yang|ang", "qiong",
+       "zhi", "mao", "yin", "wei", "shao", "ji", "que", "luan", "chi", "juan",
+       "xie", "xu", "jin", "que", "wu", "ji", "e", "qing", "xi", "san",
+       "chang|an|han", "wei", "e", "ting", "li", "zhe|zhai", "han|an", "li", "ya", "ya",
+       "yan", "she", "di", "zha|zhai", "pang", "ya", "qie", "ya", "zhi|shi", "ce",
+       "mang", "ti", "li", "she", "hou", "ting", "zui", "cuo", "fei", "yuan",
+       "ce", "yuan", "xiang", "yan", "li", "jue", "sha|xia", "dian", "chu", "jiu",
+       "jin", "ao", "gui", "yan", "si", "li", "chang", "qian|lan", "li", "yan",
+       "yan", "yuan", "si|mou", "gong|hong", "lin|miao", "rou|qiu", "qu", "qu", "ke", "lei",
+       "du", "xian|xuan", "zhuan", "san", "can|shen|cen|san", "can|shen|cen|san", "can|shen|cen|san", "can|shen|cen|san", "ai|yi", "dai",
+       "you", "cha", "ji", "you", "shuang", "fan", "shou", "guai", "ba", "fa",
+       "ruo", "li", "shu", "zhuo|yi|li|jue", "qu", "shou", "bian", "xu", "jia", "pan",
+       "sou", "ji", "wei|yu", "sou", "die", "rui", "cong", "kou", "gu", "ju|gou",
+       "ling", "gua", "tao|dao", "kou", "zhi", "jiao", "zhao|shao", "ba", "ding", "ke",
+       "tai", "chi", "shi", "you", "qiu", "po", "ye|xie", "hao", "si", "tan",
+       "chi", "le", "diao", "ji", "dug", "hong", "mie", "xu|yu", "mang", "chi",
+       "ge", "xuan|song", "yao", "zi", "he|ge", "ji", "diao", "dou|cun", "tong", "ming",
+       "hou", "li", "tu", "xiang", "zha", "xia|he", "ye", "lv", "a", "ma|mB",
+       "ou", "huo", "yi", "jun", "chou", "lin", "tun", "yin", "fei", "pi|bi",
+       "qin", "qin", "jie|ge", "bu", "fou|pi", "ba", "dun", "fen", "e|hua", "han",
+       "ting", "hang|keng", "shun", "qi", "hong", "zhi|zi", "yin|shen", "wu", "wu", "chao",
+       "na|ne", "xue|chuo|jue", "xi", "chui", "dou|ru", "wen", "hou", "hou|hong|ou", "wu|yu", "gao",
+       "ya|yB", "jun", "lv", "e", "ge", "wen", "dai", "qi", "cheng", "wu",
+       "gao", "fu", "jiao", "hong", "chi", "sheng", "na|ne", "tun|tian", "fu|?", "yi",
+       "dai", "ou", "li", "bei|bai", "yuan|yun", "wai|he|wo|wa|gua|guo", "hua|qi", "qiang", "wu", "e",
+       "shi", "juan", "pen", "wen|min", "ne", "mou|m", "ling", "ran", "you", "di",
+       "zhou", "shi", "zhou", "tie|che", "xi", "yi", "qi|zhi", "ping", "zi|ci", "gua|gu",
+       "zi|ci", "wei", "xu|hou|gou", "he|a|ke", "nao", "xia", "pei", "yi", "xiao|hao", "shen",
+       "hu", "ming", "da|dan", "qu", "ju|zui", "xian|gan", "za", "tuo", "duo", "pou",
+       "pao", "bi", "fu", "yang", "he", "zha|za", "he|huo|hu", "hai", "jiu", "yong",
+       "fu", "da", "zhou", "wa", "ka", "gu", "ka|ga", "zuo", "bu", "long",
+       "dong", "ning", "tuo", "si", "xian", "huo", "qi", "er", "e", "guang",
+       "zha", "die|xi", "yi", "lie", "zi", "mie", "mi", "zhi", "yao", "ji|xi|qia",
+       "zhou", "ka|luo|lo|ge", "shu|xun", "zan|za|zBn", "xiao", "ke|hai", "hui", "kua", "huai|shi", "tao",
+       "xian", "e|an", "xuan", "xiu", "wai|he|wo|wa|gua|guo", "yan|ye", "lao", "yi", "ai", "pin",
+       "shen", "tong", "hong", "xiong", "duo", "wa|wB", "ha", "zai", "you", "die|di",
+       "pai", "xiang", "ai", "gen|hen", "kuang", "ya", "da", "xiao", "bi", "yue|hui",
+       "nian", "hua", "xing", "kuai", "duo", "po", "ji|jie|zhai", "nong", "mou", "yo",
+       "hao", "yuan|yun", "long", "pou", "mang", "ge", "o", "chi", "shao", "li",
+       "na|nei|nB|ne", "zu", "he", "ku", "xiao", "xian", "lao", "po|ba|bo", "zhe", "zha",
+       "liang|lang", "ba", "mie", "lie|lv", "sui", "fu", "bu", "han", "heng|hng", "geng",
+       "chuo|yue", "ge|jia", "you", "yan", "gu", "gu", "bei|bai", "han", "suo", "chun",
+       "yi", "ai", "jia|qian", "tu", "dan|xian|yan", "wan", "li", "xi", "tang", "zuo",
+       "qiu", "che", "wu", "zao", "ya", "dou", "qi", "di", "qin", "ma",
+       "ma", "gong|hong", "dou", "ge", "lao", "liang", "suo", "zao", "huan", "leng",
+       "sha|shB", "ji", "zu", "wo|wei", "feng", "jin|yin", "hu|xia", "qi", "shou", "wei",
+       "shua", "chang", "er|wa", "li", "qiang", "an", "jie|ze|zuo", "yo", "nian", "yu",
+       "tian", "lai", "sha", "xi", "tuo", "hu", "ai", "zhou|zhao|tiao", "gou", "ken",
+       "zhuo", "zhuo|zhao", "shang", "di", "heng", "lan|lin", "a", "cai", "qiang", "zhun|tun|xiang|dui",
+       "wu", "wen", "cui|qi", "sha|jie|die|ti", "gu", "qi", "qi", "tao", "dan", "dan",
+       "yue|wa", "zi|ci", "bi|tu", "cui", "chuo|chuai", "he", "ya", "qi", "zhe", "fei",
+       "liang", "xian", "pi", "sha", "lB|la", "ze", "qing|ying", "gua", "pa", "ze|shi",
+       "se", "zhuan", "nie", "guo", "luo", "yan", "di", "quan", "tan|chan|tuo", "bo",
+       "ding", "lang", "xiao", "ju", "tang", "chi", "ti", "an", "jiu", "dan",
+       "ka", "yong", "wei", "nan", "shan", "yu", "zhe", "la", "jie", "hou",
+       "han", "die|zha", "zhou", "chai", "wai", "nuo|re", "huo|guo|xu", "yin", "zan|za|zBn", "yao",
+       "o|wo", "mian", "hu", "yun", "chuan", "hui", "huan", "huan|yuan|xuan|he", "xi", "he|ye",
+       "ji", "kui", "zhong|chuang", "wei", "sha", "xu", "huang", "duo|zha", "yan", "xuan",
+       "liang", "yu", "sang", "chi", "qiao|jiao", "yan", "dan|shan|chan", "pen|ben", "can|sun|qi", "li",
+       "yo", "zha|cha", "wei", "miao", "ying", "pen", "pbo", "kui", "xi", "yu",
+       "jie", "lou", "ku", "zao|qiao", "hu", "ti", "yao", "he|xiao|hu", "sha|a", "xiu",
+       "qiang", "se", "yong", "su", "gong|hong", "xie", "yi|ai", "suo", "ma|mB", "cha",
+       "hai", "ke", "ta|da", "sang", "chen", "ru", "sou", "wa|gu", "ji", "beng|pang",
+       "wu", "xian|qian|qie", "shi", "ge", "zi", "jie", "lao", "weng", "wa", "si",
+       "chi", "hao", "suo", "jia", "hai|hei", "suo", "qin", "nie", "he", "zi",
+       "sai", "ng", "ge", "na", "dia", "ai", "qiang", "tong", "bi", "ao",
+       "ao", "lian", "zui|sui", "zhe|zhu", "mo", "sou", "sou", "tan", "di", "qi",
+       "jiao", "chong", "jiao|dao", "kai|ge", "tan", "shan|can", "cao", "jia", "ai", "xiao",
+       "piao", "lou", "ga", "gu", "xiao|jiao", "hu", "hui", "guo", "ou", "xian",
+       "ze", "chang", "xu|shi", "po", "de|dei", "ma", "ma", "hu", "le", "du",
+       "ga", "tang", "ye", "beng", "ying", "sai", "jiao", "mi", "xiao", "hua",
+       "mai", "ran", "zuo", "peng", "lao", "xiao", "ji", "zhu", "chao|zhao", "kui",
+       "zui", "xiao", "si", "hao", "fu|?", "liao", "qiao", "xi", "chu|xu|shou", "tan|chan",
+       "dan|tan", "hei|mo", "xun", "e", "zun", "fan|bo", "chi", "hui", "zan", "chuang",
+       "cu|za|he", "dan", "jue", "tun|kuo", "ceng", "jiao", "ye", "xi", "qi", "hao",
+       "lian", "xu|shi", "deng", "hui", "yin", "pu", "jue", "qin", "xun", "nie",
+       "lu", "si", "yan", "ying", "da", "zhan", "o", "zhou|zhuo", "jin", "nong",
+       "yue|hui", "xie", "qi", "e", "zao", "yi", "shi", "jiao|qiao|chi", "yuan", "ai",
+       "yong", "jue|xue", "kuai", "yu", "pen", "dao", "ga", "xin|hen", "dun", "dang",
+       "xin", "sai", "pi", "pi", "yin", "zui", "ning", "di", "lan", "ta",
+       "huo|o", "ru", "hao", "he|xia", "yan", "duo", "xiu|pi", "zhou|chou", "ji|jie|zhai", "jin",
+       "hao", "ti", "chang", "xun", "me", "ca|cha", "ti", "lu", "hui", "bo|pao|bao",
+       "you", "nie", "yin", "hu", "mei|me|mo", "hong", "zhe", "li", "liu", "xie|hai",
+       "nang", "xiao", "mo", "yan", "li", "lu", "long", "po", "dan", "chen",
+       "pin", "pi", "xiang", "huo", "me", "xi", "duo", "ku", "yan", "chan",
+       "ying", "rang", "dian", "la", "ta", "xiao", "jiao|jue", "chuo", "huan", "huo",
+       "zhuan", "nie", "xiao", "ca", "li", "chan", "chai", "li", "yi", "luo",
+       "nang", "za|zan|can", "su", "xi", "zeng", "jian", "yan|za|nie", "zhu", "lan", "nie",
+       "nang", "ramo", "luo", "wei|guo", "hui", "yin", "qiu", "si", "nin", "jian|nan",
+       "hui", "xin", "yin", "nan", "tuan", "tuan", "dun|tun", "kang", "yuan", "jiong",
+       "pian", "yun", "cong", "hu", "hui", "yuan", "e", "guo", "kun", "cong",
+       "wei|tong", "tu", "wei", "lun", "guo", "qun", "ri", "ling", "gu", "guo",
+       "tai", "guo", "tu", "you", "guo", "yin", "hun", "pu", "yu", "han",
+       "yuan", "lun", "quan|juan", "yu", "qing", "guo", "chuan|chui", "wei", "yuan", "quan|juan",
+       "ku", "pu", "yuan", "yuan", "ya", "tuan", "tu", "tu", "tuan", "lve",
+       "hui", "yi", "huan|yuan", "luan", "luan", "tu", "ya", "tu", "ting", "sheng",
+       "pu", "lu", "kuai", "ya", "zai", "wei|xu", "ge", "yu|zhun", "wu", "gui",
+       "pi", "yi", "di|de", "qian|su", "qian", "zhen", "zhuo", "dang", "qia", "xia",
+       "shan", "kuang", "chang", "qi|yin", "nie", "mo", "ji", "jia", "zhi", "zhi",
+       "ban", "xun", "yi", "qin", "mei|fen", "jun", "rong|keng", "tun|dun", "fang", "ben|fen",
+       "ben", "tan", "kan", "huai|pei|pi", "zuo", "keng", "bi", "jing", "di|lan", "jing",
+       "ji", "kuai", "di", "jing", "jian", "tan", "li", "ba", "wu", "fen",
+       "zhui", "po", "pan|ban", "tang", "kun", "qu", "tan", "zhi", "tuo", "gan",
+       "ping", "dian", "gua", "ni", "tai", "pi", "jiong", "yang", "fo", "ao",
+       "lu", "qiu", "mu", "ke", "gou", "xue", "fa", "di|chi", "che", "ling",
+       "zhu", "fu", "hu", "zhi", "chui", "la", "long", "long", "lu", "ao",
+       "dai", "pao", "min", "xing", "dong|tong", "ji", "he", "lv", "ci", "chi",
+       "lei", "gai", "yin", "hou", "dui", "zhao", "fu", "guang", "yao", "duo",
+       "duo", "gui", "cha", "yang", "yin", "fa", "gou", "yuan", "die", "xie",
+       "ken", "shang", "shou", "e", "bing", "dian", "hong", "ya", "kua", "da",
+       "ka", "dang", "kai", "hang", "nao", "an", "xing", "xian", "yuan|huan", "bang",
+       "pou|fu", "ba", "yi", "yin", "han", "xu", "chui", "cen", "geng", "ai",
+       "beng|feng", "di|fang", "que|jue", "yong", "jun", "xia|jia", "di", "mai|man", "lang", "juan",
+       "cheng", "yan|shan", "qin|jin", "zhe", "lie", "lie", "pu|bu", "cheng", "hua", "bu",
+       "shi", "xun", "guo", "jiong", "ye", "nian", "di", "yu", "bu", "ya",
+       "quan", "sui|su", "pi", "qing|zheng", "wan", "ju", "lun", "zheng|cheng", "kong", "chong|shang",
+       "dong", "dai", "tan", "an", "cai", "chu|tou", "beng", "xian|kan", "zhi", "duo",
+       "yi|shi", "zhi", "yi", "pei", "ji", "zhun", "qi", "sao", "ju", "ni",
+       "ku", "ke", "tang", "kun", "ni", "jian", "dui", "jin", "gang", "yu",
+       "e", "peng|beng", "gu", "tu", "leng", "fang", "ya", "qian|zan|jian", "kun", "an",
+       "shen", "duo|hui", "nao", "tu", "cheng", "yin", "huan", "bi", "lian", "guo",
+       "die", "zhuan", "hou", "bao|bu|pu", "bao", "yu", "di", "mao|mou|wu", "jie", "ruan",
+       "e|ai|ye", "geng", "kan", "zong", "yu", "huang", "e", "yao", "yan", "bao",
+       "ji", "mei", "chang", "du", "tuo", "yin", "feng", "zhong", "jie", "jin",
+       "feng", "gang", "chuan", "jian", "ping", "lei", "jiang", "huang", "leng", "duan",
+       "wan", "xuan", "xi", "ji", "kuai", "ying", "ta", "cheng", "yong", "kai",
+       "su", "su", "shi", "mi", "ta", "weng", "cheng", "tu", "tang", "que",
+       "zhong", "li", "peng", "bang", "sai|se", "zang", "dui", "tian", "wu", "zheng",
+       "xun", "ge", "zhen", "ai", "gong", "yan", "xian", "tian|zhen", "yuan", "wen",
+       "xie", "liu", "hai", "lang", "chang", "peng", "beng", "chen", "lu", "lu",
+       "ou|qiu", "qian|zan|jian", "mei", "mo", "zhuan|tuan", "shuang", "shu", "lou", "chi", "man",
+       "biao", "jing", "qi", "shu", "zhi|di", "zhang", "kan", "yong", "dian", "chen",
+       "zhi|zhuo", "xi", "guo", "qiang", "jin", "shang", "shang", "mu", "cui", "yan",
+       "ta", "zeng", "qian", "qiang", "liang", "wei", "zhui", "qiao", "zeng", "xu",
+       "shan", "shan", "fa", "pu", "kuai|tui", "tuan|dong", "fan", "qiao|que", "mo", "dun",
+       "dun", "zun|dun", "di", "sheng", "duo|hui", "duo", "tan", "deng", "wu", "fen",
+       "huang", "tan", "da", "ye", "zhu", "jian", "ao", "qiang", "ji", "qiao|ao",
+       "ken", "yi|tu", "pi", "bi", "dian", "jiang", "ye", "yong", "xue|bo|jue", "tan",
+       "lan", "ju", "huai", "dang", "rang", "qian", "xun", "xian|lan", "xi", "he",
+       "ai", "ya", "dao", "hao", "ruan", "jin", "lei", "kuang", "lu", "yan",
+       "tan", "wei", "huai", "long", "long", "rui", "li", "lin", "rang", "chan",
+       "xun", "yan", "lei", "ba", "wan", "shi", "ren", "san", "zhuang", "zhuang",
+       "sheng", "yi", "mai", "ke|qiao", "zhu", "zhuang", "hu", "hu", "kun", "yi",
+       "hu", "xu", "kun", "shou", "mang", "dun", "shou", "yi", "zhi|zhong", "gu|ying",
+       "chu", "jiang|xiang", "feng|pang", "bei", "zhai", "bian", "sui", "qun", "ling", "fu",
+       "cuo", "xia", "xiong|xuan", "xie", "nao", "xia", "kui", "xi", "wai", "yuan|wan",
+       "mao|wan", "su", "duo", "duo", "ye", "qing", "yi", "gou", "gou", "qi",
+       "meng", "meng", "yin", "huo", "chen", "da|dai", "ce", "tian", "tai", "fu",
+       "guai", "yao", "yang", "hang|ben", "gao", "shi", "tao|ben", "tai", "tou", "yan|tao",
+       "bi", "yi", "kua", "jia|ga|xia", "duo", "hua", "kuang", "yun", "jia|ga|xia", "ba",
+       "en", "lian", "huan", "di|ti", "yan", "pao", "juan", "qi|ji", "nai", "feng",
+       "xie", "fen", "dian", "quan|juan", "kui", "zou", "huan", "qi|qie|xie", "kai", "she|chi|zha",
+       "ben", "yi", "jiang", "tao", "zang|zhuang", "ben", "xi", "huang", "fei", "diao",
+       "xun|zhui", "beng", "dian", "ao", "she", "weng", "po|ha|tai", "ao|yu", "wu", "ao|yu",
+       "jiang", "lian", "duo", "yun", "jiang", "shi", "fen", "huo", "bi", "luan",
+       "duo|che", "nv", "nu", "ding|tian", "nai", "qian", "jian", "ta|jie", "jiu", "nuan",
+       "cha", "hao", "xian", "fan", "ji", "shuo", "ru", "fei|pei", "wang", "hong",
+       "zhuang", "fu", "ma", "dan", "ren", "fu|you", "jing", "yan", "hai|jie", "wen",
+       "zhong", "pa", "du", "ji", "keng|hang", "zhong", "yao", "jin", "yun", "miao",
+       "fou|pei|pi", "chi", "yue|jue", "zhuang", "niu", "yan", "na|nan", "xin", "fen", "bi",
+       "yu", "tuo", "feng", "wan|yuan", "fang", "wu", "yu", "gui", "du", "ba",
+       "ni", "zhou", "zhuo", "zhao", "da", "ni|nai", "yuan", "tou", "xian|xuan|xu", "zhi|yi",
+       "e", "mei", "mo", "qi", "bi", "shen", "qie", "e", "he", "xu",
+       "fa", "zheng", "min", "ban", "mu", "fu", "ling", "zi", "zi", "shi",
+       "ran", "shan", "yang", "gan", "jie", "gu", "si", "xing", "wei", "zi",
+       "ju", "shan", "pin", "ren", "yao", "dong", "jiang", "shu", "ji", "gai",
+       "xiang", "hua|huo", "juan", "jiao|xiao", "gou|du", "mu|lao", "jian", "jian", "yi", "nian",
+       "zhi", "zhen", "ji", "xian", "heng", "guang", "jun|xun", "kua|hu", "yan", "ming",
+       "lie", "pei", "e", "you", "yan", "cha", "shen|xian", "yin", "shi", "gui",
+       "quan", "zi", "song", "wei", "hong", "wa", "lou", "ya", "rao", "jiao",
+       "luan", "ping", "xian", "shao", "li", "cheng|sheng", "xie", "mang", "fu", "suo",
+       "wu|mu", "wei", "ke", "chuo|lai", "chuo", "ting", "niang", "xing", "nan", "yu",
+       "na|nuo", "pou|bi", "nei|sui", "juan", "shen", "zhi", "han", "di", "zhuang", "e",
+       "pin", "tui", "man", "mian", "wu|yu", "yan", "wu", "xi|ai", "yan", "yu",
+       "si", "yu", "wa", "li", "xian", "ju", "qu", "zhui|shui", "qi", "xian",
+       "zhuo", "dong", "chang", "lu", "ai|e", "e", "e", "lou", "mian", "cong",
+       "pou|pei|bu", "ju", "po", "cai", "ling", "wan", "biao", "xiao", "shu", "qi",
+       "hui", "fu|fan", "wo", "wo", "tan", "fei", "fei", "jie", "tian", "ni",
+       "quan|juan", "jing", "hun", "jing", "qian|jin", "dian", "xing", "hu", "wan|wa", "lai",
+       "bi", "yin", "zhou|chou", "chuo|nao", "fu", "jing", "lun", "an|n<e", "lan", "hun|kun",
+       "yin", "ya", "ju", "li", "dian", "xian", "huB|dB tBi", "hua", "ying", "chan",
+       "shen", "ting", "dang|yang", "yao", "wu", "nan", "ruo|chuo", "jia", "tou|yu", "xu",
+       "yu", "wei", "di|ti", "rou", "mei", "dan", "ruan|nen", "qin", "hui", "wo",
+       "qian", "chun", "miao", "fu", "jie", "duan", "yi|pei", "zhong", "mei", "huang",
+       "mian", "an", "ying", "xuan", "jie", "wei", "mei", "yuan", "zheng", "qiu",
+       "ti", "xie", "tuo|duo", "lian", "mao", "ran", "si", "pian", "wei", "wa",
+       "cu", "hu", "ao|yun|wo", "jie", "bao", "xu", "tou|yu", "gui", "chu|zou", "yao",
+       "pi", "xi", "yuan", "ying", "rong", "ru", "chi", "liu", "mei", "pan",
+       "ao|yun|wo", "ma", "gou", "kui", "qin|shen", "jia", "sao", "zhen", "yuan", "jie|suo",
+       "rong", "ming", "ying", "ji", "su", "niao", "xian", "tao", "pang", "lang",
+       "nao", "biao", "ai", "pi", "pin", "yi", "piao", "yu", "lei", "xuan",
+       "man", "yi", "zhang", "kang", "yong", "ni", "li", "di", "gui", "yan",
+       "jin", "zhuan", "chang", "ze", "han|nan", "nen", "lao", "mo", "zhe", "hu",
+       "hu", "ao", "nen", "qiang", "ma", "pie", "gu", "wu", "qiao", "tuo",
+       "zhan", "miao", "xian", "xian", "mo", "liao", "lian", "hua", "gui", "deng",
+       "zhi", "xu", "yi", "hua", "xi", "kui", "rao", "xi", "yan", "chan",
+       "jiao", "mei", "fan", "fan", "xian|yan|jin", "yi", "hui", "jiao", "fu", "shi",
+       "bi", "shan", "sui", "qiang", "lian", "huan|xuan|qiong", "xin", "niao", "dong", "yi",
+       "can", "ai", "niang", "ning", "mo", "tiao", "chou", "jin", "ci", "yu",
+       "pin", "rong", "ru", "nai", "yan", "tai", "ying", "qian", "niao", "yue",
+       "ying", "mian", "bi", "mo", "shen", "xing", "ni", "du", "liu", "yuan",
+       "lan", "yan", "shuang", "ling", "jiao", "niang", "lan", "xian|qian", "ying", "shuang",
+       "xie|hui", "huan|quan", "mi", "li", "luan", "yan", "zhu|chuo", "lan", "zi", "jie",
+       "jue", "jue", "kong", "yun", "zi|ma", "zi", "cun", "sun|xun", "fu", "bei",
+       "zi", "xiao", "xin", "meng", "si", "tai", "bao", "ji", "gu", "nu",
+       "xue", "you", "zhuan", "hai", "luan", "sun|xun", "nao", "mie", "cong", "qian",
+       "shu", "chan|can", "ya", "zi", "ni", "fu", "zi", "li", "xue", "bo",
+       "ru", "nai", "nie", "nie", "ying", "luan", "mian", "ning", "rong", "ta",
+       "gui", "zhai", "qiong", "yu", "shou", "an", "tu|jia", "song", "wan", "rou",
+       "yao", "hong", "yi", "jing", "zhun", "mi|fu", "zhu", "dang", "hong", "zong",
+       "guan", "zhou", "ding", "wan|yuan", "yi", "bao", "shi", "shi", "chong", "shen",
+       "ke", "xuan", "shi", "you", "huan", "yi", "tiao", "shi", "xian", "gong",
+       "cheng", "qun", "gong", "xiao", "zai", "zha", "bao|shi", "hai", "yan", "xiao",
+       "jia|jiB", "cai", "chen", "rong", "huang", "mi", "kou", "kuan", "bin", "su|xiu",
+       "cai", "zan", "ji", "yuan", "ji", "yin", "mi", "kou", "qing", "he",
+       "zhen", "jian", "fu", "ning", "bing", "huan", "mei", "qin", "han", "yu",
+       "shi", "ning", "jin|qin", "ning", "zhi", "yu", "bao", "kuan", "ning", "qin",
+       "mo", "cha", "ju|lou", "gua", "qin", "hu", "wu", "liao", "shi", "ning",
+       "zhai", "shen", "wei", "xie", "kuan", "hui", "liao", "jun", "huan", "yi",
+       "yi", "bao", "qin", "chong", "bao", "feng", "cun", "dui", "si", "xun",
+       "dao", "l<e|luo", "dui", "shou", "po", "feng", "zhuan", "fu", "she|ye|yi", "kei|ke",
+       "jiang", "jiang", "zhuan", "wei|yu", "zun", "xun", "shu|zhu", "dui", "dao", "xiao",
+       "jie|ji", "shao", "er", "er", "er", "ga", "jian", "shu", "chen", "shang",
+       "shang", "mo", "ga", "chang", "liao", "xian", "xian", "hun", "you", "wang",
+       "you", "liao", "liao", "yao", "long|mang|meng|pang", "wang", "wang", "wang", "ga", "yao",
+       "duo", "kui", "zhong", "jiu", "gan", "gu", "gan", "tui", "gan", "gan",
+       "shi", "yin", "chi|che", "kao", "ni", "jin", "wei|yi", "niao|sui", "ju", "pi",
+       "ceng", "xi", "bi", "ju", "jie", "tian", "qu", "ti", "jie", "wu",
+       "diao", "shi", "shi", "ping|bing", "ji", "xie", "zhen", "xi", "ni", "zhan",
+       "xi", "wei", "man", "e", "lou", "ping|bing", "ti", "fei", "shu|zhu", "xie|ti",
+       "tu", "lv", "lv", "xi", "ceng", "lv", "ju", "xie", "ju", "jue",
+       "liao", "jue", "shu|zhu", "xi", "che|cao", "tun|zhun", "ni|ji", "shan", "wa", "xian",
+       "li", "an", "hui", "hui", "hong|long", "yi", "qi", "ren", "wu", "han|an",
+       "shen", "yu", "chu", "sui", "qi|kai", "yin", "yue", "ban", "yao", "ang",
+       "ya", "wu", "jie", "e", "ji", "qian", "fen", "wan", "qi", "cen",
+       "qian", "qi", "cha", "jie", "qu", "gang", "xian", "ao", "lan", "dao",
+       "ba", "zuo", "zuo", "yang", "ju", "gang", "ke", "gou", "xue", "po",
+       "li", "tiao", "ju", "yan", "fu", "xiu", "jia", "ling", "tuo", "pi",
+       "ao", "dai", "kuang", "yue", "qu", "hu", "po", "min", "an", "tiao",
+       "ling", "di", "ping", "dong", "zBi|ze mo", "kui", "xiu", "mao", "tong", "xue",
+       "yi", "bian", "he", "ke|ba", "luo", "e", "fu|nie", "xun", "die", "lu",
+       "en", "er", "gai", "quan", "tong|dong", "yi", "mu", "shi", "an", "wei",
+       "huan", "zhi|shi", "mi", "li", "fa", "tong", "wei", "you", "qia", "xia",
+       "li", "yao", "jiao|qiao", "zheng", "luan", "jiao", "e", "e", "yu", "xie|ye",
+       "bu", "qiao", "qun", "feng", "feng", "nao", "li", "you", "xian", "rong",
+       "dao", "shen", "cheng", "tu", "geng", "jun", "gao", "xia", "yin", "wu",
+       "lang", "kan", "lao", "lai", "xian", "que", "kong", "chong", "chong", "ta",
+       "lin", "hua", "ju", "lai", "qi", "min", "kun", "kun", "zu|cui", "gu",
+       "cui", "ya", "ya", "gang", "lun", "lun", "ling", "jue", "duo", "zheng",
+       "guo", "yin", "dong", "han", "zheng", "wei", "xiao", "pi|bi", "yan", "song",
+       "jie", "beng", "zu", "jue", "dong", "zhan|chan", "gu", "yin", "zi", "ze",
+       "huang", "yu", "wai|wei", "yang|dang", "feng", "qiu", "yang", "ti", "yi", "zhi|shi",
+       "shi|die", "zai", "yao", "e", "zhu", "kan|zhan", "lv", "yan", "mei", "han",
+       "ji", "ji", "huan", "ting", "sheng", "mei", "qian|kan", "wu|mao", "yu", "zong",
+       "lan", "ke|jie", "yan", "yan", "wei", "zong", "cha", "sui", "rong", "ke",
+       "qin", "yu", "qi", "lou", "tu", "cui", "xi", "weng", "cang", "dang|tang",
+       "rong|ying", "jie", "kai|ai", "liu", "wu", "song", "kao|qiao", "zi", "wei", "beng",
+       "dian", "cuo", "qin|qian", "yong", "nie", "cuo", "ji", "shi", "ruo", "song",
+       "zong", "jiang", "liao", "kang", "yan", "die|di", "cen", "ding", "tu", "lou",
+       "zhang", "zhan|chan", "zhan|chan", "ao", "cao", "qu", "qiang", "wei", "zui", "dao",
+       "dao", "xi", "yu", "pi|pei", "long", "xiang", "ceng", "bo", "qin", "jiao",
+       "yan", "lao", "zhan", "lin", "liao", "liao", "qin", "deng", "tuo", "zun",
+       "jiao|qiao", "jue|gui", "yao", "jiao", "yao", "jue", "zhan|shan", "yi", "xue", "nao",
+       "ye", "ye", "yi", "nie", "xian", "ji", "xie|jie", "ke|jie", "gui|xi|juan", "di",
+       "ao", "zui", "wei", "ni", "rong", "dao", "ling", "jie", "yu", "yue",
+       "yin", "ru", "jie", "li|lie", "gui|xi|juan", "long", "long", "dian", "ying|hong", "xi",
+       "ju", "chan", "ying", "kui", "yan", "wei", "nao", "quan", "chao", "cuan",
+       "luan", "dian", "dian", "nie", "yan", "yan", "yan", "kui", "yan", "chuan",
+       "kuai", "chuan", "zhou", "huang", "jing|xing", "xun", "chao", "chao", "lie", "gong",
+       "zuo", "qiao", "ju", "gong", "ge", "wu", "pu", "pu", "cha|chai|ci", "qiu",
+       "qiu", "ji", "yi", "si", "ba", "zhi", "zhao", "xiang|hang", "yi", "jin",
+       "xun", "juan", "pa", "xun", "jin", "fu", "za", "bi", "shi", "bu",
+       "ding", "shuai", "fan", "nie", "shi", "fen", "pa", "zhi", "xi", "hu",
+       "dan", "wei", "zhang", "tang|nu", "dai", "mo|wa", "pei", "pa", "tie", "fu",
+       "lian", "zhi", "zhou", "bo", "zhi", "di", "mo", "yi", "yi", "ping",
+       "qia", "juan", "ru", "shuai", "dai", "zhen", "shui", "qiao", "zhen", "shi",
+       "qun", "xi", "bang", "dai", "gui", "chou|dao", "ping", "zhang", "jian|san", "wan",
+       "dai", "wei", "chang", "sha|qie", "qi|ji", "ze", "guo", "mao", "zhu", "hou",
+       "zhen", "zheng", "mi", "wei", "wo", "fu", "yi", "bang", "ping", "die",
+       "gong", "pan", "huang", "tao", "mi", "jia", "teng", "hui", "zhong", "shan|qiao|shen",
+       "man", "mu", "biao", "guo", "ze", "mu", "bang", "zhang", "jing", "chan",
+       "fu", "zhi", "hu", "fan", "chuang|zhuang", "bi", "bi", "zhang", "mi", "qiao",
+       "chan", "fen", "meng", "bang", "chou|dao", "mie", "chu", "jie", "xian", "lan",
+       "gan", "ping", "nian", "jian", "bing", "bing", "xing", "gan", "yao", "huan",
+       "you", "you", "ji", "guang|an", "pi", "ting", "ze", "guang", "zhuang", "me|mo",
+       "qing", "bi", "qin", "dun|tun", "chuang", "gui", "ya", "bai|ting", "jie", "xu",
+       "lu", "wu", "zhuang", "ku", "ying", "di|de", "pao", "dian", "ya", "miao",
+       "geng", "ci", "fu", "tong", "pang", "fei", "xiang", "yi", "zhi", "tiao",
+       "zhi", "xiu", "du|duo", "zuo", "xiao", "tu", "gui", "ku", "mang|meng|pang", "ting",
+       "you", "bu", "bing|ping", "cheng", "lai", "bei", "ji|cuo", "an", "shu", "kang",
+       "yong", "tuo", "song", "shu", "qing", "yu", "yu", "miao", "sou", "ce",
+       "xiang", "fei", "jiu", "e", "gui|wei|hui", "liu", "sha|xia", "lian", "lang", "sou",
+       "zhi", "bu", "qing", "jiu", "jiu", "jin|qin", "ao", "kuo", "lou", "yin",
+       "liao", "dai", "lu", "yi", "chu", "chan", "tu", "si", "xin", "miao",
+       "chang", "wu", "fei", "guang", "kao", "kuai", "bi", "qiang|se", "xie", "lin",
+       "lin", "liao", "lu", "ji", "ying", "xian", "ting", "yong", "li", "ting",
+       "yin", "xun", "yan", "ting", "di", "po|pai", "jian", "hui", "nai", "hui",
+       "gong", "nian", "kai", "bian", "yi", "qi", "nong|long", "fen", "ju", "yan",
+       "yi", "zang", "bi", "yi", "yi", "er", "san", "shi", "er", "shi",
+       "shi", "gong", "diao", "yin", "hu", "fu", "hong", "wu", "tui", "chi",
+       "jiang", "ba", "shen", "di|ti|tui", "zhang", "jue|zhang", "tao", "fu", "di", "mi",
+       "xian", "hu", "chao", "nu", "jing", "zhen", "yi", "mi", "juan|quan", "wan",
+       "shao", "ruo", "xuan|yuan", "jing", "diao", "zhang", "jiang", "qiang|jiang", "peng", "dan|tan",
+       "qiang|jiang", "bi", "bi", "she", "dan|tan", "jian", "gou", "ge", "fa", "bi",
+       "kou", "jian", "bie", "xiao", "dan|tan", "guo", "qiang|jiang", "hong", "mi", "guo",
+       "wan", "jue", "xue", "ji", "gui", "dang", "lu", "lu", "tuan", "hui",
+       "zhi", "hui", "hui", "yi", "yi", "yi", "yi", "huo", "huo", "shan|xian",
+       "xing", "wen", "tong", "yan", "yan", "yu", "chi", "cai", "biao", "diao",
+       "bin", "peng|bang", "yong", "piao", "zhang", "ying", "chi", "chi", "zhuo|bo", "tuo|yi",
+       "ji", "pang|fang", "zhong", "yi", "wang", "che", "bi", "di", "ling", "fo",
+       "wang", "zheng", "cu", "wang", "jing", "dai", "xi", "xun", "hen", "yang",
+       "huai", "lv", "hou", "wang|jia|wa", "cheng|zheng", "zhi", "xu", "jing", "tu", "cong",
+       "cong", "lai", "cong", "de|dei", "pai", "xi", "dong", "ji", "chang", "zhi",
+       "cong|zong", "zhou", "lai", "yu", "xie", "jie", "jian", "shi|ti", "jia|xia", "bian",
+       "huang", "fu", "xun", "wei", "pang", "yao", "wei", "xi", "zheng", "piao",
+       "ti|chi", "de", "zhi|zheng", "zhi|zheng", "bie", "de", "zhong|chong", "che", "jiao|yao", "hui",
+       "jiao", "hui", "mei", "long", "xiang", "bao", "qu|ju", "xin", "xin", "bi",
+       "yi", "le", "ren", "dao", "ding|ting", "gai", "ji", "ren", "ren", "chan",
+       "tan", "te", "te|tui", "gan|han", "yi|qi", "shi|tai", "cun", "zhi", "wang", "mang",
+       "xi|lie", "fan", "ying", "tian", "min|wen", "min|wen", "zhong", "chong", "wu", "ji",
+       "wu", "xi", "jia", "you", "wan", "cong", "song|zhong", "kuai", "yu|shu", "bian",
+       "zhi", "qi|shi", "cui", "chen", "tai", "tun|zhun|dun", "qian|qin", "nian", "hun", "xiong",
+       "niu", "kuang|wang", "xian", "xin", "kang|hang", "hu", "kai", "fen", "huai", "tai",
+       "song", "wu", "ou", "chang", "chuang", "ju", "yi", "bao", "chao", "min|men",
+       "pei", "zuo|zha", "zen", "yang", "kou|ju", "ban", "nu", "nao|niu", "zheng", "pa",
+       "bu", "tie|zhan", "hu|gu", "hu", "cu|ju|zu", "da", "lian", "si|sai", "you|chou", "di",
+       "dai", "yi", "tu|die", "you", "fu", "ji", "peng", "xing", "yuan", "ni",
+       "guai", "fei", "xi", "bi", "you|yao", "qie", "xuan", "cong", "bing", "huang",
+       "xu|xue", "chu", "bi|pi", "shu", "xi|shu", "tan", "yong", "zong", "dui", "mi",
+       "gi", "yi", "shi", "nen|nin", "xun", "shi", "xi", "lao", "heng", "kuang",
+       "mou", "zhi", "xie", "lian", "tiao|yao", "huang", "die", "hao", "kong", "gui",
+       "heng", "xi|qi|xu", "xiao|jiao", "shu", "si", "hu|kua", "qiu", "yang", "hui", "hui",
+       "chi", "jia", "yi", "xiong", "guai", "lin", "hui", "zi", "xu", "chi",
+       "shang", "nv", "hen", "en", "ke", "dong", "tian", "gong", "quan|zhuan", "xi",
+       "qia", "yue", "peng", "ken", "de", "hui", "e|wu", "qiu", "tong", "yan",
+       "kai", "ce", "nao", "yun", "mang", "yong", "yong", "yuan|juan", "pi", "kun",
+       "qiao", "yue", "yu|shu", "tu", "jie|ke", "xi", "zhe", "lin", "ti", "han",
+       "hao|jiao", "qie", "ti", "bu", "yi", "qian", "hui", "xi", "bei", "man|men",
+       "yi", "heng", "song", "quan", "cheng", "kui|li", "wu", "wu", "you", "li",
+       "liang", "huan", "cong", "yi|nian", "yue", "li", "nin", "nao", "e", "que",
+       "xuan", "qian", "wu", "min", "cong", "fei", "bei", "de", "cui", "chang",
+       "men", "li", "ji", "guan", "guan", "xing", "dao", "qi", "kong", "tian",
+       "lun", "xi", "kan", "gun", "ni", "qing", "chou", "dun", "guo", "zhan",
+       "jing", "wan", "yuan|wan", "jin", "ji", "lan|lin", "yu|xu", "huo", "he", "juan|quan",
+       "tan|dan", "ti", "ti", "nian", "wang", "chuo|chui", "hu", "hun|men", "xi", "chang",
+       "xin", "wei", "hui", "e|wu", "suo|rui", "zong", "jian", "yong", "dian", "ju",
+       "can", "cheng", "de", "bei", "qie", "can", "dan|da", "guan", "duo", "nao",
+       "yun", "xiang", "zhui", "die", "huang", "chun", "qiong", "re", "xing", "ce",
+       "bian", "min", "zong", "ti|shi", "qiao", "chou", "bei", "xuan", "wei", "ge",
+       "qian", "wei", "yu", "yu|tou", "bi", "xuan", "huan", "min", "bi", "yi",
+       "mian", "yong", "qi|kai", "dang|shang|tang|yang", "yin", "e", "chen|xin|dan", "mao", "ke|qia", "ke",
+       "yu", "ai", "qie", "yan", "nuo", "gan", "yun", "cong|song", "sai|si", "leng",
+       "fen", "ying", "kui", "kui", "que", "gong|hong", "yun", "su", "su|shuo", "qi",
+       "yao", "song", "huang", "ji", "gu", "ju", "chuang", "ni", "xie", "kai",
+       "zheng", "yong", "cao", "xun", "shen", "bo", "kai|xi", "yuan", "xi|xie", "hun",
+       "yong", "yang", "li", "cao|sao", "tao", "yin", "ci", "xu|chu", "qian|qie", "tai",
+       "huang", "yun", "shen", "ming", "gong|hong", "she", "cao|cong", "piao", "mu", "mu",
+       "guo", "chi", "can", "can", "can", "cui", "min", "te", "zhang", "tong",
+       "ao", "shuang", "man", "guan", "que", "zao", "jiu", "hui", "kai", "lian",
+       "ou", "song", "qin|jin", "yin", "lv", "shang", "wei", "tuan", "man", "qian",
+       "she", "yong", "qing", "kang", "di|chi", "zhi|zhe", "lou|lv", "juan", "qi", "qi",
+       "yu", "ping", "liao", "cong", "you", "chong", "zhi", "tong", "cheng", "qi",
+       "qu", "peng", "bei", "bie", "qiong", "jiao", "zeng", "chi", "lian", "ping",
+       "kui", "hui", "qiao", "cheng|deng|zheng", "yin", "yin", "xi", "xi", "dan|da", "tan",
+       "duo", "dui", "dui|dun|tun", "su", "jue", "ce", "xiao|jiao", "fan", "fen", "lao",
+       "lao", "chong", "han", "qi", "xian", "min", "jing", "liao", "wu", "can",
+       "jue", "cu", "xian", "tan", "sheng", "pi", "yi", "chu", "xian", "nao|nang",
+       "dan", "tan", "jing", "song", "han", "jiao|ji", "wei", "xuan|huan", "dong", "qin",
+       "qin", "ju", "cao|sao", "ken", "xie", "ying", "ao", "mao", "yi", "lin",
+       "se", "jun", "huai", "men", "lan", "ai", "lin", "yan", "guo", "xia",
+       "chi", "yu", "yin", "dai", "meng", "ai|yi|ni", "meng", "dui", "qi|ji", "mo",
+       "lan|xian", "men", "chou", "zhi", "nuo", "nuo", "yan", "yang", "bo", "zhi",
+       "kuang", "kuang", "you", "fu", "liu", "mie", "cheng", "hui", "chan", "meng",
+       "lan", "huai", "xuan", "rang", "chan", "ji", "ju", "huan", "she", "yi",
+       "lian", "nan", "mi", "tang", "jue", "gang|zhuang", "gang|zhuang", "gang|zhuang", "ge", "yue",
+       "wu", "jian", "qu", "shu", "rong", "xi|hu", "cheng", "wo", "jie", "ge",
+       "jian", "qiang", "huo", "qiang", "zhan", "dong", "qi", "jia", "die", "zei",
+       "jia", "ji", "zhi", "kan", "ji", "kui", "gai", "deng", "zhan", "qiang",
+       "ge", "jian", "jie", "yu", "jian", "yan", "lu", "xi|hu", "zhan", "xi|hu",
+       "xi|hu", "chuo", "dai", "qu", "hu", "hu", "hu", "e", "shi", "ti",
+       "mao", "hu", "li", "fang", "suo", "bian|pian", "dian", "jiong", "shang|jiong", "yi",
+       "yi", "shan", "hu", "fei", "yan", "shou", "shou", "cai", "za|zha", "qiu",
+       "le|li|cai", "pu", "ba|pa", "da", "reng", "fan|fu", "ru", "zai", "tuo", "zhang",
+       "diao|di|yue|li", "kang|gang", "yu|wu", "yu|wu|ku", "han", "shen", "cha", "tuo|chi|yi", "gu|xi|ge|jie", "kou",
+       "wu", "den", "qian", "zhi", "ren", "kuo", "men", "sao", "yang", "niu",
+       "ban", "che", "rao", "xi|cha|qi", "qian|qin", "ban", "jia", "yu", "fu", "ba|ao",
+       "xi|zhe", "pi", "di", "zhi|sun|kan", "e", "den", "zhao", "cheng", "ji", "yan",
+       "kuang|wang|zai", "bian", "chao", "ju", "wen", "hu|gu", "yue", "jue", "ba", "qin",
+       "dan|shen", "zheng", "yun", "wan", "ne|ni|rui|na", "yi", "shu", "zhua", "pou", "tou",
+       "dou", "kang", "zhe|she", "pou|fu", "fu", "pao", "ba", "ao|niu", "ze|zhBi", "tuan",
+       "kou", "lun", "qiang|cheng", "yun", "hu", "bao", "bing", "zhi|zhai", "peng", "nan",
+       "bu|pu", "pi", "tai", "yao|tao", "zhen", "zha", "yang", "bao", "he|qia", "ni",
+       "ye", "di", "chi", "pi|pei", "jia", "mo|ma", "mei", "chen", "ya", "chou",
+       "qu", "min", "zhu", "jia|ya", "fu|bi", "zha", "zhu", "dan", "chai|ca", "mu",
+       "nian", "la", "fu", "pao", "ban|pan", "pai", "lin", "na", "guai", "qian",
+       "ju", "tuo|ta|zhi", "ba", "tuo", "tuo", "ao|niu", "ju|gou", "zhuo", "pan|pin|fan", "zhao",
+       "bai", "bai", "di", "ni", "ju", "kuo", "long", "jian", "qia", "yong",
+       "lan", "ning", "bo", "ze|zhai", "qian", "hen", "kuo|gua", "shi", "jie|jia", "zheng",
+       "nin", "gong", "gong", "quan", "shuan", "cun|zun", "za|zan", "kao", "yi|chi|hai", "xie",
+       "ce|se|chuo", "hui", "pin", "zhuai|ye", "shi|she", "na", "bai", "chi", "gua", "zhi",
+       "kuo|guang", "duo", "duo", "zhi", "qie", "an", "nong", "zhen", "ge", "jiao",
+       "kua|ku", "dong", "ru|na", "tiao", "lie", "zha", "lv", "die|she", "wa", "jue",
+       "lie ri", "ju", "zhi", "luan", "ya", "zhua|wo", "ta", "xie|jia", "nao", "dang",
+       "jiao", "zheng", "ji", "hui", "xian", "yu", "ai", "tuo|shui", "nuo", "cuo",
+       "bo", "geng", "ti", "zhen", "cheng", "suo|sB|shB", "suo|sB|shB", "keng|qian", "mei", "nong",
+       "ju", "bang|peng", "jian", "yi", "ting", "shan", "nuo", "wan", "xie|jia", "cha",
+       "peng", "jiao|ku", "wu", "jun", "jiu", "tong", "kun", "huo|chi", "tu|shu|cha", "zhuo",
+       "pou|fu", "luo|lv", "ba", "han", "shao", "nie", "juan", "ze", "shu|song|sou", "ye|yu",
+       "jue|zhuo", "bu", "wan", "bu|pu|zhi", "zun", "ye", "zhai", "lv", "sou", "tuo|shui",
+       "lao", "sun", "bang", "jian", "huan", "dao", "wei", "wan|yu", "qin", "peng",
+       "she", "lie", "min", "men", "fu|bu", "bai", "ju", "dao", "wo|luo", "ai",
+       "juan|quan", "yue", "zong", "chen", "chui", "jie", "tu", "ben", "na", "nian|nie",
+       "ruo|wei|re", "zuo", "wo|xia", "qi", "xian", "cheng", "dian", "sao", "lun", "qing|qian",
+       "gang", "duo", "shou", "diao", "pou", "di", "zhang", "hun", "ji", "tao",
+       "qia", "qi", "pai", "shu", "qian|wan", "ling", "ye", "ya", "jue", "zheng",
+       "liang", "gua", "ni|nie|yi", "huo|xu", "shan|yan", "zheng|ding", "lve", "cai", "tan", "che",
+       "bing", "jie", "ti", "kong", "tui", "yan", "cuo", "zou|zhou|chou", "ju", "tian",
+       "qian", "ken", "bai", "pa", "jie", "lu", "guai", "ming", "jie", "zhi",
+       "dan|shan", "meng", "chan|xian|can|shan", "sao", "guan", "peng", "yuan", "nuo", "jian", "zheng|keng",
+       "jiu|you", "jian", "yu", "yan", "kui", "nan", "hong", "rou", "pi|che", "wei",
+       "sai|zong|cai", "zou", "xuan", "miao", "ti|di", "nie", "cha", "shi", "zong|song", "zhen",
+       "yi", "xun", "huang|yong", "bian", "yang", "huan", "yan", "zan|zuan", "an", "xu|ju",
+       "ya", "wo", "ke|qia", "chuai|tuan|zhui", "ji", "ti|di", "la", "la", "cheng", "kai",
+       "jiu", "jiu", "tu", "jie|qi", "hui", "gen", "chong|dong", "xiao", "she|die|ye", "xie",
+       "yuan", "qian|jian", "ye", "cha", "zha", "bei", "yao", "wei", "beng", "lan",
+       "wen", "qin", "chan", "ge", "lou", "zong", "gen", "jiao", "gou", "qin",
+       "rong", "que", "chou|zou", "chuai", "zhan", "sun", "sun", "bo", "chu", "rong|nang",
+       "bang|peng", "cuo", "sao", "e", "yao", "dao", "zhi", "nu|nuo|nou", "la|xie|xian", "jian",
+       "sou", "qiu", "gao", "gan", "shuo", "sang", "jin", "mie", "e", "chui",
+       "nuo", "shan", "ta", "jie|zhe", "tang", "pan|ban|po", "ban", "da", "li", "tao",
+       "hu|ku", "zhi|nai", "wa", "hua", "qian", "wen", "qiang|cheng", "tian|shen", "zhen", "e",
+       "xie", "na|nuo", "quan", "cha", "zha", "ge", "wu", "en", "she", "kang",
+       "she|nie", "shu", "bai", "yao", "bin", "sou", "tan", "sa|sha|shai", "chan|sun", "suo",
+       "jiu|liu|liao|jiao|nao", "chong", "chuang", "guai", "bing", "feng|peng", "shuai", "di|tu|zhi", "qi|ji|cha", "sou|song",
+       "zhai", "lian", "cheng", "chi", "guan", "lu", "luo", "lou", "zong", "gai|xi",
+       "hu|chu", "zha", "qiang", "tang", "hua", "cui", "zhi|nai", "mo|ma", "jiang|qiang", "gui",
+       "ying", "zhi", "ao|qiao", "zhi", "nie|che", "man", "chan|can", "kou", "chu", "se|mi|su",
+       "tuan", "jiao|chao", "mo", "mo", "zhe", "chan|xian|can|shan", "keng|qian", "biao", "jiang", "yao",
+       "gou", "qian", "liao", "ji", "ying", "jue", "pie", "pie", "lao", "dun",
+       "xian", "ruan", "gui", "zan|zen|qian", "yi", "xian", "cheng", "cheng", "sa", "nao",
+       "hong", "si", "han", "heng|guang", "da", "zun", "nian", "lin", "zheng|cheng", "hui|wei",
+       "zhuang", "jiao", "ji", "cao", "dan", "dan|shan", "che", "bo", "che", "jue",
+       "xiao|sou", "liao", "ben", "fu", "qiao", "bo", "cuo|zuo", "zhuo", "zhuan", "wei|tuo",
+       "pu", "qin", "dun", "nian", "hua", "xie", "lu", "jiao", "cuan", "ta",
+       "han", "qiao|yao|ji", "zhua|wo", "jian", "gan", "yong", "lei", "nang", "lu", "shan",
+       "zhuo", "ze|zhai", "pu", "chuo", "ji", "dang", "se", "cao", "qing", "qing|jing",
+       "huan", "jie", "qin", "kuai", "dan", "xie", "qia|jia|ye", "pi|bo", "bo|bai", "ao",
+       "ju", "ye", "e", "meng", "sou", "mi", "ji", "tai", "zhuo", "dao",
+       "xing", "lan", "ca", "ju", "ye", "ru", "ye", "ye", "ni", "huo",
+       "jie", "bin", "ning", "ge", "zhi", "zhi|jie", "kuo", "mo", "jian", "xie",
+       "lie|la", "tan", "bai", "sou", "lu", "li|luo|yue", "rao", "ti|zhi|zhai", "pan", "yang",
+       "lei", "ca|sa", "shu", "zan", "nian", "xian", "jun|pei", "huo", "li|luo", "la|lai",
+       "huan", "ying", "lu|luo", "long", "qian", "qian", "zan|cuan", "qian", "lan", "xian|jian",
+       "ying", "mei", "rang", "chan", "weng", "cuan", "xie", "she|nie", "luo", "jun",
+       "mi|mo", "chi", "zan|cuan", "luan", "tan", "zuan", "li|shai", "dian", "wa", "dang",
+       "jiao", "jue", "lan", "li|luo", "nang", "zhi", "gui", "gui", "qi|yi|ji", "xun",
+       "pu", "pu", "shou", "kao", "you", "gai", "yi", "gong", "gan|han", "ban",
+       "fang", "zheng", "po", "dian", "kou", "min", "wu|mou", "gu", "he", "ce",
+       "xiao", "mi", "chu|shou", "ge|guo|e", "di", "xu", "jiao", "min", "chen", "jiu",
+       "shen", "duo|dui", "yu", "chi", "ao", "bai", "xu", "jiao", "duo|dui", "lian",
+       "nie", "bi", "chang", "dian", "duo|que", "yi", "gan", "san", "ke", "yan",
+       "dun|dui", "qi|yi|ji", "tou", "xiao|xue", "duo|que", "jiao", "jing", "yang", "xia", "min",
+       "shu|shuo", "ai|zhu", "qiao", "ai|zhu", "zheng", "di", "chen", "fu", "shu|shuo", "liao",
+       "qu", "xiong|xuan", "yi", "jiao", "shan", "jiao", "zhuo|zhu", "yi|du", "lian", "bi",
+       "li|tai", "xiao", "xiao", "wen", "xue", "qi", "qi", "zhai", "bin", "jue|jiao",
+       "zhai", "lang", "fei", "ban", "ban", "lan", "yu|zhong", "lan", "wei|men", "dou",
+       "sheng", "liao", "jia", "hu", "xie", "jia", "yu", "zhen", "jiao", "wo|guan",
+       "tou|tiao", "dou", "jin", "chi", "yin|zhi", "fu", "qiang", "zhan", "qu", "zhuo",
+       "zhan", "duan", "zhuo", "si", "xin", "zhuo", "zhuo", "qin", "lin", "zhuo",
+       "chu", "duan", "zhu", "fang", "chan|jie", "hang", "yu|wu", "shi", "pei", "liu|you",
+       "mie", "pang|bang", "qi", "zhan", "mao", "lv", "pei", "pi|bi", "liu", "fu",
+       "fang", "xuan", "jing", "jing", "ni", "zu", "zhao", "yi", "liu", "shao",
+       "jian", "en", "yi", "qi", "zhi", "fan", "piao", "fan", "zhan", "kuai",
+       "sui", "yu", "wu", "ji", "ji", "ji", "huo", "ri", "dan", "jiu",
+       "zhi", "zao", "xie", "tiao", "xun", "xu", "ga", "la", "gan|han", "han",
+       "tai|ying", "di|de", "xu", "chan", "shi", "kuang", "yang", "shi", "wang", "min",
+       "min", "tun|zhun", "chun", "wu", "yun", "bei", "ang", "ze", "ban", "jie",
+       "kun", "sheng", "hu", "fang", "hao", "gui", "chang", "xuan", "ming", "hun",
+       "fen", "qin", "hu", "yi", "xi", "xin", "yan", "ze", "fang", "tan",
+       "shen", "ju", "yang", "zan", "bing", "xing", "ying", "xuan", "po", "zhen",
+       "ling", "chun", "hao", "mei", "zuo", "mo", "bian", "xu", "hun", "zhao",
+       "zong", "shi", "shi", "yu", "fei", "die|yi", "mao", "ni", "chang", "wen",
+       "dong", "ai", "bing", "ang", "zhou", "long", "xian", "kuang", "tiao", "chao",
+       "shi", "huang", "huang", "xuan", "kui", "xu|kua", "jiao", "jin", "zhi", "jin",
+       "shang", "tong", "hong", "yan", "gai", "xiang", "shai", "xiao", "ye", "yun",
+       "hui", "han", "han", "jun", "wan", "xian", "kun", "zhou", "xi", "sheng|cheng",
+       "sheng", "bu", "zhe", "zhe", "wu", "wan", "hui", "hao", "chen", "wan",
+       "tian", "zhuo", "zui", "zhou", "pu", "jing|ying", "xi", "shan", "ni", "xi",
+       "qing", "qi|du", "jing", "gui", "zheng", "yi", "zhi", "an|yan", "wan", "lin",
+       "liang", "cheng", "wang", "xiao", "zan", "fei", "xuan", "xuan", "yi", "xia",
+       "yun", "hui", "xu", "min", "kui", "ye", "ying", "shu|du", "wei", "shu",
+       "qing", "mao", "nan", "jian|lan", "nuan", "an", "yang", "chun", "yao", "suo",
+       "pu", "ming", "jiao", "kai", "hao", "weng", "chang", "qi", "hao", "yan",
+       "li", "ai", "ji", "ji", "men", "zan", "xie", "hao", "mu", "mu",
+       "cong", "ni", "zhang", "hui", "bao|pu", "han", "xuan", "chuan", "liao", "xian",
+       "tan", "jing", "pie", "lin", "tun", "xi", "yi", "ji", "huang", "dai",
+       "ye", "ye", "li", "tan", "tong", "xiao", "fei", "shen", "zhao", "hao",
+       "yi", "xiang", "xing", "shen", "jiao", "bao", "jing", "yan", "ai", "ye",
+       "ru", "shu", "meng", "xun", "yao", "pu|bao", "li", "chen", "kuang", "die",
+       "liao", "yan", "huo", "lu", "xi", "rong", "long", "nang", "luo", "luan",
+       "shai", "tang", "yan", "zhu", "yue", "yue", "qu", "ye", "geng", "ye",
+       "hu", "he", "shu", "cao", "cao", "sheng", "man", "zeng|ceng", "zeng|ceng", "ti",
+       "zui", "can|qian|jian", "xu", "hui|kuai", "yin", "qie|he", "fen", "bi|pi", "yue", "you",
+       "ruan", "peng", "fen|ban", "fu", "ling", "fei|ku", "qu|xu|chun", "ti", "nv|ga", "tiao",
+       "shuo", "zhen", "lang", "lang", "juan|zui", "ming", "huang|mang|wang", "wang", "tun", "zhao|chao",
+       "ji", "qi|ji", "ying", "zong", "wang", "tong|chuang", "lang", "lao", "meng", "long",
+       "mu", "pin", "wei", "mo", "ben", "zha", "shu|zhu", "shu|zhu", "teul", "zhu|shu",
+       "ren", "ba", "piao|pu|po", "duo", "duo", "dao|tiao|mu", "li", "qiu|gui", "ji", "jiu",
+       "bi", "xiu", "cheng", "ci", "sha", "ru", "za", "quan", "qian", "yu|wu",
+       "gan", "wu", "cha", "shan|sha", "xun", "fan", "wu", "zi", "li", "xing",
+       "cai", "cun", "ren|er", "shao|biao", "tuo|zhe", "di|duo", "zhang", "mang", "chi", "yi",
+       "gu|gai", "gong", "du", "yi|li|duo|tuo", "qi", "shu", "gang", "tiao", "jie", "mian",
+       "wan", "lai", "jiu", "mang", "yang", "ma", "miao", "si|zhi|xi", "yuan|wan", "hang",
+       "fei|bei", "bei", "jie", "dong", "gao", "yao", "xian", "chu", "chun", "pa",
+       "shu|dui", "hua", "xin", "niu|chou", "zhu", "chou", "song", "ban", "song", "ji",
+       "wo|yue", "jin", "gou", "ji", "mao", "pi", "pi|mi", "wang", "ang", "fang|bing",
+       "fen", "yi", "fu", "nan", "xi", "hu|di", "ya", "dou", "xin", "zhen",
+       "yao", "lin", "rui", "e", "mei", "zhao", "guo", "zhi|qi", "cong|zong", "yun",
+       "hua", "sheng", "shu", "zao", "di|duo", "li", "lu", "jian", "cheng", "song|mB ti su",
+       "qiang", "feng", "zhan", "xiao", "xian|zhen", "ku", "ping", "si|tai", "xi", "zhi",
+       "guai", "xiao", "jia", "jia", "ju|gou", "bao|fu", "mo", "yi|xie", "ye", "ye",
+       "shi", "nie", "bi", "tuo|duo", "yi|duo|li", "ling", "bing", "ni|chi", "la", "he",
+       "pan|ban", "fan", "zhong", "dai", "ci", "yang|ying", "fu", "bai|bo", "mou", "gan",
+       "qi", "ran", "rou", "mao", "shao", "song", "zhe", "xia", "you", "shen",
+       "gui|ju", "tuo", "zuo|zha", "nan", "ning", "yong", "di", "zhi|die", "zha|zu", "cha|zha",
+       "dan", "gu", "bu|pu", "jiu", "ao", "fu", "jian", "ba|fu|pei|bo|bie", "duo|zuo|wu", "ke",
+       "nai", "zhu", "bi|bie", "liu", "chai", "zha", "si", "zhu", "bei|pei", "shi|fei",
+       "guai", "cha|zha", "yao", "cheng", "jiu", "shi", "zhi", "liu", "mei", "li",
+       "rong", "zha|shan|shi|ce", "zao", "biao", "zhan", "zhi", "long", "dong", "lu", "sa",
+       "li|yue", "lan", "yong", "shu", "xun", "shuan", "qi|qie", "chen", "qi|xi", "li",
+       "yi", "xiang", "zhen", "li", "se", "gua|tian", "kan", "ben|bing", "ren", "xiao|jiao",
+       "bai", "ren", "bing", "zi", "chou", "yi|xie", "ci", "xu", "zhu", "jian|zun",
+       "zui", "er", "er", "you|yu", "fa", "gong", "kao", "lao", "zhan", "lie",
+       "yin", "yang", "he|hu", "gen", "zhi|yi", "shi", "ge", "zai", "luan", "fu",
+       "jie", "heng|hang", "gui", "tao", "guang", "wei", "kuang", "ru", "an", "an",
+       "juan", "yi|ti", "zhuo", "ku", "zhi", "qiong", "tong", "sang", "sang", "huan",
+       "jie|ju", "jiu", "xue", "duo", "chui", "yu|mou", "za|zan", "kB sei", "ying", "jie",
+       "liu", "zhan", "ya", "nao", "zhen", "dang", "qi", "qiao", "hua", "gui|hui",
+       "jiang", "zhuang", "xun", "suo", "sha", "chen|zhen", "bei", "ting|ying", "gua", "jing",
+       "bo", "ben|fan", "fu", "rui", "tong", "jue", "xi", "lang", "liu", "feng",
+       "qi", "wen", "jun", "gan", "su|yin", "liang", "qiu", "ting", "you", "mei",
+       "bang", "long", "peng", "zhuang", "di", "xuan|juan|xie", "tu|cha", "zao", "ao|you", "gu",
+       "bi", "di", "han", "zi", "zhi", "ren|er", "bei", "geng", "jian", "huan",
+       "wan", "nuo", "jia", "tiao", "ji", "xiao", "lv", "kuan", "shao|sao", "chen",
+       "fen", "song", "meng", "wu", "li", "si|qi", "dou", "qin", "ying", "suo",
+       "ju", "ti", "xie", "kun", "zhuo", "shu", "chan|yan", "fan", "wei", "jing",
+       "li", "bin|bing", "xia", "fo", "chou|tao|dao", "zhi", "lai", "lian", "jian", "zhuo",
+       "ling", "li", "qi", "bing", "lun", "cong|song", "qian", "mian", "qi", "qi",
+       "cai", "gun|hun", "chan", "de|zhe", "fei", "pai|bei|pei", "bang", "bang|pou|bei", "hun", "zong",
+       "cheng", "zao", "ji", "li|lie", "peng", "yu", "yu", "gu", "jun", "dong",
+       "tang", "gang", "wang", "di|dai|ti", "que", "fan", "cheng", "zhan", "qi", "yuan",
+       "yan", "yu", "quan|juan", "yi", "sen", "ren|shen", "chui", "leng|ling", "qi", "zhuo",
+       "fu|su", "ke", "lai", "zou|sou", "zou", "zhao|zhuo", "guan", "fen", "fen", "chen",
+       "qing", "ni", "wan", "guo", "lu", "hao", "jie|qie", "yi", "chou|zhou|diao", "ju",
+       "ju", "cheng|sheng", "zu|cui", "liang", "qiang|kong", "zhi", "zhui|chui", "ya", "ju", "bei",
+       "jiao", "zhuo", "zi", "bin", "peng", "ding", "chu", "chang", "men", "hua",
+       "jian", "gui", "xi", "du", "qian", "dao", "gui", "dian", "luo", "zhi",
+       "quan|juan", "mi eng", "fu", "geng", "peng", "shan", "yi", "tuo", "sen", "duo|chuan",
+       "ye", "fu", "wei|hui", "wei", "duan", "jia", "zong", "jian|han", "yi", "zhen|shen",
+       "xi", "yan|ya", "yan", "chuan", "jian", "chun", "yu", "he", "zha|cha", "wo",
+       "pian", "bi", "yao", "guo|kua", "xu", "ruo", "yang", "la", "yan", "ben",
+       "hui", "kui", "jie", "kui", "si", "feng", "xie", "tuo", "ji|zhi", "jian",
+       "mu", "mao", "chu", "ku|hu", "hu", "lian", "leng", "ting", "nan", "yu",
+       "you", "mei", "song|cong", "xuan|yuan", "xuan", "yang|ying", "zhen", "pian", "die|ye", "ji",
+       "jie", "ye", "chu", "shun|dun", "yu", "cou|zou", "wei", "mei", "di|shi", "ji",
+       "jie", "kai|jie", "qiu", "ying", "rou", "huang", "lou", "le|yue", "quan", "xiang",
+       "pin", "shi", "gai", "tan", "lan", "wen|yun", "yu", "chen", "lv", "ju",
+       "shen", "chu", "bi|pi", "xie", "jia", "yi", "zhan|nian|zhen", "fu|bo", "nuo", "mi",
+       "lang", "rong", "gu", "jian|jin", "ju", "ta", "yao", "zhen", "bang", "sha|xie",
+       "yuan", "zi", "ming", "su", "jia", "yao", "jie", "huang", "gan", "fei",
+       "zha", "qian", "ma", "sun", "yuan", "xie", "rong", "shi", "zhi", "cui",
+       "wen", "ting", "liu", "rong", "tang", "que", "zhai", "si", "sheng", "ta",
+       "ke", "xi", "gu", "qi", "gao", "gao", "sun", "pan", "tao", "ge",
+       "chun", "dian", "nou", "ji", "shuo", "gou", "chui", "qiang", "cha", "qian|lian|xian",
+       "huai", "mei", "xu", "gang", "gao", "zhuo", "tuo", "qiao", "yang", "dian|zhen",
+       "jia", "jian|kan", "zui", "dao", "long", "bin|bing", "zhu", "sang", "xi|die", "ji|gui",
+       "lian", "hui", "rong|yong", "qian", "guo", "gai", "gai", "tuan|shuan|quan", "hua", "qi|se",
+       "sen", "cui|zhi", "peng", "you|chao", "hu", "jiang", "hu", "huan", "gui", "nie",
+       "yi", "gao", "kang", "gui", "gui", "cao", "man|wan", "jin", "di", "zhuang",
+       "le|yue", "lang", "chen", "cong|zong", "li|chi", "xiu", "qing", "shang", "fan", "tong",
+       "guan", "ze", "su", "lei", "lu", "liang", "mi", "lou", "chao|jiao", "su",
+       "ke", "chu", "cheng", "biao", "lu", "jiu|liao", "zhe", "zha", "shu", "zhang",
+       "man", "mo|mu", "niao|mu", "yang", "tiao", "peng", "zhu", "sha|xie", "xi", "quan",
+       "heng", "jian", "cong", "ji", "yan", "qiang", "xue", "ying", "er", "xun",
+       "zhi", "qiao", "zui", "cong", "piao", "shu", "hua", "gui", "zhen", "zun",
+       "yue", "shan", "xi", "chun", "dian", "fa|fei", "gan", "mo", "wu", "qiao",
+       "rao|nao", "lin", "liu", "qiao", "xian", "run", "fan", "zhan|jian", "tuo", "liao",
+       "yun", "shun", "tui|dun", "cheng", "tang|cheng", "meng", "ju", "cheng", "su|qiu", "jue",
+       "jue", "tan|dian", "hui", "ji", "nuo", "xiang", "tuo", "ning", "rui", "zhu",
+       "tong|chuang", "zeng|ceng", "fen|fei", "qiong", "ran|yan", "heng", "qian", "gu", "liu", "lao",
+       "gao", "chu", "xi", "sheng", "zi", "zan", "ji", "dou", "jing", "lu",
+       "xian", "cu|chu", "yuan", "ta", "shu|qiao", "jiang", "tan", "lin", "nong", "yin",
+       "xi", "hui", "shan", "zui", "xuan", "cheng", "gan", "ju", "zui", "yi",
+       "qin", "pu", "yan", "lei", "feng", "hui", "dang", "ji", "sui", "bo",
+       "ping|bo", "cheng", "chu", "zhua", "gui|hui", "ji", "jie", "jia", "qing", "zhai|shi|tu",
+       "jian", "qiang", "dao", "yi", "biao", "song", "she", "lin", "li", "cha",
+       "meng", "yin", "chou|tao|dao", "tai", "mian", "qi", "tuan", "bin|bing", "huo", "ji",
+       "qian|lian", "ni|mi", "ning", "yi", "gao", "jian|kan", "yin", "nou|ruan|ru", "qing", "yan",
+       "qi", "mi", "zhao", "gui", "chun", "ji", "kui", "po", "deng", "chu",
+       "ge", "mian", "you", "zhi", "huang|guo|gu", "qian", "lei", "lei", "sa", "lu",
+       "li", "cuan", "lv|chu", "mie|mei", "hui", "ou", "lv", "zhi", "gao", "du",
+       "yuan", "li|yue", "fei", "zhuo|zhu", "sou", "lian", "jiang", "chu", "qing", "zhu",
+       "lu", "yan", "li", "zhu", "chen", "jue|ji", "e", "su", "huai|gui", "nie",
+       "yu", "long", "la|lai", "qiao", "xian", "gui", "ju", "xiao", "ling", "ying",
+       "jian", "yin", "you", "ying", "xiang", "nong", "bo", "chan|zhan", "lan", "ju",
+       "shuang", "she", "wei|zui", "cong", "quan", "qu", "cang", "jiu", "yu", "luo",
+       "li", "cuan", "luan", "dang", "qu", "yan", "lan", "lan", "zhu", "lei",
+       "li", "ba", "nang", "yu", "ling", "guan", "qian", "ci", "huan", "xin",
+       "yu", "yu|yi", "qian|xian", "ou", "xu", "chao", "chu|qu|xi", "qi", "ke|ai", "yi|yin",
+       "jue", "xi|kai", "xu", "he", "yu", "kuai", "lang", "kuan", "shuo|sou", "xi",
+       "ei|ai", "qi", "qi", "xu|chua", "chi|chuai", "qin", "kuan", "kan|qian", "kuan", "kan|ke",
+       "chuan", "sha", "gua", "yan|yin", "xin", "xie", "yu", "qian", "xiao", "ye",
+       "ge", "wu", "tan", "jin|qun", "ou", "hu", "ti", "huan", "xu", "pen",
+       "xi", "xiao", "xu", "xi|she", "shan", "lian|han", "chu", "yi", "e", "yu",
+       "chuo", "huan", "zhi", "zheng", "ci", "bu", "wu", "qi", "bu", "bu",
+       "wai", "ju", "qian", "zhi|chi", "se", "chi", "se|sha", "zhong", "sui", "sui",
+       "li", "ze", "yu", "li", "gui", "dai", "dai", "si", "jian", "zhe",
+       "mo|wen", "mo", "yao", "mo", "cu", "yang", "tian", "sheng", "dai", "shang",
+       "xu", "xun", "shu", "can", "jing", "piao", "qia", "qiu", "su", "qing|jing",
+       "yun", "lian", "yi", "fou|bo", "zhi|shi", "ye|yan", "can", "hun|mei", "dan", "ji",
+       "die", "zhen", "yun", "wen", "chou", "bin", "ti", "jin", "shang", "yin",
+       "chi", "jiu", "kui|hui", "cuan", "yi", "dan", "du", "jiang", "lian", "bin",
+       "du", "jian", "jian", "shu", "ou", "duan", "zhu", "yin|yan", "qing|keng|sheng", "yi",
+       "sha", "ke|qiao", "ke|qiao", "xiao|yao", "xun", "dian", "hui", "hui", "gu", "qiao",
+       "ji", "yi", "ou", "hui", "duan", "yi", "xiao", "wu", "guan|wan", "mu",
+       "mei", "mei", "ai", "jie", "du|dai", "yu", "bi", "bi", "bi", "pi",
+       "pi", "bi", "chan", "mao", "hao", "cai", "bi", "lie", "jia", "zhan",
+       "sai", "mu", "tuo", "xun", "er", "rong", "xian", "ju", "mu", "hao",
+       "qiu", "dou|nuo", "mushiruPPPV", "tan", "pei", "ju", "duo", "cui", "bi", "san",
+       "san", "mao", "sai|sui", "shu", "shu", "tuo", "he", "jian", "ta", "san",
+       "lv", "mu", "mao", "tong", "rong", "chang", "pu", "lu", "zhan", "sao",
+       "zhan", "meng", "lu", "qu", "die", "shi|zhi", "di", "min", "jue", "meng|mang",
+       "qi", "pie", "nai", "qi", "dao", "xian", "chuan", "fen", "yang|ri", "nei",
+       "nei", "fu", "shen", "dong", "qing", "qi", "yin", "xi", "hai", "yang",
+       "an", "ya", "ke", "qing", "ya", "dong", "dan", "lv", "qing", "yang",
+       "yun", "yun", "shui", "shui", "zheng|cheng", "bing", "yong", "dang", "shui", "le",
+       "ni", "tun", "fan", "gui|jiu", "ting", "zhi", "qiu", "bin|pa", "ze", "mian",
+       "cuan", "hui", "diao", "han", "cha", "zhuo|que", "chuan", "wan", "fan", "da",
+       "xi", "tuo", "mang", "qiu", "qi", "shan", "pin", "han", "qian", "wu",
+       "wu", "xun", "si", "ru", "gong", "jiang", "chi", "wu", "tu", "jiu",
+       "tang|shang", "zhi|ji", "zhi", "qian", "mi", "gu|yu", "wang", "jing", "jing", "rui",
+       "jun", "hong", "tai", "tai", "ji", "bian", "bian", "gan|han|cen", "wen|men", "zhong",
+       "fang|pang", "xiong", "jue", "hu|huang", "niu|you", "qi", "fen", "xu", "xu", "qin",
+       "yi", "wo", "yun", "yuan", "hang", "yan", "shen|chen", "chen", "dan", "you",
+       "dun", "hu", "huo", "qi", "mu", "nv|niu", "mei|mo", "ta|da", "mian", "mi|wu",
+       "chong", "hong|pang", "bi", "sha", "zhi", "pei", "pan", "zhui|zi", "za", "gou",
+       "pai", "mei|mo", "ze", "feng", "ou", "li", "lun", "cang", "feng", "wei",
+       "hu", "mo", "mei", "shu", "ju", "za", "tuo|duo", "tuo", "tuo|duo", "he",
+       "li", "mi|li", "yi|chi", "fa", "fei", "you", "tian", "zhi", "zhao", "gu",
+       "zhan", "yan", "si", "kuang", "jiong", "ju", "xie|yi", "qiu", "yi|die", "jia",
+       "zhong", "quan", "bo|po", "hui", "mi|bi", "ben", "ze", "chu|she", "le", "you|ao",
+       "gu", "hong", "gan", "fa", "mao", "si", "hu", "peng|ping", "ci", "fan",
+       "zhi", "su", "ning", "cheng", "ling", "pao", "bo", "qi", "si", "ni",
+       "ju", "yue|sa", "zhu", "sheng", "lei", "xuan", "jue|xue", "fu", "pan", "min",
+       "tai", "yang", "ji", "yong", "guan", "beng", "xue", "long|shuang", "lu", "dan",
+       "luo|po", "xie", "po", "ze|shi", "jing", "yin", "pan", "jie", "yie", "hui",
+       "hui", "zai", "cheng", "yin", "wei", "hou", "jian", "yang", "lie", "si",
+       "ji", "er", "xing", "fu", "sa|xi", "se|qi|zi", "zhi", "yin", "wu", "xi|xian",
+       "kao", "zhu", "jiang", "luo", "luo", "an|yan|e", "dong", "ti", "si", "lei",
+       "yi", "mi", "quan", "jin", "po", "wei", "xiao", "xie", "hong", "xu",
+       "su|shuo", "kuang", "tao", "qie|jie", "ju", "er", "zhou", "ru", "ping", "xun",
+       "xiong", "zhi", "guang", "huan", "ming", "huo", "wa", "qia", "pai", "wu",
+       "qu", "liu", "yi", "jia", "jing", "qian|jian", "jiang", "jiao", "zhen", "shi",
+       "zhuo", "ce", "fa", "kuai|hui", "ji", "liu", "chan", "hun", "hu|xu", "nong",
+       "xun", "jin", "lie", "qiu", "wei", "zhe", "jun|xun", "han", "bang", "mang",
+       "zhuo", "you|di", "xi", "bo", "dou", "huan", "hong", "yi", "pu", "ying|cheng",
+       "lan", "hao", "lang", "han", "li", "geng", "fu", "wu", "li", "chun",
+       "feng|hong", "yi", "yu", "tong", "lao", "hai", "jin", "jia", "chong", "jiong",
+       "mei", "sui|nei", "cheng", "pei", "xian", "shen", "tu", "kun", "ping", "nie",
+       "han", "jing", "xiao", "she", "nian", "tu", "yong|chong", "xiao", "xian", "ting",
+       "e", "su", "tun|yun", "juan", "cen", "ti", "li", "shui", "si", "lei",
+       "shui", "tao", "du", "lao", "lai", "lian", "wei", "wo|guo", "yun", "huan",
+       "di", "heng", "run", "jian", "zhang", "se", "fu", "guan", "xing", "shou|tao",
+       "shuan", "ya", "chuo", "zhang", "ye", "kong|nang", "wan|wo|yuan", "han", "tuo", "dong",
+       "he", "wo", "ju", "she", "liang", "hun", "ta", "zhuo", "dian", "qie|ji",
+       "de", "juan", "zi", "xi", "xiao", "qi", "gu", "guo|guan", "yan", "lin",
+       "tang|chang", "zhou", "peng", "hao", "chang", "shu", "qi", "fang", "zhi", "lu",
+       "nao|chuo|zhuo", "ju", "tao", "cong", "lei", "zhe", "ping|peng", "fei", "song", "tian",
+       "pi|pei", "dan", "yu|xu", "ni", "yu", "lu", "gan", "mi", "jing|cheng", "ling",
+       "lun", "yin", "cui", "qu", "huai", "yu", "nian|shen", "shen", "biao|hu", "chun|zhun",
+       "hu", "yuan", "lai", "hun", "qing", "yan", "qian", "tian", "miao", "zhi",
+       "yin", "bo", "ben", "yuan", "wen|min", "ruo|re|luo", "fei", "qing", "yuan", "ke",
+       "ji", "she", "yuan", "se", "lu", "zi", "du|dou", "yi", "jian", "mian|sheng",
+       "pai", "xi", "yu", "yuan", "shen", "shen", "rou", "huan", "zhu", "jian",
+       "nuan", "yu", "qiu|wu", "ting", "qu|ju", "du", "feng", "zha", "bo", "wo",
+       "wo|guo", "ti|di", "wei", "wen", "ru", "xie", "ce", "wei", "he", "gang|jiang",
+       "yan", "hong", "xuan", "mi", "ke", "mao", "ying", "yan", "you", "hong|qing",
+       "miao", "sheng", "mei", "zai", "hun", "nai", "gui", "chi", "e", "pai",
+       "mei", "lian", "qi", "qi", "mei", "tian", "cou", "wei", "can", "tuan",
+       "mian", "hui|min|xu", "po", "xu", "ji", "pen", "jian", "jian", "hu", "feng",
+       "xiang", "yi", "yin", "zhan", "shi", "jie", "zhen", "huang", "tan", "yu",
+       "bi", "min|hun", "shi", "tu", "sheng", "yong", "ju", "dong", "tuan|nuan", "qiu|jiao",
+       "qiu|jiao", "qiu", "yan|yin", "tang|shang", "long", "huo", "yuan", "nan", "ban|pan", "you",
+       "quan", "zhuang|hun", "liang", "chan", "xian", "chun", "nie", "zi", "wan", "shi",
+       "man", "ying", "la", "kui|hui", "feng|hong", "jian", "xu", "lou", "wei", "gai",
+       "bo", "ying", "po", "jin", "yan|gui", "tang", "yuan", "suo", "yuan", "lian|nian|xian",
+       "yao", "meng", "zhun", "cheng", "ke", "tai", "da|ta", "wa", "liu", "gou",
+       "sao", "ming", "zha", "shi", "yi", "lun", "ma", "pu", "wei", "li",
+       "zai", "wu", "xi", "wen", "qiang", "ze", "shi", "su", "ai", "zhen|qin",
+       "sou", "yun", "xiu", "yin", "rong", "hun", "su", "suo", "ni|niao", "ta",
+       "shi", "ru", "ai", "pan", "chu|xu", "chu", "pang", "weng", "cang", "mie",
+       "ge", "dian", "hao|xue", "huang", "qi|xi|xie", "zi", "di", "zhi", "xing|ying", "fu",
+       "jie", "hua", "ge", "zi", "tao", "teng", "sui", "bi", "jiao", "hui",
+       "gun", "yin", "ze|hao", "long", "zhi", "yan", "she", "man", "ying", "chun",
+       "lv", "lan", "luan", "yao", "bin", "tan", "yu", "xiu", "hu", "bi",
+       "biao", "zhi", "jiang", "kou", "shen", "shang", "di", "mi", "ao", "lu",
+       "hu|xu", "hu", "you", "chan", "fan", "yong", "gun", "man", "qing", "yu",
+       "piao", "ji", "ya", "chao", "qi", "xi", "ji", "lu", "lou", "long",
+       "jin", "guo", "cong|song", "lou", "zhi", "gai", "qiang", "li", "yan", "cao",
+       "jiao", "cong", "chun", "tuan|zhuan", "ou", "teng", "ye", "xi", "mi", "tang",
+       "mo", "shang", "han", "lian", "lan", "wa", "chi", "gan", "feng|peng", "xuan",
+       "yi", "man", "zi", "mang", "kang", "luo|ta", "ben|peng", "shu", "zhang", "zhang",
+       "chong|zhuang", "xu", "huan", "huo|kuo", "jian", "yan", "shuang", "liao|liu", "cui", "ti",
+       "yang", "jiang", "cong|zong", "ying", "hong", "xiu", "shu", "guan", "ying", "xiao",
+       "cong|zong", "kun", "xu", "lian", "zhi", "wei", "pi|pie", "yu", "jiao|qiao", "po",
+       "dang|xiang", "hui", "jie", "wu", "pa", "ji", "pan", "wei", "su", "qian",
+       "qian", "xi|ya", "lu", "xi", "xun", "dun", "huang|guang", "min", "run", "su",
+       "lao|liao", "zhen", "cong|zong", "yi", "zhi", "wan", "tan|shan", "tan", "chao", "xun",
+       "kui|hui", "ye", "shao", "tu|zha", "zhu", "san|sa", "hei", "bi", "shan", "chan",
+       "chan", "shu", "tong", "pu", "lin", "wei", "se", "se", "cheng", "jiong",
+       "cheng|deng", "hua", "jiao", "lao", "che", "gan", "cun", "jing", "si", "shu|zhu",
+       "peng", "han", "yun", "liu", "hong|gong", "fu", "hao", "he", "xian", "jian",
+       "shan", "xi", "ao", "lu", "lan", "ning", "yu", "lin", "mian|sheng", "zao",
+       "dang", "huan", "ze|shi", "xie", "yu", "li", "shi", "xue", "ling", "wan|man",
+       "zi", "yong", "kuai|hui", "can", "lian", "dian", "ye", "ao", "huan", "zhen",
+       "chan", "man", "gan", "dan|tan", "yi", "sui", "pi", "ju", "ta", "qin",
+       "ji", "zhuo", "lian", "nong", "guo|wo", "jin", "fen|pen", "se", "ji|sha", "sui",
+       "hui|huo", "chu", "ta", "song", "ding|ting", "se", "zhu", "lai", "bin", "lian",
+       "mi|ni", "shi", "shu", "mi", "ning", "ying", "ying", "meng", "jin", "qi",
+       "bi|pi", "ji", "hao", "ru", "cui|zui", "wo", "tao", "yin", "yin", "dui",
+       "ci", "huo|hu", "qing", "lan", "jun|xun", "ai|kai|ke", "pu", "zhuo|zhao", "wei", "bin",
+       "gu", "qian", "ying", "bin", "kuo", "fei", "cang", "me", "jian", "wei|dui",
+       "luo|po", "zan|cuan", "lv", "li", "you", "yang", "lu", "si", "zhi", "ying",
+       "du|dou", "wang", "hui", "xie", "pan", "shen", "biao", "chan", "mie|mo", "liu",
+       "jian", "pu|bao", "se", "cheng|deng", "gu", "bin", "huo", "xian", "lu", "qin",
+       "han", "ying", "rong", "li", "jing", "xiao", "ying", "sui", "wei|dui", "xie",
+       "huai|wai", "xue", "zhu", "long|shuang", "lai", "dui", "fan", "hu", "lai", "shu",
+       "lian", "ying", "mi", "ji", "lian", "jian|zun", "ying", "fen", "lin", "yi",
+       "jian", "yue", "chan", "dai", "rang|nang", "jian", "lan", "fan", "shuang", "yuan",
+       "zhuo|jiao|ze", "feng", "she", "lei", "lan", "cong", "qu", "yong", "qian", "fa",
+       "guan", "jue", "yan", "hao", "ying", "sa", "zan|cuan", "luan", "yan", "li",
+       "mi", "shan", "tan", "dang|tang", "jiao", "chan", "ying", "hao", "ba", "zhu",
+       "lan", "lan", "nang", "wan", "luan", "xun|quan", "xian", "yan", "gan", "yan",
+       "yu", "huo", "huo|biao", "mie", "guang", "deng", "hui", "xiao", "xiao", "hui",
+       "hong", "ling", "zao", "zhuan", "jiu", "zha|yu", "xie", "chi", "zhuo", "zai",
+       "zai", "can", "yang", "qi", "zhong", "fen|ben", "niu", "jiong|gui", "wen", "pu",
+       "yi", "lu", "chui", "pi", "kai", "pan", "yan", "yan", "pang|feng", "mu",
+       "chao", "liao", "que", "kang", "dun", "guang", "xin", "zhi", "guang", "guang",
+       "wei", "qiang", "bian", "da", "xia", "zheng", "zhu", "ke", "zhao", "fu",
+       "ba", "xie", "xie", "ling", "zhuo|chu", "xuan", "ju", "tan", "pao|bao", "jiong",
+       "pao|fou", "tai", "tai", "bing", "yang", "tong", "shan|qian", "zhu", "zha", "dian",
+       "wei", "shi", "lian", "chi", "huang", "zhou", "hu", "shuo", "lan", "ting",
+       "jiao|yao", "xu", "heng", "quan", "lie", "huan", "yang", "xiao", "xiu", "xian",
+       "yin", "wu", "zhou", "yao", "shi", "wei", "tong|dong", "mie", "zai", "kai",
+       "hong", "lao|luo", "xia", "zhu", "xuan", "zheng", "po", "yan", "hui", "guang",
+       "che", "hui", "kao", "chen", "fan", "shao", "ye", "hui", "uu", "tang",
+       "jin", "re", "lie", "xi", "fu|pao", "jiong", "xie|che", "pu", "ting", "zhuo",
+       "ting", "wan", "hai", "peng", "lang", "yan", "xu", "feng", "chi", "rong",
+       "hu", "xi", "shu", "he", "xun|hun", "ku", "juan|ye", "xiao", "xi", "yan",
+       "han", "zhuang", "qu|jun", "di", "xie|che", "ji|qi", "wu", "yan", "lv", "han",
+       "yan", "huan", "men", "ju", "dao", "bei", "fen", "lin", "kun", "hun",
+       "tun", "xi", "cui", "wu", "hong", "chao|ju", "fu", "wo|ai", "jiao", "zong|cong",
+       "feng", "ping", "qiong", "ruo", "xi|yi", "qiong", "xin", "zhuo|chao", "yan", "yan",
+       "yi", "jue", "yu", "gang", "ran", "pi", "xiong|ying", "gang", "sheng", "chang",
+       "shao", "xiong|ying", "nem", "geng", "qu", "chen", "he", "kui", "zhong", "duan",
+       "xia", "hui|yun|xun", "feng", "lian", "xuan", "xing", "huang", "jiao", "jian", "bi",
+       "ying", "zhu", "wei", "tuan", "shan|qian", "xi|yi", "nuan", "nuan", "chan", "yan",
+       "jiong", "jiong", "yu", "mei", "sha", "wei", "ye|zha", "jin", "qiong", "rou",
+       "mei", "huan", "xu", "zhao", "wei", "fan", "qiu", "sui", "yang", "lie",
+       "zhu", "jie", "zao", "gua", "bao", "hu", "yun", "nan", "shi", "huo",
+       "bian", "gou", "tui", "tang", "chao", "shan", "en|yun", "bo", "huang", "xie",
+       "xi", "wu", "xi", "yun", "he", "he|xiao", "xi", "yun", "xiong", "xiong",
+       "shan", "qiong", "yao", "xun", "mi", "lian", "ying", "wu", "rong", "gong",
+       "yan", "qiang", "liu", "xi", "bi", "biao", "cong|zong", "lu|ao", "jian", "shu",
+       "yi", "lou", "peng|feng", "sui|cui", "yi", "teng", "jue", "zong", "yun|yu", "hu",
+       "yi", "zhi", "ao", "wei", "liu", "han|ran", "ou", "re", "jiong", "man",
+       "kun", "shang", "cuan", "zeng", "jian", "xi", "xi", "xi", "yi", "xiao",
+       "chi", "huang", "chan|dan", "ye", "tan", "ran", "yan", "xun", "qiao", "jun",
+       "deng", "dun", "shen", "jiao|qiao|jue|zhuo", "fen", "si", "liao", "yu", "lin", "tong|dong",
+       "shao", "fen", "fan", "yan", "xun", "lan", "mei", "tang", "yi", "jiong",
+       "men", "zhu", "jiao", "ying", "yu", "yi", "xue", "lan", "tai|lie", "zao",
+       "can", "sui", "xi", "que", "zong", "lian", "hui", "zhu", "xie", "ling",
+       "wei", "yi", "xie", "zhao", "hui", "da", "nong", "lan", "xu", "xian",
+       "he", "xun", "jin", "chou", "tao", "yao", "he", "lan", "biao", "rong|ying",
+       "li|lie", "mo", "bao", "ruo", "lv", "la|lie", "ao", "xun", "kuang|huang", "shuo",
+       "liao", "li", "lu", "jue", "liao", "yan|xun", "xi", "xie", "long", "ye",
+       "can", "rang", "yue", "lan", "cong", "jue", "chong", "guan", "qu", "che",
+       "mi", "tang", "lan", "zhu", "lan", "ling", "cuan", "yu", "zhao|zhua", "zhao|zhua",
+       "pa", "zheng", "pao", "cheng|chen", "yuan", "ai", "wei", "han", "jue", "jue",
+       "fu", "ye", "ba", "die", "ye", "yao", "zu", "shuang", "er", "pan",
+       "chuang", "ke", "zang", "die", "qiang", "yong", "qiang", "pian", "ban", "pan",
+       "chao", "jian", "pai", "du", "chuang", "yu", "zha", "bian|mian", "die", "bang",
+       "bo", "chuang", "you", "you|yong", "du", "ya", "cheng", "niu", "niu", "pin",
+       "jiu|le", "mou|mu", "ta", "mu", "lao", "ren", "mang", "fang", "mao", "mu",
+       "gang", "wu", "yan", "ge|qiu", "bei", "si", "jian", "gu", "you|chou", "ke",
+       "sheng", "mu", "di", "qian", "quan", "quan", "zi", "te", "xi", "mang",
+       "keng", "qian", "wu", "gu", "xi", "li", "li", "pou", "ji", "gang",
+       "zhi|te", "ben", "quan", "chun", "du", "ju", "jia", "jian|qian", "feng", "pian",
+       "ke", "ju", "kao", "chu", "xi", "bei", "luo", "jie", "ma", "san",
+       "wei", "mao|li", "dun", "tong", "qiao", "jiang", "xi", "li", "du", "lie",
+       "bai", "piao", "bao", "xi", "chou", "wei", "kui", "chou", "quan", "quan",
+       "quan|ba", "fan", "qiu", "ji", "chai", "zhuo|bao", "han|an", "ge", "zhuang", "guang",
+       "ma", "you", "kang|gang", "pei|fei", "hou", "ya", "yin", "huan|fan", "zhuang", "yun",
+       "kuang", "niu", "di", "kuang", "zhong", "mu", "bei", "pi", "ju", "yi|quan|chi",
+       "sheng|xing", "pao", "xia", "tuo|yi", "hu", "ling", "fei", "pi", "ni", "yao",
+       "you", "gou", "xue", "ju", "dan", "bo", "ku", "xian", "ning", "huan",
+       "hen", "jiao", "he", "zhao", "jie", "xun", "shan", "ta|shi", "rong", "shou",
+       "tong|dong", "lao", "du", "xia", "shi", "kuai", "zheng", "yu", "sun", "yu",
+       "bi", "mang|dou", "xi|shi", "juan", "li", "xia", "yin", "suan", "lang", "bei",
+       "zhi", "yan", "sha", "li", "han", "xian", "jing", "pai", "fei", "xiao",
+       "bai|pi", "qi", "ni", "biao", "yin", "lai", "lie", "jian|yan", "qiang", "kun",
+       "yan", "guo", "zong", "mi", "chang", "yi", "zhi", "zheng", "ya|wei", "meng",
+       "cai", "cu", "she", "lie", "ceon", "luo", "hu", "zong", "gui", "wei",
+       "feng", "wo", "yuan", "xing", "zhu", "mao", "wei", "chuan", "xian", "tuan",
+       "ya|jia|qie", "nao", "xie|he|ge|hai", "jia", "hou", "bian|pian", "you", "you", "mei", "cha",
+       "yao", "sun", "bo|po", "ming", "hua", "yuan", "sou", "ma", "huan", "dai",
+       "yu", "shi", "hao", "qiang", "yi", "zhen", "cang", "hao|gao", "man", "jing",
+       "jiang", "mo", "zhang", "chan", "ao", "ao", "hao", "suo", "fen", "jue",
+       "bi", "bi", "huang", "pu", "lin", "xu", "tong", "yao|xiao", "lao", "shuo|xi",
+       "xiao", "shou", "dun", "jiao", "ge|lie|xie", "juan", "du", "hui", "kuai", "xian",
+       "xie", "ta", "xian", "xun", "ning", "bian|pian", "huo", "nou|ru", "meng", "lie",
+       "nao|you", "guang", "shou", "lu", "ta", "xian", "mi", "rang", "huan", "nao|you",
+       "luo", "xian", "qi", "jue", "xuan", "miao", "zi", "shuai|lv", "lu", "yu",
+       "su", "wang", "qiu", "ga", "ding", "le", "ba", "ji", "hong", "di",
+       "chuan", "gan", "jiu", "yu", "qi", "yu", "chang|yang", "ma", "hong", "wu",
+       "fu", "min|wen", "jie", "ya", "bin|fen", "bian", "bang", "yue", "jue", "men|yun",
+       "jue", "wan", "jian|qian", "mei", "dan", "pin", "wei", "huan", "xian", "qiang|cang",
+       "ling", "dai", "yi", "an|gan", "ping", "dian", "fu", "xuan|xian", "xi", "bo",
+       "ci", "gou", "jia", "shao", "po", "ci", "ke", "ran", "sheng", "shen",
+       "yi|tai", "zu|ju", "jia", "min", "shan", "liu", "bi", "zhen", "zhen", "jue",
+       "fa", "long", "jin", "jiao", "jian", "li", "guang", "xian", "zhou", "gong",
+       "yan", "xiu", "yang", "xu", "luo", "su", "zhu", "qin", "yin|ken", "xun",
+       "bao", "er", "xiang", "yao", "xia", "hang", "gui", "chong", "xu", "ban",
+       "pei", "lao", "dang", "ying", "hun|hui", "wen", "e", "cheng", "di|ti", "wu",
+       "wu", "cheng", "jun", "mei", "bei", "ting", "xian", "chu", "han", "xuan|qiong",
+       "yan", "qiu", "xuan", "lang", "li", "xiu", "fu", "liu", "ya", "xi",
+       "ling", "li", "jin", "lian", "suo", "suo", "feng", "wan", "dian", "pin|bing",
+       "zhan", "cui|se", "min", "yu", "ju", "chen", "lai", "min", "sheng", "wei|yu",
+       "tian", "shu", "zhuo|zuo", "beng|pei", "cheng", "hu", "qi", "e", "kun", "chang",
+       "qi", "beng", "wan", "lu", "cong", "guan", "yan", "diao", "bei", "lin",
+       "qin", "pi", "pa", "que", "zhuo", "qin", "fa", "jin", "qiong", "du",
+       "jie", "hun|hui", "yu", "mao", "mei", "chun", "xuan", "ti", "xing", "dai",
+       "rou", "min", "jian", "wei", "ruan", "huan", "xie|jie", "chuan", "jian", "zhuan",
+       "chang|yang", "lian", "quan", "xia", "duan", "yuan", "ye", "nao", "hu", "ying",
+       "yu", "huang", "rui", "se", "liu", "shi", "rong", "suo", "yao", "wen",
+       "wu", "zhen", "jin", "ying", "ma", "tao", "liu", "tang", "li", "lang",
+       "gui", "tian|zhen", "qiang|cang", "cuo", "jue", "zhao", "yao", "ai", "bin|pian", "tu|shu",
+       "chang", "kun", "zhuan", "cong", "jin", "yi", "cui", "cong", "qi", "li",
+       "jing", "zao|suo", "qiu", "xuan", "ao", "lian", "men", "zhang", "yin", "ye",
+       "ying", "zhi", "lu", "wu", "deng", "xiu", "zeng", "xun", "qu", "dang",
+       "lin", "liao", "qiong|jue", "su", "huang", "gui", "pu", "jing", "fan", "jin",
+       "liu", "ji", "hui", "jing", "ai", "bi", "can", "qu", "zao", "dang",
+       "jiao", "guan", "tan", "hui|kuai", "huan", "se", "sui", "tian", "chu", "yu",
+       "jin", "lu|fu", "bin|pian", "shu", "wen", "zui", "lan", "xi", "ji|zi", "xuan",
+       "ruan", "wo", "gai", "lei", "du", "li", "zhi", "rou", "li", "zan",
+       "qiong", "ti", "gui", "sui", "la", "long", "lu", "li", "zan", "lan",
+       "ying", "mi|xi", "xiang", "qiong|wei", "guan", "dao", "zan", "huan|ye|ya", "gua", "bo",
+       "die", "bo|pao", "hu", "zhi|hu", "piao", "ban", "rang", "li", "wa", "shiwa",
+       "xiang|hong", "qianwa", "ban", "pen", "fang", "dan", "weng", "ou", "fenwa", "maowa",
+       "ki ro ton|mao wa", "hu", "ling", "yi", "ping", "ci", "bai", "juan", "chang", "chi",
+       "liwa", "dang", "wa", "bu", "zhui", "ping", "bian", "zhou", "zhen", "liwa",
+       "ci", "ying", "qi", "xian", "lou", "di", "ou", "meng", "zhuan", "beng",
+       "lin", "zeng", "wu", "pi", "dan", "weng", "ying", "yan", "gan", "dai",
+       "shen", "tian", "tian", "han", "chang", "sheng", "qing", "shen", "chan", "chan",
+       "rui", "sheng", "su", "shen", "yong", "shuai", "lu", "fu", "yong", "beng",
+       "beng", "ning", "tian", "you", "jia", "shen", "you", "dian", "fu", "nan",
+       "dian|tian|sheng", "ping", "ting|ding", "hua", "ting|ding", "zhen", "zai|zi", "meng", "bi", "bi|qi",
+       "mu", "xun", "liu", "chang", "mu", "yun", "fan", "fu", "geng", "tian",
+       "jie", "jie", "quan", "wei", "fu|bi", "tian", "mu", "tap", "pan", "jiang",
+       "wa", "da|fu", "nan", "liu", "ben", "zhen", "xu|chu", "mu", "mu", "ce|ji",
+       "zai|zi", "gai", "bi", "da", "zhi|chou|shi", "lve", "qi", "lve", "fan|pan", "yi",
+       "fan|pan", "hua", "she|yu", "she", "mu", "jun", "yi", "liu", "she", "die",
+       "chou", "hua", "dang", "zhui", "ji", "wan", "jiang", "cheng", "chang", "tuan",
+       "lei", "ji", "cha", "liu", "die", "tuan", "lin", "jiang", "jiang|qiang", "chou",
+       "pi", "die", "die", "pi|ya|shu", "jie|qie", "dan", "shu", "shu", "zhi|di", "yi|ni",
+       "ne", "nai", "ding", "bi", "jie", "liao", "gang", "ge|yi", "jiu", "zhou",
+       "xia", "shan", "xu", "n<e|yao", "li|lai", "yang", "chen", "you", "ba", "jie",
+       "jue|xue", "qi", "ya|xia", "cui", "bi", "yi", "li", "zong", "chuang", "feng",
+       "zhu", "pao", "pi", "gan", "ke", "ci", "xue", "zhi", "da", "zhen",
+       "fa|bian", "zhi", "teng", "ju", "ji", "fei", "gou", "shan|dian", "jia", "xuan",
+       "zha", "bing", "nie", "zheng", "yong", "jing", "quan", "teng|chong", "tong", "yi",
+       "jie", "wei|you|yu", "hui", "tan|shi", "yang", "zhi", "zhi", "hen", "ya", "mei",
+       "dou", "jing", "xiao", "tong", "tu", "mang", "pi", "xiao", "suan", "pu",
+       "li", "zhi", "cuo", "duo", "wu", "sha", "lao", "shou", "huan", "xian",
+       "yi", "beng|peng", "zhang", "guan", "tan", "fei", "ma", "ma|lin", "chi", "ji",
+       "tian|dian", "an|ye|e", "chi", "bi", "bi", "min", "gu", "dui", "ke|e", "wei",
+       "yu", "cui", "ya", "zhu", "cu", "dan", "shen", "zhong", "zhi|chi", "yu",
+       "hou", "feng", "la", "yang", "chen", "tu", "yu", "guo", "wen", "huan",
+       "ku", "jia|xia", "yin", "yi", "lou", "sao", "jue", "chi", "xi", "guan",
+       "yi", "wen", "ji", "chuang", "ban", "hui|lei", "liu", "chai|cuo", "shou", "n<e|yao",
+       "dian|chen", "da|dB", "bie", "tan", "zhang", "biao", "shen", "cu", "luo", "yi",
+       "zong", "chou", "zhang", "zhai", "sou", "se", "que", "diao", "lou", "lou",
+       "mo", "qin", "yin", "ying", "huang", "fu", "liao", "long", "qiao|jiao", "liu",
+       "lao", "xian", "fei", "dan", "yin", "he", "ai", "ban", "xian", "guan",
+       "gui|wei", "nong", "yu", "wei", "yi", "yong", "pi", "lei", "li|lai", "shu",
+       "dan", "lin", "dian", "lin", "la", "bie", "ji", "chi", "yang", "xuan",
+       "jie", "zheng", "mo", "li", "huo", "la", "ji", "dian", "xuan", "ying",
+       "yin", "qu", "yong", "tan", "dian", "luo", "luan", "luan", "bo", "uu",
+       "gui", "ba", "fa", "deng", "fa", "bai", "bai", "qie", "ji|bi", "zao",
+       "zao", "mao", "di|de", "pa|ba", "jie", "huang", "gui", "ci", "ling", "gao|yao",
+       "mo", "ji", "jiao", "peng", "gao|yao", "ai", "e", "hao", "han", "bi",
+       "wan", "chou", "qian", "xi", "ai", "xiao", "hao", "huang", "hao", "ze",
+       "cui", "hao", "xiao", "ye", "po", "hao", "jiao", "ai", "xing", "huang",
+       "li|luo|bo", "piao", "he", "jiao", "pi", "gan", "pao", "zhou", "jun", "qiu",
+       "cun", "que", "zha", "gu", "jun", "jun", "zhou", "zha|cu", "gu", "zhao|zhan|dan",
+       "du", "min", "qi", "ying", "yu", "bei", "diao", "zhong", "pen", "he",
+       "ying", "he", "yi", "bo", "wan", "he", "ang", "zhan", "yan", "jian",
+       "he", "yu", "kui", "fan", "gai|ge|he", "dao", "pan", "fu", "qiu", "sheng|cheng",
+       "dao", "lu", "zhan", "meng", "li", "jin", "xu", "jian", "pan", "guan",
+       "an", "lu", "xu", "zhou|chou", "dang", "an", "gu", "li", "mu", "ding",
+       "gan", "xu", "mang", "mang|wang", "zhi", "qi", "yuan", "xian|tian", "xiang", "dun",
+       "xin", "xi|pan", "pan", "feng", "dun", "min", "ming", "sheng|xing", "shi", "yun|hun",
+       "mian", "pan", "fang", "miao", "dan", "mei", "mao", "kan", "xian", "kou",
+       "shi", "yang|ying", "zheng", "yao|ao", "shen", "huo", "da", "zhen", "kuang", "ju|xu|kou",
+       "shen", "yi|chi", "sheng", "mei", "mo|mie", "zhu", "zhen", "zhen", "mian", "shi",
+       "yuan", "die|ti", "ni", "zi", "zi", "chao", "zha", "xuan", "bing|fang", "pang|pan",
+       "long", "gui|sui", "tong", "mi", "die|zhi", "di", "ne", "ming", "xuan|shun|xun", "chi",
+       "kuang", "juan", "mou", "zhen", "tiao", "yang", "yan", "mo", "zhong", "mo",
+       "zhuo|zhao|zhe", "zheng", "mei", "suo", "qiao|shao|xiao", "han", "huan", "di", "cheng", "cuo|zhuai",
+       "juan", "e", "mian", "xian", "xi", "kun", "lai", "jian", "shan", "tian",
+       "gun", "wan", "leng", "shi", "qiong", "li", "ya", "jing", "zheng", "li",
+       "lai", "sui|zui", "juan", "shui", "sui", "du", "bi", "bi", "mu", "hun",
+       "ni", "lu", "yi|ze|gao", "jie", "cai", "zhou", "yu", "hun", "ma", "xia",
+       "xing", "hui", "hun", "zai", "chun", "jian", "mei", "du", "hou", "xuan",
+       "ti", "kui", "gao", "rui", "mao", "xu", "fa", "wo", "miao", "chou",
+       "gui|wei|kui", "mi", "weng", "kou|ji", "dang", "chen", "ke", "sou", "xia", "qiong|huan",
+       "mo", "ming", "man|men", "fen", "ze", "zhang", "yi", "diao|dou", "kou", "mo",
+       "shun", "cong", "lou|lv", "chi", "man|men", "piao", "cheng", "gui", "meng", "wan",
+       "run|shun", "pie", "xi", "qiao", "pu", "zhu", "deng", "shen", "shun", "liao",
+       "che", "xian|jian", "kan", "ye", "xue", "tong", "wu|mi", "lin", "gui|kui", "jian",
+       "ye", "ai", "hui", "zhan", "jian", "gu", "zhao", "qu|ju", "wei", "chou",
+       "sao", "ning|cheng", "xun", "yao", "huo|yue", "meng", "mian", "pin", "mian", "lei",
+       "kuang|guo", "jue", "xuan", "mian", "huo", "lu", "meng", "long", "guan|quan", "man",
+       "xi", "chu", "tang", "kan", "zhu", "mao", "jin|qin|guan", "jin|qin|guan", "yu|xu|jue", "shuo",
+       "ze", "jue", "shi", "yi", "shen", "zhi", "hou", "shen", "ying", "ju",
+       "zhou", "jiao", "cuo", "duan", "ai", "jiao", "zeng", "yue", "ba", "shi|dan",
+       "ding", "qi", "ji", "zi", "gan", "wu", "zhe", "ku", "gang|qiang|kong", "xi",
+       "fan", "kuang", "dang", "ma", "sha", "dan", "jue", "li", "fu", "min",
+       "e", "xu|hua", "kang", "zhi", "qi|qie", "kan", "jie", "pin|bin|fen", "e", "ya",
+       "pi", "zhe", "yan", "sui", "zhuan", "che", "dun", "wa", "yan", "jin",
+       "feng", "fa", "mo", "zha", "ju", "yu", "ke|luo", "tuo", "tuo", "di",
+       "zhai", "zhen", "e", "fu|fei", "mu", "zhu", "li|la", "bian", "nu", "ping",
+       "peng", "ling", "pao", "le", "po", "bo", "po", "shen", "za", "ai",
+       "li", "long", "tong", "yong", "li", "kuang", "chu", "keng", "quan", "zhu",
+       "kuang|guang", "gui", "e", "nao", "qia", "lu", "wei|gui", "ai", "luo|ge", "ken|xian|gun|yin",
+       "xing", "yan", "dong", "peng|ping", "xi", "lao", "hong", "shuo|shi", "xia", "qiao",
+       "qing", "wei|ai|gai", "qiao", "ce", "keng", "xiao", "que|ke|ku", "chan", "lang", "hong",
+       "yu", "xiao", "xia", "mang|bang", "luo|long", "yong|tong", "che", "che", "wo", "liu",
+       "ying", "mang", "que", "yan", "sha", "kun", "yu", "ze", "hua", "lu",
+       "chen", "jian", "nve", "song", "zhuo", "keng", "peng", "yan", "zhui|chui|duo", "kong",
+       "cheng", "qi", "zong|cong", "qing", "lin", "jun", "bo", "ding", "min", "diao",
+       "jian|zhan", "he", "lu|liu", "ai", "sui", "que|xi", "leng", "bei", "yin", "dui",
+       "wu", "qi", "lun", "wan", "dian", "nao|gang", "bei", "qi", "chen", "ruan",
+       "yan", "die", "ding", "zhou", "tuo", "jie|ya", "ying", "bian", "ke", "bi",
+       "wei", "shuo|shi", "zhen", "duan", "xia", "dang", "ti|di", "nao", "peng", "jian",
+       "di", "tan", "cha", "tian", "qi", "dun", "feng", "xuan", "que", "que|qiao",
+       "ma", "gong", "nian", "su|xie", "e", "ci", "liu", "si|ti", "tang", "bang|pang",
+       "hua|ke|gu", "pi", "kui|wei", "sang", "lei", "cuo", "tian", "xia|qia|ya", "xi", "lian|qian",
+       "pan", "wei|ai|gai", "yun", "dui", "zhe", "ke", "la", "zhuan", "yao", "gun",
+       "zhuan", "chan", "qi", "ao|qiao", "peng", "liu", "lu", "kan", "chuang", "chen",
+       "yin", "lei", "biao", "qi", "mo", "qi|zhu", "cui", "zong", "qing", "chuo",
+       "lun", "ji", "shan", "lao|luo", "qu", "zeng", "deng", "jian", "xi", "lin",
+       "ding", "dian", "huang", "pan|bo", "ji|she", "qiao", "di", "li", "jian", "jiao",
+       "xi", "zhang", "qiao", "dun", "jian", "yu", "zhui", "he|qiao", "ke|huo", "ze",
+       "lei", "jie", "chu", "ye", "que|hu", "dang", "yi", "jiang", "pi", "pi",
+       "yu", "pin", "e|qi", "ai", "ke", "jian", "yu", "ruan", "meng", "pao",
+       "ci", "bo", "yang", "mie", "ca", "xian|xin", "kuang", "lei", "lei", "zhi",
+       "li", "li", "fan", "que", "pao", "ying", "li", "long", "long", "mo",
+       "bo", "shuang", "guan", "jian", "ca", "yan", "shi", "shi", "li", "reng",
+       "she", "yue", "si", "qi", "ta", "ma", "xie", "yao", "xian", "zhi|qi",
+       "qi", "zhi", "beng|fang", "dui", "zhong", "ren", "yi", "shi", "you", "zhi",
+       "tiao", "fu", "fu", "mi|bi", "zu", "zhi", "suan", "mei", "zuo", "qu",
+       "hu", "zhu", "shen", "sui", "ci", "chai", "mi", "lv", "yu", "xiang",
+       "wu", "tiao", "piao", "zhu", "gui", "xia", "zhi", "ji|zhai", "gao", "zhen",
+       "gao", "shui|lei", "jin", "shen", "gai", "kun", "di", "dao", "huo", "tao",
+       "qi", "gu", "guan", "zui", "ling", "lu", "bing", "jin", "dao", "zhi",
+       "lu", "chan|shan", "bi|pi", "chu", "hui", "you|chao", "xi", "yin", "zi", "huo",
+       "zhen", "fu", "yuan", "xu", "xian", "shang|yang", "ti|zhi", "yi", "mei", "si",
+       "di", "bei", "zhuo", "zhen", "ying", "ji", "gao", "tang", "si", "ma",
+       "ta", "fu", "xuan", "qi", "yu", "xi", "ji", "si", "shan|chan", "dan",
+       "gui", "sui", "li", "nong", "mi", "dao", "li", "rang", "yue", "ti",
+       "zan", "lei", "rou", "yu", "yu|ou", "li", "xie", "qin", "he", "tu",
+       "xiu", "si", "ren", "tu", "zi", "cha|na", "gan", "yi|zhi", "xian", "bing",
+       "nian", "qiu", "qiu", "zhong", "fen", "hao|mao", "yun", "ke", "miao", "zhi",
+       "jing", "bi", "zhi", "yu", "mi|bi", "ku", "ban", "pi", "ni", "li",
+       "you", "zu", "pi", "bo", "ling", "mo", "cheng", "nian", "qin", "yang",
+       "zuo", "zhi", "di", "shu", "ju", "zi", "huo|kuo", "ji", "cheng|chen", "tong",
+       "shi|zhi", "huo|kuo", "huo", "yin", "zi", "zhi", "jie", "ren", "du", "yi",
+       "zhu", "hui", "nong", "fu|pu", "xi", "gao", "lang", "fu", "xun|ze", "shui",
+       "lv", "kun", "gan", "jing", "ti", "cheng", "tu|shu", "shao", "shui", "ya",
+       "lun", "lu", "gu", "zuo", "ren", "zhun", "bang", "bai", "ji|qi", "zhi",
+       "zhi", "kun", "leng|ling", "peng", "ke", "bing", "chou", "zui|zu|su", "yu", "su",
+       "lve", "uu", "yi", "xi|qie", "bian", "ji", "fu", "pi|bi", "nuo", "jie",
+       "zhong", "zong", "xu", "cheng|chen", "dao", "wen", "xian|jian|lian", "zi|jiu", "yu", "ji",
+       "xu", "zhen", "zhi", "dao", "jia", "ji|qi", "gao", "gao", "gu", "rong",
+       "sui", "rong", "ji", "kang", "mu", "can|shan|cen", "men|mei", "zhi", "ji", "lu",
+       "su", "ji", "ying", "wen", "qiu", "se", "kweok", "yi", "huang", "qie",
+       "ji", "sui", "xiao|rao", "pu", "jiao", "zhuo|bo", "tong|zhong", "zuo", "lu", "sui",
+       "nong", "se", "hui", "rang", "nuo", "yu", "pin", "ji", "tui", "wen",
+       "cheng|chen", "huo", "kuang", "lv", "biao|pao", "se", "rang", "zhuo|jue", "li", "cuan|zan",
+       "xue", "wa", "jiu", "qiong", "xi", "qiong", "kong", "yu", "shen", "jing",
+       "yao", "chuan", "zhun", "tu", "lao", "qie", "zhai", "yao", "bian", "bao",
+       "yao", "bing", "wa", "zhu|ku", "jiao|liao|liu", "qiao", "diao", "wu", "wa|gui", "yao",
+       "zhi", "chuang", "yao", "tiao|yao", "jiao", "chuang", "jiong", "xiao", "cheng", "kou",
+       "cuan", "wo", "dan", "ku", "ke", "zhuo", "huo", "su", "guan", "kui",
+       "dou", "zhuo", "yin|xun", "wo", "wa", "ya|ye", "yu", "ju", "qiong", "yao",
+       "yao", "tiao", "chao", "yu", "tian|dian|yan", "diao", "ju", "liao", "xi", "wu",
+       "kui", "chuang", "chao|ke", "kuan|cuan", "kuan|cuan", "long", "cheng", "cui", "liao", "zao",
+       "cuan", "qiao", "qiong", "dou", "zao", "long", "qie", "li", "chu", "shi",
+       "fu", "qian", "chu|qi", "hong", "qi", "hao", "sheng", "fen", "shu", "miao",
+       "qu|kou", "zhan", "zhu", "ling", "long", "bing", "jing", "jing", "zhang", "bai",
+       "si", "jun", "hong", "tong", "song", "jing|zhen", "diao", "yi", "shu", "jing",
+       "qu", "jie", "ping", "duan", "li", "zhuan", "ceng|zeng", "deng", "cun", "wai",
+       "jing", "kan", "jing", "zhu", "zhu|du", "le|jin", "peng", "yu", "chi", "gan",
+       "mang", "zhu", "wan", "du", "ji", "jiao", "ba", "suan", "ji", "qin",
+       "zhao", "sun", "ya", "zhui|rui", "yuan", "hu", "hang", "xiao", "cen|jin|han", "pi|bi",
+       "bi", "jian", "yi", "dong", "shan", "sheng", "da|xia|na", "di", "zhu", "na",
+       "chi", "gu", "li", "qie", "min", "bao", "tiao", "si", "fu", "ce",
+       "ben", "fa", "da", "zi", "di", "ling", "zuo|ze", "nu", "fu|fei", "gou",
+       "fan", "jia", "ge", "fan", "shi", "mao", "po", "ti", "jian", "qiong",
+       "long", "min", "bian", "luo", "gui", "qu", "chi", "yin", "yao", "xian",
+       "bi", "qiong", "kuo", "deng", "jiao", "jin", "quan", "sun", "ru", "fa",
+       "kuang", "zhu", "tong", "ji", "da", "hang", "ce", "zhong", "kou", "lai",
+       "bi", "shai", "dang", "zheng", "ce", "fu", "yun|jun", "tu", "pa", "li",
+       "lang", "ju", "guan", "jian", "han", "tong", "xia", "zhi", "cheng", "suan",
+       "shi", "zhu", "zuo", "xiao", "shao", "ting", "ce", "yan", "gao", "kuai",
+       "gan", "chou", "kuang", "gang", "yun", "o", "qian", "xiao", "jian", "pou|bu|fu|pu",
+       "lai", "zou", "pai|bei", "bi", "bi", "ge", "tai|chi", "guai|dai", "yu", "jian",
+       "zhao|dao", "gu", "chi", "zheng", "qing|jing", "sha", "zhou", "lu", "bo", "ji",
+       "lin", "suan", "jun|qun", "fu", "zha", "gu", "kong", "qian", "quan", "jun",
+       "chui", "guan", "wan|yuan", "ce", "zu", "po", "ze", "qie", "tuo", "luo",
+       "dan", "xiao", "ruo", "jian", "xuan", "bian", "sun", "xiang", "xian", "ping",
+       "zhen", "xing", "hu", "shi|yi", "zhu", "yue|yao|chuo", "chun", "lv", "wu", "dong",
+       "shuo|xiao|qiao", "ji", "jie", "huang", "xing", "mei", "fan", "chuan", "zhuan", "pian",
+       "feng", "zhu", "hong", "qie", "hou", "qiu", "miao", "qian", "gu", "kui",
+       "yi", "lou", "yun", "he", "tang", "yue", "chou", "gao", "fei", "ruo",
+       "zheng", "gou", "nie", "qian", "xiao", "cuan", "gong|gan|long", "peng|pang", "du", "li",
+       "bi", "zhuo|huo", "chu", "shai", "chi", "zhu", "qiang|cang", "long", "lan", "jian",
+       "bu", "li", "hui", "bi", "zhu|di", "cong", "yan", "peng", "cen|zan|can", "zhuan|zuan|suan",
+       "pi", "piao|biao", "dou", "yu", "mie", "tuan|zhuan", "ze", "shai", "guo|gui", "yi",
+       "hu", "chan", "kou", "cu", "ping", "zao", "ji", "gui", "su", "lou",
+       "ce|ji", "lu", "nian", "suo", "cuan", "diao", "suo", "le", "duan", "zhu",
+       "xiao", "bo", "mi|mie", "shai|si", "dang", "liao", "dan", "dian", "fu", "jian",
+       "min", "kui", "dai", "jiao", "deng", "huang", "sun|zhuan", "lao", "zan", "xiao",
+       "lu", "shi", "zan", "qi", "pai", "qi", "pai", "gan", "ju", "lu",
+       "lu", "yan", "bo", "dang", "sai", "zhua", "gou", "qian", "lian", "bu|bo",
+       "zhou", "lai", "shi", "lan", "kui", "yu", "yue", "hao", "zhen|jian", "tai",
+       "ti", "nie", "chou", "ji", "yi", "qi", "teng", "zhuan", "zhou", "fan|pan|bian",
+       "sou|shu", "zhou", "qian", "zhuo", "teng", "lu", "lu", "jian", "tuo", "ying",
+       "yu", "lai", "long", "shen shi|sen si|qie", "lian", "lan", "qian", "yue", "zhong", "qu",
+       "lian", "bian", "duan", "zuan", "li", "shai", "luo", "ying", "yue", "zhuo",
+       "yu", "mi", "di", "fan", "shen", "zhe", "shen", "nv", "he", "lei",
+       "xian", "zi", "ni", "cun", "zhang", "qian", "zhai", "bi", "ban", "wu",
+       "sha|chao", "kang|jing", "rou", "fen", "bi", "cui", "yin", "zhe", "mi", "ta",
+       "hu", "ba", "li", "gan", "ju", "po", "yu", "cu", "nian", "zhou",
+       "chi", "su", "tiao", "li", "xi", "su", "hong", "tong", "zi|ci", "ce|se",
+       "yue", "zhou|yu", "lin", "zhuang", "bai", "lao", "fen", "er", "qu", "he",
+       "liang", "xian", "fu", "liang", "can", "jing", "li", "yue", "lu", "ju",
+       "qi", "cui", "bai", "zhang", "lin", "zong", "jing", "guo", "hua", "san|shen",
+       "shen", "tang", "bian", "rou", "mian", "hou", "xu", "zong", "hu", "jian",
+       "zan", "ci", "li", "xie", "fu", "nuo", "bei", "gu|gou", "xiu", "gao",
+       "tang", "qiu", "jia", "cao", "zhuang", "tang", "mi|mei", "san|shen", "fen", "zao",
+       "kang", "jiang", "mo", "san|shen", "san", "nuo", "xi", "liang", "jiang", "kuai",
+       "bo", "huan", "shu", "zong", "xian", "nuo", "tuan", "nie", "li", "zuo",
+       "di", "nie", "tiao", "lan", "mi|si", "si", "jiu", "xi|ji", "gong", "zheng",
+       "jiu", "gong", "ji", "cha", "zhou", "xun", "yue|yao", "hong|gong", "yu", "he|ge",
+       "wan", "ren", "wen", "wen", "qiu", "na", "zi", "tou", "niu", "fou",
+       "ji|jie", "shu", "chun", "bi", "zhen", "sha", "hong", "zhi", "ji", "fen",
+       "yun", "ren", "dan", "jin", "su", "fang", "suo", "cui", "jiu", "zha|za",
+       "ha", "jin", "fu", "zhi", "qi", "zi", "chou", "hong", "zha|za", "lei",
+       "xi", "fu", "xie", "shen", "bo|bi", "zhu", "qu", "ling", "zhu", "shao",
+       "gan", "yang", "fu", "tuo", "zhen|tian", "dai", "chu", "shi", "zhong", "xian",
+       "zu", "jiong", "ban", "qu", "mo", "shu", "zui", "kuang", "jing", "ren",
+       "hang", "xie", "jie", "zhu", "chou", "gua|kua", "bai|mo", "jue", "kuang", "hu",
+       "ci", "huan|geng", "geng", "tao", "xie|jie", "ku", "jiao", "quan|shuan", "gai|ai", "luo|lao",
+       "xuan", "beng|bing|peng", "xian", "fu", "gei|ji", "tong|dong", "rong", "tiao|diao|dao", "yin", "lei",
+       "xie", "juan", "xu", "gai|hai", "die", "tong", "si", "jiang", "xiang", "hui",
+       "jue", "zhi", "jian", "juan", "chi|zhi", "mian|wen|man|wan", "zhen", "lv", "cheng", "qiu",
+       "shu", "bang", "tong", "xiao", "huan|wan", "qin|xian", "geng", "xu", "ti", "xiu",
+       "xie", "hong", "xi", "fu", "ting", "sui", "dui", "kun", "fu", "jing",
+       "hu", "zhi", "yan|xian", "jiong", "feng", "ji", "xu", "ren", "zong|zeng", "lin|chen",
+       "duo", "li|lie", "lv", "jing", "chou", "quan", "shao", "qi", "qi", "zhun",
+       "ji|qi", "wan", "qian|qing|zheng", "xian", "shou", "wei", "qing|qi", "tao", "wan", "gang",
+       "wang", "beng", "zhui", "cai", "guo", "cui", "lun|guan", "liu", "qi", "zhan",
+       "bi", "chuo|chao", "ling", "mian", "qi", "ji", "tian|tan|chan", "zong", "gun", "zou",
+       "xi", "zi", "xing", "liang", "gei|ji", "fei", "rui", "min", "yu", "zong",
+       "fan", "lv|lu", "xu", "ying", "shang", "zi", "xu", "xiang", "jian", "ke",
+       "xian", "ruan", "mian", "ji|qi", "duan", "chong|zhong", "di", "min", "miao|mao", "yuan",
+       "xie|ye", "bao", "si", "qiu", "bian", "huan", "geng", "zong", "mian", "wei",
+       "fu", "wei", "tou|xu|shu", "gou", "miao", "xie", "lian", "zong", "bian|pian", "gun|yun",
+       "yin", "ti", "gua|wo", "zhi", "yun|wen", "cheng", "chan", "dai", "xie", "yuan",
+       "zong", "xu", "sheng", "wei", "geng", "seon", "ying", "jin", "yi", "zhui",
+       "ni", "bang", "gu", "pan", "zhou", "jian", "ci|cuo|suo", "quan", "shuang", "yun|wen",
+       "xia", "cui|sui|shuai", "xi", "rong", "tao", "fu", "yun", "zhen", "gao", "ru",
+       "hu", "zai|zeng", "teng", "xian|xuan", "su", "zhen", "zong", "tao", "huang", "cai",
+       "bi", "feng", "cu", "li", "suo|su", "yan|yin", "xi", "zong", "lei", "zhuan|juan",
+       "qian", "man", "zhi", "lv", "mu|mo", "piao", "lian", "mi", "xuan", "zong",
+       "ji", "shan", "sui", "fan|po", "lv", "beng", "yi", "sao", "mou|miu|miao|mu|liao", "yao|you|zhou",
+       "qiang", "sheng", "xian", "ji", "zong", "xiu", "ran", "xuan", "sui", "qiao",
+       "zeng", "zuo", "zhi", "shan", "san", "lin", "ju|jue", "fan", "liao", "chuo",
+       "zun", "jian", "rao", "chan", "rui", "xiu", "hui", "hua", "zuan", "xi",
+       "qiang", "wen", "da", "sheng", "hui", "xi|ji", "se", "jian", "jiang", "huan",
+       "qiao|sao", "cong", "xie", "jiao|zhuo", "bi", "dan|tan|chan", "yi", "nong", "sui", "yi",
+       "sha", "ru", "ji", "bin", "qian", "lan", "pu|fu", "xun", "zuan", "zi",
+       "peng", "yao|li", "mo", "lei", "xie", "zuan", "kuang", "you", "xu", "lei",
+       "xian", "chan", "jiao", "lu", "chan", "ying", "cai", "xiang|rang", "qian", "zui",
+       "zuan", "luo", "li|xi|sa", "dao", "lan", "lei", "lian", "si", "jiu", "yu",
+       "hong|gong", "zhou", "xian|qian", "he|ge", "yue|yao", "ji", "wan", "kuang", "ji", "ren",
+       "wei", "yun", "hong", "chun", "pi|bi", "sha", "gang", "na", "ren", "zong",
+       "lun|guan", "fen", "zhi", "wen", "fang", "zhu", "zhen", "niu", "shu", "xian",
+       "gan", "xie", "fu", "lian", "zu", "shen", "xi", "zhi", "zhong", "zhou",
+       "ban", "fu", "chu", "shao", "yi", "jing", "dai", "bang", "rong", "jie",
+       "ku", "rao", "die", "hang", "hui", "gei|ji", "xuan", "jiang", "luo|lao", "jue",
+       "jiao", "tong", "bing", "xiao", "juan", "xiu", "xi", "sui", "tao", "ji",
+       "ti", "ji", "xu", "ling", "ying", "xu", "qi", "fei", "chuo|chao", "shang",
+       "gun", "sheng", "wei", "mian", "shou", "beng", "chou", "tao", "liu", "quan",
+       "zong|zeng", "zhan", "wan", "lv|lu", "zhui", "zi", "ke", "xiang", "jian", "mian",
+       "lan", "ti", "miao", "ji|qi", "yun|wen", "hui", "si", "duo", "duan", "bian|pian",
+       "xian", "gou", "zhui", "huan", "di", "lv", "bian", "min", "yuan", "jin",
+       "fu", "ru", "zhen", "feng", "cui|sui|shuai", "gao", "chan", "li", "yi", "jian",
+       "bin", "piao", "man", "lei", "ying", "suo|su", "mou|miu|miao|mu|liao", "sao", "xie", "liao",
+       "shan", "zeng", "jiang", "qian", "qiao|sao", "huan", "jiao|zhuo", "zuan", "fou", "xie",
+       "gang", "fou", "que", "fou", "que", "bo", "ping", "xiang", "zhao", "gang",
+       "ying", "ying", "qing", "xia", "guan", "zun", "tan", "cheng", "qi", "weng",
+       "ying", "lei", "tan", "lu", "guan", "wang", "wang", "wang", "wang", "han",
+       "rb", "luo", "fu", "shen", "fa", "gu", "zhu", "ju", "mao", "gu",
+       "min", "gang", "ba|pi", "gua", "ti", "juan", "fu", "shen", "yan", "zhao",
+       "zui", "guai|gua", "zhuo", "yu", "zhi", "an", "fa", "lan", "shu", "si",
+       "pi", "ma", "liu", "ba|pi", "fa", "li", "chao", "wei", "bi", "ji",
+       "zeng", "chong", "liu", "ji", "juan", "mi", "zhao", "luo", "pi", "ji",
+       "ji", "luan", "yang|xiang", "mi", "qiang", "da", "mei", "yang|xiang", "ling", "you",
+       "fen", "ba", "gao", "yang", "gu", "qiang", "zang", "mei|gao", "ling", "yi|xi",
+       "zhu", "di", "xiu", "qiang", "yi", "xian", "rong", "qun", "qun", "qiang",
+       "huan", "suo", "xian", "yi", "you", "qiang|kong", "qian|xian|yan", "yu", "geng", "jie",
+       "tang", "yuan", "xi", "fan", "shan", "fen", "shan", "lian", "lei", "geng",
+       "nou", "qiang", "chan", "yu", "hong|gong", "yi", "chong", "weng", "fen", "hong",
+       "chi", "chi", "cui", "fu", "xia", "ben", "yi", "la", "yi", "pi|bi|po",
+       "ling", "liu", "zhi", "qu|yu", "xi", "xie", "xiang", "xi", "xi", "ke",
+       "qiao", "hui", "hui", "xiao", "sha", "hong", "jiang", "zhai|di", "cui", "fei",
+       "dao|zhou", "sha", "chi", "zhu", "jian", "xuan", "chi", "pian", "zong", "wan",
+       "hui", "hou", "he", "he", "han", "ao", "piao", "yi", "lian", "hou|qu",
+       "ao", "lin", "pen", "qiao", "ao", "fan", "yi", "hui", "xuan", "dao",
+       "yao", "lao", "lao", "kao", "mao", "zhe", "qi|shi", "gou", "gou", "gou",
+       "die", "die", "er", "shua", "ruan|nuo", "er|nai", "nai", "duan|zhuan", "lei", "ting",
+       "zi", "geng", "chao", "hao", "yun", "ba|pa", "pi", "si|chi", "si", "qu|chu",
+       "jia", "ju", "huo", "chu", "lao", "lun", "ji|jie", "tang", "ou", "lou",
+       "nou", "jiang", "pang", "zha|ze", "lou", "ji", "lao", "huo", "you", "mo",
+       "huai", "er", "yi", "ding", "ye", "da", "song", "qin", "yun|ying", "chi",
+       "dan", "dan", "hong", "geng", "zhi", "pan", "nie", "dan", "zhen", "che",
+       "ling", "zheng", "you", "wa|tui|zhuo", "liao", "long", "zhi", "ning", "tiao", "er|nv",
+       "ya", "tie|zhe", "guo", "xu", "lian", "hao", "sheng", "lie", "pin", "jing",
+       "ju", "bi", "di|zhi", "guo", "wen", "xu", "ping", "cong", "ding", "ni",
+       "ting", "ju", "cong", "kui", "lian", "kui", "cong", "lian", "weng", "kui",
+       "lian", "lian", "cong", "ao", "sheng", "song", "ting", "kui", "nie", "zhi",
+       "dan", "ning", "qie", "ni|jian", "ting", "ting", "long", "yu", "yu", "zhao",
+       "si", "su", "yi", "su", "si", "zhao", "zhao", "rou", "yi", "lei|le",
+       "ji", "qiu", "ken", "cao", "ge", "bo|di", "huan", "huang", "chi", "ren",
+       "xiao", "ru", "zhou", "yuan", "du", "gang", "rong|chen", "gan", "chai", "wo",
+       "chang", "gu", "zhi", "qin|han", "fu", "fei", "ban", "pei", "pang|pan", "jian",
+       "fang", "zhun|chun", "you", "na", "ang", "ken", "ran", "gong", "yu", "wen",
+       "yao", "qi", "pi|bi", "qian", "xi", "xi", "fei", "ken", "jing", "tai",
+       "shen", "zhong", "zhang", "xie", "shen", "wei", "zhou", "die", "dan", "fei|bi",
+       "ba", "bo", "qu", "tian", "bei", "gua", "tai", "zi|fei", "fei|ku", "zhi",
+       "ni", "ping|peng", "zi", "fu|zhou", "pang|pan", "zhen", "xian", "zuo", "pei", "jia",
+       "sheng", "zhi", "bao", "mu", "qu", "hu", "qia", "chi", "yin", "xu",
+       "yang", "long", "dong", "ka", "lu", "jing", "nu", "yan", "pang", "kua",
+       "yi", "guang", "hai", "ge", "dong", "chi", "jiao", "xiong", "xiong", "er",
+       "an", "heng", "pian", "neng|nai", "zi", "gui|kui", "zheng", "tiao", "zhi", "cui",
+       "mei", "xie", "cui", "xie", "mai", "mai", "ji", "xie", "nin", "kuai",
+       "sa", "zang", "qi", "nao", "mi", "nong", "luan", "wan", "bo", "wen",
+       "wan", "xiu", "jiao", "jing", "rou", "heng", "cuo", "lie", "shan", "ting",
+       "mei", "chun", "shen", "jia", "te", "juan", "cu", "xiu", "xin", "tuo",
+       "pao", "cheng", "nei", "fu", "dou", "tuo", "niao", "nao", "pi", "gu",
+       "luo", "li", "lian", "zhang", "cui", "jie", "liang", "shui", "pi", "biao",
+       "lun", "pian", "guo", "juan", "chui", "dan", "tian", "nei", "jing", "nai",
+       "la", "ye", "a", "ren", "shen", "zhui", "fu", "fu", "ju", "fei",
+       "qiang", "wan", "dong", "pi", "guo", "zong", "ding", "wo", "mei", "ruan",
+       "zhuan", "chi", "cou", "luo", "ou", "di", "an", "xing", "nao", "shu",
+       "shuan", "nan", "yun", "zhong", "rou", "e", "sai", "tu", "yao", "jian",
+       "wei", "jiao", "yu", "jia", "duan", "bi", "chang", "fu", "xian", "ni",
+       "mian", "wa", "teng", "tui", "bang", "qian", "lv", "wa", "shou", "tang",
+       "su", "zhui", "ge", "yi", "bo", "liao", "ji", "pi", "xie", "gao",
+       "lv", "bin", "ou", "chang", "lu|biao", "guo", "pang", "chuai", "biao", "jiang",
+       "fu", "tang", "mo", "xi", "zhuan|chuan|chun", "lv", "jiao", "ying", "lv", "zhi",
+       "xue", "cun", "lin", "tong", "peng", "ni", "chuai", "liao", "cui", "kui",
+       "xiao", "teng", "fan|pan", "zhi", "jiao", "shan", "hu|wu", "cui", "run", "xiang",
+       "sui", "fen", "ying", "shan|dan", "zhua", "dan", "kuai", "nong", "tun", "lian",
+       "bi|bei", "yong", "jue", "chu", "yi", "juan", "la|ge", "lian", "sao", "tun",
+       "gu", "qi", "cui", "bin", "xun", "nao", "wo|yue", "zang", "xian", "biao",
+       "xing", "kuan", "la", "yan", "lu", "huo", "za", "luo", "qu", "zang",
+       "luan", "ni|luan", "za", "chen", "qian|xian", "wo", "guang|jiong", "zang|cang", "lin", "guang|jiong",
+       "zi", "jiao", "nie", "chou|xiu", "ji", "gao", "chou", "mian|bian", "nie", "zhi",
+       "zhi", "ge", "jian", "die|zhi", "zhi|jin", "xiu", "tai", "zhen", "jiu", "xian",
+       "yu", "cha", "yao", "yu", "chong", "xi", "xi", "jiu", "yu", "yu",
+       "xing", "ju", "jiu", "xin", "she", "she", "she", "jiu", "shi", "tan",
+       "shu", "shi", "tian", "tan", "pu", "pu", "guan", "hua", "tian", "chuan",
+       "shun", "xia", "wu", "zhou", "dao", "chuan", "shan", "yi", "fan", "pa",
+       "tai", "fan", "ban", "chuan", "hang", "fang", "ban", "bi", "lu", "zhong",
+       "jian", "cang", "ling", "zhu", "ze", "duo", "bo", "xian", "ge", "chuan",
+       "xia", "lu", "qiong", "pang", "xi", "kua", "fu", "zao", "feng", "li",
+       "shao", "yu", "lang", "ting", "yu", "wei", "bo", "meng", "nian", "ju",
+       "huang", "shou", "ke", "bian", "mu", "die", "dao", "bang", "cha", "yi",
+       "sou", "cang", "cao", "lou", "dai", "xue", "yao", "chong", "deng", "dang",
+       "qiang", "lu", "yi", "ji", "jian", "huo", "meng", "qi", "lu", "lu",
+       "chan", "shuang", "gen", "liang", "jian", "jian", "se", "yan", "fu", "ping",
+       "yan", "yan", "cao", "ao", "yi", "le", "ding", "qiu", "ai", "nai",
+       "tiao", "qiu", "jie", "peng", "wan", "yi", "chai|cha", "mian", "mi", "gan",
+       "qian", "yu", "yu", "shao", "xiong", "du", "hu|xia", "qi", "mang", "zi",
+       "hui|hu", "sui", "zhi", "xiang", "bi|pi", "fu", "tun|chun", "wei", "wu", "zhi",
+       "qi", "shan", "wen", "qian", "ren", "fu", "kou", "jie|gai", "lu", "xu|zhu",
+       "ji", "qin", "qi", "yuan|yan", "fen", "ba", "rui", "xin", "ji", "hua",
+       "lun|hua", "fang", "wu|hu", "jue", "gou", "zhi", "yun", "qin", "ao", "chu",
+       "mao", "ya", "fei|fu", "reng", "hang", "cong", "chan|yin", "you", "bian", "yi",
+       "qie", "wei", "li", "pi", "e", "xian", "chang", "cang", "zhu", "su",
+       "di|ti", "yuan", "ran", "ling", "tai", "tiao|shao", "di", "miao", "qing", "ji",
+       "yong", "ke|he", "mu", "bei", "bao", "gou", "min", "yi", "yi", "ju|qu",
+       "pie", "ruo|re", "ku", "zhu|ning", "ni", "pa|bo", "bing", "shan", "xiu", "yao",
+       "xian", "ben", "hong", "ying", "zuo|zha", "dong", "cha", "die", "nie", "gan",
+       "hu", "ping|peng", "mei", "fu", "sheng|rui", "gu", "bi", "wei", "fu", "zhuo",
+       "mao", "fan", "jia", "mao", "mao", "ba", "ci", "mo", "zi", "zhi",
+       "chi", "ji", "jing", "long", "cong", "niao", "yuan", "xue", "ying", "qiong",
+       "ge", "ming", "li", "rong", "yin", "gen", "qian", "chai", "chen", "yu",
+       "hao", "zi", "lie", "wu", "ji", "gui", "ci", "jian", "ci", "hou",
+       "guang", "mang", "cha", "jiao", "jiao", "fu", "yu", "zhu", "zi", "jiang",
+       "hui", "yin", "cha", "fa", "rong", "ru", "chong", "mang", "tong", "zhong",
+       "qian", "zhu", "xun", "huan", "fu", "quan", "gai", "da", "jing", "xing",
+       "chuan", "cao", "jing", "er", "an", "qiao", "chi", "ren", "jian", "ti",
+       "huang", "ping", "li", "jin", "lao", "shu", "zhuang", "da", "jia", "rao",
+       "bi", "ce", "qiao", "hui", "ji", "dang", "zi", "rong", "hun", "xing",
+       "luo", "ying", "qian", "jin", "sun", "yin", "mai", "hong", "zhou", "yao",
+       "du", "wei", "li", "dou", "fu", "ren", "yin", "he", "bi", "bu",
+       "yun", "di", "tu", "sui", "sui", "cheng", "chen", "wu", "bie", "xi",
+       "geng", "li", "pu", "zhu", "mo", "li", "zhuang", "zuo", "tuo", "qiu",
+       "suo|sha", "suo", "chen", "peng|feng", "ju", "mei", "meng", "xing", "jing", "che",
+       "shen|xin", "jun", "yan", "ting", "you", "cuo", "guan|wan", "han", "you", "cuo",
+       "jia", "wang", "su|you", "niu", "shao|xiao", "xian", "lang|liang", "fu|piao", "e", "mo|mu",
+       "wen|wan|mian", "jie", "nan", "mu", "kan", "lai", "lian", "shi", "wo", "tu",
+       "xian|lian", "huo", "you", "ying", "ying", "neus", "chun", "mang", "mang", "ci",
+       "wan|yun", "jing", "di", "qu", "dong", "jian", "zou|chu", "gu", "la", "lu",
+       "ju", "wei", "jun", "nie|ren", "kun", "he", "pu", "zi|zai", "gao", "guo",
+       "fu", "lun", "chang", "chou", "song", "chui", "zhan", "men", "cai", "ba",
+       "li", "tu", "bo", "han", "bao", "qin", "juan", "xi", "qin", "di",
+       "jie|sha", "pu", "dang", "jin", "qiao|zhao", "tai|zhi|chi", "geng", "hua", "gu", "ling",
+       "fei", "qin|jin", "an", "wang", "beng", "zhou", "yan", "zu", "jian", "lin|ma",
+       "tan", "shu", "tian", "dao", "hu", "qi", "he", "cui", "tao", "chun",
+       "bi", "chang", "huan", "fei", "lai", "qi", "meng", "ping", "wei", "dan",
+       "sha", "huan", "yan", "yi", "tiao", "qi", "wan", "ce", "nai", "zhen",
+       "tuo", "jiu", "tie", "luo", "bi", "yi", "pan", "bo", "pao", "ding",
+       "ying", "ying", "ying", "xiao", "sa", "qiu", "ke", "xiang", "wan", "yu",
+       "yu", "fu", "lian", "xuan", "xuan", "nan", "ce", "wo", "chun", "shao",
+       "yu", "bian", "mao", "an", "e", "luo|la|lao", "ying", "kuo", "kuo", "jiang",
+       "mian", "zuo", "zuo", "zu", "bao", "rou", "xi", "ye", "an", "qu",
+       "jian", "fu", "lv", "jing", "pen", "feng", "hong", "hong", "hou", "xing",
+       "tu", "zhu|zhuo|zhe", "zi", "xiang", "ren", "ge", "qia", "qing", "mi", "huang",
+       "shen", "pu", "gai", "dong", "zhou", "qian", "wei", "bo", "wei", "pa",
+       "ji", "hu", "zang", "jia", "duan", "yao", "jun", "cong", "quan", "wei",
+       "zhen", "kui", "ting", "hun", "xi", "shi", "qi", "lan", "zong", "yao",
+       "yuan", "mei", "yun", "shu", "di", "zhuan", "guan", "ran", "xue", "chan",
+       "kai", "kui|kuai", "uu", "jiang", "lou", "wei", "pai", "yong", "sou", "yin",
+       "shi", "chun", "shi", "yun", "zhen", "lang", "ru|na", "meng", "li", "que",
+       "suan", "yuan|huan", "li", "ju", "xi", "bang", "chu", "xu|shu", "tu", "liu",
+       "huo", "dian", "qian", "ju", "po", "cuo", "yuan", "chu", "yu", "kuai",
+       "pan", "pu", "pu", "na", "shuo", "xi", "fen", "yun", "zheng", "jian",
+       "ji", "ruo", "cang", "en", "mi", "hao", "sun", "zhen", "ming", "sou",
+       "xu", "liu", "xi", "gu", "lang", "rong", "weng", "gai|ge|he", "cuo", "shi",
+       "tang", "luo", "ru", "suo", "xuan", "bei", "yao|zhuo", "gui", "bi", "zong",
+       "gun", "zuo", "tiao", "ce", "pei", "lan", "dan", "ji", "li", "shen",
+       "lang", "yu", "ling", "ying", "mo", "diao|tiao|di", "tiao", "mao", "tong", "zhu",
+       "peng", "an", "lian", "cong", "xi", "ping", "qiu|xu|fu", "jin", "chun", "jie",
+       "wei", "tui", "cao", "yu", "yi", "zi|ju", "liao|lu", "bi", "lu", "xu",
+       "bu", "zhang", "lei", "qiang", "man", "yan", "ling", "ji", "biao", "gun",
+       "han", "di", "su", "lu", "she", "shang", "di", "mie", "hun", "wan",
+       "bu", "di", "cuo", "zhe", "shen", "xuan", "wei", "hu", "ao", "mi",
+       "lou", "cu", "zhong", "cai", "po", "jiang", "mi", "cong", "niao", "hui",
+       "juan", "yin", "jian", "nian", "shu", "yin", "guo", "chen", "hu", "sha",
+       "kou", "qian", "ma", "zang", "ze", "qiang", "dou", "lian", "lin", "kou",
+       "ai", "bi", "li", "wei", "ji", "qian", "sheng", "fan", "meng", "ou",
+       "chan", "dian", "xun", "jiao", "rui", "rui", "lei", "yu", "qiao", "zhu",
+       "hua", "jian", "mai", "yun", "bao", "you", "qu", "lu", "rao", "hui",
+       "e", "ti", "fei", "jue", "zui", "fa", "ru", "fen", "kui", "shun",
+       "rui", "ya", "xu", "fu", "jue", "dang", "wu", "dong", "si", "xiao",
+       "xi", "sa", "yun", "shao", "qi", "jian", "yun", "sun", "ling", "yu",
+       "xia", "weng", "ji", "hong", "si", "nong", "lei", "xuan", "yun", "yu",
+       "xi|xiao", "hao", "bao|bo", "hao", "ai", "wei", "hui", "hui", "ji", "ci",
+       "xiang", "wan|luan", "mie", "yi", "leng", "jiang", "can", "shen", "qiang|se", "lian",
+       "ke", "yuan", "da", "ti", "tang", "xue", "bi", "zhan", "sun", "xian|lian",
+       "fan", "ding", "xie", "gu", "xie", "shu", "jian", "hao|kao", "hong", "sa",
+       "xin", "xun", "yao", "bai", "sou", "shu", "xun", "dui", "pin", "yuan|wei",
+       "ning", "chou|zhou", "mai|wo", "ru", "piao", "tai", "ji", "zao", "chen", "zhen",
+       "er", "ni", "ying", "gao", "cong", "xiao|hao", "qi", "fa", "jian", "xu",
+       "kui", "jie|ji", "bian", "diao|zhuo", "mi", "lan", "jin", "cang|zang", "miao", "qiong",
+       "qi", "xian", "liao", "ou", "xian", "su", "lv", "yi", "mai", "xie",
+       "li", "yi", "la", "lei", "jiao", "di", "zhi", "bei", "teng", "yao|yue",
+       "mo", "huan", "biao|pao", "fan", "sou", "tan", "tui", "qiong", "qiao", "wei",
+       "liu", "hui", "ou", "gao", "yun", "bao", "li", "shu", "zhu|chu", "ai",
+       "lin", "zao", "xuan", "qin", "lai", "huo", "tuo", "wu", "rui", "rui",
+       "qi", "heng", "lu", "su", "tui", "mang", "yun", "ping", "yu", "xun",
+       "ji", "jiong", "xuan", "mo", "qiu", "su", "jiong", "peng", "nie", "nie",
+       "rang", "yi", "xian", "yu", "ju", "lian", "lian", "yin", "qiang", "ying",
+       "long", "tou", "hua", "yue", "ling", "qu", "yao", "fan", "mi", "lan",
+       "gui", "lan", "ji", "dang", "man", "lei", "lei", "hui", "feng", "zhi",
+       "wei", "kui", "zhan", "huai", "li", "ji", "mi", "lei", "huai", "luo",
+       "ji", "kui", "lu", "jian", "sal", "teng", "lei", "quan", "xiao", "yi",
+       "luan", "men", "bie", "hu", "hu", "lu", "nve", "lv", "si", "xiao",
+       "qian", "chu", "hu", "xu", "cuo", "fu", "xu", "xu", "lu", "hu",
+       "yu", "hao", "jiao", "ju", "guo", "bao", "yan", "zhan", "zhan", "kui",
+       "bin", "xi", "shu", "chong", "qiu", "diao", "ji", "qiu", "ding", "shi",
+       "xia", "jue", "zhe", "she", "yu", "han", "zi", "hong", "hui", "meng",
+       "ge", "sui", "xia", "chai", "shi", "yi", "ma", "xiang", "fang|bang", "e",
+       "ba", "chi", "qian", "wen", "wen", "rui", "bang|beng", "pi", "yue", "yue",
+       "jun", "qi", "tong", "yin", "qi|zhi", "can", "yuan|wan", "jue|que", "hui", "qin|qian",
+       "qi", "zhong", "ya", "hao", "mu", "wang", "fen", "fen", "hang", "gong|zhong",
+       "zao", "fu", "ran", "jie", "fu", "chi", "dou", "bao", "xian", "ni",
+       "dai|de", "qiu", "you", "zha", "ping", "chi", "you", "he", "han", "ju",
+       "li", "fu", "ran", "zha", "gou|qu|xu", "pi", "pi|bo", "xian", "zhu", "diao",
+       "bie", "bing", "gu", "zhan", "qu", "she|yi", "tie", "ling", "gu", "dan",
+       "tun", "ying", "li", "cheng", "qu", "mou", "ge|luo", "ci", "hui", "hui",
+       "mang|bang", "fu", "yang", "wa", "lie", "zhu", "yi", "xian", "kuo", "jiao",
+       "li", "yi|xu", "ping", "jie", "ge|ha", "she", "yi", "wang", "mo", "qiong",
+       "qie|ni", "gui", "qiong", "zhi", "man", "lao", "zhe", "jia", "nao", "si",
+       "qi", "xing", "jie", "qiu", "xiao", "yong", "jia", "tui", "che", "bei",
+       "e|yi", "han", "shu", "xuan", "feng", "shen", "shen", "fu", "xian", "zhe",
+       "wu", "fu", "li", "lang", "bi", "chu", "yuan", "you", "jie", "dan",
+       "yan", "ting", "dian", "tui", "hui", "wo", "zhi", "zhong", "fei", "ju",
+       "mi", "qi", "qi", "yu", "jun", "la", "meng", "qiang", "si", "xi",
+       "lun", "li", "die", "tiao", "tao", "kun", "han", "han", "yu", "bang",
+       "fei", "pi", "wei", "dun", "yi", "yuan", "suo", "quan", "qian", "rui",
+       "ni", "qing", "wei", "liang", "guo", "wan", "dong", "e", "ban", "di",
+       "wang", "can", "yang", "ying", "guo", "chan", "ding", "la", "ke", "ji",
+       "xie", "ting", "mao", "xu", "mian", "yu", "jie", "shi", "xuan", "huang",
+       "yan", "bian", "rou", "wei", "fu", "yuan", "mei", "wei", "fu", "ru",
+       "xie", "you", "qiu", "mao", "xia", "ying", "shi", "chong", "tang", "zhu",
+       "zong", "di", "fu", "yuan", "kui", "meng", "la", "dai", "hu", "qiu",
+       "die", "li", "wo", "yun", "qu", "nan", "lou", "chun", "rong", "ying",
+       "jiang", "ban", "lang", "pang", "si", "xi", "ci", "xi", "yuan", "weng",
+       "lian", "sou", "ban", "rong", "rong", "ji", "wu", "xiu", "han", "qin",
+       "yi", "bi", "hua", "tang", "yi", "du", "nai|neng", "he|xia", "hu", "gui|hui",
+       "ma", "ming", "yi", "wen", "ying", "teng", "zhong", "cang", "sao", "qi",
+       "man", "dao", "shang", "shi|zhe", "cao", "chi", "di", "ao", "lu", "wei",
+       "die|zhi", "tang", "chen", "piao", "qu|ju", "pi", "yu", "chan|jian", "luo", "lou",
+       "qin", "zhong", "yin", "jiang", "shuai", "wen", "xiao", "wan", "zhe", "zhe",
+       "ma", "ma", "guo", "liu", "mao", "xi", "cong", "li", "man", "xiao",
+       "chang", "zhang", "mang|meng", "xiang", "mo", "zui", "si", "qiu", "te", "zhi",
+       "peng", "peng", "jiao", "qu", "bie", "liao", "pan", "gui", "xi", "ji",
+       "zhuan", "huang", "fei|ben", "lao|liao", "jue", "jue", "hui", "yin|xun", "chan", "jiao",
+       "shan", "nao", "xiao", "wu", "chong", "xun", "si", "chu", "cheng", "dang",
+       "li", "xie", "shan", "yi", "jing", "da", "chan", "qi", "ci", "xiang",
+       "she", "luo", "qin", "ying", "chai", "li", "zei", "xuan", "lian", "zhu",
+       "ze", "xie", "mang", "xie", "qi", "rong", "jian", "meng", "hao", "ru",
+       "huo", "zhuo", "jie", "pin", "he", "mie", "fan", "lei", "jie", "la",
+       "min", "li", "chun", "li", "qiu", "nie", "lu", "du", "xiao", "zhu",
+       "long", "li", "long", "feng", "ye", "pi", "nang", "gu", "juan", "ying",
+       "shu", "xi", "can", "qu", "quan", "du", "can", "man", "qu", "jie",
+       "zhu", "zhuo", "xie", "huang", "nv", "pei", "nv", "xin", "zhong", "mai",
+       "er", "ke", "mie", "xi", "xing|hang|heng", "yan", "kan", "yuan", "qu", "ling",
+       "xuan", "shu", "xian", "tong", "xiang", "jie", "xian", "ya", "hu", "wei",
+       "dao", "chong", "wei", "dao", "zhun", "heng", "qu", "yi", "yi", "bu",
+       "gan", "yu", "biao", "cha", "yi", "shan", "chen", "fu", "gun", "fen",
+       "shuai", "jie", "na", "zhong", "dan", "ri", "zhong", "zhong", "jie", "zhi",
+       "xie", "ran", "zhi", "ren", "qin", "jin", "jun", "yuan", "mei", "chai",
+       "ao", "niao", "hui", "ran", "jia", "tuo", "ling", "dai", "bao|pao", "pao",
+       "yao", "zuo", "bi", "shao", "tan", "ju|jie", "he|ke", "xue", "xiu", "zhen",
+       "yi", "pa", "fu", "di", "wa", "fu", "gun", "zhi", "zhi", "ran",
+       "pan", "yi", "mao", "tuo", "na|jue", "gou", "xuan", "zhe", "qu", "bei|pi",
+       "yu", "xi", "mi", "bo", "uu", "fu", "chi|nuo", "chi|qi|duo|nuo", "ku", "ren",
+       "peng", "jia|jie|qia", "jian|zun", "bo|mo", "jie", "er", "ge", "ru", "zhu", "gui|gua",
+       "yin", "cai", "lie", "ka", "hang", "zhuang", "dang", "xu", "kun", "ken",
+       "niao", "shu", "jia", "kun", "cheng", "li", "juan", "shen", "pou", "ge|jie",
+       "yi", "yu", "zhen", "liu", "qiu", "qun", "ji", "yi", "bu", "zhuang",
+       "shui", "sha", "qun", "li", "lian", "lian", "ku", "jian", "bao", "chan",
+       "bi|pi", "kun", "tao", "yuan", "ling", "chi", "chang", "chou|dao", "duo", "biao",
+       "liang", "chang|shBng", "pei", "pei", "fei", "yuan|gun", "luo", "guo", "yan|an", "du",
+       "xi|ti", "zhi", "ju", "yi", "qi", "guo", "gua", "ken", "qi", "ti",
+       "ti", "fu", "chong", "xie", "bian", "die", "kun", "duan", "xiu", "xiu",
+       "he", "yuan", "bao", "bao", "fu", "yu", "tuan", "yan", "hui", "bei",
+       "zhu", "lv", "pao", "dan", "yun", "ta", "gou", "da", "huai", "rong",
+       "yuan", "ru", "nai", "jiong", "suo", "ban", "tui", "chi", "sang", "niao",
+       "ying", "jie", "qian", "huai", "ku", "lian", "lan", "li", "zhe", "shi",
+       "lv", "yi", "die", "xie", "xian", "wei", "biao", "cao", "ji", "qiang",
+       "sen", "bao", "xiang", "bi", "fu", "jian", "zhuan", "jian", "cui", "ji",
+       "dan", "za", "fan", "bo", "xiang", "xin", "bie", "rao", "man", "lan",
+       "ao", "ze", "gui", "cao", "sui", "nong", "chan", "lian", "bi", "jin",
+       "dang", "shu", "tan", "bi", "lan", "fu", "ru", "zhi", "ta", "shu",
+       "wa", "shi", "bai", "xie", "bo", "chen", "lai", "long", "xi", "xian",
+       "lan", "zhe", "dai", "ju", "zan", "shi", "jian", "pan", "yi", "lan",
+       "ya", "xi", "ya", "yao", "feng", "tan|qin", "fu", "fiao", "fu", "ba|po",
+       "he", "ji", "ji", "jian|xian", "guan", "bian", "yan", "gui", "jue|jiao", "pian",
+       "mao", "mi", "mi", "pie|mie", "shi", "si", "chan", "zhen", "jue|jiao", "mi",
+       "tiao", "lian", "yao", "zhi", "jun", "xi", "shan", "wei", "xi", "tian",
+       "yu", "lan", "e", "du", "qin|qing", "pang", "ji", "ming", "ying", "gou",
+       "qu", "zhan", "jin", "guan", "deng", "jian|bian", "luo|luan", "qu", "jian", "wei",
+       "jue|jiao", "qu", "luo", "lan", "shen", "di", "guan", "jian|xian", "guan", "yan",
+       "gui", "mi", "shi", "chan", "lan", "jue|jiao", "ji", "xi", "di", "tian",
+       "yu", "gou", "jin", "qu", "jiao|jue", "qiu", "jin", "cu", "jue", "zhi",
+       "chao", "ji", "gu", "dan", "zi|zui", "di", "shang", "hua|xie", "quan", "ge",
+       "shi", "jie|xie", "gui", "gong", "chu", "jie|xie", "hun", "qiu", "xing", "su",
+       "ni", "ji|qi", "jue", "zhi", "zha", "bi", "xing", "hu", "shang", "gong",
+       "zhi", "xue|hu", "chu", "xi", "yi", "li|lu", "jue", "xi", "yan", "xi",
+       "yan", "yan", "ding", "fu", "qiu", "qiu", "jiao", "hong", "ji", "fan",
+       "xun", "diao", "hong", "chai", "tao", "xu", "jie", "dan", "ren", "xun",
+       "yin", "shan", "qi", "tuo", "ji", "xun", "yin", "e", "fen", "ya",
+       "yao", "song", "shen", "yin", "xin", "jue", "xiao", "ne", "chen", "you",
+       "zhi", "xiong", "fang", "xin", "chao", "she", "yan", "sa", "zhun", "xu",
+       "yi", "yi", "su", "chi", "he", "shen", "he", "xu", "zhen", "zhu",
+       "zheng", "gou", "zi", "zi", "zhan", "gu", "fu", "jian", "die", "ling",
+       "di", "yang", "li", "nao", "pan", "zhou", "gan", "yi", "ju", "yao",
+       "zha", "tuo", "yi", "qu", "zhao", "ping", "bi", "xiong", "qu", "ba",
+       "da", "zu", "tao", "zhu", "ci", "zhe", "yong", "xu", "xun", "yi",
+       "huang", "he", "shi", "cha", "xiao", "shi", "hen", "cha", "gou", "gui",
+       "quan", "hui", "jie", "hua", "gai", "xiang", "wei", "shen", "chou", "tong",
+       "mi", "zhan", "ming", "luo", "hui", "yan", "xiong", "gua", "er", "bing",
+       "tiao|diao", "yi|chi", "lei", "zhu", "kuang", "kua", "wu", "yu", "teng", "ji",
+       "zhi", "ren", "cu", "lang", "e", "kuang", "ei|xi", "shi", "ting", "dan",
+       "bei|bo", "chan", "you", "keng", "qiao", "qin", "shua", "an", "yu", "xiao",
+       "cheng", "jie", "xian", "wu", "wu", "gao", "song", "bu", "hui", "jing",
+       "shuo|shui|yue", "zhen", "shuo|shui|yue", "du", "hua", "chang", "shui|shei", "jie", "ke", "qu|jue",
+       "cong", "xiao", "sui", "wang", "xian", "fei", "chi|lai", "ta", "yi", "ni|na",
+       "yin", "diao|tiao", "pi|bei", "zhuo", "chan", "chen", "zhun", "ji", "qi", "tan",
+       "zhui", "wei", "ju", "qing", "dong", "zheng", "ze|zuo|zha|cuo", "zou", "qian", "zhuo",
+       "liang", "jian", "chu|ji", "xia|hao", "lun", "shen", "biao", "hua", "bian", "yu",
+       "die", "xu", "pian", "shi|di", "xuan", "shi", "hun", "hua|gua", "e", "zhong",
+       "di", "xie", "fu", "pu", "ting", "jian", "qi", "yu", "zi", "zhuan",
+       "xi|shai|ai", "hui", "yin", "an", "xian", "nan", "chen", "feng", "zhu", "yang",
+       "yan", "huang", "xuan", "ge", "nuo", "xu", "mou", "ye", "wei", "xing",
+       "teng", "zhou", "shan", "jian", "bo", "kui", "huang", "huo", "ge", "ying",
+       "mi", "xiao", "mi", "xi", "qiang", "chen", "xue", "ti", "su", "bang",
+       "chi", "qian", "shi", "jiang", "yuan", "xie", "he", "tao", "yao", "yao",
+       "lu", "yu", "biao", "cong", "qing", "li", "mo", "mo", "shang", "zhe",
+       "miu", "jian", "ze", "jie", "lian", "lou", "can", "ou", "gun", "xi",
+       "zhuo", "ao", "ao", "jin", "zhe", "yi", "hu", "jiang", "man", "chao",
+       "han", "hua", "chan", "xu", "zeng", "se", "xi", "zha", "dui", "zheng",
+       "nao", "lan", "e", "ying", "jue", "ji", "zun", "jiao", "bo", "hui",
+       "zhuan", "wu", "zen", "zha", "shi", "qiao", "tan", "jian", "pu", "sheng",
+       "xuan", "zao", "tan", "dang", "sui", "xian", "ji", "jiao", "jing", "zhan",
+       "nong", "yi", "ai", "zhan", "pi", "hui", "hua", "yi", "yi", "shan",
+       "rang", "rou", "qian", "dui", "ta", "hu", "zhou", "hao", "ai", "ying",
+       "jian", "yu", "jian", "hui", "du", "zhe", "juan|xuan", "zan", "lei", "shen",
+       "wei", "chan", "li", "yi|tui", "bian", "zhe", "yan", "e", "chou", "wei",
+       "chou", "yao", "chan", "rang", "yin", "lan", "chen", "xie", "nie", "huan",
+       "zan", "yi", "dang", "zhan", "yan", "du", "yan", "ji", "ding", "fu",
+       "ren", "ji", "jie", "hong", "tao", "rang", "shan", "qi", "tuo", "xun",
+       "yi", "xun", "ji", "ren", "jiang", "hui", "ou", "ju", "ya", "ne",
+       "xu|hu", "e", "lun", "xiong", "song", "feng", "she", "fang", "jue", "zheng",
+       "gu", "he", "ping", "zu", "shi|zhi", "xiong", "zha", "su", "zhen", "di",
+       "zhou", "ci", "qu", "zhao", "bi", "yi", "yi|dai", "kuang", "lei", "shi",
+       "gua", "shi", "jie|ji", "hui", "cheng", "zhu", "shen", "hua", "dan", "gou",
+       "quan", "gui", "xun", "yi", "zheng", "gai", "xiang|yang", "cha", "hun", "xu",
+       "zhou|chou", "jie", "wu", "yu", "qiao", "wu", "gao", "you", "hui", "kuang",
+       "shuo|shui|yue", "song", "ei|xi", "qing", "zhu", "zou", "nuo", "du|dou", "zhuo", "fei",
+       "ke", "wei", "yu", "shui", "shen", "diao", "chan", "liang", "zhun", "sui",
+       "tan", "shen", "yi", "mou", "chen", "die", "huang", "jian", "xie", "xue",
+       "ye", "wei", "e", "yu", "xuan", "chan", "zi", "an", "yan", "di",
+       "mi", "pian", "xu", "mo", "dang", "su", "xie", "yao", "bang", "shi",
+       "qian", "mi", "jin", "man", "zhe", "jian", "miu", "tan", "zen", "qiao",
+       "lan", "pu", "jue", "yan", "qian", "zhan", "chen", "gu", "qian", "hong",
+       "xia", "ji", "hong", "han", "hong", "xi", "xi", "huo", "liao", "han",
+       "du", "long", "dou", "jiang", "qi", "chi", "li", "deng", "wan", "bi",
+       "shu", "xian", "feng", "zhi", "zhi", "yan", "yan", "shi", "chu", "hui",
+       "tun", "yi", "tun", "yi", "jian", "ba", "hou", "e", "chu", "xiang",
+       "huan", "jian", "ken", "gai", "ju", "fu", "xi", "bin", "hao", "yu",
+       "zhu", "jia", "fen", "xi", "hu", "wen", "huan", "bin", "di", "zong",
+       "fen", "yi", "zhi", "bao", "chai", "an", "pi", "na", "pi", "gou",
+       "na", "you", "diao", "mo", "si", "xiu", "huan", "ken|kun", "he|mo", "he|hao|mo",
+       "mo", "an", "mao", "li", "ni", "bi", "yu", "jia", "tuan", "mao",
+       "pi", "xi", "yi", "ju|lou", "mo", "chu", "tan", "huan", "jue", "bei",
+       "zhen", "yuan|yun", "fu", "cai", "gong", "dai", "yi", "hang", "wan", "pin",
+       "huo", "fan", "tan", "guan", "ze|zhai", "zhi", "er", "zhu", "shi", "bi",
+       "zi", "er", "gui", "pian", "bian", "mai", "dai|te", "sheng", "kuang", "fei",
+       "tie", "yi", "chi", "mao", "he", "bi|ben", "lu", "lin", "hui", "gai",
+       "pian", "zi", "jia|gu", "xu", "zei", "jiao", "gai", "zang", "jian", "ying",
+       "jun", "zhen", "she", "bin", "bin", "qiu", "she", "chuan", "zang", "zhou",
+       "lai", "zan", "ci", "chen", "shang", "tian", "pei", "geng", "xian", "mai",
+       "jian", "sui", "fu", "dan", "cong", "cong", "zhi", "lai", "zhang", "du",
+       "jin", "xiong|min", "chun", "yun", "bao", "zai", "lai", "feng", "cang", "ji",
+       "sheng", "ai", "zhuan|zuan", "fu", "gou", "sai", "ze", "liao", "yi", "bai",
+       "chen", "wan", "zhi", "zhui", "biao", "yun", "zeng", "dan", "zan", "yan",
+       "pu", "shan", "wan", "ying", "jin", "gan", "xian", "zang", "bi", "du",
+       "shu", "yan", "shang", "xuan", "long", "gan", "zang", "bei", "zhen", "fu",
+       "yuan", "gong", "cai", "ze", "xian", "bai", "zhang", "huo", "zhi", "fan",
+       "tan", "pin", "bian", "gou", "zhu", "guan", "er", "jian", "bi", "shi",
+       "tie", "gui", "kuang", "dai", "mao", "fei", "he", "yi", "zei", "zhi",
+       "jia|gu", "hui", "zi", "lin", "lu", "zang", "zi", "gai", "jin", "qiu",
+       "zhen", "lai", "she", "fu", "du", "ji", "shu", "shang", "ci", "bi",
+       "zhou", "geng", "pei", "dan", "lai", "feng", "zhui", "fu", "zhuan", "sai",
+       "ze", "yan", "zan", "yun", "zeng", "shan", "ying", "gan", "chi", "xi",
+       "she", "nan", "tong", "xi", "cheng", "he", "cheng", "zhe", "xia", "tang",
+       "zou", "zou", "li", "jiu", "fu", "zhao", "gan", "qi", "shan", "qiong",
+       "yin", "xian", "zi", "jue", "qin", "chi", "ci", "chen", "chen", "die|tu",
+       "qie|ju", "chao", "di", "xi", "zhan", "jue", "yue", "qu|cu", "ji|jie", "qu",
+       "chu", "gua|huo", "xue", "zi", "tiao", "duo", "lie", "gan", "suo", "cu",
+       "xi", "zhao", "su", "yin", "ju", "jian", "que|qi|ji", "tang", "chuo", "cui",
+       "lu", "qu|cu", "dang", "qiu", "zi", "ti", "qu|cu", "chi", "huang", "qiao",
+       "qiao", "jiao", "zao", "ti|yue", "er", "zan", "zan", "zu", "pa", "bao|bo",
+       "kua|wu", "ke", "dun", "jue|gui", "fu", "chen", "jian", "fang|pang", "zhi", "ta",
+       "yue", "ba|pao", "qi", "yue", "qiang", "tuo", "tai", "yi", "jian|chen", "ling",
+       "mei", "ba", "die", "ku", "tuo", "jia", "ci", "pao", "qia", "zhu",
+       "ju", "dian|tie|die", "zhi", "fu", "pan|ban", "ju|qie", "shan", "bo", "ni", "ju",
+       "li|luo", "gen", "yi", "ji", "dai|duo|chi", "xian", "jiao", "duo", "zhu", "quan",
+       "kua", "zhuai", "gui", "qiong", "kui", "xiang", "die", "lu", "pian|beng", "zhi",
+       "jie", "tiao|tao", "cai", "jian", "da", "qiao", "bi", "xian", "duo", "ji",
+       "ju", "ji", "shu|chou", "tu", "chuo", "jing", "nie", "xiao", "bu", "xue",
+       "qun", "mu", "shu", "liang", "yong", "jiao", "chou", "qiao", "mou", "ta",
+       "jian", "ji", "wo", "wei", "chuo", "jie", "ji", "nie", "ju", "nie",
+       "lun", "lu", "leng", "huai", "ju", "chi", "wan", "quan", "ti", "bo",
+       "zu", "qie", "qi", "cu", "zong", "cai", "zong", "peng", "zhi", "zheng",
+       "dian", "zhi", "yu", "duo", "dun", "chuan", "yong", "zhong", "di", "zhe",
+       "chen", "chuai", "jian", "gua", "tang", "ju", "fu", "cu", "die", "pian",
+       "rou", "nuo", "ti", "cha", "tui", "jian", "dao", "cuo", "xi", "ta",
+       "qiang", "nian", "dian", "ti", "ji", "nie", "pan", "liu", "zan", "bi",
+       "chong", "lu", "liao", "cu", "tang", "dai", "su", "xi", "kui", "ji",
+       "zhi", "qiang", "di", "pan", "zong", "lian", "beng", "zao", "nian", "bie",
+       "tui", "ju", "deng", "ceng", "xian", "fan", "chu", "zhong", "dun", "bo",
+       "cu", "cu", "jue", "jue", "lin", "ta", "qiao", "qiao", "pu", "liao",
+       "dun", "cuan", "guan", "zao", "ta", "bi", "bi", "zhu", "ju", "chu",
+       "qiao", "dun", "chou", "ji", "wu", "yue", "nian", "lin", "lie", "zhi",
+       "li|luo", "zhi", "chan", "chu", "duan", "wei", "long", "lin", "xian", "wei",
+       "zuan", "lan", "xie", "rang", "sa|xie", "nie", "ta", "qu", "ji", "cuan",
+       "zuan", "xi", "kui", "jue", "lin", "shen", "gong", "dan", "fen", "qu",
+       "ti", "duo", "duo", "gong", "lang", "ren", "luo", "ai", "ji", "ju",
+       "tang", "kong", "lao", "yan", "mei", "kang", "qu", "lou", "lao", "duo",
+       "zhi", "yan", "ti", "dao", "ying", "yu", "che|ju", "ya|zha|ga", "gui", "jun",
+       "wei", "yue", "xin|xian", "dai", "xuan", "fan|gui", "ren", "shan", "kuang", "shu",
+       "tun", "chen", "dai", "e", "na", "qi", "mao", "ruan", "kuang", "qian",
+       "zhuan", "hong", "hu", "qu", "kuang", "di", "ling", "dai", "ao", "zhen",
+       "fan", "kuang", "yang", "peng", "bei", "gu", "gu", "pao", "zhu", "rong",
+       "e", "ba", "zhou", "zhi", "yao", "ke", "yi", "qing", "shi", "ping",
+       "er", "gong", "ju", "jiao", "guang", "lu", "kai", "quan", "zhou", "zai",
+       "zhi", "she", "liang", "yu", "shao", "you", "wan", "yin", "zhe", "wan",
+       "fu", "qing", "zhou", "ni", "ling", "zhe", "han", "liang", "zi", "hui",
+       "wang", "chuo", "guo", "kan", "yi", "peng", "qian", "gun", "nian", "ping",
+       "guan", "bei", "lun", "pai", "liang", "ruan", "rou", "ji", "yang", "xian",
+       "chuan", "cou", "chun", "ge", "you", "hong", "shu", "fu", "zi", "fu",
+       "wen", "fan", "zhan", "yu", "wen", "tao", "gu", "zhen", "xia", "yuan",
+       "lu", "jiao", "chao", "zhuan", "wei", "hun", "xue", "zhe", "jiao", "zhan",
+       "bu", "lao", "fen", "fan", "lin", "ge", "se", "kan", "huan", "yi",
+       "ji", "dui", "er", "yu", "jian", "hong", "lei", "pei", "li", "li",
+       "lu", "lin", "che", "ya", "gui", "xuan", "dai", "ren", "zhuan", "e",
+       "lun", "ruan", "hong", "gu", "ke", "lu", "zhou", "zhi", "yi", "hu",
+       "zhen", "li", "yao", "qing", "shi", "zai", "zhi", "jiao", "zhou", "quan",
+       "lu", "jiao", "zhe", "fu", "liang", "nian", "bei", "hui", "gun", "wang",
+       "liang", "chuo", "zi", "cou", "fu", "ji", "wen", "shu", "pei", "yuan",
+       "xia", "zhan|nian", "lu", "zhe", "lin", "xin", "gu", "ci", "ci", "bi|pi",
+       "zui", "bian", "la", "la", "ci", "xue", "ban", "bian", "bian", "bian",
+       "xue", "bian", "ban", "ci", "bian", "bian", "chen", "ru", "nong", "nong",
+       "zhen", "chuo", "chuo", "yi", "reng", "bian", "dao|bian", "shi", "yu", "liao",
+       "da", "chan", "gan", "qian", "yu", "yu", "qi", "xun", "yi", "guo",
+       "mai", "qi", "bi", "wang|kuang", "tu", "zhun", "ying", "da", "yun", "jin",
+       "hang", "ya", "fan", "wu", "da", "e", "huan|hai", "zhe|zhei", "da", "jin",
+       "yuan", "wei", "lian", "chi", "che", "chi", "tiao", "zhi|li", "yi", "jiong",
+       "jia", "chen", "dai", "er", "di", "po|pai", "zhu|wang", "die", "ze", "tao",
+       "shu", "yi", "keop", "jing", "hui", "dong", "you", "mi", "beng", "ji",
+       "nai", "yi", "jie", "zhui|dui", "lie", "xun", "tui", "song", "kuo", "tao",
+       "pang", "hou", "ni", "dun", "jiong", "xuan", "xun", "bu", "you", "xiao",
+       "qiu", "tou", "zhu", "qiu", "di", "di", "tu", "jing", "ti", "dou",
+       "yi", "zhe", "tong", "guang", "wu", "shi", "cheng", "su", "zao", "qun",
+       "feng", "lian", "suo", "hui", "li", "gu", "lai", "ben", "cuo", "zhu",
+       "beng", "huan", "dai", "lu", "you", "zhou", "jin", "yu", "chuo", "kui",
+       "wei", "ti", "yi", "da", "yuan", "luo", "bi", "nuo", "yu", "dang",
+       "sui", "dun", "sui", "yan", "chuan", "chi", "di", "yu", "shi", "zhen",
+       "you", "yun", "e", "bian", "guo", "e", "xia", "huang", "qiu", "dao",
+       "da", "wei", "nan", "yi", "gou", "yao", "chou", "liu", "xun", "ta",
+       "di", "chi", "yuan", "su", "ta", "qian", "ma", "yao", "guan", "zhang",
+       "ao", "shi", "ca", "chi", "su", "zao", "zhe", "dun", "di", "lou",
+       "chi", "cuo", "lin", "zun", "rao", "qian", "xuan", "yu", "wei", "e",
+       "liao", "ju", "shi", "bi", "yao", "mai", "xie", "sui", "huan|hai", "zhan",
+       "teng", "er", "miao", "bian", "bian", "la", "li|chi", "yuan", "yao", "luo",
+       "li", "yi", "ting", "deng", "qi", "yong", "shan", "han", "yu", "mang",
+       "ru", "qiong", "xi", "kuang", "fu", "kang|hang", "bin", "fang", "xing", "na|nei",
+       "xin", "shen", "bang", "yuan", "cun", "huo", "xie|ya|ye|yu|xu", "bang", "wu", "ju",
+       "you", "han", "tai", "qiu", "bi", "pi", "bing", "shao", "bei", "wa",
+       "di", "zou", "ye", "lin", "kuang", "gui", "zhu", "shi", "ku", "yu",
+       "gai|hai", "he", "qie|xi", "zhi", "ji", "xun|huan", "hou", "xing", "jiao", "xi",
+       "gui", "na", "lang", "jia", "kuai", "zheng", "lang", "yun", "yan", "cheng",
+       "dou", "chi", "lv", "fu", "wu", "fu", "gao", "hao", "lang", "jia",
+       "geng", "jun", "ying", "bo", "xi", "bei", "li|zhi", "yun", "bu", "xiao|ao",
+       "qi", "pi", "qing", "guo", "zhou", "tan", "zou", "ping", "lai", "ni",
+       "chen", "you", "bu", "xiang", "dan", "ju", "yong", "qiao", "yi", "du|dou",
+       "yan", "mei", "ruo", "bei", "e", "shu", "juan", "yu", "yun", "hou",
+       "kui", "xiang", "xiang", "sou", "tang", "ming", "xi", "ru", "chu", "zi",
+       "zou", "yi", "wu", "xiang", "yun", "hao", "yong", "bi", "mao", "chao",
+       "fu", "liao", "yin", "zhuan", "hu", "qiao", "yan", "zhang", "man", "qiao",
+       "xu", "deng", "bi", "xun", "bi", "zeng", "wei", "zheng", "mao", "shan",
+       "lin", "po", "dan", "meng", "ye", "cao", "kuai", "feng", "meng", "zou",
+       "kuang", "lian", "zan", "chan", "you", "qi", "yan", "chan", "cuo", "ling",
+       "huan", "xi", "feng", "cuo", "li", "you", "ding", "qiu", "zhuo", "pei",
+       "zhou", "yi", "gan", "yu", "jiu", "yan", "zui", "mao", "dan", "xu",
+       "dou", "zhen", "fen", "yuan", "fu", "yun", "tai", "tian", "qia", "tuo",
+       "cu", "han", "gu", "su", "fa", "chou", "zai", "ming", "lao", "chuo",
+       "chou", "you", "tong", "zhi", "xian", "jiang", "cheng", "yin", "tu", "jiao",
+       "mei", "ku", "suan", "lei", "pu", "zui", "hai", "yan", "shai", "niang",
+       "wei", "lu", "lan", "yan", "tao", "pei", "zhan", "chun", "tan|dan", "zui",
+       "zhui", "cu", "kun", "ti", "xian", "du", "hu", "xu", "xing", "tan",
+       "qiu|chou", "chun", "yun", "fa", "ke", "sou", "mi", "quan", "chou", "cuo",
+       "yun", "yong", "ang", "zha", "hai", "tang", "jiang", "piao", "chan|chen", "yu",
+       "li", "zao", "lao", "yi", "jiang", "bu", "jiao", "xi", "tan", "po|fa",
+       "nong", "yi|shi", "li", "ju", "yan|lian|xian", "yi", "niang", "ru", "xun", "chou",
+       "yan", "ling", "mi", "mi", "niang", "xin", "jiao", "shi", "mi", "yan",
+       "bian", "cai", "shi", "you", "shi", "shi", "li", "zhong|chong", "ye", "liang",
+       "li", "jin", "jin", "ga", "yi", "liao", "dao", "zhao", "ding", "po",
+       "qiu", "he", "fu", "zhen", "zhi", "ba", "luan", "fu", "nai", "diao",
+       "shan", "qiao|jiao", "kou", "chuan", "zi", "fan", "hua|yu", "hua|wu", "han", "gang",
+       "qi", "mang", "ri|ren|jian", "di|dai", "si", "xi", "yi", "chai", "shi|yi", "tu",
+       "xi", "nv", "qian", "qiu", "ri|ren|jian", "pi|zhao", "ye|ya", "jin", "ba", "fang",
+       "chen", "xing", "dou", "yue", "qian", "fu", "bu", "na", "xin", "e",
+       "jue", "dun", "gou", "yin", "qian", "ban", "sa", "ren", "chao", "niu",
+       "fen", "yun", "yi", "qin", "pi", "guo", "hong", "yin", "jun", "diao",
+       "yi", "zhong", "xi", "gai", "ri", "huo", "tai", "kang", "yuan", "lu",
+       "e", "qin", "duo", "zi", "ni", "tu", "shi", "min", "gu", "ke",
+       "ling", "bing", "si", "gu", "bo", "pi", "yu", "si", "zuo", "bu",
+       "you", "dian", "jia", "zhen", "shi", "shi", "tie", "ju", "zuan", "shi",
+       "ta", "xuan", "zhao", "bao", "he", "bi", "sheng", "chu", "shi", "bo",
+       "zhu", "chi", "za", "po", "tong", "qian", "fu", "zhai", "mao", "qian",
+       "fu", "li", "yue", "pi", "yang", "ban", "bo", "jie", "gou", "shu",
+       "zheng", "mu", "xi", "xi", "di", "jia", "mu", "tan", "shen", "yi",
+       "si", "kuang", "ka", "bei", "jian", "tong", "xing", "hong", "jiao", "chi",
+       "er", "ge", "bing", "shi", "mao", "ha", "yin", "jun", "zhou", "chong",
+       "xiang|jiong", "tong", "mo", "lei", "ji", "yu|si", "xu|hui", "ren", "zun", "zhi",
+       "qiong", "shan|shuo", "chi|li", "xian|xi", "xing", "quan", "pi", "tie", "zhu", "hou|xiang",
+       "ming", "kua", "diao|tiao|yao", "xian|kuo|tian|gua", "xian", "xiu", "jun", "cha", "lao", "ji",
+       "pi", "ru", "mi", "yi", "yin", "guang", "an", "diu", "you", "se",
+       "kao", "qian", "luan", "si", "ng", "diao", "han", "rui", "shi|zhi", "keng",
+       "qiu", "xiao", "zhe|nie", "xiu", "zang", "ti", "cuo", "xian|kuo|tian|gua", "hong|gong", "zhong|yong",
+       "tou|tu|dou", "lv", "mei|meng", "lang", "wan|jian", "xin", "yun|jun", "bei", "wu", "su",
+       "yu", "chan", "ting|ding", "bo", "han", "jia", "hong", "juan|jian|cuan", "feng", "chan",
+       "wan", "zhi", "si", "xuan|juan", "hua|wu", "wu", "tiao", "kuang", "zhuo|chuo", "lve",
+       "xing|jing", "qin", "shen", "han", "lve", "ye", "chu", "zeng", "ju", "xian",
+       "e", "mang", "pu", "li", "pan", "rui", "cheng", "gao", "li", "te",
+       "bing", "zhu", "zhen", "tu", "liu", "zui|nie", "ju", "chang", "yuan|wan", "jian",
+       "gang", "diao", "tao", "shang", "lun", "ke", "ling", "pi", "lu", "li",
+       "qing", "pei", "juan", "min", "zui", "peng", "an", "pi", "xian", "ya",
+       "zhui", "lei", "a", "kong", "ta", "kun", "du", "nei", "chui", "zi",
+       "zheng", "ben", "nie", "cong", "chun", "tan", "ding", "qi", "qian", "zhui",
+       "ji", "yu", "jin", "guan", "mao", "chang", "tian", "xi", "lian", "diao",
+       "gu", "cuo", "shu", "zhen", "lu", "meng", "lu", "hua", "biao", "ga",
+       "lai", "ken", "fang", "bu", "nai", "wan", "zan", "hu", "de", "xian",
+       "uu", "huo", "liang", "fa", "men", "kai", "yang", "chi", "lian", "guo",
+       "xian", "du", "tu", "wei", "zong", "fu", "rou", "ji", "e", "jun",
+       "chen", "ti", "zha", "hu", "yang", "duan", "xia", "yu", "keng", "sheng",
+       "huang", "wei", "fu", "zhao", "cha", "qie", "shi", "hong", "kui", "nuo",
+       "mou", "qiao", "qiao", "hou", "tou", "cong", "huan", "ye", "min", "jian",
+       "duan", "jian", "si", "kui", "hu", "xuan", "zhe", "jie", "zhen", "bian",
+       "zhong", "zi", "xiu", "ye", "mei", "pai", "ai", "jie", "qian", "mei",
+       "cuo|cha", "da|ta", "bang", "xia", "lian", "suo|se", "kai", "liu", "yao|zu", "ye|ta|ge",
+       "nou", "weng", "rong", "tang", "suo", "qiang|cheng", "ge|li", "shuo", "chui", "bo",
+       "pan", "da", "bi|pi", "sang", "gang", "zi", "wu", "ying", "huang", "tiao",
+       "liu", "kai", "sun", "sha", "sou", "wan|jian", "gao|hao", "zhen", "zhen", "lang",
+       "yi", "yuan", "tang", "nie", "xi", "jia", "ge", "ma", "juan", "song",
+       "zu", "suo", "xia", "feng", "wen", "na", "lu", "suo", "ou", "zu|chuo",
+       "tuan", "xiu", "guan", "xuan", "lian", "shou|sou", "ao", "man", "mo", "luo",
+       "bi", "wei", "liu", "di", "san|qiao|can", "cong", "yi", "lu|ao", "ao", "keng",
+       "qiang", "cui", "qi", "shang", "tang", "man", "yong", "chan", "feng", "jing",
+       "biao", "shu", "lou", "xiu", "cong", "long", "zan", "jian|zan", "cao", "li",
+       "xia", "xi", "kang", "shuang", "beng", "zhang", "qian", "zheng", "lu", "hua",
+       "ji", "pu", "hui|sui|rui", "qiang", "po", "lin", "se", "xiu", "san|xian|sa", "cheng",
+       "gui", "si", "liu", "nao", "huang", "pie", "sui", "fan", "qiao", "quan",
+       "xi", "tang", "xiang", "jue", "jiao", "zun", "liao", "qi", "lao", "dui",
+       "xin", "zan", "ji", "jian", "zhong", "deng", "ya", "ying", "dui", "jue",
+       "nou", "zan", "pu", "tie", "uu", "cheng", "ding", "shan", "kai", "jian",
+       "fei", "sui", "lu", "juan", "hui", "yu", "lian", "zhuo", "qiao", "jian",
+       "zhuo", "lei", "bi", "tie", "huan", "ye", "duo", "guo", "dang", "ju",
+       "fen", "da", "bei", "yi", "ai", "zong", "xun", "diao", "zhu", "heng",
+       "zhui", "ji", "nie", "he", "huo", "qing", "bin", "ying", "gui", "ning",
+       "xu", "jian", "jian", "qian", "cha", "zhi", "mie", "li", "lei", "ji",
+       "zuan", "kuang", "shang", "peng", "la", "du", "shuo", "chuo", "lv", "biao",
+       "pao", "lu", "xian", "kuan", "long", "e", "lu", "xin", "jian", "lan",
+       "bo", "jian", "yao", "chan", "xiang", "jian", "xi", "guan", "cang", "nie",
+       "lei", "cuan", "qu", "pan", "luo", "zuan", "luan", "zao", "nie", "jue",
+       "tang", "zhu", "lan", "jin", "ga", "yi", "zhen", "ding", "zhao", "po",
+       "liao", "tu", "qian", "chuan", "shan", "sa|xi", "fan", "diao", "men", "nv",
+       "yang", "chai", "xing", "gai", "bu", "tai", "ju", "dun", "chao", "zhong",
+       "na", "bei", "gang", "ban", "qian", "yue|yao", "qin", "jun", "wu", "gou",
+       "kang", "fang", "huo", "dou", "niu", "ba|pa", "yu", "qian", "zheng", "qian",
+       "gu", "bo", "ke", "po", "bu", "bo", "yue", "zuan", "mu", "tan",
+       "jia", "dian|tian", "you", "tie", "bo", "ling", "shuo", "qian|yan", "mao", "bao",
+       "shi", "xuan", "ta|tuo", "bi", "ni", "pi", "duo", "xing", "kao", "lao",
+       "er", "mang", "ya", "you", "cheng", "jia", "ye", "nao", "zhi", "dang|cheng",
+       "tong", "lv", "diao", "yin", "kai", "zha", "zhu", "xian|xi", "ting|ding", "diu",
+       "xian|kuo|tian|gua", "hua", "quan", "sha", "ha|ke", "diao|tiao|yao", "ge", "ming", "zheng", "se",
+       "jiao", "yi", "chan", "chong", "tang", "an", "yin", "ru", "zhu", "lao",
+       "pu", "wu", "lai", "te", "lian", "keng", "xiao", "suo", "li", "zeng",
+       "chu", "guo", "gao", "e", "xiu", "cuo", "lve", "feng", "xin", "liu",
+       "kai", "jian", "rui", "ti", "lang", "qin", "ju", "a", "qiang", "zhe",
+       "nuo", "cuo", "mao", "ben", "qi", "de", "ke", "kun", "chang", "xi",
+       "gu", "luo", "chui", "zhui", "jin", "zhi", "xian", "juan", "huo", "pei",
+       "tan", "ding", "jian", "ju", "meng", "zi", "qie", "ying", "kai", "qiang",
+       "si", "e", "cha", "qiao", "zhong", "duan", "sou", "huang", "huan", "ai",
+       "du", "mei", "lou", "zi", "fei", "mei", "mo", "zhen", "bo", "ge",
+       "nie", "tang", "juan", "nie", "na", "liu", "gao", "bang", "yi", "jia",
+       "bin", "rong", "biao", "tang", "man", "luo", "beng", "yong", "jing", "di",
+       "zu", "xuan", "liu", "xin", "jue", "liao", "pu", "lu", "dui", "lan",
+       "pu", "cuan", "qiang", "deng", "huo", "lei", "huan", "zhuo", "lian", "yi",
+       "cha", "biao", "la", "chan", "xiang", "chang", "chang", "jiu", "ao", "die",
+       "jie", "liao", "mi", "chang|zhang", "men", "ma", "shuan", "shan", "huo|shan", "men",
+       "yan", "bi", "han|bi", "bi", "ci ka Bi lu", "kai", "kang", "beng", "hong", "run",
+       "san", "xian", "xian|jian", "jian", "min", "xia", "lao", "dou", "zha", "nao",
+       "zhan", "peng", "xia|ke", "ling", "bian|guan", "bi", "run", "he", "guan", "ge",
+       "he", "fa", "chu", "hong|xiang", "gui", "min", "se", "kun", "lang", "lv",
+       "ting", "sha", "ju", "yue", "yue", "chan", "qu", "lin", "chang", "sha",
+       "kun", "yan", "wen", "yan", "e|yan", "hun", "yu", "wen", "hong", "bao",
+       "hong|juan|xiang", "qu", "yao", "wen", "ban|pan", "an", "wei", "yin", "kuo", "que",
+       "lan", "du", "quan", "pBi ying|po he deng", "tian", "nie", "ta", "kai", "he", "que",
+       "chuang", "guan", "dou", "qi", "kui", "tang|chang", "guan", "piao", "kan|han", "xi|se|ta",
+       "hui", "chan", "bi", "dang", "huan", "ta", "wen", "ta", "men", "shuan",
+       "shan", "yan", "han|bi", "bi", "wen", "chuang", "run", "wei", "xian", "hong",
+       "jian", "min", "kang", "men", "zha", "nao", "gui", "wen", "ta", "min",
+       "lv", "kai", "fa", "ge", "he", "kun", "jiu", "yue", "lang", "du",
+       "yu", "yan", "chang", "xi", "wen", "hun", "yan", "e", "chan", "lan",
+       "qu", "hui", "kuo", "que", "he", "tian", "ta", "que", "kan|han", "huan",
+       "fu", "fu", "le", "dui", "xin", "qian", "wu", "yi", "tuo", "yin",
+       "yang", "dou", "e", "sheng", "ban", "pei", "keng", "yun", "ruan", "zhi",
+       "pi", "jing", "fang", "yang", "yin", "zhen", "jie", "cheng", "e", "qu",
+       "di", "zu", "zuo", "dian", "lin", "a", "tuo", "tuo", "bei", "bing",
+       "fu", "ji", "lu", "long", "chen", "xing", "duo", "lou", "mo", "jiang",
+       "shu", "duo", "xian", "er", "gui", "yu", "gai", "shan", "jun", "qiao",
+       "xing", "chun", "wu", "bi", "xia", "shan", "sheng", "zhi", "pu", "dou",
+       "yuan", "zhen", "chu", "xian", "dao", "nie", "yun", "xian", "pei", "fei",
+       "zou", "qi", "dui", "lun", "yin", "ju", "chui", "chen", "pi", "ling",
+       "tao", "xian", "lu", "sheng", "xian", "yin", "zhu", "yang", "reng", "xia",
+       "chong", "yan", "yin", "yu|yao|shu", "di", "yu", "long", "wei", "wei", "nie",
+       "dui|zhui", "sui|duo", "an", "huang", "jie", "sui", "yin", "qi|gai|ai", "yan", "hui|duo",
+       "ge", "yun", "wu", "wei|kui", "ai", "xi", "tang", "ji", "zhang", "dao",
+       "ao", "xi", "yin", "sa", "rao", "lin", "tui", "deng", "pi", "sui",
+       "sui", "ao|yu", "xian", "fen", "ni", "er", "ji", "dao", "xi", "yin",
+       "zhi", "hui|duo", "long", "xi", "li|dai", "li|dai", "li|dai", "zhui|cui|wei", "hu|he", "zhi",
+       "sun", "jun|juan", "nan|nuo", "yi", "que|qiao", "yan", "qin", "jian", "xiong", "ya",
+       "ji", "gu", "huan", "zhi", "gou", "jun|juan", "ci", "yong", "ju", "chu",
+       "hu", "za", "luo", "yu", "chou", "diao", "sui", "han", "huo", "shuang",
+       "guan|huan", "chu", "za", "yong", "ji", "gui|xi", "chou", "liu", "li", "nan|nuo",
+       "yu", "za", "chou", "ji", "yu", "yu", "xue", "na", "fou", "se|xi",
+       "mu", "wen", "fen", "pang", "yun", "li", "chi", "yang", "ling", "lei",
+       "an", "bao", "wu|meng", "dian", "dang", "hu", "wu", "diao", "xu", "ji",
+       "mu", "chen", "xiao", "zha", "ting", "zhen", "pei", "mei", "ling", "qi",
+       "zhou", "huo", "sha", "fei", "hong", "zhan", "yin", "ni", "shu", "tun",
+       "lin", "ling", "dong", "ying", "wu", "ling", "shuang", "ling", "xia", "hong",
+       "yin", "mai", "mai", "yun", "liu", "meng", "bin", "wu", "wei", "kuo",
+       "yin", "xi", "yi", "ai", "dan", "teng", "xian", "yu", "lu", "long",
+       "dai", "ji", "pang", "yang", "ba", "pi", "wei", "uu", "xi", "ji",
+       "mai", "meng", "meng", "lei", "li", "huo", "ai", "fei", "dai", "long",
+       "ling", "ai", "feng", "li", "bao", "he", "he", "he", "bing", "qing",
+       "qing", "liang", "tian", "zheng", "jing", "cheng", "qing", "jing", "liang", "dian",
+       "jing", "tian", "fei", "fei", "kao", "mi", "mian", "mian", "pao", "ye",
+       "mian", "hui", "ye", "ge", "ding", "cha", "jian", "ren", "di", "du",
+       "wu", "ren", "qin", "jin", "xue", "niu", "ba", "yin", "sa", "na",
+       "mo", "zu", "da", "ban", "xie", "yao", "tao", "bei", "jie", "hong",
+       "pao", "yang", "bing", "yin", "ge|ta|sa", "tao", "jie|ji", "xie", "an", "an",
+       "hen", "gong", "qia", "da", "qiao", "ting", "man|men", "bian|ying", "sui", "tiao",
+       "qiao|shao", "xuan|juan", "kong", "beng", "ta", "shang|zhang", "bing|pi|bi|bei", "kuo", "ju", "la",
+       "xie|die", "rou", "bang", "eng", "qiu", "qiu", "he", "qiao", "mu|mou", "ju",
+       "jian", "bian", "di", "jian", "wen|yun", "tao", "gou", "ta", "bei", "xie",
+       "pan", "ge", "bi|bing", "kuo", "tang", "lou", "gui", "qiao", "xue", "ji",
+       "jian", "jiang", "chan", "da", "huo", "xian", "qian", "du", "wa", "jian",
+       "lan", "wei", "ren", "fu", "mei|wa", "quan", "ge", "wei", "qiao", "han",
+       "chang", "kuo", "rou", "yun", "she|xie", "wei", "ge", "bai", "tao", "gou",
+       "yun", "gao", "bi", "wei", "sui", "du", "wa", "du", "wei", "ren",
+       "fu", "han", "wei", "yun|wen", "tao", "jiu", "jiu", "xian", "xie", "xian",
+       "ji", "yin", "za", "yun", "shao", "le", "peng", "huang", "ying", "yun",
+       "peng", "an", "yin", "xiang", "hu", "ye", "ding", "qing", "qiu", "xiang",
+       "shun", "han", "xu", "yi", "xu", "e", "song", "kui", "qi", "hang",
+       "yu", "wan", "ban", "dun", "di", "dan", "pan", "po", "ling", "che",
+       "jing", "lei", "he", "qiao", "e", "e", "wei", "jie", "kuo", "shen",
+       "yi", "yi", "ke", "dui", "yu", "ping", "lei", "fu", "jia", "tou",
+       "hui", "kui", "jia", "luo", "ting", "cheng", "ying", "jun", "hu", "han",
+       "geng", "tui", "tui", "bin", "lai", "tui", "zi", "zi", "chui", "ding",
+       "lai", "tan", "han", "qian", "ke", "cui", "jiong", "qin", "yi", "sai",
+       "ti", "e", "e", "yan", "wen", "kan", "yong", "zhuan", "yan", "xian",
+       "xin", "yi", "yuan", "sang", "dian", "dian", "jiang", "kui", "lei", "lao",
+       "piao", "wai", "man", "cu", "yao", "hao", "qiao", "gu", "xun", "yan",
+       "hui", "chan", "ru", "meng", "bin", "xian", "pin", "lu", "lan", "nie",
+       "quan", "ye", "ding", "qing", "han", "xiang", "shun", "xu", "xu", "wan",
+       "gu", "dun", "qi", "ban", "song", "hang", "yu", "lu", "ling", "po",
+       "jing|geng", "jie|xie|jia", "jia", "ting", "he|ge", "ying", "jiong", "ke", "yi", "pin|bin",
+       "hui", "tui", "han", "ying", "ying", "ke", "ti", "yong", "e", "zhuan",
+       "yan", "e", "nie", "man", "dian", "sang", "hao", "lei", "chan|zhan", "ru",
+       "pin", "quan", "feng", "biao|diu", "gua", "fu", "xia", "zhan", "biao", "sa",
+       "ba|fu", "tai", "lie", "gua", "xuan", "xiao", "ju", "biao", "si", "wei",
+       "yang", "yao", "sou", "kai", "sao|sou", "fan", "liu", "xi", "liu|liao", "piao",
+       "piao", "liu", "biao", "biao", "biao", "liao", "biao", "se", "feng", "xiu",
+       "feng", "yang", "zhan", "biao", "sa", "ju", "si", "sou", "yao", "liu",
+       "piao", "biao", "biao", "fei", "fan", "fei", "fei", "shi|si|yi", "shi", "can",
+       "ji", "ding", "si", "tuo", "zhan", "sun", "xiang", "tun", "ren", "yu",
+       "yang|juan", "chi", "yin", "fan", "fan", "sun", "yin", "zhu|tou", "si", "zuo|ze|zha",
+       "bi", "jie", "tao", "bao", "ci", "tie", "si", "bao", "shi", "duo",
+       "hai", "ren", "tian", "jiao", "he", "bing", "yao", "tong", "ci", "xiang",
+       "yang", "juan", "er", "yan", "le", "xi", "can", "bo", "nei", "e",
+       "bu", "jun", "dou", "su", "yu", "shi", "yao", "hun", "guo", "shi",
+       "jian", "chuo", "bing", "xian", "bu", "ye", "dan", "fei", "zhang", "wei",
+       "guan", "e", "nuan", "yun", "hu", "huang", "tie", "hui", "jian", "hou",
+       "ai", "xing", "fen", "wei", "gu", "cha", "song", "tang", "bo", "gao",
+       "xi", "kui", "liu", "sou", "tao", "ye", "wen", "mo", "tang", "man",
+       "bi", "yu", "xiu", "jin", "san", "kui", "zhuan", "shan", "xi", "dan",
+       "yi", "ji", "rao", "cheng", "yong", "tao", "wei", "xiang", "zhan", "fen",
+       "hai", "meng", "yan", "mo", "chan", "xiang", "luo", "zan", "nang", "shi",
+       "ding", "ji", "tuo", "xing", "tun", "xi", "ren", "yu", "chi", "fan",
+       "yin", "jian", "shi", "bao", "si", "duo", "yi", "er", "rao", "xiang",
+       "he", "ge", "jiao", "xi", "bing", "bo", "dou", "e", "yu", "nei",
+       "jun", "guo", "hun", "xian", "guan", "cha", "kui", "gu", "sou", "chan",
+       "ye", "mo", "bo", "liu", "xiu", "jin", "man", "san", "zhuan", "nang",
+       "shou", "kui", "guo", "xiang", "fen", "bo", "ni", "bi", "bo", "tu",
+       "han", "fei", "jian", "an", "ai", "fu", "xian", "yun|wo", "xin", "fen",
+       "pin", "xin", "ma", "yu", "feng|ping", "han", "di", "tuo|duo", "tuo|zhe", "chi",
+       "xun", "zhu", "zhi|shi", "pei", "xin|jin", "ri", "sa", "yun", "wen", "zhi",
+       "dan", "lu", "you", "bo", "bao", "jue|kuai", "tuo|duo", "yi", "qu", "wen",
+       "qu", "jiong", "po", "zhao", "yuan", "peng", "zhou", "ju", "zhu", "nu",
+       "ju", "pi", "zang", "jia", "ling", "zhen", "tai|dai", "fu", "yang", "shi",
+       "bi", "tuo", "tuo", "si", "liu", "ma", "pian", "tao", "zhi", "rong",
+       "teng", "dong", "xun|xuan", "quan", "shen", "jiong", "er", "hai", "bo", "zhu",
+       "yin", "luo", "zhou", "dan", "hai", "liu", "ju", "song", "qin", "mang",
+       "liang|lang", "han", "tu", "xuan", "tui", "jun", "e", "cheng", "xing", "dai",
+       "lu", "zhui", "zhou", "she", "pian", "kun", "tao", "lai", "zong", "ke",
+       "qi", "qi", "yan", "fei", "sao", "yan", "ge", "yao", "wu", "pian",
+       "cong", "pian", "qian", "fei", "huang", "qian", "huo", "yu", "ti", "quan",
+       "xia", "zong", "kui", "rou", "si", "gua", "tuo", "gui", "sou", "qian",
+       "cheng", "zhi", "liu", "peng", "teng", "xi", "cao", "du", "yan", "yuan",
+       "zou", "sao", "shan", "qi", "zhi", "shuang", "lu", "xi", "luo", "zhang",
+       "mo", "ao", "can", "piao", "cong", "qu", "bi", "zhi", "yu", "xu",
+       "hua", "bo", "su", "xiao", "lin", "zhan", "dun", "liu", "tuo", "ceng",
+       "dian", "jiao", "tie", "yan", "luo", "zhan", "jing", "yi", "ye", "tuo",
+       "pin", "zhou", "yan", "long", "lv", "teng", "xiang", "ji", "shuang", "ju",
+       "xi", "huan", "li", "biao", "ma", "yu", "duo", "xun", "chi", "qu",
+       "ri", "bo", "lv", "zang", "shi", "si", "fu", "ju", "zou", "zhu",
+       "tuo", "nu", "jia", "yi", "dai", "xiao", "ma", "yin", "jiao", "hua",
+       "luo", "hai", "pian", "biao", "li", "cheng", "yan", "xing", "qin", "jun",
+       "qi", "qi", "ke", "zhui", "zong", "su", "can", "pian", "zhi", "kui",
+       "sao", "wu", "ao", "liu", "qian", "shan", "piao|biao", "luo", "cong", "chan",
+       "zhou", "ji", "shuang", "xiang", "gu", "wei", "wei", "wei", "yu", "gan",
+       "yi", "ang", "tou", "jie", "bao", "bei|mo", "ci", "ti", "di", "ku",
+       "hai", "qiao|xiao", "hou", "kua", "ge", "tui", "geng", "pian", "bi", "ke",
+       "qia", "ou", "sui", "lou", "bo", "xiao", "bang", "bo|jue", "ci", "kuan",
+       "bin", "mo", "liao", "lou", "xiao", "du", "zang", "sui", "ti", "bin",
+       "kuan", "lu", "gao", "gao", "qiao", "kao", "qiao", "lao", "sao", "biao",
+       "kun", "kun", "di", "fang", "xiu", "ran", "mao", "dan", "kun", "bin",
+       "fa", "tiao", "pi", "zi", "fa", "ran", "ti", "bao", "bi|po", "mao|meng",
+       "fu", "er", "er", "qu", "gong", "xiu", "kuo|yue", "ji", "peng", "zhua",
+       "shao", "sha", "ti", "li", "bin", "zong", "ti", "peng", "song", "zheng",
+       "quan", "zong", "shun", "jian", "duo", "hu", "la", "jiu", "qi", "lian",
+       "zhen", "bin", "peng", "ma", "san", "man", "man", "seng", "xu", "lie",
+       "qian", "qian", "nong", "huan", "kuo", "ning", "bin", "lie", "rang", "dou",
+       "dou", "nao", "hong", "xi", "dou", "kan", "dou", "dou", "jiu", "chang",
+       "yu", "yu", "ge", "yan", "fu", "zeng", "gui", "zong", "liu", "gui",
+       "shang", "yu", "gui", "mei", "ji", "qi", "ga", "kui", "hun", "ba",
+       "bo", "mei", "xu", "yan", "xiao", "liang", "yu", "tui", "qi", "wang",
+       "liang", "wei", "gan", "chi", "piao", "bi", "mo", "ji", "xu", "chou",
+       "yan", "zhan", "yu", "dao", "ren", "ji", "ba", "hong", "tuo", "diao",
+       "ji", "yu", "e", "ji", "sha", "hang", "tun", "mo", "jie", "shen",
+       "ban", "yuan", "pi", "lu", "wen", "hu", "lu", "za", "fang", "fen",
+       "na", "you", "pian", "mo", "he", "xia", "qu", "han", "pi", "ling",
+       "tuo", "ba", "qiu", "ping", "fu", "bi", "ci|ji", "wei", "ju", "diao",
+       "bo|ba", "you", "gun", "pi", "nian", "xing", "tai", "bao", "fu", "zha",
+       "ju", "gu", "shi", "dong", "chou", "ta", "jie", "shu", "hou", "xiang",
+       "er", "an", "wei", "zhao", "zhu", "yin", "lie", "luo|ge", "tong", "yi",
+       "yi", "bing", "wei", "jiao", "ku", "gui|xie|wa|kui", "xian", "ge", "hui", "lao",
+       "fu", "kao", "xiu", "tuo", "jun", "ti", "mian", "shao", "zha", "suo",
+       "qin", "yu", "nei", "zhe", "gun", "geng", "su", "wu", "qiu", "shan",
+       "pu|bu", "huan", "tiao", "li", "sha", "sha", "kao", "meng", "cheng", "li",
+       "zou", "xi", "yong", "shen", "zi", "qi", "qing", "xiang", "nei", "chun",
+       "ji", "diao", "qie", "gu", "zhou", "dong", "lai", "fei", "ni", "yi|si",
+       "kun", "lu", "jiu", "chang", "jing", "lun", "ling", "zou", "li", "meng",
+       "zong", "zhi", "nian", "hu", "yu", "di", "shi", "shen", "huan", "ti",
+       "hou", "xing", "zhu", "la", "zong", "ji", "bian", "bian", "huan", "quan",
+       "zei", "wei", "wei", "yu", "chun", "rou", "die", "huang", "lian", "yan",
+       "qiu", "qiu", "jian", "bi", "e", "yang", "fu", "sai", "jian", "xia",
+       "tuo", "hu", "shi", "ruo", "xuan", "wen", "jian", "hao", "wu", "pang",
+       "sao", "liu", "ma", "shi", "shi", "guan", "zi", "teng", "ta", "yao",
+       "e", "yong", "qian", "qi", "wen", "ruo", "ha ta ha ta", "lian", "ao", "le",
+       "hui", "min", "ji", "tiao", "qu", "jian", "shen", "man", "xi", "qiu",
+       "piao", "ji", "ji", "zhu", "jiang", "xiu", "zhuan", "yong", "zhang", "kang",
+       "xue", "bie", "yu", "qu", "xiang", "bo", "jiao", "xun", "su", "huang",
+       "zun", "shan", "shan", "fan", "gui", "lin", "xun", "yao", "xi", "zeng",
+       "xiang", "fen", "guan", "hou", "kuai", "zei", "sao", "zhan", "gan", "gui",
+       "ying", "li", "chang", "lei", "se", "ai", "ru", "ji", "xu", "hu",
+       "shu", "li", "lie", "le", "mie", "zhen", "xiang", "e", "lu", "guan",
+       "li", "xian", "yu", "dao", "ji", "you", "tun", "lu", "fang", "ba",
+       "he|ge", "ba", "ping", "nian", "lu", "you", "zha", "fu", "bo|ba", "bao",
+       "hou", "pi", "tai", "gui|xie", "jie", "kao", "wei", "er", "tong", "zei",
+       "hou", "kuai", "ji", "jiao", "xian", "zha", "xiang", "xun", "geng", "li",
+       "lian", "jian", "li", "shi", "tiao", "gun", "sha", "huan", "jun", "ji",
+       "yong", "qing", "ling", "qi", "zou", "fei", "kun", "chang", "gu", "ni",
+       "nian", "diao", "jing", "shen", "shi", "zi", "fen", "die", "bi", "chang",
+       "ti", "wen", "wei", "sai|xi", "e", "qiu", "fu", "huang", "quan", "jiang",
+       "bian", "sao", "ao", "qi", "ta", "guan", "yao", "pang", "jian", "le",
+       "biao", "xue", "bie", "man", "min", "yong", "wei", "xi", "gui|jue", "shan",
+       "lin", "zun", "hu", "gan", "li", "zhan|shan", "guan", "niao|diao", "yi", "fu",
+       "li", "jiu", "bu", "yan", "fu", "diao|zhao", "ji", "feng", "ru", "gan|han|yan",
+       "shi", "feng", "ming", "bao", "yuan", "zhi", "hu", "qin", "fu|gui", "ban|fen",
+       "wen", "jian|qian|zhan", "shi", "yu", "fou", "yao", "jue", "jue", "pi", "huan",
+       "zhen", "bao", "yan", "ya", "zheng", "fang", "feng", "wen", "ou", "dai",
+       "jia", "ru", "ling", "mie", "fu", "tuo", "min", "li", "bian", "zhi",
+       "ge", "yuan", "ci", "qu", "xiao", "chi", "dan", "ju", "yao", "gu",
+       "zhong", "yu", "yang", "yu", "ya", "die", "yu", "tian", "ying", "dui",
+       "wu", "er", "gua", "ai", "zhi", "yan", "heng", "xiao", "jia", "lie",
+       "zhu", "yang", "yi", "hong", "lu", "ru", "mou", "ge", "ren", "jiao",
+       "xiu", "zhou", "chi", "luo", "heng", "nian", "e", "luan", "jia", "ji",
+       "tu", "huan", "tuo", "bu", "wu", "juan", "yu", "bo", "jun", "jun",
+       "bi", "xi", "jun", "ju", "tu", "jing", "ti", "e", "e", "kuang",
+       "hu", "wu", "shen", "lai", "zan", "pan", "lu", "pi", "shu", "fu",
+       "an", "zhuo", "peng", "qin", "qian", "bei", "diao", "lu", "que", "jian",
+       "ju", "tu", "ya", "yuan", "qi", "li", "ye", "zhui", "kong", "duo",
+       "kun", "sheng", "qi", "jing", "yi", "yi", "jing", "zi", "lai", "dong",
+       "qi", "chun", "geng", "ju", "qu", "yi", "zun", "ji", "shu", "ying",
+       "chi", "miao", "rou", "an", "qiu", "ti|chi", "hu", "ti|chi", "e", "jie",
+       "mao", "fu|bi", "chun", "tu", "yan", "he|jie", "yuan", "pian|bian", "kun", "mei",
+       "hu", "ying", "chuan|zhi", "wu", "ju", "dong", "cang|qiang", "fang", "he|hu", "ying",
+       "yuan", "xian", "weng", "shi", "he", "chu", "tang", "xia", "ruo", "liu",
+       "ji", "gu|hu", "jian", "sun|xun", "han", "ci", "ci", "yi", "yao", "yan",
+       "ji", "li", "tian", "kou", "ti", "ti", "yi", "tu", "ma", "xiao",
+       "gao", "tian", "chen", "ji", "tuan", "zhe", "ao", "yao", "yi", "ou",
+       "chi", "zhi", "liu", "yong", "lou|lv", "bi", "shuang", "zhuo", "yu", "wu",
+       "jue", "yin", "ti", "si", "jiao", "yi", "hua", "bi", "ying", "su",
+       "huang", "fan", "jiao", "liao", "yan", "gao", "jiu", "xian", "xian", "tu",
+       "mai", "zun", "yu", "ying", "lu", "tuan", "xian", "xue", "yi", "pi",
+       "zhu", "luo", "xi", "yi", "ji", "ze", "yu", "zhan", "ye", "yang",
+       "pi", "ning", "hu", "mi", "ying", "meng", "di", "yue", "yu", "lei",
+       "bu", "lu", "he", "long", "shuang", "yue", "ying", "guan", "qu", "li",
+       "luan", "niao", "jiu", "ji", "yuan", "ming", "shi", "ou", "ya", "cang",
+       "bao", "zhen", "gu", "dong", "lu", "ya", "xiao", "yang", "ling", "chi",
+       "qu", "yuan", "xue", "tuo", "si", "zhi", "er", "gua", "xiu", "heng",
+       "zhou", "ge", "luan", "hong", "wu", "bo", "li", "juan", "hu", "e",
+       "yu", "xian", "ti", "wu", "que", "miao", "an", "kun", "bei", "peng",
+       "qian", "chun", "geng", "yuan", "su", "hu", "he", "e", "gu", "qiu",
+       "ci", "mei", "wu", "yi", "yao", "weng", "liu", "ji", "yi", "jian",
+       "he", "yi", "ying", "zhe", "liu", "liao", "jiao", "jiu", "yu", "lu",
+       "huan", "zhan", "ying", "hu", "meng", "guan", "shuang", "lu", "jin", "ling",
+       "jian", "xian", "cuo", "jian", "jian", "yan", "cuo", "lu", "you", "cu",
+       "ji", "pao|biao", "cu", "pao", "zhu|cu", "jun|qun", "zhu", "jian", "mi", "mi",
+       "yu", "liu", "chen", "jun", "lin", "ni", "qi", "lu", "jiu", "jun",
+       "jing", "li", "xiang", "xian", "jia", "mi", "li", "she", "zhang", "lin",
+       "jing", "qi", "ling", "yan", "cu", "mai", "mai", "he", "chao", "fu",
+       "mian", "mian", "fu", "pao", "qu", "qu", "mou", "fu", "xian", "lai",
+       "qu", "mian", "chi", "feng", "fu", "qu", "mian", "ma", "mo|me", "mo|me",
+       "hui", "mi", "zou", "nun", "fen", "huang", "huang", "jin", "guang", "tian",
+       "tou", "hong", "hua", "kuang", "hong", "shu", "li", "nian", "chi", "hei",
+       "hei", "yi", "qian", "dan", "xi", "tun", "mo", "mo", "qian", "dai",
+       "chu", "you", "dian", "yi", "xia", "yan", "qu", "mei", "yan", "qing",
+       "yue", "li", "dang", "du", "can", "yan", "yan", "yan", "dan|shen", "an",
+       "zhen|yan", "dai", "can", "yi", "mei", "dan|zhan", "yan", "du", "lu", "zhi",
+       "fen", "fu", "fu", "min|mian|meng", "min|mian|meng", "yuan", "cu", "qu", "chao", "wa",
+       "zhu", "zhi", "meng", "ao", "bie", "tuo", "bi", "yuan", "chao", "tuo",
+       "ding", "mi", "nai", "ding", "zi", "gu", "gu", "dong", "fen", "tao",
+       "yuan", "pi", "chang", "gao", "cao", "yuan", "tang", "teng", "shu", "shu",
+       "fen", "fei", "wen", "ba", "diao", "tuo", "zhong", "qu", "sheng", "shi",
+       "you", "shi", "ting", "wu", "ju", "jing", "hun", "ju", "yan", "tu",
+       "si", "xi", "xian", "yan", "lei", "bi", "yao", "qiu", "han", "wu",
+       "wu", "hou", "xie", "e", "zha", "xiu", "weng", "zha", "nong", "nang",
+       "qi", "zhai", "ji", "zi", "ji", "ji", "qi", "ji", "chi", "chen",
+       "chen", "he", "ya", "yin", "xie", "bao", "ze", "xie", "zi", "chi",
+       "yan", "ju", "tiao", "ling", "ling", "chu", "quan", "xie", "yin", "nie",
+       "jiu", "yao", "chuo", "yun", "yu", "chu", "yi", "ni", "ze", "zou",
+       "qu", "yun", "yan", "yu", "e", "wo", "yi", "ci", "zou", "dian",
+       "chu", "jin", "ya", "chi", "chen", "he", "yin|ken", "ju", "ling", "bao",
+       "tiao", "zi", "yin|ken", "yu", "chuo", "qu", "wo", "long", "pang", "gong|wo",
+       "pang", "yan", "long", "long", "gong", "kan", "da", "ling", "da", "long",
+       "gong", "kan", "gui|jun|qiu", "qiu", "bie", "gui|jun|qiu", "yue", "chui", "he", "jiao",
+       "xie", "yu"};
 
 #define DUOYINZI_SEPERATOR '|'
 
 static inline int __ctsvc_get_pinyinspell(UChar src, char spell[CHINESE_DUOYINZI_MAX_COUNT][CHINESE_PINYIN_SPELL_MAX_LEN])
 {
        int offset, len, i, j;
-       int count=0;
+       int count = 0;
 
        offset = src - CHINESE_UNICODE_START;
        RETVM_IF(offset < 0 || CHINESE_COUNT <= offset, CONTACTS_ERROR_INVALID_PARAMETER, "src is invalid");
 
        len = strlen(pinyin_spell_table[offset]);
 
-       for (i=0, j=0; i<=len; i++) {
-               if (pinyin_spell_table[offset][i]== DUOYINZI_SEPERATOR
+       for (i = 0, j = 0; i <= len; i++) {
+               if (pinyin_spell_table[offset][i] == DUOYINZI_SEPERATOR
                                || pinyin_spell_table[offset][i] == '\0') {
                        strncpy(spell[count], pinyin_spell_table[offset]+j, i-j);
-                       j=i+1;
+                       j = i+1;
                        count++;
                }
        }
@@ -2173,15 +2172,15 @@ static inline bool __ctsvc_has_chinese(const UChar *src)
 
 bool ctsvc_has_chinese(const char *src)
 {
-       UChar   temp[strlen(src)+1];
+       UChar temp[strlen(src)+1];
        UErrorCode status = 0;
 
-       RETVM_IF(NULL == src, false, "src is NULL");
+       RETV_IF(NULL == src, false);
        RETVM_IF('\0' == *src, false, "*src is NULL");
 
        u_strFromUTF8(temp, array_sizeof(temp), NULL, src, -1, &status);
        if (U_FAILURE(status)) {
-               CTS_ERR("u_strFromUTF8 Fail(%s)", u_errorName(status));
+               ERR("u_strFromUTF8 Fail(%s)", u_errorName(status));
                return false;
        }
 
@@ -2200,7 +2199,7 @@ bool ctsvc_has_chinese(const char *src)
 int ctsvc_convert_chinese_to_pinyin(const char *src, pinyin_name_s **name, int *size)
 {
        UChar   temp_result[strlen(src)+1];
-       int count = 0, len=0, total_count=0;
+       int count = 0, len = 0, total_count = 0;
        int ret, i, j;
        int multi_pinyin_count = 0;
        UErrorCode status = 0;
@@ -2208,12 +2207,12 @@ int ctsvc_convert_chinese_to_pinyin(const char *src, pinyin_name_s **name, int *
 
        *size = 0;
 
-       RETVM_IF(NULL == src, CONTACTS_ERROR_SYSTEM, "src is NULL");
+       RETV_IF(NULL == src, CONTACTS_ERROR_SYSTEM);
        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)) {
-               CTS_ERR("u_strFromUTF8 Fail(%s)", u_errorName(status));
+               ERR("u_strFromUTF8 Fail(%s)", u_errorName(status));
                return CONTACTS_ERROR_SYSTEM;
        }
 
@@ -2232,14 +2231,13 @@ int ctsvc_convert_chinese_to_pinyin(const char *src, pinyin_name_s **name, int *
 
                        pinyin_spell_count[count] = ret;
 
-                       if (total_count==0)
+                       if (total_count == 0)
                                total_count = ret;
                        else
                                total_count *= ret;
                        if (1 < ret)
-                               multi_pinyin_count ++;
-               }
-               else {
+                               multi_pinyin_count++;
+               } else {
                        UChar temp[2];
                        int temp_size;
 
@@ -2247,25 +2245,25 @@ int ctsvc_convert_chinese_to_pinyin(const char *src, pinyin_name_s **name, int *
                        temp[1] = 0x00;
                        u_strToUTF8(spell[count][0], 10, &temp_size, temp, -1, &status);
                        RETVM_IF(U_FAILURE(status), CONTACTS_ERROR_SYSTEM, "u_strToUTF8() Fail(%s)", u_errorName(status));
-                       spell[count][0][temp_size]='\0';
+                       spell[count][0][temp_size] = '\0';
                        pinyin_spell_count[count] = 1;
                }
        }
 
        *size = total_count;
        temp_name = calloc(total_count, sizeof(pinyin_name_s));
-       RETVM_IF(temp_name == NULL, CONTACTS_ERROR_OUT_OF_MEMORY,"calloc Fail()");
+       RETVM_IF(temp_name == NULL, CONTACTS_ERROR_OUT_OF_MEMORY, "calloc() Fail()");
 
        int repeat = 1;
        int name_len[total_count];
        int initial_len[total_count];
        int pinyin_name_len = sizeof(char) * ((len + 2) * CHINESE_PINYIN_SPELL_MAX_LEN);
        int pinyin_initial_len = sizeof(char) * (len * 5 + 1);
-       for (i=0; i < count ; i++) {
-               for (j=0;j<total_count;j++) {
+       for (i = 0; i < count; i++) {
+               for (j = 0; j < total_count; j++) {
                        int index = (j/repeat) %pinyin_spell_count[i];
 
-                       if (i==0) {
+                       if (i == 0) {
                                name_len[j] = 0;
                                initial_len[j] = 0;
 
@@ -2278,18 +2276,18 @@ int ctsvc_convert_chinese_to_pinyin(const char *src, pinyin_name_s **name, int *
                                        name_len[j] += snprintf(temp_name[j].pinyin_name + name_len[j], pinyin_name_len - name_len[j], " ");
 
                                name_len[j] += snprintf(temp_name[j].pinyin_name + name_len[j], pinyin_name_len - name_len[j],
-                                                               "%s", spell[i][index]);
+                                               "%s", spell[i][index]);
 
                                int char_len = ctsvc_check_utf8(spell[i][index][0]);
-                               if (char_len == 1)
+                               if (char_len == 1) {
                                        initial_len[j] += snprintf(temp_name[j].pinyin_initial + initial_len[j], pinyin_initial_len - initial_len[j],
-                                                                       "%c", spell[i][index][0]);
-                               else if (0 < char_len) {
+                                                       "%c", spell[i][index][0]);
+                               else if (0 < char_len) {
                                        char temp[10];
                                        snprintf(temp, sizeof(temp), "%s", spell[i][index]);
-                                       temp[char_len] ='\0';
+                                       temp[char_len] = '\0';
                                        initial_len[j] += snprintf(temp_name[j].pinyin_initial + initial_len[j], pinyin_initial_len - initial_len[j],
-                                                                       "%s", temp);
+                                                       "%s", temp);
                                }
                        }
                }
@@ -2307,7 +2305,7 @@ void ctsvc_pinyin_free(pinyin_name_s *pinyinname, int size)
        if (pinyinname == NULL)
                return;
 
-       for (i=0;i<size;i++) {
+       for (i = 0; i < size; i++) {
                free(pinyinname[i].pinyin_initial);
                free(pinyinname[i].pinyin_name);
        }
index 8cf5f80..06979f7 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
index 9e9fae9..1270c6f 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -71,10 +71,11 @@ static inline bool is_japanese(UChar src)
        if (CTSVC_COMPARE_BETWEEN(CTSVC_JAPANESE_KATAKANA_START, src, CTSVC_JAPANESE_KATAKANA_END)
                        || CTSVC_COMPARE_BETWEEN(CTSVC_JAPANESE_KATAKANA_PHONETIC_EXTENSIONS_START, src, CTSVC_JAPANESE_KATAKANA_PHONETIC_EXTENSIONS_END)
                        || CTSVC_COMPARE_BETWEEN(CTSVC_JAPANESE_HALFWIDTH_AND_FULLWIDTH_FORMS_START, src, CTSVC_JAPANESE_HALFWIDTH_AND_FULLWIDTH_FORMS_END)
-                       || CTSVC_COMPARE_BETWEEN(CTSVC_JAPANESE_HIRAGANA_START, src, CTSVC_JAPANESE_HIRAGANA_END))
+                       || CTSVC_COMPARE_BETWEEN(CTSVC_JAPANESE_HIRAGANA_START, src, CTSVC_JAPANESE_HIRAGANA_END)) {
                return true;
-       else
+       } else {
                return false;
+       }
 }
 
 
@@ -96,36 +97,30 @@ int ctsvc_convert_japanese_to_hiragana_unicode(UChar *src, UChar *dest, int dest
                                        || (unicode_value2 == 0xF2 || unicode_value2 == 0xF3)) {
                                unicode_value2 -= 0x60;
                                dest[j] = unicode_value1 << 8 | unicode_value2;
-                       }
-                       else {
+                       } else {
                                dest[j] = src[i];
                        }
-               }
-               else if (CTSVC_COMPARE_BETWEEN(CTSVC_JAPANESE_HALFWIDTH_AND_FULLWIDTH_FORMS_START,
-                                                       src[i], CTSVC_JAPANESE_HALFWIDTH_AND_FULLWIDTH_FORMS_END)) {
+               } else if (CTSVC_COMPARE_BETWEEN(CTSVC_JAPANESE_HALFWIDTH_AND_FULLWIDTH_FORMS_START,
+                                       src[i], CTSVC_JAPANESE_HALFWIDTH_AND_FULLWIDTH_FORMS_END)) {
                        unicode_value1 = 0x30;
                        if (i+1 < len && (0xFF & (src[i+1])) == 0x9E
                                        && 0x76 <= unicode_value2 && unicode_value2 <= 0x89) {
                                unicode_value2 = japanese_halfwidth_katakana_sonant_to_hiragana[unicode_value2 - 0x76];
                                dest[j] = unicode_value1 << 8 | unicode_value2;
                                i++;
-                       }
-                       else if (i+1 < len && (0xFF & (src[i])) == 0x9F
+                       } else if (i+1 < len && (0xFF & (src[i])) == 0x9F
                                        && 0x8a <= unicode_value2 && unicode_value2 <= 0x8e) {
                                unicode_value2 = japanese_halfwidth_katakana_half_dullness_to_hiragana[unicode_value2 - 0x8a];
                                dest[j] = unicode_value1 << 8 | unicode_value2;
                                i++;
-                       }
-                       else if (0x66 <= unicode_value2 && unicode_value2 <= 0x9d) {
+                       } else if (0x66 <= unicode_value2 && unicode_value2 <= 0x9d) {
                                unicode_value2 = japanese_halfwidth_katakana_to_hiragana[unicode_value2 - 0x66];
                                dest[j] = unicode_value1 << 8 | unicode_value2;
-                       }
-                       else {
+                       } else {
                                dest[j] = src[i];
                        }
-               }
-               else if (CTSVC_COMPARE_BETWEEN(CTSVC_ASCII_HALFWIDTH_AND_FULLWIDTH_FORMS_START,
-                                                       src[i], CTSVC_ASCII_HALFWIDTH_AND_FULLWIDTH_FORMS_END)) {
+               } else if (CTSVC_COMPARE_BETWEEN(CTSVC_ASCII_HALFWIDTH_AND_FULLWIDTH_FORMS_START,
+                                       src[i], CTSVC_ASCII_HALFWIDTH_AND_FULLWIDTH_FORMS_END)) {
                        unicode_value1 = 0x00;
                        unicode_value2 = unicode_value2 - 0x20;
                        dest[j] = unicode_value1 << 8 | unicode_value2;
@@ -149,26 +144,26 @@ int ctsvc_convert_japanese_to_hiragana(const char *src, char **dest)
 
        u_strFromUTF8(NULL, 0, &size, src, strlen(src), &status);
        if (U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR) {
-               CTS_ERR("u_strFromUTF8 to get the dest length Failed(%s)", u_errorName(status));
+               ERR("u_strFromUTF8 to get the dest length Fail(%s)", u_errorName(status));
                return CONTACTS_ERROR_SYSTEM;
        }
        status = U_ZERO_ERROR;
        tmp_result = calloc(1, sizeof(UChar) * (size + 1));
        if (NULL == tmp_result) {
-               CTS_ERR("calloc Fail");
+               ERR("calloc() Fail");
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
 
        u_strFromUTF8(tmp_result, size + 1, NULL, src, -1, &status);
        if (U_FAILURE(status)) {
-               CTS_ERR("u_strFromUTF8 Failed(%s)", u_errorName(status));
+               ERR("u_strFromUTF8 Fail(%s)", u_errorName(status));
                free(tmp_result);
                return CONTACTS_ERROR_SYSTEM;
        }
 
        result = calloc(1, sizeof(UChar) * (size + 1));
        if (NULL == result) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                free(tmp_result);
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
@@ -176,7 +171,7 @@ int ctsvc_convert_japanese_to_hiragana(const char *src, char **dest)
        ctsvc_convert_japanese_to_hiragana_unicode(tmp_result, result, size + 1);
        u_strToUTF8(NULL, 0, &size, result, -1, &status);
        if (U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR) {
-               CTS_ERR("u_strToUTF8 to get the dest length Failed(%s)", u_errorName(status));
+               ERR("u_strToUTF8 to get the dest length Fail(%s)", u_errorName(status));
                free(tmp_result);
                free(result);
                return CONTACTS_ERROR_SYSTEM;
@@ -185,7 +180,7 @@ int ctsvc_convert_japanese_to_hiragana(const char *src, char **dest)
        status = U_ZERO_ERROR;
        *dest = calloc(1, sizeof(char)*(size+1));
        if (NULL == *dest) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                free(tmp_result);
                free(result);
                return CONTACTS_ERROR_OUT_OF_MEMORY;
@@ -193,7 +188,7 @@ int ctsvc_convert_japanese_to_hiragana(const char *src, char **dest)
 
        u_strToUTF8(*dest, size + 1, &size, result, -1, &status);
        if (U_FAILURE(status)) {
-               CTS_ERR("u_strToUTF8 Failed(%s)", u_errorName(status));
+               ERR("u_strToUTF8 Fail(%s)", u_errorName(status));
                free(tmp_result);
                free(result);
                free(*dest);
index f8a7ba5..ab45776 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
index 92f10c2..4d84dd1 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -104,11 +104,11 @@ static inline bool is_chosung(UChar src)
                return true;
 
        if (unicode_value1 == 0xA9
-                       && (0x60 <= unicode_value2  && unicode_value2 <= 0x7C)) /* jamo Extended-A */
+                       && (0x60 <= unicode_value2 && unicode_value2 <= 0x7C)) /* jamo Extended-A */
                return true;
 
        if (unicode_value1 == 0x11
-                       && (0x00 <= unicode_value2  && unicode_value2 <= 0x5E))  /* jamo */
+                       && (0x00 <= unicode_value2 && unicode_value2 <= 0x5E))  /* jamo */
                return true;
 
        return false;
@@ -121,10 +121,11 @@ bool ctsvc_is_hangul(UChar src)
                        || CTSVC_COMPARE_BETWEEN(CTSVC_JAMO_B_START, src, CTSVC_JAMO_B_END)
                        || CTSVC_COMPARE_BETWEEN(CTSVC_HAN_C_START, src, CTSVC_HAN_C_END)
                        || CTSVC_COMPARE_BETWEEN(CTSVC_HAN_HALF_START, src, CTSVC_HAN_HALF_END)
-                       || CTSVC_COMPARE_BETWEEN(CTSVC_HAN_SYLLABLES_START, src, CTSVC_HAN_SYLLABLES_END))
+                       || CTSVC_COMPARE_BETWEEN(CTSVC_HAN_SYLLABLES_START, src, CTSVC_HAN_SYLLABLES_END)) {
                return true;
-       else
+       } else {
                return FALSE;
+       }
 }
 
 
@@ -160,13 +161,11 @@ void ctsvc_hangul_compatibility2jamo(UChar *src)
                        unicode_value1 = 0x11;
                        unicode_value2 = hangul_jamo_choseong[pos - hangul_compatibility_choseong];
                        (*src) = unicode_value1 << 8 | unicode_value2;
-               }
-               else if ((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 ((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;
@@ -206,13 +205,11 @@ void ctsvc_hangul_jamo2compatibility(UChar *src)
                        unicode_value1 = 0x31;
                        unicode_value2 = hangul_compatibility_choseong[pos - hangul_jamo_choseong];
                        (*src) = unicode_value1 << 8 | unicode_value2;
-               }
-               else if ((pos = strchr(hangul_jamo_jungseong, unicode_value2))) {
+               } else if ((pos = strchr(hangul_jamo_jungseong, unicode_value2))) {
                        unicode_value1 = 0x31;
                        unicode_value2 = hangul_compatibility_jungseong[pos - hangul_jamo_jungseong];
                        (*src) = unicode_value1 << 8 | unicode_value2;
-               }
-               else if ((pos = strchr(hangul_jamo_jongseong, unicode_value2))) {
+               } else if ((pos = strchr(hangul_jamo_jongseong, unicode_value2))) {
                        unicode_value1 = 0x31;
                        unicode_value2 = hangul_compatibility_jongseong[pos - hangul_jamo_jongseong];
                        (*src) = unicode_value1 << 8 | unicode_value2;
@@ -226,12 +223,12 @@ int ctsvc_get_chosung(const char *src, char *dest, int dest_size)
        UErrorCode status = 0;
        UChar tmp_result[10];
        UChar result[10];
-       int chosung_len=0, count = 0, i=0, j=0;
+       int chosung_len = 0, count = 0, i = 0, j = 0;
        int char_len = 0;
        int str_len = strlen(src);
        char temp[dest_size];
 
-       for (i=0;i<str_len;i+=char_len) {
+       for (i = 0; i < str_len; i += char_len) {
                char char_src[10];
                char_len = ctsvc_check_utf8(src[i]);
                RETVM_IF(char_len <= 0, CONTACTS_ERROR_INVALID_PARAMETER, "check_utf8 Fail");
@@ -273,11 +270,11 @@ int ctsvc_get_korean_search_pattern(const char *src, char *dest, int dest_size)
        UErrorCode status = 0;
        UChar tmp_result[10];
        UChar result[10];
-       int i=0, j=0, count=0;
+       int i = 0, j = 0, count = 0;
        int char_len = 0;
        int str_len = strlen(src);
 
-       for (i=0;i<str_len;i+=char_len) {
+       for (i = 0; i < str_len; i += char_len) {
                char char_src[10];
                char_len = ctsvc_check_utf8(src[i]);
                RETVM_IF(char_len <= 0, CONTACTS_ERROR_INVALID_PARAMETER, "check_utf8 Fail");
@@ -300,8 +297,7 @@ int ctsvc_get_korean_search_pattern(const char *src, char *dest, int dest_size)
                        j += size;
                        dest[j] = '*';
                        j++;
-               }
-               else {
+               } else {
                        u_strToUpper(tmp_result, array_sizeof(tmp_result), tmp_result, -1, NULL, &status);
                        RETVM_IF(U_FAILURE(status), CONTACTS_ERROR_SYSTEM,
                                        "u_strToUpper() Fail(%s)", u_errorName(status));
@@ -343,11 +339,11 @@ bool ctsvc_is_chosung(const char *src)
 
 bool ctsvc_has_chosung(const char *src)
 {
-       int  i=0;
+       int  i = 0;
        int char_len = 0;
        int str_len = strlen(src);
 
-       for (i=0;i<str_len;i+=char_len) {
+       for (i = 0; i < str_len; i += char_len) {
                char_len = ctsvc_check_utf8(src[i]);
                if (ctsvc_is_chosung(&(src[i])))
                        return true;
@@ -363,30 +359,30 @@ static bool __ctsvc_is_hangul(const char *src)
        if (char_len <= 0) return false;   /* invalid value */
 
        if (char_len == 3) {
-               switch(src[0]) {
-               /*
-                * Hangul Jamo : 0x1100 ~ 0x11FF
-                *  e1 84 80 ~ e1 87 bf
-                */
+               switch (src[0]) {
+                       /*
+                        * Hangul Jamo : 0x1100 ~ 0x11FF
+                        *  e1 84 80 ~ e1 87 bf
+                        */
                case 0xE1:
-                       switch(src[1]) {
+                       switch (src[1]) {
                        case 0x84 ... 0x87:
                                if (0x80 <= src[2] && src[2] <= 0xBF)
                                        return true;
                                else return false;
-                       default :
+                       default:
                                return false;
                        }
                        break;
 
-               /*
-                * Hangul Compatibility Jamo : 0x3130 ~ 0x318F
-                *  e3 84 b0 ~ e3 84 bf
-                *  e3 85 80 ~ e3 85 bf
-                *  e3 86 80 ~ e3 86 8f
-                */
+                       /*
+                        * Hangul Compatibility Jamo : 0x3130 ~ 0x318F
+                        *  e3 84 b0 ~ e3 84 bf
+                        *  e3 85 80 ~ e3 85 bf
+                        *  e3 86 80 ~ e3 86 8f
+                        */
                case 0xE3:
-                       switch(src[1]) {
+                       switch (src[1]) {
                        case 0x84:
                                if (0xB0 <= src[2] && src[2] <= 0xBF)
                                        return true;
@@ -399,21 +395,21 @@ static bool __ctsvc_is_hangul(const char *src)
                                if (0x80 <= src[2] && src[2] <= 0x8F)
                                        return true;
                                else return false;
-                       default :
+                       default:
                                return false;
                        }
                        break;
 
-               /*
-                * Hangul Jamo Extended A : 0xA960 ~ 0xA97F
-                *  ea a5 a0  ~ ea a5 bf
-                */
-               /*
-                * Hangul syllables : 0xAC00 ~ 0xD7AF
-                *  ea b0 80 ~ ea bf bf
-                */
+                       /*
+                        * Hangul Jamo Extended A : 0xA960 ~ 0xA97F
+                        *  ea a5 a0  ~ ea a5 bf
+                        */
+                       /*
+                        * Hangul syllables : 0xAC00 ~ 0xD7AF
+                        *  ea b0 80 ~ ea bf bf
+                        */
                case 0xEA:
-                       switch(src[1]) {
+                       switch (src[1]) {
                        case 0xA5:
                                if (0xA0 <= src[2] && src[2] <= 0xBF)
                                        return true;
@@ -422,53 +418,53 @@ static bool __ctsvc_is_hangul(const char *src)
                                if (0x80 <= src[2] && src[2] <= 0xBF)
                                        return true;
                                else return false;
-                       default :
+                       default:
                                return false;
                        }
                        break;
 
-               /*
-                * Hangul syllables : 0xAC00 ~ 0xD7AF
-                *  eb 80 80 ~ eb bf bf
-                *  ec 80 80 ~ ec bf bf
-                */
+                       /*
+                        * Hangul syllables : 0xAC00 ~ 0xD7AF
+                        *  eb 80 80 ~ eb bf bf
+                        *  ec 80 80 ~ ec bf bf
+                        */
                case 0xEB ... 0xEC:
-                       switch(src[1]) {
+                       switch (src[1]) {
                        case 0x80 ... 0xBF:
                                if (0x80 <= src[2] && src[2] <= 0xBF)
                                        return true;
                                else return false;
                                break;
-                       default :
+                       default:
                                return false;
                        }
                        break;
 
-               /*
-                * Hangul syllables : 0xAC00 ~ 0xD7AF
-                *  ed 80 80 ~ ed 9e af
-                */
-               /*
-                * Hangul Jamo Extended B : 0xD7B0 ~ 0xD7FF
-                *  ed 9e b0 ~ ed 9f bf
-                */
+                       /*
+                        * Hangul syllables : 0xAC00 ~ 0xD7AF
+                        *  ed 80 80 ~ ed 9e af
+                        */
+                       /*
+                        * Hangul Jamo Extended B : 0xD7B0 ~ 0xD7FF
+                        *  ed 9e b0 ~ ed 9f bf
+                        */
                case 0xED:
-                       switch(src[1]) {
+                       switch (src[1]) {
                        case 0x80 ... 0x9F:
                                if (0x80 <= src[2] && src[2] <= 0xBF)
                                        return true;
                                else return false;
-                       default :
+                       default:
                                return false;
                        }
                        break;
 
-               /*
-                * Hangul halfwidth : 0xFFA0 ~ 0xFFDC
-                *  ef be a0 ~ ef bf 9c
-                */
+                       /*
+                        * Hangul halfwidth : 0xFFA0 ~ 0xFFDC
+                        *  ef be a0 ~ ef bf 9c
+                        */
                case 0xEF:
-                       switch(src[1]) {
+                       switch (src[1]) {
                        case 0xBE:
                                if (0xA0 <= src[2] && src[2] <= 0xBF)
                                        return true;
@@ -477,7 +473,7 @@ static bool __ctsvc_is_hangul(const char *src)
                                if (0x80 <= src[2] && src[2] <= 0x9C)
                                        return true;
                                else return false;
-                       default :
+                       default:
                                return false;
                        }
                        break;
@@ -490,11 +486,11 @@ static bool __ctsvc_is_hangul(const char *src)
 
 bool ctsvc_has_korean(const char *src)
 {
-       int  i=0;
+       int  i = 0;
        int char_len = 0;
        int str_len = strlen(src);
 
-       for (i=0;i<str_len;i+=char_len) {
+       for (i = 0; i < str_len; i += char_len) {
                char_len = ctsvc_check_utf8(src[i]);
                RETV_IF(CONTACTS_ERROR_INVALID_PARAMETER == char_len, false);
                if (__ctsvc_is_hangul(&(src[i])))
index da2b983..95ce696 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
index 86a742a..70910e0 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -37,7 +37,7 @@ typedef struct {
        UChar letter;
        char start;
        char end;
-}hiragana_group_letter;
+} hiragana_group_letter;
 
 static hiragana_group_letter hiragana_group[13] = {
        {0x3042, 0x41, 0x4a}, /* ぁ あ ぃ い ぅ う ぇ え ぉ お */
@@ -57,10 +57,10 @@ static hiragana_group_letter hiragana_group[13] = {
 
 static int __ctsvc_remove_special_char(const char *src, char *dest, int dest_size)
 {
-       int s_pos=0, d_pos=0, char_type, src_size;
+       int s_pos = 0, d_pos = 0, char_type, src_size;
 
        if (NULL == src) {
-               CTS_ERR("The parameter(src) is NULL");
+               ERR("The parameter(src) is NULL");
                dest[d_pos] = '\0';
                return 0;
        }
@@ -73,9 +73,8 @@ static int __ctsvc_remove_special_char(const char *src, char *dest, int dest_siz
                        memcpy(dest+d_pos, src+s_pos, char_type);
                        d_pos += char_type;
                        s_pos += char_type;
-               }
-               else {
-                       CTS_ERR("The parameter(src:%s) has invalid character set", src);
+               } else {
+                       ERR("The parameter(src:%s) has invalid character set", src);
                        dest[d_pos] = '\0';
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
@@ -94,7 +93,7 @@ static inline int __ctsvc_collation_str(const char *src, char **dest)
 
        char *region = strdup(ctsvc_get_langset());
        if (NULL == region) {
-               CTS_ERR("strdup() Fail");
+               ERR("strdup() Fail");
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
 
@@ -104,14 +103,14 @@ static inline int __ctsvc_collation_str(const char *src, char **dest)
 
        collator = ucol_open(region, &status);
        if (U_FAILURE(status)) {
-               CTS_ERR("ucol_open Fail(%s)", u_errorName(status));
+               ERR("ucol_open Fail(%s)", u_errorName(status));
                free(region);
                return CONTACTS_ERROR_SYSTEM;
        }
 
        /* TODO: ucol_setAttribute is not called */
        if (U_FAILURE(status)) {
-               CTS_ERR("ucol_setAttribute Fail(%s)", u_errorName(status));
+               ERR("ucol_setAttribute Fail(%s)", u_errorName(status));
                free(region);
                ucol_close(collator);
                return CONTACTS_ERROR_SYSTEM;
@@ -119,7 +118,7 @@ static inline int __ctsvc_collation_str(const char *src, char **dest)
 
        u_strFromUTF8(NULL, 0, &size, src, strlen(src), &status);
        if (U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR) {
-               CTS_ERR("u_strFromUTF8 to get the dest length Fail(%s)", u_errorName(status));
+               ERR("u_strFromUTF8 to get the dest length Fail(%s)", u_errorName(status));
                free(region);
                ucol_close(collator);
                return CONTACTS_ERROR_SYSTEM;
@@ -128,7 +127,7 @@ static inline int __ctsvc_collation_str(const char *src, char **dest)
        tmp_result = calloc(1, sizeof(UChar) * (size + 1));
        u_strFromUTF8(tmp_result, size + 1, NULL, src, -1, &status);
        if (U_FAILURE(status)) {
-               CTS_ERR("u_strFromUTF8 Fail(%s)", u_errorName(status));
+               ERR("u_strFromUTF8 Fail(%s)", u_errorName(status));
                free(region);
                free(tmp_result);
                ucol_close(collator);
@@ -168,7 +167,7 @@ static int __ctsvc_normalize_str(const char *src, char **dest, bool is_index)
 
        tmp_result = calloc(1, sizeof(UChar)*(tmp_size+1));
        if (NULL == tmp_result) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
 
@@ -178,26 +177,25 @@ static int __ctsvc_normalize_str(const char *src, char **dest, bool is_index)
                free(tmp_result);
                tmp_result = calloc(1, sizeof(UChar) * (tmp_size + 1));
                if (NULL == tmp_result) {
-                       CTS_ERR("calloc() Fail");
+                       ERR("calloc() Fail");
                        return CONTACTS_ERROR_OUT_OF_MEMORY;
                }
 
                u_strFromUTF8(tmp_result, tmp_size + 1, NULL, src, -1, &status);
                if (U_FAILURE(status)) {
-                       CTS_ERR("u_strFromUTF8()Fail(%s)", u_errorName(status));
+                       ERR("u_strFromUTF8()Fail(%s)", u_errorName(status));
                        free(tmp_result);
                        return CONTACTS_ERROR_SYSTEM;
                }
-       }
-       else if (U_FAILURE(status)) {
-               CTS_ERR("u_strFromUTF8() Fail(%s)", u_errorName(status));
+       } else if (U_FAILURE(status)) {
+               ERR("u_strFromUTF8() Fail(%s)", u_errorName(status));
                free(tmp_result);
                return CONTACTS_ERROR_SYSTEM;
        }
 
        tmp_upper = calloc(1, sizeof(UChar)*(tmp_size+1));
        if (NULL == tmp_upper) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                free(tmp_result);
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
@@ -208,21 +206,20 @@ static int __ctsvc_normalize_str(const char *src, char **dest, bool is_index)
                free(tmp_upper);
                tmp_upper = calloc(1, sizeof(UChar) * (upper_size + 1));
                if (NULL == tmp_upper) {
-                       CTS_ERR("calloc() Fail");
+                       ERR("calloc() Fail");
                        free(tmp_result);
                        return CONTACTS_ERROR_OUT_OF_MEMORY;
                }
 
                u_strFromUTF8(tmp_upper, upper_size + 1, NULL, src, -1, &status);
                if (U_FAILURE(status)) {
-                       CTS_ERR("u_strFromUTF8()Fail(%s)", u_errorName(status));
+                       ERR("u_strFromUTF8()Fail(%s)", u_errorName(status));
                        free(tmp_result);
                        free(tmp_upper);
                        return CONTACTS_ERROR_SYSTEM;
                }
-       }
-       else if (U_FAILURE(status)) {
-               CTS_ERR("u_strToUpper() Fail(%s)", u_errorName(status));
+       } else if (U_FAILURE(status)) {
+               ERR("u_strToUpper() Fail(%s)", u_errorName(status));
                free(tmp_result);
                free(tmp_upper);
                return CONTACTS_ERROR_SYSTEM;
@@ -230,7 +227,7 @@ static int __ctsvc_normalize_str(const char *src, char **dest, bool is_index)
 
        result = calloc(1, sizeof(UChar)*(size+1));
        if (NULL == result) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                free(tmp_result);
                free(tmp_upper);
                return CONTACTS_ERROR_OUT_OF_MEMORY;
@@ -242,7 +239,7 @@ static int __ctsvc_normalize_str(const char *src, char **dest, bool is_index)
                free(result);
                result = calloc(1, sizeof(UChar)*(size + 1));
                if (NULL == result) {
-                       CTS_ERR("calloc() Fail");
+                       ERR("calloc() Fail");
                        free(tmp_result);
                        free(tmp_upper);
                        return CONTACTS_ERROR_OUT_OF_MEMORY;
@@ -250,15 +247,14 @@ static int __ctsvc_normalize_str(const char *src, char **dest, bool is_index)
 
                unorm_normalize(tmp_upper, -1, UNORM_NFD, 0, result, size+1, &status);
                if (U_FAILURE(status)) {
-                       CTS_ERR("unorm_normalize() Fail(%s)", u_errorName(status));
+                       ERR("unorm_normalize() Fail(%s)", u_errorName(status));
                        free(tmp_result);
                        free(tmp_upper);
                        free(result);
                        return CONTACTS_ERROR_SYSTEM;
                }
-       }
-       else if (U_FAILURE(status)) {
-               CTS_ERR("unorm_normalize() Fail(%s)", u_errorName(status));
+       } else if (U_FAILURE(status)) {
+               ERR("unorm_normalize() Fail(%s)", u_errorName(status));
                free(tmp_result);
                free(tmp_upper);
                free(result);
@@ -276,7 +272,7 @@ static int __ctsvc_normalize_str(const char *src, char **dest, bool is_index)
        UChar *temp_result = NULL;
        temp_result = calloc(1, sizeof(UChar)*(size+1));
        if (NULL == temp_result) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                free(tmp_result);
                free(tmp_upper);
                free(result);
@@ -284,28 +280,28 @@ static int __ctsvc_normalize_str(const char *src, char **dest, bool is_index)
        }
 
        bool replaced = false;
-       for (i=0,j=0; i<size;i++) {
+       for (i = 0, j = 0; i < size; i++) {
                if (CTSVC_COMPARE_BETWEEN((UChar)CTSVC_COMBINING_DIACRITICAL_MARKS_START,
-                       result[i], (UChar)CTSVC_COMBINING_DIACRITICAL_MARKS_END)) {
+                                       result[i], (UChar)CTSVC_COMBINING_DIACRITICAL_MARKS_END)) {
                        replaced = true;
-               }
-               else
+               } else {
                        temp_result[j++] = result[i];
+               }
        }
 
        if (replaced) {
                temp_result[j] = 0x0;
                free(result);
                result = temp_result;
-       }
-       else
+       } else {
                free(temp_result);
+       }
 
        u_strToUTF8(NULL, 0, &size, result, -1, &status);
        status = U_ZERO_ERROR;
        *dest = calloc(1, sizeof(char) * (size+1));
        if (NULL == *dest) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                free(tmp_result);
                free(tmp_upper);
                free(result);
@@ -314,7 +310,7 @@ static int __ctsvc_normalize_str(const char *src, char **dest, bool is_index)
 
        u_strToUTF8(*dest, size+1, NULL, result, -1, &status);
        if (U_FAILURE(status)) {
-               CTS_ERR("u_strToUTF8() Fail(%s)", u_errorName(status));
+               ERR("u_strToUTF8() Fail(%s)", u_errorName(status));
                free(*dest);
                *dest = NULL;
                free(tmp_result);
@@ -336,14 +332,14 @@ static int __ctsvc_convert_halfwidth_ascii_and_symbol(const char *src, UChar *de
 
        u_strFromUTF8(dest, dest_size, &size, src, strlen(src), &status);
        if (U_FAILURE(status)) {
-               CTS_ERR("u_strFromUTF8() Fail(%s)", u_errorName(status));
+               ERR("u_strFromUTF8() Fail(%s)", u_errorName(status));
                return CONTACTS_ERROR_SYSTEM;
        }
 
        *str_size = size;
 
        /* full width -> half width */
-       for (i=0;i<size;i++) {
+       for (i = 0; i < size; i++) {
                /* FF00 ~ FF60: Fullwidth ASCII variants */
                if (CTSVC_COMPARE_BETWEEN((UChar)0xFF00, dest[i], (UChar)0xFF60)) {
                        int unicode_value1 = 0;
@@ -351,37 +347,24 @@ static int __ctsvc_convert_halfwidth_ascii_and_symbol(const char *src, UChar *de
                        unicode_value1 = 0x0;
                        unicode_value2 = (0xFF & dest[i]) + 0x20;
                        dest[i] = unicode_value1 << 8 | unicode_value2;
-               }
-               /* FFE0~FFE6: Fullwidth symbol variants */
-               else if (CTSVC_COMPARE_BETWEEN((UChar)0xFFE0, dest[i], (UChar)0xFFE6)) {
-                       if (dest[i] == (UChar)0xFFE0) {
+               } else if (CTSVC_COMPARE_BETWEEN((UChar)0xFFE0, dest[i], (UChar)0xFFE6)) {
+                       /* FFE0~FFE6: Fullwidth symbol variants */
+                       if (dest[i] == (UChar)0xFFE0)
                                dest[i] = (UChar)0x00A2;
-                       }
-                       else if (dest[i] == (UChar)0xFFE1) {
+                       else if (dest[i] == (UChar)0xFFE1)
                                dest[i] = (UChar)0x00A3;
-                       }
-                       else if (dest[i] == (UChar)0xFFE2) {
+                       else if (dest[i] == (UChar)0xFFE2)
                                dest[i] = (UChar)0x00AC;
-                       }
-                       else if (dest[i] == (UChar)0xFFE3) {
+                       else if (dest[i] == (UChar)0xFFE3)
                                dest[i] = (UChar)0x00AF;
-                       }
-                       else if (dest[i] == (UChar)0xFFE4) {
+                       else if (dest[i] == (UChar)0xFFE4)
                                dest[i] = (UChar)0x00A6;
-                       }
-                       else if (dest[i] == (UChar)0xFFE5) {
+                       else if (dest[i] == (UChar)0xFFE5)
                                dest[i] = (UChar)0x00A5;
-                       }
-                       else if (dest[i] == (UChar)0xFFE6) {
+                       else if (dest[i] == (UChar)0xFFE6)
                                dest[i] = (UChar)0x20A9;
-                       }
-                       else {
-
-                       }
-               }
-               else {
-
-               }
+                       /* else */
+               } /* else */
 
        }
 
@@ -391,14 +374,13 @@ static int __ctsvc_convert_halfwidth_ascii_and_symbol(const char *src, UChar *de
 
 #define LARGE_BUFFER_SIZE 100
 
-int ctsvc_get_halfwidth_string(const char *src, char** dest, int* dest_size)
+int ctsvc_get_halfwidth_string(const char *src, char **dest, int *dest_size)
 {
        UChar unicodes[LARGE_BUFFER_SIZE+1];
        int ustr_size = 0;
 
        if (CONTACTS_ERROR_NONE != __ctsvc_convert_halfwidth_ascii_and_symbol(src, unicodes, LARGE_BUFFER_SIZE, &ustr_size)) {
-               CTS_ERR("convert to halfwidth Fail! %s ", src);
-
+               ERR("__ctsvc_convert_halfwidth_ascii_and_symbol() Fail");
                return CONTACTS_ERROR_SYSTEM;
        }
 
@@ -412,7 +394,7 @@ int ctsvc_get_halfwidth_string(const char *src, char** dest, int* dest_size)
 
        u_strToUTF8(*dest, size+1, dest_size, unicodes, ustr_size, &status);
        if (U_FAILURE(status)) {
-               CTS_ERR("u_strToUTF8() Fail(%s)", u_errorName(status));
+               ERR("u_strToUTF8() Fail(%s)", u_errorName(status));
 
                free(*dest);
                *dest = NULL;
@@ -450,7 +432,7 @@ static void __ctsvc_convert_japanese_group_letter(char *dest)
 
        unicode_value = (0xFF & (tmp_result[0]));
 
-       for (i=0; i < 13; i++) {
+       for (i = 0; i < 13; i++) {
                if (hiragana_group[i].start <= unicode_value
                                && unicode_value <= hiragana_group[i].end)
                        result[0] = hiragana_group[i].letter;
@@ -463,9 +445,9 @@ static void __ctsvc_convert_japanese_group_letter(char *dest)
 
 static bool __ctsvc_check_range_out_index(const char src[])
 {
-       if (src[0] == 0xe2 && src[1] == 0x80 && src[2] == 0xa6) {
+       if (src[0] == 0xe2 && src[1] == 0x80 && src[2] == 0xa6)
                return true;
-       }
+
        return false;
 }
 
@@ -477,12 +459,12 @@ int ctsvc_normalize_index(const char *src, char **dest)
 
        if (first_str[0] == '\0' || __ctsvc_check_range_out_index(first_str)) {
                length = ctsvc_check_utf8(src[0]);
-
                RETVM_IF(length <= 0, CONTACTS_ERROR_INTERNAL, "check_utf8() Fail");
-               memset(first_str,0x00, sizeof(first_str));
+
+               memset(first_str, 0x00, sizeof(first_str));
                strncpy(first_str, src, length);
                if (length != strlen(first_str)) {
-                       CTS_ERR("length : %d, first_str : %s, strlne : %d", length, first_str, strlen(first_str));
+                       ERR("length : %d, first_str : %s, strlne : %d", length, first_str, strlen(first_str));
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
        }
@@ -494,9 +476,8 @@ int ctsvc_normalize_index(const char *src, char **dest)
                (*dest)[length] = '\0';
        }
 
-       if (ret == CTSVC_LANG_JAPANESE) {
+       if (ret == CTSVC_LANG_JAPANESE)
                __ctsvc_convert_japanese_group_letter(*dest);
-       }
 
        return ret;
 }
index cd6f9c3..6cfe40a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -22,6 +22,6 @@
 int ctsvc_normalize_str(const char *src, char **dest);
 int ctsvc_collation_str(char *src, char **dest);
 int ctsvc_normalize_index(const char *src, char **dest);
-int ctsvc_get_halfwidth_string(const char *src, char** dest, int* dest_size);
+int ctsvc_get_halfwidth_string(const char *src, char **dest, int *dest_size);
 
-#endif /*  __CTSVC_NORMALIZE_H__ */
+#endif /* __CTSVC_NORMALIZE_H__ */
index 42ecbb7..c8b7ce9 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -56,9 +56,8 @@ void ctsvc_noti_publish_socket_initialize(void)
 {
        int fd = open(CTSVC_NOTI_IPC_READY, O_TRUNC | O_RDWR);
 
-       if (0 <= fd) {
+       if (0 <= fd)
                close(fd);
-       }
 }
 
 static inline void __ctsvc_noti_publish_contact_change(void)
@@ -474,8 +473,8 @@ void ctsvc_notification_send()
  * Whenever deleting data table record, this function will be called
  * in order to set notification
  */
-void ctsvc_db_data_delete_callback(sqlite3_context context,
-               int argc, sqlite3_value ** argv)
+void ctsvc_db_data_delete_callback(sqlite3_context  *context,
+               int argc, sqlite3_value **argv)
 {
        CTS_FN_CALL;
        int datatype;
@@ -487,7 +486,7 @@ void ctsvc_db_data_delete_callback(sqlite3_context * context,
 
        datatype = sqlite3_value_int(argv[1]);
 
-       switch(datatype) {
+       switch (datatype) {
        case CTSVC_DATA_NAME:
                ctsvc_set_name_noti();
                break;
@@ -538,15 +537,15 @@ void ctsvc_db_data_delete_callback(sqlite3_context * context,
 }
 
 API int contacts_db_add_status_changed_cb(
-               contacts_db_status_changed_cb cb, voiduser_data)
+               contacts_db_status_changed_cb cb, void *user_data)
 {
-       CTS_ERR("Please use contacts-service2 instead of contacts-service3");
+       ERR("Please use contacts-service2 instead of contacts-service3");
        return CONTACTS_ERROR_INTERNAL;
 }
 
 API int contacts_db_remove_status_changed_cb(
-               contacts_db_status_changed_cb cb, voiduser_data)
+               contacts_db_status_changed_cb cb, void *user_data)
 {
-       CTS_ERR("Please use contacts-service2 instead of contacts-service3");
+       ERR("Please use contacts-service2 instead of contacts-service3");
        return CONTACTS_ERROR_INTERNAL;
 }
index 1f386f4..0736a92 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -52,7 +52,7 @@ void ctsvc_notification_send(void);
 void ctsvc_nofitication_cancel(void);
 void ctsvc_noti_publish_socket_initialize(void);
 
-void ctsvc_db_data_delete_callback(sqlite3_context context,
-               int argc, sqlite3_value ** argv);
+void ctsvc_db_data_delete_callback(sqlite3_context  *context,
+               int argc, sqlite3_value **argv);
 
 #endif /* __CTSVC_NOTIFICATION_H__ */
index cd29295..41fe8cf 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -35,9 +35,9 @@
 typedef struct {
        int mcc;
        char *cc;
-}ctsvc_mcc_cc_map;
+} ctsvc_mcc_cc_map;
 
-const static ctsvc_mcc_cc_map __mcc_cc_list[] = {
+static const ctsvc_mcc_cc_map __mcc_cc_list[] = {
        {0, "1"},
        {202, "30"},
        {204, "31"},
@@ -296,7 +296,7 @@ char* ctsvc_get_network_cc(bool reload)
 
        ret = tel_get_property_int(handle, TAPI_PROP_NETWORK_SERVICE_TYPE, &state);
        if (ret != TAPI_API_SUCCESS) {
-               CTS_ERR("tel_get_property_int Fail(%d)", ret);
+               ERR("tel_get_property_int Fail(%d)", ret);
                tel_deinit(handle);
                return NULL;
        }
@@ -305,22 +305,22 @@ char* ctsvc_get_network_cc(bool reload)
                        || state == TAPI_NETWORK_SERVICE_TYPE_NO_SERVICE
                        || state == TAPI_NETWORK_SERVICE_TYPE_EMERGENCY
                        || state == TAPI_NETWORK_SERVICE_TYPE_SEARCH) {
-               CTS_INFO("network service is not working : state(%d)", state);
+               INFO("network service is not working : state(%d)", state);
                return NULL;
        }
 
        ret = tel_get_property_string(handle, TAPI_PROP_NETWORK_PLMN,  &temp);
        if (ret != TAPI_API_SUCCESS) {
-               CTS_ERR("tel_get_property_string Fail(%d)", ret);
+               ERR("tel_get_property_string Fail(%d)", ret);
                return NULL;
        }
 
        if (temp) {
-               if(3 < strlen(temp))
+               if (3 < strlen(temp))
                        temp[3] = '\0';
                mcc = atoi(temp);
        }
-       for (i=0;i<sizeof(__mcc_cc_list)/sizeof(ctsvc_mcc_cc_map);i++) {
+       for (i = 0; i < sizeof(__mcc_cc_list)/sizeof(ctsvc_mcc_cc_map); i++) {
                if (__mcc_cc_list[i].mcc == mcc) {
                        cc = __mcc_cc_list[i].cc;
                        break;
@@ -330,7 +330,8 @@ char* ctsvc_get_network_cc(bool reload)
        return cc;
 }
 
-static void __ctsvc_network_cc_changed(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
+static void _numutil_network_cc_changed(TapiHandle *handle, const char *noti_id,
+               void *data, void *user_data)
 {
        ctsvc_get_network_cc(true);
 }
@@ -343,11 +344,11 @@ void* ctsvc_init_tapi_handle_for_cc()
        handle_for_cc = tel_init(NULL);
        if (handle_for_cc) {
                int ret = tel_register_noti_event(handle_for_cc,
-                               TAPI_PROP_NETWORK_PLMN, __ctsvc_network_cc_changed, NULL);
+                               TAPI_PROP_NETWORK_PLMN, _numutil_network_cc_changed, NULL);
                WARN_IF(ret != TAPI_API_SUCCESS, "tel_register_noti_event Fail(%d)", ret);
+       } else {
+               ERR("tel_init() Fail");
        }
-       else
-               CTS_ERR("tel_init fail");
 
        return handle_for_cc;
 }
@@ -356,13 +357,13 @@ void ctsvc_deinit_tapi_handle_for_cc()
 {
        if (handle_for_cc) {
                int ret = tel_deregister_noti_event(handle_for_cc,  TAPI_PROP_NETWORK_PLMN);
-               WARN_IF(ret != TAPI_API_SUCCESS, "tel_register_noti_event Fail(%d)", ret);
+               WARN_IF(ret != TAPI_API_SUCCESS, "tel_register_noti_event() Fail(%d)", ret);
                tel_deinit(handle_for_cc);
        }
        handle_for_cc = NULL;
 }
 
-static inline int __ctsvc_phone_number_has_country_code(const char *src, int len)
+static inline int _numutil_has_country_code(const char *src, int len)
 {
        int ret = 0;
 
@@ -390,7 +391,7 @@ static inline int __ctsvc_phone_number_has_country_code(const char *src, int len
                        ret += 1;
                        break;
                default:
-                       CTS_ERR("The parameter(src:%s) has invalid character set", src);
+                       ERR("The parameter(src:%s) has invalid character set", src);
                }
                break;
        case 3:
@@ -410,7 +411,7 @@ static inline int __ctsvc_phone_number_has_country_code(const char *src, int len
                        ret += 1;
                        break;
                default:
-                       CTS_ERR("The parameter(src:%s) has invalid character set", src);
+                       ERR("The parameter(src:%s) has invalid character set", src);
                }
                break;
        case 4:
@@ -430,7 +431,7 @@ static inline int __ctsvc_phone_number_has_country_code(const char *src, int len
                        ret += 1;
                        break;
                default:
-                       CTS_ERR("The parameter(src:%s) has invalid character set", src);
+                       ERR("The parameter(src:%s) has invalid character set", src);
                }
                break;
        case 5:
@@ -450,7 +451,7 @@ static inline int __ctsvc_phone_number_has_country_code(const char *src, int len
                        ret += 1;
                        break;
                default:
-                       CTS_ERR("The parameter(src:%s) has invalid character set", src);
+                       ERR("The parameter(src:%s) has invalid character set", src);
                }
                break;
        case 6:
@@ -470,7 +471,7 @@ static inline int __ctsvc_phone_number_has_country_code(const char *src, int len
                        ret += 1;
                        break;
                default:
-                       CTS_ERR("The parameter(src:%s) has invalid character set", src);
+                       ERR("The parameter(src:%s) has invalid character set", src);
                }
                break;
        case 8:
@@ -490,7 +491,7 @@ static inline int __ctsvc_phone_number_has_country_code(const char *src, int len
                        ret += 1;
                        break;
                default:
-                       CTS_ERR("The parameter(src:%s) has invalid character set", src);
+                       ERR("The parameter(src:%s) has invalid character set", src);
                }
                break;
        case 9:
@@ -510,12 +511,12 @@ static inline int __ctsvc_phone_number_has_country_code(const char *src, int len
                        ret += 1;
                        break;
                default:
-                       CTS_ERR("The parameter(src:%s) has invalid character set", src);
+                       ERR("The parameter(src:%s) has invalid character set", src);
                }
                break;
        case 0:
        default:
-               CTS_ERR("The parameter(src:%s) has invalid character set", src);
+               ERR("The parameter(src:%s) has invalid character set", src);
                return 0;
        }
 
@@ -537,7 +538,7 @@ enum {
        CTSVC_NONE,
 };
 
-static int __ctsvc_number_has_ip_and_cc(const char*number, int len, int *index)
+static int _numutil_has_ip_and_cc(const char*number, int len, int *index)
 {
        bool have_cc = false;
        bool have_plus = false;
@@ -550,7 +551,7 @@ static int __ctsvc_number_has_ip_and_cc(const char*number, int len, int *index)
        start_index = 0;
        match_len = 0;
 
-       switch(number[start_index]) {
+       switch (number[start_index]) {
        case '+':
                start_index++;
                have_plus = true;
@@ -559,185 +560,181 @@ static int __ctsvc_number_has_ip_and_cc(const char*number, int len, int *index)
                        return CTSVC_PLUS_ONLY;   /* '+' */
                }
        default:
-               {
-                       /*
-                        * IP can be
-                        *  0 (Turks and Caicos Islands, Samoa)
-                        *  00, 011, 0011, 010, 000
-                        *  001/007 (Cambodia), 001/008 (Indonesia, Singapore)
-                        *  001/002 (Korea), 002(Taiwan)
-                        *  810 (Belarus, Kazakhstan, Russian, Tajikistan, Turkmenistan)
-                        *  009/007/005(Colombia), 009(Nigeria)
-                        *  119 (Cuba)
-                        *  00/012/013/014 (Israel)
-                        */
-                       switch(number[start_index]) {
-                       case '0':   /* '+0' */
-                               {
+               /*
+                * IP can be
+                *  0 (Turks and Caicos Islands, Samoa)
+                *  00, 011, 0011, 010, 000
+                *  001/007 (Cambodia), 001/008 (Indonesia, Singapore)
+                *  001/002 (Korea), 002(Taiwan)
+                *  810 (Belarus, Kazakhstan, Russian, Tajikistan, Turkmenistan)
+                *  009/007/005(Colombia), 009(Nigeria)
+                *  119 (Cuba)
+                *  00/012/013/014 (Israel)
+                */
+               switch (number[start_index]) {
+               case '0':   /* '+0' */
+                       start_index++;
+                       if (len <= start_index) {
+                               *index = start_index;
+                               return (have_plus ? CTSVC_PLUS_IP_ONLY : CTSVC_IP_ONLY); /* '+0' */
+                       }
+
+                       switch (number[start_index]) {
+                       case '0':   /* '+00' */
+                               start_index++;
+                               if (len <= start_index) {
+                                       *index = start_index;
+                                       return (have_plus ? CTSVC_PLUS_IP_ONLY : CTSVC_IP_ONLY); /* '+00' */
+                               }
+
+                               switch (number[start_index]) {
+                               case '0':   /* '+000' */
+                               case '2':   /* '+002' */
+                               case '5':   /* '+005' */
+                               case '7':   /* '+007' */
+                               case '8':   /* '+008' */
+                               case '9':   /* '+009' */
+                                       /* or '+00 CC' */
                                        start_index++;
                                        if (len <= start_index) {
                                                *index = start_index;
-                                               return (have_plus?CTSVC_PLUS_IP_ONLY:CTSVC_IP_ONLY); /* '+0' */
+                                               return (have_plus ? CTSVC_PLUS_IP_ONLY : CTSVC_IP_ONLY);  /* '+00Y' */
                                        }
 
-                                       switch(number[start_index]) {
-                                       case '0':   /* '+00' */
-                                               {
-                                                       start_index++;
-                                                       if (len <= start_index) {
-                                                               *index = start_index;
-                                                               return (have_plus?CTSVC_PLUS_IP_ONLY:CTSVC_IP_ONLY);      /* '+00' */
-                                                       }
-
-                                                       switch(number[start_index]) {
-                                                       case '0':   /* '+000' */
-                                                       case '2':   /* '+002' */
-                                                       case '5':   /* '+005' */
-                                                       case '7':   /* '+007' */
-                                                       case '8':   /* '+008' */
-                                                       case '9':   /* '+009' */
-                                                                           /* or '+00 CC' */
-                                                               start_index++;
-                                                               if (len <= start_index) {
-                                                                       *index = start_index;
-                                                                       return (have_plus?CTSVC_PLUS_IP_ONLY:CTSVC_IP_ONLY);  /* '+00Y' */
-                                                               }
-
-                                                               have_cc = __ctsvc_phone_number_has_country_code(&number[start_index], len-start_index);
-                                                               if (0 < have_cc) {
-                                                                       *index = start_index;
-                                                                       return (have_plus?CTSVC_PLUS_IP_CC:CTSVC_IP_CC);      /* '+00Y CC' */
-                                                               }
-                                                               else {
-                                                                       have_cc = __ctsvc_phone_number_has_country_code(&number[start_index-1], len-start_index+1);
-                                                                       if (0 < have_cc) {
-                                                                               *index = start_index-1;
-                                                                               return (have_plus?CTSVC_PLUS_IP_CC:CTSVC_IP_CC);  /* '+00 CC' */
-                                                                       }
-                                                               }
-                                                               *index = start_index;
-                                                               return (have_plus?CTSVC_PLUS_IP_ONLY:CTSVC_IP_ONLY);      /* '+00Y XXX' */
-                                                       case '1':   /* '+001' */
-                                                               start_index++;
-                                                               if (len <= start_index) {
-                                                                       *index = start_index;
-                                                                       return (have_plus?CTSVC_PLUS_IP_ONLY:CTSVC_IP_ONLY);  /* '+001' */
-                                                               }
-
-                                                               if (number[start_index] == '1') {
-                                                                       start_index++;
-                                                                       if (len <= start_index) {
-                                                                               *index = start_index;
-                                                                               return (have_plus?CTSVC_PLUS_IP_ONLY:CTSVC_IP_ONLY);   /* '+0011' */
-                                                                       }
-
-                                                                       have_cc = __ctsvc_phone_number_has_country_code(&number[start_index], len-start_index);
-                                                                       if (0 < have_cc) {
-                                                                               *index = start_index;
-                                                                               return (have_plus?CTSVC_PLUS_IP_CC:CTSVC_IP_CC);  /*  '+0011 CC' */
-                                                                       }
-                                                                       start_index--;
-                                                               }
-
-                                                               have_cc = __ctsvc_phone_number_has_country_code(&number[start_index], len-start_index);
-                                                               *index = start_index;
-                                                               if (0 < have_cc)
-                                                                       return (have_plus?CTSVC_PLUS_IP_CC:CTSVC_IP_CC);      /* '+001 CC' */
-                                                               else
-                                                                       return (have_plus?CTSVC_PLUS_IP_ONLY:CTSVC_IP_ONLY);  /* '+001 XXX' */
-                                                       default:   /* '+00 3', '+00 4', '+00 6' */
-                                                               *index = start_index;
-                                                               have_cc = __ctsvc_phone_number_has_country_code(&number[start_index], len-start_index);
-                                                               if (0 < have_cc)
-                                                                       return (have_plus?CTSVC_PLUS_IP_CC:CTSVC_IP_CC);      /* '+00 CC' */
-                                                               else
-                                                                       return (have_plus?CTSVC_PLUS_IP_ONLY:CTSVC_IP_ONLY);  /* '+00 XXX' */
-                                                       }   /* end of fourth switch */
+                                       have_cc = _numutil_has_country_code(&number[start_index],
+                                                       len-start_index);
+                                       if (0 < have_cc) {
+                                               *index = start_index;
+                                               return (have_plus ? CTSVC_PLUS_IP_CC : CTSVC_IP_CC);      /* '+00Y CC' */
+                                       } else {
+                                               have_cc = _numutil_has_country_code(&number[start_index-1],
+                                                               len-start_index+1);
+                                               if (0 < have_cc) {
+                                                       *index = start_index-1;
+                                                       return (have_plus ? CTSVC_PLUS_IP_CC : CTSVC_IP_CC);  /* '+00 CC' */
                                                }
-                                               break;
-                                       case '1':   /* '+01' */
-                                               {
-                                                       start_index++;
-                                                       if (len <= start_index) {
-                                                               *index = start_index-1;   /* '+0 1' */
-                                                               return (have_plus?CTSVC_PLUS_IP_CC:CTSVC_NONE);
-                                                       }
-
-                                                       switch(number[start_index]) {
-                                                       case '0':   /* '+010' */
-                                                       case '1':   /* '+011' */
-                                                       case '2':   /* '+012' */
-                                                       case '3':   /* '+013' */
-                                                       case '4':   /* '+014' */
-                                                               {
-                                                                       start_index++;
-                                                                       if (len <= start_index) {
-                                                                               *index = start_index;
-                                                                               return (have_plus?CTSVC_PLUS_IP_ONLY:CTSVC_IP_ONLY);   /* '+01Y' */
-                                                                       }
-
-                                                                       have_cc = __ctsvc_phone_number_has_country_code(&number[start_index], len-start_index);
-                                                                       *index = start_index;
-                                                                       if (0 < have_cc)
-                                                                               return (have_plus?CTSVC_PLUS_IP_CC:CTSVC_IP_CC);   /* '+01Y CC' */
-                                                                       else
-                                                                               return (have_plus?CTSVC_PLUS_IP_ONLY:CTSVC_IP_ONLY);   /* '+01Y XXX' */
-                                                               }
-                                                               break;
-                                                       default:
-                                                               *index = start_index-1;   /* '+0 1' */
-                                                               return (have_plus?CTSVC_PLUS_IP_CC:CTSVC_NONE);
-                                                       }
+                                       }
+                                       *index = start_index;
+                                       return (have_plus ? CTSVC_PLUS_IP_ONLY : CTSVC_IP_ONLY);      /* '+00Y XXX' */
+                               case '1':   /* '+001' */
+                                       start_index++;
+                                       if (len <= start_index) {
+                                               *index = start_index;
+                                               return (have_plus ? CTSVC_PLUS_IP_ONLY : CTSVC_IP_ONLY);  /* '+001' */
+                                       }
+
+                                       if (number[start_index] == '1') {
+                                               start_index++;
+                                               if (len <= start_index) {
+                                                       *index = start_index;
+                                                       return (have_plus ? CTSVC_PLUS_IP_ONLY : CTSVC_IP_ONLY);   /* '+0011' */
                                                }
-                                               break;
-                                       default:   /* '+0 CC' */
-                                               {
-                                                       have_cc = __ctsvc_phone_number_has_country_code(&number[start_index], len-start_index);
+
+                                               have_cc = _numutil_has_country_code(&number[start_index],
+                                                               len-start_index);
+                                               if (0 < have_cc) {
                                                        *index = start_index;
-                                                       if (0 < have_cc)
-                                                               return (have_plus?CTSVC_PLUS_IP_CC:CTSVC_IP_CC);          /* '+0 CC' */
-                                                       else
-                                                               return (have_plus?CTSVC_PLUS_IP_ONLY:CTSVC_IP_ONLY);      /* '+0 XXX' */
+                                                       return (have_plus ? CTSVC_PLUS_IP_CC : CTSVC_IP_CC);  /*  '+0011 CC' */
                                                }
-                                               break;
-                                       }   /* end of third switch */
-                               }
-                               break;   /* end of '+0' */
-                       case '1':   /* '+1' */
-                               start_index++;
-                               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);
-                               }
-                               else {
-                                       match_len = start_index-1;
-                                       ret = (have_plus?CTSVC_PLUS_ONLY:CTSVC_NONE);   /* '+ CC' */
-                               }
+                                               start_index--;
+                                       }
+
+                                       have_cc = _numutil_has_country_code(&number[start_index],
+                                                       len-start_index);
+                                       *index = start_index;
+                                       if (0 < have_cc)
+                                               return (have_plus ? CTSVC_PLUS_IP_CC : CTSVC_IP_CC);      /* '+001 CC' */
+                                       else
+                                               return (have_plus ? CTSVC_PLUS_IP_ONLY : CTSVC_IP_ONLY);  /* '+001 XXX' */
+                               default:   /* '+00 3', '+00 4', '+00 6' */
+                                       *index = start_index;
+                                       have_cc = _numutil_has_country_code(&number[start_index],
+                                                       len-start_index);
+                                       if (0 < have_cc)
+                                               return (have_plus ? CTSVC_PLUS_IP_CC : CTSVC_IP_CC);      /* '+00 CC' */
+                                       else
+                                               return (have_plus ? CTSVC_PLUS_IP_ONLY : CTSVC_IP_ONLY);  /* '+00 XXX' */
+                               }   /* end of fourth switch */
                                break;
-                       case '8':   /* '+8' */
+                       case '1':   /* '+01' */
                                start_index++;
-                               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);
+                               if (len <= start_index) {
+                                       *index = start_index-1;   /* '+0 1' */
+                                       return (have_plus ? CTSVC_PLUS_IP_CC : CTSVC_NONE);
                                }
-                               else {
-                                       match_len = start_index-1;
-                                       ret = (have_plus?CTSVC_PLUS_ONLY:CTSVC_NONE);   /* '+ CC' */
+
+                               switch (number[start_index]) {
+                               case '0':   /* '+010' */
+                               case '1':   /* '+011' */
+                               case '2':   /* '+012' */
+                               case '3':   /* '+013' */
+                               case '4':   /* '+014' */
+                                       {
+                                               start_index++;
+                                               if (len <= start_index) {
+                                                       *index = start_index;
+                                                       return (have_plus ? CTSVC_PLUS_IP_ONLY : CTSVC_IP_ONLY);   /* '+01Y' */
+                                               }
+
+                                               have_cc = _numutil_has_country_code(&number[start_index],
+                                                               len-start_index);
+                                               *index = start_index;
+                                               if (0 < have_cc)
+                                                       return (have_plus ? CTSVC_PLUS_IP_CC : CTSVC_IP_CC);   /* '+01Y CC' */
+                                               else
+                                                       return (have_plus ? CTSVC_PLUS_IP_ONLY : CTSVC_IP_ONLY);   /* '+01Y XXX' */
+                                       }
+                                       break;
+                               default:
+                                       *index = start_index-1;   /* '+0 1' */
+                                       return (have_plus ? CTSVC_PLUS_IP_CC : CTSVC_NONE);
                                }
                                break;
-                       default:
-                               match_len = start_index;
-                               ret = (have_plus?CTSVC_PLUS_ONLY:CTSVC_NONE);   /* '+ CC' */
+                       default:   /* '+0 CC' */
+                               have_cc = _numutil_has_country_code(&number[start_index],
+                                               len-start_index);
+                               *index = start_index;
+                               if (0 < have_cc)
+                                       return (have_plus ? CTSVC_PLUS_IP_CC : CTSVC_IP_CC);          /* '+0 CC' */
+                               else
+                                       return (have_plus ? CTSVC_PLUS_IP_ONLY : CTSVC_IP_ONLY);      /* '+0 XXX' */
                                break;
-                       }   /* end of second switch */
-               }
+                       }   /* end of third switch */
+                       break;   /* end of '+0' */
+               case '1':   /* '+1' */
+                       start_index++;
+                       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);
+                       } else {
+                               match_len = start_index-1;
+                               ret = (have_plus ? CTSVC_PLUS_ONLY : CTSVC_NONE);   /* '+ CC' */
+                       }
+                       break;
+               case '8':   /* '+8' */
+                       start_index++;
+                       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);
+                       } else {
+                               match_len = start_index-1;
+                               ret = (have_plus ? CTSVC_PLUS_ONLY : CTSVC_NONE);   /* '+ CC' */
+                       }
+                       break;
+               default:
+                       match_len = start_index;
+                       ret = (have_plus ? CTSVC_PLUS_ONLY : CTSVC_NONE);   /* '+ CC' */
+                       break;
+               }   /* end of second switch */
                break;   /* '+' default */
        }   /* end of first switch */
        *index = match_len;
 
        /* Check CC */
        if (match_len < len) {
-               have_cc = __ctsvc_phone_number_has_country_code(&number[match_len], len-match_len);
+               have_cc = _numutil_has_country_code(&number[match_len], len-match_len);
                if (0 < have_cc) {
                        switch (ret) {
                        case CTSVC_NONE:
@@ -754,7 +751,8 @@ static int __ctsvc_number_has_ip_and_cc(const char*number, int len, int *index)
        return ret;
 }
 
-int ctsvc_normalize_number(const char *src, char *dest, int dest_size, bool replace_alphabet)
+int ctsvc_normalize_number(const char *src, char *dest, int dest_size,
+               bool replace_alphabet)
 {
        int ret;
        int d_pos;
@@ -762,11 +760,7 @@ int ctsvc_normalize_number(const char *src, char *dest, int dest_size, bool repl
        char *normalized_out = NULL;
        char temp[dest_size];
 
-
-       if (NULL == src) {
-               CTS_ERR("The parameter(src) is NULL");
-               return 0;
-       }
+       RETV_IF(NULL == src, 0);
 
        d_pos = strlen(src);
        if (d_pos <= 0)
@@ -788,8 +782,7 @@ int ctsvc_normalize_number(const char *src, char *dest, int dest_size, bool repl
                d_pos = strlen(normalized_out);
                memcpy(dest, normalized_out, d_pos+1);
                free(normalized_out);
-       }
-       else {
+       } else {
                memcpy(dest, temp, d_pos+1);
        }
 
@@ -809,29 +802,25 @@ int ctsvc_clean_number(const char *src, char *dest, int dest_size, bool replace_
        int pos;
        char temp[dest_size];
 
-       if (NULL == src) {
-               CTS_ERR("The parameter(src) is NULL");
-               return 0;
-       }
+       RETV_IF(NULL == src, 0);
 
        s_pos = 0;
        pos = 0;
        while (src[s_pos] != 0) {
                int char_len;
-               if (dest_size-2 < pos) break;
+               if (dest_size - 2 < pos) break;
 
                char_len = ctsvc_check_utf8(src[s_pos]);
-               if (char_len <= 0) {
+               if (char_len <= 0)
                        break;
-               }
 
                if (char_len == 3) {
                        /* fullwidth -> halfwidth */
                        if (src[s_pos] == 0xef) {
                                if (src[s_pos+1] == 0xbc) {
-                                       if (0x90 <= src[s_pos+2] && src[s_pos+2] <= 0x99)        /* ef bc 90 : '0' ~ ef bc 99 : '9' */
+                                       if (0x90 <= src[s_pos+2] && src[s_pos+2] <= 0x99) /* ef bc 90 : '0' ~ ef bc 99 : '9' */
                                                temp[pos++] = src[s_pos+2] - 0x60;
-                                       else if (0xa1 <= src[s_pos+2] && src[s_pos+2] <= 0xba)   /* ef bc a1 : 'A' ~ ef bc ba : 'Z' */
+                                       else if (0xa1 <= src[s_pos+2] && src[s_pos+2] <= 0xba) /* ef bc a1 : 'A' ~ ef bc ba : 'Z' */
                                                temp[pos++] = src[s_pos+2] - 0x60;
                                        else if (0x8b == src[s_pos+2])   /* ef bc 8b : '+' */
                                                temp[pos++] = '+';
@@ -843,17 +832,16 @@ int ctsvc_clean_number(const char *src, char *dest, int dest_size, bool replace_
                                                temp[pos++] = ',';
                                        else if (0x9b == src[s_pos+2])   /* ef bc 9b : ';' */
                                                temp[pos++] = ';';
-                               }
-                               else if (src[s_pos+1] == 0xbd
-                                               && (0x81 <= src[s_pos+2] && src[s_pos+2] <= 0x9a))   /* ef bd 81 : 'a' ~ ef bd 9a : 'z' */
+                               } else if (src[s_pos+1] == 0xbd
+                                               && (0x81 <= src[s_pos+2] && src[s_pos+2] <= 0x9a)) {
+                                       /* ef bd 81 : 'a' ~ ef bd 9a : 'z' */
                                        temp[pos++] = src[s_pos+2] - 0x40;
-                       }
-                       else {
+                               }
+                       else {
                                s_pos += char_len;
                                continue;
                        }
-               }
-               else if (char_len == 1) {
+               } else if (char_len == 1) {
                        if (0x41 <= src[s_pos] && src[s_pos] <= 0x5a)        /* 'A' ~ 'Z' */
                                temp[pos++] = src[s_pos];
                        else if (0x61 <= src[s_pos] && src[s_pos] <= 0x7a)   /* 'a' ~ 'z' */
@@ -880,7 +868,8 @@ int ctsvc_clean_number(const char *src, char *dest, int dest_size, bool replace_
        return d_pos;
 }
 
-static int __ctsvc_minmatch_number(const char *src, char *dest, int dest_size, int min_match)
+static int _numutil_minmatch_number(const char *src, char *dest, int dest_size,
+               int min_match)
 {
        int i;
        int len = 0;
@@ -889,15 +878,15 @@ static int __ctsvc_minmatch_number(const char *src, char *dest, int dest_size, i
        const char *cc = ctsvc_get_network_cc(false);
 
        if ('+' == src[0]) {
-               len = __ctsvc_phone_number_has_country_code(&src[1], strlen(src)-1);
+               len = _numutil_has_country_code(&src[1], strlen(src)-1);
                temp_number = src + len +1;
-       }
-       else if ('0' == src[0])
+       } else if ('0' == src[0]) {
                temp_number = src+1;
-       else if (cc && cc[0] == '7' && src[0] == '8')
+       } else if (cc && cc[0] == '7' && src[0] == '8') {
                temp_number = src+1;
-       else
+       } else {
                temp_number = src;
+       }
 
        len = strlen(temp_number);
 
@@ -905,7 +894,7 @@ static int __ctsvc_minmatch_number(const char *src, char *dest, int dest_size, i
                while (0 <= (len-d_pos-1) && temp_number[len-d_pos-1]
                                && d_pos < min_match) {
                        if (dest_size-d_pos == 0) {
-                               CTS_ERR("Destination string buffer is not enough(%s)", src);
+                               ERR("Destination string buffer is not enough(%s)", src);
                                return CONTACTS_ERROR_INTERNAL;
                        }
 
@@ -915,14 +904,13 @@ static int __ctsvc_minmatch_number(const char *src, char *dest, int dest_size, i
                dest[d_pos] = 0;
 
                len = strlen(dest);
-               for (i=0; i<len/2;i++) {
+               for (i = 0; i < len/2; i++) {
                        char c;
                        c = dest[i];
                        dest[i] = dest[len-i-1];
                        dest[len-i-1] = c;
                }
-       }
-       else {
+       } else {
                memcpy(dest, src, strlen(src));
                dest[strlen(src)] = 0;
        }
@@ -937,25 +925,25 @@ int ctsvc_get_minmatch_number(const char *src, char *dest, int dest_size, int mi
        RETV_IF(NULL == src, CONTACTS_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == dest, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       ret = __ctsvc_minmatch_number(src, dest, dest_size, min_match);
+       ret = _numutil_minmatch_number(src, dest, dest_size, min_match);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("__ctsvc_minmatch_number() Fail(%d)", ret);
+               ERR("_numutil_minmatch_number() Fail(%d)", ret);
                return ret;
        }
 
        return CONTACTS_ERROR_NONE;
 }
 
-static bool __ctsvc_is_phonenumber_halfwidth(const char* keyword)
+static bool _numutil_is_phonenumber_halfwidth(const char *keyword)
 {
        int i;
        int len = strlen(keyword);
 
        /* TODO: we should add predicate including '+' */
        /* TODO: finally, we try to check the number with regular expression. */
-       for (i=0; i<len; i++) {
+       for (i = 0; i < len; i++) {
                if ((keyword[i] < '0' || '9' < keyword[i]) && keyword[i] != '+') {
-                       CTS_ERR("keyword[%d]: %c is not number)", i, keyword[i]);
+                       ERR("keyword[%d]: %c is not number)", i, keyword[i]);
                        return false;
                }
        }
@@ -963,7 +951,7 @@ static bool __ctsvc_is_phonenumber_halfwidth(const char* keyword)
 }
 
 #define UTF8_FULLWIDTH_LENGTH 3
-static bool __ctsvc_is_phonenumber_fullwidth(const char* keyword)
+static bool _numutil_is_phonenumber_fullwidth(const char *keyword)
 {
        int char_len = 1;
        int str_len;
@@ -972,36 +960,36 @@ static bool __ctsvc_is_phonenumber_fullwidth(const char* keyword)
                return false;
 
        str_len = strlen(keyword);
-       for (i=0;i<str_len;i += char_len) {
+       for (i = 0; i < str_len; i += char_len) {
                char_len = ctsvc_check_utf8(keyword[i]);
                if (char_len != UTF8_FULLWIDTH_LENGTH || str_len-i < UTF8_FULLWIDTH_LENGTH)
                        return false;
 
                if (keyword[i] == 0xef) {
                        if (keyword[i+1] == 0xbc) {
-                               if (0x90 <= keyword[i+2] && keyword[i+2] <= 0x99)            /* ef bc 90 : '0' ~ ef bc 99 : '9' */
+                               if (0x90 <= keyword[i+2] && keyword[i+2] <= 0x99) /* ef bc 90 : '0' ~ ef bc 99 : '9' */
                                        continue;
                                else if (0x8b == keyword[i+2])   /* ef bc 8b : '+' */
                                        continue;
                                else
                                        return false;
-                       }
-                       else
+                       } else {
                                return false;
-               }
-               else
+                       }
+               } else {
                        return false;
+               }
        }
        return true;
 }
 
-bool ctsvc_is_phonenumber(const charsrc)
+bool ctsvc_is_phonenumber(const char *src)
 {
-       return (__ctsvc_is_phonenumber_halfwidth(src) || __ctsvc_is_phonenumber_fullwidth(src));
+       return (_numutil_is_phonenumber_halfwidth(src) || _numutil_is_phonenumber_fullwidth(src));
 }
 
 /* numbers are cleaned number or normalized number */
-static bool __ctsvc_number_compare(const char *number1, const char *number2)
+static bool _numutil_number_compare(const char *number1, const char *number2)
 {
        int len1;
        int len2;
@@ -1029,7 +1017,7 @@ static bool __ctsvc_number_compare(const char *number1, const char *number2)
                return true;
 
        /* one is substring of the other string */
-       if (minmatch_len <= matched&& (len1 == 0 || len2 == 0))
+       if (minmatch_len <= matched && (len1 == 0 || len2 == 0))
                return true;
 
        /* one is +IPCC or +CC, the other is start wth NTP (National trunk prefix) */
@@ -1046,46 +1034,47 @@ static bool __ctsvc_number_compare(const char *number1, const char *number2)
                 * So, when comparing number, just check IP validation and CC and natinal number matching.
                 */
 
-               int n1 = __ctsvc_number_has_ip_and_cc(number1, len1, &index1);
-               int n2 = __ctsvc_number_has_ip_and_cc(number2, len2, &index2);
+               int n1 = _numutil_has_ip_and_cc(number1, len1, &index1);
+               int n2 = _numutil_has_ip_and_cc(number2, len2, &index2);
 
                /*
                 * + (IP) CC XXXXXXXX, 0XXXXXXXX
                 * + (810) 7 XXX XXX XX XX, 8XXX XXX XX XX (Russian)
                 */
                if ((CTSVC_PLUS_IP_CC == n1 || CTSVC_PLUS_CC_ONLY == n1 ||
-                               CTSVC_IP_CC == n1 || CTSVC_CC_ONLY == n1)
-                               && (number2[0] == '0' || (cc && cc[0] == '7' && number2[0] == '8')))
+                                       CTSVC_IP_CC == n1 || CTSVC_CC_ONLY == n1)
+                               && (number2[0] == '0' || (cc && cc[0] == '7' && number2[0] == '8'))) {
                        return true;
-               else if ((CTSVC_PLUS_IP_CC == n2 || CTSVC_PLUS_CC_ONLY == n2 ||
+               else if ((CTSVC_PLUS_IP_CC == n2 || CTSVC_PLUS_CC_ONLY == n2 ||
                                        CTSVC_IP_CC == n2 || CTSVC_CC_ONLY == n2)
-                               && (number1[0] == '0' || (cc && cc[0] == '7' && number1[0] == '8')))
+                               && (number1[0] == '0' || (cc && cc[0] == '7' && number1[0] == '8'))) {
                        return true;
-               /*
-                * + IP CC XXXXXXXX, + CC XXXXXXXX  (ex. +001 82  11 1234 5678, +82 10 1234 5678)
-                */
-               else if ((CTSVC_PLUS_IP_CC == n1 || CTSVC_IP_CC == n1)
+               } else if ((CTSVC_PLUS_IP_CC == n1 || CTSVC_IP_CC == n1)
                                && (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 && STRING_EQUAL == strncmp(&number1[index1], &number2[p], cc_index))
+                       /*
+                        * + IP CC XXXXXXXX, + CC XXXXXXXX      (ex. +001 82  11 1234 5678, +82 10 1234 5678)
+                        */
+                       int p = (CTSVC_PLUS_CC_ONLY == n2) ? 1 : 0;
+                       cc_index = _numutil_has_country_code(&number2[p], len2-p);
+                       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)
+                       }
+               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 && STRING_EQUAL == strncmp(&number2[index2], &number1[p], cc_index))
+                       int p = (CTSVC_PLUS_CC_ONLY == n1) ? 1 : 0;
+                       cc_index = _numutil_has_country_code(&number1[p], len1-p);
+                       if (0 < cc_index
+                                       && STRING_EQUAL == strncmp(&number2[index2], &number1[p], cc_index)) {
                                return true;
-               }
-               /*
-                * + CC XXXXXXXX, + IP CC XXXXXXXX  (ex. +001 82  10 1234 5678, +82 10 1234 5678)
-                */
-               else if ((CTSVC_PLUS_IP_ONLY == n1 || CTSVC_IP_ONLY == n1)
+                       }
+               } else if ((CTSVC_PLUS_IP_ONLY == n1 || CTSVC_IP_ONLY == n1)
                                && CTSVC_PLUS_ONLY == n2) {
+                       /*
+                        * + CC XXXXXXXX, + IP CC XXXXXXXX      (ex. +001 82  10 1234 5678, +82 10 1234 5678)
+                        */
                        return true;
-               }
-               else if ((CTSVC_PLUS_IP_ONLY == n2 || CTSVC_IP_ONLY == n2)
+               } else if ((CTSVC_PLUS_IP_ONLY == n2 || CTSVC_IP_ONLY == n2)
                                && CTSVC_PLUS_ONLY == n1) {
                        return true;
                }
@@ -1095,8 +1084,8 @@ static bool __ctsvc_number_compare(const char *number1, const char *number2)
 }
 
 /* When querying _NUMBER_COMPARE_, this function will be called. */
-void ctsvc_db_phone_number_equal_callback(sqlite3_context context,
-               int argc, sqlite3_value ** argv)
+void ctsvc_db_phone_number_equal_callback(sqlite3_context  *context,
+               int argc, sqlite3_value **argv)
 {
 #ifdef _CONTACTS_IPC_SERVER
        char *number1;
@@ -1104,14 +1093,14 @@ void ctsvc_db_phone_number_equal_callback(sqlite3_context * context,
 
        if (argc < 4) {
                sqlite3_result_int(context, 0);
-               CTS_ERR("argc invalid");
+               ERR("argc invalid");
                return;
        }
 
        number1 = (char*)sqlite3_value_text(argv[0]);
        number2 = (char*)sqlite3_value_text(argv[1]);
 
-       sqlite3_result_int(context, __ctsvc_number_compare(number1, number2));
+       sqlite3_result_int(context, _numutil_number_compare(number1, number2));
        return;
 #endif
 }
index 65d3ac8..7ccbb18 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -26,10 +26,10 @@ char* ctsvc_get_network_cc(bool reload);
 int ctsvc_clean_number(const char *src, char *dest, int dest_size, bool replace_alphabet);
 int ctsvc_normalize_number(const char *src, char *dest, int dest_size, bool replace_alphabet);
 int ctsvc_get_minmatch_number(const char *src, char *dest, int dest_size, int min_match);
-bool ctsvc_is_phonenumber(const charsrc);
-void ctsvc_db_phone_number_equal_callback(sqlite3_context * context, int argc, sqlite3_value ** argv);
+bool ctsvc_is_phonenumber(const char *src);
+void ctsvc_db_phone_number_equal_callback(sqlite3_context  *context, int argc, sqlite3_value **argv);
 
 void* ctsvc_init_tapi_handle_for_cc(void);
 void ctsvc_deinit_tapi_handle_for_cc(void);
 
-#endif /*  __CTSVC_NUMBER_UTILS_H__ */
+#endif /* __CTSVC_NUMBER_UTILS_H__ */
index f3dc3b3..6c18ab1 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -56,7 +56,7 @@ static inline int __ctsvc_server_remake_db_file()
 
        ret = sqlite3_exec(db, schema_query, NULL, 0, &errmsg);
        if (SQLITE_OK != ret) {
-               CTS_ERR("remake contacts DB file is Fail : %s", errmsg);
+               ERR("remake contacts DB file is Fail : %s", errmsg);
                sqlite3_free(errmsg);
        }
 
@@ -67,10 +67,10 @@ static inline int __ctsvc_server_remake_db_file()
 
        ret = fchown(fd, getuid(), CTS_SECURITY_FILE_GROUP);
        if (0 != ret)
-               CTS_ERR("fchown(%s) Fail(%d)", CTSVC_DB_PATH, ret);
+               ERR("fchown(%s) Fail(%d)", CTSVC_DB_PATH, ret);
        ret = fchmod(fd, CTS_SECURITY_DEFAULT_PERMISSION);
        if (0 != ret)
-               CTS_ERR("fchown(%s) Fail(%d)", CTSVC_DB_PATH, ret);
+               ERR("fchown(%s) Fail(%d)", CTSVC_DB_PATH, ret);
        close(fd);
 
        fd = open(CTSVC_DB_JOURNAL_PATH, O_CREAT | O_RDWR, 0660);
@@ -78,10 +78,10 @@ static inline int __ctsvc_server_remake_db_file()
 
        ret = fchown(fd, getuid(), CTS_SECURITY_FILE_GROUP);
        if (0 != ret)
-               CTS_ERR("fchown(%s) Fail(%d)", CTSVC_DB_JOURNAL_PATH, ret);
+               ERR("fchown(%s) Fail(%d)", CTSVC_DB_JOURNAL_PATH, ret);
        ret = fchmod(fd, CTS_SECURITY_DEFAULT_PERMISSION);
        if (0 != ret)
-               CTS_ERR("fchown(%s) Fail(%d)", CTSVC_DB_JOURNAL_PATH, ret);
+               ERR("fchown(%s) Fail(%d)", CTSVC_DB_JOURNAL_PATH, ret);
        close(fd);
 
        return CONTACTS_ERROR_NONE;
@@ -102,14 +102,14 @@ static int __ctsvc_server_check_table()
                        CTS_TABLE_CONTACTS);
        ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
        if (SQLITE_OK != ret) {
-               CTS_ERR("DB error : sqlite3_prepare_v2(%s) Fail(%s)", query, sqlite3_errmsg(db));
+               ERR("sqlite3_prepare_v2(%s) Fail(%s)", query, sqlite3_errmsg(db));
                ctsvc_server_db_close();
                return CONTACTS_ERROR_DB;
        }
 
        ret = sqlite3_step(stmt);
        if (SQLITE_ROW != ret) {
-               CTS_ERR("contacts table does not exist in contacts DB file : %s", sqlite3_errmsg(db));
+               ERR("contacts table does not exist in contacts DB file : %s", sqlite3_errmsg(db));
                sqlite3_finalize(stmt);
                ctsvc_server_db_close();
                return CTSVC_ERR_NO_TABLE;
index 8540b2f..2093215 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
index a35ba4b..8415e26 100644 (file)
@@ -37,9 +37,8 @@
 #include "ctsvc_server_bg.h"
 #include "ctsvc_server_update.h"
 #include "ctsvc_server_service.h"
-
+#include "ctsvc_notification.h"
 #include "ctsvc_db_access_control.h"
-
 #include "ctsvc_ipc_define.h"
 #include "ctsvc_ipc_server.h"
 #include "ctsvc_ipc_server2.h"
@@ -112,13 +111,14 @@ static int __server_main(void)
                if (pims_ipc_svc_register(CTSVC_IPC_SETTING_MODULE, CTSVC_IPC_SERVER_SETTING_GET_NAME_SORTING_ORDER, ctsvc_ipc_setting_get_name_sorting_order, NULL) != 0) break;
                if (pims_ipc_svc_register(CTSVC_IPC_SETTING_MODULE, CTSVC_IPC_SERVER_SETTING_SET_NAME_SORTING_ORDER, ctsvc_ipc_setting_set_name_sorting_order, NULL) != 0) break;
 
-               snprintf(sock_file, sizeof(sock_file), CTSVC_SOCK_PATH"/.%s_for_subscribe", getuid(), CTSVC_IPC_SERVICE);
+               snprintf(sock_file, sizeof(sock_file), CTSVC_SOCK_PATH"/.%s_for_subscribe",
+                               getuid(), CTSVC_IPC_SERVICE);
                pims_ipc_svc_init_for_publish(sock_file, CTS_SECURITY_FILE_GROUP, 0660);
                ctsvc_noti_publish_socket_initialize();
 
                ret = ctsvc_connect();
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("contacts_connect fail(%d)", ret);
+                       ERR("contacts_connect fail(%d)", ret);
                        break;
                }
                ctsvc_set_client_access_info(NULL, NULL);
@@ -127,7 +127,7 @@ static int __server_main(void)
                ctsvc_server_bg_delete_start();
 
                ret = ctsvc_server_init_configuration();
-               CTS_DBG("%d", ret);
+               DBG("%d", ret);
 
                main_loop = g_main_loop_new(NULL, FALSE);
 
@@ -141,7 +141,7 @@ static int __server_main(void)
 
                ret = ctsvc_disconnect();
                if (CONTACTS_ERROR_NONE != ret)
-                       CTS_DBG("%d", ret);
+                       DBG("%d", ret);
 
                pims_ipc_svc_deinit_for_publish();
 
@@ -151,7 +151,7 @@ static int __server_main(void)
 
        } while (0);
 
-       CTS_ERR("pims_ipc_svc_register error");
+       ERR("pims_ipc_svc_register error");
        return -1;
 }
 
@@ -163,31 +163,29 @@ void ctsvc_server_quit(void)
 
 int ctsvc_server_get_timeout_sec(void)
 {
-       CTS_DBG("ctsvc_timeout_sec:%d", ctsvc_timeout_sec);
+       DBG("ctsvc_timeout_sec:%d", ctsvc_timeout_sec);
        return ctsvc_timeout_sec;
 }
 
 #define CTSVC_SECURITY_FILE_GROUP 6005
-void ctsvc_create_file_set_permission(const charfile, mode_t mode)
+void ctsvc_create_file_set_permission(const char *file, mode_t mode)
 {
        int fd, ret;
        fd = creat(file, mode);
-       if (0 <= fd)
-       {
+       if (0 <= fd) {
                ret = fchown(fd, -1, CTSVC_SECURITY_FILE_GROUP);
                if (-1 == ret)
-                       printf("Fail to fchown\n");
+                       ERR("fchown() Fail");
 
                close(fd);
        }
 
 }
 
-void ctsvc_create_rep_set_permission(const chardirectory, mode_t mode)
+void ctsvc_create_rep_set_permission(const char *directory, mode_t mode)
 {
-       if (-1 == access (directory, F_OK)) {
+       if (-1 == access(directory, F_OK))
                mkdir(directory, mode);
-       }
 }
 
 int main(int argc, char *argv[])
@@ -199,7 +197,7 @@ int main(int argc, char *argv[])
        if (getuid() == 0) {   /* root */
                gid_t glist[] = {CTS_SECURITY_FILE_GROUP};
                ret = setgroups(1, glist);   /* client and server should have same Groups */
-               WARN_IF(ret <0, "setgroups Fail(%d)", ret);
+               WARN_IF(ret < 0, "setgroups Fail(%d)", ret);
        }
 
        if (2 <= argc && STRING_EQUAL == strcmp(argv[1], "timeout"))
@@ -243,12 +241,12 @@ int main(int argc, char *argv[])
        ctsvc_create_file_set_permission(CTSVC_NOTI_PHONELOG_CHANGED, 0660);
        ctsvc_create_file_set_permission(CTSVC_NOTI_SPEEDDIAL_CHANGED, 0660);
 
-       // update DB for compatability
+       /* update DB for compatability */
        ctsvc_server_db_update();
 
        ctsvc_server_load_feature_list();
        ret = ctsvc_server_socket_init();
-       CTS_DBG("%d", ret);
+       DBG("%d", ret);
 
        __server_main();
 
index 8b589d4..616ea52 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -39,7 +39,7 @@ int ctsvc_activity_delete_by_contact_id(int contact_id)
 
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -67,7 +67,7 @@ int ctsvc_activity_delete_by_account_id(int account_id)
 
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
index 266db54..055a892 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
index f84aba1..b842a04 100644 (file)
@@ -42,8 +42,7 @@
 
 #define CTSVC_SERVER_BG_BASE_CPU_USAGE 10  /* Delete contacts when cpu usage is under the value */
 
-typedef enum
-{
+typedef enum {
        STEP_1, /* get contact_ids */
        STEP_2, /* delete data */
        STEP_3, /* delete activity */
@@ -63,7 +62,7 @@ GMutex __ctsvc_server_bg_delete_mutex;
 account_subscribe_h account = NULL;
 contacts_h bg_contact;
 
-static int __ctsvc_server_bg_contact_delete_step1(__ctsvc_delete_data_sdata)
+static int __ctsvc_server_bg_contact_delete_step1(__ctsvc_delete_data_s *data)
 {
        char query[CTS_SQL_MIN_LEN] = {0,};
        int ret;
@@ -75,7 +74,7 @@ static int __ctsvc_server_bg_contact_delete_step1(__ctsvc_delete_data_s* data)
                /* get event_list */
                snprintf(query, sizeof(query), "SELECT contact_id FROM "CTS_TABLE_CONTACTS" WHERE deleted = 1");
                ret = ctsvc_query_prepare(query, &stmt);
-               RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
                while (1 == (ret = ctsvc_stmt_step(stmt))) {
                        int id = 0;
@@ -97,16 +96,15 @@ static int __ctsvc_server_bg_contact_delete_step1(__ctsvc_delete_data_s* data)
                data->contact_ids = g_slist_remove(data->contact_ids, GINT_TO_POINTER(data->current_contact_id));
 
                return CONTACTS_ERROR_NONE;
-       }
-       else {
+       } else {
                return CONTACTS_ERROR_NO_DATA;
        }
 }
 
 /* remove data */
-static int __ctsvc_server_bg_contact_delete_step2(__ctsvc_delete_data_sdata)
+static int __ctsvc_server_bg_contact_delete_step2(__ctsvc_delete_data_s *data)
 {
-    CTS_FN_CALL;
+       CTS_FN_CALL;
        int ret;
        char query[CTS_SQL_MIN_LEN] = {0};
        GSList *list = NULL;
@@ -116,11 +114,11 @@ static int __ctsvc_server_bg_contact_delete_step2(__ctsvc_delete_data_s* data)
 
        /* get event_list */
        snprintf(query, sizeof(query),
-               "SELECT id FROM "CTS_TABLE_DATA" WHERE contact_id = %d AND is_my_profile = 0 LIMIT %d",
-               data->current_contact_id, CTSVC_SERVER_BG_DELETE_COUNT);
+                       "SELECT id FROM "CTS_TABLE_DATA" WHERE contact_id = %d AND is_my_profile = 0 LIMIT %d",
+                       data->current_contact_id, CTSVC_SERVER_BG_DELETE_COUNT);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        while (1 == (ret = ctsvc_stmt_step(stmt))) {
                int id = 0;
@@ -143,7 +141,7 @@ static int __ctsvc_server_bg_contact_delete_step2(__ctsvc_delete_data_s* data)
 
                ret = ctsvc_query_exec(query);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("DB Fail");
+                       ERR("DB Fail");
                        ctsvc_end_trans(false);
                        g_slist_free(list);
                        return ret;
@@ -157,9 +155,9 @@ static int __ctsvc_server_bg_contact_delete_step2(__ctsvc_delete_data_s* data)
 }
 
 /* remove activities */
-static int __ctsvc_server_bg_contact_delete_step3(__ctsvc_delete_data_sdata)
+static int __ctsvc_server_bg_contact_delete_step3(__ctsvc_delete_data_s *data)
 {
-    CTS_FN_CALL;
+       CTS_FN_CALL;
 
        int ret;
        char query[CTS_SQL_MIN_LEN] = {0};
@@ -170,11 +168,11 @@ static int __ctsvc_server_bg_contact_delete_step3(__ctsvc_delete_data_s* data)
 
        /* get event_list */
        snprintf(query, sizeof(query),
-               "SELECT id FROM "CTS_TABLE_ACTIVITIES" WHERE contact_id = %d LIMIT %d",
-               data->current_contact_id, CTSVC_SERVER_BG_DELETE_COUNT);
+                       "SELECT id FROM "CTS_TABLE_ACTIVITIES" WHERE contact_id = %d LIMIT %d",
+                       data->current_contact_id, CTSVC_SERVER_BG_DELETE_COUNT);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        while (1 == (ret = ctsvc_stmt_step(stmt))) {
                int id = 0;
@@ -197,7 +195,7 @@ static int __ctsvc_server_bg_contact_delete_step3(__ctsvc_delete_data_s* data)
 
                ret = ctsvc_query_exec(query);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("DB Fail");
+                       ERR("DB Fail");
                        ctsvc_end_trans(false);
                        g_slist_free(list);
                        return ret;
@@ -210,7 +208,7 @@ static int __ctsvc_server_bg_contact_delete_step3(__ctsvc_delete_data_s* data)
        return ret;
 }
 
-static int __ctsvc_server_bg_contact_delete_step4(__ctsvc_delete_data_sdata)
+static int __ctsvc_server_bg_contact_delete_step4(__ctsvc_delete_data_s *data)
 {
        int ret;
        char query[CTS_SQL_MIN_LEN] = {0};
@@ -219,19 +217,19 @@ static int __ctsvc_server_bg_contact_delete_step4(__ctsvc_delete_data_s* data)
        RETVM_IF(CONTACTS_ERROR_NONE != ret, CONTACTS_ERROR_DB, "DB Fail");
 
        snprintf(query, sizeof(query), "DELETE FROM "CTS_TABLE_SEARCH_INDEX" WHERE contact_id = %d",
-                                       data->current_contact_id);
+                       data->current_contact_id);
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB Fail");
+               ERR("DB Fail");
                ctsvc_end_trans(false);
                return ret;
        }
 
        snprintf(query, sizeof(query), "DELETE FROM "CTS_TABLE_CONTACTS" WHERE contact_id = %d",
-                                       data->current_contact_id);
+                       data->current_contact_id);
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB Fail");
+               ERR("DB Fail");
                ctsvc_end_trans(false);
                return ret;
        }
@@ -240,12 +238,12 @@ static int __ctsvc_server_bg_contact_delete_step4(__ctsvc_delete_data_s* data)
        return ret;
 }
 
-static bool __ctsvc_server_bg_contact_delete_step(int ret, __ctsvc_delete_data_sdata)
+static bool __ctsvc_server_bg_contact_delete_step(int ret, __ctsvc_delete_data_s *data)
 {
        if (ret != CONTACTS_ERROR_NONE && ret != CONTACTS_ERROR_NO_DATA) {
                if (data->contact_ids)
                        g_slist_free(data->contact_ids);
-               CTS_ERR("fail (%d)",ret);
+               ERR("Fail(%d)", ret);
                return false;
        }
 
@@ -254,7 +252,7 @@ static bool __ctsvc_server_bg_contact_delete_step(int ret, __ctsvc_delete_data_s
                if (ret == CONTACTS_ERROR_NO_DATA) {
                        if (data->contact_ids)
                                g_slist_free(data->contact_ids);
-                       CTS_ERR("step_1 no_data");
+                       ERR("step_1 no_data");
                        return false;
                }
                data->step = STEP_2;
@@ -278,38 +276,35 @@ static bool __ctsvc_server_bg_contact_delete_step(int ret, __ctsvc_delete_data_s
        return true;
 }
 
-static bool  __ctsvc_server_db_delete_run(__ctsvc_delete_data_sdata)
+static bool  __ctsvc_server_db_delete_run(__ctsvc_delete_data_s *data)
 {
        CTS_FN_CALL;
        int ret = CONTACTS_ERROR_NONE;
 
-       if (data == NULL) {
-               CTS_ERR("data is NULL");
-               return false;
-       }
+       RETV_IF(NULL == data, false);
 
        switch (data->step) {
-               case STEP_1:
-                       /* get deleted contact id list */
-                       ret = __ctsvc_server_bg_contact_delete_step1(data);
-                       break;
-               case STEP_2:
-                       /* delete data of current contact id (MAX CTSVC_SERVER_BG_DELETE_COUNT) */
-                       ret = __ctsvc_server_bg_contact_delete_step2(data);
-                       break;
-               case STEP_3:
-                       /* delete activity of current contact id (MAX CTSVC_SERVER_BG_DELETE_COUNT each time) */
-                       ret = __ctsvc_server_bg_contact_delete_step3(data);
-                       break;
-               case STEP_4:
-                       /* delete search index of current contact id */
-                       ret = __ctsvc_server_bg_contact_delete_step4(data);
-                       break;
-               default:
-                       CTS_ERR("invalid step");
-                       if (data->contact_ids)
+       case STEP_1:
+               /* get deleted contact id list */
+               ret = __ctsvc_server_bg_contact_delete_step1(data);
+               break;
+       case STEP_2:
+               /* delete data of current contact id (MAX CTSVC_SERVER_BG_DELETE_COUNT) */
+               ret = __ctsvc_server_bg_contact_delete_step2(data);
+               break;
+       case STEP_3:
+               /* delete activity of current contact id (MAX CTSVC_SERVER_BG_DELETE_COUNT each time) */
+               ret = __ctsvc_server_bg_contact_delete_step3(data);
+               break;
+       case STEP_4:
+               /* delete search index of current contact id */
+               ret = __ctsvc_server_bg_contact_delete_step4(data);
+               break;
+       default:
+               ERR("invalid step");
+               if (data->contact_ids)
                        g_slist_free(data->contact_ids);
-                       return false;
+               return false;
        }
 
        return __ctsvc_server_bg_contact_delete_step(ret, data);
@@ -318,7 +313,7 @@ static bool  __ctsvc_server_db_delete_run(__ctsvc_delete_data_s* data)
 typedef struct {
        unsigned long int cpu_work_time;
        unsigned long int cpu_total_time;
-}process_stat;
+} process_stat;
 
 static process_stat* __ctsvc_get_cpu_stat()
 {
@@ -328,9 +323,9 @@ static process_stat* __ctsvc_get_cpu_stat()
        process_stat *result = NULL;
 
        FILE *fstat = fopen("/proc/stat", "r");
-       if (fstat == NULL) {
+       if (fstat == NULL)
                return NULL;
-       }
+
        memset(cpu_time, 0x0, sizeof(cpu_time));
        ret = fscanf(fstat, "%*s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu",
                        &cpu_time[0], &cpu_time[1], &cpu_time[2], &cpu_time[3],
@@ -338,16 +333,15 @@ static process_stat* __ctsvc_get_cpu_stat()
                        &cpu_time[8], &cpu_time[9]);
        fclose(fstat);
 
-       if (ret < 0) {
+       if (ret < 0)
                return NULL;
-       }
 
        result = calloc(1, sizeof(process_stat));
        if (NULL == result) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                return NULL;
        }
-       for (i=0; i < 10;i++) {
+       for (i = 0; i < 10; i++) {
                if (i < 3)
                        result->cpu_work_time += cpu_time[i];
                result->cpu_total_time += cpu_time[i];
@@ -380,7 +374,7 @@ static bool __ctsvc_cpu_is_busy()
        free(result2);
 
        cpu_usage = ((double)work_time_diff/(double)total_time_diff) * 100;
-       CTS_INFO("cpu usage : %.2lf (%ld/%ld)", cpu_usage, work_time_diff, total_time_diff);
+       INFO("cpu usage : %.2lf (%ld/%ld)", cpu_usage, work_time_diff, total_time_diff);
        if (CTSVC_SERVER_BG_BASE_CPU_USAGE < cpu_usage)
                return true;
        return false;
@@ -393,16 +387,16 @@ static gpointer __ctsvc_server_bg_delete(gpointer user_data)
        __ctsvc_delete_data_s *callback_data = NULL;
 
        while (1) {
-               callback_data = calloc(1,sizeof(__ctsvc_delete_data_s));
+               callback_data = calloc(1, sizeof(__ctsvc_delete_data_s));
                if (callback_data == NULL) {
-                       CTS_ERR("calloc fail");
+                       ERR("calloc fail");
                        continue;
                }
                callback_data->step = STEP_1;
 
                ret = ctsvc_connect();
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("contacts_connect() fail(%d)", ret);
+                       ERR("contacts_connect() fail(%d)", ret);
                        free(callback_data);
                        continue;
                }
@@ -411,12 +405,12 @@ static gpointer __ctsvc_server_bg_delete(gpointer user_data)
                ctsvc_server_stop_timeout();
                while (1) {
                        if (__ctsvc_cpu_is_busy()) { /* sleep 1 sec in function */
-                               CTS_ERR("Now CPU is busy.. waiting");
+                               ERR("Now CPU is busy.. waiting");
                                sleep(CTSVC_SERVER_BG_DELETE_STEP_TIME*59); /* sleep 60 sec(1 min) totally */
                                continue;
                        }
                        if (__ctsvc_server_db_delete_run(callback_data) == false) {
-                               CTS_DBG("end");
+                               DBG("end");
                                free(callback_data);
                                break;
                        }
@@ -427,11 +421,11 @@ static gpointer __ctsvc_server_bg_delete(gpointer user_data)
                ret = ctsvc_disconnect();
 
                if (CONTACTS_ERROR_NONE != ret)
-                       CTS_ERR("contacts_disconnect Fail(%d)", ret);
+                       ERR("contacts_disconnect Fail(%d)", ret);
                ctsvc_server_start_timeout();
 
                g_mutex_lock(&__ctsvc_server_bg_delete_mutex);
-               CTS_DBG("wait");
+               DBG("wait");
                g_cond_wait(&__ctsvc_server_bg_delete_cond, &__ctsvc_server_bg_delete_mutex);
                g_mutex_unlock(&__ctsvc_server_bg_delete_mutex);
        }
@@ -468,10 +462,10 @@ static void __ctsvc_server_contact_deleted_cb(const char *view_uri, void *data)
        ctsvc_server_bg_delete_start();
 }
 
-static bool __ctsvc_server_account_delete_cb(const char* event_type, int account_id, void* user_data)
+static bool __ctsvc_server_account_delete_cb(const char *event_type, int account_id, void *user_data)
 {
        CTS_FN_CALL;
-       CTS_INFO("event_type : %s, account_id : %d", event_type, account_id);
+       INFO("event_type : %s, account_id : %d", event_type, account_id);
 
        if (STRING_EQUAL == strcmp(event_type, ACCOUNT_NOTI_NAME_DELETE)) {
                ctsvc_server_stop_timeout();
@@ -486,20 +480,19 @@ void ctsvc_server_bg_add_cb()
        int ret;
        ctsvc_handle_create(&bg_contact);
        ret = ctsvc_inotify_subscribe(bg_contact, _contacts_address_book._uri, __ctsvc_server_addressbook_deleted_cb, NULL);
-       CTS_DBG("call ctsvc_inotify_subscribe (_contacts_address_book)  : return (%d)", ret);
+       DBG("call ctsvc_inotify_subscribe (_contacts_address_book)  : return (%d)", ret);
 
        ret = ctsvc_inotify_subscribe(bg_contact, _contacts_contact._uri, __ctsvc_server_contact_deleted_cb, NULL);
-       CTS_DBG("call ctsvc_inotify_subscribe (_contacts_contact): return (%d)", ret);
+       DBG("call ctsvc_inotify_subscribe (_contacts_contact): return (%d)", ret);
 
        ret = account_subscribe_create(&account);
        if (ACCOUNT_ERROR_NONE == ret) {
                ret = account_subscribe_notification(account, __ctsvc_server_account_delete_cb, NULL);
-               if (ACCOUNT_ERROR_NONE != ret) {
-                       CTS_ERR("account_subscribe_notification Fail (%d)", ret);
-               }
+               if (ACCOUNT_ERROR_NONE != ret)
+                       ERR("account_subscribe_notification() Fail(%d)", ret);
+       } else {
+               ERR("account_subscribe_create() Fail(%d)", ret);
        }
-       else
-               CTS_ERR("account_subscribe_create Fail (%d)", ret);
 }
 
 void ctsvc_server_bg_remove_cb()
@@ -507,9 +500,9 @@ void ctsvc_server_bg_remove_cb()
        int ret;
 
        ret = ctsvc_inotify_unsubscribe(bg_contact, _contacts_address_book._uri, __ctsvc_server_addressbook_deleted_cb, NULL);
-       CTS_ERR("call ctsvc_inotify_unsubscribe (_contacts_address_book): return (%d)", ret);
+       ERR("call ctsvc_inotify_unsubscribe (_contacts_address_book): return (%d)", ret);
        ret = ctsvc_inotify_unsubscribe(bg_contact, _contacts_contact._uri, __ctsvc_server_contact_deleted_cb, NULL);
-       CTS_ERR("call ctsvc_inotify_unsubscribe (_contacts_contact) : return (%d)", ret);
+       ERR("call ctsvc_inotify_unsubscribe (_contacts_contact) : return (%d)", ret);
 
        if (account) {
                account_unsubscribe_notification(account);  /* unsubscirbe & destroy */
index f73e48b..422f8a8 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -45,18 +45,18 @@ static gboolean __ctsvc_publish_changes_with_data(const char *view_uri, char *da
 
        indata = pims_ipc_data_create(0);
        if (NULL == indata) {
-               CTS_ERR("pims_ipc_data_create error\n");
+               ERR("pims_ipc_data_create error\n");
                return false;
        }
 
        if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_string(data, indata)) {
-               CTS_ERR("ctsvc_ipc_marshal_string() Fail");
+               ERR("ctsvc_ipc_marshal_string() Fail");
                pims_ipc_data_destroy(indata);
                return false;
        }
 
        if (pims_ipc_svc_publish(CTSVC_IPC_SUBSCRIBE_MODULE, (char*)view_uri, indata) != 0) {
-               CTS_ERR("pims_ipc_svc_publish error (%s)\n", view_uri);
+               ERR("pims_ipc_svc_publish error (%s)\n", view_uri);
                pims_ipc_data_destroy(indata);
                return false;
        }
@@ -70,8 +70,9 @@ void ctsvc_change_subject_publish_changed_info()
 {
        __ctsvc_publish_changes_with_data(_contacts_person._uri, __person_changed_info);
 #ifdef ENABLE_LOG_FEATURE
-       __ctsvc_publish_changes_with_data(_contacts_phone_log._uri, __phone_log_chanaged_info);
-#endif /* ENABLE_LOG_FEATURE */
+       __ctsvc_publish_changes_with_data(_contacts_phone_log._uri,
+                       __phone_log_chanaged_info);
+#endif
        ctsvc_change_subject_clear_changed_info();
 }
 
@@ -81,7 +82,7 @@ void ctsvc_change_subject_clear_changed_info()
        free(__phone_log_chanaged_info);
        __phone_log_chanaged_info = NULL;
        __phone_log_buf_size = 0;
-#endif /* ENABLE_LOG_FEATURE */
+#endif
 
        free(__person_changed_info);
        __person_changed_info = NULL;
@@ -97,22 +98,27 @@ void ctsvc_change_subject_add_changed_phone_log_id(contacts_changed_e type, int
        char changed_info[30] = {0};
 
        if (NULL == __phone_log_chanaged_info) {
-               __phone_log_chanaged_info = (char*)calloc(CTSVC_SUBSCRIBE_MAX_LEN, sizeof(char));
+               __phone_log_chanaged_info = calloc(CTSVC_SUBSCRIBE_MAX_LEN, sizeof(char));
                __phone_log_buf_size = CTSVC_SUBSCRIBE_MAX_LEN;
                __phone_log_chanaged_info[0] = '\0';
        }
 
        info_len = snprintf(changed_info, sizeof(changed_info), "%d:%d,", type, id);
        cur_len = strlen(__phone_log_chanaged_info);
-       CTS_DBG("%s(info_len : %d), %s(crrent_len : %d), max_len : %u",
-               changed_info, info_len, __phone_log_chanaged_info, cur_len, __phone_log_buf_size);
+       DBG("%s(info_len : %d), %s(crrent_len : %d), max_len : %u",
+                       changed_info, info_len,
+                       __phone_log_chanaged_info,
+                       cur_len,
+                       __phone_log_buf_size);
 
        if (__phone_log_buf_size <= (cur_len + info_len)) {
                __phone_log_buf_size *= 2;
-               __phone_log_chanaged_info = realloc(__phone_log_chanaged_info, __phone_log_buf_size);
+               __phone_log_chanaged_info = realloc(__phone_log_chanaged_info,
+                               __phone_log_buf_size);
        }
-       snprintf(__phone_log_chanaged_info + cur_len, __phone_log_buf_size - cur_len, "%s", changed_info);
-       CTS_DBG("%s", __phone_log_chanaged_info);
+       snprintf(__phone_log_chanaged_info + cur_len, __phone_log_buf_size - cur_len, "%s",
+                       changed_info);
+       DBG("%s", __phone_log_chanaged_info);
 }
 #endif /* ENABLE_LOG_FEATURE */
 
@@ -124,21 +130,22 @@ void ctsvc_change_subject_add_changed_person_id(contacts_changed_e type, int id)
        char changed_info[30] = {0};
 
        if (NULL == __person_changed_info) {
-               __person_changed_info = (char*)calloc(CTSVC_SUBSCRIBE_MAX_LEN, sizeof(char));
+               __person_changed_info = calloc(CTSVC_SUBSCRIBE_MAX_LEN, sizeof(char));
                __person_buf_size = CTSVC_SUBSCRIBE_MAX_LEN;
                __person_changed_info[0] = '\0';
        }
 
        info_len = snprintf(changed_info, sizeof(changed_info), "%d:%d,", type, id);
        cur_len = strlen(__person_changed_info);
-       CTS_DBG("%s(info_len : %d), %s(crrent_len : %d), max_len : %u",
-               changed_info, info_len, __person_changed_info, cur_len, __person_buf_size);
+       DBG("%s(info_len : %d), %s(crrent_len : %d), max_len : %u",
+                       changed_info, info_len, __person_changed_info, cur_len, __person_buf_size);
 
        if (__person_buf_size <= (cur_len + info_len)) {
                __person_buf_size *= 2;
                __person_changed_info = realloc(__person_changed_info, __person_buf_size);
        }
-       snprintf(__person_changed_info + cur_len, __person_buf_size - cur_len, "%s", changed_info);
+       snprintf(__person_changed_info + cur_len, __person_buf_size - cur_len, "%s",
+                       changed_info);
 }
 
 void ctsvc_change_subject_publish_setting(const char *setting_id, int value)
@@ -148,31 +155,35 @@ void ctsvc_change_subject_publish_setting(const char *setting_id, int value)
        RETM_IF(NULL == indata, "pims_ipc_data_create() Fail");
 
        if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(value, indata)) {
-               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+               ERR("ctsvc_ipc_marshal_int() Fail");
                pims_ipc_data_destroy(indata);
                return;
        }
 
        if (pims_ipc_svc_publish(CTSVC_IPC_SUBSCRIBE_MODULE, (char*)setting_id, indata) != 0)
-               CTS_ERR("pims_ipc_svc_publish error (%s)", setting_id);
+               ERR("pims_ipc_svc_publish error (%s)", setting_id);
 
        pims_ipc_data_destroy(indata);
 }
 
 void ctsvc_change_subject_publish_status(contacts_db_status_e status)
 {
+       int ret;
        pims_ipc_data_h indata = NULL;
+
        indata = pims_ipc_data_create(0);
        RETM_IF(NULL == indata, "pims_ipc_data_create() Fail");
 
        if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(status, indata)) {
-               CTS_ERR("ctsvc_ipc_marshal_int() Fail");
+               ERR("ctsvc_ipc_marshal_int() Fail");
                pims_ipc_data_destroy(indata);
                return;
        }
 
-       if (pims_ipc_svc_publish(CTSVC_IPC_SUBSCRIBE_MODULE, CTSVC_IPC_SERVER_DB_STATUS_CHANGED, indata) != 0)
-               CTS_ERR("pims_ipc_svc_publish error(service status)");
+       ret = pims_ipc_svc_publish(CTSVC_IPC_SUBSCRIBE_MODULE,
+                       CTSVC_IPC_SERVER_DB_STATUS_CHANGED, indata);
+       if (0 != ret)
+               ERR("pims_ipc_svc_publish(service status) Fail(%d)", ret);
 
        pims_ipc_data_destroy(indata);
 }
index d34685e..a09dc2b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
index 1854864..4e08e91 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -44,11 +44,11 @@ int ctsvc_group_add_contact_in_transaction(int group_id, int contact_id)
 
        ret = ctsvc_query_get_first_int_result(query, &exist);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_DBG("ctsvc_query_get_first_int_result fail(%d)");
+               DBG("ctsvc_query_get_first_int_result fail(%d)");
                return ret;
        }
        if (1 == exist) {
-               CTS_DBG("group relation already exist (group_id:%d, contac_id:%d)", group_id, contact_id);
+               DBG("group relation already exist (group_id:%d, contac_id:%d)", group_id, contact_id);
                return CONTACTS_ERROR_NONE;
        }
 
@@ -59,21 +59,21 @@ int ctsvc_group_add_contact_in_transaction(int group_id, int contact_id)
                        CTS_TABLE_GROUPS, group_id);
        ret = ctsvc_query_get_first_int_result(query, &grp_acc);
        RETVM_IF(CONTACTS_ERROR_NO_DATA == ret, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid Parameter: group_id(%d) is Invalid", group_id);
+                       "group_id(%d) is Invalid", group_id);
 
        snprintf(query, sizeof(query),
                        "SELECT addressbook_id FROM %s WHERE contact_id = %d AND deleted = 0",
                        CTS_TABLE_CONTACTS, contact_id);
        ret = ctsvc_query_get_first_int_result(query, &contact_acc);
        RETVM_IF(CONTACTS_ERROR_NO_DATA == ret, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid Parameter: contact_id(%d) is Invalid", contact_id);
+                       "contact_id(%d) is Invalid", contact_id);
        RETVM_IF(contact_acc != grp_acc, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid Parameter: group_acc(%d) is differ from contact_acc(%d) Invalid", grp_acc, contact_acc);
+                       "group_acc(%d) is differ from contact_acc(%d) Invalid", grp_acc, contact_acc);
 
        snprintf(query, sizeof(query), "INSERT OR REPLACE INTO %s VALUES(%d, %d, %d, 0)",
                        CTS_TABLE_GROUP_RELATIONS, group_id, contact_id, version);
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_stmt_step() Fail(%d)", ret);
@@ -100,8 +100,10 @@ int ctsvc_group_add_contact(int group_id, int contact_id)
        int addressbook_id;
        char query[CTS_SQL_MAX_LEN] = {0};
 
-       RETVM_IF(group_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid Parameter: group_id should be greater than 0");
-       RETVM_IF(contact_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid Parameter: contact_id should be greater than 0");
+       RETVM_IF(group_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
+                       "group_id should be greater than 0");
+       RETVM_IF(contact_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
+                       "contact_id should be greater than 0");
 
        /* BEGIN_TRANSACTION */
        ret = ctsvc_begin_trans();
@@ -111,13 +113,13 @@ int ctsvc_group_add_contact(int group_id, int contact_id)
                        "SELECT addressbook_id from "CTSVC_DB_VIEW_CONTACT"  WHERE contact_id = %d", contact_id);
        ret = ctsvc_query_get_first_int_result(query, &addressbook_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("No data : contact_id (%d) is not exist", contact_id);
+               ERR("No data : contact_id (%d) is not exist", contact_id);
                ctsvc_end_trans(false);
                return ret;
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to get this group record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to get this group record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
@@ -126,14 +128,14 @@ int ctsvc_group_add_contact(int group_id, int contact_id)
        do {
                int changed = ctsvc_group_add_contact_in_transaction(group_id, contact_id);
                if (changed < CONTACTS_ERROR_NONE) {
-                       CTS_ERR("DB error : ctsvc_group_add_contact_in_transaction() Fail(%d)", changed);
+                       ERR("ctsvc_group_add_contact_in_transaction() Fail(%d)", changed);
                        ret = changed;
                        break;
                }
 
                ret = ctsvc_db_contact_update_changed_time(contact_id);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+                       ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                        ret = CONTACTS_ERROR_DB;
                        break;
                }
@@ -141,7 +143,7 @@ int ctsvc_group_add_contact(int group_id, int contact_id)
 
                ret = ctsvc_end_trans(true);
                if (ret < CONTACTS_ERROR_NONE) {
-                       CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+                       ERR("ctsvc_end_trans() Fail(%d)", ret);
                        return ret;
                }
 
@@ -168,7 +170,7 @@ int ctsvc_group_remove_contact_in_transaction(int group_id, int contact_id)
                        CTS_TABLE_GROUP_RELATIONS, version, group_id, contact_id);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        WARN_IF(CONTACTS_ERROR_NONE != ret, "DB Error: ctsvc_stmt_step() Fail(%d)", ret);
@@ -195,8 +197,10 @@ int ctsvc_group_remove_contact(int group_id, int contact_id)
        int addressbook_id;
        char query[CTS_SQL_MAX_LEN] = {0};
 
-       RETVM_IF(group_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid Parameter: group_id should be greater than 0");
-       RETVM_IF(contact_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid Parameter: contact_id should be greater than 0");
+       RETVM_IF(group_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
+                       "group_id should be greater than 0");
+       RETVM_IF(contact_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
+                       "contact_id should be greater than 0");
 
        /* BEGIN_TRANSACTION */
        ret = ctsvc_begin_trans();
@@ -206,13 +210,13 @@ int ctsvc_group_remove_contact(int group_id, int contact_id)
                        "SELECT addressbook_id from "CTSVC_DB_VIEW_CONTACT"  WHERE contact_id = %d", contact_id);
        ret = ctsvc_query_get_first_int_result(query, &addressbook_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("No data : contact_id (%d) is not exist", contact_id);
+               ERR("No data : contact_id (%d) is not exist", contact_id);
                ctsvc_end_trans(false);
                return ret;
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to get this group record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to get this group record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
@@ -221,14 +225,14 @@ int ctsvc_group_remove_contact(int group_id, int contact_id)
        do {
                int changed = ctsvc_group_remove_contact_in_transaction(group_id, contact_id);
                if (changed < CONTACTS_ERROR_NONE) {
-                       CTS_ERR("DB error : ctsvc_group_remove_contact_in_transaction() Fail(%d)", changed);
+                       ERR("ctsvc_group_remove_contact_in_transaction() Fail(%d)", changed);
                        ret = changed;
                        break;
                }
 
                ret = ctsvc_db_contact_update_changed_time(contact_id);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+                       ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                        ret = CONTACTS_ERROR_DB;
                        break;
                }
@@ -236,7 +240,7 @@ int ctsvc_group_remove_contact(int group_id, int contact_id)
 
                ret = ctsvc_end_trans(true);
                if (ret < CONTACTS_ERROR_NONE) {
-                       CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+                       ERR("ctsvc_end_trans() Fail(%d)", ret);
                        return ret;
                }
 
@@ -265,19 +269,19 @@ int ctsvc_group_set_group_order(int group_id, int previous_group_id, int next_gr
                        "SELECT addressbook_id from "CTS_TABLE_GROUPS"  WHERE group_id = %d", group_id);
        ret = ctsvc_query_get_first_int_result(query, &addressbook_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("No data : group_id (%d) is not exist", group_id);
+               ERR("No data : group_id (%d) is not exist", group_id);
                return ret;
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to get this group record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to get this group record : addresbook_id(%d)", addressbook_id);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        snprintf(query, sizeof(query), "SELECT group_prio, addressbook_id FROM "CTS_TABLE_GROUPS" WHERE group_id = ?");
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ctsvc_stmt_bind_int(stmt, 1, previous_group_id);
        ret = ctsvc_stmt_step(stmt);
@@ -295,19 +299,19 @@ int ctsvc_group_set_group_order(int group_id, int previous_group_id, int next_gr
        ctsvc_stmt_reset(stmt);
        ctsvc_stmt_bind_int(stmt, 1, group_id);
        ret = ctsvc_stmt_step(stmt);
-       if (1 /*CTS_TRUE*/ == ret) {
+       if (1 /*CTS_TRUE*/ == ret)
                addressbook_id = ctsvc_stmt_get_int(stmt, 1);
-       }
+
        ctsvc_stmt_finalize(stmt);
 
        RETVM_IF(0.0 == previous_prio && 0.0 == next_prio, CONTACTS_ERROR_INVALID_PARAMETER,
                        "The indexes for previous and next are invalid.");
        RETVM_IF(previous_group_id && previous_addressbook_id != addressbook_id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "previous group(%d) and group(%d) are not the same addressbook(%d, %d) groups",
-                               previous_group_id, group_id, previous_addressbook_id, addressbook_id);
+                       "previous group(%d) and group(%d) are not the same addressbook(%d, %d) groups",
+                       previous_group_id, group_id, previous_addressbook_id, addressbook_id);
        RETVM_IF(next_group_id && next_addressbook_id != addressbook_id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "next group(%d) and group(%d) are not the same addressbook(%d, %d) groups",
-                               next_group_id, group_id, next_addressbook_id, addressbook_id);
+                       "next group(%d) and group(%d) are not the same addressbook(%d, %d) groups",
+                       next_group_id, group_id, next_addressbook_id, addressbook_id);
 
        if (0.0 == next_prio)
                prio = previous_prio + 1;
@@ -323,7 +327,7 @@ int ctsvc_group_set_group_order(int group_id, int previous_group_id, int next_gr
 
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -332,21 +336,21 @@ int ctsvc_group_set_group_order(int group_id, int previous_group_id, int next_gr
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
 /*
-API int contacts_group_add_person(int group_id, int person_id)
-{
-       return CONTACTS_ERROR_NONE;
-}
-API int contacts_group_remove_person(int group_id, int person_id)
-{
-       return CONTACTS_ERROR_NONE;
-}
-*/
+   API int contacts_group_add_person(int group_id, int person_id)
+   {
+   return CONTACTS_ERROR_NONE;
+   }
+   API int contacts_group_remove_person(int group_id, int person_id)
+   {
+   return CONTACTS_ERROR_NONE;
+   }
+   */
 
index c2c9506..5939b81 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
index 4216a4f..642d70d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -58,12 +58,12 @@ static inline int __ctsvc_get_person_default_number_value(int id, contacts_recor
                        CTS_TABLE_CONTACTS, CTS_TABLE_DATA, CTSVC_DATA_NUMBER, id);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/ != ret) {
                ctsvc_stmt_finalize(stmt);
-               CTS_ERR("ctsvc_stmt_step Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
                else
@@ -85,9 +85,9 @@ static inline int __ctsvc_get_person_default_number_value(int id, contacts_recor
 
                *record = (contacts_record_h)number;
                ret = CONTACTS_ERROR_NONE;
+       } else {
+               ERR("contacts_record_create() Fail");
        }
-       else
-               CTS_ERR("contacts_record_create() Fail");
 
        ctsvc_stmt_finalize(stmt);
        return ret;
@@ -108,12 +108,12 @@ static inline int __ctsvc_get_person_default_email_value(int id, contacts_record
                        CTS_TABLE_CONTACTS, CTS_TABLE_DATA, CTSVC_DATA_EMAIL, id);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/ != ret) {
                ctsvc_stmt_finalize(stmt);
-               CTS_ERR("ctsvc_stmt_step Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
                else
@@ -133,9 +133,9 @@ static inline int __ctsvc_get_person_default_email_value(int id, contacts_record
 
                *record = (contacts_record_h)email;
                ret = CONTACTS_ERROR_NONE;
+       } else {
+               ERR("contacts_record_create() Fail");
        }
-       else
-               CTS_ERR("contacts_record_create() Fail");
 
        ctsvc_stmt_finalize(stmt);
        return ret;
@@ -157,12 +157,12 @@ static inline int __ctsvc_get_person_default_image_value(int id, contacts_record
                        CTSVC_DATA_IMAGE, id);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/ != ret) {
                ctsvc_stmt_finalize(stmt);
-               CTS_ERR("ctsvc_stmt_step Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
                else
@@ -182,9 +182,9 @@ static inline int __ctsvc_get_person_default_image_value(int id, contacts_record
 
                *record = (contacts_record_h)image;
                ret = CONTACTS_ERROR_NONE;
+       } else {
+               ERR("contacts_record_create() Fail");
        }
-       else
-               CTS_ERR("contacts_record_create() Fail");
 
        ctsvc_stmt_finalize(stmt);
        return ret;
@@ -211,7 +211,7 @@ static int __ctsvc_get_person_value(int op_code,
                RETVM_IF(ret != CONTACTS_ERROR_NONE, ret, "__ctsvc_get_person_default_image_value() Fail(%d)", ret);
                break;
        default:
-               CTS_ERR("Invalid parameter : The op_code(%d) is not supported", op_code);
+               ERR("The op_code(%d) is not supported", op_code);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
@@ -236,29 +236,27 @@ static inline int __ctsvc_put_person_default_name(int person_id, int contact_id)
 
        if (id == person_id) {
                ret = ctsvc_begin_trans();
-               RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "ctsvc_begin_trans() Fail(%d)", ret);
                snprintf(query, sizeof(query),
                                "UPDATE %s SET name_contact_id=%d WHERE person_id=%d",
                                CTS_TABLE_PERSONS, contact_id, person_id);
 
                ret = ctsvc_query_exec(query);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+                       ERR("ctsvc_query_exec() Fail(%d)", ret);
                        ctsvc_end_trans(false);
                        return ret;
-               }
-               else {
+               } else {
                        ret = ctsvc_end_trans(true);
                        if (ret < CONTACTS_ERROR_NONE) {
-                               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+                               ERR("ctsvc_end_trans() Fail(%d)", ret);
                                return ret;
-                       }
-                       else
+                       } else {
                                return CONTACTS_ERROR_NONE;
+                       }
                }
-       }
-       else {
-               CTS_ERR("contact(%d) does not belong to person(%d), to person(%d)", contact_id, person_id, ret);
+       } else {
+               ERR("contact(%d) does not belong to person(%d), to person(%d)", contact_id, person_id, ret);
                ret = CONTACTS_ERROR_NO_DATA;
        }
 
@@ -275,7 +273,7 @@ static inline int __ctsvc_put_person_default_image(int person_id, int id)
        char query[CTS_SQL_MAX_LEN] = {0};
 
        ret = ctsvc_begin_trans();
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "DB error : ctsvc_begin_trans() Fail(%d)", ret);
+       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "ctsvc_begin_trans() Fail(%d)", ret);
 
        snprintf(query, sizeof(query),
                        "SELECT D.is_default, D.contact_id, D.data3 "
@@ -285,7 +283,7 @@ static inline int __ctsvc_put_person_default_image(int person_id, int id)
                        CTSVC_DATA_IMAGE, person_id, id);
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("ctsvc_query_prepare Fail(%d)", ret);
+               ERR("ctsvc_query_prepare Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -310,7 +308,7 @@ static inline int __ctsvc_put_person_default_image(int person_id, int id)
                        CTSVC_DATA_IMAGE, person_id);
        ret = ctsvc_query_exec(query);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                free(image_path);
                ctsvc_end_trans(false);
                return ret;
@@ -325,7 +323,7 @@ static inline int __ctsvc_put_person_default_image(int person_id, int id)
 
                ret = ctsvc_query_exec(query);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("DB error : ctsvc_query_exec() Fail(%d)", ret);
+                       ERR("ctsvc_query_exec() Fail(%d)", ret);
                        free(image_path);
                        ctsvc_end_trans(false);
                        return ret;
@@ -337,7 +335,7 @@ static inline int __ctsvc_put_person_default_image(int person_id, int id)
                        "UPDATE "CTS_TABLE_DATA" SET is_primary_default=1, is_default=1 WHERE id=%d ", id);
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                free(image_path);
                ctsvc_end_trans(false);
                return ret;
@@ -348,7 +346,7 @@ static inline int __ctsvc_put_person_default_image(int person_id, int id)
                        "UPDATE "CTS_TABLE_PERSONS" SET image_thumbnail_path=? WHERE person_id=%d ", person_id);
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                free(image_path);
                ctsvc_end_trans(false);
                return ret;
@@ -357,7 +355,7 @@ static inline int __ctsvc_put_person_default_image(int person_id, int id)
        ctsvc_stmt_bind_text(stmt, 1, image_path);
        ret = ctsvc_stmt_step(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                free(image_path);
                ctsvc_end_trans(false);
@@ -370,7 +368,7 @@ static inline int __ctsvc_put_person_default_image(int person_id, int id)
                        "UPDATE "CTS_TABLE_CONTACTS" SET image_thumbnail_path=? WHERE contact_id=%d ", contact_id);
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                free(image_path);
                ctsvc_end_trans(false);
                return ret;
@@ -379,7 +377,7 @@ static inline int __ctsvc_put_person_default_image(int person_id, int id)
        ctsvc_stmt_bind_text(stmt, 1, image_path);
        ret = ctsvc_stmt_step(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                free(image_path);
                ctsvc_end_trans(false);
@@ -410,11 +408,11 @@ static inline int __ctsvc_put_person_default_data(int person_id, int id, int dat
                        CTS_TABLE_DATA, CTS_TABLE_CONTACTS, datatype, person_id, id);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 != ret) {
-               CTS_ERR("ctsvc_stmt_step Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                return ret;
        }
@@ -425,7 +423,7 @@ static inline int __ctsvc_put_person_default_data(int person_id, int id, int dat
        ctsvc_stmt_finalize(stmt);
 
        ret = ctsvc_begin_trans();
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "DB error : ctsvc_begin_trans() Fail(%d)", ret);
+       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "ctsvc_begin_trans() Fail(%d)", ret);
 
        /* unset is_primary_default of all data of the person */
        snprintf(query, sizeof(query),
@@ -436,7 +434,7 @@ static inline int __ctsvc_put_person_default_data(int person_id, int id, int dat
 
        ret = ctsvc_query_exec(query);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -450,7 +448,7 @@ static inline int __ctsvc_put_person_default_data(int person_id, int id, int dat
 
                ret = ctsvc_query_exec(query);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("DB error : ctsvc_query_exec() Fail(%d)", ret);
+                       ERR("ctsvc_query_exec() Fail(%d)", ret);
                        ctsvc_end_trans(false);
                        return ret;
                }
@@ -462,7 +460,7 @@ static inline int __ctsvc_put_person_default_data(int person_id, int id, int dat
 
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -479,7 +477,7 @@ static inline int __ctsvc_put_person_default_data(int person_id, int id, int dat
                        "SELECT name_contact_id FROM "CTS_TABLE_PERSONS" WHERE person_id = %d", person_id);
        ret = ctsvc_query_get_first_int_result(query, &name_contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
+               ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -490,7 +488,7 @@ static inline int __ctsvc_put_person_default_data(int person_id, int id, int dat
                                "SELECT display_name_source FROM "CTS_TABLE_CONTACTS" WHERE contact_id = %d", name_contact_id);
                ret = ctsvc_query_get_first_int_result(query, &org_source_type);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
+                       ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                        ctsvc_end_trans(false);
                        return ret;
                }
@@ -501,7 +499,7 @@ static inline int __ctsvc_put_person_default_data(int person_id, int id, int dat
                                        CTS_TABLE_PERSONS, contact_id, person_id);
                        ret = ctsvc_query_exec(query);
                        if (CONTACTS_ERROR_NONE != ret) {
-                               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+                               ERR("ctsvc_query_exec() Fail(%d)", ret);
                                ctsvc_end_trans(false);
                                return ret;
                        }
@@ -510,15 +508,15 @@ static inline int __ctsvc_put_person_default_data(int person_id, int id, int dat
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
-void ctsvc_db_person_delete_callback(sqlite3_context context,
-               int argc, sqlite3_value ** argv)
+void ctsvc_db_person_delete_callback(sqlite3_context  *context,
+               int argc, sqlite3_value **argv)
 {
 #ifdef _CONTACTS_IPC_SERVER
        int person_id;
@@ -537,19 +535,18 @@ void ctsvc_db_person_delete_callback(sqlite3_context * context,
         * CASE : do not know the proper new person_id
         */
        ctsvc_db_phone_log_update_person_id(NULL, person_id, -1, false);
-#endif // ENABLE_LOG_FEATURE
+#endif /* ENABLE_LOG_FEATURE */
        sqlite3_result_null(context);
        return;
 #endif
 }
 
-inline static const char* __ctsvc_get_image_filename(const char* src)
+static inline const char *__ctsvc_get_image_filename(const char *src)
 {
-       const chardir = CTSVC_CONTACT_IMG_FULL_LOCATION;
-       int pos=0;
-       while (dir[pos]==src[pos]) {
+       const char *dir = CTSVC_CONTACT_IMG_FULL_LOCATION;
+       int pos = 0;
+       while (dir[pos] == src[pos])
                pos++;
-       }
 
        if ('/' == src[pos])
                return src + pos + 1;
@@ -595,15 +592,15 @@ int ctsvc_person_aggregate(int person_id)
                        "FROM "CTS_TABLE_PERSONS" "
                        "WHERE persons.person_id = %d", person_id);
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        if (1 != ctsvc_stmt_step(stmt)) {
-               CTS_ERR("ctsvc_stmt_step() Fail\n");
+               ERR("ctsvc_stmt_step() Fail\n");
                return CONTACTS_ERROR_DB;
        }
        ret = contacts_record_create(_contacts_person._uri, (contacts_record_h*)&person);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("contacts_record_create() Fail\n");
+               ERR("contacts_record_create() Fail\n");
                return CONTACTS_ERROR_INTERNAL;
        }
        person->person_id = ctsvc_stmt_get_int(stmt, 0);
@@ -627,11 +624,9 @@ int ctsvc_person_aggregate(int person_id)
                                "AND D.datatype=%d AND D.is_primary_default = 1 AND D.data3='%s'",
                                person->person_id, CTSVC_DATA_IMAGE, temp);
                ret = ctsvc_query_get_first_int_result(query, &id);
-               if (ret == CONTACTS_ERROR_NONE) {
+               if (ret == CONTACTS_ERROR_NONE)
                        image_thumbnail_path = SAFE_STRDUP(temp);
-               }
-       }
-       else {
+       } else {
                image_thumbnail_path = NULL;
        }
 
@@ -645,8 +640,7 @@ int ctsvc_person_aggregate(int person_id)
        if (ret == CONTACTS_ERROR_NONE) {
                name_contact_id = person->name_contact_id;
                person_name_contact_id = person->name_contact_id;
-       }
-       else {
+       } else {
                name_contact_id = 0;
                person_name_contact_id = 0;
        }
@@ -660,7 +654,7 @@ int ctsvc_person_aggregate(int person_id)
                        CTS_TABLE_CONTACTS, CTS_TABLE_ACTIVITIES, person->person_id);
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                free(image_thumbnail_path);
                contacts_record_destroy((contacts_record_h)person, true);
                return ret;
@@ -680,11 +674,9 @@ int ctsvc_person_aggregate(int person_id)
                                "AND C.ringtone_path = '%s'",
                                person->person_id, person->ringtone_path);
                ret = ctsvc_query_get_first_int_result(query, &id);
-               if (ret == CONTACTS_ERROR_NONE) {
+               if (ret == CONTACTS_ERROR_NONE)
                        ringtone_path = SAFE_STRDUP(person->ringtone_path);
-               }
-       }
-       else {
+       } else {
                ringtone_path = NULL;
        }
 
@@ -696,11 +688,9 @@ int ctsvc_person_aggregate(int person_id)
                                "AND C.vibration = '%s'",
                                person->person_id, person->vibration);
                ret = ctsvc_query_get_first_int_result(query, &id);
-               if (ret == CONTACTS_ERROR_NONE) {
+               if (ret == CONTACTS_ERROR_NONE)
                        vibration = SAFE_STRDUP(person->vibration);
-               }
-       }
-       else {
+       } else {
                vibration = NULL;
        }
 
@@ -712,11 +702,9 @@ int ctsvc_person_aggregate(int person_id)
                                "AND C.message_alert = '%s'",
                                person->person_id, person->message_alert);
                ret = ctsvc_query_get_first_int_result(query, &id);
-               if (ret == CONTACTS_ERROR_NONE) {
+               if (ret == CONTACTS_ERROR_NONE)
                        message_alert = SAFE_STRDUP(person->message_alert);
-               }
-       }
-       else {
+       } else {
                message_alert = NULL;
        }
        contacts_record_destroy((contacts_record_h)person, true);
@@ -730,7 +718,7 @@ int ctsvc_person_aggregate(int person_id)
                        CTS_TABLE_CONTACTS, person_id);
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                free(image_thumbnail_path);
                free(ringtone_path);
                free(vibration);
@@ -774,8 +762,7 @@ int ctsvc_person_aggregate(int person_id)
                if (display_name_source_type < contact_display_name_source_type) {
                        display_name_source_type = contact_display_name_source_type;
                        name_contact_id = contact_id;
-               }
-               else if (contact_display_name_source_type == display_name_source_type) {
+               } else if (contact_display_name_source_type == display_name_source_type) {
                        if (name_contact_id != person_name_contact_id && person_name_contact_id != 0)
                                name_contact_id = person_name_contact_id;
                        else if (person_name_contact_id == 0 && name_contact_id == 0)
@@ -833,7 +820,7 @@ int ctsvc_person_aggregate(int person_id)
 
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                free(addressbook_ids);
                free(image_thumbnail_path);
                free(ringtone_path);
@@ -858,7 +845,7 @@ int ctsvc_person_aggregate(int person_id)
 
        ret = ctsvc_stmt_step(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                free(addressbook_ids);
                free(image_thumbnail_path);
@@ -883,7 +870,7 @@ int ctsvc_person_aggregate(int person_id)
                                "DELETE FROM "CTS_TABLE_FAVORITES" WHERE person_id = %d", person_id);
                ret = ctsvc_query_exec(query);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+                       ERR("ctsvc_query_exec() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -904,7 +891,7 @@ static bool __ctsvc_get_person_favorite_info(int person_id, double *priority)
        snprintf(query, sizeof(query),
                        "SELECT favorite_prio FROM "CTS_TABLE_FAVORITES" WHERE person_id = %d", person_id);
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 == ret) {
@@ -929,10 +916,10 @@ int ctsvc_person_link_person(int base_person_id, int person_id)
        double favorite_prio = 0.0;
 
        RETVM_IF(base_person_id == person_id, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : base_person_id(%d), person_id(%d)", base_person_id, person_id);
+                       "base_person_id(%d), person_id(%d)", base_person_id, person_id);
 
        ret = ctsvc_begin_trans();
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "DB error : ctsvc_begin_trans() Fail(%d)", ret);
+       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "ctsvc_begin_trans() Fail(%d)", ret);
 
        ret = __ctsvc_get_person_value(CTSVC_GET_PERSON_DEFAULT_NUMBER_VALUE, base_person_id, &record);
        if (CONTACTS_ERROR_NONE != ret) {
@@ -941,8 +928,7 @@ int ctsvc_person_link_person(int base_person_id, int person_id)
                        contacts_record_get_int(record, CTSVC_PROPERTY_NUMBER_ID, &default_number_id);
                        contacts_record_destroy(record, true);
                }
-       }
-       else {
+       } else {
                contacts_record_get_int(record, CTSVC_PROPERTY_NUMBER_ID, &default_number_id);
                contacts_record_destroy(record, true);
        }
@@ -954,8 +940,7 @@ int ctsvc_person_link_person(int base_person_id, int person_id)
                        contacts_record_get_int(record, CTSVC_PROPERTY_EMAIL_ID, &default_email_id);
                        contacts_record_destroy(record, true);
                }
-       }
-       else {
+       } else {
                contacts_record_get_int(record, CTSVC_PROPERTY_EMAIL_ID, &default_email_id);
                contacts_record_destroy(record, true);
        }
@@ -967,8 +952,7 @@ int ctsvc_person_link_person(int base_person_id, int person_id)
                        contacts_record_get_int(record, CTSVC_PROPERTY_IMAGE_ID, &default_image_id);
                        contacts_record_destroy(record, true);
                }
-       }
-       else {
+       } else {
                contacts_record_get_int(record, CTSVC_PROPERTY_IMAGE_ID, &default_image_id);
                contacts_record_destroy(record, true);
        }
@@ -982,7 +966,7 @@ int ctsvc_person_link_person(int base_person_id, int person_id)
                        CTS_TABLE_CONTACTS, base_person_id, person_id);
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -1012,7 +996,7 @@ int ctsvc_person_link_person(int base_person_id, int person_id)
                        CTS_TABLE_PERSONS, person_id);
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -1028,7 +1012,7 @@ int ctsvc_person_link_person(int base_person_id, int person_id)
                                "INSERT INTO "CTS_TABLE_FAVORITES" values(%d, %f)", base_person_id, favorite_prio);
                ret = ctsvc_query_exec(query);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+                       ERR("ctsvc_query_exec() Fail(%d)", ret);
                        ctsvc_end_trans(false);
                        return ret;
                }
@@ -1037,11 +1021,11 @@ int ctsvc_person_link_person(int base_person_id, int person_id)
        ctsvc_set_person_noti();
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
 static int __ctsvc_update_primary_default_data(int person_id)
@@ -1060,7 +1044,7 @@ static int __ctsvc_update_primary_default_data(int person_id)
                                "ORDER BY contact_id",
                                CTS_TABLE_CONTACTS, person_id);
                ret = ctsvc_query_prepare(query, &stmt);
-               RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
                while (1 == ctsvc_stmt_step(stmt)) {
                        int contact_id = ctsvc_stmt_get_int(stmt, 0);
@@ -1073,7 +1057,7 @@ static int __ctsvc_update_primary_default_data(int person_id)
 
                        ret = ctsvc_query_prepare(query, &stmt_number);
                        if (NULL == stmt_number) {
-                               CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+                               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                                ctsvc_stmt_finalize(stmt);
                                return ret;
                        }
@@ -1087,8 +1071,7 @@ static int __ctsvc_update_primary_default_data(int person_id)
                        ctsvc_stmt_finalize(stmt_number);
                }
                ctsvc_stmt_finalize(stmt);
-       }
-       else {
+       } else {
                contacts_record_destroy(record, true);
        }
 
@@ -1101,7 +1084,7 @@ static int __ctsvc_update_primary_default_data(int person_id)
                                "ORDER BY contact_id",
                                CTS_TABLE_CONTACTS, person_id);
                ret = ctsvc_query_prepare(query, &stmt);
-               RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
                while (1 == ctsvc_stmt_step(stmt)) {
                        int contact_id = ctsvc_stmt_get_int(stmt, 0);
@@ -1114,7 +1097,7 @@ static int __ctsvc_update_primary_default_data(int person_id)
 
                        ret = ctsvc_query_prepare(query, &stmt_email);
                        if (NULL == stmt_email) {
-                               CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+                               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                                ctsvc_stmt_finalize(stmt);
                                return ret;
                        }
@@ -1128,8 +1111,7 @@ static int __ctsvc_update_primary_default_data(int person_id)
                        ctsvc_stmt_finalize(stmt_email);
                }
                ctsvc_stmt_finalize(stmt);
-       }
-       else {
+       } else {
                contacts_record_destroy(record, true);
        }
 
@@ -1142,7 +1124,7 @@ static int __ctsvc_update_primary_default_data(int person_id)
                                "ORDER BY contact_id",
                                CTS_TABLE_CONTACTS, person_id);
                ret = ctsvc_query_prepare(query, &stmt);
-               RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
                while (1 == ctsvc_stmt_step(stmt)) {
                        int contact_id = ctsvc_stmt_get_int(stmt, 0);
@@ -1155,7 +1137,7 @@ static int __ctsvc_update_primary_default_data(int person_id)
 
                        ret = ctsvc_query_prepare(query, &stmt_image);
                        if (NULL == stmt_image) {
-                               CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+                               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                                ctsvc_stmt_finalize(stmt);
                                return ret;
                        }
@@ -1169,15 +1151,14 @@ static int __ctsvc_update_primary_default_data(int person_id)
                        ctsvc_stmt_finalize(stmt_image);
                }
                ctsvc_stmt_finalize(stmt);
-       }
-       else {
+       } else {
                contacts_record_destroy(record, true);
        }
 
        return CONTACTS_ERROR_NONE;
 }
 
-int ctsvc_person_unlink_contact(int person_id, int contact_id, intout_person_id)
+int ctsvc_person_unlink_contact(int person_id, int contact_id, int *out_person_id)
 {
        int ret;
        int id;
@@ -1188,7 +1169,7 @@ int ctsvc_person_unlink_contact(int person_id, int contact_id, int* out_person_i
        double priority = 0.0;
 
        RETVM_IF(person_id <= 0 || contact_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : person_id(%d), person_id(%d)", person_id, person_id);
+                       "person_id(%d), person_id(%d)", person_id, person_id);
 
        if (out_person_id)
                *out_person_id = 0;
@@ -1205,14 +1186,14 @@ int ctsvc_person_unlink_contact(int person_id, int contact_id, int* out_person_i
        }
 
        if (link_count == 1) {
-               CTS_ERR("This person(%d) has one contact(%d)", person_id, contact_id);
+               ERR("This person(%d) has one contact(%d)", person_id, contact_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
        ret = ctsvc_db_contact_get(contact_id, (contacts_record_h*)&record);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_db_contact_get() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_get() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -1220,7 +1201,7 @@ int ctsvc_person_unlink_contact(int person_id, int contact_id, int* out_person_i
        /* create new person */
        id = ctsvc_db_insert_person(record);
        if (id < CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_db_insert_person() Fail(%d)", id);
+               ERR("ctsvc_db_insert_person() Fail(%d)", id);
                ctsvc_end_trans(false);
                contacts_record_destroy(record, true);
                return id;
@@ -1233,7 +1214,7 @@ int ctsvc_person_unlink_contact(int person_id, int contact_id, int* out_person_i
                        CTS_TABLE_CONTACT_STAT, id, CTS_TABLE_CONTACT_STAT, person_id);
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                contacts_record_destroy(record, true);
                return ret;
@@ -1247,7 +1228,7 @@ int ctsvc_person_unlink_contact(int person_id, int contact_id, int* out_person_i
                        CTS_TABLE_CONTACTS, id, contact_id);
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                contacts_record_destroy(record, true);
                return ret;
@@ -1256,7 +1237,7 @@ int ctsvc_person_unlink_contact(int person_id, int contact_id, int* out_person_i
        /* update bsae person info */
        ret = ctsvc_person_aggregate(person_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_person_aggregate(%d) Fail(%d)", person_id, ret);
+               ERR("ctsvc_person_aggregate(%d) Fail(%d)", person_id, ret);
                ctsvc_end_trans(false);
                contacts_record_destroy(record, true);
                return ret;
@@ -1267,7 +1248,7 @@ int ctsvc_person_unlink_contact(int person_id, int contact_id, int* out_person_i
                                "INSERT OR REPLACE INTO "CTS_TABLE_FAVORITES" values(%d, %f)", id, priority);
                ret = ctsvc_query_exec(query);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+                       ERR("ctsvc_query_exec() Fail(%d)", ret);
                        ctsvc_end_trans(false);
                        contacts_record_destroy(record, true);
                        return ret;
@@ -1287,11 +1268,11 @@ int ctsvc_person_unlink_contact(int person_id, int contact_id, int* out_person_i
        ctsvc_set_person_noti();
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
 int ctsvc_person_do_garbage_collection(void)
@@ -1303,7 +1284,7 @@ int ctsvc_person_do_garbage_collection(void)
        snprintf(query, sizeof(query), "SELECT person_id FROM "CTS_TABLE_PERSONS" WHERE dirty=1");
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        while (1 /*CTS_TRUE*/ == ctsvc_stmt_step(stmt)) {
                int person_id;
@@ -1324,29 +1305,29 @@ int ctsvc_person_reset_usage(int person_id, contacts_usage_type_e type)
        int ret ;
        char query[CTS_SQL_MAX_LEN] = {0};
 
-       RETVM_IF(person_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,"contact_id should be greater than 0");
+       RETVM_IF(person_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER, "contact_id should be greater than 0");
 
        snprintf(query, sizeof(query),
                        "UPDATE %s SET times_used = 0 WHERE person_id = %d AND usage_type = %d",
                        CTS_TABLE_CONTACT_STAT, person_id, type);
 
        ret = ctsvc_begin_trans();
-       RETVM_IF(ret, ret, "DB error : ctsvc_begin_trans() Fail(%d)", ret);
+       RETVM_IF(ret, ret, "ctsvc_begin_trans() Fail(%d)", ret);
 
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
 int ctsvc_person_set_favorite_order(int person_id, int front_person_id, int back_person_id)
@@ -1361,7 +1342,7 @@ int ctsvc_person_set_favorite_order(int person_id, int front_person_id, int back
        snprintf(query, sizeof(query), "SELECT favorite_prio FROM "CTS_TABLE_FAVORITES" WHERE person_id = ?");
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ctsvc_stmt_bind_int(stmt, 1, front_person_id);
        ret = ctsvc_stmt_step(stmt);
@@ -1391,7 +1372,7 @@ int ctsvc_person_set_favorite_order(int person_id, int front_person_id, int back
 
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -1400,11 +1381,11 @@ int ctsvc_person_set_favorite_order(int person_id, int front_person_id, int back
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
 int ctsvc_person_set_default_property(contacts_person_property_e property, int person_id,
@@ -1415,7 +1396,7 @@ int ctsvc_person_set_default_property(contacts_person_property_e property, int p
        ret = ctsvc_begin_trans();
        RETVM_IF(ret < CONTACTS_ERROR_NONE, CONTACTS_ERROR_DB, "ctsvc_begin_trans() Fail(%d)", ret);
 
-       switch(property) {
+       switch (property) {
        case CONTACTS_PERSON_PROPERTY_NAME_CONTACT:
                ret = __ctsvc_put_person_default_name(person_id, id);           /* contact id */
                break;
@@ -1433,7 +1414,7 @@ int ctsvc_person_set_default_property(contacts_person_property_e property, int p
                break;
        }
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("contacts_person_set_default_property() Fail(%d) : person property (%d)", ret, property);
+               ERR("contacts_person_set_default_property() Fail(%d) : person property (%d)", ret, property);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -1453,10 +1434,10 @@ int ctsvc_person_get_default_property(contacts_person_property_e property, int p
        int ret = CONTACTS_ERROR_NONE;
        char query[CTS_SQL_MAX_LEN] = {0};
 
-       RETVM_IF(person_id <= 0 || id == NULL, CONTACTS_ERROR_INVALID_PARAMETER,"id should be greater than 0");
+       RETVM_IF(person_id <= 0 || id == NULL, CONTACTS_ERROR_INVALID_PARAMETER, "id should be greater than 0");
        *id = 0;
 
-       switch(property) {
+       switch (property) {
        case CONTACTS_PERSON_PROPERTY_NAME_CONTACT:
                snprintf(query, sizeof(query),
                                "SELECT name_contact_id FROM "CTS_TABLE_PERSONS" WHERE person_id = %d",
@@ -1491,7 +1472,7 @@ int ctsvc_person_get_default_property(contacts_person_property_e property, int p
        if (*query) {
                int result = 0;
                ret = ctsvc_query_get_first_int_result(query, &result);
-               RETVM_IF(ret != CONTACTS_ERROR_NONE, ret, "ctsvc_query_get_first_int_result Fail(%d)", ret);
+               RETVM_IF(ret != CONTACTS_ERROR_NONE, ret, "ctsvc_query_get_first_int_result() Fail(%d)", ret);
                *id = result;
        }
 
index c949453..9951de7 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -24,9 +24,9 @@
 
 int ctsvc_person_do_garbage_collection(void);
 int ctsvc_person_aggregate(int person_id);
-void ctsvc_db_person_delete_callback(sqlite3_context * context, int argc, sqlite3_value ** argv);
+void ctsvc_db_person_delete_callback(sqlite3_context  *context, int argc, sqlite3_value **argv);
 int ctsvc_person_link_person(int base_person_id, int person_id);
-int ctsvc_person_unlink_contact(int person_id, int contact_id, intout_person_id );
+int ctsvc_person_unlink_contact(int person_id, int contact_id, int *out_person_id );
 int ctsvc_person_reset_usage(int person_id, contacts_usage_type_e type);
 int ctsvc_person_set_favorite_order(int person_id, int front_person_id, int back_person_id);
 int ctsvc_person_set_default_property(contacts_person_property_e property, int person_id, int id);
index 52ad39d..c4d4ac2 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -38,7 +38,7 @@
 int ctsvc_phone_log_reset_statistics()
 {
        char query[CTS_SQL_MIN_LEN] = {0};
-       snprintf(query, sizeof(query),"DELETE FROM "CTS_TABLE_PHONELOG_STAT);
+       snprintf(query, sizeof(query), "DELETE FROM "CTS_TABLE_PHONELOG_STAT);
        return ctsvc_query_exec(query);
 }
 
@@ -50,7 +50,7 @@ int ctsvc_phone_log_delete(contacts_phone_log_delete_e op, ...)
        char *number = NULL;
        va_list args;
 
-       switch(op) {
+       switch (op) {
        case CONTACTS_PHONE_LOG_DELETE_BY_ADDRESS:
                va_start(args, op);
                number = va_arg(args, char *);
@@ -65,7 +65,7 @@ int ctsvc_phone_log_delete(contacts_phone_log_delete_e op, ...)
                snprintf(query, sizeof(query),
                                "DELETE FROM "CTS_TABLE_PHONELOGS" "
                                "WHERE data1 = %d AND %d <= log_type AND log_type <= %d",
-                                               extra_data1, CONTACTS_PLOG_TYPE_MMS_INCOMMING, CONTACTS_PLOG_TYPE_MMS_BLOCKED);
+                               extra_data1, CONTACTS_PLOG_TYPE_MMS_INCOMMING, CONTACTS_PLOG_TYPE_MMS_BLOCKED);
                break;
        case CONTACTS_PHONE_LOG_DELETE_BY_EMAIL_EXTRA_DATA1:
                va_start(args, op);
@@ -74,10 +74,10 @@ int ctsvc_phone_log_delete(contacts_phone_log_delete_e op, ...)
                snprintf(query, sizeof(query),
                                "DELETE FROM "CTS_TABLE_PHONELOGS" "
                                "WHERE data1 = %d AND %d <= log_type AND log_type <= %d",
-                                               extra_data1, CONTACTS_PLOG_TYPE_EMAIL_RECEIVED, CONTACTS_PLOG_TYPE_EMAIL_SENT);
+                               extra_data1, CONTACTS_PLOG_TYPE_EMAIL_RECEIVED, CONTACTS_PLOG_TYPE_EMAIL_SENT);
                break;
        default:
-               CTS_ERR("Invalid parameter : the operation is not proper (op : %d)", op);
+               ERR("the operation is not proper (op : %d)", op);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
        ret = ctsvc_begin_trans();
@@ -85,7 +85,7 @@ int ctsvc_phone_log_delete(contacts_phone_log_delete_e op, ...)
 
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -94,8 +94,8 @@ int ctsvc_phone_log_delete(contacts_phone_log_delete_e op, ...)
        return ret;
 }
 
-void ctsvc_db_phone_log_delete_callback(sqlite3_context context,
-               int argc, sqlite3_value ** argv)
+void ctsvc_db_phone_log_delete_callback(sqlite3_context  *context,
+               int argc, sqlite3_value **argv)
 {
 #ifdef _CONTACTS_IPC_SERVER
        int phone_log_id;
@@ -126,10 +126,10 @@ static int __ctsvc_db_phone_log_find_person_id(char *number, char *normal_num, c
        if (normal_num) {
                ret = snprintf(query, sizeof(query),
                                "SELECT person_id, data1 FROM "CTS_TABLE_CONTACTS", "CTS_TABLE_DATA" "
-                                       "ON "CTS_TABLE_CONTACTS".contact_id = "CTS_TABLE_DATA".contact_id "
-                                               "AND datatype = %d AND is_my_profile = 0 AND deleted = 0 "
-                                               "WHERE data4 = ? AND _NUMBER_COMPARE_(data5, ?, NULL, NULL)",
-                                       CTSVC_DATA_NUMBER);
+                               "ON "CTS_TABLE_CONTACTS".contact_id = "CTS_TABLE_DATA".contact_id "
+                               "AND datatype = %d AND is_my_profile = 0 AND deleted = 0 "
+                               "WHERE data4 = ? AND _NUMBER_COMPARE_(data5, ?, NULL, NULL)",
+                               CTSVC_DATA_NUMBER);
                bind_text = g_slist_append(bind_text, strdup(minmatch));
                bind_text = g_slist_append(bind_text, strdup(normal_num));
        }
@@ -142,9 +142,9 @@ static int __ctsvc_db_phone_log_find_person_id(char *number, char *normal_num, c
 
                ret = ctsvc_query_prepare(query, &stmt);
                if (stmt == NULL) {
-                       CTS_ERR("ctsvc_query_prepare fail(%d)", ret);
+                       ERR("ctsvc_query_prepare fail(%d)", ret);
                        if (bind_text) {
-                               for (cursor=bind_text;cursor;cursor=cursor->next)
+                               for (cursor = bind_text; cursor; cursor = cursor->next)
                                        free(cursor->data);
                                g_slist_free(bind_text);
                        }
@@ -152,7 +152,7 @@ static int __ctsvc_db_phone_log_find_person_id(char *number, char *normal_num, c
                }
 
                if (bind_text) {
-                       for (cursor=bind_text,i=1;cursor;cursor=cursor->next,i++) {
+                       for (cursor = bind_text, i = 1; cursor; cursor = cursor->next, i++) {
                                const char *text = cursor->data;
                                if (text && *text)
                                        ctsvc_stmt_bind_text(stmt, i, text);
@@ -179,7 +179,7 @@ static int __ctsvc_db_phone_log_find_person_id(char *number, char *normal_num, c
        }
 
        if (bind_text) {
-               for (cursor=bind_text;cursor;cursor=cursor->next)
+               for (cursor = bind_text; cursor; cursor = cursor->next)
                        free(cursor->data);
                g_slist_free(bind_text);
        }
@@ -200,12 +200,12 @@ int ctsvc_db_phone_log_update_person_id(const char *number, int old_person_id, i
        int i = 0;
 
        RETVM_IF(old_person_id <= 0 && NULL == number, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : old person_id (%d), numberis NULL", old_person_id);
+                       "old person_id (%d), number is NULL", old_person_id);
 
        len = snprintf(query, sizeof(query),
-                                       "SELECT id, number, normal_num, minmatch FROM "CTS_TABLE_PHONELOGS" "
-                                                                               "WHERE log_type <= %d ",
-                                       CONTACTS_PLOG_TYPE_EMAIL_RECEIVED);
+                       "SELECT id, number, normal_num, minmatch FROM "CTS_TABLE_PHONELOGS" "
+                       "WHERE log_type <= %d ",
+                       CONTACTS_PLOG_TYPE_EMAIL_RECEIVED);
 
        if (number && *number) {
                char clean_num[strlen(number)+1];
@@ -221,18 +221,18 @@ int ctsvc_db_phone_log_update_person_id(const char *number, int old_person_id, i
                                ret = ctsvc_get_minmatch_number(normal_num, minmatch, sizeof(minmatch), ctsvc_get_phonenumber_min_match_digit());
                                if (CONTACTS_ERROR_NONE == ret) {
                                        len += snprintf(query+len, sizeof(query)-len,
-                                               "OR (minmatch = ? AND _NUMBER_COMPARE_(normal_num, ?, NULL, NULL))) ");
+                                                       "OR (minmatch = ? AND _NUMBER_COMPARE_(normal_num, ?, NULL, NULL))) ");
                                        bind_text = g_slist_append(bind_text, strdup(minmatch));
                                        bind_text = g_slist_append(bind_text, strdup(normal_num));
-                               }
-                               else
+                               } else {
                                        len += snprintf(query+len, sizeof(query)-len, ") ");
-                       }
-                       else
+                               }
+                       } else {
                                len += snprintf(query+len, sizeof(query)-len, ") ");
-               }
-               else
+                       }
+               } else {
                        len += snprintf(query+len, sizeof(query)-len, ") ");
+               }
        }
 
        if (0 < old_person_id)
@@ -242,9 +242,9 @@ int ctsvc_db_phone_log_update_person_id(const char *number, int old_person_id, i
 
        ret = ctsvc_query_prepare(query, &get_log);
        if (get_log == NULL) {
-               CTS_ERR("ctsvc_query_prepare fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                if (bind_text) {
-                       for (cursor=bind_text;cursor;cursor=cursor->next)
+                       for (cursor = bind_text; cursor; cursor = cursor->next)
                                free(cursor->data);
                        g_slist_free(bind_text);
                }
@@ -252,21 +252,22 @@ int ctsvc_db_phone_log_update_person_id(const char *number, int old_person_id, i
        }
 
        if (bind_text) {
-               for (cursor=bind_text,i=1;cursor;cursor=cursor->next,i++) {
+               for (cursor = bind_text, i = 1; cursor; cursor = cursor->next, i++) {
                        const char *text = cursor->data;
                        if (text && *text)
                                ctsvc_stmt_bind_text(get_log, i, text);
                }
        }
 
-       snprintf(query, sizeof(query), "UPDATE "CTS_TABLE_PHONELOGS" SET person_id=?, number_type = ? WHERE id = ?");
+       snprintf(query, sizeof(query),
+                       "UPDATE "CTS_TABLE_PHONELOGS" SET person_id=?, number_type = ? WHERE id = ?");
        ret = ctsvc_query_prepare(query, &update_log);
        if (update_log == NULL) {
-               CTS_ERR("ctsvc_query_prepare fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                ctsvc_stmt_finalize(get_log);
 
                if (bind_text) {
-                       for (cursor=bind_text;cursor;cursor=cursor->next)
+                       for (cursor = bind_text; cursor; cursor = cursor->next)
                                free(cursor->data);
                        g_slist_free(bind_text);
                }
@@ -277,7 +278,7 @@ int ctsvc_db_phone_log_update_person_id(const char *number, int old_person_id, i
                int phonelog_id;
                int new_person_id = -1;
                int temp_id;
-               int number_type= -1;
+               int number_type = -1;
                char *address;
                char *normal_address;
                char *minmatch_address;
@@ -291,35 +292,30 @@ int ctsvc_db_phone_log_update_person_id(const char *number, int old_person_id, i
                if (number && old_person_id <= 0 && 0 < candidate_person_id) {
                        __ctsvc_db_phone_log_find_person_id(address, normal_address, minmatch_address, candidate_person_id, &number_type);
                        new_person_id = candidate_person_id;
-               }
-               /* CASE : phonelog insert without person_id */
-               else if (number && old_person_id <= 0) {
+               } else if (number && old_person_id <= 0) {
+                       /* CASE : phonelog insert without person_id */
                        /* address == number */
                        new_person_id = __ctsvc_db_phone_log_find_person_id(address, normal_address, minmatch_address, -1, &number_type);
                        if (new_person_id <= 0) continue;
-               }
-               /* CASE : number update/delete (contact update/delete) => find new_person_id by address */
-               /* CASE : phonelog insert with person_id */
-               else if (number && 0 < old_person_id) {
+               } else if (number && 0 < old_person_id) {
+                       /* CASE : number update/delete (contact update/delete) => find new_person_id by address */
+                       /* CASE : phonelog insert with person_id */
                        /* address == number */
                        /* although new_person_id and old_person_id are same, update phonelog for setting number_type */
                        new_person_id = __ctsvc_db_phone_log_find_person_id(address, normal_address, minmatch_address, old_person_id, &number_type);
-               }
-               /* CASE : person link => deleted person_id -> new person_id (base_person_id) */
-               else if (NULL == number && 0 < old_person_id && 0 < candidate_person_id && person_link) {
+               } else if (NULL == number && 0 < old_person_id && 0 < candidate_person_id && person_link) {
+                       /* CASE : person link => deleted person_id -> new person_id (base_person_id) */
                        new_person_id = candidate_person_id;
-               }
-               /* CASE : person unlink => check person_id of the address, */
-               /* if person_id is not old_person_id then change person_id to new_person_id */
-               else if (NULL == number && 0 < old_person_id && 0 < candidate_person_id) {
+               } else if (NULL == number && 0 < old_person_id && 0 < candidate_person_id) {
+                       /* CASE : person unlink => check person_id of the address, */
+                       /* if person_id is not old_person_id then change person_id to new_person_id */
                        temp_id = __ctsvc_db_phone_log_find_person_id(address, normal_address, minmatch_address, candidate_person_id, &number_type);
                        if (0 < temp_id && temp_id == old_person_id)
                                continue;
                        else if (0 < temp_id && temp_id != old_person_id)
                                new_person_id = temp_id;
-               }
-               /* CASE : person delete => find new_person_id by address */
-               else if (NULL == number && 0 < old_person_id) {
+               } else if (NULL == number && 0 < old_person_id) {
+                       /* CASE : person delete => find new_person_id by address */
                        new_person_id = __ctsvc_db_phone_log_find_person_id(address, normal_address, minmatch_address, candidate_person_id, &number_type);
                }
                /* Already check this case as above : RETVM_IF(old_person_id <= 0 && NULL == number, ... */
@@ -340,7 +336,7 @@ int ctsvc_db_phone_log_update_person_id(const char *number, int old_person_id, i
        ctsvc_stmt_finalize(update_log);
 
        if (bind_text) {
-               for (cursor=bind_text;cursor;cursor=cursor->next)
+               for (cursor = bind_text; cursor; cursor = cursor->next)
                        free(cursor->data);
                g_slist_free(bind_text);
        }
index 5ba8e1a..0daad92 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -25,8 +25,8 @@
 
 int ctsvc_phone_log_reset_statistics();
 int ctsvc_phone_log_delete(contacts_phone_log_delete_e op, ...);
-void ctsvc_db_phone_log_delete_callback(sqlite3_context context,
-               int argc, sqlite3_value ** argv);
+void ctsvc_db_phone_log_delete_callback(sqlite3_context  *context,
+               int argc, sqlite3_value **argv);
 int ctsvc_db_phone_log_update_person_id(const char *number, int old_person_id, int candidate_person_id, bool person_link);
 
 #endif /* __CTSVC_SERVER_PHONELOG_H__ */
index 9433314..f73fb2e 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
@@ -47,23 +43,23 @@ int ctsvc_connect()
        if (0 == ctsvc_connection) {
                ret = ctsvc_inotify_init();
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_inotify_init() Fail(%d)", ret);
+                       ERR("ctsvc_inotify_init() Fail(%d)", ret);
                        ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION);
                        return ret;
                }
                ctsvc_db_plugin_init();
                ctsvc_view_uri_init();
                ctsvc_register_vconf();
+       } else {
+               DBG("System : Contacts service has been already connected");
        }
-       else
-               CTS_DBG("System : Contacts service has been already connected");
 
        ctsvc_connection++;
 
        if (0 == thread_connection) {
                ret = ctsvc_db_init();
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_db_init() Fail(%d)", ret);
+                       ERR("ctsvc_db_init() Fail(%d)", ret);
                        ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION);
                        return ret;
                }
@@ -81,9 +77,8 @@ int ctsvc_disconnect()
 
        if (1 == thread_connection) {
                ctsvc_db_deinit();
-       }
-       else if (thread_connection <= 0) {
-               CTS_DBG("System : please call contacts_connect_on_thread(), thread_connection count is (%d)", thread_connection);
+       } else if (thread_connection <= 0) {
+               DBG("System : please call contacts_connect_on_thread(), thread_connection count is (%d)", thread_connection);
                ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
@@ -95,11 +90,10 @@ int ctsvc_disconnect()
                ctsvc_view_uri_deinit();
                ctsvc_db_plugin_deinit();
                ctsvc_deinit_tapi_handle_for_cc();
-       }
-       else if (1 < ctsvc_connection)
-               CTS_DBG("System : connection count is %d", ctsvc_connection);
-       else {
-               CTS_DBG("System : please call contacts_connect(), connection count is (%d)", ctsvc_connection);
+       } else if (1 < ctsvc_connection) {
+               DBG("System : connection count is %d", ctsvc_connection);
+       } else {
+               DBG("System : please call contacts_connect(), connection count is (%d)", ctsvc_connection);
                ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
@@ -117,9 +111,8 @@ int ctsvc_contacts_internal_disconnect()
                ctsvc_db_deinit();
                thread_connection--;
 
-               if (1 <= ctsvc_connection) {
+               if (1 <= ctsvc_connection)
                        ctsvc_connection--;
-               }
        }
 
        ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION);
index 604701e..375e46f 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
index 2d87e05..b8e7588 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
@@ -54,7 +50,7 @@ int ctsvc_setting_get_name_display_order(contacts_name_display_order_e *order)
 
        if (name_display_order < 0) {
                ret = vconf_get_int(CTSVC_VCONF_DISPLAY_ORDER, &name_display_order);
-               RETVM_IF(ret<0, CONTACTS_ERROR_SYSTEM, "System : vconf_get_int() Fail(%d)", ret);
+               RETVM_IF(ret < 0, CONTACTS_ERROR_SYSTEM, "System : vconf_get_int() Fail(%d)", ret);
        }
 
        *order = name_display_order;
@@ -66,13 +62,13 @@ int ctsvc_setting_set_name_display_order(contacts_name_display_order_e order)
 {
        int ret;
        RETVM_IF(CONTACTS_NAME_DISPLAY_ORDER_FIRSTLAST != order && CONTACTS_NAME_DISPLAY_ORDER_LASTFIRST != order,
-                       CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : The parameter(order:%d) is Invalid", name_display_order);
+                       CONTACTS_ERROR_INVALID_PARAMETER, "The parameter(order:%d) is Invalid", name_display_order);
 
        if (order == name_display_order)
                return CONTACTS_ERROR_NONE;
 
        ret = vconf_set_int(CTSVC_VCONF_DISPLAY_ORDER, order);
-       RETVM_IF(ret<0, CONTACTS_ERROR_SYSTEM, "System : vconf_set_int(display order) Fail(%d)", ret);
+       RETVM_IF(ret < 0, CONTACTS_ERROR_SYSTEM, "System : vconf_set_int(display order) Fail(%d)", ret);
 
        name_display_order = order;
 
@@ -84,7 +80,7 @@ int ctsvc_setting_get_name_sorting_order(contacts_name_sorting_order_e *order)
        int ret;
        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);
+               RETVM_IF(ret < 0, CONTACTS_ERROR_SYSTEM, "System : vconf_get_int(sort order) Fail(%d)", ret);
        }
 
        *order = name_sorting_order;
@@ -96,13 +92,13 @@ int ctsvc_setting_set_name_sorting_order(contacts_name_sorting_order_e order)
 {
        int ret;
        RETVM_IF(CONTACTS_NAME_SORTING_ORDER_FIRSTLAST != order && CONTACTS_NAME_SORTING_ORDER_LASTFIRST != order,
-                       CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : The parameter(order:%d) is Invalid", name_sorting_order);
+                       CONTACTS_ERROR_INVALID_PARAMETER, "The parameter(order:%d) is Invalid", name_sorting_order);
 
        if (order == name_sorting_order)
                return CONTACTS_ERROR_NONE;
 
        ret = vconf_set_int(CTSVC_VCONF_SORTING_ORDER, order);
-       RETVM_IF(ret<0, CONTACTS_ERROR_SYSTEM, "System : vconf_set_int(sort order) Fail(%d)", ret);
+       RETVM_IF(ret < 0, CONTACTS_ERROR_SYSTEM, "System : vconf_set_int(sort order) Fail(%d)", ret);
 
        name_sorting_order = order;
 
@@ -146,30 +142,30 @@ int ctsvc_register_vconf(void)
        int ret;
 
 
-       // display order
+       /* display order */
        ret = vconf_get_int(CTSVC_VCONF_DISPLAY_ORDER, &name_display_order);
        if (ret < 0) {
-               CTS_ERR("vconf_get_int() Fail(%d)", ret);
+               ERR("vconf_get_int() Fail(%d)", ret);
                name_display_order = CONTACTS_NAME_DISPLAY_ORDER_FIRSTLAST;
        }
        ret = vconf_notify_key_changed(CTSVC_VCONF_DISPLAY_ORDER,
                        ctsvc_vconf_display_order_cb, NULL);
-       RETVM_IF(ret<0, CONTACTS_ERROR_SYSTEM, "vconf_notify_key_changed(display order) Fail(%d)", ret);
+       RETVM_IF(ret < 0, CONTACTS_ERROR_SYSTEM, "vconf_notify_key_changed(display order) Fail(%d)", ret);
 
-       // sorting order
+       /* sorting order */
        ret = vconf_get_int(CTSVC_VCONF_SORTING_ORDER, &name_sorting_order);
        if (ret < 0) {
-               CTS_ERR("vconf_get_int() Fail(%d)", ret);
+               ERR("vconf_get_int() Fail(%d)", ret);
                name_sorting_order = CONTACTS_NAME_SORTING_ORDER_FIRSTLAST;
        }
        ret = vconf_notify_key_changed(CTSVC_VCONF_SORTING_ORDER,
                        ctsvc_vconf_sorting_order_cb, NULL);
-       RETVM_IF(ret<0, CONTACTS_ERROR_SYSTEM, "vconf_notify_key_changed(sort order) Fail(%d)", ret);
+       RETVM_IF(ret < 0, CONTACTS_ERROR_SYSTEM, "vconf_notify_key_changed(sort order) Fail(%d)", ret);
 
        /* phonenumber min match digit */
        ret = vconf_get_int(CTSVC_VCONF_PHONENUMBER_MIN_MATCH_DIGIT, &phonenumber_min_match_digit);
        if (ret < 0) {
-               CTS_ERR("vconf_get_int() Fail(%d)", ret);
+               ERR("vconf_get_int() Fail(%d)", ret);
                phonenumber_min_match_digit = 8;
        }
 
@@ -179,7 +175,7 @@ int ctsvc_register_vconf(void)
 
        ret = vconf_notify_key_changed(ctsvc_get_default_sort_vconfkey(),
                        ctsvc_vconf_sort_change_cb, NULL);
-       RETVM_IF(ret<0, CONTACTS_ERROR_SYSTEM, "vconf_notify_key_changed(deafult lang) Fail(%d)", ret);
+       RETVM_IF(ret < 0, CONTACTS_ERROR_SYSTEM, "vconf_notify_key_changed(deafult lang) Fail(%d)", ret);
 
        return CONTACTS_ERROR_NONE;
 }
@@ -190,12 +186,12 @@ void ctsvc_deregister_vconf(void)
 
 
        ret = vconf_ignore_key_changed(CTSVC_VCONF_DISPLAY_ORDER, ctsvc_vconf_display_order_cb);
-       RETM_IF(ret<0,"vconf_ignore_key_changed(display order) Fail(%d)", ret);
+       RETM_IF(ret < 0, "vconf_ignore_key_changed(display order) Fail(%d)", ret);
        ret = vconf_ignore_key_changed(CTSVC_VCONF_SORTING_ORDER, ctsvc_vconf_sorting_order_cb);
-       RETM_IF(ret<0,"vconf_ignore_key_changed(sort order) Fail(%d)", ret);
+       RETM_IF(ret < 0, "vconf_ignore_key_changed(sort order) Fail(%d)", ret);
 
        ret = vconf_ignore_key_changed(ctsvc_get_default_sort_vconfkey(), ctsvc_vconf_sort_change_cb);
-       RETM_IF(ret<0,"vconf_ignore_key_changed(default_lang) Fail(%d)", ret);
+       RETM_IF(ret < 0, "vconf_ignore_key_changed(default_lang) Fail(%d)", ret);
 }
 
 int ctsvc_get_phonenumber_min_match_digit(void)
@@ -204,7 +200,7 @@ int ctsvc_get_phonenumber_min_match_digit(void)
        if (phonenumber_min_match_digit <= 0) {
                ret = vconf_get_int(CTSVC_VCONF_PHONENUMBER_MIN_MATCH_DIGIT, &phonenumber_min_match_digit);
                if (ret < 0) {
-                       CTS_ERR("vconf_get_int() Fail(%d)", ret);
+                       ERR("vconf_get_int() Fail(%d)", ret);
                        phonenumber_min_match_digit = 8;
                }
        }
index bdc5eb7..77670f5 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
index 050a39f..802d4ab 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -56,7 +56,7 @@ typedef struct {
        unsigned int index_max;
        unsigned int text_max;
        unsigned int used_count;
-}sim_file_s;
+} sim_file_s;
 
 typedef struct {
        /* SIM slot number */
@@ -94,13 +94,13 @@ typedef struct {
         * It should be save to phone log table
         * in order to find which SIM is used to the call/message log
         */
-       charsim_unique_id;
+       char *sim_unique_id;
 
 } ctsvc_sim_info_s;
 
 
 static GSList *__ctsvc_sim_info = NULL;
-static voidgreturn_data = NULL;
+static void *greturn_data = NULL;
 static bool __ctsvc_tapi_cb = false;
 static bool __ctsvc_sim_cb = false;
 
@@ -114,10 +114,9 @@ static TapiHandle* __ctsvc_server_sim_get_tapi_handle(ctsvc_sim_info_s *info)
                vconf_get_bool(VCONFKEY_TELEPHONY_READY, &bReady);
 
                if (0 == bReady) {
-                       CTS_ERR("telephony is not ready ");
+                       ERR("telephony is not ready ");
                        return NULL;
-               }
-               else {
+               } else {
                        info->handle = tel_init(info->cp_name);
                        RETVM_IF(NULL == info->handle, NULL, "tel_init() Fail");
                }
@@ -126,14 +125,15 @@ static TapiHandle* __ctsvc_server_sim_get_tapi_handle(ctsvc_sim_info_s *info)
        return info->handle;
 }
 
-static inline void __ctsvc_server_sim_set_return_data(voiddata)
+static inline void __ctsvc_server_sim_set_return_data(void *data)
 {
        greturn_data = data;
 }
 
 static inline void* __ctsvc_server_sim_get_return_data(void)
 {
-       RETVM_IF(NULL == greturn_data, NULL, "greturn_data is NULL");
+       RETV_IF(NULL == greturn_data, NULL);
+
        return greturn_data;
 }
 
@@ -157,9 +157,9 @@ static void __ctsvc_server_sim_record_destroy(sim_contact_s *record)
 
 static sim_contact_s * __ctsvc_server_sim_record_clone(TelSimPbRecord_t *sim_record)
 {
-       sim_contact_s *record = calloc(1,sizeof(sim_contact_s));
+       sim_contact_s *record = calloc(1, sizeof(sim_contact_s));
        if (NULL == record) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                return NULL;
        }
 
@@ -204,14 +204,14 @@ static inline int __ctsvc_server_sim_record_add_email(contacts_record_h *record,
        RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create() Fail(%d)", ret);
        ret = contacts_record_set_str(*record, _contacts_email.email, email);
        RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_set_str() Fail(%d)", ret);
-       ret = contacts_record_set_int(*record, _contacts_email.type,CONTACTS_EMAIL_TYPE_OTHER);
+       ret = contacts_record_set_int(*record, _contacts_email.type, CONTACTS_EMAIL_TYPE_OTHER);
        RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_set_int() Fail(%d)", ret);
 
        return ret;
 }
 
 static int __ctsvc_server_sim_ctsvc_record_clone(sim_contact_s *record,
-       int addressbook_id, contacts_record_h *contact)
+               int addressbook_id, contacts_record_h *contact)
 {
        CTS_FN_CALL;
        int ret;
@@ -225,7 +225,7 @@ static int __ctsvc_server_sim_ctsvc_record_clone(sim_contact_s *record,
        RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
        RETVM_IF(record->sim_index <= 0, CONTACTS_ERROR_INVALID_PARAMETER, "The index(%d) is invalid", record->sim_index);
 
-       CTS_DBG("insert record->sim_index %d", record->sim_index);
+       DBG("insert record->sim_index %d", record->sim_index);
 
        ret = contacts_record_create(_contacts_contact._uri, contact);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "contacts_record_create Fail(%d)", ret);
@@ -295,7 +295,7 @@ static int __ctsvc_server_sim_ctsvc_record_clone(sim_contact_s *record,
 static ctsvc_sim_info_s* __ctsvc_server_sim_get_handle_by_tapi_handle(TapiHandle *handle)
 {
        GSList *cursor = NULL;
-       for (cursor=__ctsvc_sim_info;cursor;cursor=cursor->next) {
+       for (cursor = __ctsvc_sim_info; cursor; cursor = cursor->next) {
                ctsvc_sim_info_s *info = cursor->data;
                if (info->handle == handle)
                        return info;
@@ -310,7 +310,7 @@ static ctsvc_sim_info_s* __ctsvc_server_sim_get_handle_by_sim_slot_no(int slot_n
        if (slot_no < 0)
                return NULL;
 
-       for (cursor=__ctsvc_sim_info;cursor;cursor=cursor->next) {
+       for (cursor = __ctsvc_sim_info; cursor; cursor = cursor->next) {
                ctsvc_sim_info_s *info = cursor->data;
                if (info->sim_slot_no == slot_no) {
                        if (NULL == __ctsvc_server_sim_get_tapi_handle(info))
@@ -328,7 +328,7 @@ int ctsvc_server_sim_get_info_id_by_sim_slot_no(int slot_no)
        if (slot_no < 0)
                return -1;
 
-       for (cursor=__ctsvc_sim_info;cursor;cursor=cursor->next) {
+       for (cursor = __ctsvc_sim_info; cursor; cursor = cursor->next) {
                ctsvc_sim_info_s *info = cursor->data;
                if (info->sim_slot_no == slot_no) {
                        if (NULL == __ctsvc_server_sim_get_tapi_handle(info))
@@ -342,7 +342,7 @@ int ctsvc_server_sim_get_info_id_by_sim_slot_no(int slot_no)
 int ctsvc_server_sim_get_sim_slot_no_by_info_id(int sim_info_id)
 {
        GSList *cursor = NULL;
-       for (cursor=__ctsvc_sim_info;cursor;cursor=cursor->next) {
+       for (cursor = __ctsvc_sim_info; cursor; cursor = cursor->next) {
                ctsvc_sim_info_s *info = cursor->data;
                if (info->sim_info_id == sim_info_id) {
                        if (NULL == __ctsvc_server_sim_get_tapi_handle(info))
@@ -382,21 +382,21 @@ static int __ctsvc_server_sim_insert_records_to_db(ctsvc_sim_info_s *info)
        /* insert contacts to DB */
        ret = contacts_list_create(&list);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("contacts_list_create() Fail(%d)", ret);
+               ERR("contacts_list_create() Fail(%d)", ret);
                return CONTACTS_ERROR_INTERNAL;
        }
 
-       for (cursor = info->import_contacts, i=0;cursor;i++) {
+       for (cursor = info->import_contacts, i = 0; cursor; i++) {
                record = cursor->data;
                ret = __ctsvc_server_sim_ctsvc_record_clone(record, DEFAULT_ADDRESS_BOOK_ID, &contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("__ctsvc_server_sim_ctsvc_record_clone() Fail(%d)", ret);
+                       ERR("__ctsvc_server_sim_ctsvc_record_clone() Fail(%d)", ret);
                        contacts_list_destroy(list, true);
                        return CONTACTS_ERROR_INTERNAL;
                }
                ret = contacts_list_add(list, contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("contacts_list_add() Fail(%d)", ret);
+                       ERR("contacts_list_add() Fail(%d)", ret);
                        contacts_list_destroy(list, true);
                        return CONTACTS_ERROR_INTERNAL;
                }
@@ -404,11 +404,11 @@ static int __ctsvc_server_sim_insert_records_to_db(ctsvc_sim_info_s *info)
        }
 
        contacts_list_get_count(list, &count);
-       CTS_DBG("records count:%d", count);
+       DBG("records count:%d", count);
        if (0 < count) {
                ret = ctsvc_db_insert_records(list, NULL, NULL);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_db_insert_records() Fail(%d)", ret);
+                       ERR("ctsvc_db_insert_records() Fail(%d)", ret);
                        contacts_list_destroy(list, true);
                        return ret;
                }
@@ -418,7 +418,7 @@ static int __ctsvc_server_sim_insert_records_to_db(ctsvc_sim_info_s *info)
        return CONTACTS_ERROR_NONE;
 }
 
-static void __ctsvc_server_sim_import_contact_cb(TapiHandle *handle, int result, void *data, voiduser_data)
+static void __ctsvc_server_sim_import_contact_cb(TapiHandle *handle, int result, void *data, void *user_data)
 {
        CTS_FN_CALL;
        int ret = 0;
@@ -428,7 +428,7 @@ static void __ctsvc_server_sim_import_contact_cb(TapiHandle *handle, int result,
        ctsvc_sim_info_s *info;
 
        if (NULL == sim_info) {
-               CTS_ERR("sim_info is NULL, result = %d", access_rt);
+               ERR("sim_info is NULL, result = %d", access_rt);
                ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), CONTACTS_ERROR_SYSTEM, 0, NULL);
                WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_socket_return() Fail(%d)", ret);
                __ctsvc_server_sim_set_return_data(NULL);
@@ -437,7 +437,7 @@ static void __ctsvc_server_sim_import_contact_cb(TapiHandle *handle, int result,
 
        info = __ctsvc_server_sim_get_handle_by_tapi_handle(handle);
        if (NULL == info) {
-               CTS_ERR("__ctsvc_server_sim_get_handle_by_tapi_handle() Fail");
+               ERR("__ctsvc_server_sim_get_handle_by_tapi_handle() Fail");
                ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), CONTACTS_ERROR_INTERNAL, 0, NULL);
                WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_socket_return() Fail(%d)", ret);
                __ctsvc_server_sim_set_return_data(NULL);
@@ -448,10 +448,10 @@ static void __ctsvc_server_sim_import_contact_cb(TapiHandle *handle, int result,
                int start_index = 0;
                if (user_data)
                        start_index = (int)user_data;
-               CTS_DBG("TAPI_SIM_PB_INVALID_INDEX : start_index = %d",start_index);
+               DBG("TAPI_SIM_PB_INVALID_INDEX : start_index = %d", start_index);
                start_index++;
                if (info->file_record[TAPI_PB_3G_NAME].index_max < start_index) {
-                       CTS_ERR("start_index is invalid start_index = %d, total = %d", start_index,
+                       ERR("start_index is invalid start_index = %d, total = %d", start_index,
                                        info->file_record[TAPI_PB_3G_NAME].index_max);
                        ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), CONTACTS_ERROR_INTERNAL, 0, NULL);
                        WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_socket_return() Fail(%d)", ret);
@@ -462,7 +462,7 @@ static void __ctsvc_server_sim_import_contact_cb(TapiHandle *handle, int result,
                ret = tel_read_sim_pb_record(handle, info->sim_type, start_index,
                                __ctsvc_server_sim_import_contact_cb, (void*)start_index);
                if (TAPI_API_SUCCESS != ret) {
-                       CTS_ERR("SIM phonebook access Fail(%d) start_indext(%d)", access_rt,start_index);
+                       ERR("SIM phonebook access Fail(%d) start_indext(%d)", access_rt, start_index);
                        ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), CONTACTS_ERROR_SYSTEM, 0, NULL);
                        WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_socket_return() Fail(%d)", ret);
                        __ctsvc_server_sim_destroy_import_contacts(info);
@@ -473,7 +473,7 @@ static void __ctsvc_server_sim_import_contact_cb(TapiHandle *handle, int result,
        }
 
        if (TAPI_SIM_PB_SUCCESS != access_rt) {
-               CTS_ERR("SIM phonebook access Fail(%d)", access_rt);
+               ERR("SIM phonebook access Fail(%d)", access_rt);
                ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), CONTACTS_ERROR_SYSTEM, 0, NULL);
                WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_socket_return() Fail(%d)", ret);
                __ctsvc_server_sim_destroy_import_contacts(info);
@@ -490,7 +490,7 @@ static void __ctsvc_server_sim_import_contact_cb(TapiHandle *handle, int result,
        case TAPI_SIM_PB_FDN:
        case TAPI_SIM_PB_SDN:
        default:
-               CTS_ERR("Unknown storage type(%d)", sim_info->phonebook_type);
+               ERR("Unknown storage type(%d)", sim_info->phonebook_type);
                ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), CONTACTS_ERROR_SYSTEM, 0, NULL);
                WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_socket_return() Fail(%d)", ret);
                __ctsvc_server_sim_destroy_import_contacts(info);
@@ -499,20 +499,19 @@ static void __ctsvc_server_sim_import_contact_cb(TapiHandle *handle, int result,
        }
 
        if (sim_info->next_index && CTSVC_TAPI_SIM_PB_MAX != sim_info->next_index) {
-               CTS_DBG("NextIndex = %d", sim_info->next_index);
+               DBG("NextIndex = %d", sim_info->next_index);
                ret = tel_read_sim_pb_record(__ctsvc_server_sim_get_tapi_handle(info), sim_info->phonebook_type,
                                sim_info->next_index, __ctsvc_server_sim_import_contact_cb, NULL);
 
                if (TAPI_API_SUCCESS != ret) {
-                       CTS_ERR("tel_read_sim_pb_record() Fail(%d)", ret);
+                       ERR("tel_read_sim_pb_record() Fail(%d)", ret);
                        ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), CONTACTS_ERROR_SYSTEM, 0, NULL);
                        WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_socket_return() Fail(%d)", ret);
                        __ctsvc_server_sim_destroy_import_contacts(info);
                        __ctsvc_server_sim_set_return_data(NULL);
                        return;
                }
-       }
-       else {
+       } else {
                /* insert imported contact to DB */
                ret = __ctsvc_server_sim_insert_records_to_db(info);
                ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), ret, 0, NULL);
@@ -522,7 +521,7 @@ static void __ctsvc_server_sim_import_contact_cb(TapiHandle *handle, int result,
        }
 }
 
-int ctsvc_server_sim_import_contact(voiddata, int sim_slot_no)
+int ctsvc_server_sim_import_contact(void *data, int sim_slot_no)
 {
        CTS_FN_CALL;
        int ret;
@@ -546,7 +545,7 @@ int ctsvc_server_sim_import_contact(void* data, int sim_slot_no)
        ret = tel_read_sim_pb_record(__ctsvc_server_sim_get_tapi_handle(info), info->sim_type, 1,
                        __ctsvc_server_sim_import_contact_cb, NULL);
        if (TAPI_API_SUCCESS != ret) {
-               CTS_ERR("tel_read_sim_pb_record = %d",ret);
+               ERR("tel_read_sim_pb_record = %d", ret);
                __ctsvc_server_sim_set_return_data(NULL);
                return CONTACTS_ERROR_SYSTEM;
        }
@@ -554,7 +553,7 @@ int ctsvc_server_sim_import_contact(void* data, int sim_slot_no)
        return CONTACTS_ERROR_NONE;
 }
 
-int ctsvc_server_socket_get_sim_init_status(voiddata, int sim_slot_no)
+int ctsvc_server_socket_get_sim_init_status(void *data, int sim_slot_no)
 {
        CTS_FN_CALL;
        ctsvc_sim_info_s *info;
@@ -567,7 +566,7 @@ int ctsvc_server_socket_get_sim_init_status(void* data, int sim_slot_no)
 static void __ctsvc_server_sim_sdn_read_cb(TapiHandle *handle, int result, void *data, void *user_data)
 {
        CTS_FN_CALL;
-       int ret=0;
+       int ret = 0;
        TelSimPbAccessResult_t access_rt = result;
        TelSimPbRecord_t *sim_info = data;
        ctsvc_sim_info_s *info = (ctsvc_sim_info_s*)user_data;
@@ -577,12 +576,12 @@ static void __ctsvc_server_sim_sdn_read_cb(TapiHandle *handle, int result, void
        if (TAPI_SIM_PB_SUCCESS != access_rt) {
                if (TAPI_SIM_PB_SDN == sim_info->phonebook_type &&
                                TAPI_SIM_PB_INVALID_INDEX == access_rt) {
-                       CTS_DBG("Index = %d", sim_info->index);
+                       DBG("Index = %d", sim_info->index);
                        ret = tel_read_sim_pb_record(handle, sim_info->phonebook_type, sim_info->index+1,
                                        __ctsvc_server_sim_sdn_read_cb, info);
                        RETM_IF(TAPI_API_SUCCESS != ret,  "tel_read_sim_pb_record() Fail(%d)", ret);
                }
-               CTS_ERR("SIM phonebook access Fail(%d)", access_rt);
+               ERR("SIM phonebook access Fail(%d)", access_rt);
                ctsvc_server_trim_memory();
                return;
        }
@@ -596,22 +595,21 @@ static void __ctsvc_server_sim_sdn_read_cb(TapiHandle *handle, int result, void
        case TAPI_SIM_PB_3GSIM:
        case TAPI_SIM_PB_FDN:
        default:
-               CTS_ERR("Not SDN type(%d)", sim_info->phonebook_type);
+               ERR("Not SDN type(%d)", sim_info->phonebook_type);
                ctsvc_server_trim_memory();
                return;
        }
 
        if (sim_info->next_index && CTSVC_TAPI_SIM_PB_MAX != sim_info->next_index) {
-               CTS_DBG("NextIndex = %d", sim_info->next_index);
-               ret = tel_read_sim_pb_record(handle, sim_info->phonebook_type,sim_info->next_index,
+               DBG("NextIndex = %d", sim_info->next_index);
+               ret = tel_read_sim_pb_record(handle, sim_info->phonebook_type, sim_info->next_index,
                                __ctsvc_server_sim_sdn_read_cb, info);
                if (TAPI_API_SUCCESS != ret) {
-                       CTS_ERR("tel_read_sim_pb_record() Fail(%d)", ret);
+                       ERR("tel_read_sim_pb_record() Fail(%d)", ret);
                        ctsvc_server_trim_memory();
                        return;
                }
-       }
-       else {
+       } else {
                ctsvc_server_trim_memory();
        }
 }
@@ -630,18 +628,17 @@ static void __ctsvc_server_sim_sdn_count_cb(TapiHandle *handle, int result, void
        if (0 < ps->UsedRecordCount) {
                ret = tel_read_sim_pb_record(info->handle, TAPI_SIM_PB_SDN, 1, __ctsvc_server_sim_sdn_read_cb, info);
                if (TAPI_API_SUCCESS != ret) {
-                       CTS_ERR("tel_read_sim_pb_record() Fail(%d)", ret);
+                       ERR("tel_read_sim_pb_record() Fail(%d)", ret);
                        ctsvc_server_trim_memory();
                        return;
                }
-       }
-       else {
-               CTS_ERR("ps->UsedRecordCount:0. No SDN!!!!");
+       } else {
+               ERR("ps->UsedRecordCount:0. No SDN!!!!");
        }
        ctsvc_server_trim_memory();
 }
 
-static int __ctsvc_server_sim_sdn_read(ctsvc_sim_info_sinfo)
+static int __ctsvc_server_sim_sdn_read(ctsvc_sim_info_s *info)
 {
        CTS_FN_CALL;
        int ret;
@@ -653,8 +650,8 @@ static int __ctsvc_server_sim_sdn_read(ctsvc_sim_info_s* info)
 
        ret = tel_get_sim_init_info(info->handle, &sim_status, &card_changed);
        if (TAPI_API_SUCCESS != ret) {
-               CTS_ERR("tel_get_sim_init_info() Fail(%d)", ret);
-               CTS_DBG("sim_status = %d, card_changed = %d", sim_status, card_changed);
+               ERR("tel_get_sim_init_info() Fail(%d)", ret);
+               DBG("sim_status = %d, card_changed = %d", sim_status, card_changed);
                ctsvc_server_trim_memory();
                return CONTACTS_ERROR_SYSTEM;
        }
@@ -663,28 +660,26 @@ static int __ctsvc_server_sim_sdn_read(ctsvc_sim_info_s* info)
                        TAPI_SIM_STATUS_CARD_REMOVED == sim_status) {
                ret = ctsvc_server_delete_sdn_contact(info->sim_slot_no);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_server_delete_sdn_contact() Fail(%d)", ret);
+                       ERR("ctsvc_server_delete_sdn_contact() Fail(%d)", ret);
                        ctsvc_server_trim_memory();
                        return ret;
                }
-       }
-       else if (TAPI_SIM_STATUS_SIM_INIT_COMPLETED == sim_status) {
+       } else if (TAPI_SIM_STATUS_SIM_INIT_COMPLETED == sim_status) {
                ret = ctsvc_server_delete_sdn_contact(info->sim_slot_no);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_server_delete_sdn_contact() Fail(%d)", ret);
+                       ERR("ctsvc_server_delete_sdn_contact() Fail(%d)", ret);
                        ctsvc_server_trim_memory();
                        return ret;
                }
 
                ret = tel_get_sim_pb_count(info->handle, TAPI_SIM_PB_SDN, __ctsvc_server_sim_sdn_count_cb, info);
                if (TAPI_API_SUCCESS != ret) {
-                       CTS_ERR("tel_get_sim_pb_meta_info() Fail(%d)", ret);
+                       ERR("tel_get_sim_pb_meta_info() Fail(%d)", ret);
                        ctsvc_server_trim_memory();
                        return CONTACTS_ERROR_SYSTEM;
                }
-       }
-       else {
-               CTS_ERR("sim_status Fail(%d)", sim_status);
+       } else {
+               ERR("sim_status Fail(%d)", sim_status);
                return CONTACTS_ERROR_SYSTEM;
        }
 
@@ -694,18 +689,18 @@ static int __ctsvc_server_sim_sdn_read(ctsvc_sim_info_s* info)
 static void __ctsvc_server_sim_get_meta_info_cb(TapiHandle *handle, int result, void *data, void *user_data)
 {
        CTS_FN_CALL;
-       int ret=0;
-       int i=0;
+       int ret = 0;
+       int i = 0;
        int type = TAPI_PB_3G_NAME;
        TelSimPbAccessResult_t access_rt = result;
        ctsvc_sim_info_s *info = (ctsvc_sim_info_s*)user_data;
 
-       CTS_DBG("sim slot id :%d, sim_type = %d", info->sim_slot_no, info->sim_type);
+       DBG("sim slot id :%d, sim_type = %d", info->sim_slot_no, info->sim_type);
        if (TAPI_SIM_PB_3GSIM == info->sim_type) {
                TelSimPbCapabilityInfo_t *capa = data;
-               RETM_IF(NULL == capa, "capa is NULL result =%d",access_rt);
+               RETM_IF(NULL == capa, "capa is NULL result =%d", access_rt);
 
-               for (i=0; i < capa->FileTypeCount; i++) {
+               for (i = 0; i < capa->FileTypeCount; i++) {
                        type = capa->FileTypeInfo[i].field_type;
 
                        info->file_record[type].support = true;
@@ -718,8 +713,7 @@ static void __ctsvc_server_sim_get_meta_info_cb(TapiHandle *handle, int result,
                                        info->file_record[type].text_max,
                                        info->file_record[type].used_count);
                }
-       }
-       else if (TAPI_SIM_PB_ADN == info->sim_type) {
+       } else if (TAPI_SIM_PB_ADN == info->sim_type) {
                TelSimPbEntryInfo_t *pe = data;
                RETM_IF(NULL == pe, "pe is NULL result =%d", access_rt);
 
@@ -727,23 +721,22 @@ static void __ctsvc_server_sim_get_meta_info_cb(TapiHandle *handle, int result,
                info->file_record[CTSVC_2GSIM_NAME].index_max = pe->PbIndexMax;
                info->file_record[CTSVC_2GSIM_NAME].text_max = pe->PbTextLenMax;
                info->file_record[CTSVC_2GSIM_NAME].used_count = pe->PbUsedCount;
-               CTS_DBG(" CTSVC_2GSIM_NAME : index_max(%d), text_max(%d), used_count(%d)",
-                               pe->PbIndexMax,pe->PbTextLenMax,pe->PbUsedCount);
+               DBG(" CTSVC_2GSIM_NAME : index_max(%d), text_max(%d), used_count(%d)",
+                               pe->PbIndexMax, pe->PbTextLenMax, pe->PbUsedCount);
 
                info->file_record[CTSVC_2GSIM_NUMBER].support = true;
                info->file_record[CTSVC_2GSIM_NUMBER].index_max = pe->PbIndexMax;
                info->file_record[CTSVC_2GSIM_NUMBER].text_max = pe->PbNumLenMax;
                info->file_record[CTSVC_2GSIM_NUMBER].used_count = pe->PbUsedCount;
-               CTS_DBG(" CTSVC_2GSIM_NUMBER : index_max(%d), text_max(%d), used_count(%d)",
-                               pe->PbIndexMax,pe->PbNumLenMax,pe->PbUsedCount);
+               DBG(" CTSVC_2GSIM_NUMBER : index_max(%d), text_max(%d), used_count(%d)",
+                               pe->PbIndexMax, pe->PbNumLenMax, pe->PbUsedCount);
 
                INFO(" field_type[%d] : index_max(%d), text_max(%d), used_count(%d)", CTSVC_2GSIM_NAME,
                                info->file_record[CTSVC_2GSIM_NAME].index_max,
                                info->file_record[CTSVC_2GSIM_NAME].text_max,
                                info->file_record[CTSVC_2GSIM_NAME].used_count);
-       }
-       else {
-               CTS_ERR("sim_type [%d]error ", info->sim_type);
+       } else {
+               ERR("sim_type [%d]error ", info->sim_type);
                return;
        }
 
@@ -754,7 +747,8 @@ static void __ctsvc_server_sim_get_meta_info_cb(TapiHandle *handle, int result,
        }
 }
 
-static void __ctsvc_server_sim_get_iccid_cb(TapiHandle *handle, int result, void *data,void *user_data)
+static void __ctsvc_server_sim_get_iccid_cb(TapiHandle *handle, int result, void *data,
+               void *user_data)
 {
        TelSimAccessResult_t access_rt = result;
        TelSimIccIdInfo_t *iccid = data;
@@ -764,7 +758,7 @@ static void __ctsvc_server_sim_get_iccid_cb(TapiHandle *handle, int result, void
 
        RETM_IF(TAPI_SIM_ACCESS_SUCCESS != access_rt, "tel_get_sim_iccid Fail(%d)", access_rt);
 
-       CTS_DBG("%d, %s", iccid->icc_length, iccid->icc_num);
+       DBG("%d, %s", iccid->icc_length, iccid->icc_num);
 
        info->sim_unique_id = strdup(iccid->icc_num);
 
@@ -785,17 +779,15 @@ static int __ctsvc_server_sim_init_meta_info(ctsvc_sim_info_s *info)
 
        if (TAPI_SIM_PB_3GSIM == info->sim_type) {
                ret = tel_get_sim_pb_usim_meta_info(info->handle, __ctsvc_server_sim_get_meta_info_cb, info);
-       }
-       else if (TAPI_SIM_PB_ADN == info->sim_type) {
+       } else if (TAPI_SIM_PB_ADN == info->sim_type) {
                ret = tel_get_sim_pb_meta_info(info->handle, info->sim_type, __ctsvc_server_sim_get_meta_info_cb, info);
-       }
-       else {
-               CTS_ERR("info->sim_type is invalid(%d) stop sim init !!!", info->sim_type);
+       } else {
+               ERR("info->sim_type is invalid(%d) stop sim init !!!", info->sim_type);
                return CONTACTS_ERROR_SYSTEM;
        }
 
        RETVM_IF(TAPI_API_SUCCESS != ret, CONTACTS_ERROR_SYSTEM,
-                               "tel_get_sim_(usim)_meta_info(type:%d) Fail(%d)", info->sim_type, ret);
+                       "tel_get_sim_(usim)_meta_info(type:%d) Fail(%d)", info->sim_type, ret);
 
        return CONTACTS_ERROR_NONE;
 }
@@ -811,12 +803,10 @@ static int __ctsvc_server_sim_init_info(ctsvc_sim_info_s *info)
        RETVM_IF(TAPI_API_SUCCESS != ret, CONTACTS_ERROR_SYSTEM, "tel_get_sim_type Fail(%d)slot no(%d)", ret, info->sim_slot_no);
        if (TAPI_SIM_CARD_TYPE_USIM == cardtype) {
                info->sim_type = TAPI_SIM_PB_3GSIM;
-       }
-       else if (TAPI_SIM_CARD_TYPE_GSM == cardtype) {
+       } else if (TAPI_SIM_CARD_TYPE_GSM == cardtype) {
                info->sim_type = TAPI_SIM_PB_ADN;
-       }
-       else {
-               CTS_ERR("cardtype(%d)is invalid!!!", cardtype);
+       } else {
+               ERR("cardtype(%d)is invalid!!!", cardtype);
                return CONTACTS_ERROR_SYSTEM;
        }
 
@@ -841,16 +831,14 @@ static void __ctsvc_server_sim_noti_pb_status(TapiHandle *handle, const char *no
                        return;
                ret = __ctsvc_server_sim_init_meta_info(info);
                WARN_IF(CONTACTS_ERROR_NONE != ret, "__ctsvc_server_sim_init_meta_info() Fail(%d)", ret);
-       }
-       /* FDN on : can not import sim contacts */
-       else if ((1 == pb_status->pb_list.b_fdn) && (0 == pb_status->pb_list.b_adn)
+       } else if ((1 == pb_status->pb_list.b_fdn) && (0 == pb_status->pb_list.b_adn)
                        && (TAPI_SIM_PB_ADN == info->sim_type)) {
-               CTS_INFO("This is sim card is 2G and FDN on status. sim phonebook will be block");
+               /* FDN on : can not import sim contacts */
+               INFO("This is sim card is 2G and FDN on status. sim phonebook will be block");
                info->initialized = false;
                __ctsvc_server_sim_destroy_import_contacts(info);
-       }
-       else {
-               CTS_ERR("This noti did not control !!!");
+       } else {
+               ERR("This noti did not control !!!");
        }
 }
 
@@ -873,26 +861,24 @@ static int __ctsvc_server_sim_info_init()
        int i;
        unsigned int cp_index = 0;
 
-#if !GLIB_CHECK_VERSION(2,35,0)
+#if !GLIB_CHECK_VERSION(2, 35, 0)
        g_type_init();
 #endif
        cp_name = tel_get_cp_name_list();
-       RETVM_IF(NULL == cp_name, CONTACTS_ERROR_SYSTEM, "tel_get_cp_name_list() Fail(cp_name is NULL)");
+       RETVM_IF(NULL == cp_name, CONTACTS_ERROR_SYSTEM, "tel_get_cp_name_list() Fail");
 
        ret = ctsvc_server_delete_sdn_contact(-1);
        WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_delete_sdn_contact() Fail(%d)", ret);
 
-       while (cp_name[cp_index]) {
+       while (cp_name[cp_index])
                cp_index++;
-       }
 
        cp_index = 0;
        while (cp_name[cp_index]) {
                TapiHandle *handle;
                ctsvc_sim_info_s *info = calloc(1, sizeof(ctsvc_sim_info_s));
-               if (NULL == info)
-               {
-                       CTS_ERR("calloc() Fail");
+               if (NULL == info) {
+                       ERR("calloc() Fail");
                        g_strfreev(cp_name);
                        return CONTACTS_ERROR_OUT_OF_MEMORY;
                }
@@ -906,7 +892,7 @@ static int __ctsvc_server_sim_info_init()
                info->sim_unique_id = NULL;
 
                /* initialize file_record meta info */
-               for (i = 0 ;i <TAPI_PB_MAX_FILE_CNT; i++) {
+               for (i = 0; i < TAPI_PB_MAX_FILE_CNT; i++) {
                        info->file_record[i].support = false;
                        info->file_record[i].index_max = 0;
                        info->file_record[i].text_max = 0;
@@ -928,9 +914,8 @@ static int __ctsvc_server_sim_info_init()
 
                        ret = tel_register_noti_event(handle, TAPI_NOTI_SIM_REFRESHED, __ctsvc_server_sim_noti_sim_refreshed, info);
                        WARN_IF(TAPI_API_SUCCESS != ret, "tel_register_noti_event() Fail(%d)", ret);
-               }
-               else {
-                       CTS_ERR("tel_init() Fail");
+               } else {
+                       ERR("tel_init() Fail");
                }
 
                __ctsvc_sim_info = g_slist_append(__ctsvc_sim_info, (void*)info);
@@ -948,7 +933,7 @@ static void __ctsvc_server_sim_ready_cb(keynode_t *key, void *data)
        vconf_get_int(VCONFKEY_TELEPHONY_SIM_STATUS, &status);
 
        if (VCONFKEY_TELEPHONY_SIM_STATUS_INIT_COMPLETED != status) {
-               CTS_ERR("sim is not ready (%d)", status);
+               ERR("sim is not ready (%d)", status);
                return;
        }
        INFO("sim is Ready");
@@ -966,7 +951,7 @@ static void __ctsvc_server_telephony_ready_cb(keynode_t *key, void *data)
        vconf_get_bool(VCONFKEY_TELEPHONY_READY, &bReady);
 
        if (0 == bReady) {
-               CTS_ERR("telephony is not ready ");
+               ERR("telephony is not ready ");
                return;
        }
        INFO("telephony is Ready");
@@ -977,7 +962,7 @@ static void __ctsvc_server_telephony_ready_cb(keynode_t *key, void *data)
        int status = 0;
        vconf_get_int(VCONFKEY_TELEPHONY_SIM_STATUS, &status);
        if (VCONFKEY_TELEPHONY_SIM_STATUS_INIT_COMPLETED != status) {
-               CTS_ERR("sim is not ready (%d)", status);
+               ERR("sim is not ready (%d)", status);
                vconf_notify_key_changed(VCONFKEY_TELEPHONY_SIM_STATUS, __ctsvc_server_sim_ready_cb, NULL);
                __ctsvc_sim_cb = true;
                return;
@@ -995,7 +980,7 @@ int ctsvc_server_sim_init()
        vconf_get_bool(VCONFKEY_TELEPHONY_READY, &bReady);
 
        if (0 == bReady) {
-               CTS_ERR("telephony is not ready ");
+               ERR("telephony is not ready ");
                vconf_notify_key_changed(VCONFKEY_TELEPHONY_READY, __ctsvc_server_telephony_ready_cb, NULL);
                __ctsvc_tapi_cb = true;
                return CONTACTS_ERROR_NONE;
@@ -1004,7 +989,7 @@ int ctsvc_server_sim_init()
        int status = 0;
        vconf_get_int(VCONFKEY_TELEPHONY_SIM_STATUS, &status);
        if (VCONFKEY_TELEPHONY_SIM_STATUS_INIT_COMPLETED != status) {
-               CTS_ERR("sim is not ready (%d)", status);
+               ERR("sim is not ready (%d)", status);
                vconf_notify_key_changed(VCONFKEY_TELEPHONY_SIM_STATUS, __ctsvc_server_sim_ready_cb, NULL);
                __ctsvc_sim_cb = true;
                return CONTACTS_ERROR_NONE;
@@ -1024,7 +1009,7 @@ int ctsvc_server_sim_final(void)
        if (__ctsvc_sim_cb)
                vconf_ignore_key_changed(VCONFKEY_TELEPHONY_SIM_STATUS, __ctsvc_server_sim_ready_cb);
 
-       for (info_cursor=__ctsvc_sim_info;info_cursor;info_cursor=info_cursor->next) {
+       for (info_cursor = __ctsvc_sim_info; info_cursor; info_cursor = info_cursor->next) {
                ctsvc_sim_info_s *info = info_cursor->data;
                free(info->cp_name);
                free(info->sim_unique_id);
index 8ceb096..e3458f5 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -39,10 +39,10 @@ typedef struct {
 int ctsvc_server_sim_init(void);
 int ctsvc_server_sim_final(void);
 
-int ctsvc_server_sim_import_contact(voiddata, int sim_slot_no);
+int ctsvc_server_sim_import_contact(void *data, int sim_slot_no);
 int ctsvc_server_sim_get_info_id_by_sim_slot_no(int sim_slot_no);
 int ctsvc_server_sim_get_sim_slot_no_by_info_id(int sim_info_id);
-int ctsvc_server_socket_get_sim_init_status(voiddata, int sim_slot_no);
+int ctsvc_server_socket_get_sim_init_status(void *data, int sim_slot_no);
 
 #endif /* __CTSVC_SERVER_SIM_H__ */
 
index e7c2cd3..bf83bf7 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -54,7 +54,9 @@ struct client_info {
        char *uid;
        char *client_session;
 };
-static GHashTable *_client_info_table = NULL; // key : socket_fd, value : struct client_info*
+
+/* key : socket_fd, value : struct client_info* */
+static GHashTable *_client_info_table = NULL;
 
 static inline int __ctsvc_server_socket_safe_write(int fd, char *buf, int buf_size)
 {
@@ -96,7 +98,8 @@ int ctsvc_server_socket_return(GIOChannel *src, int value, int attach_num, int *
        CTS_FN_CALL;
        int ret;
        ctsvc_socket_msg_s msg = {0};
-       RETVM_IF(NULL == src, CONTACTS_ERROR_INVALID_PARAMETER, "src is NULL");
+
+       RETV_IF(NULL == src, CONTACTS_ERROR_INVALID_PARAMETER);
 
        /* RETVM_IF(CONTACTS_ERROR_SYSTEM == value, value, "Socket has problems"); */
        RETVM_IF(CTSVC_SOCKET_MSG_REQUEST_MAX_ATTACH < attach_num, CONTACTS_ERROR_INTERNAL,
@@ -108,7 +111,7 @@ int ctsvc_server_socket_return(GIOChannel *src, int value, int attach_num, int *
 
        memcpy(msg.attach_sizes, attach_size, attach_num * sizeof(int));
 
-       CTS_DBG("fd = %d, MSG_TYPE=%d, MSG_VAL=%d, MSG_ATTACH_NUM=%d,"
+       DBG("fd = %d, MSG_TYPE=%d, MSG_VAL=%d, MSG_ATTACH_NUM=%d,"
                        "MSG_ATTACH1=%d, MSG_ATTACH2=%d, MSG_ATTACH3=%d, MSG_ATTACH4=%d",
                        g_io_channel_unix_get_fd(src), msg.type, msg.val, msg.attach_num,
                        msg.attach_sizes[0], msg.attach_sizes[1], msg.attach_sizes[2],
@@ -132,24 +135,23 @@ static void __ctsvc_server_socket_import_sim(GIOChannel *src, int size)
        if (0 < size) {
                g_io_channel_read_chars(src, receiver, size, &len, &gerr);
                if (gerr) {
-                       CTS_ERR("g_io_channel_read_chars() Fail(%s)", gerr->message);
+                       ERR("g_io_channel_read_chars() Fail(%s)", gerr->message);
                        g_error_free(gerr);
                        return;
                }
-               CTS_DBG("Receiver = %s(%d), read_size = %d", receiver, len, size);
+               DBG("Receiver = %s(%d), read_size = %d", receiver, len, size);
        }
 
        if (len) {
                receiver[len] = '\0';
-               CTS_DBG("sim_id %d", atoi(receiver));
+               DBG("sim_id %d", atoi(receiver));
                ret = ctsvc_server_sim_import_contact(src, atoi(receiver));
-       }
-       else {
+       } else {
                ret = ctsvc_server_sim_import_contact(src, 0);
        }
 
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_server_sim_import_contact() Fail(%d)", ret);
+               ERR("ctsvc_server_sim_import_contact() Fail(%d)", ret);
                ctsvc_server_socket_return(src, ret, 0, NULL);
        }
 }
@@ -166,24 +168,23 @@ static void __ctsvc_server_socket_get_sim_init_status(GIOChannel *src, int size)
        if (0 < size) {
                g_io_channel_read_chars(src, receiver, size, &len, &gerr);
                if (gerr) {
-                       CTS_ERR("g_io_channel_read_chars() Fail(%s)", gerr->message);
+                       ERR("g_io_channel_read_chars() Fail(%s)", gerr->message);
                        g_error_free(gerr);
                        return;
                }
-               CTS_DBG("Receiver = %s(%d), read_size = %d", receiver, len, size);
+               DBG("Receiver = %s(%d), read_size = %d", receiver, len, size);
        }
 
        if (len) {
                receiver[len] = '\0';
-               CTS_DBG("sim_id : %d", atoi(receiver));
+               DBG("sim_id : %d", atoi(receiver));
                ret = ctsvc_server_socket_get_sim_init_status(src, atoi(receiver));
-       }
-       else {
+       } else {
                ret = ctsvc_server_socket_get_sim_init_status(src, 0);
        }
 
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_server_socket_get_sim_init_status() Fail(%d)", ret);
+               ERR("ctsvc_server_socket_get_sim_init_status() Fail(%d)", ret);
                ctsvc_server_socket_return(src, ret, 0, NULL);
        }
 }
@@ -198,7 +199,7 @@ int ctsvc_server_socket_return_sim_int(GIOChannel *src, int value)
        str_len = snprintf(count_str, sizeof(count_str), "%d", value);
        ret = ctsvc_server_socket_return(src, CONTACTS_ERROR_NONE, 1, &str_len);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_server_socket_return() Fail(%d)", ret);
-       CTS_DBG("count_str : %s", count_str);
+       DBG("count_str : %s", count_str);
        ret = __ctsvc_server_socket_safe_write(g_io_channel_unix_get_fd(src), count_str, str_len);
        RETVM_IF(-1 == ret, CONTACTS_ERROR_SYSTEM, "__ctsvc_server_socket_safe_write() Fail(errno = %d)", errno);
 
@@ -216,7 +217,7 @@ static void __ctsvc_server_socket_read_flush(GIOChannel *src, int size)
 
        g_io_channel_read_chars(src, receiver, size, &len, &gerr);
        if (gerr) {
-               CTS_ERR("g_io_channel_read_chars() Fail(%s)", gerr->message);
+               ERR("g_io_channel_read_chars() Fail(%s)", gerr->message);
                g_error_free(gerr);
        }
 }
@@ -232,7 +233,7 @@ static int _ctsvc_server_initialize_cynara()
        if (CYNARA_API_SUCCESS != ret) {
                char errmsg[1024] = {0};
                cynara_strerror(ret, errmsg, sizeof(errmsg));
-               CTS_ERR("cynara_initialize() Fail(%d,%s)", ret, errmsg);
+               ERR("cynara_initialize() Fail(%d,%s)", ret, errmsg);
                return CONTACTS_ERROR_SYSTEM;
        }
        return CONTACTS_ERROR_NONE;
@@ -249,13 +250,13 @@ static void _ctsvc_server_finalize_cynara()
        if (CYNARA_API_SUCCESS != ret) {
                char errmsg[1024] = {0};
                cynara_strerror(ret, errmsg, sizeof(errmsg));
-               CTS_ERR("cynara_finish() Fail(%d,%s)", ret, errmsg);
+               ERR("cynara_finish() Fail(%d,%s)", ret, errmsg);
        }
 }
 
 static bool _ctsvc_server_check_privilege(struct client_info *info, const char *privilege)
 {
-       RETVM_IF(NULL == info, false, "info is NULL");
+       RETV_IF(NULL == info, false);
 
        ctsvc_mutex_lock(CTS_MUTEX_CYNARA);
        int ret = cynara_check(_cynara, info->smack, info->client_session, info->uid, privilege);
@@ -290,12 +291,12 @@ static gboolean __ctsvc_server_socket_request_handler(GIOChannel *src, GIOCondit
        ret = __ctsvc_server_socket_safe_read(fd, (char *)&msg, sizeof(msg));
        RETVM_IF(-1 == ret, TRUE, "__ctsvc_server_socket_safe_read() Fail(errno = %d)", errno);
 
-       CTS_DBG("attach number = %d", msg.attach_num);
+       DBG("attach number = %d", msg.attach_num);
 
        bool have_telephony_feature = false;
        have_telephony_feature = ctsvc_server_have_telephony_feature();
        if (false == have_telephony_feature) {
-               CTS_ERR("Telephony feature disabled");
+               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);
                return TRUE;
@@ -315,7 +316,7 @@ static gboolean __ctsvc_server_socket_request_handler(GIOChannel *src, GIOCondit
        switch (msg.type) {
        case CTSVC_SOCKET_MSG_TYPE_REQUEST_IMPORT_SIM:
                if (false == have_write_permission) {
-                       CTS_ERR("write permission denied");
+                       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);
                        return TRUE;
@@ -324,7 +325,7 @@ static gboolean __ctsvc_server_socket_request_handler(GIOChannel *src, GIOCondit
                break;
        case CTSVC_SOCKET_MSG_TYPE_REQUEST_SIM_INIT_COMPLETE:
                if (false == have_read_permission) {
-                       CTS_ERR("read permission denied");
+                       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);
                        return TRUE;
@@ -332,7 +333,7 @@ static gboolean __ctsvc_server_socket_request_handler(GIOChannel *src, GIOCondit
                __ctsvc_server_socket_get_sim_init_status(src, msg.attach_sizes[0]);
                break;
        default:
-               CTS_ERR("Unknown request type(%d)", msg.type);
+               ERR("Unknown request type(%d)", msg.type);
                break;
        }
        return TRUE;
@@ -358,14 +359,14 @@ static int _ctsvc_server_create_client_info(int fd, struct client_info **p_info)
 
        struct client_info *info = calloc(1, sizeof(struct client_info));
        if (NULL == info) {
-               CTS_ERR("calloc() return NULL");
+               ERR("calloc() return NULL");
                return CONTACTS_ERROR_SYSTEM;
        }
 
        ret = cynara_creds_socket_get_client(fd, CLIENT_METHOD_SMACK, &(info->smack));
        if (CYNARA_API_SUCCESS != ret) {
                cynara_strerror(ret, errmsg, sizeof(errmsg));
-               CTS_ERR("cynara_creds_socket_get_client() Fail(%d,%s)", ret, errmsg);
+               ERR("cynara_creds_socket_get_client() Fail(%d,%s)", ret, errmsg);
                _ctsvc_server_destroy_client_info(info);
                return CONTACTS_ERROR_SYSTEM;
        }
@@ -373,7 +374,7 @@ static int _ctsvc_server_create_client_info(int fd, struct client_info **p_info)
        ret = cynara_creds_socket_get_user(fd, USER_METHOD_UID, &(info->uid));
        if (CYNARA_API_SUCCESS != ret) {
                cynara_strerror(ret, errmsg, sizeof(errmsg));
-               CTS_ERR("cynara_creds_socket_get_user() Fail(%d,%s)", ret, errmsg);
+               ERR("cynara_creds_socket_get_user() Fail(%d,%s)", ret, errmsg);
                _ctsvc_server_destroy_client_info(info);
                return CONTACTS_ERROR_SYSTEM;
        }
@@ -381,14 +382,14 @@ static int _ctsvc_server_create_client_info(int fd, struct client_info **p_info)
        ret = cynara_creds_socket_get_pid(fd, &pid);
        if (CYNARA_API_SUCCESS != ret) {
                cynara_strerror(ret, errmsg, sizeof(errmsg));
-               CTS_ERR("cynara_creds_socket_get_pid() Fail(%d,%s)", ret, errmsg);
+               ERR("cynara_creds_socket_get_pid() Fail(%d,%s)", ret, errmsg);
                _ctsvc_server_destroy_client_info(info);
                return CONTACTS_ERROR_SYSTEM;
        }
 
        info->client_session = cynara_session_from_pid(pid);
        if (NULL == info->client_session) {
-               CTS_ERR("cynara_session_from_pid() return NULL");
+               ERR("cynara_session_from_pid() return NULL");
                _ctsvc_server_destroy_client_info(info);
                return CONTACTS_ERROR_SYSTEM;
        }
@@ -417,7 +418,7 @@ static gboolean __ctsvc_server_socket_handler(GIOChannel *src,
        struct client_info *info = NULL;
        ret = _ctsvc_server_create_client_info(client_sockfd, &info);
        if (CONTACTS_ERROR_NONE != ret)
-               CTS_ERR("_create_client_info() Fail(%d)", ret);
+               ERR("_create_client_info() Fail(%d)", ret);
        else
                g_hash_table_insert(_client_info_table, GINT_TO_POINTER(client_sockfd), info);
 
@@ -450,24 +451,24 @@ int ctsvc_server_socket_init(void)
        RETVM_IF(-1 == sockfd, CONTACTS_ERROR_SYSTEM, "socket() Fail(errno = %d)", errno);
 
        ret = bind(sockfd, (struct sockaddr *)&addr, sizeof(addr));
-       if (-1 == ret){
+       if (-1 == ret) {
                close(sockfd);
-               CTS_ERR("bind() Failed(errno = %d)", errno);
+               ERR("bind() Fail(errno = %d)", errno);
                return CONTACTS_ERROR_SYSTEM;
        }
 
        ret = chown(sock_file, getuid(), CTS_SECURITY_FILE_GROUP);
        if (0 != ret)
-               CTS_ERR("chown(%s) Fail(%d)", sock_file, ret);
+               ERR("chown(%s) Fail(%d)", sock_file, ret);
 
        ret = chmod(sock_file, CTS_SECURITY_DEFAULT_PERMISSION);
        if (0 != ret)
-               CTS_ERR("chmod(%s) Fail(%d)", sock_file, ret);
+               ERR("chmod(%s) Fail(%d)", sock_file, ret);
 
        ret = listen(sockfd, 30);
        if (-1 == ret) {
                close(sockfd);
-               CTS_ERR("listen() Fail(errno = %d)", errno);
+               ERR("listen() Fail(errno = %d)", errno);
                return CONTACTS_ERROR_SYSTEM;
        }
 
index bbb5b43..1a77243 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
index b5615ff..232b76f 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -61,39 +61,39 @@ int ctsvc_server_db_open(sqlite3 **db)
                                "db_util_open() Fail(%d)", ret);
 
                ret = sqlite3_create_function(server_db, "_DATA_DELETE_", 2, SQLITE_UTF8, NULL,
-                                       ctsvc_db_data_delete_callback, NULL, NULL);
+                               ctsvc_db_data_delete_callback, NULL, NULL);
                RETVM_IF(SQLITE_OK != ret, CONTACTS_ERROR_DB,
-                                               "sqlite3_create_function() Fail(%d)", ret);
+                               "sqlite3_create_function() Fail(%d)", ret);
                ret = sqlite3_create_function(server_db, "_DATA_IMAGE_DELETE_", 1, SQLITE_UTF8, NULL,
-                                       ctsvc_db_image_delete_callback, NULL, NULL);
+                               ctsvc_db_image_delete_callback, NULL, NULL);
                RETVM_IF(SQLITE_OK != ret, CONTACTS_ERROR_DB,
-                                               "sqlite3_create_function() Fail(%d)", ret);
+                               "sqlite3_create_function() Fail(%d)", ret);
                ret = sqlite3_create_function(server_db, "_DATA_COMPANY_DELETE_", 1, SQLITE_UTF8, NULL,
-                                       ctsvc_db_company_delete_callback, NULL, NULL);
+                               ctsvc_db_company_delete_callback, NULL, NULL);
                RETVM_IF(SQLITE_OK != ret, CONTACTS_ERROR_DB,
-                                               "sqlite3_create_function() Fail(%d)", ret);
+                               "sqlite3_create_function() Fail(%d)", ret);
 #ifdef ENABLE_LOG_FEATURE
                ret = sqlite3_create_function(server_db, "_PHONE_LOG_DELETE_", 1, SQLITE_UTF8, NULL,
-                                       ctsvc_db_phone_log_delete_callback, NULL, NULL);
+                               ctsvc_db_phone_log_delete_callback, NULL, NULL);
                RETVM_IF(SQLITE_OK != ret, CONTACTS_ERROR_DB,
-                                               "sqlite3_create_function() Fail(%d)", ret);
+                               "sqlite3_create_function() Fail(%d)", ret);
 #endif /* ENABLE_LOG_FEATURE */
                ret = sqlite3_create_function(server_db, "_PERSON_DELETE_", 1, SQLITE_UTF8, NULL,
-                                       ctsvc_db_person_delete_callback, NULL, NULL);
+                               ctsvc_db_person_delete_callback, NULL, NULL);
                RETVM_IF(SQLITE_OK != ret, CONTACTS_ERROR_DB,
-                                               "sqlite3_create_function() Fail(%d)", ret);
+                               "sqlite3_create_function() Fail(%d)", ret);
                ret = sqlite3_create_function(server_db, "_GROUP_DELETE_", 1, SQLITE_UTF8, NULL,
-                                       ctsvc_db_group_delete_callback, NULL, NULL);
+                               ctsvc_db_group_delete_callback, NULL, NULL);
                RETVM_IF(SQLITE_OK != ret, CONTACTS_ERROR_DB,
-                                               "sqlite3_create_function() Fail(%d)", ret);
+                               "sqlite3_create_function() Fail(%d)", ret);
                ret = sqlite3_create_function(server_db, "_NUMBER_COMPARE_", 4, SQLITE_UTF8, NULL,
-                                       ctsvc_db_phone_number_equal_callback, NULL, NULL);
+                               ctsvc_db_phone_number_equal_callback, NULL, NULL);
                RETVM_IF(SQLITE_OK != ret, CONTACTS_ERROR_DB,
-                                               "sqlite3_create_function() Fail(%d)", ret);
+                               "sqlite3_create_function() Fail(%d)", ret);
                ret = sqlite3_create_collation(server_db, "_NAME_SORT_", SQLITE_UTF8, (void *)SQLITE_UTF8,
-                                       ctsvc_db_group_name_sort_callback);
+                               ctsvc_db_group_name_sort_callback);
                RETVM_IF(SQLITE_OK != ret, CONTACTS_ERROR_DB,
-                                               "sqlite3_create_collation() Fail(%d)", ret);
+                               "sqlite3_create_collation() Fail(%d)", ret);
        }
        if (db)
                *db = server_db;
@@ -124,7 +124,7 @@ int ctsvc_server_begin_trans(void)
        }
 
        if (SQLITE_OK != ret) {
-               CTS_ERR("sqlite3_exec() Fail(%d)", ret);
+               ERR("sqlite3_exec() Fail(%d)", ret);
                return CONTACTS_ERROR_DB;
        }
        return CONTACTS_ERROR_NONE;
@@ -133,7 +133,7 @@ int ctsvc_server_begin_trans(void)
 #define CTS_COMMIT_TRY_MAX 5
 int ctsvc_server_end_trans(bool success)
 {
-       int ret = -1, i=0;
+       int ret = -1, i = 0;
        char *errmsg = NULL;
 
        if (success) {
@@ -141,18 +141,17 @@ int ctsvc_server_end_trans(bool success)
                        ret = sqlite3_exec(server_db, "COMMIT TRANSACTION",
                                        NULL, NULL, &errmsg);
                        if (SQLITE_OK != ret) {
-                               CTS_ERR("sqlite3_exec(COMMIT) Fail(%d, %s)", ret, errmsg);
+                               ERR("sqlite3_exec(COMMIT) Fail(%d, %s)", ret, errmsg);
                                sqlite3_free(errmsg);
                                i++;
                                sleep(1);
-                       }
-                       else {
+                       } else {
                                INFO("commit end");
                                return CONTACTS_ERROR_NONE;
                        }
                } while ((SQLITE_BUSY == ret || SQLITE_LOCKED == ret) && i < CTS_COMMIT_TRY_MAX);
 
-               CTS_ERR("Commit error : %d", ret);
+               ERR("Commit error : %d", ret);
        }
 
        i = 0;
@@ -160,7 +159,7 @@ int ctsvc_server_end_trans(bool success)
                ret = sqlite3_exec(server_db, "ROLLBACK TRANSACTION",
                                NULL, NULL, &errmsg);
                if (SQLITE_OK != ret) {
-                       CTS_ERR("sqlite3_exec(ROLLBACK) Fail(%d, %s)", ret, errmsg);
+                       ERR("sqlite3_exec(ROLLBACK) Fail(%d, %s)", ret, errmsg);
                        sqlite3_free(errmsg);
                        i++;
                        sleep(1);
@@ -168,10 +167,9 @@ int ctsvc_server_end_trans(bool success)
        } while ((SQLITE_BUSY == ret || SQLITE_LOCKED == ret) && i < CTS_COMMIT_TRY_MAX);
 
        if (SQLITE_OK != ret) {
-               CTS_ERR("sqlite3_exec(ROLLBACK) Fail(%d) : DB lock", ret);
+               ERR("sqlite3_exec(ROLLBACK) Fail(%d) : DB lock", ret);
                return CONTACTS_ERROR_DB;
-       }
-       else {
+       } else {
                INFO("rollback end");
                return CONTACTS_ERROR_NONE;
        }
@@ -181,7 +179,7 @@ int ctsvc_server_update_sort(int prev_sort_primary, int prev_sort_secondary, int
 {
        CTS_FN_CALL;
        int ret;
-       sqlite3db = NULL;
+       sqlite3 *db = NULL;
        char *errmsg = NULL;
        char query[CTS_SQL_MIN_LEN] = {0};
 
@@ -195,7 +193,7 @@ int ctsvc_server_update_sort(int prev_sort_primary, int prev_sort_secondary, int
                        CTS_TABLE_CONTACTS, prev_sort_primary, CTSVC_SORT_PRIMARY);
        ret = sqlite3_exec(db, query, NULL, NULL, &errmsg);
        if (SQLITE_OK != ret) {
-               CTS_ERR("sqlite3_exec(%s) Fail(%d, %s)", query, ret, errmsg);
+               ERR("sqlite3_exec(%s) Fail(%d, %s)", query, ret, errmsg);
                sqlite3_free(errmsg);
                ctsvc_server_end_trans(false);
                ctsvc_server_db_close();
@@ -206,7 +204,7 @@ int ctsvc_server_update_sort(int prev_sort_primary, int prev_sort_secondary, int
                        CTS_TABLE_CONTACTS, prev_sort_secondary, CTSVC_SORT_SECONDARY);
        ret = sqlite3_exec(db, query, NULL, NULL, &errmsg);
        if (SQLITE_OK != ret) {
-               CTS_ERR("sqlite3_exec(%s) Fail(%d, %s)", query, ret, errmsg);
+               ERR("sqlite3_exec(%s) Fail(%d, %s)", query, ret, errmsg);
                sqlite3_free(errmsg);
                ctsvc_server_end_trans(false);
                ctsvc_server_db_close();
@@ -214,10 +212,10 @@ int ctsvc_server_update_sort(int prev_sort_primary, int prev_sort_secondary, int
        }
 
        snprintf(query, sizeof(query), "UPDATE %s SET display_name_language=%d WHERE display_name_language=%d",
-                               CTS_TABLE_CONTACTS, CTSVC_SORT_PRIMARY, new_sort_primary);
+                       CTS_TABLE_CONTACTS, CTSVC_SORT_PRIMARY, new_sort_primary);
        ret = sqlite3_exec(db, query, NULL, NULL, &errmsg);
        if (SQLITE_OK != ret) {
-               CTS_ERR("sqlite3_exec(%s) Fail(%d, %s)", query, ret, errmsg);
+               ERR("sqlite3_exec(%s) Fail(%d, %s)", query, ret, errmsg);
                sqlite3_free(errmsg);
                ctsvc_server_end_trans(false);
                ctsvc_server_db_close();
@@ -228,7 +226,7 @@ int ctsvc_server_update_sort(int prev_sort_primary, int prev_sort_secondary, int
                        CTS_TABLE_CONTACTS, CTSVC_SORT_SECONDARY, new_sort_secondary);
        ret = sqlite3_exec(db, query, NULL, NULL, &errmsg);
        if (SQLITE_OK != ret) {
-               CTS_ERR("sqlite3_exec(%s) Fail(%d, %s)", query, ret, errmsg);
+               ERR("sqlite3_exec(%s) Fail(%d, %s)", query, ret, errmsg);
                sqlite3_free(errmsg);
                ctsvc_server_end_trans(false);
                ctsvc_server_db_close();
@@ -236,10 +234,10 @@ int ctsvc_server_update_sort(int prev_sort_primary, int prev_sort_secondary, int
        }
 
        snprintf(query, sizeof(query), "UPDATE %s SET reverse_display_name_language=%d WHERE reverse_display_name_language = %d",
-                               CTS_TABLE_CONTACTS, prev_sort_primary, CTSVC_SORT_PRIMARY);
+                       CTS_TABLE_CONTACTS, prev_sort_primary, CTSVC_SORT_PRIMARY);
        ret = sqlite3_exec(db, query, NULL, NULL, &errmsg);
        if (SQLITE_OK != ret) {
-               CTS_ERR("sqlite3_exec(%s) Fail(%d, %s)", query, ret, errmsg);
+               ERR("sqlite3_exec(%s) Fail(%d, %s)", query, ret, errmsg);
                sqlite3_free(errmsg);
                ctsvc_server_end_trans(false);
                ctsvc_server_db_close();
@@ -250,7 +248,7 @@ int ctsvc_server_update_sort(int prev_sort_primary, int prev_sort_secondary, int
                        CTS_TABLE_CONTACTS, prev_sort_secondary, CTSVC_SORT_SECONDARY);
        ret = sqlite3_exec(db, query, NULL, NULL, &errmsg);
        if (SQLITE_OK != ret) {
-               CTS_ERR("sqlite3_exec(%s) Fail(%d, %s)", query, ret, errmsg);
+               ERR("sqlite3_exec(%s) Fail(%d, %s)", query, ret, errmsg);
                sqlite3_free(errmsg);
                ctsvc_server_end_trans(false);
                ctsvc_server_db_close();
@@ -258,10 +256,10 @@ int ctsvc_server_update_sort(int prev_sort_primary, int prev_sort_secondary, int
        }
 
        snprintf(query, sizeof(query), "UPDATE %s SET reverse_display_name_language=%d WHERE reverse_display_name_language = %d",
-                               CTS_TABLE_CONTACTS, CTSVC_SORT_PRIMARY, new_sort_primary);
+                       CTS_TABLE_CONTACTS, CTSVC_SORT_PRIMARY, new_sort_primary);
        ret = sqlite3_exec(db, query, NULL, NULL, &errmsg);
        if (SQLITE_OK != ret) {
-               CTS_ERR("sqlite3_exec(%s) Fail(%d, %s)", query, ret, errmsg);
+               ERR("sqlite3_exec(%s) Fail(%d, %s)", query, ret, errmsg);
                sqlite3_free(errmsg);
                ctsvc_server_end_trans(false);
                ctsvc_server_db_close();
@@ -272,7 +270,7 @@ int ctsvc_server_update_sort(int prev_sort_primary, int prev_sort_secondary, int
                        CTS_TABLE_CONTACTS, CTSVC_SORT_SECONDARY, new_sort_secondary);
        ret = sqlite3_exec(db, query, NULL, NULL, &errmsg);
        if (SQLITE_OK != ret) {
-               CTS_ERR("sqlite3_exec(%s) Fail(%d, %s)", query, ret, errmsg);
+               ERR("sqlite3_exec(%s) Fail(%d, %s)", query, ret, errmsg);
                sqlite3_free(errmsg);
                ctsvc_server_end_trans(false);
                ctsvc_server_db_close();
@@ -304,8 +302,8 @@ int ctsvc_server_insert_sdn_contact(const char *name, const char *number,
                int sim_slot_no)
 {
        int ret;
-       sqlite3db = NULL;
-       sqlite3_stmtstmt = NULL;
+       sqlite3 *db = NULL;
+       sqlite3_stmt *stmt = NULL;
        char query[CTS_SQL_MIN_LEN] = {0};
 
        ret = ctsvc_server_db_open(&db);
@@ -316,7 +314,7 @@ int ctsvc_server_insert_sdn_contact(const char *name, const char *number,
 
        ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
        if (SQLITE_OK != ret) {
-               CTS_ERR("sqlite3_prepare_v2(%s) Fail(%s)", query, sqlite3_errmsg(db));
+               ERR("sqlite3_prepare_v2(%s) Fail(%s)", query, sqlite3_errmsg(db));
                ctsvc_server_db_close();
                return CONTACTS_ERROR_DB;
        }
@@ -327,7 +325,7 @@ int ctsvc_server_insert_sdn_contact(const char *name, const char *number,
 
        ret = sqlite3_step(stmt);
        if (SQLITE_DONE != ret) {
-               CTS_ERR("sqlite3_step() Fail(%d)", ret);
+               ERR("sqlite3_step() Fail(%d)", ret);
                sqlite3_finalize(stmt);
                ctsvc_server_db_close();
                return CONTACTS_ERROR_DB;
@@ -341,8 +339,8 @@ int ctsvc_server_insert_sdn_contact(const char *name, const char *number,
 int ctsvc_server_delete_sdn_contact(int sim_slot_no)
 {
        int ret;
-       sqlite3db = NULL;
-       sqlite3_stmtstmt = NULL;
+       sqlite3 *db = NULL;
+       sqlite3_stmt *stmt = NULL;
        char query[CTS_SQL_MAX_LEN] = {0};
 
        ret = ctsvc_server_db_open(&db);
@@ -355,13 +353,13 @@ int ctsvc_server_delete_sdn_contact(int sim_slot_no)
 
        ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
        if (SQLITE_OK != ret) {
-               CTS_ERR("sqlite3_prepare_v2(%s) Fail(%s)", query, sqlite3_errmsg(db));
+               ERR("sqlite3_prepare_v2(%s) Fail(%s)", query, sqlite3_errmsg(db));
                ctsvc_server_db_close();
                return CONTACTS_ERROR_DB;
        }
        ret = sqlite3_step(stmt);
        if (SQLITE_DONE != ret) {
-               CTS_ERR("sqlite3_step() Fail(%d)", ret);
+               ERR("sqlite3_step() Fail(%d)", ret);
                sqlite3_finalize(stmt);
                ctsvc_server_db_close();
                return CONTACTS_ERROR_DB;
@@ -375,7 +373,7 @@ int ctsvc_server_delete_sdn_contact(int sim_slot_no)
 int ctsvc_server_update_collation()
 {
        int ret = 0;
-       sqlite3db = NULL;
+       sqlite3 *db = NULL;
        cts_stmt stmt = NULL;
        cts_stmt update_stmt = NULL;
        char query[CTS_SQL_MIN_LEN] = {0};
@@ -384,14 +382,14 @@ int ctsvc_server_update_collation()
 
        ret = ctsvc_server_db_open(&db);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_server_db_open() Fail(%d)", ret);
+               ERR("ctsvc_server_db_open() Fail(%d)", ret);
                ctsvc_db_set_status(CONTACTS_DB_STATUS_NORMAL);
                return ret;
        }
 
        ret = ctsvc_server_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_server_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_server_begin_trans() Fail(%d)", ret);
                ctsvc_server_db_close();
                ctsvc_db_set_status(CONTACTS_DB_STATUS_NORMAL);
                return ret;
@@ -399,10 +397,10 @@ int ctsvc_server_update_collation()
 
        snprintf(query, sizeof(query),
                        "SELECT contact_id, sort_name, reverse_sort_name "
-                               "FROM "CTS_TABLE_CONTACTS" WHERE deleted = 0");
+                       "FROM "CTS_TABLE_CONTACTS" WHERE deleted = 0");
        ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
        if (SQLITE_OK != ret) {
-               CTS_ERR("sqlite3_prepare_v2(%s) Fail(%s)", query, sqlite3_errmsg(db));
+               ERR("sqlite3_prepare_v2(%s) Fail(%s)", query, sqlite3_errmsg(db));
                ctsvc_server_end_trans(false);
                ctsvc_server_db_close();
                ctsvc_db_set_status(CONTACTS_DB_STATUS_NORMAL);
@@ -411,10 +409,10 @@ int ctsvc_server_update_collation()
 
        snprintf(query, sizeof(query),
                        "UPDATE "CTS_TABLE_CONTACTS" SET sortkey=?, reverse_sortkey=? "
-                               "WHERE contact_id = ?");
+                       "WHERE contact_id = ?");
        ret = sqlite3_prepare_v2(db, query, strlen(query), &update_stmt, NULL);
        if (SQLITE_OK != ret) {
-               CTS_ERR("sqlite3_prepare_v2(%s) Fail(%s)", query, sqlite3_errmsg(db));
+               ERR("sqlite3_prepare_v2(%s) Fail(%s)", query, sqlite3_errmsg(db));
                sqlite3_finalize(stmt);
                ctsvc_server_end_trans(false);
                ctsvc_server_db_close();
@@ -449,7 +447,7 @@ int ctsvc_server_update_collation()
                free(reverse_sortkey);
 
                if (SQLITE_DONE != ret) {
-                       CTS_ERR("sqlite3_step(%s) Fail(%d, %s)", query, ret, sqlite3_errmsg(db));
+                       ERR("sqlite3_step(%s) Fail(%d, %s)", query, ret, sqlite3_errmsg(db));
                        sqlite3_finalize(stmt);
                        sqlite3_finalize(update_stmt);
                        ctsvc_server_end_trans(false);
@@ -463,7 +461,7 @@ int ctsvc_server_update_collation()
        }
 
        if (SQLITE_ROW != ret && SQLITE_DONE != ret) {
-               CTS_ERR("sqlite3_step() Fail(%d)", ret);
+               ERR("sqlite3_step() Fail(%d)", ret);
                sqlite3_finalize(update_stmt);
                sqlite3_finalize(stmt);
                ctsvc_server_end_trans(false);
@@ -499,35 +497,35 @@ int ctsvc_server_get_sim_id(const char *unique_id, int *sim_id)
        char query[CTS_SQL_MAX_LEN] = {0};
 
        *sim_id = 0;
-       RETVM_IF(unique_id == NULL, CONTACTS_ERROR_INVALID_PARAMETER, "unique_id is NULL");
+       RETV_IF(unique_id == NULL, CONTACTS_ERROR_INVALID_PARAMETER);
 
        snprintf(query, sizeof(query),
-                               "SELECT sim_id FROM "CTS_TABLE_SIM_INFO" "
-                                                               "WHERE unique_id = '%s'", unique_id);
+                       "SELECT sim_id FROM "CTS_TABLE_SIM_INFO" "
+                       "WHERE unique_id = '%s'", unique_id);
        ret = ctsvc_query_get_first_int_result(query, &id);
        if (CONTACTS_ERROR_NONE != ret && CONTACTS_ERROR_NO_DATA != ret) {
-               CTS_ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
+               ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                return ret;
        }
 
        if (CONTACTS_ERROR_NO_DATA == ret) {
                snprintf(query, sizeof(query),
-                       "INSERT INTO "CTS_TABLE_SIM_INFO" (unique_id) VALUES('%s')", unique_id);
+                               "INSERT INTO "CTS_TABLE_SIM_INFO" (unique_id) VALUES('%s')", unique_id);
                ret = ctsvc_query_exec(query);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_query_exec Fail(%d)", ret);
+                       ERR("ctsvc_query_exec() Fail(%d)", ret);
                        return ret;
                }
                id = ctsvc_db_get_last_insert_id();
        }
-       CTS_DBG("id :%d, unique_id :%s", id, unique_id);
+       DBG("id :%d, unique_id :%s", id, unique_id);
        *sim_id = id;
 
        return CONTACTS_ERROR_NONE;
 
 }
 
-static int __ctsvc_server_db_get_contact_data(sqlite3db, int id, ctsvc_contact_s *contact)
+static int __ctsvc_server_db_get_contact_data(sqlite3 *db, int id, ctsvc_contact_s *contact)
 {
        int ret;
        int datatype;
@@ -535,18 +533,18 @@ static int __ctsvc_server_db_get_contact_data(sqlite3* db, int id, ctsvc_contact
        char query[CTS_SQL_MAX_LEN] = {0};
 
        snprintf(query, sizeof(query),
-                               "SELECT datatype, id, data.contact_id, is_default, data1, data2, "
-                                       "data3, data4, data5, data6, data7, data8, data9, data10, data11, data12 "
-                                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                                       "WHERE data.contact_id = %d  AND is_my_profile = 0 "
-                                       "ORDER BY is_default DESC", id);
+                       "SELECT datatype, id, data.contact_id, is_default, data1, data2, "
+                       "data3, data4, data5, data6, data7, data8, data9, data10, data11, data12 "
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE data.contact_id = %d  AND is_my_profile = 0 "
+                       "ORDER BY is_default DESC", id);
        ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
-       RETVM_IF(SQLITE_OK != ret, ret, "DB error : sqlite3_prepare_v2() Fail(%d)", ret);
+       RETVM_IF(SQLITE_OK != ret, ret, "sqlite3_prepare_v2() Fail(%d)", ret);
 
        ret = sqlite3_step(stmt);
        if (SQLITE_ROW != ret) {
-               CTS_ERR("sqlite3_step() Fail(%d)", ret);
+               ERR("sqlite3_step() Fail(%d)", ret);
                sqlite3_finalize(stmt);
                return ret;
        }
@@ -582,7 +580,7 @@ static int __ctsvc_server_db_get_contact_data(sqlite3* db, int id, ctsvc_contact
 int ctsvc_server_update_sort_name()
 {
        int ret = 0;
-       sqlite3db = NULL;
+       sqlite3 *db = NULL;
        cts_stmt stmt = NULL;
        cts_stmt update_stmt = NULL;
        cts_stmt search_name_stmt = NULL;
@@ -594,14 +592,14 @@ int ctsvc_server_update_sort_name()
 
        ret = ctsvc_server_db_open(&db);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_server_db_open() Fail(%d)", ret);
+               ERR("ctsvc_server_db_open() Fail(%d)", ret);
                ctsvc_db_set_status(CONTACTS_DB_STATUS_NORMAL);
                return ret;
        }
 
        ret = ctsvc_server_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_server_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_server_begin_trans() Fail(%d)", ret);
                ctsvc_server_db_close();
                ctsvc_db_set_status(CONTACTS_DB_STATUS_NORMAL);
                return ret;
@@ -609,10 +607,10 @@ int ctsvc_server_update_sort_name()
 
        snprintf(query, sizeof(query),
                        "SELECT contact_id "
-                               "FROM "CTS_TABLE_CONTACTS" WHERE deleted = 0");
+                       "FROM "CTS_TABLE_CONTACTS" WHERE deleted = 0");
        ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
        if (SQLITE_OK != ret) {
-               CTS_ERR("sqlite3_prepare_v2(%s) Fail(%s)", query, sqlite3_errmsg(db));
+               ERR("sqlite3_prepare_v2(%s) Fail(%s)", query, sqlite3_errmsg(db));
                ctsvc_server_end_trans(false);
                ctsvc_server_db_close();
                ctsvc_db_set_status(CONTACTS_DB_STATUS_NORMAL);
@@ -622,13 +620,13 @@ int ctsvc_server_update_sort_name()
        /* Update sort_name, sortkey, display_name_language of contact table */
        snprintf(query, sizeof(query),
                        "UPDATE "CTS_TABLE_CONTACTS" "
-                               "SET sort_name = ?, reverse_sort_name = ?, sortkey = ?, reverse_sortkey = ?, "
-                                       " display_name_language = ?,  reverse_display_name_language = ?, "
-                                       " display_name_source = ? "
-                               "WHERE contact_id = ?");
+                       "SET sort_name = ?, reverse_sort_name = ?, sortkey = ?, reverse_sortkey = ?, "
+                       " display_name_language = ?,  reverse_display_name_language = ?, "
+                       " display_name_source = ? "
+                       "WHERE contact_id = ?");
        ret = sqlite3_prepare_v2(db, query, strlen(query), &update_stmt, NULL);
        if (SQLITE_OK != ret) {
-               CTS_ERR("sqlite3_propare_v2(%s) Fail(%s)", query, sqlite3_errmsg(db));
+               ERR("sqlite3_propare_v2(%s) Fail(%s)", query, sqlite3_errmsg(db));
                ret = CONTACTS_ERROR_DB;
                goto DATA_FREE;
        }
@@ -639,7 +637,7 @@ int ctsvc_server_update_sort_name()
                        CTS_TABLE_SEARCH_INDEX);
        ret = sqlite3_prepare_v2(db, query, strlen(query), &search_name_stmt, NULL);
        if (SQLITE_OK != ret) {
-               CTS_ERR("sqlite3_propare_v2(%s) Fail(%s)", query, sqlite3_errmsg(db));
+               ERR("sqlite3_propare_v2(%s) Fail(%s)", query, sqlite3_errmsg(db));
                ret = CONTACTS_ERROR_DB;
                goto DATA_FREE;
        }
@@ -653,7 +651,7 @@ int ctsvc_server_update_sort_name()
                contacts_record_create(_contacts_contact._uri, (contacts_record_h*)&contact);
                ret = __ctsvc_server_db_get_contact_data(db, contact_id, contact);
                if (SQLITE_DONE != ret) {
-                       CTS_ERR("sqlite3_step(%s) Fail(%d, %s)", query, ret, sqlite3_errmsg(db));
+                       ERR("sqlite3_step(%s) Fail(%d, %s)", query, ret, sqlite3_errmsg(db));
                        contacts_record_destroy((contacts_record_h)contact, true);
                        ret = CONTACTS_ERROR_DB;
                        goto DATA_FREE;
@@ -676,7 +674,7 @@ int ctsvc_server_update_sort_name()
 
                ret = sqlite3_step(update_stmt);
                if (SQLITE_DONE != ret) {
-                       CTS_ERR("sqlite3_step(%s) Fail(%d, %s)", query, ret, sqlite3_errmsg(db));
+                       ERR("sqlite3_step(%s) Fail(%d, %s)", query, ret, sqlite3_errmsg(db));
                        contacts_record_destroy((contacts_record_h)contact, true);
                        ret = CONTACTS_ERROR_DB;
                        goto DATA_FREE;
@@ -691,7 +689,7 @@ int ctsvc_server_update_sort_name()
                        ret = sqlite3_step(search_name_stmt);
                        free(search_name);
                        if (SQLITE_DONE != ret) {
-                               CTS_ERR("sqlite3_step(%s) Fail(%d, %s)", query, ret, sqlite3_errmsg(db));
+                               ERR("sqlite3_step(%s) Fail(%d, %s)", query, ret, sqlite3_errmsg(db));
                                contacts_record_destroy((contacts_record_h)contact, true);
                                ret = CONTACTS_ERROR_DB;
                                goto DATA_FREE;
@@ -703,7 +701,7 @@ int ctsvc_server_update_sort_name()
        }
 
        if (SQLITE_ROW != ret && SQLITE_DONE != ret) {
-               CTS_ERR("sqlite3_step() Fail(%d)", ret);
+               ERR("sqlite3_step() Fail(%d)", ret);
                ret = CONTACTS_ERROR_DB;
                goto DATA_FREE;
        }
@@ -728,9 +726,9 @@ DATA_FREE:
                        if (0 <= fd)
                                close(fd);
                }
-       }
-       else
+       } else {
                ctsvc_server_end_trans(false);
+       }
 
        ctsvc_server_db_close();
        ctsvc_db_set_status(CONTACTS_DB_STATUS_NORMAL);
index b1674a8..d8faaa3 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
index 5599ffc..c197ce3 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -64,9 +64,9 @@ static int __ctsvc_server_find_person_id_of_phonelog(sqlite3 *__db, char *normal
 
        ret = sqlite3_prepare_v2(__db, query, sizeof(query), &stmt, NULL);
        if (stmt == NULL) {
-               CTS_ERR("sqlite3_prepare_v2 fail(%d)", ret);
+               ERR("sqlite3_prepare_v2 Fail(%d)", ret);
                if (bind_text) {
-                       for (cursor=bind_text;cursor;cursor=cursor->next,i++)
+                       for (cursor = bind_text; cursor; cursor = cursor->next, i++)
                                free(cursor->data);
                        g_slist_free(bind_text);
                }
@@ -74,7 +74,7 @@ static int __ctsvc_server_find_person_id_of_phonelog(sqlite3 *__db, char *normal
        }
 
        if (bind_text) {
-               for (cursor=bind_text,i=1;cursor;cursor=cursor->next,i++) {
+               for (cursor = bind_text, i = 1; cursor; cursor = cursor->next, i++) {
                        const char *text = cursor->data;
                        if (text && *text)
                                sqlite3_bind_text(stmt, i, text, strlen(text), SQLITE_STATIC);
@@ -84,8 +84,8 @@ static int __ctsvc_server_find_person_id_of_phonelog(sqlite3 *__db, char *normal
        while ((ret = sqlite3_step(stmt))) {
                id = sqlite3_column_int(stmt, 0);
                number_type = sqlite3_column_int(stmt, 1);
-               if (find_person_id <= 0 && id > 0) {
-                       find_person_id = id;    /* find first match person_id */
+               if (find_person_id <= 0 && 0 < id) {
+                       find_person_id = id;   /* find first match person_id */
                        *find_number_type = number_type;
                        if (person_id <= 0)
                                break;
@@ -100,7 +100,7 @@ static int __ctsvc_server_find_person_id_of_phonelog(sqlite3 *__db, char *normal
        sqlite3_finalize(stmt);
 
        if (bind_text) {
-               for (cursor=bind_text;cursor;cursor=cursor->next,i++)
+               for (cursor = bind_text; cursor; cursor = cursor->next, i++)
                        free(cursor->data);
                g_slist_free(bind_text);
        }
@@ -123,7 +123,7 @@ static void __ctsvc_server_number_info_update(sqlite3 *__db)
                        "WHERE log_type < %d", CONTACTS_PLOG_TYPE_EMAIL_RECEIVED);
        ret = sqlite3_prepare_v2(__db, query, strlen(query), &stmt, NULL);
        if (SQLITE_OK != ret) {
-               CTS_ERR("sqlite3_prepare_v2() Fail(%s)", sqlite3_errmsg(__db));
+               ERR("sqlite3_prepare_v2() Fail(%s)", sqlite3_errmsg(__db));
                return;
        }
 
@@ -132,7 +132,7 @@ static void __ctsvc_server_number_info_update(sqlite3 *__db)
                        "minmatch=?, person_id=?, number_type=? WHERE id = ?");
        ret = sqlite3_prepare_v2(__db, query, strlen(query), &update_stmt, NULL);
        if (SQLITE_OK != ret) {
-               CTS_ERR("sqlite3_prepare_v2() Fail(%s)", sqlite3_errmsg(__db));
+               ERR("sqlite3_prepare_v2() Fail(%s)", sqlite3_errmsg(__db));
                sqlite3_finalize(stmt);
                return;
        }
@@ -168,7 +168,7 @@ static void __ctsvc_server_number_info_update(sqlite3 *__db)
 
                        ret = sqlite3_step(update_stmt);
                        if (SQLITE_DONE != ret) {
-                               CTS_ERR("sqlite3_step() Fail(%d, %s)", ret, sqlite3_errmsg(__db));
+                               ERR("sqlite3_step() Fail(%d, %s)", ret, sqlite3_errmsg(__db));
                                break;
                        }
                        sqlite3_reset(update_stmt);
@@ -184,7 +184,7 @@ static void __ctsvc_server_number_info_update(sqlite3 *__db)
                        "WHERE datatype = %d", CTSVC_DATA_NUMBER);
        ret = sqlite3_prepare_v2(__db, query, strlen(query), &stmt, NULL);
        if (SQLITE_OK != ret) {
-               CTS_ERR("sqlite3_prepare_v2() Fail(%s)", sqlite3_errmsg(__db));
+               ERR("sqlite3_prepare_v2() Fail(%s)", sqlite3_errmsg(__db));
                return;
        }
 
@@ -192,7 +192,7 @@ static void __ctsvc_server_number_info_update(sqlite3 *__db)
                        "UPDATE "CTS_TABLE_DATA" SET data4=?, data5=?, data6=?  WHERE id = ?");
        ret = sqlite3_prepare_v2(__db, query, strlen(query), &update_stmt, NULL);
        if (SQLITE_OK != ret) {
-               CTS_ERR("sqlite3_prepare_v2() Fail(%s)", sqlite3_errmsg(__db));
+               ERR("sqlite3_prepare_v2() Fail(%s)", sqlite3_errmsg(__db));
                sqlite3_finalize(stmt);
                return;
        }
@@ -217,7 +217,7 @@ static void __ctsvc_server_number_info_update(sqlite3 *__db)
                        sqlite3_bind_int(update_stmt, 4, id);
                        ret = sqlite3_step(update_stmt);
                        if (SQLITE_DONE != ret) {
-                               CTS_ERR("sqlite3_step() Fail(%d, %s)", ret, sqlite3_errmsg(__db));
+                               ERR("sqlite3_step() Fail(%d, %s)", ret, sqlite3_errmsg(__db));
                                break;
                        }
                        sqlite3_reset(update_stmt);
@@ -240,12 +240,12 @@ static int __ctsvc_server_get_db_version(sqlite3 *db, int *version)
        snprintf(query, sizeof(query), "PRAGMA user_version;");
        ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
        if (SQLITE_OK != ret) {
-               CTS_ERR("sqlite3_prepare_v2() Fail(%s)", sqlite3_errmsg(db));
+               ERR("sqlite3_prepare_v2() Fail(%s)", sqlite3_errmsg(db));
                return CONTACTS_ERROR_DB;
        }
        ret = sqlite3_step(stmt);
        if (SQLITE_ROW != ret) {
-               CTS_ERR("sqlite3_step() Fail(%s)", sqlite3_errmsg(db));
+               ERR("sqlite3_step() Fail(%s)", sqlite3_errmsg(db));
                sqlite3_finalize(stmt);
                return CONTACTS_ERROR_DB;
        }
@@ -273,20 +273,20 @@ int ctsvc_server_db_update(void)
        if (old_version <= 100) {
                ret = sqlite3_exec(__db, "CREATE INDEX name_lookup_idx1 ON name_lookup(contact_id);", NULL, 0, &errmsg);
                if (SQLITE_OK != ret) {
-                       CTS_ERR("drop view view_person_contact_group Fail(%d) : %s", ret, errmsg);
+                       ERR("drop view view_person_contact_group Fail(%d) : %s", ret, errmsg);
                        sqlite3_free(errmsg);
                }
 
                ret = sqlite3_exec(__db, "CREATE INDEX phone_lookup_idx1 ON phone_lookup(contact_id);", NULL, 0, &errmsg);
                if (SQLITE_OK != ret) {
-                       CTS_ERR("drop view view_person_contact_group Fail(%d) : %s", ret, errmsg);
+                       ERR("drop view view_person_contact_group Fail(%d) : %s", ret, errmsg);
                        sqlite3_free(errmsg);
                }
 
                /* add view_activity_photos */
                ret = sqlite3_exec(__db, "DROP VIEW view_phonelog_number", NULL, 0, &errmsg);
                if (SQLITE_OK != ret) {
-                       CTS_ERR("drop view view_person_contact_group Fail(%d) : %s", ret, errmsg);
+                       ERR("drop view view_person_contact_group Fail(%d) : %s", ret, errmsg);
                        sqlite3_free(errmsg);
                }
 
@@ -295,63 +295,63 @@ int ctsvc_server_db_update(void)
                /* change DB VIEW view_person_contact_group for performance */
                ret = sqlite3_exec(__db, "DROP VIEW "CTSVC_DB_VIEW_PERSON_GROUP, NULL, 0, &errmsg);
                if (SQLITE_OK != ret) {
-                       CTS_ERR("drop view view_person_contact_group Fail(%d) : %s", ret, errmsg);
+                       ERR("drop view view_person_contact_group Fail(%d) : %s", ret, errmsg);
                        sqlite3_free(errmsg);
                }
 
                /* change DB VIEW view_contact_group for performance */
                ret = sqlite3_exec(__db, "DROP VIEW "CTSVC_DB_VIEW_CONTACT_GROUP, NULL, 0, &errmsg);
                if (SQLITE_OK != ret) {
-                       CTS_ERR("drop view view_contact_group Fail : %s", errmsg);
+                       ERR("drop view view_contact_group Fail : %s", errmsg);
                        sqlite3_free(errmsg);
                }
 
                /* for number compare */
                ret = sqlite3_exec(__db, "DROP VIEW "CTSVC_DB_VIEW_NUMBER, NULL, 0, &errmsg);
                if (SQLITE_OK != ret) {
-                       CTS_ERR("drop view %s Fail(%d) : %s", CTSVC_DB_VIEW_NUMBER, ret, errmsg);
+                       ERR("drop view %s Fail(%d) : %s", CTSVC_DB_VIEW_NUMBER, ret, errmsg);
                        sqlite3_free(errmsg);
                }
 
                ret = sqlite3_exec(__db, "DROP VIEW "CTSVC_DB_VIEW_SPEEDIDAL, NULL, 0, &errmsg);
                if (SQLITE_OK != ret) {
-                       CTS_ERR("drop view %s Fail(%d) : %s", CTSVC_DB_VIEW_SPEEDIDAL, ret, errmsg);
+                       ERR("drop view %s Fail(%d) : %s", CTSVC_DB_VIEW_SPEEDIDAL, ret, errmsg);
                        sqlite3_free(errmsg);
                }
 
                ret = sqlite3_exec(__db, "DROP VIEW "CTSVC_DB_VIEW_PERSON_NUMBER, NULL, 0, &errmsg);
                if (SQLITE_OK != ret) {
-                       CTS_ERR("drop view %s Fail(%d) : %s", CTSVC_DB_VIEW_PERSON_NUMBER, ret, errmsg);
+                       ERR("drop view %s Fail(%d) : %s", CTSVC_DB_VIEW_PERSON_NUMBER, ret, errmsg);
                        sqlite3_free(errmsg);
                }
 
                ret = sqlite3_exec(__db, "DROP VIEW "CTSVC_DB_VIEW_CONTACT_NUMBER, NULL, 0, &errmsg);
                if (SQLITE_OK != ret) {
-                       CTS_ERR("drop view %s Fail(%d) : %s", CTSVC_DB_VIEW_CONTACT_NUMBER, ret, errmsg);
+                       ERR("drop view %s Fail(%d) : %s", CTSVC_DB_VIEW_CONTACT_NUMBER, ret, errmsg);
                        sqlite3_free(errmsg);
                }
 
                ret = sqlite3_exec(__db, "DROP VIEW "CTSVC_DB_VIEW_PERSON_PHONELOG, NULL, 0, &errmsg);
                if (SQLITE_OK != ret) {
-                       CTS_ERR("drop view %s Fail(%d) : %s", CTSVC_DB_VIEW_PERSON_PHONELOG, ret, errmsg);
+                       ERR("drop view %s Fail(%d) : %s", CTSVC_DB_VIEW_PERSON_PHONELOG, ret, errmsg);
                        sqlite3_free(errmsg);
                }
 
                ret = sqlite3_exec(__db, "ALTER TABLE "CTS_TABLE_PHONELOGS" ADD COLUMN clean_num TEXT", NULL, 0, &errmsg);
                if (SQLITE_OK != ret) {
-                       CTS_ERR("add phonelogs.clean_num Fail(%d) : %s", ret, errmsg);
+                       ERR("add phonelogs.clean_num Fail(%d) : %s", ret, errmsg);
                        sqlite3_free(errmsg);
                }
 
                ret = sqlite3_exec(__db, "ALTER TABLE "CTS_TABLE_PHONELOGS" ADD COLUMN sim_id TEXT", NULL, 0, &errmsg);
                if (SQLITE_OK != ret) {
-                       CTS_ERR("add phonelogs.sim_id Fail(%d) : %s", ret, errmsg);
+                       ERR("add phonelogs.sim_id Fail(%d) : %s", ret, errmsg);
                        sqlite3_free(errmsg);
                }
 
                ret = sqlite3_exec(__db, "ALTER TABLE "CTS_TABLE_PHONELOGS" ADD COLUMN number_type TEXT", NULL, 0, &errmsg);
                if (SQLITE_OK != ret) {
-                       CTS_ERR("add phonelogs.number_type Fail(%d) : %s", ret, errmsg);
+                       ERR("add phonelogs.number_type Fail(%d) : %s", ret, errmsg);
                        sqlite3_free(errmsg);
                }
 
@@ -360,18 +360,18 @@ int ctsvc_server_db_update(void)
 
                ret = sqlite3_exec(__db, "ALTER TABLE "CTS_TABLE_SDN" ADD COLUMN sim_slot_no TEXT", NULL, 0, &errmsg);
                if (SQLITE_OK != ret) {
-                       CTS_ERR("add sdn.sim_id Fail(%d) : %s", ret, errmsg);
+                       ERR("add sdn.sim_id Fail(%d) : %s", ret, errmsg);
                        sqlite3_free(errmsg);
                }
 
                ret = sqlite3_exec(__db, "ALTER TABLE "CTS_TABLE_ADDRESSBOOKS" ADD COLUMN smack_label TEXT", NULL, 0, &errmsg);
                if (SQLITE_OK != ret) {
-                       CTS_ERR("add sdn.sim_id Fail(%d) : %s", ret, errmsg);
+                       ERR("add sdn.sim_id Fail(%d) : %s", ret, errmsg);
                        sqlite3_free(errmsg);
                }
                ret = sqlite3_exec(__db, "UPDATE "CTS_TABLE_ADDRESSBOOKS" SET='org.tizen.contact' WHERE addressbook_id = 0", NULL, 0, &errmsg);
                if (SQLITE_OK != ret) {
-                       CTS_ERR("add sdn.sim_id Fail(%d) : %s", ret, errmsg);
+                       ERR("add sdn.sim_id Fail(%d) : %s", ret, errmsg);
                        sqlite3_free(errmsg);
                }
 
@@ -382,13 +382,13 @@ int ctsvc_server_db_update(void)
                                "UNIQUE(unique_id))");
                ret = sqlite3_exec(__db, query, NULL, 0, &errmsg);
                if (SQLITE_OK != ret) {
-                       CTS_ERR("create sim_info table(%d)", ret);
+                       ERR("create sim_info table(%d)", ret);
                        sqlite3_free(errmsg);
                }
 
                ret = sqlite3_exec(__db, "DROP trigger trg_contacts_update", NULL, 0, &errmsg);
                if (SQLITE_OK != ret) {
-                       CTS_ERR("drop trigger trg_contacts_update Fail(%d) : %s", ret, errmsg);
+                       ERR("drop trigger trg_contacts_update Fail(%d) : %s", ret, errmsg);
                        sqlite3_free(errmsg);
                }
                ret = sqlite3_exec(__db,
@@ -403,7 +403,7 @@ int ctsvc_server_db_update(void)
                                " END;",
                                NULL, 0, &errmsg);
                if (SQLITE_OK != ret) {
-                       CTS_ERR("create trigger trg_contacts_update Fail(%d) : %s", ret, errmsg);
+                       ERR("create trigger trg_contacts_update Fail(%d) : %s", ret, errmsg);
                        sqlite3_free(errmsg);
                }
 
@@ -421,7 +421,7 @@ int ctsvc_server_db_update(void)
                        "PRAGMA user_version = %d", CTSVC_SCHEMA_VERSION);
        ret = sqlite3_exec(__db, query, NULL, 0, &errmsg);
        if (SQLITE_OK != ret) {
-               CTS_ERR("sqlite3_exec() Fail(%s)", errmsg);
+               ERR("sqlite3_exec() Fail(%s)", errmsg);
                sqlite3_free(errmsg);
        }
 
index badbc82..59d5dea 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
index 078fb06..7943aec 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -55,7 +55,7 @@ bool ctsvc_server_have_telephony_feature(void)
 inline int ctsvc_server_set_default_sort(int sort)
 {
        int ret = vconf_set_int(ctsvc_get_default_sort_vconfkey(), sort);
-       RETVM_IF(ret<0, CONTACTS_ERROR_SYSTEM, "vconf_set_int() Fail(%d)", ret);
+       RETVM_IF(ret < 0, CONTACTS_ERROR_SYSTEM, "vconf_set_int() Fail(%d)", ret);
        ctsvc_set_sort_memory(sort);
        return CONTACTS_ERROR_NONE;
 }
@@ -69,9 +69,8 @@ static void __ctsvc_server_change_language_cb(keynode_t *key, void *data)
        char *langset = NULL;
 
        new_langset = vconf_keynode_get_str(key);
-       if (NULL == new_langset)
-       {
-               CTS_ERR("vconf_keynode_get_str() Fail");
+       if (NULL == new_langset) {
+               ERR("vconf_keynode_get_str() Fail");
                return;
        }
        langset = ctsvc_get_langset();
@@ -82,13 +81,12 @@ static void __ctsvc_server_change_language_cb(keynode_t *key, void *data)
        if (STRING_EQUAL != strcmp(langset, new_langset)) {
                bool sort_name_update = false;
                old_primary_sort = ctsvc_get_primary_sort();
-               if (old_primary_sort < 0) {
-                       RETM_IF(ret<0, "ctsvc_get_primary_sort() Fail(%d)", ret);
-               }
+               if (old_primary_sort < 0)
+                       RETM_IF(ret < 0, "ctsvc_get_primary_sort() Fail(%d)", ret);
+
                old_secondary_sort = ctsvc_get_secondary_sort();
-               if (old_secondary_sort < 0) {
-                       RETM_IF(ret<0, "ctsvc_get_secondary_sort() Fail(%d)", ret);
-               }
+               if (old_secondary_sort < 0)
+                       RETM_IF(ret < 0, "ctsvc_get_secondary_sort() Fail(%d)", ret);
 
                if (STRING_EQUAL == strncmp(langset, "zh", strlen("zh")) ||
                                STRING_EQUAL == strncmp(langset, "ko", strlen("ko")) ||
@@ -109,10 +107,9 @@ static void __ctsvc_server_change_language_cb(keynode_t *key, void *data)
                new_secondary_sort = CTSVC_SORT_WESTERN;
 
                if (sort_name_update) {
-                  ctsvc_server_set_default_sort(new_primary_sort);
+                       ctsvc_server_set_default_sort(new_primary_sort);
                        ctsvc_server_update_sort_name();
-               }
-               else {
+               } else {
                        if (new_primary_sort != old_primary_sort)
                                ret = ctsvc_server_update_sort(old_primary_sort, old_secondary_sort, new_primary_sort, new_secondary_sort);
 
@@ -128,7 +125,7 @@ void ctsvc_server_final_configuration(void)
        int ret = -1;
 
        ret = vconf_ignore_key_changed(VCONFKEY_LANGSET, __ctsvc_server_change_language_cb);
-       RETM_IF(ret<0,"vconf_ignore_key_changed(%s) Fail(%d)", VCONFKEY_LANGSET, ret);
+       RETM_IF(ret < 0, "vconf_ignore_key_changed(%s) Fail(%d)", VCONFKEY_LANGSET, ret);
 
        ctsvc_server_sim_final();
 }
@@ -146,7 +143,7 @@ int ctsvc_server_init_configuration(void)
 
        ret = vconf_get_int(ctsvc_get_default_sort_vconfkey(), &sort_type);
        if (ret < 0 || sort_type == CTSVC_SORT_OTHERS) {
-               CTS_ERR("vconf_get_int(%s) Fail(%d)", ctsvc_get_default_sort_vconfkey(),ret);
+               ERR("vconf_get_int(%s) Fail(%d)", ctsvc_get_default_sort_vconfkey(), ret);
                sort_type = ctsvc_get_sort_type_from_language(system_language);
                if (sort_type == CTSVC_SORT_OTHERS)
                        sort_type = CTSVC_SORT_WESTERN;
@@ -155,11 +152,11 @@ int ctsvc_server_init_configuration(void)
 
        ret = vconf_notify_key_changed(VCONFKEY_LANGSET,
                        __ctsvc_server_change_language_cb, NULL);
-       RETVM_IF(ret<0, CONTACTS_ERROR_SYSTEM, "vconf_notify_key_changed(%s) Fail(%d)",
+       RETVM_IF(ret < 0, CONTACTS_ERROR_SYSTEM, "vconf_notify_key_changed(%s) Fail(%d)",
                        VCONFKEY_LANGSET, ret);
 
        ret = ctsvc_server_sim_init();
-       RETVM_IF(ret !=CONTACTS_ERROR_NONE, ret, "ctsvc_server_sim_init Fail(%d)", ret);
+       RETVM_IF(ret != CONTACTS_ERROR_NONE, ret, "ctsvc_server_sim_init Fail(%d)", ret);
 
        return CONTACTS_ERROR_NONE;
 }
index f71cd25..b229151 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
index 43fd411..b787cf5 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -35,7 +35,7 @@ typedef struct {
        char *smack;
        int *write_list;
        int write_list_count;
-}ctsvc_permission_info_s;
+} ctsvc_permission_info_s;
 
 static GList *__thread_list = NULL;
 
@@ -57,8 +57,10 @@ static int __ctsvc_have_smack(void)
 static ctsvc_permission_info_s * __ctsvc_find_access_info(unsigned int thread_id)
 {
        GList *cursor;
-       CTS_VERBOSE("thread id : %08x", thread_id);
-       for (cursor=__thread_list;cursor;cursor = cursor->next) {
+
+       DBG("thread id : %08x", thread_id);
+
+       for (cursor = __thread_list; cursor; cursor = cursor->next) {
                ctsvc_permission_info_s *info = NULL;
                info = cursor->data;
                if (info->thread_id == thread_id)
@@ -70,7 +72,7 @@ static ctsvc_permission_info_s * __ctsvc_find_access_info(unsigned int thread_id
 /*
  * Check the client has read permission of the file(path)
  * success : CONTACTS_ERROR_NONE
- * fail : return negative value
+ * Fail: return negative value
  */
 int ctsvc_have_file_read_permission(const char *path)
 {
@@ -78,7 +80,7 @@ int ctsvc_have_file_read_permission(const char *path)
        RETV_IF(NULL == path, CONTACTS_ERROR_INVALID_PARAMETER);
 
        if (0 != access(path, F_OK|R_OK)) {
-               CTS_ERR("access(%s) Fail(%d)", path, errno);
+               ERR("access(%s) Fail(%d)", path, errno);
                switch (errno) {
                case EACCES:
                        return CONTACTS_ERROR_PERMISSION_DENIED;
@@ -118,7 +120,7 @@ static void __ctsvc_set_permission_info(ctsvc_permission_info_s *info)
                        "SELECT count(addressbook_id) FROM "CTS_TABLE_ADDRESSBOOKS);
        ret = ctsvc_query_get_first_int_result(query, &count);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_query_get_first_int_result() Fail(%d)", ret);
+               ERR(" ctsvc_query_get_first_int_result() Fail(%d)", ret);
                return;
        }
        info->write_list = calloc(count, sizeof(int));
@@ -129,7 +131,7 @@ static void __ctsvc_set_permission_info(ctsvc_permission_info_s *info)
                        "SELECT addressbook_id, mode, smack_label FROM "CTS_TABLE_ADDRESSBOOKS);
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                return;
        }
 
@@ -140,7 +142,7 @@ static void __ctsvc_set_permission_info(ctsvc_permission_info_s *info)
                char *temp = NULL;
 
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        return;
                }
@@ -149,11 +151,11 @@ static void __ctsvc_set_permission_info(ctsvc_permission_info_s *info)
                mode = ctsvc_stmt_get_int(stmt, 1);
                temp = ctsvc_stmt_get_text(stmt, 2);
 
-               if (!smack_enabled) // smack disabled
+               if (!smack_enabled) /* smack disabled */
                        info->write_list[write_index++] = id;
-               else if (NULL == info->ipc) // contacts-service daemon
+               else if (NULL == info->ipc) /* contacts-service daemon */
                        info->write_list[write_index++] = id;
-               else if (info->smack && temp && STRING_EQUAL == strcmp(temp, info->smack)) // owner
+               else if (info->smack && temp && STRING_EQUAL == strcmp(temp, info->smack))/* owner */
                        info->write_list[write_index++] = id;
                else if (CONTACTS_ADDRESS_BOOK_MODE_NONE == mode)
                        info->write_list[write_index++] = id;
@@ -216,7 +218,7 @@ void ctsvc_set_client_access_info(pims_ipc_h ipc, const char *smack)
        if (NULL == info) {
                info = calloc(1, sizeof(ctsvc_permission_info_s));
                if (NULL == info) {
-                       CTS_ERR("Thread(0x%x), calloc() Fail", thread_id);
+                       ERR("Thread(0x%x), calloc() Fail", thread_id);
                        ctsvc_mutex_unlock(CTS_MUTEX_ACCESS_CONTROL);
                        return;
                }
@@ -243,9 +245,10 @@ void ctsvc_reset_all_client_access_info()
 {
        GList *cursor;
        ctsvc_mutex_lock(CTS_MUTEX_ACCESS_CONTROL);
-       for (cursor=__thread_list;cursor;cursor=cursor->next) {
-               ctsvc_permission_info_s *info = (ctsvc_permission_info_s *)cursor->data;
-               if (info == NULL) continue;
+       for (cursor = __thread_list; cursor; cursor = cursor->next) {
+               ctsvc_permission_info_s *info = cursor->data;
+               if (info == NULL)
+                       continue;
                __ctsvc_set_permission_info(info);
        }
        ctsvc_mutex_unlock(CTS_MUTEX_ACCESS_CONTROL);
@@ -257,7 +260,7 @@ bool ctsvc_have_permission(pims_ipc_h ipc, int permission)
        if (have_smack != 1)   /* smack disable */
                return true;
 
-       if (NULL == ipc) // contacts-service daemon
+       if (NULL == ipc) /* contacts-service daemon */
                return true;
 
        if ((CTSVC_PERMISSION_CONTACT_READ & permission) &&
@@ -294,17 +297,17 @@ bool ctsvc_have_ab_write_permission(int addressbook_id)
        find = __ctsvc_find_access_info(thread_id);
        if (NULL == find) {
                ctsvc_mutex_unlock(CTS_MUTEX_ACCESS_CONTROL);
-               CTS_ERR("can not found access info");
+               ERR("can not found access info");
                return false;
        }
 
        if (NULL == find->write_list) {
                ctsvc_mutex_unlock(CTS_MUTEX_ACCESS_CONTROL);
-               CTS_ERR("there is no write access info");
+               ERR("there is no write access info");
                return false;
        }
 
-       for (i=0;i<find->write_list_count;i++) {
+       for (i = 0; i < find->write_list_count; i++) {
                if (addressbook_id == find->write_list[i]) {
                        ctsvc_mutex_unlock(CTS_MUTEX_ACCESS_CONTROL);
                        return true;
@@ -312,7 +315,7 @@ bool ctsvc_have_ab_write_permission(int addressbook_id)
        }
 
        ctsvc_mutex_unlock(CTS_MUTEX_ACCESS_CONTROL);
-       CTS_ERR("Thread(0x%x), Does not have write permission of addressbook(%d)", thread_id, addressbook_id);
+       ERR("Thread(0x%x), Does not have write permission of addressbook(%d)", thread_id, addressbook_id);
        return false;
 }
 
@@ -331,7 +334,7 @@ int ctsvc_get_write_permitted_addressbook_ids(int **addressbook_ids, int *count)
                        int size = find->write_list_count * sizeof(int);
                        int *list = calloc(1, size);
                        if (NULL == list) {
-                               CTS_ERR("Thread(0x%x), calloc() Fail", thread_id);
+                               ERR("Thread(0x%x), calloc() Fail", thread_id);
                                ctsvc_mutex_unlock(CTS_MUTEX_ACCESS_CONTROL);
                                return CONTACTS_ERROR_OUT_OF_MEMORY;
                        }
@@ -375,16 +378,16 @@ int ctsvc_is_owner(int addressbook_id)
 
        snprintf(query, sizeof(query),
                        "SELECT addressbook_name, smack_label FROM "CTS_TABLE_ADDRESSBOOKS" "
-                               "WHERE addressbook_id = %d", addressbook_id);
+                       "WHERE addressbook_id = %d", addressbook_id);
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                return ret;
        }
 
        ret = ctsvc_stmt_step(stmt);
        if (1 != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                return ret;
        }
index 57ed887..8825008 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
index 3c82cda..6ff2c74 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
@@ -79,7 +75,7 @@ typedef struct {
        int read_permission;
        int write_permission;
        bool need_ab_access_control;
-}db_table_info_s;
+} db_table_info_s;
 
 static const db_table_info_s __db_tables[] = {
        {CTSVC_VIEW_URI_ADDRESSBOOK,    CTS_TABLE_ADDRESSBOOKS, CTSVC_PERMISSION_CONTACT_READ, CTSVC_PERMISSION_CONTACT_WRITE, true},
@@ -89,7 +85,7 @@ static const db_table_info_s __db_tables[] = {
        {CTSVC_VIEW_URI_CONTACT,                CTSVC_DB_VIEW_CONTACT, CTSVC_PERMISSION_CONTACT_READ, CTSVC_PERMISSION_CONTACT_WRITE, true},
        {CTSVC_VIEW_URI_MY_PROFILE,     CTSVC_DB_VIEW_MY_PROFILE, CTSVC_PERMISSION_CONTACT_READ, CTSVC_PERMISSION_CONTACT_WRITE, true},
        {CTSVC_VIEW_URI_ACTIVITY,               CTSVC_DB_VIEW_ACTIVITY, CTSVC_PERMISSION_CONTACT_READ, CTSVC_PERMISSION_CONTACT_WRITE, true},
-       {CTSVC_VIEW_URI_ACTIVITY_PHOTO,CTSVC_DB_VIEW_ACTIVITY_PHOTOS, CTSVC_PERMISSION_CONTACT_READ, CTSVC_PERMISSION_CONTACT_WRITE, true},
+       {CTSVC_VIEW_URI_ACTIVITY_PHOTO, CTSVC_DB_VIEW_ACTIVITY_PHOTOS, CTSVC_PERMISSION_CONTACT_READ, CTSVC_PERMISSION_CONTACT_WRITE, true},
        {CTSVC_VIEW_URI_PHONELOG,               CTS_TABLE_PHONELOGS, CTSVC_PERMISSION_PHONELOG_READ, CTSVC_PERMISSION_PHONELOG_WRITE, false},
        {CTSVC_VIEW_URI_SPEEDDIAL,              CTSVC_DB_VIEW_SPEEDIDAL, CTSVC_PERMISSION_CONTACT_READ, CTSVC_PERMISSION_CONTACT_WRITE, false},
        {CTSVC_VIEW_URI_SDN,                            CTS_TABLE_SDN, CTSVC_PERMISSION_CONTACT_READ, CTSVC_PERMISSION_CONTACT_WRITE, false},
@@ -110,14 +106,14 @@ static const db_table_info_s __db_tables[] = {
        {CTSVC_VIEW_URI_GROUP_RELATION, CTSVC_DB_VIEW_GROUP_RELATION, CTSVC_PERMISSION_CONTACT_READ, CTSVC_PERMISSION_CONTACT_WRITE, true},
        {CTSVC_VIEW_URI_EXTENSION,              CTSVC_DB_VIEW_EXTENSION, CTSVC_PERMISSION_CONTACT_READ, CTSVC_PERMISSION_CONTACT_WRITE, true},
 
-/* Do not support get_all_records, get_records_with_query, get_count, get_count_with_query */
-/*
- * {CTSVC_VIEW_URI_GROUPS_UPDATED_INFO, CTSVC_DB_VIEW_GROUPS_UPDATED_INFO, false},
- * {CTSVC_VIEW_URI_GROUPS_MEMBER_UPDATED_INFO, CTSVC_DB_VIEW_GROUPS_MEMBER_UPDATED_INFO, false},
- * {CTSVC_VIEW_URI_CONTACTS_UPDATED_INFO, CTSVC_DB_VIEW_CONTACTS_UPDATED_INFO, false},
- * {CTSVC_VIEW_URI_MY_PROFILE_UPDATED_INFO, NULL, false},
- * {CTSVC_VIEW_URI_GROUPRELS_UPDATED_INFO, NULL, false},
- */
+       /* Do not support get_all_records, get_records_with_query, get_count, get_count_with_query */
+       /*
       * {CTSVC_VIEW_URI_GROUPS_UPDATED_INFO, CTSVC_DB_VIEW_GROUPS_UPDATED_INFO, false},
       * {CTSVC_VIEW_URI_GROUPS_MEMBER_UPDATED_INFO, CTSVC_DB_VIEW_GROUPS_MEMBER_UPDATED_INFO, false},
       * {CTSVC_VIEW_URI_CONTACTS_UPDATED_INFO, CTSVC_DB_VIEW_CONTACTS_UPDATED_INFO, false},
       * {CTSVC_VIEW_URI_MY_PROFILE_UPDATED_INFO, NULL, false},
       * {CTSVC_VIEW_URI_GROUPRELS_UPDATED_INFO, NULL, false},
       */
 
        {CTSVC_VIEW_URI_READ_ONLY_PERSON_CONTACT, CTSVC_DB_VIEW_PERSON_CONTACT, CTSVC_PERMISSION_CONTACT_READ, CTSVC_PERMISSION_CONTACT_NONE, true},
        {CTSVC_VIEW_URI_READ_ONLY_PERSON_NUMBER, CTSVC_DB_VIEW_PERSON_NUMBER, CTSVC_PERMISSION_CONTACT_READ, CTSVC_PERMISSION_CONTACT_NONE, true},
@@ -146,15 +142,14 @@ int ctsvc_db_plugin_init()
        __ctsvc_db_view_ref_count++;
 #endif
 
-       if (__ctsvc_db_view_hash_table) {
+       if (__ctsvc_db_view_hash_table)
                return CONTACTS_ERROR_NONE;
-       }
 
        __ctsvc_db_view_hash_table = g_hash_table_new(g_str_hash, g_str_equal);
 
        if (__ctsvc_db_view_hash_table) {
                int count = sizeof(__db_tables) /sizeof(db_table_info_s);
-               for (i=0;i<count;i++)
+               for (i = 0; i < count; i++)
                        g_hash_table_insert(__ctsvc_db_view_hash_table, __db_tables[i].view_uri, GINT_TO_POINTER(&(__db_tables[i])));
        }
        return CONTACTS_ERROR_NONE;
@@ -168,9 +163,9 @@ int ctsvc_db_plugin_deinit()
                return;
 #endif
 
-       if (NULL == __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);
        __ctsvc_db_view_hash_table = NULL;
 
@@ -179,7 +174,8 @@ int ctsvc_db_plugin_deinit()
 
 int ctsvc_db_get_table_name(const char *view_uri, const char **out_table)
 {
-       db_table_info_s* db_view_info = NULL;
+       db_table_info_s *db_view_info = NULL;
+
        RETV_IF(NULL == view_uri, CONTACTS_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == out_table, CONTACTS_ERROR_INVALID_PARAMETER);
 
@@ -189,67 +185,67 @@ int ctsvc_db_get_table_name(const char *view_uri, const char **out_table)
                        *out_table = db_view_info->table_name;
                        return CONTACTS_ERROR_NONE;
                }
+       } else {
+               ERR("Please check contact_connect()");
        }
-       else
-               CTS_ERR("Please check contact_connect()");
 
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
 int ctsvc_required_read_permission(const char *view_uri)
 {
-       db_table_info_s* db_view_info = NULL;
+       db_table_info_s *db_view_info = NULL;
+
        RETV_IF(NULL == view_uri, CTSVC_PERMISSION_CONTACT_NONE);
 
        if (__ctsvc_db_view_hash_table) {
                db_view_info = g_hash_table_lookup(__ctsvc_db_view_hash_table, view_uri);
-               if (db_view_info) {
+               if (db_view_info)
                        return db_view_info->read_permission;
-               }
+       } else {
+               ERR("Please check contact_connect()");
        }
-       else
-               CTS_ERR("Please check contact_connect()");
 
        return CTSVC_PERMISSION_CONTACT_NONE;
 }
 
 int ctsvc_required_write_permission(const char *view_uri)
 {
-       db_table_info_s* db_view_info = NULL;
+       db_table_info_s *db_view_info = NULL;
+
        RETV_IF(NULL == view_uri, CTSVC_PERMISSION_CONTACT_NONE);
 
        if (__ctsvc_db_view_hash_table) {
                db_view_info = g_hash_table_lookup(__ctsvc_db_view_hash_table, view_uri);
-               if (db_view_info) {
+               if (db_view_info)
                        return db_view_info->write_permission;
-               }
+       } else {
+               ERR("Please check contact_connect()");
        }
-       else
-               CTS_ERR("Please check contact_connect()");
 
        return CTSVC_PERMISSION_CONTACT_NONE;
 }
 
 bool ctsvc_should_ab_access_control(const char *view_uri)
 {
-       db_table_info_s* db_view_info = NULL;
+       db_table_info_s *db_view_info = NULL;
+
        RETV_IF(NULL == view_uri, false);
 
        if (__ctsvc_db_view_hash_table) {
                db_view_info = g_hash_table_lookup(__ctsvc_db_view_hash_table, view_uri);
-               if (db_view_info) {
+               if (db_view_info)
                        return db_view_info->need_ab_access_control;
-               }
+       } else {
+               ERR("Please check contact_connect()");
        }
-       else
-               CTS_ERR("Please check contact_connect()");
 
        return false;
 }
 
-ctsvc_db_plugin_info_sctsvc_db_get_plugin_info(ctsvc_record_type_e type)
+ctsvc_db_plugin_info_s *ctsvc_db_get_plugin_info(ctsvc_record_type_e type)
 {
-       switch((int)type) {
+       switch ((int)type) {
        case CTSVC_RECORD_ADDRESSBOOK:
                return &ctsvc_db_plugin_addressbook;
        case CTSVC_RECORD_GROUP:
@@ -322,588 +318,588 @@ static int __ctsvc_db_create_views()
 
        /* CTSVC_DB_VIEW_CONTACT */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_CONTACT" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_CONTACT" AS "
                        "SELECT * FROM "CTS_TABLE_CONTACTS" WHERE deleted = 0");
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_execs() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_execs() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_MY_PROFILE */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_MY_PROFILE" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_MY_PROFILE" AS "
                        "SELECT * FROM "CTS_TABLE_MY_PROFILES" WHERE deleted = 0");
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_PERSON */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_PERSON" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_PERSON" AS "
                        "SELECT persons.person_id, "
-                                       "display_name, reverse_display_name, "
-                                       "display_name_language, "
-                                       "reverse_display_name_language, "
-                                       "sort_name, reverse_sort_name, "
-                                       "sortkey, reverse_sortkey, "
-                                       "name_contact_id, "
-                                       "persons.ringtone_path, "
-                                       "persons.image_thumbnail_path, "
-                                       "persons.vibration, "
-                                       "persons.message_alert, "
-                                       "status, "
-                                       "link_count, "
-                                       "addressbook_ids, "
-                                       "persons.has_phonenumber, "
-                                       "persons.has_email, "
-                                       "EXISTS(SELECT person_id FROM "CTS_TABLE_FAVORITES" WHERE person_id=persons.person_id) is_favorite, "
-                                       "(SELECT favorite_prio FROM "CTS_TABLE_FAVORITES" WHERE person_id=persons.person_id) favorite_prio "
+                       "display_name, reverse_display_name, "
+                       "display_name_language, "
+                       "reverse_display_name_language, "
+                       "sort_name, reverse_sort_name, "
+                       "sortkey, reverse_sortkey, "
+                       "name_contact_id, "
+                       "persons.ringtone_path, "
+                       "persons.image_thumbnail_path, "
+                       "persons.vibration, "
+                       "persons.message_alert, "
+                       "status, "
+                       "link_count, "
+                       "addressbook_ids, "
+                       "persons.has_phonenumber, "
+                       "persons.has_email, "
+                       "EXISTS(SELECT person_id FROM "CTS_TABLE_FAVORITES" WHERE person_id=persons.person_id) is_favorite, "
+                       "(SELECT favorite_prio FROM "CTS_TABLE_FAVORITES" WHERE person_id=persons.person_id) favorite_prio "
                        "FROM "CTS_TABLE_CONTACTS", "CTS_TABLE_PERSONS" "
                        "ON (name_contact_id = contacts.contact_id) ");
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_NAME */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_NAME" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_NAME" AS "
                        "SELECT id, "
-                               "data.contact_id, "
-                               "addressbook_id, "
-                               "data2, "
-                               "data3, "
-                               "data4, "
-                               "data5, "
-                               "data6, "
-                               "data7, "
-                               "data8, "
-                               "data9 "
+                       "data.contact_id, "
+                       "addressbook_id, "
+                       "data2, "
+                       "data3, "
+                       "data4, "
+                       "data5, "
+                       "data6, "
+                       "data7, "
+                       "data8, "
+                       "data9 "
                        "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
                        "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
                        "WHERE datatype = %d AND is_my_profile = 0 ",
-                               CTSVC_DATA_NAME);
+                       CTSVC_DATA_NAME);
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_NUMBER */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_NUMBER" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_NUMBER" AS "
                        "SELECT id, "
-                                       "data.contact_id, "
-                                       "addressbook_id, "
-                                       "is_default, "
-                                       "data1, "
-                                       "data2, "
-                                       "data3, "
-                                       "data4, "
-                                       "data5, "
-                                       "data6 "
+                       "data.contact_id, "
+                       "addressbook_id, "
+                       "is_default, "
+                       "data1, "
+                       "data2, "
+                       "data3, "
+                       "data4, "
+                       "data5, "
+                       "data6 "
                        "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
                        "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
                        "WHERE datatype = %d AND is_my_profile = 0 ",
-                               CTSVC_DATA_NUMBER);
+                       CTSVC_DATA_NUMBER);
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_EMAIL */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_EMAIL" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_EMAIL" AS "
                        "SELECT id, "
-                                       "data.contact_id, "
-                                       "addressbook_id, "
-                                       "is_default, "
-                                       "data1, "
-                                       "data2, "
-                                       "data3 "
+                       "data.contact_id, "
+                       "addressbook_id, "
+                       "is_default, "
+                       "data1, "
+                       "data2, "
+                       "data3 "
                        "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
                        "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
                        "WHERE datatype = %d AND is_my_profile = 0 ",
-                               CTSVC_DATA_EMAIL);
+                       CTSVC_DATA_EMAIL);
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_ADDRESS */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_ADDRESS" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_ADDRESS" AS "
                        "SELECT id, "
-                                       "data.contact_id, "
-                                       "addressbook_id, "
-                                       "is_default, "
-                                       "data1, "
-                                       "data2, "
-                                       "data3, "
-                                       "data4, "
-                                       "data5, "
-                                       "data6, "
-                                       "data7, "
-                                       "data8, "
-                                       "data9 "
+                       "data.contact_id, "
+                       "addressbook_id, "
+                       "is_default, "
+                       "data1, "
+                       "data2, "
+                       "data3, "
+                       "data4, "
+                       "data5, "
+                       "data6, "
+                       "data7, "
+                       "data8, "
+                       "data9 "
                        "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
                        "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
                        "WHERE datatype = %d AND is_my_profile = 0 ",
-                               CTSVC_DATA_POSTAL);
+                       CTSVC_DATA_POSTAL);
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_URL */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_URL" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_URL" AS "
                        "SELECT id, "
-                                       "data.contact_id, "
-                                       "addressbook_id, "
-                                       "data1, "
-                                       "data2, "
-                                       "data3 "
+                       "data.contact_id, "
+                       "addressbook_id, "
+                       "data1, "
+                       "data2, "
+                       "data3 "
                        "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
                        "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
                        "WHERE datatype = %d AND is_my_profile = 0 ",
-                               CTSVC_DATA_URL);
+                       CTSVC_DATA_URL);
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_EVENT */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_EVENT" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_EVENT" AS "
                        "SELECT id, "
-                                       "data.contact_id, "
-                                       "addressbook_id, "
-                                       "data1, "
-                                       "data2, "
-                                       "data3, "
-                                       "data4, "
-                                       "data5 "
+                       "data.contact_id, "
+                       "addressbook_id, "
+                       "data1, "
+                       "data2, "
+                       "data3, "
+                       "data4, "
+                       "data5 "
                        "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
                        "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
                        "WHERE datatype = %d AND is_my_profile = 0 ",
-                               CTSVC_DATA_EVENT);
+                       CTSVC_DATA_EVENT);
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_GROUP_RELATION */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_GROUP_RELATION" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_GROUP_RELATION" AS "
                        "SELECT "CTS_TABLE_GROUP_RELATIONS".group_id, "
-                                       "contact_id, "
-                                       "addressbook_id, "
-                                       "group_name "
+                       "contact_id, "
+                       "addressbook_id, "
+                       "group_name "
                        "FROM "CTS_TABLE_GROUP_RELATIONS", "CTS_TABLE_GROUPS" "
                        "ON "CTS_TABLE_GROUP_RELATIONS".group_id = "CTS_TABLE_GROUPS".group_id AND deleted = 0 "
                        "ORDER BY group_prio");
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_RELATIONSHIP */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_RELATIONSHIP" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_RELATIONSHIP" AS "
                        "SELECT id, "
-                                       "data.contact_id, "
-                                       "addressbook_id, "
-                                       "data1, "
-                                       "data2, "
-                                       "data3  "
+                       "data.contact_id, "
+                       "addressbook_id, "
+                       "data1, "
+                       "data2, "
+                       "data3  "
                        "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
                        "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
                        "WHERE datatype = %d AND is_my_profile = 0 ",
-                               CTSVC_DATA_RELATIONSHIP);
+                       CTSVC_DATA_RELATIONSHIP);
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_IMAGE */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_IMAGE" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_IMAGE" AS "
                        "SELECT id, "
-                                       "is_default, "
-                                       "data.contact_id, "
-                                       "addressbook_id, "
-                                       "data1, "
-                                       "data2, "
-                                       "data3 "
+                       "is_default, "
+                       "data.contact_id, "
+                       "addressbook_id, "
+                       "data1, "
+                       "data2, "
+                       "data3 "
                        "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
                        "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
                        "WHERE datatype = %d AND is_my_profile = 0 ",
-                               CTSVC_DATA_IMAGE);
+                       CTSVC_DATA_IMAGE);
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_COMPANY */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_COMPANY" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_COMPANY" AS "
                        "SELECT id, "
-                                       "data.contact_id, "
-                                       "addressbook_id, "
-                                       "data1, "
-                                       "data2, "
-                                       "data3, "
-                                       "data4, "
-                                       "data5, "
-                                       "data6, "
-                                       "data7, "
-                                       "data8, "
-                                       "data9, "
-                                       "data10, "
-                                       "data11 "
+                       "data.contact_id, "
+                       "addressbook_id, "
+                       "data1, "
+                       "data2, "
+                       "data3, "
+                       "data4, "
+                       "data5, "
+                       "data6, "
+                       "data7, "
+                       "data8, "
+                       "data9, "
+                       "data10, "
+                       "data11 "
                        "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
                        "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
                        "WHERE datatype = %d AND is_my_profile = 0 ",
-                               CTSVC_DATA_COMPANY);
+                       CTSVC_DATA_COMPANY);
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_NICKNAME */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_NICKNAME" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_NICKNAME" AS "
                        "SELECT id, "
-                                       "data.contact_id, "
-                                       "addressbook_id, "
-                                       "data3 "
+                       "data.contact_id, "
+                       "addressbook_id, "
+                       "data3 "
                        "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
                        "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
                        "WHERE datatype = %d AND is_my_profile = 0 ",
-                               CTSVC_DATA_NICKNAME);
+                       CTSVC_DATA_NICKNAME);
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_MESSENGER */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_MESSENGER" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_MESSENGER" AS "
                        "SELECT id, "
-                                       "data.contact_id, "
-                                       "addressbook_id, "
-                                       "data1, "
-                                       "data2, "
-                                       "data3 "
+                       "data.contact_id, "
+                       "addressbook_id, "
+                       "data1, "
+                       "data2, "
+                       "data3 "
                        "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
                        "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
                        "WHERE datatype = %d AND is_my_profile = 0 ",
-                               CTSVC_DATA_MESSENGER);
+                       CTSVC_DATA_MESSENGER);
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_NOTE */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_NOTE" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_NOTE" AS "
                        "SELECT id, "
-                                       "data.contact_id, "
-                                       "addressbook_id, "
-                                       "data3 "
+                       "data.contact_id, "
+                       "addressbook_id, "
+                       "data3 "
                        "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
                        "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
                        "WHERE datatype = %d AND is_my_profile = 0 ",
-                               CTSVC_DATA_NOTE);
+                       CTSVC_DATA_NOTE);
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_PROFILE */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_PROFILE" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_PROFILE" AS "
                        "SELECT id, "
-                                       "data.contact_id, "
-                                       "addressbook_id, "
-                                       "data1, "
-                                       "data2, "
-                                       "data3, "
-                                       "data4, "
-                                       "data5, "
-                                       "data6, "
-                                       "data7, "
-                                       "data8, "
-                                       "data9, "
-                                       "data10, "
-                                       "data11 "
+                       "data.contact_id, "
+                       "addressbook_id, "
+                       "data1, "
+                       "data2, "
+                       "data3, "
+                       "data4, "
+                       "data5, "
+                       "data6, "
+                       "data7, "
+                       "data8, "
+                       "data9, "
+                       "data10, "
+                       "data11 "
                        "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
                        "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
                        "WHERE datatype = %d AND is_my_profile = 0 ",
-                               CTSVC_DATA_PROFILE);
+                       CTSVC_DATA_PROFILE);
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_EXTENSION */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_EXTENSION" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_EXTENSION" AS "
                        "SELECT id, "
-                                       "data.contact_id, "
-                                       "addressbook_id, "
-                                       "data1, "
-                                       "data2, "
-                                       "data3, "
-                                       "data4, "
-                                       "data5, "
-                                       "data6, "
-                                       "data7, "
-                                       "data8, "
-                                       "data9, "
-                                       "data10, "
-                                       "data11, "
-                                       "data12 "
+                       "data.contact_id, "
+                       "addressbook_id, "
+                       "data1, "
+                       "data2, "
+                       "data3, "
+                       "data4, "
+                       "data5, "
+                       "data6, "
+                       "data7, "
+                       "data8, "
+                       "data9, "
+                       "data10, "
+                       "data11, "
+                       "data12 "
                        "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
                        "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
                        "WHERE datatype = %d AND is_my_profile = 0 ",
-                               CTSVC_DATA_EXTENSION);
+                       CTSVC_DATA_EXTENSION);
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_ACTIVITY */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_ACTIVITY" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_ACTIVITY" AS "
                        "SELECT id, "
-                                       "activities.contact_id, "
-                                       "addressbook_id, "
-                                       "source_name, "
-                                       "status, "
-                                       "timestamp, "
-                                       "service_operation, "
-                                       "uri "
+                       "activities.contact_id, "
+                       "addressbook_id, "
+                       "source_name, "
+                       "status, "
+                       "timestamp, "
+                       "service_operation, "
+                       "uri "
                        "FROM "CTS_TABLE_ACTIVITIES", "CTSVC_DB_VIEW_CONTACT" "
                        "ON "CTS_TABLE_ACTIVITIES".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
                        "ORDER BY timestamp DESC");
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_ACTIVITY_PHOTOS */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_ACTIVITY_PHOTOS" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_ACTIVITY_PHOTOS" AS "
                        "SELECT "CTS_TABLE_ACTIVITY_PHOTOS".id, "
-                                       "activity_id, "
-                                       "photo_url, "
-                                       "sort_index "
+                       "activity_id, "
+                       "photo_url, "
+                       "sort_index "
                        "FROM "CTS_TABLE_ACTIVITY_PHOTOS", "CTSVC_DB_VIEW_ACTIVITY" "
                        "ON "CTS_TABLE_ACTIVITY_PHOTOS".activity_id = "CTSVC_DB_VIEW_ACTIVITY".id");
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_SPEEDIDAL */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_SPEEDIDAL" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_SPEEDIDAL" AS "
                        "SELECT persons.person_id, "
-                                       "name_contacts.display_name, name_contacts.reverse_display_name, "
-                                       "name_contacts.display_name_language, "
-                                       "name_contacts.reverse_display_name_language, "
-                                       "name_contacts.sort_name, name_contacts.reverse_sort_name, "
-                                       "name_contacts.sortkey, name_contacts.reverse_sortkey, "
-                                       "persons.image_thumbnail_path, "
-                                       "data.id number_id, "
-                                       "data.data1 type, "
-                                       "data.data2 label, "
-                                       "data.data3 number, "
-                                       "data.data4 minmatch, "
-                                       "data.data5 normalized_number, "
-                                       "data.data6 cleaned_number, "
-                                       "speeddials.speed_number  "
+                       "name_contacts.display_name, name_contacts.reverse_display_name, "
+                       "name_contacts.display_name_language, "
+                       "name_contacts.reverse_display_name_language, "
+                       "name_contacts.sort_name, name_contacts.reverse_sort_name, "
+                       "name_contacts.sortkey, name_contacts.reverse_sortkey, "
+                       "persons.image_thumbnail_path, "
+                       "data.id number_id, "
+                       "data.data1 type, "
+                       "data.data2 label, "
+                       "data.data3 number, "
+                       "data.data4 minmatch, "
+                       "data.data5 normalized_number, "
+                       "data.data6 cleaned_number, "
+                       "speeddials.speed_number  "
                        "FROM "CTS_TABLE_PERSONS", "CTS_TABLE_CONTACTS" AS name_contacts, "
-                                       CTSVC_DB_VIEW_CONTACT" AS temp_contacts, "
-                                       CTS_TABLE_DATA", "CTS_TABLE_SPEEDDIALS" "
+                       CTSVC_DB_VIEW_CONTACT" AS temp_contacts, "
+                       CTS_TABLE_DATA", "CTS_TABLE_SPEEDDIALS" "
                        "ON (persons.name_contact_id = name_contacts.contact_id "
-                               "AND persons.person_id = temp_contacts.person_id "
-                               "AND temp_contacts.contact_id = data.contact_id "
-                               "AND data.id = speeddials.number_id) "
+                       "AND persons.person_id = temp_contacts.person_id "
+                       "AND temp_contacts.contact_id = data.contact_id "
+                       "AND data.id = speeddials.number_id) "
                        "ORDER BY speeddials.speed_number");
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_PERSON_CONTACT */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_PERSON_CONTACT" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_PERSON_CONTACT" AS "
                        "SELECT * FROM "CTSVC_DB_VIEW_PERSON" "
                        "JOIN (SELECT contact_id, "
-                                               "addressbook_id, "
-                                               "person_id person_id_in_contact "
-                                       "FROM "CTSVC_DB_VIEW_CONTACT") temp_contacts "
+                       "addressbook_id, "
+                       "person_id person_id_in_contact "
+                       "FROM "CTSVC_DB_VIEW_CONTACT") temp_contacts "
                        "JOIN (SELECT addressbook_id addressbook_id_in_addressbooks, addressbook_name, mode addressbook_mode "
-                                       "FROM "CTS_TABLE_ADDRESSBOOKS") temp_addressbooks "
+                       "FROM "CTS_TABLE_ADDRESSBOOKS") temp_addressbooks "
                        "ON temp_contacts.person_id_in_contact = "CTSVC_DB_VIEW_PERSON".person_id "
-                               "AND addressbook_id = temp_addressbooks.addressbook_id_in_addressbooks");
+                       "AND addressbook_id = temp_addressbooks.addressbook_id_in_addressbooks");
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_PERSON_NUMBER */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_PERSON_NUMBER" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_PERSON_NUMBER" AS "
                        "SELECT * FROM "CTSVC_DB_VIEW_PERSON_CONTACT" "
                        "JOIN (SELECT id number_id, "
-                                                               "contact_id, "
-                                                               "data1 type, "
-                                                               "is_primary_default, "
-                                                               "data2 label, "
-                                                               "data3 number, "
-                                                               "data4 minmatch, "
-                                                               "data5 normalized_number, "
-                                                               "data6 cleaned_number "
-                                       "FROM "CTS_TABLE_DATA" WHERE datatype = %d AND is_my_profile = 0) temp_data "
+                       "contact_id, "
+                       "data1 type, "
+                       "is_primary_default, "
+                       "data2 label, "
+                       "data3 number, "
+                       "data4 minmatch, "
+                       "data5 normalized_number, "
+                       "data6 cleaned_number "
+                       "FROM "CTS_TABLE_DATA" WHERE datatype = %d AND is_my_profile = 0) temp_data "
                        "ON temp_data.contact_id = "CTSVC_DB_VIEW_PERSON_CONTACT".contact_id",
-                               CTSVC_DATA_NUMBER);
+                       CTSVC_DATA_NUMBER);
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_PERSON_EMAIL */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_PERSON_EMAIL" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_PERSON_EMAIL" AS "
                        "SELECT * FROM "CTSVC_DB_VIEW_PERSON_CONTACT" "
                        "JOIN (SELECT id email_id, "
-                                                               "contact_id, "
-                                                               "data1 type, "
-                                                               "is_primary_default, "
-                                                               "data2 label, "
-                                                               "data3 email "
-                                       "FROM "CTS_TABLE_DATA" WHERE datatype = %d AND is_my_profile = 0) temp_data "
+                       "contact_id, "
+                       "data1 type, "
+                       "is_primary_default, "
+                       "data2 label, "
+                       "data3 email "
+                       "FROM "CTS_TABLE_DATA" WHERE datatype = %d AND is_my_profile = 0) temp_data "
                        "ON temp_data.contact_id = "CTSVC_DB_VIEW_PERSON_CONTACT".contact_id",
-                               CTSVC_DATA_EMAIL);
+                       CTSVC_DATA_EMAIL);
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
 #ifdef ENABLE_LOG_FEATURE
        /* CTSVC_DB_VIEW_PERSON_PHONELOG */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_PERSON_PHONELOG" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_PERSON_PHONELOG" AS "
                        "SELECT L.id phonelog_id, "
-                                       "C.display_name, "
-                                       "C.reverse_display_name, "
-                                       "C.display_name_language, "
-                                       "C.reverse_display_name_language, "
-                                       "C.sort_name, C.reverse_sort_name, "
-                                       "C.sortkey, C.reverse_sortkey, "
-                                       "P.image_thumbnail_path, "
-                                       "L.number address, "
-                                       "L.normal_num, "
-                                       "L.minmatch, "
-                                       "L.clean_num, "
-                                       "L.log_type, "
-                                       "L.log_time, "
-                                       "L.data1, "
-                                       "L.data2, "
-                                       "L.sim_id, "
-                                       "L.person_id id, "
-                                       "L.number_type address_type "
+                       "C.display_name, "
+                       "C.reverse_display_name, "
+                       "C.display_name_language, "
+                       "C.reverse_display_name_language, "
+                       "C.sort_name, C.reverse_sort_name, "
+                       "C.sortkey, C.reverse_sortkey, "
+                       "P.image_thumbnail_path, "
+                       "L.number address, "
+                       "L.normal_num, "
+                       "L.minmatch, "
+                       "L.clean_num, "
+                       "L.log_type, "
+                       "L.log_time, "
+                       "L.data1, "
+                       "L.data2, "
+                       "L.sim_id, "
+                       "L.person_id id, "
+                       "L.number_type address_type "
                        "FROM "CTS_TABLE_PHONELOGS" L "
-                                       "LEFT JOIN "CTS_TABLE_PERSONS" P "
-                                               "ON P.person_id = L.person_id "
-                                       "LEFT JOIN "CTS_TABLE_CONTACTS" C "
-                                               "ON P.name_contact_id = C.contact_id AND C.deleted = 0 "
+                       "LEFT JOIN "CTS_TABLE_PERSONS" P "
+                       "ON P.person_id = L.person_id "
+                       "LEFT JOIN "CTS_TABLE_CONTACTS" C "
+                       "ON P.name_contact_id = C.contact_id AND C.deleted = 0 "
                        "ORDER BY L.log_time DESC");
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 #endif /* ENABLE_LOG_FEATURE */
 
        /* CTSVC_DB_VIEW_PERSON_USAGE */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_PERSON_USAGE" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_PERSON_USAGE" AS "
                        "SELECT * FROM "CTSVC_DB_VIEW_PERSON" "
                        "LEFT JOIN (SELECT usage_type, "
-                                                       "person_id, "
-                                                       "times_used "
-                                       "FROM "CTS_TABLE_CONTACT_STAT") usage "
+                       "person_id, "
+                       "times_used "
+                       "FROM "CTS_TABLE_CONTACT_STAT") usage "
                        "ON usage.person_id = "CTSVC_DB_VIEW_PERSON".person_id "
                        "ORDER BY usage.times_used");
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_PERSON_GROUP */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_PERSON_GROUP" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_PERSON_GROUP" AS "
                        "SELECT view_person_contact.*, groups.group_id, group_prio "
-                               "FROM "CTSVC_DB_VIEW_PERSON_CONTACT" "
-                                       "LEFT JOIN "CTS_TABLE_GROUP_RELATIONS" "
-                                               "ON "CTS_TABLE_GROUP_RELATIONS".deleted = 0 AND "
-                                                       CTS_TABLE_GROUP_RELATIONS".contact_id = "CTSVC_DB_VIEW_PERSON_CONTACT".contact_id "
-                                       "LEFT JOIN "CTS_TABLE_GROUPS" "
-                                               "ON "CTS_TABLE_GROUP_RELATIONS".group_id = "CTS_TABLE_GROUPS".group_id "
-                                       "ORDER BY group_prio");
+                       "FROM "CTSVC_DB_VIEW_PERSON_CONTACT" "
+                       "LEFT JOIN "CTS_TABLE_GROUP_RELATIONS" "
+                       "ON "CTS_TABLE_GROUP_RELATIONS".deleted = 0 AND "
+                       CTS_TABLE_GROUP_RELATIONS".contact_id = "CTSVC_DB_VIEW_PERSON_CONTACT".contact_id "
+                       "LEFT JOIN "CTS_TABLE_GROUPS" "
+                       "ON "CTS_TABLE_GROUP_RELATIONS".group_id = "CTS_TABLE_GROUPS".group_id "
+                       "ORDER BY group_prio");
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_PERSON_GROUP_NOT_ASSIGNED */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_PERSON_GROUP_NOT_ASSIGNED" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_PERSON_GROUP_NOT_ASSIGNED" AS "
                        "SELECT * FROM "CTSVC_DB_VIEW_PERSON_CONTACT" "
                        "WHERE contact_id NOT IN (select contact_id FROM "CTS_TABLE_GROUP_RELATIONS" WHERE deleted = 0)");
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_PERSON_GROUP_ASSIGNED */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_PERSON_GROUP_ASSIGNED" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_PERSON_GROUP_ASSIGNED" AS "
                        "SELECT "CTSVC_DB_VIEW_PERSON_CONTACT".*, groups.group_id, group_prio "
-                               "FROM "CTSVC_DB_VIEW_PERSON_CONTACT", "
-                                       CTS_TABLE_GROUP_RELATIONS", "CTS_TABLE_GROUPS" "
-                               "ON "
+                       "FROM "CTSVC_DB_VIEW_PERSON_CONTACT", "
+                       CTS_TABLE_GROUP_RELATIONS", "CTS_TABLE_GROUPS" "
+                       "ON "
                        CTS_TABLE_GROUP_RELATIONS".contact_id = "CTSVC_DB_VIEW_PERSON_CONTACT".contact_id AND "
                        CTS_TABLE_GROUP_RELATIONS".group_id = "CTS_TABLE_GROUPS".group_id AND "
                        CTS_TABLE_GROUP_RELATIONS".deleted = 0 "
                        "ORDER BY group_prio");
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_CONTACT_NUMBER */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_CONTACT_NUMBER" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_CONTACT_NUMBER" AS "
                        "SELECT * FROM "CTSVC_DB_VIEW_CONTACT" "
                        "JOIN (SELECT id number_id, "
-                                                               "contact_id, "
-                                                               "data1 type, "
-                                                               "is_default, "
-                                                               "data2 label, "
-                                                               "data3 number, "
-                                                               "data4 minmatch, "
-                                                               "data5 normalized_number, "
-                                                               "data6 cleaned_number "
-                                       "FROM "CTS_TABLE_DATA" WHERE datatype = %d AND is_my_profile = 0) temp_data "
+                       "contact_id, "
+                       "data1 type, "
+                       "is_default, "
+                       "data2 label, "
+                       "data3 number, "
+                       "data4 minmatch, "
+                       "data5 normalized_number, "
+                       "data6 cleaned_number "
+                       "FROM "CTS_TABLE_DATA" WHERE datatype = %d AND is_my_profile = 0) temp_data "
                        "ON temp_data.contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id",
-                               CTSVC_DATA_NUMBER);
+                       CTSVC_DATA_NUMBER);
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_CONTACT_EMAIL */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_CONTACT_EMAIL" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_CONTACT_EMAIL" AS "
                        "SELECT * FROM "CTSVC_DB_VIEW_CONTACT" "
                        "JOIN (SELECT id email_id, "
-                                                               "contact_id, "
-                                                               "data1 type, "
-                                                               "is_default, "
-                                                               "data2 label, "
-                                                               "data3 email "
-                                       "FROM "CTS_TABLE_DATA" WHERE datatype = %d AND is_my_profile = 0) temp_data "
+                       "contact_id, "
+                       "data1 type, "
+                       "is_default, "
+                       "data2 label, "
+                       "data3 email "
+                       "FROM "CTS_TABLE_DATA" WHERE datatype = %d AND is_my_profile = 0) temp_data "
                        "ON temp_data.contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id",
-                               CTSVC_DATA_EMAIL);
+                       CTSVC_DATA_EMAIL);
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_CONTACT_GROUP */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_CONTACT_GROUP" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_CONTACT_GROUP" AS "
                        "SELECT C.*, groups.group_id, group_name "
-                               "FROM "CTSVC_DB_VIEW_CONTACT" C "
-                               "LEFT JOIN "CTS_TABLE_GROUP_RELATIONS" "
-                                       "ON "CTS_TABLE_GROUP_RELATIONS".deleted = 0 AND "
-                                                       CTS_TABLE_GROUP_RELATIONS".contact_id = C.contact_id "
-                               "LEFT JOIN "CTS_TABLE_GROUPS" "
-                                       "ON "CTS_TABLE_GROUP_RELATIONS".group_id = "CTS_TABLE_GROUPS".group_id");
+                       "FROM "CTSVC_DB_VIEW_CONTACT" C "
+                       "LEFT JOIN "CTS_TABLE_GROUP_RELATIONS" "
+                       "ON "CTS_TABLE_GROUP_RELATIONS".deleted = 0 AND "
+                       CTS_TABLE_GROUP_RELATIONS".contact_id = C.contact_id "
+                       "LEFT JOIN "CTS_TABLE_GROUPS" "
+                       "ON "CTS_TABLE_GROUP_RELATIONS".group_id = "CTS_TABLE_GROUPS".group_id");
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        /* CTSVC_DB_VIEW_CONTACT_ACTIVITY */
        snprintf(query, sizeof(query),
-               "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_CONTACT_ACTIVITY" AS "
+                       "CREATE VIEW IF NOT EXISTS "CTSVC_DB_VIEW_CONTACT_ACTIVITY" AS "
                        "SELECT A.contact_id, "
-                                       "A.display_name, "
-                                       "A.display_name_source, "
-                                       "A.reverse_display_name, "
-                                       "A.display_name_language, "
-                                       "A.reverse_display_name_language, "
-                                       "A.sort_name, A.reverse_sort_name, "
-                                       "A.sortkey, A.reverse_sortkey, "
-                                       "A.addressbook_id, "
-                                       "AB.account_id, "
-                                       "A.person_id, "
-                                       "A.ringtone_path, "
-                                       "A.image_thumbnail_path, "
-                                       "AC.id activity_id, "
-                                       "AC.source_name, "
-                                       "AC.status, "
-                                       "AC.timestamp, "
-                                       "AC.service_operation, "
-                                       "AC.uri "
-                                       "FROM "CTSVC_DB_VIEW_CONTACT" A, "CTS_TABLE_ACTIVITIES" AC, "CTS_TABLE_ADDRESSBOOKS" AB "
+                       "A.display_name, "
+                       "A.display_name_source, "
+                       "A.reverse_display_name, "
+                       "A.display_name_language, "
+                       "A.reverse_display_name_language, "
+                       "A.sort_name, A.reverse_sort_name, "
+                       "A.sortkey, A.reverse_sortkey, "
+                       "A.addressbook_id, "
+                       "AB.account_id, "
+                       "A.person_id, "
+                       "A.ringtone_path, "
+                       "A.image_thumbnail_path, "
+                       "AC.id activity_id, "
+                       "AC.source_name, "
+                       "AC.status, "
+                       "AC.timestamp, "
+                       "AC.service_operation, "
+                       "AC.uri "
+                       "FROM "CTSVC_DB_VIEW_CONTACT" A, "CTS_TABLE_ACTIVITIES" AC, "CTS_TABLE_ADDRESSBOOKS" AB "
                        "ON A.contact_id = AC.contact_id "
                        "AND A.addressbook_id = AB.addressbook_id "
                        "ORDER BY timestamp DESC");
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        __ctsvc_db_view_already_created = true;
 
@@ -917,14 +913,14 @@ int ctsvc_db_init()
        int ret = CONTACTS_ERROR_NONE;
        ret = ctsvc_db_open();
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_db_open() Fail(%d)", ret);
+               ERR("ctsvc_db_open() Fail(%d)", ret);
                return ret;
        }
 
 #ifdef _CONTACTS_IPC_SERVER
        ret = __ctsvc_db_create_views();
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("__ctsvc_db_create_views() Fail(%d)", ret);
+               ERR("__ctsvc_db_create_views() Fail(%d)", ret);
                return ret;
        }
 #endif
@@ -937,7 +933,7 @@ int ctsvc_db_deinit()
        int ret = CONTACTS_ERROR_NONE;
        ret = ctsvc_db_close();
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_db_close() Fail(%d)", ret);
+               ERR("ctsvc_db_close() Fail(%d)", ret);
                return ret;
        }
 
index def09b1..7ac999e 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
@@ -28,7 +24,7 @@
 #include "ctsvc_struct.h"
 
 typedef int (*ctsvc_db_insert_record_cb)(contacts_record_h record, int *id);
-typedef int (*ctsvc_db_get_record_cb)(int id, contacts_record_hout_record);
+typedef int (*ctsvc_db_get_record_cb)(int id, contacts_record_h *out_record);
 typedef int (*ctsvc_db_update_record_cb)(contacts_record_h record);
 typedef int (*ctsvc_db_delete_record_cb)(int id);
 typedef int (*ctsvc_db_replace_record_cb)(contacts_record_h record, int id);
@@ -36,10 +32,12 @@ typedef int (*ctsvc_db_replace_record_cb)(contacts_record_h record, int id);
 typedef int (*ctsvc_db_insert_records_cb)(const contacts_list_h in_list, int **ids);
 typedef int (*ctsvc_db_update_records_cb)(const contacts_list_h in_list);
 typedef int (*ctsvc_db_delete_records_cb)(int ids[], int count);
-typedef int (*ctsvc_db_replace_records_cb)(const contacts_list_h in_list, int ids[], int count);
+typedef int (*ctsvc_db_replace_records_cb)(const contacts_list_h in_list, int ids[],
+               int count);
 
-typedef int (*ctsvc_db_get_all_records_cb)(int offset, int limit, contacts_list_h* out_list);
-typedef int (*ctsvc_db_get_records_with_query_cb)(contacts_query_h query, int offset, int limit, contacts_list_h* out_list);
+typedef int (*ctsvc_db_get_all_records_cb)(int offset, int limit, contacts_list_h *out_list);
+typedef int (*ctsvc_db_get_records_with_query_cb)(contacts_query_h query, int offset,
+               int limit, contacts_list_h *out_list);
 typedef int (*ctsvc_db_get_count_cb)(int *out_count);
 typedef int (*ctsvc_db_get_count_with_query_cb)(contacts_query_h query, int *out_count);
 
index 0c7d528..5a46b6a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_db_schema.h"
 #include "ctsvc_notification.h"
 #include "ctsvc_db_access_control.h"
 
-static int __ctsvc_db_activity_insert_record(contacts_record_h record, int *id);
-static int __ctsvc_db_activity_get_record(int id, contacts_record_h* out_record);
-static int __ctsvc_db_activity_update_record(contacts_record_h record);
-static int __ctsvc_db_activity_delete_record(int id);
-static int __ctsvc_db_activity_get_all_records(int offset, int limit, contacts_list_h* out_list);
-static int __ctsvc_db_activity_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h* out_list);
-
-ctsvc_db_plugin_info_s ctsvc_db_plugin_activity = {
-       .is_query_only = false,
-       .insert_record = __ctsvc_db_activity_insert_record,
-       .get_record = __ctsvc_db_activity_get_record,
-       .update_record = __ctsvc_db_activity_update_record,
-       .delete_record = __ctsvc_db_activity_delete_record,
-       .get_all_records = __ctsvc_db_activity_get_all_records,
-       .get_records_with_query = __ctsvc_db_activity_get_records_with_query,
-       .insert_records = NULL,
-       .update_records = NULL,
-       .delete_records = NULL,
-       .get_count = NULL,
-       .get_count_with_query = NULL,
-       .replace_record = NULL,
-       .replace_records = NULL,
-};
 
 static int __ctsvc_db_activity_insert_record(contacts_record_h record, int *id)
 {
@@ -63,31 +39,30 @@ static int __ctsvc_db_activity_insert_record(contacts_record_h record, int *id)
        cts_stmt stmt = NULL;
        int count = 0;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_activity_s *activity = (ctsvc_activity_s *)record;
+       ctsvc_activity_s *activity = (ctsvc_activity_s*)record;
 
        RETV_IF(NULL == activity, CONTACTS_ERROR_INVALID_PARAMETER);
        RETVM_IF(activity->id, CONTACTS_ERROR_INVALID_PARAMETER,
-               "The activity has ID(%d)", activity->id);
+                       "The activity has ID(%d)", activity->id);
 
        RETVM_IF(activity->contact_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
-               "The contact_id(%d) does not exist", activity->contact_id);
+                       "The contact_id(%d) does not exist", activity->contact_id);
 
        ret = ctsvc_begin_trans();
        RETVM_IF(ret, ret, "contacts_svc_begin_trans() Fail(%d)", ret);
 
        snprintf(query, sizeof(query),
                        "SELECT addressbook_id from %s WHERE contact_id = %d",
-                               CTSVC_DB_VIEW_CONTACT, activity->contact_id);
+                       CTSVC_DB_VIEW_CONTACT, activity->contact_id);
 
        ret = ctsvc_query_get_first_int_result(query, &addressbook_id);
        if (CONTACTS_ERROR_NONE != ret) {
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NO_DATA == ret) {
-                       CTS_ERR("No data : contact id (%d)", activity->contact_id);
+                       ERR("No data : contact id (%d)", activity->contact_id);
                        return CONTACTS_ERROR_INVALID_PARAMETER;
-               }
-               else {
-                       CTS_ERR("ctsvc_query_get_first_int_result Fail(%d)", ret);
+               } else {
+                       ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -95,9 +70,9 @@ static int __ctsvc_db_activity_insert_record(contacts_record_h record, int *id)
        ret = ctsvc_is_owner(addressbook_id);
        if (CONTACTS_ERROR_NONE != ret) {
                if (CONTACTS_ERROR_PERMISSION_DENIED == ret)
-                       CTS_ERR("Does not have permission of address_book (%d)", addressbook_id);
+                       ERR("Does not have permission of address_book (%d)", addressbook_id);
                else
-                       CTS_ERR("ctsvc_is_owner Fail(%d)", ret);
+                       ERR("ctsvc_is_owner() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -110,7 +85,7 @@ static int __ctsvc_db_activity_insert_record(contacts_record_h record, int *id)
 
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare() Failed9(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -126,7 +101,7 @@ static int __ctsvc_db_activity_insert_record(contacts_record_h record, int *id)
 
        ret = ctsvc_stmt_step(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                return ret;
@@ -148,7 +123,7 @@ static int __ctsvc_db_activity_insert_record(contacts_record_h record, int *id)
                                photo = (ctsvc_activity_photo_s*)record;
                                ret = ctsvc_db_activity_photo_insert((contacts_record_h)photo, activity_id, NULL);
                                if (CONTACTS_ERROR_DB == ret) {
-                                       CTS_ERR("DB error : return (%d)", ret);
+                                       ERR("return (%d)", ret);
                                        break;
                                }
                        } while (CONTACTS_ERROR_NONE == contacts_list_next((contacts_list_h)activity->photos));
@@ -193,7 +168,7 @@ static int __ctsvc_db_activity_value_set(cts_stmt stmt, contacts_record_h *recor
 }
 
 
-static int __ctsvc_db_activity_get_record(int id, contacts_record_hout_record)
+static int __ctsvc_db_activity_get_record(int id, contacts_record_h *out_record)
 {
        char query[CTS_SQL_MAX_LEN] = {0};
        int ret;
@@ -201,15 +176,15 @@ static int __ctsvc_db_activity_get_record(int id, contacts_record_h* out_record)
        contacts_record_h record;
 
        snprintf(query, sizeof(query), "SELECT id, contact_id, source_name, status, "
-                                       "timestamp, service_operation, uri "
-                                       "FROM "CTSVC_DB_VIEW_ACTIVITY" WHERE id = %d", id);
+                       "timestamp, service_operation, uri "
+                       "FROM "CTSVC_DB_VIEW_ACTIVITY" WHERE id = %d", id);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/ != ret) {
-               CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
@@ -229,7 +204,7 @@ static int __ctsvc_db_activity_get_record(int id, contacts_record_h* out_record)
 
 static int __ctsvc_db_activity_update_record(contacts_record_h record)
 {
-       CTS_ERR("Invalid operation : activity can not update, only insert/delete");
+       ERR("Invalid operation : activity can not update, only insert/delete");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
@@ -244,10 +219,10 @@ static int __ctsvc_db_activity_delete_record(int id)
 
        snprintf(query, sizeof(query),
                        "SELECT addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" "
-                               "WHERE contact_id = (SELECT contact_id FROM "CTSVC_DB_VIEW_ACTIVITY" WHERE id = %d)", id);
+                       "WHERE contact_id = (SELECT contact_id FROM "CTSVC_DB_VIEW_ACTIVITY" WHERE id = %d)", id);
        ret = ctsvc_query_get_first_int_result(query, &addressbook_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("No data : id (%d)", id);
+               ERR("No data : id (%d)", id);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -255,9 +230,9 @@ static int __ctsvc_db_activity_delete_record(int id)
        ret = ctsvc_is_owner(addressbook_id);
        if (CONTACTS_ERROR_NONE != ret) {
                if (CONTACTS_ERROR_PERMISSION_DENIED == ret)
-                       CTS_ERR("Does not have permission of address_book (%d)", addressbook_id);
+                       ERR("Does not have permission of address_book (%d)", addressbook_id);
                else
-                       CTS_ERR("ctsvc_is_owner Fail(%d)", ret);
+                       ERR("ctsvc_is_owner Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -266,7 +241,7 @@ static int __ctsvc_db_activity_delete_record(int id)
                        "DELETE FROM "CTS_TABLE_ACTIVITIES" WHERE id = %d", id);
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -282,7 +257,7 @@ static int __ctsvc_db_activity_delete_record(int id)
 }
 
 static int __ctsvc_db_activity_get_all_records(int offset, int limit,
-       contacts_list_h* out_list)
+               contacts_list_h *out_list)
 {
        int ret;
        int len;
@@ -301,13 +276,13 @@ static int __ctsvc_db_activity_get_all_records(int offset, int limit,
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -315,7 +290,7 @@ static int __ctsvc_db_activity_get_all_records(int offset, int limit,
                activity_id = ctsvc_stmt_get_int(stmt, 0);
                ret = ctsvc_db_get_record(_contacts_activity._uri, activity_id, &record);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("DB error : contacts_db_get_record() Fail(%d)", ret);
+                       ERR("contacts_db_get_record() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -329,7 +304,7 @@ static int __ctsvc_db_activity_get_all_records(int offset, int limit,
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_activity_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_hout_list)
+static int __ctsvc_db_activity_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h *out_list)
 {
        int ret;
        int i;
@@ -342,17 +317,16 @@ static int __ctsvc_db_activity_get_records_with_query(contacts_query_h query, in
        bool had_activity_id = false;
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        if (s_query->projection) {
-               for (i=0;i<s_query->projection_count;i++) {
+               for (i = 0; i < s_query->projection_count; i++) {
                        if (s_query->projection[i] == CTSVC_PROPERTY_ACTIVITY_ID) {
                                had_activity_id = true;
                                break;
                        }
                }
-       }
-       else {
+       } else {
                s_query->projection_count = 0;
                had_activity_id = true;
        }
@@ -360,7 +334,7 @@ static int __ctsvc_db_activity_get_records_with_query(contacts_query_h query, in
        if (false == had_activity_id) {
                s_query->projection = realloc(s_query->projection, s_query->projection_count+1);
                if (NULL == s_query->projection) {
-                       CTS_ERR("realloc() Fail");
+                       ERR("realloc() Fail");
                        return CONTACTS_ERROR_OUT_OF_MEMORY;
                }
                s_query->projection[s_query->projection_count] = CTSVC_PROPERTY_ACTIVITY_ID;
@@ -374,7 +348,7 @@ static int __ctsvc_db_activity_get_records_with_query(contacts_query_h query, in
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 /*CTS_TRUE */ != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -382,18 +356,18 @@ static int __ctsvc_db_activity_get_records_with_query(contacts_query_h query, in
 
                contacts_record_create(_contacts_activity._uri, &record);
                activity = (ctsvc_activity_s*)record;
-               if (0 == s_query->projection_count)
+               if (0 == s_query->projection_count) {
                        field_count = s_query->property_count;
-               else {
+               else {
                        field_count = s_query->projection_count;
                        ret = ctsvc_record_set_projection_flags(record, s_query->projection,
                                        s_query->projection_count, s_query->property_count);
 
                        if (CONTACTS_ERROR_NONE != ret)
-                               ASSERT_NOT_REACHED("To set projection is Fail.\n");
+                               ASSERT_NOT_REACHED("To set projection is Fail\n");
                }
 
-               for (i=0;i<field_count;i++) {
+               for (i = 0; i < field_count; i++) {
                        char *temp;
                        int property_id;
                        if (0 == s_query->projection_count)
@@ -402,7 +376,7 @@ static int __ctsvc_db_activity_get_records_with_query(contacts_query_h query, in
                                property_id = s_query->projection[i];
 
 
-                       switch(property_id) {
+                       switch (property_id) {
                        case CTSVC_PROPERTY_ACTIVITY_ID:
                                activity_id = ctsvc_stmt_get_int(stmt, i);
                                if (had_activity_id)
@@ -448,3 +422,21 @@ static int __ctsvc_db_activity_get_records_with_query(contacts_query_h query, in
        *out_list = list;
        return CONTACTS_ERROR_NONE;
 }
+
+ctsvc_db_plugin_info_s ctsvc_db_plugin_activity = {
+       .is_query_only = false,
+       .insert_record = __ctsvc_db_activity_insert_record,
+       .get_record = __ctsvc_db_activity_get_record,
+       .update_record = __ctsvc_db_activity_update_record,
+       .delete_record = __ctsvc_db_activity_delete_record,
+       .get_all_records = __ctsvc_db_activity_get_all_records,
+       .get_records_with_query = __ctsvc_db_activity_get_records_with_query,
+       .insert_records = NULL,
+       .update_records = NULL,
+       .delete_records = NULL,
+       .get_count = NULL,
+       .get_count_with_query = NULL,
+       .replace_record = NULL,
+       .replace_records = NULL,
+};
+
index 9859a5f..ff9ce59 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
 #include "ctsvc_db_query.h"
 #include "ctsvc_list.h"
 
-static int __ctsvc_db_activity_photo_insert_record(contacts_record_h record, int *id);
-static int __ctsvc_db_activity_photo_get_record(int id, contacts_record_h* out_record);
-static int __ctsvc_db_activity_photo_update_record(contacts_record_h record);
-static int __ctsvc_db_activity_photo_delete_record(int id);
-static int __ctsvc_db_activity_photo_get_all_records(int offset, int limit, contacts_list_h* out_list);
-static int __ctsvc_db_activity_photo_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h* out_list);
-
-ctsvc_db_plugin_info_s ctsvc_db_plugin_activity_photo = {
-       .is_query_only = false,
-       .insert_record = __ctsvc_db_activity_photo_insert_record,
-       .get_record = __ctsvc_db_activity_photo_get_record,
-       .update_record = __ctsvc_db_activity_photo_update_record,
-       .delete_record = __ctsvc_db_activity_photo_delete_record,
-       .get_all_records = __ctsvc_db_activity_photo_get_all_records,
-       .get_records_with_query = __ctsvc_db_activity_photo_get_records_with_query,
-       .insert_records = NULL,
-       .update_records = NULL,
-       .delete_records = NULL,
-       .get_count = NULL,
-       .get_count_with_query = NULL,
-       .replace_record = NULL,
-       .replace_records = NULL,
-};
 
 static int __ctsvc_db_activity_photo_insert_record(contacts_record_h record, int *id)
 {
        int ret;
        int addressbook_id;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_activity_photo_s *activity_photo = (ctsvc_activity_photo_s *)record;
+       ctsvc_activity_photo_s *activity_photo = (ctsvc_activity_photo_s*)record;
 
-       RETVM_IF(NULL == activity_photo->photo_url, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : photo_url is NULL");
+       RETV_IF(NULL == activity_photo->photo_url, CONTACTS_ERROR_INVALID_PARAMETER);
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -76,35 +52,34 @@ static int __ctsvc_db_activity_photo_insert_record(contacts_record_h record, int
        if (CONTACTS_ERROR_NONE != ret) {
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NO_DATA == ret) {
-                       CTS_ERR("No data : activity_id (%d) is not exist", activity_photo->activity_id);
+                       ERR("No data : activity_id (%d) is not exist", activity_photo->activity_id);
                        return CONTACTS_ERROR_INVALID_PARAMETER;
-               }
-               else {
-                       CTS_ERR("ctsvc_query_get_first_int_result Fail(%d)", ret);
+               } else {
+                       ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                        return ret;
                }
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to insert this activity_photo record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to insert this activity_photo record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_activity_photo_insert(record, activity_photo->activity_id, id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_activity_photo_insert() Fail(%d)", ret);
+               ERR("ctsvc_db_activity_photo_insert() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_end_trans(true);
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "DB error : ctsvc_end_trans() Fail(%d)", ret);
+       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "ctsvc_end_trans() Fail(%d)", ret);
 
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_activity_photo_get_record(int id, contacts_record_hout_record)
+static int __ctsvc_db_activity_photo_get_record(int id, contacts_record_h *out_record)
 {
        int ret;
        cts_stmt stmt = NULL;
@@ -120,11 +95,11 @@ static int __ctsvc_db_activity_photo_get_record(int id, contacts_record_h* out_r
                        id);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/ != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
@@ -144,13 +119,13 @@ static int __ctsvc_db_activity_photo_update_record(contacts_record_h record)
        int ret;
        int addressbook_id;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_activity_photo_s *activity_photo = (ctsvc_activity_photo_s *)record;
+       ctsvc_activity_photo_s *activity_photo = (ctsvc_activity_photo_s*)record;
 
        RETVM_IF(NULL == activity_photo->photo_url, CONTACTS_ERROR_INVALID_PARAMETER, "photo_url is empty");
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -161,26 +136,26 @@ static int __ctsvc_db_activity_photo_update_record(contacts_record_h record)
 
        ret = ctsvc_query_get_first_int_result(query, &addressbook_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("No data : activity_id (%d) is not exist", activity_photo->activity_id);
+               ERR("No data : activity_id (%d) is not exist", activity_photo->activity_id);
                ctsvc_end_trans(false);
                return ret;
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this activity_photo record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this activity_photo record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_activity_photo_update(record);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("Update record Fail(%d)", ret);
+               ERR("Update record Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_end_trans(true);
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "DB error : ctsvc_end_trans() Fail(%d)", ret);
+       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "ctsvc_end_trans() Fail(%d)", ret);
 
        return CONTACTS_ERROR_NONE;
 }
@@ -193,7 +168,7 @@ static int __ctsvc_db_activity_photo_delete_record(int id)
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -204,31 +179,31 @@ static int __ctsvc_db_activity_photo_delete_record(int id)
 
        ret = ctsvc_query_get_first_int_result(query, &addressbook_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("No data : id (%d) is not exist", id);
+               ERR("No data : id (%d) is not exist", id);
                ctsvc_end_trans(false);
                return ret;
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to delete this activity_photo record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to delete this activity_photo record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_activity_photo_delete(id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_activity_photo_delete() Fail(%d)", ret);
+               ERR("ctsvc_db_activity_photo_delete() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_end_trans(true);
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "DB error : ctsvc_end_trans() Fail(%d)", ret);
+       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "ctsvc_end_trans() Fail(%d)", ret);
 
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_activity_photo_get_all_records(int offset, int limit, contacts_list_hout_list)
+static int __ctsvc_db_activity_photo_get_all_records(int offset, int limit, contacts_list_h *out_list)
 {
        int len;
        int ret;
@@ -239,8 +214,8 @@ static int __ctsvc_db_activity_photo_get_all_records(int offset, int limit, cont
 
        len = snprintf(query, sizeof(query),
                        "SELECT P.id, P.activity_id, P.photo_url, P.sort_index "
-                               "FROM "CTSVC_DB_VIEW_CONTACT" C, "CTSVC_DB_VIEW_ACTIVITY" A, "CTSVC_DB_VIEW_ACTIVITY_PHOTOS" P "
-                               "ON C.contact_id = A.contact_id AND A.id = P.activity_id ");
+                       "FROM "CTSVC_DB_VIEW_CONTACT" C, "CTSVC_DB_VIEW_ACTIVITY" A, "CTSVC_DB_VIEW_ACTIVITY_PHOTOS" P "
+                       "ON C.contact_id = A.contact_id AND A.id = P.activity_id ");
 
        if (0 != limit) {
                len += snprintf(query+len, sizeof(query)-len, " LIMIT %d", limit);
@@ -249,12 +224,12 @@ static int __ctsvc_db_activity_photo_get_all_records(int offset, int limit, cont
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                if (1 /*CTS_TRUE */ != ret) {
-                       CTS_ERR("DB : ctsvc_stmt_step fail(%d)", ret);
+                       ERR("DB : ctsvc_stmt_step fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -270,7 +245,7 @@ static int __ctsvc_db_activity_photo_get_all_records(int offset, int limit, cont
 }
 
 static int __ctsvc_db_activity_photo_get_records_with_query(contacts_query_h query, int offset,
-               int limit, contacts_list_hout_list)
+               int limit, contacts_list_h *out_list)
 {
        int ret;
        int i;
@@ -281,7 +256,7 @@ static int __ctsvc_db_activity_photo_get_records_with_query(contacts_query_h que
        ctsvc_activity_photo_s *activity_photo;
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        ret = ctsvc_db_make_get_records_query_stmt(s_query, offset, limit, &stmt);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_db_make_get_records_query_stmt fail(%d)", ret);
@@ -290,7 +265,7 @@ static int __ctsvc_db_activity_photo_get_records_with_query(contacts_query_h que
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 /*CTS_TRUE */ != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -298,18 +273,18 @@ static int __ctsvc_db_activity_photo_get_records_with_query(contacts_query_h que
 
                contacts_record_create(_contacts_activity_photo._uri, &record);
                activity_photo = (ctsvc_activity_photo_s*)record;
-               if (0 == s_query->projection_count)
+               if (0 == s_query->projection_count) {
                        field_count = s_query->property_count;
-               else {
+               else {
                        field_count = s_query->projection_count;
                        ret = ctsvc_record_set_projection_flags(record, s_query->projection,
                                        s_query->projection_count, s_query->property_count);
 
                        if (CONTACTS_ERROR_NONE != ret)
-                               ASSERT_NOT_REACHED("To set projection is Fail.\n");
+                               ASSERT_NOT_REACHED("To set projection is Fail\n");
                }
 
-               for (i=0;i<field_count;i++) {
+               for (i = 0; i < field_count; i++) {
                        char *temp;
                        int property_id;
                        if (0 == s_query->projection_count)
@@ -317,12 +292,12 @@ static int __ctsvc_db_activity_photo_get_records_with_query(contacts_query_h que
                        else
                                property_id = s_query->projection[i];
 
-                       switch(property_id) {
+                       switch (property_id) {
                        case CTSVC_PROPERTY_ACTIVITY_PHOTO_ID:
                                activity_photo->id = ctsvc_stmt_get_int(stmt, i);
                                break;
                        case CTSVC_PROPERTY_ACTIVITY_PHOTO_ACTIVITY_ID:
-                               activity_photo->activity_id= ctsvc_stmt_get_int(stmt, i);
+                               activity_photo->activity_id = ctsvc_stmt_get_int(stmt, i);
                                break;
                        case CTSVC_PROPERTY_ACTIVITY_PHOTO_URL:
                                temp = ctsvc_stmt_get_text(stmt, i);
@@ -330,7 +305,7 @@ static int __ctsvc_db_activity_photo_get_records_with_query(contacts_query_h que
                                activity_photo->photo_url = SAFE_STRDUP(temp);
                                break;
                        case CTSVC_PROPERTY_ACTIVITY_PHOTO_SORT_INDEX:
-                               activity_photo->sort_index= ctsvc_stmt_get_int(stmt, i);
+                               activity_photo->sort_index = ctsvc_stmt_get_int(stmt, i);
                                break;
                        default:
                                break;
@@ -345,3 +320,20 @@ static int __ctsvc_db_activity_photo_get_records_with_query(contacts_query_h que
        return CONTACTS_ERROR_NONE;
 }
 
+ctsvc_db_plugin_info_s ctsvc_db_plugin_activity_photo = {
+       .is_query_only = false,
+       .insert_record = __ctsvc_db_activity_photo_insert_record,
+       .get_record = __ctsvc_db_activity_photo_get_record,
+       .update_record = __ctsvc_db_activity_photo_update_record,
+       .delete_record = __ctsvc_db_activity_photo_delete_record,
+       .get_all_records = __ctsvc_db_activity_photo_get_all_records,
+       .get_records_with_query = __ctsvc_db_activity_photo_get_records_with_query,
+       .insert_records = NULL,
+       .update_records = NULL,
+       .delete_records = NULL,
+       .get_count = NULL,
+       .get_count_with_query = NULL,
+       .replace_record = NULL,
+       .replace_records = NULL,
+};
+
index b8cc32d..7f395d0 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -35,7 +35,7 @@ int ctsvc_db_activity_photo_get_value_from_stmt(cts_stmt stmt, contacts_record_h
        ctsvc_activity_photo_s *activity_photo;
        int start_count = 0;
 
-       ret = contacts_record_create(_contacts_activity_photo._uri, (contacts_record_h *)&activity_photo);
+       ret = contacts_record_create(_contacts_activity_photo._uri, (contacts_record_h*)&activity_photo);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "contacts_record_create Fail(%d)", ret);
 
        activity_photo->id = ctsvc_stmt_get_int(stmt, start_count++);
@@ -52,31 +52,28 @@ int ctsvc_db_activity_photo_insert(contacts_record_h record, int activity_id, in
 {
        int ret;
        cts_stmt stmt = NULL;
-       ctsvc_activity_photo_s *activity_photo =(ctsvc_activity_photo_s*)record;
+       ctsvc_activity_photo_s *activity_photo = (ctsvc_activity_photo_s*)record;
        char query[CTS_SQL_MAX_LEN] = {0};
 
        RETVM_IF(activity_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : activity_id(%d) is mandatory field to insert activity_photo record ", activity_id);
-
+                       "activity_id(%d) Invalid", activity_id);
        RETVM_IF(0 < activity_photo->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : id(%d), This record is already inserted", activity_photo->id);
-
-       RETVM_IF(NULL == activity_photo->photo_url, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : activity_photo->photo_url is NULL");
+                       "id(%d), This record is already inserted", activity_photo->id);
+       RETV_IF(NULL == activity_photo->photo_url, CONTACTS_ERROR_INVALID_PARAMETER);
 
        snprintf(query, sizeof(query),
-               "INSERT INTO "CTS_TABLE_ACTIVITY_PHOTOS"(activity_id, photo_url, sort_index) "
-                                       "VALUES(%d, ?, %d)",
+                       "INSERT INTO "CTS_TABLE_ACTIVITY_PHOTOS"(activity_id, photo_url, sort_index) "
+                       "VALUES(%d, ?, %d)",
                        activity_id, activity_photo->sort_index);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        sqlite3_bind_text(stmt, 1, activity_photo->photo_url, strlen(activity_photo->photo_url), SQLITE_STATIC);
 
        ret = ctsvc_stmt_step(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                return ret;
        }
@@ -94,7 +91,7 @@ int ctsvc_db_activity_photo_update(contacts_record_h record)
 {
        int id;
        int ret = CONTACTS_ERROR_NONE;
-       charset = NULL;
+       char *set = NULL;
        GSList *bind_text = NULL;
        GSList *cursor = NULL;
        ctsvc_activity_photo_s *activity_photo = (ctsvc_activity_photo_s*)record;
@@ -116,11 +113,14 @@ int ctsvc_db_activity_photo_update(contacts_record_h record)
                ctsvc_set_activity_photo_noti();
        } while (0);
 
-       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s *)record);
-       CONTACTS_FREE(set);
+       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s*)record);
+       free(set);
+
        if (bind_text) {
-               for (cursor=bind_text;cursor;cursor=cursor->next)
-                       CONTACTS_FREE(cursor->data);
+               for (cursor = bind_text; cursor; cursor = cursor->next) {
+                       free(cursor->data);
+                       cursor->data = NULL;
+               }
                g_slist_free(bind_text);
        }
 
@@ -152,16 +152,16 @@ int ctsvc_db_activity_photo_get_records(int activity_id, contacts_record_h recor
        contacts_list_h list;
 
        snprintf(query, sizeof(query), "SELECT activity_id, activity_id, photo_url, sort_index "
-                                               "FROM "CTSVC_DB_VIEW_ACTIVITY_PHOTOS" WHERE activity_id = %d "
-                                               "ORDER BY sort_index ASC", activity_id);
+                       "FROM "CTSVC_DB_VIEW_ACTIVITY_PHOTOS" WHERE activity_id = %d "
+                       "ORDER BY sort_index ASC", activity_id);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
index 3088885..a610d84 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
index b4dd61d..b275e0e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_db_schema.h"
 #include "ctsvc_notification.h"
 #include "ctsvc_db_access_control.h"
 
-static int __ctsvc_db_address_insert_record(contacts_record_h record, int *id);
-static int __ctsvc_db_address_get_record(int id, contacts_record_h* out_record);
-static int __ctsvc_db_address_update_record(contacts_record_h record);
-static int __ctsvc_db_address_delete_record(int id);
-static int __ctsvc_db_address_get_all_records(int offset, int limit, contacts_list_h* out_list);
-static int __ctsvc_db_address_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h* out_list);
-
-ctsvc_db_plugin_info_s ctsvc_db_plugin_address = {
-       .is_query_only = false,
-       .insert_record = __ctsvc_db_address_insert_record,
-       .get_record = __ctsvc_db_address_get_record,
-       .update_record = __ctsvc_db_address_update_record,
-       .delete_record = __ctsvc_db_address_delete_record,
-       .get_all_records = __ctsvc_db_address_get_all_records,
-       .get_records_with_query = __ctsvc_db_address_get_records_with_query,
-       .insert_records = NULL,
-       .update_records = NULL,
-       .delete_records = NULL,
-       .get_count = NULL,
-       .get_count_with_query = NULL,
-       .replace_record = NULL,
-       .replace_records = NULL,
-};
 
 static int __ctsvc_db_address_insert_record(contacts_record_h record, int *id)
 {
@@ -63,13 +39,13 @@ static int __ctsvc_db_address_insert_record(contacts_record_h record, int *id)
        ctsvc_address_s *address = (ctsvc_address_s*)record;
 
        RETVM_IF(NULL == address->pobox && NULL == address->postalcode && NULL == address->region
-               && NULL == address->locality && NULL == address->street && NULL == address->extended
-               && NULL == address->country,
-               CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : address is NULL");
+                       && NULL == address->locality && NULL == address->street && NULL == address->extended
+                       && NULL == address->country,
+                       CONTACTS_ERROR_INVALID_PARAMETER, "address is NULL");
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -79,31 +55,30 @@ static int __ctsvc_db_address_insert_record(contacts_record_h record, int *id)
        if (CONTACTS_ERROR_NONE != ret) {
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NO_DATA == ret) {
-                       CTS_ERR("No data : contact_id (%d) is not exist", address->contact_id);
+                       ERR("No data : contact_id (%d) is not exist", address->contact_id);
                        return CONTACTS_ERROR_INVALID_PARAMETER;
-               }
-               else {
-                       CTS_ERR("ctsvc_query_get_first_int_result Fail(%d)", ret);
+               } else {
+                       ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                        return ret;
                }
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this address record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this address record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_address_insert(record, address->contact_id, false, id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_db_contact_update_changed_time(address->contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -129,7 +104,7 @@ static int __ctsvc_db_address_update_record(contacts_record_h record)
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -137,27 +112,27 @@ static int __ctsvc_db_address_update_record(contacts_record_h record)
                        "SELECT addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", address->contact_id);
        ret = ctsvc_query_get_first_int_result(query, &addressbook_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("No data : contact_id (%d) is not exist", address->contact_id);
+               ERR("No data : contact_id (%d) is not exist", address->contact_id);
                ctsvc_end_trans(false);
                return ret;
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this address record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this address record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_address_update(record, false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("update record Fail(%d)", ret);
+               ERR("update record Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_db_contact_update_changed_time(address->contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -183,16 +158,16 @@ static int __ctsvc_db_address_delete_record(int id)
 
        snprintf(query, sizeof(query),
                        "SELECT contact_id, addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" "
-                               "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id);
+                       "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id);
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error :ctsvc_query_prepare Fail(%d)", ret);
+               ERR("DB error :ctsvc_query_prepare Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
        ret = ctsvc_stmt_step(stmt);
        if (1 != ret) {
-               CTS_ERR("The id(%d) is Invalid(%d)", id, ret);
+               ERR("The id(%d) is Invalid(%d)", id, ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NONE == ret)
@@ -206,20 +181,20 @@ static int __ctsvc_db_address_delete_record(int id)
        ctsvc_stmt_finalize(stmt);
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to delete this address record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to delete this address record : addresbook_id(%d)", addressbook_id);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_address_delete(id, false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_address_delete() Fail(%d)", ret);
+               ERR("ctsvc_db_address_delete() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_db_contact_update_changed_time(contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -233,7 +208,7 @@ static int __ctsvc_db_address_delete_record(int id)
                return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_address_get_record(int id, contacts_record_hout_record)
+static int __ctsvc_db_address_get_record(int id, contacts_record_h *out_record)
 {
        char query[CTS_SQL_MAX_LEN] = {0};
        int ret;
@@ -241,19 +216,19 @@ static int __ctsvc_db_address_get_record(int id, contacts_record_h* out_record)
        ctsvc_address_s *address;
 
        snprintf(query, sizeof(query),
-                               "SELECT id, data.contact_id, is_default, "
-                                               "data1, data2, data3, data4, data5, data6, data7, data8, data9 "
-                                               "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                                               "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                                               "WHERE datatype=%d AND id = %d ",
-                                               CTSVC_DATA_POSTAL, id);
+                       "SELECT id, data.contact_id, is_default, "
+                       "data1, data2, data3, data4, data5, data6, data7, data8, data9 "
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE datatype=%d AND id = %d ",
+                       CTSVC_DATA_POSTAL, id);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/  != ret) {
-               CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
@@ -269,7 +244,7 @@ static int __ctsvc_db_address_get_record(int id, contacts_record_h* out_record)
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_address_get_all_records(int offset, int limit, contacts_list_hout_list)
+static int __ctsvc_db_address_get_all_records(int offset, int limit, contacts_list_h *out_list)
 {
        int len;
        int ret;
@@ -280,11 +255,11 @@ static int __ctsvc_db_address_get_all_records(int offset, int limit, contacts_li
 
        len = snprintf(query, sizeof(query),
                        "SELECT data.contact_id, is_default, "
-                                               "data1, data2, data3, data4, data5, data6, data7, data8, data9 "
-                                               "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                                               "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                                               "WHERE datatype=%d AND is_my_profile=0 ",
-                                               CTSVC_DATA_POSTAL);
+                       "data1, data2, data3, data4, data5, data6, data7, data8, data9 "
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE datatype=%d AND is_my_profile=0 ",
+                       CTSVC_DATA_POSTAL);
 
        if (0 != limit) {
                len += snprintf(query+len, sizeof(query)-len, " LIMIT %d", limit);
@@ -293,12 +268,12 @@ static int __ctsvc_db_address_get_all_records(int offset, int limit, contacts_li
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -314,7 +289,7 @@ static int __ctsvc_db_address_get_all_records(int offset, int limit, contacts_li
 }
 
 static int __ctsvc_db_address_get_records_with_query(contacts_query_h query, int offset,
-               int limit, contacts_list_hout_list)
+               int limit, contacts_list_h *out_list)
 {
        int ret;
        int i;
@@ -325,7 +300,7 @@ static int __ctsvc_db_address_get_records_with_query(contacts_query_h query, int
        ctsvc_address_s *address;
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        ret = ctsvc_db_make_get_records_query_stmt(s_query, offset, limit, &stmt);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_db_make_get_records_query_stmt fail(%d)", ret);
@@ -334,7 +309,7 @@ static int __ctsvc_db_address_get_records_with_query(contacts_query_h query, int
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -342,9 +317,9 @@ static int __ctsvc_db_address_get_records_with_query(contacts_query_h query, int
 
                contacts_record_create(_contacts_address._uri, &record);
                address = (ctsvc_address_s*)record;
-               if (0 == s_query->projection_count)
+               if (0 == s_query->projection_count) {
                        field_count = s_query->property_count;
-               else {
+               else {
                        field_count = s_query->projection_count;
                        ret = ctsvc_record_set_projection_flags(record, s_query->projection,
                                        s_query->projection_count, s_query->property_count);
@@ -353,7 +328,7 @@ static int __ctsvc_db_address_get_records_with_query(contacts_query_h query, int
                                ASSERT_NOT_REACHED("To set projection is Fail.\n");
                }
 
-               for (i=0;i<field_count;i++) {
+               for (i = 0; i < field_count; i++) {
                        char *temp;
                        int property_id;
                        if (0 == s_query->projection_count)
@@ -361,7 +336,7 @@ static int __ctsvc_db_address_get_records_with_query(contacts_query_h query, int
                        else
                                property_id = s_query->projection[i];
 
-                       switch(property_id) {
+                       switch (property_id) {
                        case CTSVC_PROPERTY_ADDRESS_ID:
                                address->id = ctsvc_stmt_get_int(stmt, i);
                                break;
@@ -426,3 +401,21 @@ static int __ctsvc_db_address_get_records_with_query(contacts_query_h query, int
        *out_list = list;
        return CONTACTS_ERROR_NONE;
 }
+
+ctsvc_db_plugin_info_s ctsvc_db_plugin_address = {
+       .is_query_only = false,
+       .insert_record = __ctsvc_db_address_insert_record,
+       .get_record = __ctsvc_db_address_get_record,
+       .update_record = __ctsvc_db_address_update_record,
+       .delete_record = __ctsvc_db_address_delete_record,
+       .get_all_records = __ctsvc_db_address_get_all_records,
+       .get_records_with_query = __ctsvc_db_address_get_records_with_query,
+       .insert_records = NULL,
+       .update_records = NULL,
+       .delete_records = NULL,
+       .get_count = NULL,
+       .get_count_with_query = NULL,
+       .replace_record = NULL,
+       .replace_records = NULL,
+};
+
index adc8c08..e31321e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_db_schema.h"
@@ -33,7 +32,7 @@ int ctsvc_db_address_get_value_from_stmt(cts_stmt stmt, contacts_record_h *recor
        char *temp;
        ctsvc_address_s *address;
 
-       ret = contacts_record_create(_contacts_address._uri, (contacts_record_h *)&address);
+       ret = contacts_record_create(_contacts_address._uri, (contacts_record_h*)&address);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "contacts_record_create Fail(%d)", ret);
 
        address->id = ctsvc_stmt_get_int(stmt, start_count++);
@@ -68,7 +67,7 @@ static int __ctsvc_db_address_reset_default(int address_id, int contact_id)
 
        snprintf(query, sizeof(query),
                        "UPDATE "CTS_TABLE_DATA" SET is_default = 0, is_primary_default = 0 "
-                                       "WHERE id != %d AND contact_id = %d AND datatype = %d",
+                       "WHERE id != %d AND contact_id = %d AND datatype = %d",
                        address_id, contact_id, CTSVC_DATA_POSTAL);
        ret = ctsvc_query_exec(query);
        WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_query_exec() Fail(%d)", ret);
@@ -84,20 +83,20 @@ int ctsvc_db_address_insert(contacts_record_h record, int contact_id, bool is_my
        char query[CTS_SQL_MAX_LEN] = {0};
 
        RETVM_IF(contact_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : contact_id(%d) is mandatory field to insert address record ", address->contact_id);
+                       "contact_id(%d) is mandatory field to insert address record ", address->contact_id);
        RETVM_IF(0 < address->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : id(%d), This record is already inserted", address->id);
+                       "id(%d), This record is already inserted", address->id);
 
        if (address->pobox || address->postalcode || address->region || address->locality
-               || address->street || address->extended || address->country) {
+                       || address->street || address->extended || address->country) {
                snprintf(query, sizeof(query),
-                       "INSERT INTO "CTS_TABLE_DATA"(contact_id, is_my_profile, datatype, is_default, data1, data2, data3, "
-                                               "data4, data5, data6, data7, data8, data9) "
-                                               "VALUES(%d, %d, %d, %d, %d, ?, ?, ?, ?, ?, ?, ?, ?)",
+                               "INSERT INTO "CTS_TABLE_DATA"(contact_id, is_my_profile, datatype, is_default, data1, data2, data3, "
+                               "data4, data5, data6, data7, data8, data9) "
+                               "VALUES(%d, %d, %d, %d, %d, ?, ?, ?, ?, ?, ?, ?, ?)",
                                contact_id, is_my_profile, CTSVC_DATA_POSTAL, address->is_default, address->type);
 
                ret = ctsvc_query_prepare(query, &stmt);
-               RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
                if (address->label)
                        ctsvc_stmt_bind_text(stmt, 1, address->label);
@@ -118,7 +117,7 @@ int ctsvc_db_address_insert(contacts_record_h record, int contact_id, bool is_my
 
                ret = ctsvc_stmt_step(stmt);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        return ret;
                }
@@ -127,7 +126,7 @@ int ctsvc_db_address_insert(contacts_record_h record, int contact_id, bool is_my
                        *id = address_id;
                ctsvc_stmt_finalize(stmt);
 
-               if (ctsvc_record_check_property_flag((ctsvc_record_s *)record, _contacts_address.is_default, CTSVC_PROPERTY_FLAG_DIRTY)) {
+               if (ctsvc_record_check_property_flag((ctsvc_record_s*)record, _contacts_address.is_default, CTSVC_PROPERTY_FLAG_DIRTY)) {
                        if (address->is_default)
                                __ctsvc_db_address_reset_default(address_id, contact_id);
                }
@@ -143,25 +142,25 @@ int ctsvc_db_address_update(contacts_record_h record, bool is_my_profile)
 {
        int id;
        int ret = CONTACTS_ERROR_NONE;
-       charset = NULL;
+       char *set = NULL;
        GSList *bind_text = NULL;
        GSList *cursor = NULL;
        ctsvc_address_s *address = (ctsvc_address_s*)record;
        char query[CTS_SQL_MAX_LEN] = {0};
 
        RETVM_IF(address->id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : id(%d), This record is already inserted", address->id);
+                       "id(%d), This record is already inserted", address->id);
        RETVM_IF(CTSVC_PROPERTY_FLAG_DIRTY != (address->base.property_flag & CTSVC_PROPERTY_FLAG_DIRTY), CONTACTS_ERROR_NONE, "No update");
        RETVM_IF(NULL == address->pobox && NULL == address->postalcode && address->region
                        && address->locality && address->street && address->extended && address->country,
-                       CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : address is NULL");
+                       CONTACTS_ERROR_INVALID_PARAMETER, "address is NULL");
 
        snprintf(query, sizeof(query),
                        "SELECT id FROM "CTS_TABLE_DATA" WHERE id = %d", address->id);
        ret = ctsvc_query_get_first_int_result(query, &id);
        RETV_IF(ret != CONTACTS_ERROR_NONE, ret);
 
-       if (ctsvc_record_check_property_flag((ctsvc_record_s *)record, _contacts_address.is_default, CTSVC_PROPERTY_FLAG_DIRTY)) {
+       if (ctsvc_record_check_property_flag((ctsvc_record_s*)record, _contacts_address.is_default, CTSVC_PROPERTY_FLAG_DIRTY)) {
                if (address->is_default)
                        __ctsvc_db_address_reset_default(address->id, address->contact_id);
        }
@@ -173,11 +172,14 @@ int ctsvc_db_address_update(contacts_record_h record, bool is_my_profile)
                        ctsvc_set_address_noti();
        } while (0);
 
-       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s *)record);
-       CONTACTS_FREE(set);
+       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s*)record);
+       free(set);
+
        if (bind_text) {
-               for (cursor=bind_text;cursor;cursor=cursor->next)
-                       CONTACTS_FREE(cursor->data);
+               for (cursor = bind_text; cursor; cursor = cursor->next) {
+                       free(cursor->data);
+                       cursor->data = NULL;
+               }
                g_slist_free(bind_text);
        }
 
@@ -193,7 +195,7 @@ int ctsvc_db_address_delete(int id, bool is_my_profile)
                        CTSVC_DATA_POSTAL, id);
 
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        if (false == is_my_profile)
                ctsvc_set_address_noti();
index 6606e3a..727691f 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #ifndef __CTSVC_DB_PLUGIN_ADDRESS_HELPER_H__
 #define __CTSVC_DB_PLUGIN_ADDRESS_HELPER_H__
 
 #include "contacts.h"
 #include "ctsvc_db_sqlite.h"
 
-int ctsvc_db_address_insert(contacts_record_h record, int contact_id, bool is_my_profile, int *id);
+int ctsvc_db_address_insert(contacts_record_h record, int contact_id, bool is_my_profile,
+               int *id);
 int ctsvc_db_address_update(contacts_record_h record, bool is_my_profile);
 int ctsvc_db_address_delete(int id, bool is_my_profile);
-int ctsvc_db_address_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record, int start_count);
+int ctsvc_db_address_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record,
+               int start_count);
 
 #endif /* __CTSVC_DB_PLUGIN_ADDRESS_HELPER_H__ */
index 3095c34..12661a6 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
 #include "ctsvc_db_access_control.h"
 #include "ctsvc_db_plugin_addressbook_helper.h"
 
-static int __ctsvc_db_addressbook_insert_record(contacts_record_h record, int *id);
-static int __ctsvc_db_addressbook_get_record(int id, contacts_record_h* record);
-static int __ctsvc_db_addressbook_update_record(contacts_record_h record);
-static int __ctsvc_db_addressbook_delete_record(int id);
-static int __ctsvc_db_addressbook_get_all_records(int offset, int limit, contacts_list_h* out_list);
-static int __ctsvc_db_addressbook_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h* out_list);
-
-ctsvc_db_plugin_info_s ctsvc_db_plugin_addressbook = {
-       .is_query_only = false,
-       .insert_record = __ctsvc_db_addressbook_insert_record,
-       .get_record = __ctsvc_db_addressbook_get_record,
-       .update_record = __ctsvc_db_addressbook_update_record,
-       .delete_record = __ctsvc_db_addressbook_delete_record,
-       .get_all_records = __ctsvc_db_addressbook_get_all_records,
-       .get_records_with_query = __ctsvc_db_addressbook_get_records_with_query,
-       .insert_records = NULL,
-       .update_records = NULL,
-       .delete_records = NULL,
-       .get_count = NULL,
-       .get_count_with_query = NULL,
-       .replace_record = NULL,
-       .replace_records = NULL,
-};
 
 static int __ctsvc_db_addressbook_value_set(cts_stmt stmt, contacts_record_h *record)
 {
@@ -78,7 +55,7 @@ static int __ctsvc_db_addressbook_value_set(cts_stmt stmt, contacts_record_h *re
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_addressbook_get_record(int id, contacts_record_hout_record)
+static int __ctsvc_db_addressbook_get_record(int id, contacts_record_h *out_record)
 {
        int ret;
        cts_stmt stmt = NULL;
@@ -89,15 +66,15 @@ static int __ctsvc_db_addressbook_get_record(int id, contacts_record_h* out_reco
        *out_record = NULL;
 
        snprintf(query, sizeof(query),
-                               "SELECT addressbook_id, addressbook_name, account_id, mode, last_sync_ver "
-                               "FROM "CTS_TABLE_ADDRESSBOOKS" WHERE addressbook_id = %d", id);
+                       "SELECT addressbook_id, addressbook_name, account_id, mode, last_sync_ver "
+                       "FROM "CTS_TABLE_ADDRESSBOOKS" WHERE addressbook_id = %d", id);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/ != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
@@ -109,7 +86,7 @@ static int __ctsvc_db_addressbook_get_record(int id, contacts_record_h* out_reco
 
        ctsvc_stmt_finalize(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("__ctsvc_db_addressbook_value_set(ALL) Fail(%d)", ret);
+               ERR("__ctsvc_db_addressbook_value_set(ALL) Fail(%d)", ret);
                return ret;
        }
 
@@ -130,26 +107,25 @@ static int __ctsvc_db_addressbook_insert_record(contacts_record_h record, int *i
        RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == addressbook->name, CONTACTS_ERROR_INVALID_PARAMETER);
        RETVM_IF(CTSVC_RECORD_ADDRESSBOOK != addressbook->base.r_type, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : record is invalid type(%d)", addressbook->base.r_type);
+                       "record is invalid type(%d)", addressbook->base.r_type);
 
        ret = ctsvc_begin_trans();
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "DB error : ctsvc_begin_trans() Fail(%d)", ret);
+       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "ctsvc_begin_trans() Fail(%d)", ret);
 
        /* Can not insert addressbook which has same account_id */
        int addresbook_id;
        account_h account = NULL;
        snprintf(query, sizeof(query),
-               "SELECT addressbook_id FROM "CTS_TABLE_ADDRESSBOOKS" WHERE account_id = %d",
-               addressbook->account_id);
+                       "SELECT addressbook_id FROM "CTS_TABLE_ADDRESSBOOKS" WHERE account_id = %d",
+                       addressbook->account_id);
        ret = ctsvc_query_get_first_int_result(query, &addresbook_id);
        if (CONTACTS_ERROR_NO_DATA != ret) {
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NONE == ret) {
-                       CTS_ERR("One addressbook which has account_id(%d) already exists", addressbook->account_id);
+                       ERR("One addressbook which has account_id(%d) already exists", addressbook->account_id);
                        return CONTACTS_ERROR_INVALID_PARAMETER;
-               }
-               else {
-                       CTS_ERR("DB error : ctsvc_query_get_first_int_result() Fail (%d)", ret);
+               } else {
+                       ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -157,13 +133,13 @@ static int __ctsvc_db_addressbook_insert_record(contacts_record_h record, int *i
        /* check account_id validation */
        ret = account_create(&account);
        if (ACCOUNT_ERROR_NONE != ret) {
-               CTS_ERR("account_create() Fail(%d)", ret);
+               ERR("account_create() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_SYSTEM;
        }
        ret = account_query_account_by_account_id(addressbook->account_id, &account);
        if (ACCOUNT_ERROR_NONE != ret) {
-               CTS_ERR("account_query_account_by_account_id Faild(%d) : account_id(%d)", ret, addressbook->account_id);
+               ERR("account_query_account_by_account_id Faild(%d) : account_id(%d)", ret, addressbook->account_id);
                ret = account_destroy(account);
                WARN_IF(ret != ACCOUNT_ERROR_NONE, "account_destroy Fail(%d)", ret);
                ctsvc_end_trans(false);
@@ -179,7 +155,7 @@ static int __ctsvc_db_addressbook_insert_record(contacts_record_h record, int *i
 
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -194,7 +170,7 @@ static int __ctsvc_db_addressbook_insert_record(contacts_record_h record, int *i
        do {
                ret = ctsvc_stmt_step(stmt);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        break;
                }
@@ -206,9 +182,8 @@ static int __ctsvc_db_addressbook_insert_record(contacts_record_h record, int *i
 
                ctsvc_set_addressbook_noti();
                ret = ctsvc_end_trans(true);
-               if (ret < CONTACTS_ERROR_NONE)
-               {
-                       CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               if (ret < CONTACTS_ERROR_NONE) {
+                       ERR("ctsvc_end_trans() Fail(%d)", ret);
                        free(smack);
                        return ret;
                }
@@ -228,16 +203,16 @@ static int __ctsvc_db_addressbook_insert_record(contacts_record_h record, int *i
 static int __ctsvc_db_addressbook_update_record(contacts_record_h record)
 {
        int ret = CONTACTS_ERROR_NONE;
-       charset = NULL;
+       char *set = NULL;
        GSList *bind_text = NULL;
        GSList *cursor = NULL;
-       ctsvc_addressbook_s *addressbook = (ctsvc_addressbook_s *)record;
+       ctsvc_addressbook_s *addressbook = (ctsvc_addressbook_s*)record;
 
        RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
        RETVM_IF(CTSVC_PROPERTY_FLAG_DIRTY != (addressbook->base.property_flag & CTSVC_PROPERTY_FLAG_DIRTY), CONTACTS_ERROR_NONE, "No update");
        RETV_IF(NULL == addressbook->name, CONTACTS_ERROR_INVALID_PARAMETER);
        RETVM_IF(CTSVC_RECORD_ADDRESSBOOK != addressbook->base.r_type, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : record is invalid type(%d)", addressbook->base.r_type);
+                       "record is invalid type(%d)", addressbook->base.r_type);
 
        ret = ctsvc_begin_trans();
        RETVM_IF(ret, ret, "ctsvc_begin_trans() Fail(%d)", ret);
@@ -245,9 +220,9 @@ static int __ctsvc_db_addressbook_update_record(contacts_record_h record)
        ret = ctsvc_is_owner(addressbook->id);
        if (CONTACTS_ERROR_NONE != ret) {
                if (CONTACTS_ERROR_PERMISSION_DENIED == ret)
-                       CTS_ERR("Does not have permission of address_book (%d)", addressbook->id);
+                       ERR("Does not have permission of address_book (%d)", addressbook->id);
                else
-                       CTS_ERR("ctsvc_is_owner Fail(%d)", ret);
+                       ERR("ctsvc_is_owner Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -263,12 +238,12 @@ static int __ctsvc_db_addressbook_update_record(contacts_record_h record)
                snprintf(query, sizeof(query), "UPDATE %s SET %s WHERE addressbook_id = %d", CTS_TABLE_ADDRESSBOOKS, set, addressbook->id);
                ret = ctsvc_query_prepare(query, &stmt);
                if (NULL == stmt) {
-                       CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+                       ERR("ctsvc_query_prepare() Fail(%d)", ret);
                        break;
                }
                if (bind_text) {
                        int i = 0;
-                       for (cursor=bind_text,i=1;cursor;cursor=cursor->next,i++) {
+                       for (cursor = bind_text, i = 1; cursor; cursor = cursor->next, i++) {
                                const char *text = cursor->data;
                                if (text && *text)
                                        ctsvc_stmt_bind_text(stmt, i, text);
@@ -276,7 +251,7 @@ static int __ctsvc_db_addressbook_update_record(contacts_record_h record)
                }
                ret = ctsvc_stmt_step(stmt);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        break;
                }
@@ -284,12 +259,14 @@ static int __ctsvc_db_addressbook_update_record(contacts_record_h record)
 
                ctsvc_set_addressbook_noti();
        } while (0);
-       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s *)record);
-       CONTACTS_FREE(set);
+       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s*)record);
+       free(set);
 
        if (bind_text) {
-               for (cursor=bind_text;cursor;cursor=cursor->next)
-                       CONTACTS_FREE(cursor->data);
+               for (cursor = bind_text; cursor; cursor = cursor->next) {
+                       free(cursor->data);
+                       cursor->data = NULL;
+               }
                g_slist_free(bind_text);
        }
 
@@ -299,7 +276,7 @@ static int __ctsvc_db_addressbook_update_record(contacts_record_h record)
        }
 
        ret = ctsvc_end_trans(true);
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "DB error : ctsvc_end_trans() Fail(%d)", ret);
+       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "ctsvc_end_trans() Fail(%d)", ret);
 
        return CONTACTS_ERROR_NONE;
 }
@@ -313,14 +290,14 @@ static int __ctsvc_db_addressbook_delete_record(int addressbook_id)
 
        char query[CTS_SQL_MAX_LEN] = {0};
        int ret = ctsvc_begin_trans();
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "DB error : ctsvc_begin_trans() Fail(%d)", ret);
+       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "ctsvc_begin_trans() Fail(%d)", ret);
 
        ret = ctsvc_is_owner(addressbook_id);
        if (CONTACTS_ERROR_NONE != ret) {
                if (CONTACTS_ERROR_PERMISSION_DENIED == ret)
-                       CTS_ERR("Does not have permission to delete address_book (%d)", addressbook_id);
+                       ERR("Does not have permission to delete address_book (%d)", addressbook_id);
                else
-                       CTS_ERR("ctsvc_is_owner Fail(%d)", ret);
+                       ERR("ctsvc_is_owner Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -332,7 +309,7 @@ static int __ctsvc_db_addressbook_delete_record(int addressbook_id)
        do {
                ret = ctsvc_query_exec(query);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("DB error : ctsvc_query_exec() Fail(%d)", ret);
+                       ERR("ctsvc_query_exec() Fail(%d)", ret);
                        break;
                }
 
@@ -343,21 +320,20 @@ static int __ctsvc_db_addressbook_delete_record(int addressbook_id)
                        /* person noti will set in ctsvc_person_do_garbage_collection : ctsvc_set_person_noti(); */
                        ctsvc_set_group_noti();
                        ctsvc_set_addressbook_noti();
-               }
-               else {
+               } else {
                        ret = CONTACTS_ERROR_NO_DATA;
                        break;
                }
 
                ret = ctsvc_person_do_garbage_collection();
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("DB error : ctsvc_person_garbagecollection() Fail(%d)", ret);
+                       ERR("ctsvc_person_garbagecollection() Fail(%d)", ret);
                        break;
                }
 
                ret = ctsvc_end_trans(true);
                if (ret < CONTACTS_ERROR_NONE) {
-                       CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+                       ERR("ctsvc_end_trans() Fail(%d)", ret);
                        return ret;
                }
 
@@ -371,7 +347,7 @@ static int __ctsvc_db_addressbook_delete_record(int addressbook_id)
 }
 
 static int __ctsvc_db_addressbook_get_all_records(int offset, int limit,
-       contacts_list_h* out_list)
+               contacts_list_h *out_list)
 {
        int ret;
        int len;
@@ -380,11 +356,11 @@ static int __ctsvc_db_addressbook_get_all_records(int offset, int limit,
        contacts_list_h list;
 
        len = snprintf(query, sizeof(query),
-                               "SELECT addressbook_id, addressbook_name, account_id, mode, last_sync_ver "
-                               "FROM "CTS_TABLE_ADDRESSBOOKS);
+                       "SELECT addressbook_id, addressbook_name, account_id, mode, last_sync_ver "
+                       "FROM "CTS_TABLE_ADDRESSBOOKS);
 
        len += snprintf(query+len, sizeof(query)-len,
-                               " ORDER BY account_id, addressbook_id");
+                       " ORDER BY account_id, addressbook_id");
 
        if (0 != limit) {
                len += snprintf(query+len, sizeof(query)-len, " LIMIT %d", limit);
@@ -393,13 +369,13 @@ static int __ctsvc_db_addressbook_get_all_records(int offset, int limit,
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -415,7 +391,7 @@ static int __ctsvc_db_addressbook_get_all_records(int offset, int limit,
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_addressbook_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_hout_list)
+static int __ctsvc_db_addressbook_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h *out_list)
 {
        int ret;
        int i;
@@ -426,7 +402,7 @@ static int __ctsvc_db_addressbook_get_records_with_query(contacts_query_h query,
        ctsvc_addressbook_s *addressbook;
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        ret = ctsvc_db_make_get_records_query_stmt(s_query, offset, limit, &stmt);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_db_make_get_records_query_stmt fail(%d)", ret);
@@ -435,7 +411,7 @@ static int __ctsvc_db_addressbook_get_records_with_query(contacts_query_h query,
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -443,9 +419,9 @@ static int __ctsvc_db_addressbook_get_records_with_query(contacts_query_h query,
 
                contacts_record_create(_contacts_address_book._uri, &record);
                addressbook = (ctsvc_addressbook_s*)record;
-               if (0 == s_query->projection_count)
+               if (0 == s_query->projection_count) {
                        field_count = s_query->property_count;
-               else {
+               else {
                        field_count = s_query->projection_count;
                        ret = ctsvc_record_set_projection_flags(record, s_query->projection,
                                        s_query->projection_count, s_query->property_count);
@@ -454,7 +430,7 @@ static int __ctsvc_db_addressbook_get_records_with_query(contacts_query_h query,
                                ASSERT_NOT_REACHED("To set projection is Fail.\n");
                }
 
-               for (i=0;i<field_count;i++) {
+               for (i = 0; i < field_count; i++) {
                        char *temp;
                        int property_id;
                        if (0 == s_query->projection_count)
@@ -462,7 +438,7 @@ static int __ctsvc_db_addressbook_get_records_with_query(contacts_query_h query,
                        else
                                property_id = s_query->projection[i];
 
-                       switch(property_id) {
+                       switch (property_id) {
                        case CTSVC_PROPERTY_ADDRESSBOOK_ID:
                                addressbook->id = ctsvc_stmt_get_int(stmt, i);
                                break;
@@ -491,3 +467,20 @@ static int __ctsvc_db_addressbook_get_records_with_query(contacts_query_h query,
        return CONTACTS_ERROR_NONE;
 }
 
+ctsvc_db_plugin_info_s ctsvc_db_plugin_addressbook = {
+       .is_query_only = false,
+       .insert_record = __ctsvc_db_addressbook_insert_record,
+       .get_record = __ctsvc_db_addressbook_get_record,
+       .update_record = __ctsvc_db_addressbook_update_record,
+       .delete_record = __ctsvc_db_addressbook_delete_record,
+       .get_all_records = __ctsvc_db_addressbook_get_all_records,
+       .get_records_with_query = __ctsvc_db_addressbook_get_records_with_query,
+       .insert_records = NULL,
+       .update_records = NULL,
+       .delete_records = NULL,
+       .get_count = NULL,
+       .get_count_with_query = NULL,
+       .replace_record = NULL,
+       .replace_records = NULL,
+};
+
index 9aa4f2b..9293222 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_db_sqlite.h"
@@ -35,14 +34,14 @@ int ctsvc_addressbook_reset_internal_addressbook(void)
        int version;
 
        ret = ctsvc_begin_trans();
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "DB error : ctsvc_begin_trans() Fail(%d)", ret);
+       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "ctsvc_begin_trans() Fail(%d)", ret);
 
        ret = ctsvc_is_owner(0);
        if (CONTACTS_ERROR_NONE != ret) {
                if (CONTACTS_ERROR_PERMISSION_DENIED == ret)
-                       CTS_ERR("Does not have permission of address_book (0)");
+                       ERR("Does not have permission of address_book (0)");
                else
-                       CTS_ERR("ctsvc_is_owner Fail(%d)", ret);
+                       ERR("ctsvc_is_owner Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -56,7 +55,7 @@ int ctsvc_addressbook_reset_internal_addressbook(void)
        do {
                ret = ctsvc_query_exec(query);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("DB error : ctsvc_query_exec() Fail(%d)", ret);
+                       ERR("ctsvc_query_exec() Fail(%d)", ret);
                        break;
                }
 
@@ -65,7 +64,7 @@ int ctsvc_addressbook_reset_internal_addressbook(void)
 
                ret = ctsvc_query_exec(query);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("DB error : ctsvc_query_exec() Fail(%d)", ret);
+                       ERR("ctsvc_query_exec() Fail(%d)", ret);
                        break;
                }
 
@@ -73,7 +72,7 @@ int ctsvc_addressbook_reset_internal_addressbook(void)
                                CTS_TABLE_GROUPS, 0 /*CTS_ADDRESSBOOK_INTERNAL*/);
                ret = ctsvc_query_exec(query);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("DB error : ctsvc_query_exec() Fail(%d)", ret);
+                       ERR("ctsvc_query_exec() Fail(%d)", ret);
                        break;
                }
 
@@ -81,7 +80,7 @@ int ctsvc_addressbook_reset_internal_addressbook(void)
                                CTS_TABLE_GROUP_DELETEDS, 0 /*CTS_ADDRESSBOOK_INTERNAL*/);
                ret = ctsvc_query_exec(query);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("DB error : ctsvc_query_exec() Fail(%d)", ret);
+                       ERR("ctsvc_query_exec() Fail(%d)", ret);
                        break;
                }
 
@@ -89,13 +88,13 @@ int ctsvc_addressbook_reset_internal_addressbook(void)
                                CTS_TABLE_DELETEDS, 0 /*CTS_ADDRESSBOOK_INTERNAL*/);
                ret = ctsvc_query_exec(query);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("DB error : ctsvc_query_exec() Fail(%d)", ret);
+                       ERR("ctsvc_query_exec() Fail(%d)", ret);
                        break;
                }
 
                ret = ctsvc_person_do_garbage_collection();
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("DB error : ctsvc_person_garbagecollection() Fail(%d)", ret);
+                       ERR("ctsvc_person_garbagecollection() Fail(%d)", ret);
                        break;
                }
 
@@ -105,7 +104,7 @@ int ctsvc_addressbook_reset_internal_addressbook(void)
                ctsvc_set_group_noti();
                ret = ctsvc_end_trans(true);
                if (ret < CONTACTS_ERROR_NONE) {
-                       CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+                       ERR("ctsvc_end_trans() Fail(%d)", ret);
                        return ret;
                }
 
@@ -128,13 +127,13 @@ int ctsvc_addressbook_delete(int account_id)
 
        /* delete addressbook whish has account_id */
        ret = ctsvc_begin_trans();
-       RETVM_IF (CONTACTS_ERROR_NONE != ret, ret, "ctsvc_begin_trans() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_begin_trans() Fail(%d)", ret);
 
        snprintf(query, sizeof(query), "SELECT addressbook_id FROM %s WHERE account_id = %d",
                        CTS_TABLE_ADDRESSBOOKS, account_id);
        ret = ctsvc_query_get_first_int_result(query, &addressbook_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_query_get_first_int_result() Fail(%d)", ret);
+               ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -152,7 +151,7 @@ int ctsvc_addressbook_delete(int account_id)
                        CTS_TABLE_ADDRESSBOOKS, account_id);
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -164,16 +163,15 @@ int ctsvc_addressbook_delete(int account_id)
                /* person noti will set in ctsvc_person_do_garbage_collection : ctsvc_set_person_noti(); */
                ctsvc_set_group_noti();
                ctsvc_set_addressbook_noti();
-       }
-       else {
-               CTS_ERR("There is no addressbook which has account_id (%d)", account_id);
+       } else {
+               ERR("There is no addressbook which has account_id (%d)", account_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_NO_DATA;
        }
 
        ret = ctsvc_person_do_garbage_collection();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_person_garbagecollection() Fail(%d)", ret);
+               ERR("ctsvc_person_garbagecollection() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
index b6067fa..2e193cd 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #ifndef __CTSVC_DB_PLUGIN_ADDRESS_BOOK_HELPER_H__
 #define __CTSVC_DB_PLUGIN_ADDRESS_BOOK_HELPER_H__
 
index e10702e..a0eae4d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include <unistd.h>
 
 #include "contacts.h"
 #include "ctsvc_db_query.h"
 #include "ctsvc_list.h"
 
-static int __ctsvc_db_company_insert_record(contacts_record_h record, int *id);
-static int __ctsvc_db_company_get_record(int id, contacts_record_h* out_record);
-static int __ctsvc_db_company_update_record(contacts_record_h record);
-static int __ctsvc_db_company_delete_record(int id);
-static int __ctsvc_db_company_get_all_records(int offset, int limit, contacts_list_h* out_list);
-static int __ctsvc_db_company_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h* out_list);
-
-ctsvc_db_plugin_info_s ctsvc_db_plugin_company = {
-       .is_query_only = false,
-       .insert_record = __ctsvc_db_company_insert_record,
-       .get_record = __ctsvc_db_company_get_record,
-       .update_record = __ctsvc_db_company_update_record,
-       .delete_record = __ctsvc_db_company_delete_record,
-       .get_all_records = __ctsvc_db_company_get_all_records,
-       .get_records_with_query = __ctsvc_db_company_get_records_with_query,
-       .insert_records = NULL,
-       .update_records = NULL,
-       .delete_records = NULL,
-       .get_count = NULL,
-       .get_count_with_query = NULL,
-       .replace_record = NULL,
-       .replace_records = NULL,
-};
 
-static int __ctsvc_db_company_get_record(int id, contacts_record_hout_record)
+static int __ctsvc_db_company_get_record(int id, contacts_record_h *out_record)
 {
        int ret;
        cts_stmt stmt = NULL;
@@ -68,18 +44,18 @@ static int __ctsvc_db_company_get_record(int id, contacts_record_h* out_record)
 
        snprintf(query, sizeof(query),
                        "SELECT id, data.contact_id, is_default, data1, data2, "
-                               "data3, data4, data5, data6, data7, data8, data9, data10, data11, data12 "
-                               "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                               "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                               "WHERE id = %d AND datatype = %d ",
-                               id, CTSVC_DATA_COMPANY);
+                       "data3, data4, data5, data6, data7, data8, data9, data10, data11, data12 "
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE id = %d AND datatype = %d ",
+                       id, CTSVC_DATA_COMPANY);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/ != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
@@ -98,16 +74,16 @@ static int __ctsvc_db_company_insert_record(contacts_record_h record, int *id)
        int ret;
        int addressbook_id;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_company_s *company = (ctsvc_company_s *)record;
+       ctsvc_company_s *company = (ctsvc_company_s*)record;
 
        RETVM_IF(NULL == company->name && NULL == company->department && NULL == company->job_title
-               && NULL == company->role && NULL == company->assistant_name && NULL == company->logo
-               && NULL == company->location && NULL == company->description && NULL == company->phonetic_name,
-               CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : company is NULL");
+                       && NULL == company->role && NULL == company->assistant_name && NULL == company->logo
+                       && NULL == company->location && NULL == company->description && NULL == company->phonetic_name,
+                       CONTACTS_ERROR_INVALID_PARAMETER, "company is NULL");
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -117,24 +93,23 @@ static int __ctsvc_db_company_insert_record(contacts_record_h record, int *id)
        if (CONTACTS_ERROR_NONE != ret) {
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NO_DATA == ret) {
-                       CTS_ERR("No data : contact_id (%d) is not exist", company->contact_id);
+                       ERR("No data : contact_id (%d) is not exist", company->contact_id);
                        return CONTACTS_ERROR_INVALID_PARAMETER;
-               }
-               else {
-                       CTS_ERR("ctsvc_query_get_first_int_result Fail(%d)", ret);
+               } else {
+                       ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                        return ret;
                }
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this company record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this company record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_company_insert(record, company->contact_id, false, id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -143,7 +118,7 @@ static int __ctsvc_db_company_insert_record(contacts_record_h record, int *id)
 
        ret = ctsvc_db_contact_update_changed_time(company->contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -151,11 +126,11 @@ static int __ctsvc_db_company_insert_record(contacts_record_h record, int *id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
 static int __ctsvc_db_company_update_record(contacts_record_h record)
@@ -163,7 +138,7 @@ static int __ctsvc_db_company_update_record(contacts_record_h record)
        int ret;
        int addressbook_id;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_company_s *company = (ctsvc_company_s *)record;
+       ctsvc_company_s *company = (ctsvc_company_s*)record;
 
        RETVM_IF(NULL == company->name && NULL == company->department &&        NULL == company->job_title &&
                        NULL == company->role && NULL == company->assistant_name && NULL == company->logo &&
@@ -172,7 +147,7 @@ static int __ctsvc_db_company_update_record(contacts_record_h record)
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -180,20 +155,20 @@ static int __ctsvc_db_company_update_record(contacts_record_h record)
                        "SELECT addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", company->contact_id);
        ret = ctsvc_query_get_first_int_result(query, &addressbook_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("No data : contact_id (%d) is not exist", company->contact_id);
+               ERR("No data : contact_id (%d) is not exist", company->contact_id);
                ctsvc_end_trans(false);
                return ret;
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this company record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this company record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_company_update(record, company->contact_id, false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("Update record Fail(%d)", ret);
+               ERR("Update record Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -202,7 +177,7 @@ static int __ctsvc_db_company_update_record(contacts_record_h record)
 
        ret = ctsvc_db_contact_update_changed_time(company->contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -210,11 +185,11 @@ static int __ctsvc_db_company_update_record(contacts_record_h record)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
 
@@ -228,22 +203,22 @@ static int __ctsvc_db_company_delete_record(int id)
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
        snprintf(query, sizeof(query),
                        "SELECT contact_id, addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" "
-                               "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id);
+                       "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id);
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare Fail(%d)", ret);
+               ERR("ctsvc_query_prepare Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
        ret = ctsvc_stmt_step(stmt);
        if (1 != ret) {
-               CTS_ERR("The id(%d) is Invalid(%d)", id, ret);
+               ERR("The id(%d) is Invalid(%d)", id, ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NONE == ret)
@@ -257,14 +232,14 @@ static int __ctsvc_db_company_delete_record(int id)
        ctsvc_stmt_finalize(stmt);
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to delete this company record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to delete this company record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_company_delete(id, false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -273,7 +248,7 @@ static int __ctsvc_db_company_delete_record(int id)
 
        ret = ctsvc_db_contact_update_changed_time(contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -281,14 +256,14 @@ static int __ctsvc_db_company_delete_record(int id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
-static int __ctsvc_db_company_get_all_records(int offset, int limit, contacts_list_hout_list)
+static int __ctsvc_db_company_get_all_records(int offset, int limit, contacts_list_h *out_list)
 {
        int len;
        int ret;
@@ -299,11 +274,11 @@ static int __ctsvc_db_company_get_all_records(int offset, int limit, contacts_li
 
        len = snprintf(query, sizeof(query),
                        "SELECT id, data.contact_id, is_default, data1, data2, "
-                               "data3, data4, data5, data6, data7, data8, data9, data10, data11, data12 "
-                               "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                               "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                               "WHERE datatype=%d AND is_my_profile=0 ",
-                               CTSVC_DATA_COMPANY);
+                       "data3, data4, data5, data6, data7, data8, data9, data10, data11, data12 "
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE datatype=%d AND is_my_profile=0 ",
+                       CTSVC_DATA_COMPANY);
 
        if (0 != limit) {
                len += snprintf(query+len, sizeof(query)-len, " LIMIT %d", limit);
@@ -312,12 +287,12 @@ static int __ctsvc_db_company_get_all_records(int offset, int limit, contacts_li
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                if (1 /*CTS_TRUE */ != ret) {
-                       CTS_ERR("DB : ctsvc_stmt_step fail(%d)", ret);
+                       ERR("DB : ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -333,7 +308,7 @@ static int __ctsvc_db_company_get_all_records(int offset, int limit, contacts_li
 }
 
 static int __ctsvc_db_company_get_records_with_query(contacts_query_h query, int offset,
-               int limit, contacts_list_hout_list)
+               int limit, contacts_list_h *out_list)
 {
        int ret;
        int i;
@@ -344,7 +319,7 @@ static int __ctsvc_db_company_get_records_with_query(contacts_query_h query, int
        ctsvc_company_s *company;
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        ret = ctsvc_db_make_get_records_query_stmt(s_query, offset, limit, &stmt);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_db_make_get_records_query_stmt fail(%d)", ret);
@@ -353,7 +328,7 @@ static int __ctsvc_db_company_get_records_with_query(contacts_query_h query, int
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 /*CTS_TRUE */ != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -361,9 +336,9 @@ static int __ctsvc_db_company_get_records_with_query(contacts_query_h query, int
 
                contacts_record_create(_contacts_company._uri, &record);
                company = (ctsvc_company_s*)record;
-               if (0 == s_query->projection_count)
+               if (0 == s_query->projection_count) {
                        field_count = s_query->property_count;
-               else {
+               else {
                        field_count = s_query->projection_count;
                        ret = ctsvc_record_set_projection_flags(record, s_query->projection,
                                        s_query->projection_count, s_query->property_count);
@@ -372,7 +347,7 @@ static int __ctsvc_db_company_get_records_with_query(contacts_query_h query, int
                                ASSERT_NOT_REACHED("To set projection is Fail.\n");
                }
 
-               for (i=0;i<field_count;i++) {
+               for (i = 0; i < field_count; i++) {
                        char *temp;
                        int property_id;
                        if (0 == s_query->projection_count)
@@ -380,7 +355,7 @@ static int __ctsvc_db_company_get_records_with_query(contacts_query_h query, int
                        else
                                property_id = s_query->projection[i];
 
-                       switch(property_id) {
+                       switch (property_id) {
                        case CTSVC_PROPERTY_COMPANY_ID:
                                company->id = ctsvc_stmt_get_int(stmt, i);
                                break;
@@ -452,3 +427,21 @@ static int __ctsvc_db_company_get_records_with_query(contacts_query_h query, int
        *out_list = list;
        return CONTACTS_ERROR_NONE;
 }
+
+ctsvc_db_plugin_info_s ctsvc_db_plugin_company = {
+       .is_query_only = false,
+       .insert_record = __ctsvc_db_company_insert_record,
+       .get_record = __ctsvc_db_company_get_record,
+       .update_record = __ctsvc_db_company_update_record,
+       .delete_record = __ctsvc_db_company_delete_record,
+       .get_all_records = __ctsvc_db_company_get_all_records,
+       .get_records_with_query = __ctsvc_db_company_get_records_with_query,
+       .insert_records = NULL,
+       .update_records = NULL,
+       .delete_records = NULL,
+       .get_count = NULL,
+       .get_count_with_query = NULL,
+       .replace_record = NULL,
+       .replace_records = NULL,
+};
+
index 2c7f1f0..88077d2 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include <ctype.h>
 #include <unistd.h>
 
@@ -30,8 +29,8 @@
 #include "ctsvc_db_plugin_company_helper.h"
 #include "ctsvc_record.h"
 #include "ctsvc_notification.h"
-#include "ctsvc_db_access_control.h"
 #include "ctsvc_notify.h"
+#include "ctsvc_db_access_control.h"
 
 static int __ctsvc_company_bind_stmt(cts_stmt stmt, ctsvc_company_s *company, int start_cnt)
 {
@@ -39,10 +38,10 @@ static int __ctsvc_company_bind_stmt(cts_stmt stmt, ctsvc_company_s *company, in
        ctsvc_stmt_bind_int(stmt, start_cnt+1, company->type);
        if (company->label)
                sqlite3_bind_text(stmt, start_cnt+2, company->label,
-                       strlen(company->label), SQLITE_STATIC);
+                               strlen(company->label), SQLITE_STATIC);
        if (company->name)
                sqlite3_bind_text(stmt, start_cnt+3, company->name,
-                       strlen(company->name), SQLITE_STATIC);
+                               strlen(company->name), SQLITE_STATIC);
        if (company->department)
                sqlite3_bind_text(stmt, start_cnt+4, company->department,
                                strlen(company->department), SQLITE_STATIC);
@@ -54,19 +53,19 @@ static int __ctsvc_company_bind_stmt(cts_stmt stmt, ctsvc_company_s *company, in
                                strlen(company->role), SQLITE_STATIC);
        if (company->assistant_name)
                sqlite3_bind_text(stmt, start_cnt+7, company->assistant_name,
-                       strlen(company->assistant_name), SQLITE_STATIC);
+                               strlen(company->assistant_name), SQLITE_STATIC);
 
        /* skip logo here */
 
        if (company->location)
                sqlite3_bind_text(stmt, start_cnt+9, company->location,
-                       strlen(company->location), SQLITE_STATIC);
+                               strlen(company->location), SQLITE_STATIC);
        if (company->description)
                sqlite3_bind_text(stmt, start_cnt+10, company->description,
-                       strlen(company->description), SQLITE_STATIC);
+                               strlen(company->description), SQLITE_STATIC);
        if (company->phonetic_name)
                sqlite3_bind_text(stmt, start_cnt+11, company->phonetic_name,
-                       strlen(company->phonetic_name), SQLITE_STATIC);
+                               strlen(company->phonetic_name), SQLITE_STATIC);
 
        return CONTACTS_ERROR_NONE;
 }
@@ -80,9 +79,9 @@ int ctsvc_db_company_insert(contacts_record_h record, int contact_id, bool is_my
        char query[CTS_SQL_MAX_LEN] = {0};
 
        RETVM_IF(contact_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : contact_id(%d) is mandatory field to insert company record ", company->contact_id);
+                       "contact_id(%d) is mandatory field to insert company record ", company->contact_id);
        RETVM_IF(0 < company->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : id(%d), This record is already inserted", company->id);
+                       "id(%d), This record is already inserted", company->id);
 
        if (company->name || company->department || company->job_title || company->role
                        || company->assistant_name || company->logo || company->location || company->description
@@ -90,34 +89,34 @@ int ctsvc_db_company_insert(contacts_record_h record, int contact_id, bool is_my
 
                ret = ctsvc_db_get_next_id(CTS_TABLE_DATA);
                if (ret < CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_db_get_next_id() Fail(%d)", ret);
+                       ERR("ctsvc_db_get_next_id() Fail(%d)", ret);
                        ctsvc_end_trans(false);
                        return ret;
                }
                company_id = ret;
 
                snprintf(query, sizeof(query),
-                       "INSERT INTO "CTS_TABLE_DATA"(id, contact_id, is_my_profile, datatype, is_default, data1, data2, data3, data4, "
-                                       "data5, data6, data7, data8, data9, data10, data11, data12) "
-                                       "VALUES(%d, %d, %d, %d, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
-                                       company_id, contact_id, is_my_profile, CTSVC_DATA_COMPANY);
+                               "INSERT INTO "CTS_TABLE_DATA"(id, contact_id, is_my_profile, datatype, is_default, data1, data2, data3, data4, "
+                               "data5, data6, data7, data8, data9, data10, data11, data12) "
+                               "VALUES(%d, %d, %d, %d, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
+                               company_id, contact_id, is_my_profile, CTSVC_DATA_COMPANY);
 
                ret = ctsvc_query_prepare(query, &stmt);
-               RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
                __ctsvc_company_bind_stmt(stmt, company, 1);
                if (company->logo) {
                        char image[CTSVC_IMG_FULL_PATH_SIZE_MAX] = {0};
                        ret = ctsvc_have_file_read_permission(company->logo);
                        if (ret != CONTACTS_ERROR_NONE) {
-                               CTS_ERR("ctsvc_have_file_read_permission Fail(%d)", ret);
+                               ERR("ctsvc_have_file_read_permission Fail(%d)", ret);
                                ctsvc_stmt_finalize(stmt);
                                return ret;
                        }
                        ctsvc_utils_make_image_file_name(contact_id, company_id, company->logo, image, sizeof(image));
                        ret = ctsvc_utils_copy_image(CTS_LOGO_IMAGE_LOCATION, company->logo, image);
                        if (CONTACTS_ERROR_NONE != ret) {
-                               CTS_ERR("ctsvc_utils_copy_image() Fail(%d)", ret);
+                               ERR("ctsvc_utils_copy_image() Fail(%d)", ret);
                                ctsvc_stmt_finalize(stmt);
                                return ret;
                        }
@@ -126,7 +125,7 @@ int ctsvc_db_company_insert(contacts_record_h record, int contact_id, bool is_my
 
                ret = ctsvc_stmt_step(stmt);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        return ret;
                }
@@ -148,7 +147,7 @@ int ctsvc_db_company_get_value_from_stmt(cts_stmt stmt, contacts_record_h *recor
        char *temp;
        ctsvc_company_s *company;
 
-       ret = contacts_record_create(_contacts_company._uri, (contacts_record_h *)&company);
+       ret = contacts_record_create(_contacts_company._uri, (contacts_record_h*)&company);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "contacts_record_create Fail(%d)", ret);
 
        company->id = ctsvc_stmt_get_int(stmt, start_count++);
@@ -182,9 +181,9 @@ int ctsvc_db_company_get_value_from_stmt(cts_stmt stmt, contacts_record_h *recor
 
        if (company->name || company->department || company->job_title || company->role
                        || company->assistant_name || company->logo || company->location || company->description
-                       || company->phonetic_name)
+                       || company->phonetic_name) {
                *record = (contacts_record_h)company;
-       else {
+       else {
                contacts_record_destroy((contacts_record_h)company, true);
                *record = NULL;
        }
@@ -194,7 +193,7 @@ int ctsvc_db_company_get_value_from_stmt(cts_stmt stmt, contacts_record_h *recor
 int ctsvc_db_company_update(contacts_record_h record, int contact_id, bool is_my_profile)
 {
        int ret = CONTACTS_ERROR_NONE;
-       charset = NULL;
+       char *set = NULL;
        GSList *bind_text = NULL;
        GSList *cursor = NULL;
        char query[CTS_SQL_MAX_LEN] = {0};
@@ -207,7 +206,7 @@ int ctsvc_db_company_update(contacts_record_h record, int contact_id, bool is_my
        snprintf(query, sizeof(query),
                        "SELECT id, data8 FROM "CTS_TABLE_DATA" WHERE id = %d", company->id);
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (ret != 1) {
@@ -218,7 +217,7 @@ int ctsvc_db_company_update(contacts_record_h record, int contact_id, bool is_my
                        return ret;
        }
 
-       if (ctsvc_record_check_property_flag((ctsvc_record_s *)company, _contacts_company.logo, CTSVC_PROPERTY_FLAG_DIRTY)) {
+       if (ctsvc_record_check_property_flag((ctsvc_record_s*)company, _contacts_company.logo, CTSVC_PROPERTY_FLAG_DIRTY)) {
                char *logo = ctsvc_stmt_get_text(stmt, 1);
                bool same = false;
                bool check_permission = false;
@@ -229,23 +228,21 @@ int ctsvc_db_company_update(contacts_record_h record, int contact_id, bool is_my
                        snprintf(full_path, sizeof(full_path), "%s/%s", CTS_LOGO_IMAGE_LOCATION, logo);
                        if (company->logo && STRING_EQUAL == strcmp(company->logo, full_path)) {
                                int index = _contacts_company.logo & 0x000000FF;
-                               ((ctsvc_record_s *)record)->properties_flags[index] = 0;
+                               ((ctsvc_record_s*)record)->properties_flags[index] = 0;
                                same = true;
-                       }
-                       else {
+                       } else {
                                if (company->logo) {
                                        ret = ctsvc_have_file_read_permission(company->logo);
                                        if (ret != CONTACTS_ERROR_NONE) {
-                                               CTS_ERR("ctsvc_have_file_read_permission Fail(%d)", ret);
+                                               ERR("ctsvc_have_file_read_permission Fail(%d)", ret);
                                                ctsvc_stmt_finalize(stmt);
                                                return ret;
                                        }
                                        check_permission = true;
                                }
                                ret = unlink(full_path);
-                               if (ret < 0) {
-                                       CTS_WARN("unlink Fail(%d)", errno);
-                               }
+                               if (ret < 0)
+                                       WARN("unlink() Fail(%d)", errno);
                        }
                }
 
@@ -255,7 +252,7 @@ int ctsvc_db_company_update(contacts_record_h record, int contact_id, bool is_my
                        if (false == check_permission) {
                                ret = ctsvc_have_file_read_permission(company->logo);
                                if (ret != CONTACTS_ERROR_NONE) {
-                                       CTS_ERR("ctsvc_have_file_read_permission Fail(%d)", ret);
+                                       ERR("ctsvc_have_file_read_permission Fail(%d)", ret);
                                        ctsvc_stmt_finalize(stmt);
                                        return ret;
                                }
@@ -263,7 +260,7 @@ int ctsvc_db_company_update(contacts_record_h record, int contact_id, bool is_my
                        ctsvc_utils_make_image_file_name(contact_id, company->id, company->logo, dest, sizeof(dest));
                        ret = ctsvc_utils_copy_image(CTS_LOGO_IMAGE_LOCATION, company->logo, dest);
                        if (CONTACTS_ERROR_NONE != ret) {
-                               CTS_ERR("cts_copy_file() Fail(%d)", ret);
+                               ERR("cts_copy_file() Fail(%d)", ret);
                                ctsvc_stmt_finalize(stmt);
                                return ret;
                        }
@@ -280,11 +277,14 @@ int ctsvc_db_company_update(contacts_record_h record, int contact_id, bool is_my
                        ctsvc_set_company_noti();
        } while (0);
 
-       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s *)record);
-       CONTACTS_FREE(set);
+       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s*)record);
+       free(set);
+
        if (bind_text) {
-               for (cursor=bind_text;cursor;cursor=cursor->next)
-                       CONTACTS_FREE(cursor->data);
+               for (cursor = bind_text; cursor; cursor = cursor->next) {
+                       free(cursor->data);
+                       cursor->data = NULL;
+               }
                g_slist_free(bind_text);
        }
 
@@ -311,10 +311,10 @@ int ctsvc_db_company_delete(int id, bool is_my_profile)
  * Whenever deleting company record in data table, this function will be called
  * in order to delete company logo image file
  */
-void ctsvc_db_company_delete_callback(sqlite3_context *context, int argc, sqlite3_value ** argv)
+void ctsvc_db_company_delete_callback(sqlite3_context *context, int argc, sqlite3_value **argv)
 {
        int ret;
-       const unsigned charlogo_path;
+       const unsigned char *logo_path;
 
        if (1 < argc) {
                sqlite3_result_null(context);
@@ -326,9 +326,8 @@ void ctsvc_db_company_delete_callback(sqlite3_context *context, int argc, sqlite
                char full_path[CTSVC_IMG_FULL_PATH_SIZE_MAX] = {0};
                snprintf(full_path, sizeof(full_path), "%s/%s", CTS_LOGO_IMAGE_LOCATION, logo_path);
                ret = unlink(full_path);
-               if (ret < 0) {
-                       CTS_WARN("unlink Fail(%d)", errno);
-               }
+               if (ret < 0)
+                       WARN("unlink() Fail(%d)", errno);
        }
 
        return;
index b1ee5ab..b8ac8b0 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #ifndef __CTSVC_DB_PLUGIN_COMPANY_HELPER_H__
 #define __CTSVC_DB_PLUGIN_COMPANY_HELPER_H__
 
 #include "contacts.h"
 #include "ctsvc_db_sqlite.h"
-#include <tzplatform_config.h>
 
-int ctsvc_db_company_insert(contacts_record_h record, int contact_id, bool is_my_profile, int *id);
+int ctsvc_db_company_insert(contacts_record_h record, int contact_id, bool is_my_profile,
+               int *id);
 int ctsvc_db_company_update(contacts_record_h record, int contact_id, bool is_my_profile);
 int ctsvc_db_company_delete(int id, bool is_my_profile);
-int ctsvc_db_company_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record, int start_count);
-void ctsvc_db_company_delete_callback(sqlite3_context *context, int argc, sqlite3_value ** argv);
+int ctsvc_db_company_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record,
+               int start_count);
+void ctsvc_db_company_delete_callback(sqlite3_context *context, int argc,
+               sqlite3_value **argv);
 
 #endif /* __CTSVC_DB_PLUGIN_COMPANY_HELPER_H__ */
index 73ea1ec..3cfbd1c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
 #include "ctsvc_db_plugin_contact_helper.h"
 #include "ctsvc_db_plugin_person_helper.h"
 
-static int __ctsvc_db_contact_insert_record(contacts_record_h record, int *id);
-static int __ctsvc_db_contact_get_record(int id, contacts_record_h* out_record);
-static int __ctsvc_db_contact_update_record(contacts_record_h record);
-static int __ctsvc_db_contact_delete_record(int id);
-static int __ctsvc_db_contact_replace_record(contacts_record_h record, int id);
-
-static int __ctsvc_db_contact_get_all_records(int offset, int limit, contacts_list_h* out_list);
-static int __ctsvc_db_contact_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h* out_list);
-
-ctsvc_db_plugin_info_s ctsvc_db_plugin_contact = {
-       .is_query_only = false,
-       .insert_record = __ctsvc_db_contact_insert_record,
-       .get_record = __ctsvc_db_contact_get_record,
-       .update_record = __ctsvc_db_contact_update_record,
-       .delete_record = __ctsvc_db_contact_delete_record,
-       .get_all_records = __ctsvc_db_contact_get_all_records,
-       .get_records_with_query = __ctsvc_db_contact_get_records_with_query,
-       .insert_records = NULL,
-       .update_records = NULL,
-       .delete_records = NULL,
-       .get_count = NULL,
-       .get_count_with_query = NULL,
-       .replace_record = __ctsvc_db_contact_replace_record,
-       .replace_records = NULL,
-};
 
 static int __ctsvc_db_get_contact_base_info(int id, ctsvc_contact_s *contact)
 {
@@ -84,19 +59,19 @@ static int __ctsvc_db_get_contact_base_info(int id, ctsvc_contact_s *contact)
 
        snprintf(query, sizeof(query),
                        "SELECT contact_id, addressbook_id, person_id, changed_time, changed_ver, link_mode, %s, "
-                               "display_name_source, image_thumbnail_path, "
-                               "ringtone_path, vibration, message_alert, "
-                               "uid, is_favorite, has_phonenumber, has_email, "
-                               "sort_name, reverse_sort_name "
-                               "FROM "CTS_TABLE_CONTACTS" WHERE contact_id = %d AND deleted = 0",
-                               ctsvc_get_display_column(), id);
+                       "display_name_source, image_thumbnail_path, "
+                       "ringtone_path, vibration, message_alert, "
+                       "uid, is_favorite, has_phonenumber, has_email, "
+                       "sort_name, reverse_sort_name "
+                       "FROM "CTS_TABLE_CONTACTS" WHERE contact_id = %d AND deleted = 0",
+                       ctsvc_get_display_column(), id);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/ != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
@@ -149,19 +124,19 @@ static int __ctsvc_db_get_data(int id, ctsvc_contact_s *contact)
        char query[CTS_SQL_MAX_LEN] = {0};
 
        snprintf(query, sizeof(query),
-                               "SELECT datatype, id, data.contact_id, is_default, data1, data2, "
-                                       "data3, data4, data5, data6, data7, data8, data9, data10, data11, data12 "
-                                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                                       "WHERE data.contact_id = %d  AND is_my_profile = 0 "
-                                       "ORDER BY is_default DESC", id);
+                       "SELECT datatype, id, data.contact_id, is_default, data1, data2, "
+                       "data3, data4, data5, data6, data7, data8, data9, data10, data11, data12 "
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE data.contact_id = %d  AND is_my_profile = 0 "
+                       "ORDER BY is_default DESC", id);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE */!= ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                return ret;
        }
@@ -212,7 +187,7 @@ static int __ctsvc_db_get_data(int id, ctsvc_contact_s *contact)
                        ctsvc_get_data_info_extension(stmt, (contacts_list_h)contact->extensions);
                        break;
                default:
-                       CTS_ERR("Intenal : Not supported data type (%d)", datatype);
+                       ERR("Intenal : Not supported data type (%d)", datatype);
                        break;
                }
 
@@ -234,11 +209,11 @@ static inline int __ctsvc_get_contact_grouprel(int contact_id, ctsvc_contact_s *
        char *temp;
 
        snprintf(query, sizeof(query),
-               "SELECT group_id, contact_id, group_name "
+                       "SELECT group_id, contact_id, group_name "
                        " FROM "CTSVC_DB_VIEW_GROUP_RELATION" WHERE contact_id = %d", contact_id);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        while (1 /*CTS_TRUE */ == ctsvc_stmt_step(stmt)) {
                contacts_record_create(_contacts_group_relation._uri, (contacts_record_h*)&grouprel);
@@ -259,7 +234,7 @@ static inline int __ctsvc_get_contact_grouprel(int contact_id, ctsvc_contact_s *
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_contact_get_record(int id, contacts_record_hout_record)
+static int __ctsvc_db_contact_get_record(int id, contacts_record_h *out_record)
 {
        int ret;
        contacts_record_h record;
@@ -269,24 +244,24 @@ static int __ctsvc_db_contact_get_record(int id, contacts_record_h* out_record)
        *out_record = NULL;
 
        contacts_record_create(_contacts_contact._uri, &record);
-       contact = (ctsvc_contact_s *)record;
+       contact = (ctsvc_contact_s*)record;
        ret = __ctsvc_db_get_contact_base_info(id, contact);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("__ctsvc_db_get_contact_base_info(ALL) Fail(%d)", ret);
+               ERR("__ctsvc_db_get_contact_base_info(ALL) Fail(%d)", ret);
                contacts_record_destroy(record, true);
                return ret;
        }
 
        ret = __ctsvc_db_get_data(id, contact);
        if (CONTACTS_ERROR_NONE != ret && CONTACTS_ERROR_NO_DATA != ret) {
-               CTS_ERR("ctsvc_get_data_info Fail(%d)", ret);
+               ERR("ctsvc_get_data_info Fail(%d)", ret);
                contacts_record_destroy(record, true);
                return ret;
        }
 
        ret = __ctsvc_get_contact_grouprel(id, contact);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_get_group_relations Fail(%d)", ret);
+               ERR("ctsvc_get_group_relations Fail(%d)", ret);
                contacts_record_destroy(record, true);
                return ret;
        }
@@ -308,7 +283,7 @@ static inline int __ctsvc_contact_update_data(ctsvc_contact_s *contact)
        if (contact->name) {
                ret = ctsvc_contact_update_data_name((contacts_list_h)contact->name, contact->id, false);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_update_data_name() Fail(%d)", ret);
+                       ERR("ctsvc_contact_update_data_name() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -316,7 +291,7 @@ static inline int __ctsvc_contact_update_data(ctsvc_contact_s *contact)
        if (contact->company) {
                ret = ctsvc_contact_update_data_company((contacts_list_h)contact->company, contact->id, false);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_update_data_company() Fail(%d)", ret);
+                       ERR("ctsvc_contact_update_data_company() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -324,7 +299,7 @@ static inline int __ctsvc_contact_update_data(ctsvc_contact_s *contact)
        if (contact->note) {
                ret = ctsvc_contact_update_data_note((contacts_list_h)contact->note, contact->id, false);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_update_data_note() Fail(%d)", ret);
+                       ERR("ctsvc_contact_update_data_note() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -332,7 +307,7 @@ static inline int __ctsvc_contact_update_data(ctsvc_contact_s *contact)
        if (contact->events) {
                ret = ctsvc_contact_update_data_event((contacts_list_h)contact->events, contact->id, false);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_update_data_events() Fail(%d)", ret);
+                       ERR("ctsvc_contact_update_data_events() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -340,7 +315,7 @@ static inline int __ctsvc_contact_update_data(ctsvc_contact_s *contact)
        if (contact->messengers) {
                ret = ctsvc_contact_update_data_messenger((contacts_list_h)contact->messengers, contact->id, false);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_update_data_messengers() Fail(%d)", ret);
+                       ERR("ctsvc_contact_update_data_messengers() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -348,7 +323,7 @@ static inline int __ctsvc_contact_update_data(ctsvc_contact_s *contact)
        if (contact->postal_addrs) {
                ret = ctsvc_contact_update_data_address((contacts_list_h)contact->postal_addrs, contact->id, false);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_update_data_address() Fail(%d)", ret);
+                       ERR("ctsvc_contact_update_data_address() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -356,7 +331,7 @@ static inline int __ctsvc_contact_update_data(ctsvc_contact_s *contact)
        if (contact->urls) {
                ret = ctsvc_contact_update_data_url((contacts_list_h)contact->urls, contact->id, false);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_update_data_url() Fail(%d)", ret);
+                       ERR("ctsvc_contact_update_data_url() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -364,7 +339,7 @@ static inline int __ctsvc_contact_update_data(ctsvc_contact_s *contact)
        if (contact->nicknames) {
                ret = ctsvc_contact_update_data_nickname((contacts_list_h)contact->nicknames, contact->id, false);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_update_data_nickname() Fail(%d)", ret);
+                       ERR("ctsvc_contact_update_data_nickname() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -373,7 +348,7 @@ static inline int __ctsvc_contact_update_data(ctsvc_contact_s *contact)
                bool had_phonenumber;
                ret = ctsvc_contact_update_data_number((contacts_list_h)contact->numbers, contact->id, false, &had_phonenumber);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_update_data_number() Fail(%d)", ret);
+                       ERR("ctsvc_contact_update_data_number() Fail(%d)", ret);
                        return ret;
                }
                contact->has_phonenumber = had_phonenumber;
@@ -383,7 +358,7 @@ static inline int __ctsvc_contact_update_data(ctsvc_contact_s *contact)
                bool had_email;
                ret = ctsvc_contact_update_data_email((contacts_list_h)contact->emails, contact->id, false, &had_email);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_update_data_email() Fail(%d)", ret);
+                       ERR("ctsvc_contact_update_data_email() Fail(%d)", ret);
                        return ret;
                }
                contact->has_email = had_email;
@@ -392,7 +367,7 @@ static inline int __ctsvc_contact_update_data(ctsvc_contact_s *contact)
        if (contact->profiles) {
                ret = ctsvc_contact_update_data_profile((contacts_list_h)contact->profiles, contact->id, false);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_update_data_profile() Fail(%d)", ret);
+                       ERR("ctsvc_contact_update_data_profile() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -400,7 +375,7 @@ static inline int __ctsvc_contact_update_data(ctsvc_contact_s *contact)
        if (contact->relationships) {
                ret = ctsvc_contact_update_data_relationship((contacts_list_h)contact->relationships, contact->id, false);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_update_data_relationship() Fail(%d)", ret);
+                       ERR("ctsvc_contact_update_data_relationship() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -408,7 +383,7 @@ static inline int __ctsvc_contact_update_data(ctsvc_contact_s *contact)
        if (contact->images) {
                ret = ctsvc_contact_update_data_image((contacts_list_h)contact->images, contact->id, false);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_update_data_image() Fail(%d)", ret);
+                       ERR("ctsvc_contact_update_data_image() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -416,7 +391,7 @@ static inline int __ctsvc_contact_update_data(ctsvc_contact_s *contact)
        if (contact->extensions) {
                ret = ctsvc_contact_update_data_extension((contacts_list_h)contact->extensions, contact->id, false);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_update_data_extension() Fail(%d)", ret);
+                       ERR("ctsvc_contact_update_data_extension() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -448,8 +423,8 @@ static inline int __ctsvc_contact_update_grouprel(int contact_id, contacts_list_
 
        RETV_IF(NULL == group_list, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       for (cursor = list->deleted_records;cursor;cursor=cursor->next) {
-               grouprel = (ctsvc_group_relation_s *)cursor->data;
+       for (cursor = list->deleted_records; cursor; cursor = cursor->next) {
+               grouprel = cursor->data;
                ret = ctsvc_group_remove_contact_in_transaction(grouprel->group_id, contact_id);
                if (0 < ret)
                        rel_changed += ret;
@@ -485,13 +460,13 @@ static bool __ctsvc_contact_check_token(char *src, char *dest, int len)
        bool had = false;
        int i = 0;
 
-       for (i=0;i<len;i++) {
+       for (i = 0; i < len; i++) {
                if (src[i] == '@' || src[i] == '.') {
                        dest[i] = ' ';
                        had = true;
-               }
-               else
+               } else {
                        dest[i] = src[i];
+               }
        }
        dest[i] = '\0';
 
@@ -506,9 +481,9 @@ static inline int __ctsvc_contact_make_search_data(ctsvc_contact_s *contact,
 
        char *number = NULL;
        char *data = NULL;
-       char *temp_number=NULL;
-       char *temp_data=NULL;
-       int buf_size=0;
+       char *temp_number = NULL;
+       char *temp_data = NULL;
+       int buf_size = 0;
 
        RETV_IF(NULL == contact, CONTACTS_ERROR_NO_DATA);
 
@@ -522,7 +497,7 @@ static inline int __ctsvc_contact_make_search_data(ctsvc_contact_s *contact,
                                buf_size = SAFE_STRLEN(number) + SAFE_STRLEN(number_record->cleaned) + SAFE_STRLEN(number_record->normalized) + 3;
                                temp_number = calloc(1, buf_size);
                                if (NULL == temp_number) {
-                                       CTS_ERR("calloc() Fail");
+                                       ERR("calloc() Fail");
                                        free(number);
                                        return CONTACTS_ERROR_OUT_OF_MEMORY;
                                }
@@ -548,19 +523,23 @@ static inline int __ctsvc_contact_make_search_data(ctsvc_contact_s *contact,
                                char temp[len+1];
                                bool had = __ctsvc_contact_check_token(email->email_addr, temp, len);
 
-                               buf_size = SAFE_STRLEN(data) + SAFE_STRLEN(email->email_addr) * (had?2:1) + 4;
+                               buf_size = SAFE_STRLEN(data) + SAFE_STRLEN(email->email_addr)
+                                       * (had ? 2 : 1) + 4;
                                temp_data = calloc(1, buf_size);
                                if (NULL == temp_data) {
-                                       CTS_ERR("calloc() Fail");
+                                       ERR("calloc() Fail");
                                        free(data);
                                        free(number);
                                        return CONTACTS_ERROR_OUT_OF_MEMORY;
                                }
 
-                               if (data)
-                                       snprintf(temp_data, buf_size, "%s %s %s",data, email->email_addr, (had?temp:""));
-                               else
-                                       snprintf(temp_data, buf_size, "%s %s",email->email_addr, (had?temp:""));
+                               if (data) {
+                                       snprintf(temp_data, buf_size, "%s %s %s", data, email->email_addr,
+                                                       (had ? temp : ""));
+                               } else {
+                                       snprintf(temp_data, buf_size, "%s %s", email->email_addr,
+                                                       (had ? temp : ""));
+                               }
                                free(data);
                                data = temp_data;
                        }
@@ -578,19 +557,19 @@ static inline int __ctsvc_contact_make_search_data(ctsvc_contact_s *contact,
                                char temp[len+1];
                                bool had = __ctsvc_contact_check_token(nickname->nickname, temp, len);
 
-                               buf_size = SAFE_STRLEN(data) + SAFE_STRLEN(nickname->nickname) * (had?2:1) + 4;
+                               buf_size = SAFE_STRLEN(data) + SAFE_STRLEN(nickname->nickname) * (had ? 2 : 1) + 4;
                                temp_data = calloc(1, buf_size);
                                if (NULL == temp_data) {
-                                       CTS_ERR("calloc() Fail");
+                                       ERR("calloc() Fail");
                                        free(data);
                                        free(number);
                                        return CONTACTS_ERROR_OUT_OF_MEMORY;
                                }
 
                                if (data)
-                                       snprintf(temp_data, buf_size, "%s %s %s", data, nickname->nickname, (had?temp:""));
+                                       snprintf(temp_data, buf_size, "%s %s %s", data, nickname->nickname, (had ? temp : ""));
                                else
-                                       snprintf(temp_data, buf_size, "%s %s", nickname->nickname, (had?temp:""));
+                                       snprintf(temp_data, buf_size, "%s %s", nickname->nickname, (had ? temp : ""));
                                free(data);
                                data = temp_data;
                        }
@@ -606,18 +585,18 @@ static inline int __ctsvc_contact_make_search_data(ctsvc_contact_s *contact,
                        if (address) {
                                bool had;
                                int str_len = SAFE_STRLEN(address->country)
-                                                       + SAFE_STRLEN(address->pobox)
-                                                       + SAFE_STRLEN(address->postalcode)
-                                                       + SAFE_STRLEN(address->region)
-                                                       + SAFE_STRLEN(address->locality)
-                                                       + SAFE_STRLEN(address->street)
-                                                       + SAFE_STRLEN(address->extended);
+                                       + SAFE_STRLEN(address->pobox)
+                                       + SAFE_STRLEN(address->postalcode)
+                                       + SAFE_STRLEN(address->region)
+                                       + SAFE_STRLEN(address->locality)
+                                       + SAFE_STRLEN(address->street)
+                                       + SAFE_STRLEN(address->extended);
                                len = 0;
                                buf_size = SAFE_STRLEN(data)
-                                                       + str_len * 2 + 16;
+                                       + str_len * 2 + 16;
                                temp_data = calloc(1, buf_size);
                                if (NULL == temp_data) {
-                                       CTS_ERR("calloc() Fail");
+                                       ERR("calloc() Fail");
                                        free(data);
                                        free(number);
                                        return CONTACTS_ERROR_OUT_OF_MEMORY;
@@ -630,31 +609,31 @@ static inline int __ctsvc_contact_make_search_data(ctsvc_contact_s *contact,
 
                                if (address->country) {
                                        had = __ctsvc_contact_check_token(address->country, temp, SAFE_STRLEN(address->country));
-                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", address->country, had?temp:"");
+                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", address->country, had ? temp : "");
                                }
                                if (address->pobox) {
                                        had = __ctsvc_contact_check_token(address->pobox, temp, SAFE_STRLEN(address->pobox));
-                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", address->pobox, had?temp:"");
+                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", address->pobox, had ? temp : "");
                                }
                                if (address->postalcode) {
                                        had = __ctsvc_contact_check_token(address->postalcode, temp, SAFE_STRLEN(address->postalcode));
-                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", address->postalcode, had?temp:"");
+                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", address->postalcode, had ? temp : "");
                                }
                                if (address->region) {
                                        had = __ctsvc_contact_check_token(address->region, temp, SAFE_STRLEN(address->region));
-                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", address->region, had?temp:"");
+                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", address->region, had ? temp : "");
                                }
                                if (address->locality) {
                                        had = __ctsvc_contact_check_token(address->locality, temp, SAFE_STRLEN(address->locality));
-                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", address->locality, had?temp:"");
+                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", address->locality, had ? temp : "");
                                }
                                if (address->street) {
                                        had = __ctsvc_contact_check_token(address->street, temp, SAFE_STRLEN(address->street));
-                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", address->street, had?temp:"");
+                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", address->street, had ? temp : "");
                                }
                                if (address->extended) {
                                        had = __ctsvc_contact_check_token(address->extended, temp, SAFE_STRLEN(address->extended));
-                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", address->extended, had?temp:"");
+                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", address->extended, had ? temp : "");
                                }
                                free(data);
                                data = temp_data;
@@ -673,19 +652,22 @@ static inline int __ctsvc_contact_make_search_data(ctsvc_contact_s *contact,
                                char temp[len+1];
                                bool had = __ctsvc_contact_check_token(note->note, temp, len);
 
-                               buf_size = SAFE_STRLEN(data) + SAFE_STRLEN(note->note) * (had?2:1) + 4;
+                               buf_size = SAFE_STRLEN(data) + SAFE_STRLEN(note->note) * (had ? 2 : 1) + 4;
                                temp_data = calloc(1, buf_size);
                                if (NULL == temp_data) {
-                                       CTS_ERR("calloc() Fail");
+                                       ERR("calloc() Fail");
                                        free(data);
                                        free(number);
                                        return CONTACTS_ERROR_OUT_OF_MEMORY;
                                }
 
-                               if (data)
-                                       snprintf(temp_data, buf_size, "%s %s %s",data, note->note, (had?temp:""));
-                               else
-                                       snprintf(temp_data, buf_size, "%s %s",note->note, (had?temp:""));
+                               if (data) {
+                                       snprintf(temp_data, buf_size, "%s %s %s", data, note->note,
+                                                       (had ? temp : ""));
+                               } else {
+                                       snprintf(temp_data, buf_size, "%s %s", note->note,
+                                                       (had ? temp : ""));
+                               }
                                free(data);
                                data = temp_data;
                        }
@@ -703,19 +685,22 @@ static inline int __ctsvc_contact_make_search_data(ctsvc_contact_s *contact,
                                char temp[len+1];
                                bool had = __ctsvc_contact_check_token(messenger->im_id, temp, len);
 
-                               buf_size = SAFE_STRLEN(data) + SAFE_STRLEN(messenger->im_id) * (had?2:1) + 4;
+                               buf_size = SAFE_STRLEN(data) + SAFE_STRLEN(messenger->im_id) * (had ? 2 : 1) + 4;
                                temp_data = calloc(1, buf_size);
                                if (NULL == temp_data) {
-                                       CTS_ERR("calloc() Fail");
+                                       ERR("calloc() Fail");
                                        free(data);
                                        free(number);
                                        return CONTACTS_ERROR_OUT_OF_MEMORY;
                                }
 
-                               if (data)
-                                       snprintf(temp_data, buf_size, "%s %s %s",data, messenger->im_id, (had?temp:""));
-                               else
-                                       snprintf(temp_data, buf_size, "%s %s",messenger->im_id, (had?temp:""));
+                               if (data) {
+                                       snprintf(temp_data, buf_size, "%s %s %s", data, messenger->im_id,
+                                                       (had ? temp : ""));
+                               } else {
+                                       snprintf(temp_data, buf_size, "%s %s", messenger->im_id,
+                                                       (had ? temp : ""));
+                               }
                                free(data);
                                data = temp_data;
                        }
@@ -733,19 +718,22 @@ static inline int __ctsvc_contact_make_search_data(ctsvc_contact_s *contact,
                                char temp[len+1];
                                bool had = __ctsvc_contact_check_token(relationship->name, temp, len);
 
-                               buf_size = SAFE_STRLEN(data) + SAFE_STRLEN(relationship->name) * (had?2:1) + 4;
+                               buf_size = SAFE_STRLEN(data) + SAFE_STRLEN(relationship->name) * (had ? 2 : 1) + 4;
                                temp_data = calloc(1, buf_size);
                                if (NULL == temp_data) {
-                                       CTS_ERR("calloc() Fail");
+                                       ERR("calloc() Fail");
                                        free(data);
                                        free(number);
                                        return CONTACTS_ERROR_OUT_OF_MEMORY;
                                }
 
-                               if (data)
-                                       snprintf(temp_data, buf_size, "%s %s %s",data, relationship->name, (had?temp:""));
-                               else
-                                       snprintf(temp_data, buf_size, "%s %s",relationship->name, (had?temp:""));
+                               if (data) {
+                                       snprintf(temp_data, buf_size, "%s %s %s", data, relationship->name,
+                                                       (had ? temp : ""));
+                               } else {
+                                       snprintf(temp_data, buf_size, "%s %s", relationship->name,
+                                                       (had ? temp : ""));
+                               }
                                free(data);
                                data = temp_data;
                        }
@@ -761,18 +749,18 @@ static inline int __ctsvc_contact_make_search_data(ctsvc_contact_s *contact,
                        if (company) {
                                bool had;
                                int str_len = SAFE_STRLEN(company->name)
-                                                       + SAFE_STRLEN(company->department)
-                                                       + SAFE_STRLEN(company->job_title)
-                                                       + SAFE_STRLEN(company->role)
-                                                       + SAFE_STRLEN(company->assistant_name)
-                                                       + SAFE_STRLEN(company->location)
-                                                       + SAFE_STRLEN(company->description)
-                                                       + SAFE_STRLEN(company->phonetic_name);
+                                       + SAFE_STRLEN(company->department)
+                                       + SAFE_STRLEN(company->job_title)
+                                       + SAFE_STRLEN(company->role)
+                                       + SAFE_STRLEN(company->assistant_name)
+                                       + SAFE_STRLEN(company->location)
+                                       + SAFE_STRLEN(company->description)
+                                       + SAFE_STRLEN(company->phonetic_name);
                                len = 0;
                                buf_size = SAFE_STRLEN(data) + str_len * 2 + 18;
                                temp_data = calloc(1, buf_size);
                                if (NULL == temp_data) {
-                                       CTS_ERR("calloc() Fail");
+                                       ERR("calloc() Fail");
                                        free(data);
                                        free(number);
                                        return CONTACTS_ERROR_OUT_OF_MEMORY;
@@ -784,35 +772,35 @@ static inline int __ctsvc_contact_make_search_data(ctsvc_contact_s *contact,
                                        len += snprintf(temp_data + len, buf_size - len, "%s ", data);
                                if (company->name) {
                                        had = __ctsvc_contact_check_token(company->name, temp, SAFE_STRLEN(company->name));
-                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", company->name, had?temp:"");
+                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", company->name, had ? temp : "");
                                }
                                if (company->department) {
                                        had = __ctsvc_contact_check_token(company->department, temp, SAFE_STRLEN(company->department));
-                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", company->department, had?temp:"");
+                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", company->department, had ? temp : "");
                                }
                                if (company->job_title) {
                                        had = __ctsvc_contact_check_token(company->job_title, temp, SAFE_STRLEN(company->job_title));
-                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", company->job_title, had?temp:"");
+                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", company->job_title, had ? temp : "");
                                }
                                if (company->role) {
                                        had = __ctsvc_contact_check_token(company->role, temp, SAFE_STRLEN(company->role));
-                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", company->role, had?temp:"");
+                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", company->role, had ? temp : "");
                                }
                                if (company->assistant_name) {
                                        had = __ctsvc_contact_check_token(company->assistant_name, temp, SAFE_STRLEN(company->assistant_name));
-                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", company->assistant_name, had?temp:"");
+                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", company->assistant_name, had ? temp : "");
                                }
                                if (company->location) {
                                        had = __ctsvc_contact_check_token(company->location, temp, SAFE_STRLEN(company->location));
-                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", company->location, had?temp:"");
+                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", company->location, had ? temp : "");
                                }
                                if (company->description) {
                                        had = __ctsvc_contact_check_token(company->description, temp, SAFE_STRLEN(company->description));
-                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", company->description, had?temp:"");
+                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", company->description, had ? temp : "");
                                }
                                if (company->phonetic_name) {
                                        had = __ctsvc_contact_check_token(company->phonetic_name, temp, SAFE_STRLEN(company->phonetic_name));
-                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", company->phonetic_name, had?temp:"");
+                                       len += snprintf(temp_data + len, buf_size - len, "%s %s ", company->phonetic_name, had ? temp : "");
                                }
 
                                free(data);
@@ -822,23 +810,23 @@ static inline int __ctsvc_contact_make_search_data(ctsvc_contact_s *contact,
        }
 
        *search_number = number;
-       if (data) {
+       if (data)
                *search_data = data;
-       }
+
        return CONTACTS_ERROR_NONE;
 }
 
 static inline int __ctsvc_contact_refresh_lookup_data(int contact_id, ctsvc_contact_s *contact)
 {
        CTS_FN_CALL;
-       int ret, len = 0, temp_len =0;
+       int ret, len = 0, temp_len = 0;
        char query[CTS_SQL_MAX_LEN] = {0};
 
        snprintf(query, sizeof(query), "DELETE FROM %s WHERE contact_id = %d",
                        CTS_TABLE_NAME_LOOKUP, contact_id);
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                return ret;
        }
 
@@ -846,7 +834,7 @@ static inline int __ctsvc_contact_refresh_lookup_data(int contact_id, ctsvc_cont
                        CTS_TABLE_PHONE_LOOKUP, contact_id);
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                return ret;
        }
 
@@ -864,7 +852,10 @@ static inline int __ctsvc_contact_refresh_lookup_data(int contact_id, ctsvc_cont
                do {
                        contacts_list_get_current_record_p(name_list, (contacts_record_h*)&name_record);
                        if (name_record
-                                       && (name_record->last || name_record->first || name_record->addition || name_record->suffix)) {
+                                       && (name_record->last
+                                               || name_record->first
+                                               || name_record->addition
+                                               || name_record->suffix)) {
                                char *normalized_name = NULL;
 
                                /*
@@ -873,21 +864,24 @@ static inline int __ctsvc_contact_refresh_lookup_data(int contact_id, ctsvc_cont
                                 * Korean, Chinese : Prefix LastMiddleFirstSuffix
                                 * Japanese        : Prefix Last Middle First Suffix
                                 * reverse sort name does not include prefix
-                                *      But, if there is only prefix, reverse sort_name is prefix
+                                * But, if there is only prefix, reverse sort_name is prefix
                                 */
                                /* make display name */
-                               temp_len = SAFE_STRLEN(name_record->first) + SAFE_STRLEN(name_record->addition)
-                                                                       + SAFE_STRLEN(name_record->last)+ SAFE_STRLEN(name_record->suffix) + 1;
+                               temp_len = SAFE_STRLEN(name_record->first)
+                                       + SAFE_STRLEN(name_record->addition)
+                                       + SAFE_STRLEN(name_record->last)
+                                       + SAFE_STRLEN(name_record->suffix)
+                                       + 1;
                                int reverse_lang_type = ctsvc_contact_get_name_language(name_record);
                                temp_name = calloc(1, temp_len);
                                if (NULL == temp_name) {
-                                       CTS_ERR("calloc() Fail");
+                                       ERR("calloc() Fail");
                                        return CONTACTS_ERROR_OUT_OF_MEMORY;
                                }
 
                                if (reverse_lang_type == CTSVC_LANG_KOREAN ||
-                                       reverse_lang_type == CTSVC_LANG_CHINESE ||
-                                       reverse_lang_type == CTSVC_LANG_JAPANESE) {
+                                               reverse_lang_type == CTSVC_LANG_CHINESE ||
+                                               reverse_lang_type == CTSVC_LANG_JAPANESE) {
                                        if (name_record->last)
                                                len += snprintf(temp_name + len, temp_len - len, "%s", name_record->last);
                                        if (name_record->addition)
@@ -896,8 +890,7 @@ static inline int __ctsvc_contact_refresh_lookup_data(int contact_id, ctsvc_cont
                                                len += snprintf(temp_name + len, temp_len - len, "%s", name_record->first);
                                        if (name_record->suffix)
                                                len += snprintf(temp_name + len, temp_len - len, "%s", name_record->suffix);
-                               }
-                               else {
+                               } else {
                                        if (name_record->last)
                                                len += snprintf(temp_name + len, temp_len - len, "%s", name_record->last);
                                        if (name_record->first)
@@ -910,12 +903,12 @@ static inline int __ctsvc_contact_refresh_lookup_data(int contact_id, ctsvc_cont
 
                                ctsvc_normalize_str(temp_name, &normalized_name);
                                snprintf(query, sizeof(query), "INSERT INTO %s(data_id, contact_id, name, type) "
-                                                               "VALUES(%d, %d, ?, %d)",        CTS_TABLE_NAME_LOOKUP, name_record->id,
-                                                               contact_id, 0);
+                                               "VALUES(%d, %d, ?, %d)",        CTS_TABLE_NAME_LOOKUP, name_record->id,
+                                               contact_id, 0);
 
                                ret = ctsvc_query_prepare(query, &stmt);
                                if (NULL == stmt) {
-                                       CTS_ERR("ctsvc_query_prepare() Fail(%d)", ret);
+                                       ERR("ctsvc_query_prepare() Fail(%d)", ret);
                                        free(temp_name);
                                        free(normalized_name);
                                        return ret;
@@ -932,7 +925,7 @@ static inline int __ctsvc_contact_refresh_lookup_data(int contact_id, ctsvc_cont
                                ctsvc_stmt_finalize(stmt);
 
                                if (CONTACTS_ERROR_NONE != ret) {
-                                       CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+                                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                                        return ret;
                                }
                                break;
@@ -954,17 +947,17 @@ static inline int __ctsvc_contact_refresh_lookup_data(int contact_id, ctsvc_cont
 
                                /* actually phone_lookup minmatch is not used */
                                snprintf(query, sizeof(query), "INSERT INTO %s(data_id, contact_id, number, min_match) "
-                                                               "VALUES(%d, %d, ?, ?)", CTS_TABLE_PHONE_LOOKUP, number_record->id,
-                                                               contact_id);
+                                               "VALUES(%d, %d, ?, ?)", CTS_TABLE_PHONE_LOOKUP, number_record->id,
+                                               contact_id);
 
                                ret = ctsvc_query_prepare(query, &stmt);
-                               RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+                               RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
                                if (*number_record->cleaned)
                                        ctsvc_stmt_bind_text(stmt, 1, number_record->cleaned);
                                ret = ctsvc_stmt_step(stmt);
                                if (CONTACTS_ERROR_NONE != ret) {
-                                       CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+                                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                                        ctsvc_stmt_finalize(stmt);
                                        return ret;
                                }
@@ -974,7 +967,7 @@ static inline int __ctsvc_contact_refresh_lookup_data(int contact_id, ctsvc_cont
                                                ctsvc_stmt_bind_text(stmt, 1, number_record->normalized);
                                        ret = ctsvc_stmt_step(stmt);
                                        if (CONTACTS_ERROR_NONE != ret) {
-                                               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+                                               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                                                ctsvc_stmt_finalize(stmt);
                                                return ret;
                                        }
@@ -995,12 +988,12 @@ static inline int __ctsvc_contact_refresh_lookup_data(int contact_id, ctsvc_cont
                                char *normalized_nickname = NULL;
                                ctsvc_normalize_str(nickname->nickname, &normalized_nickname);
                                snprintf(query, sizeof(query), "INSERT INTO %s(data_id, contact_id, name, type) "
-                                                               "VALUES(%d, %d, ?, %d)",        CTS_TABLE_NAME_LOOKUP, nickname->id,
-                                                               contact_id,  0);
+                                               "VALUES(%d, %d, ?, %d)",        CTS_TABLE_NAME_LOOKUP, nickname->id,
+                                               contact_id,  0);
 
                                ret = ctsvc_query_prepare(query, &stmt);
                                if (NULL == stmt) {
-                                       CTS_ERR("ctsvc_query_prepare() Fail(%d)", ret);
+                                       ERR("ctsvc_query_prepare() Fail(%d)", ret);
                                        free(normalized_nickname);
                                        return ret;
                                }
@@ -1015,7 +1008,7 @@ static inline int __ctsvc_contact_refresh_lookup_data(int contact_id, ctsvc_cont
                                ctsvc_stmt_finalize(stmt);
 
                                if (CONTACTS_ERROR_NONE != ret) {
-                                       CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+                                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                                        return ret;
                                }
                        }
@@ -1045,22 +1038,21 @@ static inline int __ctsvc_contact_update_search_data(int contact_id, bool need_r
                                CTS_TABLE_SEARCH_INDEX, contact_id);
                r = ctsvc_query_exec(query);
                if (CONTACTS_ERROR_NONE != r) {
-                       CTS_ERR("ctsvc_query_exec() Fail(%d)", r);
+                       ERR("ctsvc_query_exec() Fail(%d)", r);
                        ctsvc_end_trans(false);
                        return r;
                }
                ctsvc_end_trans(false);
                return ret;
-       }
-       else if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_db_contact_get() Fail(%d)", ret);
+       } else if (CONTACTS_ERROR_NONE != ret) {
+               ERR("ctsvc_db_contact_get() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_contact_make_search_name(contact, &search_name);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_contact_make_search_name() Fail(%d)", ret);
+               ERR("ctsvc_contact_make_search_name() Fail(%d)", ret);
                contacts_record_destroy((contacts_record_h)contact, true);
                ctsvc_end_trans(false);
                return ret;
@@ -1068,7 +1060,7 @@ static inline int __ctsvc_contact_update_search_data(int contact_id, bool need_r
 
        ret = __ctsvc_contact_make_search_data(contact, &search_number, &search_data);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("__ctsvc_contact_make_search_data() Fail(%d)", ret);
+               ERR("__ctsvc_contact_make_search_data() Fail(%d)", ret);
                contacts_record_destroy((contacts_record_h)contact, true);
                ctsvc_end_trans(false);
                free(search_name);
@@ -1082,7 +1074,7 @@ static inline int __ctsvc_contact_update_search_data(int contact_id, bool need_r
 
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                contacts_record_destroy((contacts_record_h)contact, true);
                ctsvc_end_trans(false);
                free(search_name);
@@ -1105,7 +1097,7 @@ static inline int __ctsvc_contact_update_search_data(int contact_id, bool need_r
        free(search_data);
 
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                contacts_record_destroy((contacts_record_h)contact, true);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
@@ -1117,7 +1109,7 @@ static inline int __ctsvc_contact_update_search_data(int contact_id, bool need_r
                /* update phone_lookup, name_lookup */
                ret = __ctsvc_contact_refresh_lookup_data(contact_id, contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("__ctsvc_contact_refresh_lookup_data() Fail(%d)", ret);
+                       ERR("__ctsvc_contact_refresh_lookup_data() Fail(%d)", ret);
                        contacts_record_destroy((contacts_record_h)contact, true);
                        ctsvc_end_trans(false);
                        return ret;
@@ -1135,19 +1127,20 @@ static inline int __ctsvc_contact_update_search_data(int contact_id, bool need_r
 static bool __ctsvc_list_check_dirty(ctsvc_list_s *list)
 {
        if (list) {
-               if (list->deleted_records) {
+               if (list->deleted_records)
                        return true;
-               }
+
                GList *c = NULL;
-               for (c=list->records;c;c=c->next) {
+               for (c = list->records; c; c = c->next) {
                        ctsvc_record_s *s_record = c->data;
                        int i;
                        unsigned int property_info_count = 0;
                        const property_info_s *property_info = ctsvc_view_get_all_property_infos(s_record->view_uri, &property_info_count);
-                       for (i=0;i<property_info_count;i++) {
-                               if (ctsvc_record_check_property_flag(s_record, property_info[i].property_id, CTSVC_PROPERTY_FLAG_DIRTY)) {
+                       for (i = 0; i < property_info_count; i++) {
+                               bool ret = ctsvc_record_check_property_flag(s_record,
+                                               property_info[i].property_id, CTSVC_PROPERTY_FLAG_DIRTY);
+                               if (ret)
                                        return true;
-                               }
                        }
                }
        }
@@ -1182,17 +1175,17 @@ static int __ctsvc_db_contact_update_record(contacts_record_h record)
        RETVM_IF(ret, ret, "ctsvc_begin_trans() Fail(%d)", ret);
 
        snprintf(query, sizeof(query),
-               "SELECT changed_ver FROM "CTS_TABLE_CONTACTS" "
-               "WHERE contact_id = %d AND deleted = 0", contact->id);
+                       "SELECT changed_ver FROM "CTS_TABLE_CONTACTS" "
+                       "WHERE contact_id = %d AND deleted = 0", contact->id);
        ret = ctsvc_query_get_first_int_result(query, &current_version);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("The index(%d) is Invalid. %d Record(s) is(are) found", contact->id, ret);
+               ERR("The index(%d) is Invalid. %d Record(s) is(are) found", contact->id, ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        if (false == ctsvc_have_ab_write_permission(contact->addressbook_id)) {
-               CTS_ERR("Does not have permission to update this contact");
+               ERR("Does not have permission to update this contact");
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
@@ -1207,7 +1200,7 @@ static int __ctsvc_db_contact_update_record(contacts_record_h record)
        /* update data */
        ret = __ctsvc_contact_update_data(contact);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("__ctsvc_contact_update_data() Fail(%d)", ret);
+               ERR("__ctsvc_contact_update_data() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -1215,7 +1208,7 @@ static int __ctsvc_db_contact_update_record(contacts_record_h record)
        if (contact->grouprelations) {
                rel_changed = __ctsvc_contact_update_grouprel(contact->id, (contacts_list_h)contact->grouprelations);
                if (rel_changed < CONTACTS_ERROR_NONE) {
-                       CTS_ERR("cts_update_contact_grouprel() Fail(%d)", rel_changed);
+                       ERR("cts_update_contact_grouprel() Fail(%d)", rel_changed);
                        ctsvc_end_trans(false);
                        return rel_changed;
                }
@@ -1233,7 +1226,7 @@ static int __ctsvc_db_contact_update_record(contacts_record_h record)
                        do {
                                ret = contacts_list_get_current_record_p((contacts_list_h)contact->images, (contacts_record_h*)&image);
                                if (CONTACTS_ERROR_NONE != ret) {
-                                       CTS_ERR("contacts_list_get_current_record_p() Fail(%d)", ret);
+                                       ERR("contacts_list_get_current_record_p() Fail(%d)", ret);
                                        ctsvc_end_trans(false);
                                        return CONTACTS_ERROR_DB;
                                }
@@ -1245,32 +1238,30 @@ static int __ctsvc_db_contact_update_record(contacts_record_h record)
                        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);
+                               ctsvc_record_set_property_flag((ctsvc_record_s*)contact, _contacts_contact.image_thumbnail_path, CTSVC_PROPERTY_FLAG_DIRTY);
 
                                if (ctsvc_contact_check_image_location(image->path))
                                        contact->image_thumbnail_path = SAFE_STRDUP(image->path + strlen(CTSVC_CONTACT_IMG_FULL_LOCATION) + 1);
                                else
                                        contact->image_thumbnail_path = SAFE_STRDUP(image->path);
                        }
-               }
-               else if (contact->image_thumbnail_path) {
+               } else if (contact->image_thumbnail_path) {
                        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);
+                       bool is_changed = ctsvc_record_check_property_flag((ctsvc_record_s*)contact, _contacts_contact.image_thumbnail_path, CTSVC_PROPERTY_FLAG_DIRTY);
                        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 {
-                               if (((ctsvc_record_s *)record)->properties_flags) {
+                               ctsvc_record_set_property_flag((ctsvc_record_s*)contact, _contacts_contact.image_thumbnail_path, CTSVC_PROPERTY_FLAG_DIRTY);
+                       } else {
+                               if (((ctsvc_record_s*)record)->properties_flags) {
                                        int index = _contacts_contact.image_thumbnail_path & 0x000000FF;
-                                       ((ctsvc_record_s *)record)->properties_flags[index] = 0;
+                                       ((ctsvc_record_s*)record)->properties_flags[index] = 0;
                                }
                        }
                }
        }
 
        if (is_invalid) {
-               ctsvc_contact_stemp_contact;
+               ctsvc_contact_s *temp_contact;
                contacts_record_create(_contacts_contact._uri, (contacts_record_h*)&temp_contact);
                ret = __ctsvc_db_get_data(contact->id, temp_contact);
                ctsvc_contact_make_display_name(temp_contact);
@@ -1286,13 +1277,13 @@ static int __ctsvc_db_contact_update_record(contacts_record_h record)
                contact->reverse_display_name_language = temp_contact->reverse_display_name_language;
                contact->display_source_type = temp_contact->display_source_type;
 
-               if (ctsvc_record_check_property_flag((ctsvc_record_s *)temp_contact, _contacts_contact.display_name, CTSVC_PROPERTY_FLAG_DIRTY))
-                       ctsvc_record_set_property_flag((ctsvc_record_s *)contact, _contacts_contact.display_name, CTSVC_PROPERTY_FLAG_DIRTY);
+               if (ctsvc_record_check_property_flag((ctsvc_record_s*)temp_contact, _contacts_contact.display_name, CTSVC_PROPERTY_FLAG_DIRTY))
+                       ctsvc_record_set_property_flag((ctsvc_record_s*)contact, _contacts_contact.display_name, CTSVC_PROPERTY_FLAG_DIRTY);
 
                contacts_record_destroy((contacts_record_h)temp_contact, true);
-       }
-       else
+       } else {
                ctsvc_contact_make_display_name(contact);
+       }
 
        do {
                char query[CTS_SQL_MAX_LEN] = {0};
@@ -1308,7 +1299,7 @@ static int __ctsvc_db_contact_update_record(contacts_record_h record)
                        len = snprintf(query_set, sizeof(query_set), "%s, ", set);
                len += snprintf(query_set+len, sizeof(query_set)-len, " changed_ver=%d, changed_time=%d, has_phonenumber=%d, has_email=%d",
                                version, (int)time(NULL), contact->has_phonenumber, contact->has_email);
-               if (ctsvc_record_check_property_flag((ctsvc_record_s *)contact, _contacts_contact.display_name, CTSVC_PROPERTY_FLAG_DIRTY)) {
+               if (ctsvc_record_check_property_flag((ctsvc_record_s*)contact, _contacts_contact.display_name, CTSVC_PROPERTY_FLAG_DIRTY)) {
                        len += snprintf(query_set+len, sizeof(query_set)-len,
                                        ", display_name=?, reverse_display_name=?, display_name_source=%d, "
                                        "display_name_language=%d, reverse_display_name_language=%d, "
@@ -1322,20 +1313,20 @@ static int __ctsvc_db_contact_update_record(contacts_record_h record)
                        bind_text = g_slist_append(bind_text, strdup(SAFE_STR(contact->reverse_sortkey)));
                }
 
-               if (ctsvc_record_check_property_flag((ctsvc_record_s *)contact, _contacts_contact.image_thumbnail_path, CTSVC_PROPERTY_FLAG_DIRTY))
+               if (ctsvc_record_check_property_flag((ctsvc_record_s*)contact, _contacts_contact.image_thumbnail_path, CTSVC_PROPERTY_FLAG_DIRTY))
                        len += snprintf(query_set+len, sizeof(query_set)-len, ", image_changed_ver=%d", version);
 
                snprintf(query, sizeof(query), "UPDATE %s SET %s WHERE contact_id = %d", CTS_TABLE_CONTACTS, query_set, contact->id);
 
                ret = ctsvc_query_prepare(query, &stmt);
                if (NULL == stmt) {
-                       CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+                       ERR("ctsvc_query_prepare() Fail(%d)", ret);
                        break;
                }
 
                if (bind_text) {
                        int i = 0;
-                       for (cursor=bind_text,i=1;cursor;cursor=cursor->next,i++) {
+                       for (cursor = bind_text, i = 1; cursor; cursor = cursor->next, i++) {
                                const char *text = cursor->data;
                                if (*text)
                                        ctsvc_stmt_bind_text(stmt, i, text);
@@ -1343,7 +1334,7 @@ static int __ctsvc_db_contact_update_record(contacts_record_h record)
                }
                ret = ctsvc_stmt_step(stmt);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        break;
                }
@@ -1352,11 +1343,14 @@ static int __ctsvc_db_contact_update_record(contacts_record_h record)
 
        if (CONTACTS_ERROR_NONE != ret) {
                ctsvc_end_trans(false);
-               CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s *)record);
-               CONTACTS_FREE(set);
+               CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s*)record);
+               free(set);
+
                if (bind_text) {
-                       for (cursor=bind_text;cursor;cursor=cursor->next)
-                               CONTACTS_FREE(cursor->data);
+                       for (cursor = bind_text; cursor; cursor = cursor->next) {
+                               free(cursor->data);
+                               cursor->data = NULL;
+                       }
                        g_slist_free(bind_text);
                }
                return ret;
@@ -1369,21 +1363,24 @@ static int __ctsvc_db_contact_update_record(contacts_record_h record)
        __ctsvc_contact_update_search_data(contact->id, need_update_lookup);
        ctsvc_db_update_person((contacts_record_h)contact);
 
-       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s *)record);
-       CONTACTS_FREE(set);
+       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s*)record);
+       free(set);
+
        if (bind_text) {
-               for (cursor=bind_text;cursor;cursor=cursor->next)
-                       CONTACTS_FREE(cursor->data);
+               for (cursor = bind_text; cursor; cursor = cursor->next) {
+                       free(cursor->data);
+                       cursor->data = NULL;
+               }
                g_slist_free(bind_text);
        }
 
        ret = ctsvc_end_trans(true);
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "DB error : ctsvc_end_trans() Fail(%d)", ret);
+       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "ctsvc_end_trans() Fail(%d)", ret);
 
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_contact_get_all_records(int offset, int limit, contacts_list_hout_list)
+static int __ctsvc_db_contact_get_all_records(int offset, int limit, contacts_list_h *out_list)
 {
        int ret;
        int len;
@@ -1402,13 +1399,13 @@ static int __ctsvc_db_contact_get_all_records(int offset, int limit, contacts_li
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -1416,7 +1413,7 @@ static int __ctsvc_db_contact_get_all_records(int offset, int limit, contacts_li
                contact_id = ctsvc_stmt_get_int(stmt, 0);
                ret = ctsvc_db_contact_get(contact_id, &record);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("DB error : ctsvc_db_contact_get() Fail(%d)", ret);
+                       ERR("ctsvc_db_contact_get() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -1438,14 +1435,14 @@ static int __ctsvc_db_contact_get_changed_ver(int contact_id, ctsvc_contact_s *c
 
        snprintf(query, sizeof(query),
                        "SELECT changed_ver FROM "CTS_TABLE_CONTACTS
-                               " WHERE contact_id = %d AND deleted = 0", contact_id);
+                       " WHERE contact_id = %d AND deleted = 0", contact_id);
        ret = ctsvc_query_get_first_int_result(query, &version);
        if (CONTACTS_ERROR_NONE == ret)
                contact->changed_ver = version;
        return ret;
 }
 
-static int __ctsvc_db_contact_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_hout_list)
+static int __ctsvc_db_contact_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h *out_list)
 {
        int ret;
        int i;
@@ -1459,17 +1456,16 @@ static int __ctsvc_db_contact_get_records_with_query(contacts_query_h query, int
        int contact_id = 0;
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        if (s_query->projection) {
-               for (i=0;i<s_query->projection_count;i++) {
+               for (i = 0; i < s_query->projection_count; i++) {
                        if (s_query->projection[i] == CTSVC_PROPERTY_CONTACT_ID) {
                                had_contact_id = true;
                                break;
                        }
                }
-       }
-       else {
+       } else {
                s_query->projection_count = 0;
                had_contact_id = true;
        }
@@ -1477,7 +1473,7 @@ static int __ctsvc_db_contact_get_records_with_query(contacts_query_h query, int
        if (false == had_contact_id) {
                s_query->projection = realloc(s_query->projection, s_query->projection_count+1);
                if (NULL == s_query->projection) {
-                       CTS_ERR("realloc() Fail");
+                       ERR("realloc() Fail");
                        return CONTACTS_ERROR_OUT_OF_MEMORY;
                }
 
@@ -1492,7 +1488,7 @@ static int __ctsvc_db_contact_get_records_with_query(contacts_query_h query, int
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -1500,9 +1496,9 @@ static int __ctsvc_db_contact_get_records_with_query(contacts_query_h query, int
 
                contacts_record_create(_contacts_contact._uri, &record);
                contact = (ctsvc_contact_s*)record;
-               if (0 == s_query->projection_count)
+               if (0 == s_query->projection_count) {
                        field_count = s_query->property_count;
-               else {
+               else {
                        field_count = s_query->projection_count;
                        ret = ctsvc_record_set_projection_flags(record, s_query->projection,
                                        s_query->projection_count, s_query->property_count);
@@ -1511,7 +1507,7 @@ static int __ctsvc_db_contact_get_records_with_query(contacts_query_h query, int
                                ASSERT_NOT_REACHED("To set projection is failed.\n");
                }
 
-               for (i=0;i<field_count;i++) {
+               for (i = 0; i < field_count; i++) {
                        char *temp;
                        int property_id;
                        if (0 == s_query->projection_count)
@@ -1519,7 +1515,7 @@ static int __ctsvc_db_contact_get_records_with_query(contacts_query_h query, int
                        else
                                property_id = s_query->projection[i];
 
-                       switch(property_id) {
+                       switch (property_id) {
                        case CTSVC_PROPERTY_CONTACT_ID:
                                contact_id = ctsvc_stmt_get_int(stmt, i);
                                if (had_contact_id)
@@ -1589,7 +1585,7 @@ static int __ctsvc_db_contact_get_records_with_query(contacts_query_h query, int
                /* get changed_ver */
                ret = __ctsvc_db_contact_get_changed_ver(contact_id, contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("__ctsvc_db_contact_get_changed_ver Fail(%d)", ret);
+                       ERR("__ctsvc_db_contact_get_changed_ver Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -1597,7 +1593,7 @@ static int __ctsvc_db_contact_get_records_with_query(contacts_query_h query, int
 
                ret = __ctsvc_db_get_data(contact_id, contact);
                if (CONTACTS_ERROR_NONE != ret && CONTACTS_ERROR_NO_DATA != ret) {
-                       CTS_ERR("ctsvc_get_data_info Fail(%d)", ret);
+                       ERR("ctsvc_get_data_info Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -1605,7 +1601,7 @@ static int __ctsvc_db_contact_get_records_with_query(contacts_query_h query, int
 
                ret = __ctsvc_get_contact_grouprel(contact_id, contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_get_group_relations Fail(%d)", ret);
+                       ERR("ctsvc_get_group_relations Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -1630,7 +1626,7 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact)
        if (contact->name) {
                ret = ctsvc_contact_insert_data_name((contacts_list_h)contact->name, contact->id, false);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_insert_data_name() Fail(%d)", ret);
+                       ERR("ctsvc_contact_insert_data_name() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -1639,7 +1635,7 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact)
        if (contact->company) {
                ret = ctsvc_contact_insert_data_company((contacts_list_h)contact->company, contact->id, false);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_insert_contact_data_company() Fail(%d)", ret);
+                       ERR("ctsvc_insert_contact_data_company() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -1648,7 +1644,7 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact)
        if (contact->events) {
                ret = ctsvc_contact_insert_data_event((contacts_list_h)contact->events, contact->id, false);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_insert_contact_data_event() Fail(%d)", ret);
+                       ERR("ctsvc_insert_contact_data_event() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -1657,7 +1653,7 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact)
        if (contact->messengers) {
                ret = ctsvc_contact_insert_data_messenger((contacts_list_h)contact->messengers, contact->id, false);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_insert_contact_data_messenger() Fail(%d)", ret);
+                       ERR("ctsvc_insert_contact_data_messenger() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -1666,7 +1662,7 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact)
        if (contact->postal_addrs) {
                ret = ctsvc_contact_insert_data_address((contacts_list_h)contact->postal_addrs, contact->id, false);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_insert_contact_data_postal() Fail(%d)", ret);
+                       ERR("ctsvc_insert_contact_data_postal() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -1675,7 +1671,7 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact)
        if (contact->urls) {
                ret = ctsvc_contact_insert_data_url((contacts_list_h)contact->urls, contact->id, false);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_insert_contact_data_web() Fail(%d)", ret);
+                       ERR("ctsvc_insert_contact_data_web() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -1684,7 +1680,7 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact)
        if (contact->nicknames) {
                ret = ctsvc_contact_insert_data_nickname((contacts_list_h)contact->nicknames, contact->id, false);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_insert_contact_data_nickname() Fail(%d)", ret);
+                       ERR("ctsvc_insert_contact_data_nickname() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -1693,7 +1689,7 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact)
        if (contact->numbers) {
                ret = ctsvc_contact_insert_data_number((contacts_list_h)contact->numbers, contact->id, false);
                if (ret < CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_contact_insert_data_number() Fail(%d)", ret);
+                       ERR("ctsvc_contact_insert_data_number() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -1702,7 +1698,7 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact)
        if (contact->emails) {
                ret = ctsvc_contact_insert_data_email((contacts_list_h)contact->emails, contact->id, false);
                if (ret < CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_insert_contact_data_email() Fail(%d)", ret);
+                       ERR("ctsvc_insert_contact_data_email() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -1711,7 +1707,7 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact)
        if (contact->profiles) {
                ret = ctsvc_contact_insert_data_profile((contacts_list_h)contact->profiles, contact->id, false);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_insert_contact_data_profile() Fail(%d)", ret);
+                       ERR("ctsvc_insert_contact_data_profile() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -1720,7 +1716,7 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact)
        if (contact->relationships) {
                ret = ctsvc_contact_insert_data_relationship((contacts_list_h)contact->relationships, contact->id, false);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_insert_data_relationship() Fail(%d)", ret);
+                       ERR("ctsvc_contact_insert_data_relationship() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -1729,7 +1725,7 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact)
        if (contact->images) {
                ret = ctsvc_contact_insert_data_image((contacts_list_h)contact->images, contact->id, false);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_insert_data_image() Fail(%d)", ret);
+                       ERR("ctsvc_contact_insert_data_image() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -1738,7 +1734,7 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact)
        if (contact->note) {
                ret = ctsvc_contact_insert_data_note((contacts_list_h)contact->note, contact->id, false);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_insert_data_note() Fail(%d)", ret);
+                       ERR("ctsvc_contact_insert_data_note() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -1747,7 +1743,7 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact)
        if (contact->extensions) {
                ret = ctsvc_contact_insert_data_extension((contacts_list_h)contact->extensions, contact->id, false);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_insert_data_extension() Fail(%d)", ret);
+                       ERR("ctsvc_contact_insert_data_extension() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -1770,14 +1766,14 @@ static inline int __ctsvc_contact_insert_search_data(int contact_id, bool need_i
 
        ret = ctsvc_db_contact_get(contact_id, (contacts_record_h*)&contact);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_db_contact_get() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_get() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_contact_make_search_name(contact, &search_name);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_contact_make_search_name() Fail(%d)", ret);
+               ERR("ctsvc_contact_make_search_name() Fail(%d)", ret);
                contacts_record_destroy((contacts_record_h)contact, true);
                ctsvc_end_trans(false);
                return ret;
@@ -1785,7 +1781,7 @@ static inline int __ctsvc_contact_insert_search_data(int contact_id, bool need_i
 
        ret = __ctsvc_contact_make_search_data(contact, &search_number, &search_data);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("__ctsvc_contact_make_search_data() Fail(%d)", ret);
+               ERR("__ctsvc_contact_make_search_data() Fail(%d)", ret);
                contacts_record_destroy((contacts_record_h)contact, true);
                ctsvc_end_trans(false);
                free(search_name);
@@ -1799,7 +1795,7 @@ static inline int __ctsvc_contact_insert_search_data(int contact_id, bool need_i
 
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                contacts_record_destroy((contacts_record_h)contact, true);
                ctsvc_end_trans(false);
                free(search_name);
@@ -1822,7 +1818,7 @@ static inline int __ctsvc_contact_insert_search_data(int contact_id, bool need_i
        free(search_data);
 
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                contacts_record_destroy((contacts_record_h)contact, true);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
@@ -1834,7 +1830,7 @@ static inline int __ctsvc_contact_insert_search_data(int contact_id, bool need_i
        if (need_insert_lookup_data) {
                ret = __ctsvc_contact_refresh_lookup_data(contact_id, contact);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("__ctsvc_contact_refresh_lookup_data() Fail(%d)", ret);
+                       ERR("__ctsvc_contact_refresh_lookup_data() Fail(%d)", ret);
                        contacts_record_destroy((contacts_record_h)contact, true);
                        ctsvc_end_trans(false);
                        return ret;
@@ -1883,7 +1879,8 @@ static inline int __ctsvc_contact_insert_grouprel(int contact_id, contacts_list_
                return CONTACTS_ERROR_NONE;
 }
 
-inline static int __ctsvc_find_person_to_link_with_number(const char *number, int addressbook_id, int *person_id)
+static inline int __ctsvc_find_person_to_link_with_number(const char *number,
+               int addressbook_id, int *person_id)
 {
        int ret;
        cts_stmt stmt = NULL;
@@ -1916,19 +1913,18 @@ inline static int __ctsvc_find_person_to_link_with_number(const char *number, in
                if (1 == ret) {
                        *person_id = ctsvc_stmt_get_int(stmt, 0);
                        ret = CONTACTS_ERROR_NONE;
-               }
-               else if (CONTACTS_ERROR_NONE == ret) {
+               } else if (CONTACTS_ERROR_NONE == ret) {
                        ret = CONTACTS_ERROR_NO_DATA;
                }
                ctsvc_stmt_finalize(stmt);
-               CTS_DBG("result ret(%d) person_id(%d)", ret, *person_id);
+               DBG("result ret(%d) person_id(%d)", ret, *person_id);
                return ret;
        }
 
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-inline static int __ctsvc_find_person_to_link_with_email(const char *email_addr, int addressbook_id, int *person_id)
+static inline int __ctsvc_find_person_to_link_with_email(const char *email_addr, int addressbook_id, int *person_id)
 {
        int ret;
        cts_stmt stmt = NULL;
@@ -1949,18 +1945,17 @@ inline static int __ctsvc_find_person_to_link_with_email(const char *email_addr,
        if (1 == ret) {
                *person_id = ctsvc_stmt_get_int(stmt, 0);
                ret = CONTACTS_ERROR_NONE;
-       }
-       else if (CONTACTS_ERROR_NONE == ret) {
+       } else if (CONTACTS_ERROR_NONE == ret) {
                ret = CONTACTS_ERROR_NO_DATA;
        }
 
        ctsvc_stmt_finalize(stmt);
-       CTS_DBG("result ret(%d) person_id(%d)", ret, *person_id);
+       DBG("result ret(%d) person_id(%d)", ret, *person_id);
 
        return ret;
 }
 
-inline static int __ctsvc_find_person_to_link(contacts_record_h record, int addressbook_id, int *person_id)
+static inline int __ctsvc_find_person_to_link(contacts_record_h record, int addressbook_id, int *person_id)
 {
        int ret;
        ctsvc_contact_s *contact = (ctsvc_contact_s*)record;
@@ -1968,8 +1963,8 @@ inline static int __ctsvc_find_person_to_link(contacts_record_h record, int addr
        ctsvc_email_s *email_data;
        GList *cursor;
 
-       for (cursor = contact->numbers->records;cursor;cursor=cursor->next) {
-               number_data = (ctsvc_number_s *)cursor->data;
+       for (cursor = contact->numbers->records; cursor; cursor = cursor->next) {
+               number_data = cursor->data;
                if (number_data && number_data->number && number_data->number[0]) {
                        ret = __ctsvc_find_person_to_link_with_number(number_data->number, addressbook_id, person_id);
 
@@ -1978,8 +1973,8 @@ inline static int __ctsvc_find_person_to_link(contacts_record_h record, int addr
                }
        }
 
-       for (cursor = contact->emails->records;cursor;cursor=cursor->next) {
-               email_data = (ctsvc_email_s *)cursor->data;
+       for (cursor = contact->emails->records; cursor; cursor = cursor->next) {
+               email_data = cursor->data;
                if (email_data && email_data->email_addr && email_data->email_addr[0]) {
                        ret = __ctsvc_find_person_to_link_with_email(email_data->email_addr, addressbook_id, person_id);
 
@@ -2004,12 +1999,11 @@ static int __ctsvc_db_contact_insert_record(contacts_record_h record, int *id)
        cts_stmt stmt = NULL;
 
        /* These check should be done in client side */
-       RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER,
-                                       "Invalid parameter : contact is NULL");
+       RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
        RETVM_IF(contact->addressbook_id < 0, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : addressbook_id(%d) is mandatory field to insert contact record ", contact->addressbook_id);
+                       "addressbook_id(%d) is mandatory field to insert contact record ", contact->addressbook_id);
        RETVM_IF(0 < contact->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : id(%d), This record is already inserted", contact->id);
+                       "id(%d), This record is already inserted", contact->id);
 
        if (contact->link_mode == CONTACTS_CONTACT_LINK_MODE_IGNORE_ONCE)
                auto_link_enabled = false;
@@ -2018,15 +2012,15 @@ static int __ctsvc_db_contact_insert_record(contacts_record_h record, int *id)
        RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "ctsvc_begin_trans() Fail(%d)", ret);
 
        if (false == ctsvc_have_ab_write_permission(contact->addressbook_id)) {
-               CTS_ERR("ctsvc_have_ab_write_permission fail : does not have permission(addressbook_id : %d)",
-                                       contact->addressbook_id);
+               ERR("ctsvc_have_ab_write_permission Fail: does not have permission(addressbook_id : %d)",
+                               contact->addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_get_next_id(CTS_TABLE_CONTACTS);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_db_get_next_id() Fail(%d)", ret);
+               ERR("ctsvc_db_get_next_id() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -2043,7 +2037,7 @@ static int __ctsvc_db_contact_insert_record(contacts_record_h record, int *id)
        /* Insert Data */
        ret = __ctsvc_contact_insert_data(contact);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("cts_insert_contact_data() Fail(%d)", ret);
+               ERR("cts_insert_contact_data() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -2061,7 +2055,7 @@ static int __ctsvc_db_contact_insert_record(contacts_record_h record, int *id)
                        do {
                                ret = contacts_list_get_current_record_p((contacts_list_h)contact->images, (contacts_record_h*)&image);
                                if (CONTACTS_ERROR_NONE != ret) {
-                                       CTS_ERR("contacts_list_get_current_record_p() Fail(%d)", ret);
+                                       ERR("contacts_list_get_current_record_p() Fail(%d)", ret);
                                        ctsvc_end_trans(false);
                                        return CONTACTS_ERROR_DB;
                                }
@@ -2079,41 +2073,38 @@ static int __ctsvc_db_contact_insert_record(contacts_record_h record, int *id)
        if (contact->person_id) {
                int id;
 
-               snprintf(query,sizeof(query),
-                                       "SELECT contact_id FROM "CTSVC_DB_VIEW_CONTACT" "
-                                               "WHERE person_id = %d", contact->person_id);
+               snprintf(query, sizeof(query),
+                               "SELECT contact_id FROM "CTSVC_DB_VIEW_CONTACT" "
+                               "WHERE person_id = %d", contact->person_id);
                ret = ctsvc_query_get_first_int_result(query, &id);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("Invalid person_id(%d)", contact->person_id);
+                       ERR("Invalid person_id(%d)", contact->person_id);
                        ctsvc_end_trans(false);
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
 
                auto_linked = true;
-       }
-       else if (auto_link_enabled) {
+       } else if (auto_link_enabled) {
                ret = __ctsvc_find_person_to_link((contacts_record_h)contact, contact->addressbook_id, &person_id);
-               CTS_DBG("__ctsvc_find_person_to_link return %d, person_id(%d)", ret, person_id);
+               DBG("__ctsvc_find_person_to_link return %d, person_id(%d)", ret, person_id);
                if (ret == CONTACTS_ERROR_NONE && 0 < person_id) {
                        contact->person_id = person_id;
                        auto_linked = true;
-               }
-               else {
+               } else {
                        ret = ctsvc_db_insert_person((contacts_record_h)contact);
-                       CTS_DBG("ctsvc_db_insert_person return %d, person_id(%d)", ret, ret);
+                       DBG("ctsvc_db_insert_person return %d, person_id(%d)", ret, ret);
                        if (ret < CONTACTS_ERROR_NONE) {
-                               CTS_ERR("ctsvc_db_insert_person() Fail(%d)", ret);
+                               ERR("ctsvc_db_insert_person() Fail(%d)", ret);
                                ctsvc_end_trans(false);
                                return ret;
                        }
                        contact->person_id = ret;
                }
-       }
-       else {
+       } else {
                ret = ctsvc_db_insert_person((contacts_record_h)contact);
-               CTS_DBG("ctsvc_db_insert_person return %d, person_id(%d)", ret, ret);
+               DBG("ctsvc_db_insert_person return %d, person_id(%d)", ret, ret);
                if (ret < CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_db_insert_person() Fail(%d)", ret);
+                       ERR("ctsvc_db_insert_person() Fail(%d)", ret);
                        ctsvc_end_trans(false);
                        return ret;
                }
@@ -2121,7 +2112,7 @@ static int __ctsvc_db_contact_insert_record(contacts_record_h record, int *id)
        }
 
        snprintf(query, sizeof(query),
-               "INSERT INTO "CTS_TABLE_CONTACTS"(contact_id, person_id, addressbook_id, is_favorite, "
+                       "INSERT INTO "CTS_TABLE_CONTACTS"(contact_id, person_id, addressbook_id, is_favorite, "
                        "created_ver, changed_ver, changed_time, link_mode, "
                        "image_changed_ver, has_phonenumber, has_email, "
                        "display_name, reverse_display_name, display_name_source, "
@@ -2132,12 +2123,12 @@ 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,
-                       (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);
        if (NULL == stmt) {
-               CTS_ERR("ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -2167,7 +2158,7 @@ static int __ctsvc_db_contact_insert_record(contacts_record_h record, int *id)
 
        ret = ctsvc_stmt_step(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                return ret;
@@ -2178,7 +2169,7 @@ static int __ctsvc_db_contact_insert_record(contacts_record_h record, int *id)
        if (contact->grouprelations) {
                rel_changed = __ctsvc_contact_insert_grouprel(contact->id, (contacts_list_h)contact->grouprelations);
                if (rel_changed < CONTACTS_ERROR_NONE) {
-                       CTS_ERR("__ctsvc_contact_insert_grouprel() Fail(%d)", rel_changed);
+                       ERR("__ctsvc_contact_insert_grouprel() Fail(%d)", rel_changed);
                        ctsvc_end_trans(false);
                        return rel_changed;
                }
@@ -2186,7 +2177,7 @@ static int __ctsvc_db_contact_insert_record(contacts_record_h record, int *id)
 
        ret = __ctsvc_contact_insert_search_data(contact->id, need_insert_lookup);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("__ctsvc_contact_insert_search_data() Fail(%d)", ret);
+               ERR("__ctsvc_contact_insert_search_data() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -2207,7 +2198,7 @@ static int __ctsvc_db_contact_insert_record(contacts_record_h record, int *id)
                                contacts_list_get_current_record_p((contacts_list_h)contact->numbers, (contacts_record_h*)&number_record);
                                if (number_record->number)
                                        ctsvc_db_phone_log_update_person_id(number_record->number, -1, contact->person_id, false);
-                       } while(CONTACTS_ERROR_NONE == contacts_list_next((contacts_list_h)contact->numbers));
+                       } while (CONTACTS_ERROR_NONE == contacts_list_next((contacts_list_h)contact->numbers));
                }
        }
 #endif /* ENABLE_LOG_FEATURE */
@@ -2237,17 +2228,17 @@ static int __ctsvc_db_contact_replace_record(contacts_record_h record, int conta
        RETVM_IF(ret, ret, "ctsvc_begin_trans() Fail(%d)", ret);
 
        snprintf(query, sizeof(query),
-               "SELECT addressbook_id, person_id FROM "CTS_TABLE_CONTACTS" "
-               "WHERE contact_id = %d AND deleted = 0", contact_id);
+                       "SELECT addressbook_id, person_id FROM "CTS_TABLE_CONTACTS" "
+                       "WHERE contact_id = %d AND deleted = 0", contact_id);
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB errror : ctsvc_query_prepare fail(%d)", ret);
+               ERR("ctsvc_query_prepare fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
        ret = ctsvc_stmt_step(stmt);
        if (1 != ret) {
-               CTS_ERR("The contact_id(%d) is Invalid(%d)", contact_id, ret);
+               ERR("The contact_id(%d) is Invalid(%d)", contact_id, ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NONE == ret)
@@ -2261,7 +2252,7 @@ static int __ctsvc_db_contact_replace_record(contacts_record_h record, int conta
        ctsvc_stmt_finalize(stmt);
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to replace this contact (addressbook_id : %d, contact_id : %d", addressbook_id, contact_id);
+               ERR("ctsvc_have_ab_write_permission(%d) Fail", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
@@ -2272,34 +2263,37 @@ static int __ctsvc_db_contact_replace_record(contacts_record_h record, int conta
        __ctsvc_contact_check_default_data(contact);
 
        /* remove current child data */
-       snprintf(query, sizeof(query), "DELETE FROM "CTS_TABLE_DATA" WHERE contact_id = %d", contact_id);
+       snprintf(query, sizeof(query), "DELETE FROM "CTS_TABLE_DATA" WHERE contact_id = %d",
+                       contact_id);
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = __ctsvc_contact_insert_data(contact);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("__ctsvc_contact_insert_data() Fail(%d)", ret);
+               ERR("__ctsvc_contact_insert_data() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        /* remove current child data */
-       snprintf(query, sizeof(query), "DELETE FROM "CTS_TABLE_GROUP_RELATIONS" WHERE contact_id = %d", contact_id);
+       snprintf(query, sizeof(query),
+                       "DELETE FROM "CTS_TABLE_GROUP_RELATIONS" WHERE contact_id = %d", contact_id);
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        if (contact->grouprelations) {
-               rel_changed = __ctsvc_contact_insert_grouprel(contact_id, (contacts_list_h)contact->grouprelations);
+               rel_changed = __ctsvc_contact_insert_grouprel(contact_id,
+                               (contacts_list_h)contact->grouprelations);
                if (rel_changed < CONTACTS_ERROR_NONE) {
-                       CTS_ERR("__ctsvc_contact_insert_grouprel() Fail(%d)", rel_changed);
+                       ERR("__ctsvc_contact_insert_grouprel() Fail(%d)", rel_changed);
                        ctsvc_end_trans(false);
                        return rel_changed;
                }
@@ -2315,9 +2309,10 @@ static int __ctsvc_db_contact_replace_record(contacts_record_h record, int conta
                if (count) {
                        contacts_list_first((contacts_list_h)contact->images);
                        do {
-                               ret = contacts_list_get_current_record_p((contacts_list_h)contact->images, (contacts_record_h*)&image);
+                               ret = contacts_list_get_current_record_p((contacts_list_h)contact->images,
+                                               (contacts_record_h*)&image);
                                if (CONTACTS_ERROR_NONE != ret) {
-                                       CTS_ERR("contacts_list_get_current_record_p() Fail(%d)", ret);
+                                       ERR("contacts_list_get_current_record_p() Fail(%d)", ret);
                                        ctsvc_end_trans(false);
                                        return CONTACTS_ERROR_DB;
                                }
@@ -2329,24 +2324,22 @@ static int __ctsvc_db_contact_replace_record(contacts_record_h record, int conta
                        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);
+                               ctsvc_record_set_property_flag((ctsvc_record_s*)contact, _contacts_contact.image_thumbnail_path, CTSVC_PROPERTY_FLAG_DIRTY);
 
                                if (ctsvc_contact_check_image_location(image->path))
                                        contact->image_thumbnail_path = SAFE_STRDUP(image->path + strlen(CTSVC_CONTACT_IMG_FULL_LOCATION) + 1);
                                else
                                        contact->image_thumbnail_path = SAFE_STRDUP(image->path);
                        }
-               }
-               else if (contact->image_thumbnail_path) {
+               } else if (contact->image_thumbnail_path) {
                        free(contact->image_thumbnail_path);
                        contact->image_thumbnail_path = NULL;
-                       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 {
-                               if (((ctsvc_record_s *)record)->properties_flags) {
+                       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 {
+                               if (((ctsvc_record_s*)record)->properties_flags) {
                                        int index = _contacts_contact.image_thumbnail_path & 0x000000FF;
-                                       ((ctsvc_record_s *)record)->properties_flags[index] = 0;
+                                       ((ctsvc_record_s*)record)->properties_flags[index] = 0;
                                }
                        }
                }
@@ -2355,25 +2348,25 @@ static int __ctsvc_db_contact_replace_record(contacts_record_h record, int conta
 
        len = snprintf(query, sizeof(query),
                        "UPDATE "CTS_TABLE_CONTACTS" SET changed_ver=%d, changed_time=%d, is_favorite=%d, "
-                                       "has_phonenumber=%d, has_email=%d, display_name=?, "
-                                       "reverse_display_name=?, display_name_source=%d, "
-                                       "display_name_language=%d, reverse_display_name_language=%d, "
-                                       "sort_name=?, reverse_sort_name=?, "
-                                       "sortkey=?, reverse_sortkey=?, uid=?, ringtone_path=?, vibration=?, "
-                                       "message_alert =?, image_thumbnail_path=?",
-                                       version, (int)time(NULL), contact->is_favorite,
-                                       contact->has_phonenumber, contact->has_email,
-                                       contact->display_source_type,
-                                       contact->display_name_language, contact->reverse_display_name_language);
-
-       if (ctsvc_record_check_property_flag((ctsvc_record_s *)contact, _contacts_contact.image_thumbnail_path, CTSVC_PROPERTY_FLAG_DIRTY))
+                       "has_phonenumber=%d, has_email=%d, display_name=?, "
+                       "reverse_display_name=?, display_name_source=%d, "
+                       "display_name_language=%d, reverse_display_name_language=%d, "
+                       "sort_name=?, reverse_sort_name=?, "
+                       "sortkey=?, reverse_sortkey=?, uid=?, ringtone_path=?, vibration=?, "
+                       "message_alert =?, image_thumbnail_path=?",
+                       version, (int)time(NULL), contact->is_favorite,
+                       contact->has_phonenumber, contact->has_email,
+                       contact->display_source_type,
+                       contact->display_name_language, contact->reverse_display_name_language);
+
+       if (ctsvc_record_check_property_flag((ctsvc_record_s*)contact, _contacts_contact.image_thumbnail_path, CTSVC_PROPERTY_FLAG_DIRTY))
                len += snprintf(query+len, sizeof(query)-len, ", image_changed_ver = %d", version);
 
        len += snprintf(query+len, sizeof(query)-len, " WHERE contact_id=%d", contact->id);
 
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -2403,7 +2396,7 @@ static int __ctsvc_db_contact_replace_record(contacts_record_h record, int conta
 
        ret = ctsvc_stmt_step(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                return ret;
@@ -2425,3 +2418,20 @@ static int __ctsvc_db_contact_replace_record(contacts_record_h record, int conta
                return CONTACTS_ERROR_NONE;
 }
 
+ctsvc_db_plugin_info_s ctsvc_db_plugin_contact = {
+       .is_query_only = false,
+       .insert_record = __ctsvc_db_contact_insert_record,
+       .get_record = __ctsvc_db_contact_get_record,
+       .update_record = __ctsvc_db_contact_update_record,
+       .delete_record = __ctsvc_db_contact_delete_record,
+       .get_all_records = __ctsvc_db_contact_get_all_records,
+       .get_records_with_query = __ctsvc_db_contact_get_records_with_query,
+       .insert_records = NULL,
+       .update_records = NULL,
+       .delete_records = NULL,
+       .get_count = NULL,
+       .get_count_with_query = NULL,
+       .replace_record = __ctsvc_db_contact_replace_record,
+       .replace_records = NULL,
+};
+
index 76cf728..b5c571f 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -70,7 +70,7 @@ int ctsvc_contact_add_image_file(int parent_id, int img_id,
        char *temp;
        char *lower_ext;
 
-       RETVM_IF(NULL == src_img, CONTACTS_ERROR_INVALID_PARAMETER, "image_thumbnail_path is NULL");
+       RETV_IF(NULL == src_img, CONTACTS_ERROR_INVALID_PARAMETER);
 
        ext = strrchr(src_img, '.');
        if (NULL == ext || strchr(ext, '/'))
@@ -79,7 +79,7 @@ int ctsvc_contact_add_image_file(int parent_id, int img_id,
        lower_ext = strdup(ext);
        temp = lower_ext;
        if (NULL == temp) {
-               CTS_ERR("strdup() Fail");
+               ERR("strdup() Fail");
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
        while (*temp) {
@@ -93,7 +93,7 @@ int ctsvc_contact_add_image_file(int parent_id, int img_id,
 
        ret = ctsvc_utils_copy_image(CTSVC_CONTACT_IMG_FULL_LOCATION, src_img, dest);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_utils_copy_image() Fail(%d)", ret);
+               ERR("ctsvc_utils_copy_image() Fail(%d)", ret);
                dest[0] = '\0';
                return ret;
        }
@@ -110,11 +110,11 @@ static int __ctsvc_contact_get_current_image_file(int image_id, char *dest, int
 
        snprintf(query, sizeof(query), "SELECT data3 FROM %s WHERE id = %d", CTS_TABLE_DATA, image_id);
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/ != ret) {
-               CTS_ERR("DB error: ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("DB error: ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
@@ -123,9 +123,9 @@ static int __ctsvc_contact_get_current_image_file(int image_id, char *dest, int
        }
 
        tmp_path = ctsvc_stmt_get_text(stmt, 0);
-       if (tmp_path) {
+       if (tmp_path)
                snprintf(dest, dest_size, "%s/%s", CTSVC_CONTACT_IMG_FULL_LOCATION, tmp_path);
-       }
+
        ctsvc_stmt_finalize(stmt);
        return CONTACTS_ERROR_NONE;
 }
@@ -174,9 +174,8 @@ int ctsvc_contact_update_image_file(int parent_id, int img_id,
                }
 
                ret = unlink(dest);
-               if (ret < 0) {
-                       CTS_WARN("unlink Fail(%d)", errno);
-               }
+               if (ret < 0)
+                       WARN("unlink() Fail(%d)", errno);
        }
 
        if (src_img) {
@@ -204,7 +203,7 @@ int ctsvc_db_contact_update_changed_time(int contact_id)
        return CONTACTS_ERROR_NONE;
 }
 
-int ctsvc_contact_delete_image_file_with_path(const unsigned charimage_path)
+int ctsvc_contact_delete_image_file_with_path(const unsigned char *image_path)
 {
        int ret;
 
@@ -212,9 +211,8 @@ int ctsvc_contact_delete_image_file_with_path(const unsigned char* image_path)
                char full_path[CTSVC_IMG_FULL_PATH_SIZE_MAX] = {0};
                snprintf(full_path, sizeof(full_path), "%s/%s", CTSVC_CONTACT_IMG_FULL_LOCATION, image_path);
                ret = unlink(full_path);
-               if (ret < 0) {
-                       CTS_WARN("unlink Fail(%d)", errno);
-               }
+               if (ret < 0)
+                       WARN("unlink() Fail(%d)", errno);
        }
 
        return CONTACTS_ERROR_NONE;
@@ -232,22 +230,22 @@ int ctsvc_db_contact_delete(int contact_id)
        int version;
 
        ret = ctsvc_begin_trans();
-       RETVM_IF(ret, ret, "DB error : ctsvc_begin_trans() Fail(%d)", ret);
+       RETVM_IF(ret, ret, "ctsvc_begin_trans() Fail(%d)", ret);
 
        snprintf(query, sizeof(query),
-               "SELECT addressbook_id, person_id "
-               "FROM "CTS_TABLE_CONTACTS" WHERE contact_id = %d AND deleted = 0", contact_id);
+                       "SELECT addressbook_id, person_id "
+                       "FROM "CTS_TABLE_CONTACTS" WHERE contact_id = %d AND deleted = 0", contact_id);
 
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_stmt_step(stmt);
        if (1 != ret) {
-               CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NONE == ret)
@@ -258,12 +256,12 @@ int ctsvc_db_contact_delete(int contact_id)
 
        addressbook_id = ctsvc_stmt_get_int(stmt, 0);
        person_id = ctsvc_stmt_get_int(stmt, 1);
-       CTS_DBG("addressbook_id : %d, person_id : %d", addressbook_id, person_id);
+       DBG("addressbook_id : %d, person_id : %d", addressbook_id, person_id);
        ctsvc_stmt_finalize(stmt);
        stmt = NULL;
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to delete this contact");
+               ERR("Does not have permission to delete this contact");
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
@@ -271,11 +269,11 @@ int ctsvc_db_contact_delete(int contact_id)
        version = ctsvc_get_next_ver();
        snprintf(query, sizeof(query),
                        "UPDATE %s SET member_changed_ver=%d "
-                               "WHERE group_id IN (SELECT group_id FROM %s WHERE contact_id = %d AND deleted = 0) ",
-                               CTS_TABLE_GROUPS, version, CTS_TABLE_GROUP_RELATIONS, contact_id);
+                       "WHERE group_id IN (SELECT group_id FROM %s WHERE contact_id = %d AND deleted = 0) ",
+                       CTS_TABLE_GROUPS, version, CTS_TABLE_GROUP_RELATIONS, contact_id);
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -286,7 +284,7 @@ int ctsvc_db_contact_delete(int contact_id)
                        CTS_TABLE_CONTACTS, version, contact_id);
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -306,9 +304,9 @@ int ctsvc_db_contact_delete(int contact_id)
                /* update phonelog */
                ctsvc_db_phone_log_update_person_id(NULL, person_id, -1, false);
 #endif /* ENABLE_LOG_FEATURE */
-       }
-       else
+       } else {
                ctsvc_set_person_noti();
+       }
 
        ctsvc_set_contact_noti();
        if (0 < rel_changed)
@@ -316,42 +314,42 @@ int ctsvc_db_contact_delete(int contact_id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
 static inline void __ctsvc_contact_get_initial(char *src, char *dest, int dest_size, bool pinyin)
 {
-       int i, j=0;
+       int i, j = 0;
        bool bFirst = true;
        int len = strlen(src);
        for (i = 0; i < len && j < (dest_size-1);) {
                if (src[i] == ' ') {
-                       bFirst=true;
+                       bFirst = true;
                        i++;
                } else if (bFirst) {
                        int char_len = ctsvc_check_utf8(src[i]);
                        int k;
-                       for (k=0;k<char_len && j < (dest_size-1) ;k++)
+                       for (k = 0; k < char_len && j < (dest_size-1); k++)
                                dest[j++] = src[i++];
                        if (false == pinyin && j < (dest_size-1))
                                dest[j++] = ' ';
                        bFirst = false;
-               }
-               else
+               } else {
                        i++;
+               }
        }
 }
 
 static inline void __ctsvc_remove_space(char *src, char *dest, int dest_size)
 {
        int len = strlen(src);
-       int i, j=0;
+       int i, j = 0;
 
-       for (i=0; i < len && i < dest_size; i++) {
+       for (i = 0; i < len && i < dest_size; i++) {
                if (src[i] && src[i] != ' ') {
                        dest[j] = src[i];
                        j++;
@@ -368,7 +366,8 @@ static inline void __ctsvc_remove_space(char *src, char *dest, int dest_size)
  * chinese : display_name, pinyin name, pinyin initial, phonetic
  * others : display_name, phonetic
  */
-int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name) {
+int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name)
+{
        char *name = NULL;
        char *temp_name = NULL;
        int buf_size, ret;
@@ -378,22 +377,21 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name)
        if (contact->display_name) {
                if (ctsvc_has_chinese(contact->display_name)) {
                        if (CTSVC_LANG_JAPANESE == ctsvc_check_language_type(contact->sort_name)) {
-                               char *normalized_display_name=NULL;
+                               char *normalized_display_name = NULL;
 
                                ctsvc_normalize_str(contact->display_name, &normalized_display_name);
                                if (normalized_display_name) {
                                        buf_size = SAFE_STRLEN(normalized_display_name) + strlen(contact->sort_name) + 2;
                                        name = calloc(1, buf_size);
                                        if (NULL == name) {
-                                               CTS_ERR("calloc() Fail");
+                                               ERR("calloc() Fail");
                                                free(normalized_display_name);
                                                return CONTACTS_ERROR_OUT_OF_MEMORY;
                                        }
                                        snprintf(name, buf_size, "%s %s", normalized_display_name, contact->sort_name);
                                        free(normalized_display_name);
                                }
-                       }
-                       else {
+                       } else {
                                char *langset = ctsvc_get_langset();
                                if (STRING_EQUAL == strncmp(langset, "zh_CN", strlen("zh_CN"))) {
                                        pinyin_name_s *pinyinname;
@@ -401,10 +399,10 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name)
 
                                        ret = ctsvc_convert_chinese_to_pinyin(contact->display_name, &pinyinname, &size);
                                        if (CONTACTS_ERROR_NONE == ret) {
-                                               int name_len = (CHINESE_PINYIN_SPELL_MAX_LEN*strlen(contact->display_name)+1) sizeof(char);
+                                               int name_len = (CHINESE_PINYIN_SPELL_MAX_LEN*strlen(contact->display_name)+1)  *sizeof(char);
                                                char *name_nospace = calloc(1, name_len);
                                                if (NULL == name_nospace) {
-                                                       CTS_ERR("calloc() Fail");
+                                                       ERR("calloc() Fail");
                                                        ctsvc_pinyin_free(pinyinname, size);
                                                        return CONTACTS_ERROR_OUT_OF_MEMORY;
                                                }
@@ -412,17 +410,17 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name)
 
                                                ctsvc_normalize_str(contact->display_name, &name);
                                                if (name) {
-                                                       for (i=0; i<size; i++) {
+                                                       for (i = 0; i < size; i++) {
                                                                __ctsvc_remove_space(pinyinname[i].pinyin_name, name_nospace, name_len);
 
                                                                buf_size = SAFE_STRLEN(name)
-                                                                                                       + SAFE_STRLEN(pinyinname[i].pinyin_name)
-                                                                                                       + SAFE_STRLEN(name_nospace)
-                                                                                                       + SAFE_STRLEN(pinyinname[i].pinyin_initial)
-                                                                                                       + 4;
+                                                                       + SAFE_STRLEN(pinyinname[i].pinyin_name)
+                                                                       + SAFE_STRLEN(name_nospace)
+                                                                       + SAFE_STRLEN(pinyinname[i].pinyin_initial)
+                                                                       + 4;
                                                                temp_name = calloc(1, buf_size);
                                                                if (NULL == temp_name) {
-                                                                       CTS_ERR("calloc() Fail");
+                                                                       ERR("calloc() Fail");
                                                                        free(name_nospace);
                                                                        ctsvc_pinyin_free(pinyinname, size);
                                                                        free(name);
@@ -436,13 +434,13 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name)
                                                }
 
                                                len = ctsvc_check_utf8(contact->display_name[0]);
-                                               for (i=len; i < strlen(contact->display_name); i+=len) {
+                                               for (i = len; i < strlen(contact->display_name); i += len) {
                                                        len = ctsvc_check_utf8(contact->display_name[i]);
 
                                                        buf_size = SAFE_STRLEN(name) + SAFE_STRLEN(&contact->display_name[i]) + 2;
                                                        temp_name = calloc(1, buf_size);
                                                        if (NULL == temp_name) {
-                                                               CTS_ERR("calloc() Fail");
+                                                               ERR("calloc() Fail");
                                                                free(name_nospace);
                                                                ctsvc_pinyin_free(pinyinname, size);
                                                                free(name);
@@ -456,8 +454,7 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name)
 
                                                free(name_nospace);
                                                ctsvc_pinyin_free(pinyinname, size);
-                                       }
-                                       else {
+                                       } else {
                                                char initial[CTSVC_CONTACT_INITIAL_DATA_MAX_LEN] = {0,};
                                                char *normalized_display_name = NULL;
 
@@ -467,7 +464,7 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name)
                                                        buf_size = SAFE_STRLEN(normalized_display_name) + strlen(initial) + 2;
                                                        name = calloc(1, buf_size);
                                                        if (NULL == name) {
-                                                               CTS_ERR("calloc() Fail");
+                                                               ERR("calloc() Fail");
                                                                free(normalized_display_name);
                                                                return CONTACTS_ERROR_OUT_OF_MEMORY;
                                                        }
@@ -476,8 +473,7 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name)
                                                        free(normalized_display_name);
                                                }
                                        }
-                               }
-                               else {
+                               } else {
                                        char initial[CTSVC_CONTACT_INITIAL_DATA_MAX_LEN] = {0,};
                                        char *normalized_display_name = NULL;
 
@@ -487,7 +483,7 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name)
                                                buf_size = SAFE_STRLEN(normalized_display_name) + strlen(initial) + 2;
                                                name = calloc(1, buf_size);
                                                if (NULL == name) {
-                                                       CTS_ERR("calloc() Fail");
+                                                       ERR("calloc() Fail");
                                                        free(normalized_display_name);
                                                        return CONTACTS_ERROR_OUT_OF_MEMORY;
                                                }
@@ -497,14 +493,13 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name)
                                        }
                                }
                        }
-               }
-               else if (ctsvc_has_korean(contact->display_name)) {
+               } else if (ctsvc_has_korean(contact->display_name)) {
                        /* 'a가' should be searched by 'ㄱ' */
                        int count, i, j;
                        int full_len, chosung_len;
                        char *chosung = calloc(1, strlen(contact->display_name) * 5);
                        if (NULL == chosung) {
-                               CTS_ERR("calloc() Fail");
+                               ERR("calloc() Fail");
                                return CONTACTS_ERROR_OUT_OF_MEMORY;
                        }
                        int total_len = strlen(contact->display_name);
@@ -514,14 +509,14 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name)
                        ctsvc_normalize_str(contact->display_name, &name);
 
                        if (0 < count) {
-                               for (i=0, j=0; i < total_len; i+=full_len, j+=chosung_len) {
+                               for (i = 0, j = 0; i < total_len; i += full_len, j += chosung_len) {
                                        full_len = ctsvc_check_utf8(contact->display_name[i]);
                                        chosung_len = ctsvc_check_utf8(chosung[j]);
 
                                        buf_size = SAFE_STRLEN(name) + SAFE_STRLEN(&contact->display_name[i]) + SAFE_STRLEN(&chosung[j]) + 3;
                                        temp_name = calloc(1, buf_size);
                                        if (NULL == temp_name) {
-                                               CTS_ERR("calloc() Fail");
+                                               ERR("calloc() Fail");
                                                free(chosung);
                                                free(name);
                                                return CONTACTS_ERROR_OUT_OF_MEMORY;
@@ -534,14 +529,12 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name)
                                }
                        }
                        free(chosung);
-               }
-               else if (CTSVC_LANG_JAPANESE == ctsvc_check_language_type(contact->display_name)) {
+               } else if (CTSVC_LANG_JAPANESE == ctsvc_check_language_type(contact->display_name)) {
                        ctsvc_convert_japanese_to_hiragana(contact->display_name, &name);
-               }
-               else {
+               } else {
                        /* Insert 'ABO Â' for 'ÂBC' */
-                       char initial[CTSVC_CONTACT_INITIAL_DATA_MAX_LEN] = {0,};
-                       char *normalized_display_name=NULL;
+                       char initial[CTSVC_CONTACT_INITIAL_DATA_MAX_LEN] = {0};
+                       char *normalized_display_name = NULL;
 
                        ctsvc_normalize_str(contact->display_name, &normalized_display_name);
                        if (normalized_display_name) {
@@ -549,7 +542,7 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name)
                                buf_size = SAFE_STRLEN(normalized_display_name) + strlen(initial) + 2;
                                name = calloc(1, buf_size);
                                if (NULL == name) {
-                                       CTS_ERR("calloc() Fail");
+                                       ERR("calloc() Fail");
                                        free(normalized_display_name);
                                        return CONTACTS_ERROR_OUT_OF_MEMORY;
                                }
@@ -575,7 +568,7 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name)
                                buf_size += 3; /* for space and null string */
                                phonetic = calloc(1, buf_size);
                                if (NULL == phonetic) {
-                                       CTS_ERR("calloc() Fail");
+                                       ERR("calloc() Fail");
                                        free(name);
                                        return CONTACTS_ERROR_OUT_OF_MEMORY;
                                }
@@ -597,7 +590,7 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name)
                                        buf_size = SAFE_STRLEN(name) + SAFE_STRLEN(phonetic) + 2;
                                        temp_name = calloc(1, buf_size);
                                        if (NULL == temp_name) {
-                                               CTS_ERR("calloc() Fail");
+                                               ERR("calloc() Fail");
                                                free(phonetic);
                                                free(name);
                                                return CONTACTS_ERROR_OUT_OF_MEMORY;
@@ -606,9 +599,9 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name)
                                        free(name);
                                        name = temp_name;
                                        free(phonetic);
-                               }
-                               else
+                               } else {
                                        name = phonetic;
+                               }
                        }
                }
        }
@@ -617,14 +610,14 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name)
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_make_phonetic_name(ctsvc_name_s* name, char** phonetic, contacts_name_display_order_e order)
+static int __ctsvc_make_phonetic_name(ctsvc_name_s *name, char **phonetic, contacts_name_display_order_e order)
 {
        int len = SAFE_STRLEN(name->phonetic_first) + SAFE_STRLEN(name->phonetic_last) + SAFE_STRLEN(name->phonetic_middle);
        if (0 < len) {
                len += 3; /* for space and null string */
                *phonetic = calloc(1, len);
                if (NULL == *phonetic) {
-                       CTS_ERR("calloc() Fail");
+                       ERR("calloc() Fail");
                        return CONTACTS_ERROR_OUT_OF_MEMORY;
                }
 
@@ -642,8 +635,7 @@ static int __ctsvc_make_phonetic_name(ctsvc_name_s* name, char** phonetic, conta
                                        temp_len += snprintf(*phonetic + temp_len, len - temp_len, " ");
                                temp_len += snprintf(*phonetic + temp_len, len - temp_len, "%s", name->phonetic_last);
                        }
-               }
-               else {
+               } else {
                        if (name->phonetic_last)
                                temp_len += snprintf(*phonetic, len, "%s", name->phonetic_last);
                        if (name->phonetic_middle) {
@@ -662,7 +654,8 @@ static int __ctsvc_make_phonetic_name(ctsvc_name_s* name, char** phonetic, conta
        return CONTACTS_ERROR_NONE;
 }
 
-static inline int __ctsvc_get_sort_name_to_pinyin(const char *display_name, char **sort_name) {
+static inline int __ctsvc_get_sort_name_to_pinyin(const char *display_name, char **sort_name)
+{
        int ret;
        int size;
        pinyin_name_s *pinyinname = NULL;
@@ -737,7 +730,7 @@ void ctsvc_contact_make_sortkey(ctsvc_contact_s *contact)
        if (contact->display_source_type == CONTACTS_DISPLAY_NAME_SOURCE_TYPE_NAME) {
                if (0 < contact->name->count && contact->name->records
                                && contact->name->records->data) {
-                       ctsvc_name_s *name = (ctsvc_name_s *)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);
                }
        }
@@ -768,9 +761,8 @@ void ctsvc_contact_make_sortkey(ctsvc_contact_s *contact)
                                        contact->sort_name = pinyin;
                                        sort_type = CTSVC_SORT_WESTERN;
                                }
-                       }
-                       else if (STRING_EQUAL == strncmp(langset, "ko_KR", strlen("ko_KR"))) {
-                                       sort_type = CTSVC_SORT_KOREAN;
+                       } else if (STRING_EQUAL == strncmp(langset, "ko_KR", strlen("ko_KR"))) {
+                               sort_type = CTSVC_SORT_KOREAN;
                        }
                }
                break;
@@ -812,7 +804,7 @@ void ctsvc_contact_make_sortkey(ctsvc_contact_s *contact)
        if (contact->display_source_type == CONTACTS_DISPLAY_NAME_SOURCE_TYPE_NAME) {
                if (0 < contact->name->count && contact->name->records
                                && contact->name->records->data) {
-                       ctsvc_name_s *name = (ctsvc_name_s *)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);
                }
        }
@@ -841,9 +833,8 @@ void ctsvc_contact_make_sortkey(ctsvc_contact_s *contact)
                                        contact->reverse_sort_name = pinyin;
                                        sort_type = CTSVC_SORT_WESTERN;
                                }
-                       }
-                       else if (STRING_EQUAL == strncmp(langset, "ko_KR", strlen("ko_KR"))) {
-                                       sort_type = CTSVC_SORT_KOREAN;
+                       } else if (STRING_EQUAL == strncmp(langset, "ko_KR", strlen("ko_KR"))) {
+                               sort_type = CTSVC_SORT_KOREAN;
                        }
                }
                break;
@@ -958,23 +949,23 @@ int ctsvc_contact_get_name_language(const ctsvc_name_s *name)
        return lang;
 }
 
-char * __ctsvc_remove_first_space(char *src)
+char* __ctsvc_remove_first_space(char *src)
 {
-       if (src == NULL ||SAFE_STRLEN(src) == 0)
+       if (src == NULL || SAFE_STRLEN(src) == 0)
                return NULL;
 
        int name_len = (SAFE_STRLEN(src)+1)*sizeof(char);
        char *name_nospace = NULL;
        name_nospace = calloc(1, name_len);
        if (NULL == name_nospace) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                return NULL;
        }
 
        int len = strlen(src);
-       int i =0;
+       int i = 0;
 
-       for (i=0; i < len && i < name_len; i++) {
+       for (i = 0; i < len && i < name_len; i++) {
                if (src[i] && src[i] != ' ') {
                        strncpy(name_nospace, src+i, name_len);
                        break;
@@ -1015,11 +1006,13 @@ 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 && contact->name->records->data) {
-               name = (ctsvc_name_s *)contact->name->records->data;
+       if (0 < contact->name->count && contact->name->records
+                       && contact->name->records->data) {
+               name = (ctsvc_name_s*)contact->name->records->data;
        }
 
-       if (name && (name->first || name->last || name->prefix || name->addition || name->suffix)) {
+       if (name && (name->first || name->last || name->prefix || name->addition
+                               || name->suffix)) {
                int reverse_lang_type = -1;
                int display_len;
                int temp_display_len;
@@ -1035,22 +1028,22 @@ void ctsvc_contact_make_display_name(ctsvc_contact_s *contact)
                 *    But, if there is only prefix, reverse sort_name is prefix
                 */
                temp_display_len = SAFE_STRLEN(name->first)
-                                               + SAFE_STRLEN(name->addition)
-                                               + SAFE_STRLEN(name->last)
-                                               + SAFE_STRLEN(name->suffix);
+                       + SAFE_STRLEN(name->addition)
+                       + SAFE_STRLEN(name->last)
+                       + SAFE_STRLEN(name->suffix);
                if (0 < temp_display_len) {
                        temp_display_len += 7;
                        temp_display = calloc(1, temp_display_len);
                        if (NULL == temp_display) {
-                               CTS_ERR("calloc() Fail");
+                               ERR("calloc() Fail");
                                return;
                        }
-                       len=0;
+                       len = 0;
 
                        /* get language type */
                        reverse_lang_type = ctsvc_contact_get_name_language(name);
                        if (name->last) {
-                               char temp = __ctsvc_remove_first_space(name->last);
+                               char  *temp = __ctsvc_remove_first_space(name->last);
                                len += snprintf(temp_display + len, temp_display_len - len, "%s", temp);
                                free(temp);
                                if (reverse_lang_type != CTSVC_LANG_KOREAN &&
@@ -1064,7 +1057,7 @@ void ctsvc_contact_make_display_name(ctsvc_contact_s *contact)
                        if (reverse_lang_type == CTSVC_LANG_JAPANESE) {
                                /* make temp_display name Prefix - Last - Middle - First - Suffix */
                                if (name->addition) {
-                                       char temp = __ctsvc_remove_first_space(name->addition);
+                                       char  *temp = __ctsvc_remove_first_space(name->addition);
                                        if (*temp_display)
                                                len += snprintf(temp_display + len, temp_display_len - len, " ");
                                        len += snprintf(temp_display + len, temp_display_len - len, "%s", temp);
@@ -1072,54 +1065,50 @@ void ctsvc_contact_make_display_name(ctsvc_contact_s *contact)
                                }
 
                                if (name->first) {
-                                       char temp = __ctsvc_remove_first_space(name->first);
+                                       char  *temp = __ctsvc_remove_first_space(name->first);
                                        if (*temp_display)
                                                len += snprintf(temp_display + len, temp_display_len - len, " ");
                                        len += snprintf(temp_display + len, temp_display_len - len, "%s", temp);
                                        free(temp);
                                }
-                       }
-                       else if (reverse_lang_type == CTSVC_LANG_CHINESE || reverse_lang_type == CTSVC_LANG_KOREAN) {
+                       } else if (reverse_lang_type == CTSVC_LANG_CHINESE || reverse_lang_type == CTSVC_LANG_KOREAN) {
                                if (name->addition) {
-                                       char temp = __ctsvc_remove_first_space(name->addition);
+                                       char  *temp = __ctsvc_remove_first_space(name->addition);
                                        len += snprintf(temp_display + len, temp_display_len - len, "%s", temp);
                                        free(temp);
                                }
 
                                if (name->first) {
-                                       char temp = __ctsvc_remove_first_space(name->first);
+                                       char  *temp = __ctsvc_remove_first_space(name->first);
                                        len += snprintf(temp_display + len, temp_display_len - len, "%s", temp);
                                        free(temp);
                                }
-                       }
-                       else {
+                       } else {
                                /* make temp_display name Prefix - Last - First - Middle - Suffix */
                                if (name->first) {
                                        if (*temp_display) {
-                                               if (reverse_lang_type < 0) {
+                                               if (reverse_lang_type < 0)
                                                        reverse_lang_type = ctsvc_check_language_type(temp_display);
-                                               }
 
                                                if (reverse_lang_type != CTSVC_LANG_KOREAN &&
                                                                reverse_lang_type != CTSVC_LANG_CHINESE)
                                                        len += snprintf(temp_display + len, temp_display_len - len, " ");
                                        }
-                                       char temp = __ctsvc_remove_first_space(name->first);
+                                       char  *temp = __ctsvc_remove_first_space(name->first);
                                        len += snprintf(temp_display + len, temp_display_len - len, "%s", temp);
                                        free(temp);
                                }
 
                                if (name->addition) {
                                        if (*temp_display) {
-                                               if (reverse_lang_type < 0) {
+                                               if (reverse_lang_type < 0)
                                                        reverse_lang_type = ctsvc_check_language_type(temp_display);
-                                               }
 
                                                if (reverse_lang_type != CTSVC_LANG_KOREAN &&
                                                                reverse_lang_type != CTSVC_LANG_CHINESE)
                                                        len += snprintf(temp_display + len, temp_display_len - len, " ");
                                        }
-                                       char temp = __ctsvc_remove_first_space(name->addition);
+                                       char  *temp = __ctsvc_remove_first_space(name->addition);
                                        len += snprintf(temp_display + len, temp_display_len - len, "%s", temp);
                                        free(temp);
                                }
@@ -1127,17 +1116,16 @@ void ctsvc_contact_make_display_name(ctsvc_contact_s *contact)
 
                        if (name->suffix) {
                                if (*temp_display) {
-                                       if (reverse_lang_type < 0) {
+                                       if (reverse_lang_type < 0)
                                                reverse_lang_type = ctsvc_check_language_type(temp_display);
-                                       }
 
                                        if (reverse_lang_type == CTSVC_LANG_JAPANESE)
                                                len += snprintf(temp_display + len, temp_display_len - len, " ");
                                        else if (reverse_lang_type != CTSVC_LANG_KOREAN &&
-                                                               reverse_lang_type != CTSVC_LANG_CHINESE)
+                                                       reverse_lang_type != CTSVC_LANG_CHINESE)
                                                len += snprintf(temp_display + len, temp_display_len - len, ", ");
                                }
-                               char temp = __ctsvc_remove_first_space(name->suffix);
+                               char  *temp = __ctsvc_remove_first_space(name->suffix);
                                len += snprintf(temp_display + len, temp_display_len - len, "%s", temp);
                                free(temp);
                        }
@@ -1147,21 +1135,19 @@ void ctsvc_contact_make_display_name(ctsvc_contact_s *contact)
                        display_len = SAFE_STRLEN(name->prefix) + temp_display_len + 2;
                        display = calloc(1, display_len);
                        if (NULL == display) {
-                               CTS_ERR("calloc() Fail");
+                               ERR("calloc() Fail");
                                free(temp_display);
                                return;
                        }
-                       char temp = __ctsvc_remove_first_space(name->prefix);
+                       char  *temp = __ctsvc_remove_first_space(name->prefix);
                        snprintf(display, display_len, "%s %s", temp, temp_display);
                        free(temp);
                        contact->reverse_display_name = display;
                        contact->reverse_sort_name = temp_display;
-               }
-               else if (temp_display) {
+               } else if (temp_display) {
                        contact->reverse_display_name = temp_display;
                        contact->reverse_sort_name = strdup(temp_display);
-               }
-               else if (name->prefix) {
+               } else if (name->prefix) {
                        contact->reverse_display_name = strdup(name->prefix);
                        contact->reverse_sort_name = strdup(name->prefix);
                }
@@ -1175,36 +1161,35 @@ void ctsvc_contact_make_display_name(ctsvc_contact_s *contact)
                 *    But, if there is only prefix, sort_name is prefix
                 */
                if (reverse_lang_type == CTSVC_LANG_KOREAN ||
-                       reverse_lang_type == CTSVC_LANG_CHINESE ||
-                       reverse_lang_type == CTSVC_LANG_JAPANESE) {
+                               reverse_lang_type == CTSVC_LANG_CHINESE ||
+                               reverse_lang_type == CTSVC_LANG_JAPANESE) {
                        contact->display_name = strdup(contact->reverse_display_name);
                        contact->sort_name = SAFE_STRDUP(contact->reverse_sort_name);
-               }
-               else {
+               } else {
                        int lang_type = -1;
                        temp_display = NULL;
                        temp_display_len = SAFE_STRLEN(name->first)
-                                                               + SAFE_STRLEN(name->addition)
-                                                               + SAFE_STRLEN(name->last)
-                                                               + SAFE_STRLEN(name->suffix);
+                               + SAFE_STRLEN(name->addition)
+                               + SAFE_STRLEN(name->last)
+                               + SAFE_STRLEN(name->suffix);
                        if (0 < temp_display_len) {
                                temp_display_len += 6;
                                /* make reverse_temp_display_name */
                                temp_display = calloc(1, temp_display_len);
                                if (NULL == temp_display) {
-                                       CTS_ERR("calloc() Fail");
+                                       ERR("calloc() Fail");
                                        return;
                                }
                                len = 0;
 
                                if (name->first) {
-                                       char temp = __ctsvc_remove_first_space(name->first);
+                                       char  *temp = __ctsvc_remove_first_space(name->first);
                                        len += snprintf(temp_display + len, temp_display_len - len, "%s", temp);
                                        free(temp);
                                }
 
                                if (name->addition) {
-                                       char temp = __ctsvc_remove_first_space(name->addition);
+                                       char  *temp = __ctsvc_remove_first_space(name->addition);
                                        if (*temp_display)
                                                len += snprintf(temp_display + len, temp_display_len - len, " ");
                                        len += snprintf(temp_display + len, temp_display_len - len, "%s", temp);
@@ -1212,7 +1197,7 @@ void ctsvc_contact_make_display_name(ctsvc_contact_s *contact)
                                }
 
                                if (name->last) {
-                                       char temp = __ctsvc_remove_first_space(name->last);
+                                       char  *temp = __ctsvc_remove_first_space(name->last);
                                        if (*temp_display)
                                                len += snprintf(temp_display + len, temp_display_len - len, " ");
                                        len += snprintf(temp_display + len, temp_display_len - len, "%s", temp);
@@ -1227,7 +1212,7 @@ void ctsvc_contact_make_display_name(ctsvc_contact_s *contact)
                                                else
                                                        len += snprintf(temp_display + len, temp_display_len - len, ", ");
                                        }
-                                       char temp = __ctsvc_remove_first_space(name->suffix);
+                                       char  *temp = __ctsvc_remove_first_space(name->suffix);
                                        len += snprintf(temp_display + len, temp_display_len - len, "%s", temp);
                                        free(temp);
                                }
@@ -1237,34 +1222,31 @@ void ctsvc_contact_make_display_name(ctsvc_contact_s *contact)
                                display_len = SAFE_STRLEN(name->prefix) + temp_display_len + 2;
                                display = calloc(1, display_len);
                                if (NULL == display) {
-                                       CTS_ERR("calloc() Fail");
+                                       ERR("calloc() Fail");
                                        free(temp_display);
                                        return;
                                }
                                snprintf(display, display_len, "%s %s", name->prefix, temp_display);
                                contact->display_name = display;
                                contact->sort_name = temp_display;
-                       }
-                       else if (temp_display) {
+                       } else if (temp_display) {
                                contact->display_name = temp_display;
                                contact->sort_name = strdup(temp_display);
-                       }
-                       else if (name->prefix) {
+                       } else if (name->prefix) {
                                contact->display_name = strdup(name->prefix);
                                contact->sort_name = strdup(name->prefix);
                        }
                }
 
-               ctsvc_record_set_property_flag((ctsvc_record_s *)contact, _contacts_contact.display_name, CTSVC_PROPERTY_FLAG_DIRTY);
+               ctsvc_record_set_property_flag((ctsvc_record_s*)contact, _contacts_contact.display_name, CTSVC_PROPERTY_FLAG_DIRTY);
                contact->display_source_type = CONTACTS_DISPLAY_NAME_SOURCE_TYPE_NAME;
-       }
-       else {
+       } else {
                GList *cur;
                if (contact->company && contact->company->records) {
-                       for (cur=contact->company->records;cur;cur=cur->next) {
-                               ctsvc_company_s *company = (ctsvc_company_s *)cur->data;
+                       for (cur = contact->company->records; cur; cur = cur->next) {
+                               ctsvc_company_s *company = cur->data;
                                if (company && company->name) {
-                                       ctsvc_record_set_property_flag((ctsvc_record_s *)contact, _contacts_contact.display_name, CTSVC_PROPERTY_FLAG_DIRTY);
+                                       ctsvc_record_set_property_flag((ctsvc_record_s*)contact, _contacts_contact.display_name, CTSVC_PROPERTY_FLAG_DIRTY);
                                        contact->display_name = SAFE_STRDUP(company->name);
                                        contact->display_source_type = CONTACTS_DISPLAY_NAME_SOURCE_TYPE_COMPANY;
                                        break;
@@ -1272,12 +1254,12 @@ void ctsvc_contact_make_display_name(ctsvc_contact_s *contact)
                        }
                }
 
-               if (false == 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;
+                       for (cur = contact->nicknames->records; cur; cur = cur->next) {
+                               ctsvc_nickname_s *nickname = cur->data;
                                if (nickname && nickname->nickname) {
-                                       ctsvc_record_set_property_flag((ctsvc_record_s *)contact, _contacts_contact.display_name, CTSVC_PROPERTY_FLAG_DIRTY);
+                                       ctsvc_record_set_property_flag((ctsvc_record_s*)contact, _contacts_contact.display_name, CTSVC_PROPERTY_FLAG_DIRTY);
                                        free(contact->display_name);
                                        contact->display_name = SAFE_STRDUP(nickname->nickname);
                                        contact->display_source_type = CONTACTS_DISPLAY_NAME_SOURCE_TYPE_NICKNAME;
@@ -1286,12 +1268,12 @@ void ctsvc_contact_make_display_name(ctsvc_contact_s *contact)
                        }
                }
 
-               if (false == 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;
+                       for (cur = contact->numbers->records; cur; cur = cur->next) {
+                               ctsvc_number_s *number = cur->data;
                                if (number && number->number) {
-                                       ctsvc_record_set_property_flag((ctsvc_record_s *)contact, _contacts_contact.display_name, CTSVC_PROPERTY_FLAG_DIRTY);
+                                       ctsvc_record_set_property_flag((ctsvc_record_s*)contact, _contacts_contact.display_name, CTSVC_PROPERTY_FLAG_DIRTY);
                                        free(contact->display_name);
                                        contact->display_name = SAFE_STRDUP(number->number);
                                        contact->display_source_type = CONTACTS_DISPLAY_NAME_SOURCE_TYPE_NUMBER;
@@ -1300,12 +1282,12 @@ void ctsvc_contact_make_display_name(ctsvc_contact_s *contact)
                        }
                }
 
-               if (false == 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;
+                       for (cur = contact->emails->records; cur; cur = cur->next) {
+                               ctsvc_email_s *email = cur->data;
                                if (email && email->email_addr) {
-                                       ctsvc_record_set_property_flag((ctsvc_record_s *)contact, _contacts_contact.display_name, CTSVC_PROPERTY_FLAG_DIRTY);
+                                       ctsvc_record_set_property_flag((ctsvc_record_s*)contact, _contacts_contact.display_name, CTSVC_PROPERTY_FLAG_DIRTY);
                                        free(contact->display_name);
                                        contact->display_name = SAFE_STRDUP(email->email_addr);
                                        contact->display_source_type = CONTACTS_DISPLAY_NAME_SOURCE_TYPE_EMAIL;
@@ -1314,19 +1296,18 @@ 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 (ctsvc_record_check_property_flag((ctsvc_record_s*)contact, _contacts_contact.display_name, CTSVC_PROPERTY_FLAG_DIRTY)) {
                        contact->reverse_display_name = SAFE_STRDUP(contact->display_name);
                        contact->sort_name = SAFE_STRDUP(contact->display_name);
                        contact->reverse_sort_name = SAFE_STRDUP(contact->display_name);
-               }
-               else {
+               } else {
                        /* Update as NULL */
-                       ctsvc_record_set_property_flag((ctsvc_record_s *)contact, _contacts_contact.display_name, CTSVC_PROPERTY_FLAG_DIRTY);
+                       ctsvc_record_set_property_flag((ctsvc_record_s*)contact, _contacts_contact.display_name, CTSVC_PROPERTY_FLAG_DIRTY);
                }
        }
 
        /* make sortkey */
-       if (ctsvc_record_check_property_flag((ctsvc_record_s *)contact, _contacts_contact.display_name, CTSVC_PROPERTY_FLAG_DIRTY))
+       if (ctsvc_record_check_property_flag((ctsvc_record_s*)contact, _contacts_contact.display_name, CTSVC_PROPERTY_FLAG_DIRTY))
                ctsvc_contact_make_sortkey(contact);
 
        return;
@@ -1340,7 +1321,7 @@ int ctsvc_get_data_info_name(cts_stmt stmt, contacts_list_h name_list)
 
        ret = contacts_list_get_count(name_list, &count);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "contacts_list_get_count Fail(%d)", ret);
-       RETVM_IF (1 < count, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : already had name");
+       RETVM_IF(1 < count, CONTACTS_ERROR_INVALID_PARAMETER, "already had name");
 
        ctsvc_db_name_get_value_from_stmt(stmt, &record, 1);
        contacts_list_add(name_list, record);
@@ -1481,14 +1462,14 @@ int ctsvc_get_data_info_extension(cts_stmt stmt, contacts_list_h list)
 bool ctsvc_contact_check_default_number(contacts_list_h number_list)
 {
        bool has_default = false;
-       ctsvc_number_snumber;
+       ctsvc_number_s *number;
        int count;
        int ret;
 
        RETV_IF(NULL == number_list, false);
 
        ret = contacts_list_get_count(number_list, &count);
-       if (CONTACTS_ERROR_NONE !=ret || 0 == count)
+       if (CONTACTS_ERROR_NONE != ret || 0 == count)
                return false;
 
        contacts_list_first(number_list);
@@ -1508,7 +1489,7 @@ bool ctsvc_contact_check_default_number(contacts_list_h number_list)
                        contacts_list_get_current_record_p(number_list, (contacts_record_h*)&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);
+                               ctsvc_record_set_property_flag((ctsvc_record_s*)number, _contacts_number.is_default, CTSVC_PROPERTY_FLAG_DIRTY);
                                has_default = true;
                                break;
                        }
@@ -1520,14 +1501,14 @@ bool ctsvc_contact_check_default_number(contacts_list_h number_list)
 bool ctsvc_contact_check_default_email(contacts_list_h email_list)
 {
        bool has_default = false;
-       ctsvc_email_semail;
+       ctsvc_email_s *email;
        int count;
        int ret;
 
        RETV_IF(NULL == email_list, false);
 
        ret = contacts_list_get_count(email_list, &count);
-       if (CONTACTS_ERROR_NONE !=ret || 0 == count)
+       if (CONTACTS_ERROR_NONE != ret || 0 == count)
                return false;
 
        contacts_list_first(email_list);
@@ -1547,7 +1528,7 @@ bool ctsvc_contact_check_default_email(contacts_list_h email_list)
                        contacts_list_get_current_record_p(email_list, (contacts_record_h*)&email);
                        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);
+                               ctsvc_record_set_property_flag((ctsvc_record_s*)email, _contacts_email.is_default, CTSVC_PROPERTY_FLAG_DIRTY);
                                has_default = true;
                                break;
                        }
@@ -1559,15 +1540,15 @@ bool ctsvc_contact_check_default_email(contacts_list_h email_list)
 bool ctsvc_contact_check_default_image(contacts_list_h image_list)
 {
        bool has_default = false;
-       ctsvc_image_simage;
+       ctsvc_image_s *image;
        int count;
        int ret;
 
        RETV_IF(NULL == image_list, false);
 
        ret = contacts_list_get_count(image_list, &count);
-       if (CONTACTS_ERROR_NONE !=ret || 0 == count) {
-               CTS_DBG("list get count Fail (%d)", count);
+       if (CONTACTS_ERROR_NONE != ret || 0 == count) {
+               DBG("list get count Fail(%d)", count);
                return false;
        }
 
@@ -1588,7 +1569,7 @@ bool ctsvc_contact_check_default_image(contacts_list_h image_list)
                        contacts_list_get_current_record_p(image_list, (contacts_record_h*)&image);
                        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);
+                               ctsvc_record_set_property_flag((ctsvc_record_s*)image, _contacts_image.is_default, CTSVC_PROPERTY_FLAG_DIRTY);
                                has_default = true;
                                break;
                        }
@@ -1600,15 +1581,15 @@ bool ctsvc_contact_check_default_image(contacts_list_h image_list)
 bool ctsvc_contact_check_default_address(contacts_list_h address_list)
 {
        bool has_default = false;
-       ctsvc_address_saddress;
+       ctsvc_address_s *address;
        int count;
        int ret;
 
        RETV_IF(NULL == address_list, false);
 
        ret = contacts_list_get_count(address_list, &count);
-       if (CONTACTS_ERROR_NONE !=ret || 0 == count) {
-               CTS_DBG("list get count Fail (%d)", count);
+       if (CONTACTS_ERROR_NONE != ret || 0 == count) {
+               DBG("list get count Fail(%d)", count);
                return false;
        }
 
@@ -1616,8 +1597,8 @@ bool ctsvc_contact_check_default_address(contacts_list_h address_list)
        do {
                contacts_list_get_current_record_p(address_list, (contacts_record_h*)&address);
                if (address &&
-                                               (address->pobox || address->postalcode || address->region || address->locality
-                                                       || address->street || address->extended || address->country)) {
+                               (address->pobox || address->postalcode || address->region || address->locality
+                                || address->street || address->extended || address->country)) {
                        if (address->is_default && false == has_default)
                                has_default = true;
                        else if (has_default)
@@ -1630,10 +1611,10 @@ bool ctsvc_contact_check_default_address(contacts_list_h address_list)
                do {
                        contacts_list_get_current_record_p(address_list, (contacts_record_h*)&address);
                        if (address &&
-                                               (address->pobox || address->postalcode || address->region || address->locality
-                                                       || address->street || address->extended || address->country)) {
+                                       (address->pobox || address->postalcode || address->region || address->locality
+                                        || address->street || address->extended || address->country)) {
                                address->is_default = true;
-                               ctsvc_record_set_property_flag((ctsvc_record_s *)address, _contacts_address.is_default, CTSVC_PROPERTY_FLAG_DIRTY);
+                               ctsvc_record_set_property_flag((ctsvc_record_s*)address, _contacts_address.is_default, CTSVC_PROPERTY_FLAG_DIRTY);
                                has_default = true;
                                break;
                        }
@@ -1652,8 +1633,8 @@ int ctsvc_contact_update_data_name(contacts_list_h name_list, int contact_id, bo
        GList *cursor;
        RETV_IF(NULL == name_list, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       for (cursor = list->deleted_records;cursor;cursor=cursor->next) {
-               name = (ctsvc_name_s *)cursor->data;
+       for (cursor = list->deleted_records; cursor; cursor = cursor->next) {
+               name = cursor->data;
                ctsvc_db_name_delete(name->id, is_my_profile);
        }
 
@@ -1663,15 +1644,16 @@ int ctsvc_contact_update_data_name(contacts_list_h name_list, int contact_id, bo
                name = (ctsvc_name_s*)record;
                if (0 < name->id) {
                        if (name->first || name->last || name->addition || name->prefix || name->suffix
-                                       || name->phonetic_first || name->phonetic_middle || name->phonetic_last)
+                                       || name->phonetic_first || name->phonetic_middle || name->phonetic_last) {
                                ret = ctsvc_db_name_update(record, is_my_profile);
-                       else
+                       } else {
                                ret = ctsvc_db_name_delete(name->id, is_my_profile);
-               }
-               else
+                       }
+               } else {
                        ret = ctsvc_db_name_insert(record, contact_id, is_my_profile, NULL);
+               }
                if (CONTACTS_ERROR_DB == ret)
-                       CTS_ERR("DB error : return(%d)", ret);
+                       ERR("return(%d)", ret);
        }
 
        return ret;
@@ -1689,8 +1671,8 @@ int ctsvc_contact_update_data_company(contacts_list_h company_list, int contact_
 
        RETV_IF(NULL == company_list, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       for (cursor = list->deleted_records;cursor;cursor=cursor->next) {
-               company = (ctsvc_company_s *)cursor->data;
+       for (cursor = list->deleted_records; cursor; cursor = cursor->next) {
+               company = cursor->data;
                ctsvc_db_company_delete(company->id, is_my_profile);
        }
 
@@ -1704,16 +1686,17 @@ int ctsvc_contact_update_data_company(contacts_list_h company_list, int contact_
                company = (ctsvc_company_s*)record;
                if (0 < company->id) {
                        if (company->name || company->department || company->job_title || company->role
-                               || company->assistant_name || company->logo || company->location || company->description
-                               || company->phonetic_name)
+                                       || company->assistant_name || company->logo || company->location || company->description
+                                       || company->phonetic_name) {
                                ret = ctsvc_db_company_update(record, contact_id, is_my_profile);
-                       else
+                       } else {
                                ret = ctsvc_db_company_delete(company->id, is_my_profile);
-               }
-               else
+                       }
+               } else {
                        ret = ctsvc_db_company_insert(record, contact_id, is_my_profile, NULL);
+               }
                if (CONTACTS_ERROR_DB == ret) {
-                       CTS_ERR("DB error : return (%d)", ret);
+                       ERR("return (%d)", ret);
                        break;
                }
        } while (CONTACTS_ERROR_NONE == contacts_list_next(company_list));
@@ -1733,8 +1716,8 @@ int ctsvc_contact_update_data_note(contacts_list_h note_list, int contact_id, bo
 
        RETV_IF(NULL == note_list, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       for (cursor = list->deleted_records;cursor;cursor=cursor->next) {
-               note = (ctsvc_note_s *)cursor->data;
+       for (cursor = list->deleted_records; cursor; cursor = cursor->next) {
+               note = cursor->data;
                ctsvc_db_note_delete(note->id, is_my_profile);
        }
 
@@ -1751,11 +1734,11 @@ int ctsvc_contact_update_data_note(contacts_list_h note_list, int contact_id, bo
                                ret = ctsvc_db_note_update(record, is_my_profile);
                        else
                                ret = ctsvc_db_note_delete(note->id, is_my_profile);
-               }
-               else
+               } else {
                        ret = ctsvc_db_note_insert(record, contact_id, is_my_profile, NULL);
+               }
                if (CONTACTS_ERROR_DB == ret) {
-                       CTS_ERR("DB error : return (%d)", ret);
+                       ERR("return (%d)", ret);
                        break;
                }
        } while (CONTACTS_ERROR_NONE == contacts_list_next(note_list));
@@ -1775,8 +1758,8 @@ int ctsvc_contact_update_data_event(contacts_list_h event_list, int contact_id,
 
        RETV_IF(NULL == event_list, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       for (cursor = list->deleted_records;cursor;cursor=cursor->next) {
-               event = (ctsvc_event_s *)cursor->data;
+       for (cursor = list->deleted_records; cursor; cursor = cursor->next) {
+               event = cursor->data;
                ctsvc_db_event_delete(event->id, is_my_profile);
        }
 
@@ -1793,11 +1776,11 @@ int ctsvc_contact_update_data_event(contacts_list_h event_list, int contact_id,
                                ret = ctsvc_db_event_update(record, is_my_profile);
                        else
                                ret = ctsvc_db_event_delete(event->id, is_my_profile);
-               }
-               else
+               } else {
                        ret = ctsvc_db_event_insert(record, contact_id, is_my_profile, NULL);
+               }
                if (CONTACTS_ERROR_DB == ret) {
-                       CTS_ERR("DB error : return (%d)", ret);
+                       ERR("return (%d)", ret);
                        break;
                }
        } while (CONTACTS_ERROR_NONE == contacts_list_next(event_list));
@@ -1817,8 +1800,8 @@ int ctsvc_contact_update_data_messenger(contacts_list_h messenger_list, int cont
 
        RETV_IF(NULL == messenger_list, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       for (cursor = list->deleted_records;cursor;cursor=cursor->next) {
-               messenger = (ctsvc_messenger_s *)cursor->data;
+       for (cursor = list->deleted_records; cursor; cursor = cursor->next) {
+               messenger = cursor->data;
                ctsvc_db_messenger_delete(messenger->id, is_my_profile);
        }
 
@@ -1835,11 +1818,11 @@ int ctsvc_contact_update_data_messenger(contacts_list_h messenger_list, int cont
                                ret = ctsvc_db_messenger_update(record, is_my_profile);
                        else
                                ret = ctsvc_db_messenger_delete(messenger->id, is_my_profile);
-               }
-               else
+               } else {
                        ret = ctsvc_db_messenger_insert(record, contact_id, is_my_profile, NULL);
+               }
                if (CONTACTS_ERROR_DB == ret) {
-                       CTS_ERR("DB error : return (%d)", ret);
+                       ERR("return (%d)", ret);
                        break;
                }
        } while (CONTACTS_ERROR_NONE == contacts_list_next(messenger_list));
@@ -1859,8 +1842,8 @@ int ctsvc_contact_update_data_address(contacts_list_h address_list, int contact_
 
        RETV_IF(NULL == address_list, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       for (cursor = list->deleted_records;cursor;cursor=cursor->next) {
-               address = (ctsvc_address_s *)cursor->data;
+       for (cursor = list->deleted_records; cursor; cursor = cursor->next) {
+               address = cursor->data;
                ctsvc_db_address_delete(address->id, is_my_profile);
        }
 
@@ -1874,15 +1857,16 @@ int ctsvc_contact_update_data_address(contacts_list_h address_list, int contact_
                address = (ctsvc_address_s*)record;
                if (0 < address->id) {
                        if (address->pobox || address->postalcode || address->region || address->locality
-                               || address->street || address->extended || address->country)
+                                       || address->street || address->extended || address->country) {
                                ret = ctsvc_db_address_update(record, is_my_profile);
-                       else
+                       } else {
                                ret = ctsvc_db_address_delete(address->id, is_my_profile);
-               }
-               else
+                       }
+               } else {
                        ret = ctsvc_db_address_insert(record, contact_id, is_my_profile, NULL);
+               }
                if (CONTACTS_ERROR_DB == ret) {
-                       CTS_ERR("DB error : return (%d)", ret);
+                       ERR("return (%d)", ret);
                        break;
                }
        } while (CONTACTS_ERROR_NONE == contacts_list_next(address_list));
@@ -1902,8 +1886,8 @@ int ctsvc_contact_update_data_url(contacts_list_h url_list, int contact_id, bool
 
        RETV_IF(NULL == url_list, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       for (cursor = list->deleted_records;cursor;cursor=cursor->next) {
-               url = (ctsvc_url_s *)cursor->data;
+       for (cursor = list->deleted_records; cursor; cursor = cursor->next) {
+               url = cursor->data;
                ctsvc_db_url_delete(url->id, is_my_profile);
        }
 
@@ -1920,11 +1904,11 @@ int ctsvc_contact_update_data_url(contacts_list_h url_list, int contact_id, bool
                                ret = ctsvc_db_url_update(record, is_my_profile);
                        else
                                ret = ctsvc_db_url_delete(url->id, is_my_profile);
-               }
-               else
+               } else {
                        ret = ctsvc_db_url_insert(record, contact_id, is_my_profile, NULL);
+               }
                if (CONTACTS_ERROR_DB == ret) {
-                       CTS_ERR("DB error : return (%d)", ret);
+                       ERR("return (%d)", ret);
                        break;
                }
        } while (CONTACTS_ERROR_NONE == contacts_list_next(url_list));
@@ -1944,8 +1928,8 @@ int ctsvc_contact_update_data_profile(contacts_list_h profile_list, int contact_
 
        RETV_IF(NULL == profile_list, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       for (cursor = list->deleted_records;cursor;cursor=cursor->next) {
-               profile = (ctsvc_profile_s *)cursor->data;
+       for (cursor = list->deleted_records; cursor; cursor = cursor->next) {
+               profile = cursor->data;
                ctsvc_db_profile_delete(profile->id, is_my_profile);
        }
        ret = contacts_list_get_count(profile_list, &count);
@@ -1961,11 +1945,11 @@ int ctsvc_contact_update_data_profile(contacts_list_h profile_list, int contact_
                                ret = ctsvc_db_profile_update(record, is_my_profile);
                        else
                                ret = ctsvc_db_profile_delete(profile->id, is_my_profile);
-               }
-               else
+               } else {
                        ret = ctsvc_db_profile_insert(record, contact_id, is_my_profile, NULL);
+               }
                if (CONTACTS_ERROR_DB == ret) {
-                       CTS_ERR("DB error : return (%d)", ret);
+                       ERR("return (%d)", ret);
                        break;
                }
        } while (CONTACTS_ERROR_NONE == contacts_list_next(profile_list));
@@ -1985,8 +1969,8 @@ int ctsvc_contact_update_data_relationship(contacts_list_h relationship_list, in
 
        RETV_IF(NULL == relationship_list, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       for (cursor = list->deleted_records;cursor;cursor=cursor->next) {
-               relationship = (ctsvc_relationship_s *)cursor->data;
+       for (cursor = list->deleted_records; cursor; cursor = cursor->next) {
+               relationship = cursor->data;
                ctsvc_db_relationship_delete(relationship->id, is_my_profile);
        }
 
@@ -2003,11 +1987,11 @@ int ctsvc_contact_update_data_relationship(contacts_list_h relationship_list, in
                                ret = ctsvc_db_relationship_update(record, is_my_profile);
                        else
                                ret = ctsvc_db_relationship_delete(relationship->id, is_my_profile);
-               }
-               else
+               } else {
                        ret = ctsvc_db_relationship_insert(record, contact_id, is_my_profile, NULL);
+               }
                if (CONTACTS_ERROR_DB == ret) {
-                       CTS_ERR("DB error : return (%d)", ret);
+                       ERR("return (%d)", ret);
                        break;
                }
        } while (CONTACTS_ERROR_NONE == contacts_list_next(relationship_list));
@@ -2027,8 +2011,8 @@ int ctsvc_contact_update_data_image(contacts_list_h image_list, int contact_id,
 
        RETV_IF(NULL == image_list, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       for (cursor = list->deleted_records;cursor;cursor=cursor->next) {
-               image = (ctsvc_image_s *)cursor->data;
+       for (cursor = list->deleted_records; cursor; cursor = cursor->next) {
+               image = cursor->data;
                ctsvc_db_image_delete(image->id, is_my_profile);
        }
 
@@ -2046,12 +2030,12 @@ int ctsvc_contact_update_data_image(contacts_list_h image_list, int contact_id,
                                        ret = ctsvc_db_image_update(record, contact_id, is_my_profile);
                                else
                                        ret = ctsvc_db_image_delete(image->id, is_my_profile);
-                       }
-                       else
+                       } else {
                                ret = ctsvc_db_image_insert(record, contact_id, is_my_profile, NULL);
+                       }
                }
                if (CONTACTS_ERROR_DB == ret) {
-                       CTS_ERR("DB error : return (%d)", ret);
+                       ERR("return (%d)", ret);
                        break;
                }
        } while (CONTACTS_ERROR_NONE == contacts_list_next(image_list));
@@ -2071,8 +2055,8 @@ int ctsvc_contact_update_data_nickname(contacts_list_h nickname_list, int contac
 
        RETV_IF(NULL == nickname_list, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       for (cursor = list->deleted_records;cursor;cursor=cursor->next) {
-               nickname = (ctsvc_nickname_s *)cursor->data;
+       for (cursor = list->deleted_records; cursor; cursor = cursor->next) {
+               nickname = cursor->data;
                ctsvc_db_nickname_delete(nickname->id, is_my_profile);
        }
 
@@ -2089,11 +2073,11 @@ int ctsvc_contact_update_data_nickname(contacts_list_h nickname_list, int contac
                                ret = ctsvc_db_nickname_update(record, is_my_profile);
                        else
                                ret = ctsvc_db_nickname_delete(nickname->id, is_my_profile);
-               }
-               else
+               } else {
                        ret = ctsvc_db_nickname_insert(record, contact_id, is_my_profile, NULL);
+               }
                if (CONTACTS_ERROR_DB == ret) {
-                       CTS_ERR("DB error : return (%d)", ret);
+                       ERR("return (%d)", ret);
                        break;
                }
        } while (CONTACTS_ERROR_NONE == contacts_list_next(nickname_list));
@@ -2113,8 +2097,8 @@ int ctsvc_contact_update_data_extension(contacts_list_h extension_list, int cont
 
        RETV_IF(NULL == extension_list, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       for (cursor = list->deleted_records;cursor;cursor=cursor->next) {
-               extension = (ctsvc_extension_s *)cursor->data;
+       for (cursor = list->deleted_records; cursor; cursor = cursor->next) {
+               extension = cursor->data;
                ctsvc_db_extension_delete(extension->id, is_my_profile);
        }
 
@@ -2128,16 +2112,17 @@ int ctsvc_contact_update_data_extension(contacts_list_h extension_list, int cont
                extension = (ctsvc_extension_s*)record;
                if (0 < extension->id) {
                        if (extension->data2 || extension->data3 || extension->data4 || extension->data5
-                               || extension->data6 || extension->data7 || extension->data8 || extension->data9
-                               || extension->data10 || extension->data11 || extension->data12)
+                                       || extension->data6 || extension->data7 || extension->data8 || extension->data9
+                                       || extension->data10 || extension->data11 || extension->data12) {
                                ret = ctsvc_db_extension_update(record);
-                       else
+                       } else {
                                ret = ctsvc_db_extension_delete(extension->id, is_my_profile);
-               }
-               else
+                       }
+               } else {
                        ret = ctsvc_db_extension_insert(record, contact_id, is_my_profile, NULL);
+               }
                if (CONTACTS_ERROR_DB == ret) {
-                       CTS_ERR("DB error : return (%d)", ret);
+                       ERR("return (%d)", ret);
                        break;
                }
        } while (CONTACTS_ERROR_NONE == contacts_list_next(extension_list));
@@ -2146,7 +2131,7 @@ int ctsvc_contact_update_data_extension(contacts_list_h extension_list, int cont
 }
 
 int ctsvc_contact_update_data_number(contacts_list_h number_list,
-       int contact_id, bool is_my_profile, bool *had_phonenumber)
+               int contact_id, bool is_my_profile, bool *had_phonenumber)
 {
        CTS_FN_CALL;
        int ret = CONTACTS_ERROR_NONE;
@@ -2160,8 +2145,8 @@ int ctsvc_contact_update_data_number(contacts_list_h number_list,
 
        RETV_IF(NULL == number_list, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       for (cursor = list->deleted_records;cursor;cursor=cursor->next) {
-               number = (ctsvc_number_s *)cursor->data;
+       for (cursor = list->deleted_records; cursor; cursor = cursor->next) {
+               number = cursor->data;
                ctsvc_db_number_delete(number->id, is_my_profile);
        }
 
@@ -2177,16 +2162,15 @@ int ctsvc_contact_update_data_number(contacts_list_h number_list,
                        if (number->number) {
                                ret = ctsvc_db_number_update(record, is_my_profile);
                                had = true;
-                       }
-                       else
+                       } else {
                                ret = ctsvc_db_number_delete(number->id, is_my_profile);
-               }
-               else if (number->number) {
+                       }
+               else if (number->number) {
                        ret = ctsvc_db_number_insert(record, contact_id, is_my_profile, NULL);
                        had = true;
                }
                if (CONTACTS_ERROR_DB == ret) {
-                       CTS_ERR("DB error : return (%d)", ret);
+                       ERR("return (%d)", ret);
                        break;
                }
        } while (CONTACTS_ERROR_NONE == contacts_list_next(number_list));
@@ -2196,7 +2180,7 @@ int ctsvc_contact_update_data_number(contacts_list_h number_list,
 }
 
 int ctsvc_contact_update_data_email(contacts_list_h email_list,
-       int contact_id, bool is_my_profile, bool *had_email)
+               int contact_id, bool is_my_profile, bool *had_email)
 {
        CTS_FN_CALL;
        int ret = CONTACTS_ERROR_NONE;
@@ -2210,8 +2194,8 @@ int ctsvc_contact_update_data_email(contacts_list_h email_list,
 
        RETV_IF(NULL == email_list, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       for (cursor = list->deleted_records;cursor;cursor=cursor->next) {
-               email = (ctsvc_email_s *)cursor->data;
+       for (cursor = list->deleted_records; cursor; cursor = cursor->next) {
+               email = cursor->data;
                ctsvc_db_email_delete(email->id, is_my_profile);
        }
 
@@ -2228,16 +2212,15 @@ int ctsvc_contact_update_data_email(contacts_list_h email_list,
                        if (email->email_addr) {
                                ret = ctsvc_db_email_update(record, is_my_profile);
                                had = true;
-                       }
-                       else
+                       } else {
                                ret = ctsvc_db_email_delete(email->id, is_my_profile);
-               }
-               else if (email->email_addr) {
+                       }
+               else if (email->email_addr) {
                        ret = ctsvc_db_email_insert(record, contact_id, is_my_profile, NULL);
                        had = true;
                }
                if (CONTACTS_ERROR_DB == ret) {
-                       CTS_ERR("DB error : return (%d)", ret);
+                       ERR("return (%d)", ret);
                        break;
                }
        } while (CONTACTS_ERROR_NONE == contacts_list_next(email_list));
@@ -2257,9 +2240,8 @@ int ctsvc_contact_insert_data_name(contacts_list_h name_list, int contact_id, bo
        contacts_list_get_current_record_p(name_list, &record);
        if (record) {
                ret = ctsvc_db_name_insert(record, contact_id, is_my_profile, NULL);
-               if (CONTACTS_ERROR_DB == ret) {
-                       CTS_ERR("DB error : ctsvc_db_name_insert");
-               }
+               if (CONTACTS_ERROR_DB == ret)
+                       ERR("ctsvc_db_name_insert() Fail");
        }
        return ret;
 }
@@ -2281,7 +2263,7 @@ int ctsvc_contact_insert_data_number(contacts_list_h number_list, int contact_id
                contacts_list_get_current_record_p(number_list, &record);
                ret = ctsvc_db_number_insert(record, contact_id, is_my_profile, NULL);
                if (CONTACTS_ERROR_DB == ret) {
-                       CTS_ERR("DB error : ctsvc_db_number_insert");
+                       ERR("ctsvc_db_number_insert");
                        break;
                }
        } while (CONTACTS_ERROR_NONE == contacts_list_next(number_list));
@@ -2306,7 +2288,7 @@ int ctsvc_contact_insert_data_email(contacts_list_h email_list, int contact_id,
                contacts_list_get_current_record_p(email_list, &record);
                ret = ctsvc_db_email_insert(record, contact_id, is_my_profile, NULL);
                if (CONTACTS_ERROR_DB == ret) {
-                       CTS_ERR("DB error : ctsvc_db_email_insert");
+                       ERR("ctsvc_db_email_insert");
                        break;
                }
        } while (CONTACTS_ERROR_NONE == contacts_list_next(email_list));
@@ -2331,7 +2313,7 @@ int ctsvc_contact_insert_data_profile(contacts_list_h profile_list, int contact_
                contacts_list_get_current_record_p(profile_list, &record);
                ret = ctsvc_db_profile_insert(record, contact_id, is_my_profile, NULL);
                if (CONTACTS_ERROR_DB == ret) {
-                       CTS_ERR("DB error : ctsvc_db_profile_insert");
+                       ERR("ctsvc_db_profile_insert");
                        break;
                }
        } while (CONTACTS_ERROR_NONE == contacts_list_next(profile_list));
@@ -2356,7 +2338,7 @@ int ctsvc_contact_insert_data_company(contacts_list_h company_list, int contact_
                contacts_list_get_current_record_p(company_list, &record);
                ret = ctsvc_db_company_insert(record, contact_id, is_my_profile, NULL);
                if (CONTACTS_ERROR_DB == ret) {
-                       CTS_ERR("DB error : ctsvc_db_company_insert");
+                       ERR("ctsvc_db_company_insert");
                        break;
                }
        } while (CONTACTS_ERROR_NONE == contacts_list_next(company_list));
@@ -2382,7 +2364,7 @@ int ctsvc_contact_insert_data_note(contacts_list_h note_list, int contact_id, bo
                if (record) {
                        ret = ctsvc_db_note_insert(record, contact_id, is_my_profile, NULL);
                        if (CONTACTS_ERROR_DB == ret) {
-                               CTS_ERR("DB error : ctsvc_db_note_insert");
+                               ERR("ctsvc_db_note_insert");
                                break;
                        }
                }
@@ -2407,7 +2389,7 @@ int ctsvc_contact_insert_data_event(contacts_list_h event_list, int contact_id,
                contacts_list_get_current_record_p(event_list, &record);
                ret = ctsvc_db_event_insert(record, contact_id, is_my_profile, NULL);
                if (CONTACTS_ERROR_DB == ret) {
-                       CTS_ERR("DB error : ctsvc_db_event_insert");
+                       ERR("ctsvc_db_event_insert");
                        break;
                }
        } while (CONTACTS_ERROR_NONE == contacts_list_next(event_list));
@@ -2432,7 +2414,7 @@ int ctsvc_contact_insert_data_messenger(contacts_list_h messenger_list, int cont
                contacts_list_get_current_record_p(messenger_list, &record);
                ret = ctsvc_db_messenger_insert(record, contact_id, is_my_profile, NULL);
                if (CONTACTS_ERROR_DB == ret) {
-                       CTS_ERR("DB error : ctsvc_db_messenger_insert");
+                       ERR("ctsvc_db_messenger_insert");
                        break;
                }
        } while (CONTACTS_ERROR_NONE == contacts_list_next(messenger_list));
@@ -2457,7 +2439,7 @@ int ctsvc_contact_insert_data_address(contacts_list_h address_list, int contact_
                contacts_list_get_current_record_p(address_list, &record);
                ret = ctsvc_db_address_insert(record, contact_id, is_my_profile, NULL);
                if (CONTACTS_ERROR_DB == ret) {
-                       CTS_ERR("DB error : ctsvc_db_address_insert");
+                       ERR("ctsvc_db_address_insert");
                        break;
                }
        } while (CONTACTS_ERROR_NONE == contacts_list_next(address_list));
@@ -2482,7 +2464,7 @@ int ctsvc_contact_insert_data_url(contacts_list_h url_list, int contact_id, bool
                contacts_list_get_current_record_p(url_list, &record);
                ret = ctsvc_db_url_insert(record, contact_id, is_my_profile, NULL);
                if (CONTACTS_ERROR_DB == ret) {
-                       CTS_ERR("DB error : ctsvc_db_url_insert");
+                       ERR("ctsvc_db_url_insert");
                        break;
                }
        } while (CONTACTS_ERROR_NONE == contacts_list_next(url_list));
@@ -2507,7 +2489,7 @@ int ctsvc_contact_insert_data_nickname(contacts_list_h nickname_list, int contac
                contacts_list_get_current_record_p(nickname_list, &record);
                ret = ctsvc_db_nickname_insert(record, contact_id, is_my_profile, NULL);
                if (CONTACTS_ERROR_DB == ret) {
-                       CTS_ERR("DB error : ctsvc_db_nickname_insert");
+                       ERR("ctsvc_db_nickname_insert");
                        break;
                }
        } while (CONTACTS_ERROR_NONE == contacts_list_next(nickname_list));
@@ -2532,7 +2514,7 @@ int ctsvc_contact_insert_data_relationship(contacts_list_h relationship_list, in
                contacts_list_get_current_record_p(relationship_list, &record);
                ret = ctsvc_db_relationship_insert(record, contact_id, is_my_profile, NULL);
                if (CONTACTS_ERROR_DB == ret) {
-                       CTS_ERR("DB error : ctsvc_db_relationship_insert");
+                       ERR("ctsvc_db_relationship_insert");
                        break;
                }
        } while (CONTACTS_ERROR_NONE == contacts_list_next(relationship_list));
@@ -2557,7 +2539,7 @@ int ctsvc_contact_insert_data_image(contacts_list_h image_list, int contact_id,
                contacts_list_get_current_record_p(image_list, &record);
                ret = ctsvc_db_image_insert(record, contact_id, is_my_profile, NULL);
                if (CONTACTS_ERROR_DB == ret) {
-                       CTS_ERR("DB error : ctsvc_db_image_insert");
+                       ERR("ctsvc_db_image_insert");
                        break;
                }
        } while (CONTACTS_ERROR_NONE == contacts_list_next(image_list));
@@ -2582,7 +2564,7 @@ int ctsvc_contact_insert_data_extension(contacts_list_h extension_list, int cont
                contacts_list_get_current_record_p(extension_list, &record);
                ret = ctsvc_db_extension_insert(record, contact_id, is_my_profile, NULL);
                if (CONTACTS_ERROR_DB == ret) {
-                       CTS_ERR("DB error : ctsvc_db_extension_insert");
+                       ERR("ctsvc_db_extension_insert");
                        break;
                }
        } while (CONTACTS_ERROR_NONE == contacts_list_next(extension_list));
@@ -2603,7 +2585,7 @@ int ctsvc_contact_update_display_name(int contact_id, contacts_display_name_sour
 
                cts_stmt stmt = NULL;
                char query[CTS_SQL_MAX_LEN] = {0};
-               ctsvc_contact_s *contact = (ctsvc_contact_s *)record;
+               ctsvc_contact_s *contact = (ctsvc_contact_s*)record;
                ctsvc_contact_make_display_name(contact);
 
                snprintf(query, sizeof(query), "UPDATE "CTS_TABLE_CONTACTS" SET "
@@ -2617,7 +2599,7 @@ int ctsvc_contact_update_display_name(int contact_id, contacts_display_name_sour
 
                ret = ctsvc_query_prepare(query, &stmt);
                if (NULL == stmt) {
-                       CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+                       ERR("ctsvc_query_prepare() Fail(%d)", ret);
                        contacts_record_destroy(record, true);
                        return ret;
                }
@@ -2646,7 +2628,7 @@ int ctsvc_contact_update_display_name(int contact_id, contacts_display_name_sour
 }
 
 extern ctsvc_db_plugin_info_s ctsvc_db_plugin_contact;
-int ctsvc_db_contact_get(int id, contacts_record_hout_record)
+int ctsvc_db_contact_get(int id, contacts_record_h *out_record)
 {
        return ctsvc_db_plugin_contact.get_record(id, out_record);
 }
index 8436b9d..1f6ab03 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #ifndef __CTSVC_DB_PLUGIN_CONTACT_HELPER_H__
 #define __CTSVC_DB_PLUGIN_CONTACT_HELPER_H__
 
 #include "ctsvc_struct.h"
 #include "ctsvc_db_sqlite.h"
 
-int ctsvc_contact_add_image_file(int parent_id, int img_id,
-               char *src_img, char *dest_name, int dest_size);
-int ctsvc_contact_update_image_file(int parent_id, int img_id,
-               char *src_img, char *dest_name, int dest_size);
-int ctsvc_contact_delete_image_file_with_path(const unsigned charimage_path);
+int ctsvc_contact_add_image_file(int parent_id, int img_id, char *src_img,
+               char *dest_name, int dest_size);
+int ctsvc_contact_update_image_file(int parent_id, int img_id, char *src_img,
+               char *dest_name, int dest_size);
+int ctsvc_contact_delete_image_file_with_path(const unsigned char *image_path);
 
 void ctsvc_contact_make_display_name(ctsvc_contact_s *contact);
 int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name);
 int ctsvc_contact_get_name_language(const ctsvc_name_s *name);
 
 int ctsvc_db_contact_update_changed_time(int contact_id);
-int ctsvc_contact_update_display_name(int contact_id, contacts_display_name_source_type_e changed_record_type);
+int ctsvc_contact_update_display_name(int contact_id,
+               contacts_display_name_source_type_e changed_record_type);
 
 int ctsvc_db_contact_delete(int contact_id);
-int ctsvc_db_contact_get(int id, contacts_record_hout_record);
+int ctsvc_db_contact_get(int id, contacts_record_h *out_record);
 
 int ctsvc_get_data_info_name(cts_stmt stmt, contacts_list_h name_list);
 int ctsvc_get_data_info_event(cts_stmt stmt, contacts_list_h list);
@@ -60,34 +60,62 @@ bool ctsvc_contact_check_default_address(contacts_list_h address_list);
 bool ctsvc_contact_check_default_image(contacts_list_h image_list);
 bool ctsvc_contact_check_image_location(const char *path);
 
-int ctsvc_contact_update_data_name(contacts_list_h name_list, int contact_id, bool is_my_profile);
-int ctsvc_contact_update_data_company(contacts_list_h company_list, int contact_id, bool is_my_profile);
-int ctsvc_contact_update_data_note(contacts_list_h note_list, int contact_id, bool is_my_profile);
-int ctsvc_contact_update_data_event(contacts_list_h event_list, int contact_id, bool is_my_profile);
-int ctsvc_contact_update_data_messenger(contacts_list_h messenger_list, int contact_id, bool is_my_profile);
-int ctsvc_contact_update_data_address(contacts_list_h address_list, int contact_id, bool is_my_profile);
-int ctsvc_contact_update_data_url(contacts_list_h url_list, int contact_id, bool is_my_profile);
-int ctsvc_contact_update_data_profile(contacts_list_h profile_list, int contact_id, bool is_my_profile);
-int ctsvc_contact_update_data_relationship(contacts_list_h relationship_list, int contact_id, bool is_my_profile);
-int ctsvc_contact_update_data_image(contacts_list_h image_list, int contact_id, bool is_my_profile);
-int ctsvc_contact_update_data_nickname(contacts_list_h nickname_list, int contact_id, bool is_my_profile);
-int ctsvc_contact_update_data_extension(contacts_list_h extension_list, int contact_id, bool is_my_profile);
-int ctsvc_contact_update_data_number(contacts_list_h number_list, int contact_id, bool is_my_profile, bool *had_phonenumber);
-int ctsvc_contact_update_data_email(contacts_list_h email_list, int contact_id, bool is_my_profile, bool *had_email);
+int ctsvc_contact_update_data_name(contacts_list_h name_list, int contact_id,
+               bool is_my_profile);
+int ctsvc_contact_update_data_company(contacts_list_h company_list, int contact_id,
+               bool is_my_profile);
+int ctsvc_contact_update_data_note(contacts_list_h note_list, int contact_id,
+               bool is_my_profile);
+int ctsvc_contact_update_data_event(contacts_list_h event_list, int contact_id,
+               bool is_my_profile);
+int ctsvc_contact_update_data_messenger(contacts_list_h messenger_list,
+               int contact_id, bool is_my_profile);
+int ctsvc_contact_update_data_address(contacts_list_h address_list, int contact_id,
+               bool is_my_profile);
+int ctsvc_contact_update_data_url(contacts_list_h url_list, int contact_id,
+               bool is_my_profile);
+int ctsvc_contact_update_data_profile(contacts_list_h profile_list, int contact_id,
+               bool is_my_profile);
+int ctsvc_contact_update_data_relationship(contacts_list_h relationship_list,
+               int contact_id, bool is_my_profile);
+int ctsvc_contact_update_data_image(contacts_list_h image_list, int contact_id,
+               bool is_my_profile);
+int ctsvc_contact_update_data_nickname(contacts_list_h nickname_list, int contact_id,
+               bool is_my_profile);
+int ctsvc_contact_update_data_extension(contacts_list_h extension_list, int contact_id,
+               bool is_my_profile);
+int ctsvc_contact_update_data_number(contacts_list_h number_list, int contact_id,
+               bool is_my_profile, bool *had_phonenumber);
+int ctsvc_contact_update_data_email(contacts_list_h email_list, int contact_id,
+               bool is_my_profile, bool *had_email);
 
-int ctsvc_contact_insert_data_name(contacts_list_h name_list, int contact_id, bool is_my_profile);
-int ctsvc_contact_insert_data_number(contacts_list_h number_list, int contact_id, bool is_my_profile);
-int ctsvc_contact_insert_data_email(contacts_list_h email_list, int contact_id, bool is_my_profile);
-int ctsvc_contact_insert_data_profile(contacts_list_h profile_list, int contact_id, bool is_my_profile);
-int ctsvc_contact_insert_data_company(contacts_list_h company_list, int contact_id, bool is_my_profile);
-int ctsvc_contact_insert_data_note(contacts_list_h note_list, int contact_id, bool is_my_profile);
-int ctsvc_contact_insert_data_event(contacts_list_h event_list, int contact_id, bool is_my_profile);
-int ctsvc_contact_insert_data_messenger(contacts_list_h messenger_list, int contact_id, bool is_my_profile);
-int ctsvc_contact_insert_data_address(contacts_list_h address_list, int contact_id, bool is_my_profile);
-int ctsvc_contact_insert_data_url(contacts_list_h url_list, int contact_id, bool is_my_profile);
-int ctsvc_contact_insert_data_nickname(contacts_list_h nickname_list, int contact_id, bool is_my_profile);
-int ctsvc_contact_insert_data_relationship(contacts_list_h relationship_list, int contact_id, bool is_my_profile);
-int ctsvc_contact_insert_data_image(contacts_list_h image_list, int contact_id, bool is_my_profile);
-int ctsvc_contact_insert_data_extension(contacts_list_h extension_list, int contact_id, bool is_my_profile);
+int ctsvc_contact_insert_data_name(contacts_list_h name_list, int contact_id,
+               bool is_my_profile);
+int ctsvc_contact_insert_data_number(contacts_list_h number_list, int contact_id,
+               bool is_my_profile);
+int ctsvc_contact_insert_data_email(contacts_list_h email_list, int contact_id,
+               bool is_my_profile);
+int ctsvc_contact_insert_data_profile(contacts_list_h profile_list, int contact_id,
+               bool is_my_profile);
+int ctsvc_contact_insert_data_company(contacts_list_h company_list, int contact_id,
+               bool is_my_profile);
+int ctsvc_contact_insert_data_note(contacts_list_h note_list, int contact_id,
+               bool is_my_profile);
+int ctsvc_contact_insert_data_event(contacts_list_h event_list, int contact_id,
+               bool is_my_profile);
+int ctsvc_contact_insert_data_messenger(contacts_list_h messenger_list, int contact_id,
+               bool is_my_profile);
+int ctsvc_contact_insert_data_address(contacts_list_h address_list, int contact_id,
+               bool is_my_profile);
+int ctsvc_contact_insert_data_url(contacts_list_h url_list, int contact_id,
+               bool is_my_profile);
+int ctsvc_contact_insert_data_nickname(contacts_list_h nickname_list, int contact_id,
+               bool is_my_profile);
+int ctsvc_contact_insert_data_relationship(contacts_list_h relationship_list,
+               int contact_id, bool is_my_profile);
+int ctsvc_contact_insert_data_image(contacts_list_h image_list, int contact_id,
+               bool is_my_profile);
+int ctsvc_contact_insert_data_extension(contacts_list_h extension_list, int contact_id,
+               bool is_my_profile);
 
 #endif /* __CTSVC_DB_PLUGIN_CONTACT_HELPER_H__ */
index 4fa4677..e4947ff 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_db_schema.h"
 #include "ctsvc_db_query.h"
 #include "ctsvc_list.h"
 
-static int __ctsvc_db_email_insert_record(contacts_record_h record, int *id);
-static int __ctsvc_db_email_get_record(int id, contacts_record_h* out_record);
-static int __ctsvc_db_email_update_record(contacts_record_h record);
-static int __ctsvc_db_email_delete_record(int id);
-static int __ctsvc_db_email_get_all_records(int offset, int limit, contacts_list_h* out_list);
-static int __ctsvc_db_email_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h* out_list);
-
-ctsvc_db_plugin_info_s ctsvc_db_plugin_email = {
-       .is_query_only = false,
-       .insert_record = __ctsvc_db_email_insert_record,
-       .get_record = __ctsvc_db_email_get_record,
-       .update_record = __ctsvc_db_email_update_record,
-       .delete_record = __ctsvc_db_email_delete_record,
-       .get_all_records = __ctsvc_db_email_get_all_records,
-       .get_records_with_query = __ctsvc_db_email_get_records_with_query,
-       .insert_records = NULL,
-       .update_records = NULL,
-       .delete_records = NULL,
-       .get_count = NULL,
-       .get_count_with_query = NULL,
-       .replace_record = NULL,
-       .replace_records = NULL,
-};
 
 static int __ctsvc_db_email_get_person_default_email(int person_id)
 {
@@ -62,9 +38,9 @@ static int __ctsvc_db_email_get_person_default_email(int person_id)
        char query[CTS_SQL_MAX_LEN] = {0};
 
        snprintf(query, sizeof(query),
-               "SELECT id FROM "CTSVC_DB_VIEW_CONTACT" c, "CTS_TABLE_DATA" d "
-               "WHERE c.person_id = %d AND d.datatype = %d AND c.contact_id = d.contact_id AND d.is_default = 1",
-               person_id, CTSVC_DATA_EMAIL);
+                       "SELECT id FROM "CTSVC_DB_VIEW_CONTACT" c, "CTS_TABLE_DATA" d "
+                       "WHERE c.person_id = %d AND d.datatype = %d AND c.contact_id = d.contact_id AND d.is_default = 1",
+                       person_id, CTSVC_DATA_EMAIL);
        ret = ctsvc_query_get_first_int_result(query, &default_email_id);
        if (CONTACTS_ERROR_NONE != ret)
                return 0;
@@ -164,13 +140,12 @@ static int __ctsvc_db_email_insert_record(contacts_record_h record, int *id)
        int old_default_email_id = 0;
        char query[CTS_SQL_MAX_LEN] = {0};
        cts_stmt stmt = NULL;
-       ctsvc_email_s *email = (ctsvc_email_s *)record;
-       RETVM_IF(NULL == email->email_addr, CONTACTS_ERROR_INVALID_PARAMETER,
-               "Invalid parameter : email is NULL");
+       ctsvc_email_s *email = (ctsvc_email_s*)record;
+       RETV_IF(NULL == email->email_addr, CONTACTS_ERROR_INVALID_PARAMETER);
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -178,14 +153,14 @@ static int __ctsvc_db_email_insert_record(contacts_record_h record, int *id)
                        "SELECT addressbook_id, person_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", email->contact_id);
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_stmt_step(stmt);
        if (1 != ret) {
-               CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NONE == ret)
@@ -198,7 +173,7 @@ static int __ctsvc_db_email_insert_record(contacts_record_h record, int *id)
        ctsvc_stmt_finalize(stmt);
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this email record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this email record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
@@ -209,19 +184,19 @@ static int __ctsvc_db_email_insert_record(contacts_record_h record, int *id)
 
        ret = ctsvc_db_email_insert(record, email->contact_id, false, id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        snprintf(query, sizeof(query),
-               "UPDATE "CTS_TABLE_CONTACTS" SET has_email = %d, changed_ver = %d, changed_time = %d "
+                       "UPDATE "CTS_TABLE_CONTACTS" SET has_email = %d, changed_ver = %d, changed_time = %d "
                        "WHERE contact_id = %d",
                        1, ctsvc_get_next_ver(), (int)time(NULL), email->contact_id);
 
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -243,14 +218,14 @@ static int __ctsvc_db_email_insert_record(contacts_record_h record, int *id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
-static int __ctsvc_db_email_get_record(int id, contacts_record_hout_record)
+static int __ctsvc_db_email_get_record(int id, contacts_record_h *out_record)
 {
        int ret;
        cts_stmt stmt = NULL;
@@ -261,17 +236,17 @@ static int __ctsvc_db_email_get_record(int id, contacts_record_h* out_record)
 
        snprintf(query, sizeof(query),
                        "SELECT id, data.contact_id, is_default, data1, data2, data3 "
-                               "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                               "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                               "WHERE id = %d AND datatype = %d ",
-                               id, CTSVC_DATA_EMAIL);
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE id = %d AND datatype = %d ",
+                       id, CTSVC_DATA_EMAIL);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/ != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
@@ -291,12 +266,12 @@ static int __ctsvc_db_email_update_record(contacts_record_h record)
        int ret;
        int addressbook_id;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_email_s *email = (ctsvc_email_s *)record;
+       ctsvc_email_s *email = (ctsvc_email_s*)record;
        RETVM_IF(NULL == email->email_addr, CONTACTS_ERROR_INVALID_PARAMETER, "email is empty");
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -304,20 +279,20 @@ static int __ctsvc_db_email_update_record(contacts_record_h record)
                        "SELECT addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", email->contact_id);
        ret = ctsvc_query_get_first_int_result(query, &addressbook_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("No data : contact_id (%d) is not exist", email->contact_id);
+               ERR("No data : contact_id (%d) is not exist", email->contact_id);
                ctsvc_end_trans(false);
                return ret;
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this email record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this email record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_email_update(record, false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("update record Fail(%d)", ret);
+               ERR("update record Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -332,20 +307,19 @@ static int __ctsvc_db_email_update_record(contacts_record_h record)
 
        ret = ctsvc_db_contact_update_changed_time(email->contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
        ctsvc_set_person_noti();
 
        ret = ctsvc_end_trans(true);
-       if (ret < CONTACTS_ERROR_NONE)
-       {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+       if (ret < CONTACTS_ERROR_NONE) {
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
 static int __ctsvc_db_email_delete_record(int id)
@@ -363,7 +337,7 @@ static int __ctsvc_db_email_delete_record(int id)
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -373,14 +347,14 @@ static int __ctsvc_db_email_delete_record(int id)
 
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_stmt_step(stmt);
        if (1 != ret) {
-               CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NONE == ret)
@@ -394,7 +368,7 @@ static int __ctsvc_db_email_delete_record(int id)
        ctsvc_stmt_finalize(stmt);
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to delete this email record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to delete this email record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
@@ -403,11 +377,11 @@ static int __ctsvc_db_email_delete_record(int id)
                        "SELECT is_default, is_primary_default FROM "CTS_TABLE_DATA" WHERE id = %d", id);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 != ret) {
-               CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NONE == ret)
@@ -421,7 +395,7 @@ static int __ctsvc_db_email_delete_record(int id)
 
        ret = ctsvc_db_email_delete(id, false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -434,13 +408,13 @@ static int __ctsvc_db_email_delete_record(int id)
                has_email = true;
 
        snprintf(query, sizeof(query),
-               "UPDATE "CTS_TABLE_CONTACTS" SET has_email = %d, changed_ver = %d, changed_time = %d "
+                       "UPDATE "CTS_TABLE_CONTACTS" SET has_email = %d, changed_ver = %d, changed_time = %d "
                        "WHERE contact_id = %d",
                        has_email, ctsvc_get_next_ver(), (int)time(NULL), contact_id);
 
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -449,8 +423,7 @@ static int __ctsvc_db_email_delete_record(int id)
 
                if (email_id) {
                        __ctsvc_db_email_update_default(email_id, contact_id, is_default, is_primary_default);
-               }
-               else if (is_primary_default) {
+               } else if (is_primary_default) {
                        int default_email_id = 0;
                        default_email_id = __ctsvc_db_email_get_person_default_email(person_id);
                        if (default_email_id)
@@ -465,11 +438,11 @@ static int __ctsvc_db_email_delete_record(int id)
        ctsvc_set_person_noti();
 
        ret = ctsvc_end_trans(true);
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "DB error : ctsvc_end_trans() Fail(%d)", ret);
+       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "ctsvc_end_trans() Fail(%d)", ret);
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_email_get_all_records(int offset, int limit, contacts_list_hout_list)
+static int __ctsvc_db_email_get_all_records(int offset, int limit, contacts_list_h *out_list)
 {
        int len;
        int ret;
@@ -480,10 +453,10 @@ static int __ctsvc_db_email_get_all_records(int offset, int limit, contacts_list
 
        len = snprintf(query, sizeof(query),
                        "SELECT id, data.contact_id, is_default, data1, data2, data3 "
-                               "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                               "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                               "WHERE datatype = %d AND is_my_profile=0 ",
-                               CTSVC_DATA_EMAIL);
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE datatype = %d AND is_my_profile=0 ",
+                       CTSVC_DATA_EMAIL);
 
        if (0 != limit) {
                len += snprintf(query+len, sizeof(query)-len, " LIMIT %d", limit);
@@ -492,12 +465,12 @@ static int __ctsvc_db_email_get_all_records(int offset, int limit, contacts_list
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                if (1 /*CTS_TRUE */ != ret) {
-                       CTS_ERR("DB : ctsvc_stmt_step fail(%d)", ret);
+                       ERR("DB : ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -513,7 +486,7 @@ static int __ctsvc_db_email_get_all_records(int offset, int limit, contacts_list
 }
 
 static int __ctsvc_db_email_get_records_with_query(contacts_query_h query, int offset,
-               int limit, contacts_list_hout_list)
+               int limit, contacts_list_h *out_list)
 {
        int ret;
        int i;
@@ -524,7 +497,7 @@ static int __ctsvc_db_email_get_records_with_query(contacts_query_h query, int o
        ctsvc_email_s *email;
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        ret = ctsvc_db_make_get_records_query_stmt(s_query, offset, limit, &stmt);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_db_make_get_records_query_stmt fail(%d)", ret);
@@ -533,7 +506,7 @@ static int __ctsvc_db_email_get_records_with_query(contacts_query_h query, int o
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 /*CTS_TRUE */ != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -541,9 +514,9 @@ static int __ctsvc_db_email_get_records_with_query(contacts_query_h query, int o
 
                contacts_record_create(_contacts_email._uri, &record);
                email = (ctsvc_email_s*)record;
-               if (0 == s_query->projection_count)
+               if (0 == s_query->projection_count) {
                        field_count = s_query->property_count;
-               else {
+               else {
                        field_count = s_query->projection_count;
                        ret = ctsvc_record_set_projection_flags(record, s_query->projection,
                                        s_query->projection_count, s_query->property_count);
@@ -552,7 +525,7 @@ static int __ctsvc_db_email_get_records_with_query(contacts_query_h query, int o
                                ASSERT_NOT_REACHED("To set projection is Fail.\n");
                }
 
-               for (i=0;i<field_count;i++) {
+               for (i = 0; i < field_count; i++) {
                        char *temp;
                        int property_id;
                        if (0 == s_query->projection_count)
@@ -560,7 +533,7 @@ static int __ctsvc_db_email_get_records_with_query(contacts_query_h query, int o
                        else
                                property_id = s_query->projection[i];
 
-                       switch(property_id) {
+                       switch (property_id) {
                        case CTSVC_PROPERTY_EMAIL_ID:
                                email->id = ctsvc_stmt_get_int(stmt, i);
                                break;
@@ -595,3 +568,21 @@ static int __ctsvc_db_email_get_records_with_query(contacts_query_h query, int o
        *out_list = list;
        return CONTACTS_ERROR_NONE;
 }
+
+ctsvc_db_plugin_info_s ctsvc_db_plugin_email = {
+       .is_query_only = false,
+       .insert_record = __ctsvc_db_email_insert_record,
+       .get_record = __ctsvc_db_email_get_record,
+       .update_record = __ctsvc_db_email_update_record,
+       .delete_record = __ctsvc_db_email_delete_record,
+       .get_all_records = __ctsvc_db_email_get_all_records,
+       .get_records_with_query = __ctsvc_db_email_get_records_with_query,
+       .insert_records = NULL,
+       .update_records = NULL,
+       .delete_records = NULL,
+       .get_count = NULL,
+       .get_count_with_query = NULL,
+       .replace_record = NULL,
+       .replace_records = NULL,
+};
+
index 9a6b120..1c59b5d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_db_schema.h"
@@ -33,7 +32,7 @@ int ctsvc_db_email_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record,
        char *temp;
        ctsvc_email_s *email;
 
-       ret = contacts_record_create(_contacts_email._uri, (contacts_record_h *)&email);
+       ret = contacts_record_create(_contacts_email._uri, (contacts_record_h*)&email);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "contacts_record_create Fail(%d)", ret);
 
        email->id = ctsvc_stmt_get_int(stmt, start_count++);
@@ -56,7 +55,7 @@ static int __ctsvc_db_email_reset_default(int email_id, int contact_id)
 
        snprintf(query, sizeof(query),
                        "UPDATE "CTS_TABLE_DATA" SET is_default = 0, is_primary_default = 0 "
-                                       "WHERE id != %d AND contact_id = %d AND datatype = %d",
+                       "WHERE id != %d AND contact_id = %d AND datatype = %d",
                        email_id, contact_id, CTSVC_DATA_EMAIL);
        ret = ctsvc_query_exec(query);
        WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_query_exec() Fail(%d)", ret);
@@ -69,21 +68,21 @@ int ctsvc_db_email_insert(contacts_record_h record, int contact_id, bool is_my_p
        int email_id;
        cts_stmt stmt = NULL;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_email_s *email = (ctsvc_email_s *)record;
+       ctsvc_email_s *email = (ctsvc_email_s*)record;
 
        RETV_IF(NULL == email->email_addr, CONTACTS_ERROR_NONE);
        RETVM_IF(contact_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : contact_id(%d) is mandatory field to insert email record ", email->contact_id);
+                       "contact_id(%d) is mandatory field to insert email record ", email->contact_id);
        RETVM_IF(0 < email->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : id(%d), This record is already inserted", email->id);
+                       "id(%d), This record is already inserted", email->id);
 
        snprintf(query, sizeof(query),
-               "INSERT INTO "CTS_TABLE_DATA"(contact_id, is_my_profile, datatype, is_default, data1, data2, data3) "
-                                                                       "VALUES(%d, %d, %d, %d, %d, ?, ?)",
+                       "INSERT INTO "CTS_TABLE_DATA"(contact_id, is_my_profile, datatype, is_default, data1, data2, data3) "
+                       "VALUES(%d, %d, %d, %d, %d, ?, ?)",
                        contact_id, is_my_profile, CTSVC_DATA_EMAIL, email->is_default, email->type);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        if (email->label)
                ctsvc_stmt_bind_text(stmt, 1, email->label);
@@ -92,7 +91,7 @@ int ctsvc_db_email_insert(contacts_record_h record, int contact_id, bool is_my_p
 
        ret = ctsvc_stmt_step(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                return ret;
        }
@@ -102,7 +101,7 @@ int ctsvc_db_email_insert(contacts_record_h record, int contact_id, bool is_my_p
                *id = email_id;
        ctsvc_stmt_finalize(stmt);
 
-       if (ctsvc_record_check_property_flag((ctsvc_record_s *)record, _contacts_email.is_default, CTSVC_PROPERTY_FLAG_DIRTY)) {
+       if (ctsvc_record_check_property_flag((ctsvc_record_s*)record, _contacts_email.is_default, CTSVC_PROPERTY_FLAG_DIRTY)) {
                if (email->is_default)
                        __ctsvc_db_email_reset_default(email_id, contact_id);
        }
@@ -117,7 +116,7 @@ int ctsvc_db_email_update(contacts_record_h record, bool is_my_profile)
 {
        int id;
        int ret = CONTACTS_ERROR_NONE;
-       charset = NULL;
+       char *set = NULL;
        GSList *bind_text = NULL;
        GSList *cursor = NULL;
        ctsvc_email_s *email = (ctsvc_email_s*)record;
@@ -131,7 +130,7 @@ int ctsvc_db_email_update(contacts_record_h record, bool is_my_profile)
        ret = ctsvc_query_get_first_int_result(query, &id);
        RETV_IF(ret != CONTACTS_ERROR_NONE, ret);
 
-       if (ctsvc_record_check_property_flag((ctsvc_record_s *)record, _contacts_email.is_default, CTSVC_PROPERTY_FLAG_DIRTY)) {
+       if (ctsvc_record_check_property_flag((ctsvc_record_s*)record, _contacts_email.is_default, CTSVC_PROPERTY_FLAG_DIRTY)) {
                if (email->is_default)
                        __ctsvc_db_email_reset_default(email->id, email->contact_id);
        }
@@ -143,11 +142,14 @@ int ctsvc_db_email_update(contacts_record_h record, bool is_my_profile)
                        ctsvc_set_email_noti();
        } while (0);
 
-       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s *)record);
-       CONTACTS_FREE(set);
+       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s*)record);
+       free(set);
+
        if (bind_text) {
-               for (cursor=bind_text;cursor;cursor=cursor->next)
-                       CONTACTS_FREE(cursor->data);
+               for (cursor = bind_text; cursor; cursor = cursor->next) {
+                       free(cursor->data);
+                       cursor->data = NULL;
+               }
                g_slist_free(bind_text);
        }
 
index 68f6825..e906a36 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #ifndef __CTSVC_DB_PLUGIN_EMAIL_HELPER_H__
 #define __CTSVC_DB_PLUGIN_EMAIL_HELPER_H__
 
 #include "contacts.h"
 #include "ctsvc_db_sqlite.h"
 
-int ctsvc_db_email_insert(contacts_record_h record, int contact_id, bool is_my_profile, int *id);
+int ctsvc_db_email_insert(contacts_record_h record, int contact_id, bool is_my_profile,
+               int *id);
 int ctsvc_db_email_update(contacts_record_h record, bool is_my_profile);
 int ctsvc_db_email_delete(int id, bool is_my_profile);
 
-int ctsvc_db_email_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record, int start_count);
+int ctsvc_db_email_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record,
+               int start_count);
 
 #endif /* __CTSVC_DB_PLUGIN_EMAIL_HELPER_H__ */
index 425f547..6272237 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_db_schema.h"
 #include "ctsvc_list.h"
 #include "ctsvc_notification.h"
 
-static int __ctsvc_db_event_insert_record(contacts_record_h record, int *id);
-static int __ctsvc_db_event_get_record(int id, contacts_record_h* out_record);
-static int __ctsvc_db_event_update_record(contacts_record_h record);
-static int __ctsvc_db_event_delete_record(int id);
-static int __ctsvc_db_event_get_all_records(int offset, int limit, contacts_list_h* out_list);
-static int __ctsvc_db_event_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h* out_list);
-
-ctsvc_db_plugin_info_s ctsvc_db_plugin_event = {
-       .is_query_only = false,
-       .insert_record = __ctsvc_db_event_insert_record,
-       .get_record = __ctsvc_db_event_get_record,
-       .update_record = __ctsvc_db_event_update_record,
-       .delete_record = __ctsvc_db_event_delete_record,
-       .get_all_records = __ctsvc_db_event_get_all_records,
-       .get_records_with_query = __ctsvc_db_event_get_records_with_query,
-       .insert_records = NULL,
-       .update_records = NULL,
-       .delete_records = NULL,
-       .get_count = NULL,
-       .get_count_with_query = NULL,
-       .replace_record = NULL,
-       .replace_records = NULL,
-};
 
 static int __ctsvc_db_event_insert_record(contacts_record_h record, int *id)
 {
        int ret;
        int addressbook_id;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_event_s *event = (ctsvc_event_s *)record;
+       ctsvc_event_s *event = (ctsvc_event_s*)record;
 
        RETVM_IF(event->date <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : event date(%d)", event->date);
+                       "event date(%d)", event->date);
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -77,31 +53,30 @@ static int __ctsvc_db_event_insert_record(contacts_record_h record, int *id)
        if (CONTACTS_ERROR_NONE != ret) {
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NO_DATA == ret) {
-                       CTS_ERR("No data : contact_id (%d) is not exist", event->contact_id);
+                       ERR("No data : contact_id (%d) is not exist", event->contact_id);
                        return CONTACTS_ERROR_INVALID_PARAMETER;
-               }
-               else {
-                       CTS_ERR("ctsvc_query_get_first_int_result Fail(%d)", ret);
+               } else {
+                       ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                        return ret;
                }
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this event record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this event record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_event_insert(record, event->contact_id, false, id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_db_contact_update_changed_time(event->contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -109,14 +84,14 @@ static int __ctsvc_db_event_insert_record(contacts_record_h record, int *id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
-static int __ctsvc_db_event_get_record(int id, contacts_record_hout_record)
+static int __ctsvc_db_event_get_record(int id, contacts_record_h *out_record)
 {
        int ret;
        cts_stmt stmt = NULL;
@@ -127,17 +102,17 @@ static int __ctsvc_db_event_get_record(int id, contacts_record_h* out_record)
 
        snprintf(query, sizeof(query),
                        "SELECT id, data.contact_id, is_default, data1, data2, data3, data4, data5 "
-                               "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                               "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                               "WHERE id = %d AND datatype = %d ",
-                               id, CTSVC_DATA_EVENT);
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE id = %d AND datatype = %d ",
+                       id, CTSVC_DATA_EVENT);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/ != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
@@ -157,11 +132,11 @@ static int __ctsvc_db_event_update_record(contacts_record_h record)
        int ret;
        int addressbook_id;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_event_s *event = (ctsvc_event_s *)record;
+       ctsvc_event_s *event = (ctsvc_event_s*)record;
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -169,20 +144,20 @@ static int __ctsvc_db_event_update_record(contacts_record_h record)
                        "SELECT addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", event->contact_id);
        ret = ctsvc_query_get_first_int_result(query, &addressbook_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("No data : contact_id (%d) is not exist", event->contact_id);
+               ERR("No data : contact_id (%d) is not exist", event->contact_id);
                ctsvc_end_trans(false);
                return ret;
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this event record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this event record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_event_update(record, false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("update record Fail(%d)", ret);
+               ERR("update record Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -190,7 +165,7 @@ static int __ctsvc_db_event_update_record(contacts_record_h record)
        /* TODO ; contact display event update */
        ret = ctsvc_db_contact_update_changed_time(event->contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -198,11 +173,11 @@ static int __ctsvc_db_event_update_record(contacts_record_h record)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
 static int __ctsvc_db_event_delete_record(int id)
@@ -215,22 +190,22 @@ static int __ctsvc_db_event_delete_record(int id)
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
        snprintf(query, sizeof(query),
                        "SELECT contact_id, addressbook_id FROM "CTSVC_DB_VIEW_CONTACT " "
-                               "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id);
+                       "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id);
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
        ret = ctsvc_stmt_step(stmt);
        if (1 != ret) {
-               CTS_ERR("The id(%d) is Invalid(%d)", id, ret);
+               ERR("The id(%d) is Invalid(%d)", id, ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NONE == ret)
@@ -244,21 +219,21 @@ static int __ctsvc_db_event_delete_record(int id)
        ctsvc_stmt_finalize(stmt);
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to delete this event record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to delete this event record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_event_delete(id, false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_db_contact_update_changed_time(contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -266,14 +241,14 @@ static int __ctsvc_db_event_delete_record(int id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
-static int __ctsvc_db_event_get_all_records(int offset, int limit, contacts_list_hout_list)
+static int __ctsvc_db_event_get_all_records(int offset, int limit, contacts_list_h *out_list)
 {
        int len;
        int ret;
@@ -284,10 +259,10 @@ static int __ctsvc_db_event_get_all_records(int offset, int limit, contacts_list
 
        len = snprintf(query, sizeof(query),
                        "SELECT id, data.contact_id, is_default, data1, data2, data3, data4, data5 "
-                               "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                               "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                               "WHERE datatype = %d AND is_my_profile=0 ",
-                               CTSVC_DATA_EVENT);
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE datatype = %d AND is_my_profile=0 ",
+                       CTSVC_DATA_EVENT);
 
        if (0 != limit) {
                len += snprintf(query+len, sizeof(query)-len, " LIMIT %d", limit);
@@ -296,12 +271,12 @@ static int __ctsvc_db_event_get_all_records(int offset, int limit, contacts_list
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                if (1 /*CTS_TRUE */ != ret) {
-                       CTS_ERR("DB : ctsvc_stmt_step fail(%d)", ret);
+                       ERR("DB : ctsvc_stmt_step fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -317,7 +292,7 @@ static int __ctsvc_db_event_get_all_records(int offset, int limit, contacts_list
 }
 
 static int __ctsvc_db_event_get_records_with_query(contacts_query_h query, int offset,
-               int limit, contacts_list_hout_list)
+               int limit, contacts_list_h *out_list)
 {
        int ret;
        int i;
@@ -328,7 +303,7 @@ static int __ctsvc_db_event_get_records_with_query(contacts_query_h query, int o
        ctsvc_event_s *event;
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        ret = ctsvc_db_make_get_records_query_stmt(s_query, offset, limit, &stmt);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_db_make_get_records_query_stmt fail(%d)", ret);
@@ -337,7 +312,7 @@ static int __ctsvc_db_event_get_records_with_query(contacts_query_h query, int o
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 /*CTS_TRUE */ != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -345,9 +320,9 @@ static int __ctsvc_db_event_get_records_with_query(contacts_query_h query, int o
 
                contacts_record_create(_contacts_event._uri, &record);
                event = (ctsvc_event_s*)record;
-               if (0 == s_query->projection_count)
+               if (0 == s_query->projection_count) {
                        field_count = s_query->property_count;
-               else {
+               else {
                        field_count = s_query->projection_count;
                        ret = ctsvc_record_set_projection_flags(record, s_query->projection,
                                        s_query->projection_count, s_query->property_count);
@@ -356,7 +331,7 @@ static int __ctsvc_db_event_get_records_with_query(contacts_query_h query, int o
                                ASSERT_NOT_REACHED("To set projection is Fail.\n");
                }
 
-               for (i=0;i<field_count;i++) {
+               for (i = 0; i < field_count; i++) {
                        char *temp;
                        int property_id;
                        if (0 == s_query->projection_count)
@@ -364,7 +339,7 @@ static int __ctsvc_db_event_get_records_with_query(contacts_query_h query, int o
                        else
                                property_id = s_query->projection[i];
 
-                       switch(property_id) {
+                       switch (property_id) {
                        case CTSVC_PROPERTY_EVENT_ID:
                                event->id = ctsvc_stmt_get_int(stmt, i);
                                break;
@@ -400,3 +375,21 @@ static int __ctsvc_db_event_get_records_with_query(contacts_query_h query, int o
        *out_list = list;
        return CONTACTS_ERROR_NONE;
 }
+
+ctsvc_db_plugin_info_s ctsvc_db_plugin_event = {
+       .is_query_only = false,
+       .insert_record = __ctsvc_db_event_insert_record,
+       .get_record = __ctsvc_db_event_get_record,
+       .update_record = __ctsvc_db_event_update_record,
+       .delete_record = __ctsvc_db_event_delete_record,
+       .get_all_records = __ctsvc_db_event_get_all_records,
+       .get_records_with_query = __ctsvc_db_event_get_records_with_query,
+       .insert_records = NULL,
+       .update_records = NULL,
+       .delete_records = NULL,
+       .get_count = NULL,
+       .get_count_with_query = NULL,
+       .replace_record = NULL,
+       .replace_records = NULL,
+};
+
index 8fea968..c50ee25 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_db_schema.h"
@@ -32,21 +31,21 @@ int ctsvc_db_event_insert(contacts_record_h record, int contact_id, bool is_my_p
        int ret;
        cts_stmt stmt = NULL;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_event_s *event = (ctsvc_event_s *)record;
+       ctsvc_event_s *event = (ctsvc_event_s*)record;
 
        /* These check should be done in client side */
        RETV_IF(event->date <= 0, CONTACTS_ERROR_NONE);
        RETVM_IF(contact_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : contact_id(%d) is mandatory field to insert event record", event->contact_id);
+                       "contact_id(%d) is mandatory field to insert event record", event->contact_id);
        RETVM_IF(0 < event->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : id(%d), This record is already inserted", event->id);
+                       "id(%d), This record is already inserted", event->id);
 
        snprintf(query, sizeof(query),
-               "INSERT INTO "CTS_TABLE_DATA"(contact_id, is_my_profile, datatype, data1, data2, data3, data4, data5) "
-                                                                       "VALUES(%d, %d, %d, %d, ?, ?, ?, %d)",
+                       "INSERT INTO "CTS_TABLE_DATA"(contact_id, is_my_profile, datatype, data1, data2, data3, data4, data5) "
+                       "VALUES(%d, %d, %d, %d, ?, ?, ?, %d)",
                        contact_id, is_my_profile, CTSVC_DATA_EVENT, event->type, event->is_leap_month);
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        if (event->label)
                ctsvc_stmt_bind_text(stmt, 1, event->label);
@@ -55,7 +54,7 @@ int ctsvc_db_event_insert(contacts_record_h record, int contact_id, bool is_my_p
 
        ret = ctsvc_stmt_step(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                return ret;
        }
@@ -79,7 +78,7 @@ int ctsvc_db_event_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record,
        ctsvc_event_s *event;
        char *temp;
 
-       ret = contacts_record_create(_contacts_event._uri, (contacts_record_h *)&event);
+       ret = contacts_record_create(_contacts_event._uri, (contacts_record_h*)&event);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "contacts_record_create Fail(%d)", ret);
 
        event->id = ctsvc_stmt_get_int(stmt, start_count++);
@@ -101,7 +100,7 @@ int ctsvc_db_event_update(contacts_record_h record, bool is_my_profile)
 {
        int id;
        int ret = CONTACTS_ERROR_NONE;
-       charset = NULL;
+       char *set = NULL;
        GSList *bind_text = NULL;
        GSList *cursor = NULL;
        ctsvc_event_s *event = (ctsvc_event_s*)record;
@@ -122,11 +121,14 @@ int ctsvc_db_event_update(contacts_record_h record, bool is_my_profile)
                        ctsvc_set_event_noti();
        } while (0);
 
-       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s *)record);
-       CONTACTS_FREE(set);
+       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s*)record);
+       free(set);
+
        if (bind_text) {
-               for (cursor=bind_text;cursor;cursor=cursor->next)
-                       CONTACTS_FREE(cursor->data);
+               for (cursor = bind_text; cursor; cursor = cursor->next) {
+                       free(cursor->data);
+                       cursor->data = NULL;
+               }
                g_slist_free(bind_text);
        }
 
index 018ac40..eacf4b0 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #ifndef __CTSVC_DB_PLUGIN_EVENT_HELPER_H__
 #define __CTSVC_DB_PLUGIN_EVENT_HELPER_H__
 
 #include "contacts.h"
 #include "ctsvc_db_sqlite.h"
 
-int ctsvc_db_event_insert(contacts_record_h record, int contact_id, bool is_my_profile, int *id);
+int ctsvc_db_event_insert(contacts_record_h record, int contact_id, bool is_my_profile,
+               int *id);
 int ctsvc_db_event_update(contacts_record_h record, bool is_my_profile);
 int ctsvc_db_event_delete(int id, bool is_my_profile);
 
-int ctsvc_db_event_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record, int start_count);
+int ctsvc_db_event_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record,
+               int start_count);
 
 #endif /* __CTSVC_DB_PLUGIN_EVENT_HELPER_H__ */
index d1d6065..4e98824 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_db_schema.h"
 #include "ctsvc_list.h"
 #include "ctsvc_notification.h"
 
-static int __ctsvc_db_extension_insert_record(contacts_record_h record, int *id);
-static int __ctsvc_db_extension_get_record(int id, contacts_record_h* out_record);
-static int __ctsvc_db_extension_update_record(contacts_record_h record);
-static int __ctsvc_db_extension_delete_record(int id);
-static int __ctsvc_db_extension_get_all_records(int offset, int limit, contacts_list_h* out_list);
-static int __ctsvc_db_extension_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h* out_list);
-
-ctsvc_db_plugin_info_s ctsvc_db_plugin_extension = {
-       .is_query_only = false,
-       .insert_record = __ctsvc_db_extension_insert_record,
-       .get_record = __ctsvc_db_extension_get_record,
-       .update_record = __ctsvc_db_extension_update_record,
-       .delete_record = __ctsvc_db_extension_delete_record,
-       .get_all_records = __ctsvc_db_extension_get_all_records,
-       .get_records_with_query = __ctsvc_db_extension_get_records_with_query,
-       .insert_records = NULL,
-       .update_records = NULL,
-       .delete_records = NULL,
-       .get_count = NULL,
-       .get_count_with_query = NULL,
-       .replace_record = NULL,
-       .replace_records = NULL,
-};
 
 static int __ctsvc_db_extension_insert_record(contacts_record_h record, int *id)
 {
        int ret;
        int addressbook_id;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_extension_s *extension = (ctsvc_extension_s *)record;
+       ctsvc_extension_s *extension = (ctsvc_extension_s*)record;
 
        RETVM_IF(NULL == extension->data2 && NULL == extension->data3 && NULL == extension->data4
                        && NULL == extension->data5 && NULL == extension->data6 && NULL == extension->data7
@@ -70,7 +46,7 @@ static int __ctsvc_db_extension_insert_record(contacts_record_h record, int *id)
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -80,31 +56,30 @@ static int __ctsvc_db_extension_insert_record(contacts_record_h record, int *id)
        if (CONTACTS_ERROR_NONE != ret) {
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NO_DATA == ret) {
-                       CTS_ERR("No data : contact_id (%d) is not exist", extension->contact_id);
+                       ERR("No data : contact_id (%d) is not exist", extension->contact_id);
                        return CONTACTS_ERROR_INVALID_PARAMETER;
-               }
-               else {
-                       CTS_ERR("ctsvc_query_get_first_int_result Fail(%d)", ret);
+               } else {
+                       ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                        return ret;
                }
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this extension record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this extension record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_extension_insert(record, extension->contact_id, false, id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_db_contact_update_changed_time(extension->contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -112,14 +87,14 @@ static int __ctsvc_db_extension_insert_record(contacts_record_h record, int *id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
-static int __ctsvc_db_extension_get_record(int id, contacts_record_hout_record)
+static int __ctsvc_db_extension_get_record(int id, contacts_record_h *out_record)
 {
        int ret;
        cts_stmt stmt = NULL;
@@ -130,18 +105,18 @@ static int __ctsvc_db_extension_get_record(int id, contacts_record_h* out_record
 
        snprintf(query, sizeof(query),
                        "SELECT id, data.contact_id, is_default, data1, data2, "
-                               "data3, data4, data5, data6, data7, data8, data9, data10, data11, data12 "
-                               "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                               "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                               "WHERE id = %d AND datatype = %d ",
-                               id, CTSVC_DATA_EXTENSION);
+                       "data3, data4, data5, data6, data7, data8, data9, data10, data11, data12 "
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE id = %d AND datatype = %d ",
+                       id, CTSVC_DATA_EXTENSION);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/ != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
@@ -161,7 +136,7 @@ static int __ctsvc_db_extension_update_record(contacts_record_h record)
        int ret;
        int addressbook_id;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_extension_s *extension = (ctsvc_extension_s *)record;
+       ctsvc_extension_s *extension = (ctsvc_extension_s*)record;
 
        RETVM_IF(NULL == extension->data2 && NULL == extension->data3 && NULL == extension->data4 &&
                        NULL == extension->data5 && NULL == extension->data6 && NULL == extension->data7 &&
@@ -170,7 +145,7 @@ static int __ctsvc_db_extension_update_record(contacts_record_h record)
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -178,27 +153,27 @@ static int __ctsvc_db_extension_update_record(contacts_record_h record)
                        "SELECT addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", extension->contact_id);
        ret = ctsvc_query_get_first_int_result(query, &addressbook_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("No data : contact_id (%d) is not exist", extension->contact_id);
+               ERR("No data : contact_id (%d) is not exist", extension->contact_id);
                ctsvc_end_trans(false);
                return ret;
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this extension record : addressbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this extension record : addressbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_extension_update(record);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("update record Fail(%d)", ret);
+               ERR("update record Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_db_contact_update_changed_time(extension->contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -206,11 +181,11 @@ static int __ctsvc_db_extension_update_record(contacts_record_h record)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
 static int __ctsvc_db_extension_delete_record(int id)
@@ -223,22 +198,22 @@ static int __ctsvc_db_extension_delete_record(int id)
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
        snprintf(query, sizeof(query),
                        "SELECT contact_id, addressbook_id FROM "CTSVC_DB_VIEW_CONTACT " "
-                               "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id);
+                       "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id);
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare Fail(%d)", ret);
+               ERR("ctsvc_query_prepare Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
        ret = ctsvc_stmt_step(stmt);
        if (1 != ret) {
-               CTS_ERR("The id(%d) is Invalid(%d)", id, ret);
+               ERR("The id(%d) is Invalid(%d)", id, ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NONE == ret)
@@ -252,21 +227,21 @@ static int __ctsvc_db_extension_delete_record(int id)
        ctsvc_stmt_finalize(stmt);
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to delete this extension record : addressbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to delete this extension record : addressbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_extension_delete(id, false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_db_contact_update_changed_time(contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -274,14 +249,14 @@ static int __ctsvc_db_extension_delete_record(int id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
-static int __ctsvc_db_extension_get_all_records(int offset, int limit, contacts_list_hout_list)
+static int __ctsvc_db_extension_get_all_records(int offset, int limit, contacts_list_h *out_list)
 {
        int len;
        int ret;
@@ -292,11 +267,11 @@ static int __ctsvc_db_extension_get_all_records(int offset, int limit, contacts_
 
        len = snprintf(query, sizeof(query),
                        "SELECT id, data.contact_id, is_default, data1, data2, "
-                               "data3, data4, data5, data6, data7, data8, data9, data10, data11, data12 "
-                               "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                               "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                               "WHERE datatype = %d AND is_my_profile=0 ",
-                               CTSVC_DATA_EXTENSION);
+                       "data3, data4, data5, data6, data7, data8, data9, data10, data11, data12 "
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE datatype = %d AND is_my_profile=0 ",
+                       CTSVC_DATA_EXTENSION);
 
        if (0 != limit) {
                len += snprintf(query+len, sizeof(query)-len, " LIMIT %d", limit);
@@ -305,12 +280,12 @@ static int __ctsvc_db_extension_get_all_records(int offset, int limit, contacts_
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                if (1 /*CTS_TRUE */ != ret) {
-                       CTS_ERR("DB : ctsvc_stmt_step fail(%d)", ret);
+                       ERR("DB : ctsvc_stmt_step fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -326,7 +301,7 @@ static int __ctsvc_db_extension_get_all_records(int offset, int limit, contacts_
 }
 
 static int __ctsvc_db_extension_get_records_with_query(contacts_query_h query, int offset,
-               int limit, contacts_list_hout_list)
+               int limit, contacts_list_h *out_list)
 {
        int ret;
        int i;
@@ -337,7 +312,7 @@ static int __ctsvc_db_extension_get_records_with_query(contacts_query_h query, i
        ctsvc_extension_s *extension;
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        ret = ctsvc_db_make_get_records_query_stmt(s_query, offset, limit, &stmt);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_db_make_get_records_query_stmt fail(%d)", ret);
@@ -346,7 +321,7 @@ static int __ctsvc_db_extension_get_records_with_query(contacts_query_h query, i
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 /*CTS_TRUE */ != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -354,9 +329,9 @@ static int __ctsvc_db_extension_get_records_with_query(contacts_query_h query, i
 
                contacts_record_create(_contacts_extension._uri, &record);
                extension = (ctsvc_extension_s*)record;
-               if (0 == s_query->projection_count)
+               if (0 == s_query->projection_count) {
                        field_count = s_query->property_count;
-               else {
+               else {
                        field_count = s_query->projection_count;
                        ret = ctsvc_record_set_projection_flags(record, s_query->projection,
                                        s_query->projection_count, s_query->property_count);
@@ -365,7 +340,7 @@ static int __ctsvc_db_extension_get_records_with_query(contacts_query_h query, i
                                ASSERT_NOT_REACHED("To set projection is Fail.\n");
                }
 
-               for (i=0;i<field_count;i++) {
+               for (i = 0; i < field_count; i++) {
                        char *temp;
                        int property_id;
                        if (0 == s_query->projection_count)
@@ -373,7 +348,7 @@ static int __ctsvc_db_extension_get_records_with_query(contacts_query_h query, i
                        else
                                property_id = s_query->projection[i];
 
-                       switch(property_id) {
+                       switch (property_id) {
                        case CTSVC_PROPERTY_EXTENSION_ID:
                                extension->id = ctsvc_stmt_get_int(stmt, i);
                                break;
@@ -450,3 +425,21 @@ static int __ctsvc_db_extension_get_records_with_query(contacts_query_h query, i
        *out_list = list;
        return CONTACTS_ERROR_NONE;
 }
+
+ctsvc_db_plugin_info_s ctsvc_db_plugin_extension = {
+       .is_query_only = false,
+       .insert_record = __ctsvc_db_extension_insert_record,
+       .get_record = __ctsvc_db_extension_get_record,
+       .update_record = __ctsvc_db_extension_update_record,
+       .delete_record = __ctsvc_db_extension_delete_record,
+       .get_all_records = __ctsvc_db_extension_get_all_records,
+       .get_records_with_query = __ctsvc_db_extension_get_records_with_query,
+       .insert_records = NULL,
+       .update_records = NULL,
+       .delete_records = NULL,
+       .get_count = NULL,
+       .get_count_with_query = NULL,
+       .replace_record = NULL,
+       .replace_records = NULL,
+};
+
index 632260e..28926c4 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_db_schema.h"
@@ -34,7 +33,7 @@ int ctsvc_db_extension_get_value_from_stmt(cts_stmt stmt, contacts_record_h *rec
        char *temp;
        ctsvc_extension_s *extension;
 
-       ret = contacts_record_create(_contacts_extension._uri, (contacts_record_h *)&extension);
+       ret = contacts_record_create(_contacts_extension._uri, (contacts_record_h*)&extension);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "contacts_record_create Fail(%d)", ret);
 
        extension->id = ctsvc_stmt_get_int(stmt, start_count++);
@@ -42,11 +41,11 @@ int ctsvc_db_extension_get_value_from_stmt(cts_stmt stmt, contacts_record_h *rec
        start_count++;
        extension->data1 = ctsvc_stmt_get_int(stmt, start_count++);
        temp = ctsvc_stmt_get_text(stmt, start_count++);
-       extension->data2= SAFE_STRDUP(temp);
+       extension->data2 = SAFE_STRDUP(temp);
        temp = ctsvc_stmt_get_text(stmt, start_count++);
        extension->data3 = SAFE_STRDUP(temp);
        temp = ctsvc_stmt_get_text(stmt, start_count++);
-       extension->data4= SAFE_STRDUP(temp);
+       extension->data4 = SAFE_STRDUP(temp);
        temp = ctsvc_stmt_get_text(stmt, start_count++);
        extension->data5 = SAFE_STRDUP(temp);
        temp = ctsvc_stmt_get_text(stmt, start_count++);
@@ -100,30 +99,30 @@ int ctsvc_db_extension_insert(contacts_record_h record, int contact_id, bool is_
        int ret;
        cts_stmt stmt = NULL;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_extension_s *extension = (ctsvc_extension_s *)record;
+       ctsvc_extension_s *extension = (ctsvc_extension_s*)record;
 
        RETVM_IF(contact_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : contact_id(%d) is mandatory field to insert extension record ", extension->contact_id);
+                       "contact_id(%d) is mandatory field to insert extension record ", extension->contact_id);
        RETVM_IF(0 < extension->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : id(%d), This record is already inserted", extension->id);
+                       "id(%d), This record is already inserted", extension->id);
 
        if (extension->data2 || extension->data3 || extension->data4 || extension->data5
                        || extension->data6 || extension->data7 || extension->data8 || extension->data9
                        || extension->data10 || extension->data11 || extension->data12) {
                snprintf(query, sizeof(query),
-                       "INSERT INTO "CTS_TABLE_DATA" (contact_id, is_my_profile, datatype, data1, data2, data3, data4, "
-                                                               "data5, data6, data7, data8, data9, data10, data11, data12) "
-                                                               "VALUES(%d, %d, %d, %d, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
-                                               contact_id, is_my_profile, CTSVC_DATA_EXTENSION, extension->data1);
+                               "INSERT INTO "CTS_TABLE_DATA" (contact_id, is_my_profile, datatype, data1, data2, data3, data4, "
+                               "data5, data6, data7, data8, data9, data10, data11, data12) "
+                               "VALUES(%d, %d, %d, %d, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
+                               contact_id, is_my_profile, CTSVC_DATA_EXTENSION, extension->data1);
 
                ret = ctsvc_query_prepare(query, &stmt);
-               RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
                __ctsvc_extension_bind_stmt(stmt, extension, 1);
 
                ret = ctsvc_stmt_step(stmt);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        return ret;
                }
@@ -144,7 +143,7 @@ int ctsvc_db_extension_update(contacts_record_h record)
 {
        int id;
        int ret = CONTACTS_ERROR_NONE;
-       charset = NULL;
+       char *set = NULL;
        GSList *bind_text = NULL;
        GSList *cursor = NULL;
        ctsvc_extension_s *extension = (ctsvc_extension_s*)record;
@@ -163,11 +162,14 @@ int ctsvc_db_extension_update(contacts_record_h record)
                if (CONTACTS_ERROR_NONE != (ret = ctsvc_db_update_record_with_set_query(set, bind_text, CTS_TABLE_DATA, extension->id))) break;
        } while (0);
 
-       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s *)record);
-       CONTACTS_FREE(set);
+       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s*)record);
+       free(set);
+
        if (bind_text) {
-               for (cursor=bind_text;cursor;cursor=cursor->next)
-                       CONTACTS_FREE(cursor->data);
+               for (cursor = bind_text; cursor; cursor = cursor->next) {
+                       free(cursor->data);
+                       cursor->data = NULL;
+               }
                g_slist_free(bind_text);
        }
        return ret;
index fcf8547..90edad9 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #ifndef __CTSVC_DB_PLUGIN_EXTENSION_HELPER_H__
 #define __CTSVC_DB_PLUGIN_EXTENSION_HELPER_H__
 
 #include "contacts.h"
 #include "ctsvc_db_sqlite.h"
 
-int ctsvc_db_extension_insert(contacts_record_h record, int contact_id, bool is_my_profile, int *id);
+int ctsvc_db_extension_insert(contacts_record_h record, int contact_id,
+               bool is_my_profile, int *id);
 int ctsvc_db_extension_update(contacts_record_h record);
 int ctsvc_db_extension_delete(int id, bool is_my_profile);
 
-int ctsvc_db_extension_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record, int start_count);
+int ctsvc_db_extension_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record,
+               int start_count);
 
 #endif /* __CTSVC_DB_PLUGIN_EXTENSION_HELPER_H__ */
index ab982e8..531b842 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include <unistd.h>
 
 #include "contacts.h"
 #include "ctsvc_db_plugin_group_helper.h"
 #include "ctsvc_notify.h"
 
-static int __ctsvc_db_group_insert_record(contacts_record_h record, int *id);
-static int __ctsvc_db_group_get_record(int id, contacts_record_h* out_record);
-static int __ctsvc_db_group_update_record(contacts_record_h record);
-static int __ctsvc_db_group_delete_record(int id);
-static int __ctsvc_db_group_get_all_records(int offset, int limit, contacts_list_h* out_list);
-static int __ctsvc_db_group_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h* out_list);
-
-ctsvc_db_plugin_info_s ctsvc_db_plugin_group = {
-       .is_query_only = false,
-       .insert_record = __ctsvc_db_group_insert_record,
-       .get_record = __ctsvc_db_group_get_record,
-       .update_record = __ctsvc_db_group_update_record,
-       .delete_record = __ctsvc_db_group_delete_record,
-       .get_all_records = __ctsvc_db_group_get_all_records,
-       .get_records_with_query = __ctsvc_db_group_get_records_with_query,
-       .insert_records = NULL,
-       .update_records = NULL,
-       .delete_records = NULL,
-       .get_count = NULL,
-       .get_count_with_query = NULL,
-       .replace_record = NULL,
-       .replace_records = NULL,
-};
 
 static double __ctsvc_db_group_get_next_group_prio(void)
 {
@@ -67,7 +43,7 @@ static double __ctsvc_db_group_get_next_group_prio(void)
        snprintf(query, sizeof(query), "SELECT MAX(group_prio) FROM "CTS_TABLE_GROUPS" ");
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/  == ret)
@@ -83,21 +59,21 @@ static int __ctsvc_db_group_insert_record(contacts_record_h record, int *id)
        int ver;
        cts_stmt stmt;
        double group_prio = 0.0;
-       ctsvc_group_s *group = (ctsvc_group_s *)record;
+       ctsvc_group_s *group = (ctsvc_group_s*)record;
        char query[CTS_SQL_MAX_LEN] = {0};
 
        RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
        RETVM_IF(CTSVC_RECORD_GROUP != group->base.r_type, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : record is invalid type(%d)", group->base.r_type);
+                       "record is invalid type(%d)", group->base.r_type);
        RETVM_IF(NULL == group->name, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : The name of record is empty.");
+                       "The name of record is empty.");
 
        ret = ctsvc_begin_trans();
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret,  "DB error : ctsvc_begin_trans() Fail(%d)", ret);
+       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret,  "ctsvc_begin_trans() Fail(%d)", ret);
 
        if (false == ctsvc_have_ab_write_permission(group->addressbook_id)) {
-               CTS_ERR("ctsvc_have_ab_write_permission fail : does not have permission(addressbook_id : %d)",
-                                       group->addressbook_id);
+               ERR("ctsvc_have_ab_write_permission Fail: does not have permission(addressbook_id : %d)",
+                               group->addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
@@ -109,13 +85,13 @@ static int __ctsvc_db_group_insert_record(contacts_record_h record, int *id)
 
        snprintf(query, sizeof(query),
                        "INSERT INTO "CTS_TABLE_GROUPS"(group_id, addressbook_id, group_name, created_ver, changed_ver, ringtone_path, "
-                                               "vibration, message_alert, image_thumbnail_path, extra_data, is_read_only, group_prio) "
+                       "vibration, message_alert, image_thumbnail_path, extra_data, is_read_only, group_prio) "
                        "VALUES(%d, %d, ?, ?, ?, ?, ?, ?, ?, ?, %d, %lf)",
                        group->id, group->addressbook_id, group->is_read_only, group_prio);
 
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -138,7 +114,7 @@ static int __ctsvc_db_group_insert_record(contacts_record_h record, int *id)
                char image[CTSVC_IMG_FULL_PATH_SIZE_MAX] = {0};
                ret = ctsvc_have_file_read_permission(group->image_thumbnail_path);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_have_file_read_permission Fail(%d)", ret);
+                       ERR("ctsvc_have_file_read_permission Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        ctsvc_end_trans(false);
                        return ret;
@@ -147,7 +123,7 @@ static int __ctsvc_db_group_insert_record(contacts_record_h record, int *id)
                ctsvc_utils_make_image_file_name(0, group->id, group->image_thumbnail_path, image, sizeof(image));
                ret = ctsvc_utils_copy_image(CTS_GROUP_IMAGE_LOCATION, group->image_thumbnail_path, image);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_utils_copy_image() Fail(%d)", ret);
+                       ERR("ctsvc_utils_copy_image() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        ctsvc_end_trans(false);
                        return ret;
@@ -163,7 +139,7 @@ static int __ctsvc_db_group_insert_record(contacts_record_h record, int *id)
 
        ret = ctsvc_stmt_step(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                return ret;
@@ -175,7 +151,7 @@ static int __ctsvc_db_group_insert_record(contacts_record_h record, int *id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -186,7 +162,7 @@ static int __ctsvc_db_group_update_record(contacts_record_h record)
 {
        int addressbook_id = 0;
        int ret = CONTACTS_ERROR_NONE;
-       charset = NULL;
+       char *set = NULL;
        GSList *bind_text = NULL;
        GSList *cursor = NULL;
        ctsvc_group_s *group = (ctsvc_group_s*)record;
@@ -198,10 +174,10 @@ static int __ctsvc_db_group_update_record(contacts_record_h record)
 
        RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
        RETVM_IF(CTSVC_RECORD_GROUP != group->base.r_type, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : group is invalid type(%d)", group->base.r_type);
+                       "group is invalid type(%d)", group->base.r_type);
        RETVM_IF(CTSVC_PROPERTY_FLAG_DIRTY != (group->base.property_flag & CTSVC_PROPERTY_FLAG_DIRTY), CONTACTS_ERROR_NONE, "No update");
        RETVM_IF(NULL == group->name, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : The name of group is empty.");
+                       "The name of group is empty.");
 
        ret = ctsvc_begin_trans();
        RETVM_IF(ret, ret, "ctsvc_begin_trans() Fail(%d)", ret);
@@ -211,22 +187,22 @@ static int __ctsvc_db_group_update_record(contacts_record_h record)
                        CTS_TABLE_GROUPS, group->id);
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_stmt_step(stmt);
        if (1 != ret) {
-               CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NONE == ret) {
-                       CTS_ERR("DB error : The group record(%d) is Invalid(%d)", group->id, ret);
+                       ERR("The group record(%d) is Invalid(%d)", group->id, ret);
                        return CONTACTS_ERROR_NO_DATA;
-               }
-               else
+               } else {
                        return ret;
+               }
        }
 
        addressbook_id = ctsvc_stmt_get_int(stmt, 0);
@@ -235,22 +211,22 @@ static int __ctsvc_db_group_update_record(contacts_record_h record)
        image = SAFE_STRDUP(temp);
        ctsvc_stmt_finalize(stmt);
 
-       if (is_read_only && ctsvc_record_check_property_flag((ctsvc_record_s *)record, _contacts_group.name, CTSVC_PROPERTY_FLAG_DIRTY)) {
-               CTS_ERR("Can not change the group name. It is a read-only group (group_id : %d)", group->id);
+       if (is_read_only && ctsvc_record_check_property_flag((ctsvc_record_s*)record, _contacts_group.name, CTSVC_PROPERTY_FLAG_DIRTY)) {
+               ERR("Can not change the group name. It is a read-only group (group_id : %d)", group->id);
                ctsvc_end_trans(false);
                free(image);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("ctsvc_have_ab_write_permission fail : does not have permission(addressbook_id : %d, group_id : %d)",
-                                       addressbook_id, group->id);
+               ERR("ctsvc_have_ab_write_permission Fail: does not have permission(addressbook_id : %d, group_id : %d)",
+                               addressbook_id, group->id);
                ctsvc_end_trans(false);
                free(image);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
-       if (ctsvc_record_check_property_flag((ctsvc_record_s *)group, _contacts_group.image_path, CTSVC_PROPERTY_FLAG_DIRTY)) {
+       if (ctsvc_record_check_property_flag((ctsvc_record_s*)group, _contacts_group.image_path, CTSVC_PROPERTY_FLAG_DIRTY)) {
                bool same = false;
                bool check_permission = 0;
                /* delete current image */
@@ -260,14 +236,13 @@ static int __ctsvc_db_group_update_record(contacts_record_h record)
 
                        if (group->image_thumbnail_path && STRING_EQUAL == strcmp(group->image_thumbnail_path, full_path)) {
                                int index = _contacts_group.image_path & 0x000000FF;
-                               ((ctsvc_record_s *)record)->properties_flags[index] = 0;
+                               ((ctsvc_record_s*)record)->properties_flags[index] = 0;
                                same = true;
-                       }
-                       else {
+                       } else {
                                if (group->image_thumbnail_path) {
                                        ret = ctsvc_have_file_read_permission(group->image_thumbnail_path);
                                        if (ret != CONTACTS_ERROR_NONE) {
-                                               CTS_ERR("Your module does not have read permission of the image file()");
+                                               ERR("Your module does not have read permission of the image file()");
                                                ctsvc_end_trans(false);
                                                free(image);
                                                return ret;
@@ -275,9 +250,8 @@ static int __ctsvc_db_group_update_record(contacts_record_h record)
                                        check_permission = true;
                                }
                                ret = unlink(full_path);
-                               if (ret < 0) {
-                                       CTS_WARN("unlink Fail(%d)", errno);
-                               }
+                               if (ret < 0)
+                                       WARN("unlink() Fail(%d)", errno);
                        }
                }
 
@@ -287,7 +261,7 @@ static int __ctsvc_db_group_update_record(contacts_record_h record)
                        if (false == check_permission) {
                                ret = ctsvc_have_file_read_permission(group->image_thumbnail_path);
                                if (ret != CONTACTS_ERROR_NONE) {
-                                       CTS_ERR("ctsvc_have_file_read_permission Fail(%d)", ret);
+                                       ERR("ctsvc_have_file_read_permission Fail(%d)", ret);
                                        ctsvc_end_trans(false);
                                        free(image);
                                        return ret;
@@ -296,7 +270,7 @@ static int __ctsvc_db_group_update_record(contacts_record_h record)
                        ctsvc_utils_make_image_file_name(0, group->id, group->image_thumbnail_path, dest, sizeof(dest));
                        ret = ctsvc_utils_copy_image(CTS_GROUP_IMAGE_LOCATION, group->image_thumbnail_path, dest);
                        if (CONTACTS_ERROR_NONE != ret) {
-                               CTS_ERR("cts_copy_file() Fail(%d)", ret);
+                               ERR("cts_copy_file() Fail(%d)", ret);
                                ctsvc_end_trans(false);
                                free(image);
                                return ret;
@@ -321,12 +295,12 @@ static int __ctsvc_db_group_update_record(contacts_record_h record)
                snprintf(query, sizeof(query), "UPDATE %s SET %s WHERE group_id = %d", CTS_TABLE_GROUPS, query_set, group->id);
                ret = ctsvc_query_prepare(query, &stmt);
                if (NULL == stmt) {
-                       CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+                       ERR("ctsvc_query_prepare() Fail(%d)", ret);
                        break;
                }
                if (bind_text) {
                        int i = 0;
-                       for (cursor=bind_text,i=1;cursor;cursor=cursor->next,i++) {
+                       for (cursor = bind_text, i = 1; cursor; cursor = cursor->next, i++) {
                                const char *text = cursor->data;
                                if (text && *text)
                                        ctsvc_stmt_bind_text(stmt, i, text);
@@ -334,7 +308,7 @@ static int __ctsvc_db_group_update_record(contacts_record_h record)
                }
                ret = ctsvc_stmt_step(stmt);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        break;
                }
@@ -343,11 +317,14 @@ static int __ctsvc_db_group_update_record(contacts_record_h record)
                ctsvc_set_group_noti();
        } while (0);
 
-       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s *)record);
-       CONTACTS_FREE(set);
+       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s*)record);
+       free(set);
+
        if (bind_text) {
-               for (cursor=bind_text;cursor;cursor=cursor->next)
-                       CONTACTS_FREE(cursor->data);
+               for (cursor = bind_text; cursor; cursor = cursor->next) {
+                       free(cursor->data);
+                       cursor->data = NULL;
+               }
                g_slist_free(bind_text);
        }
 
@@ -357,7 +334,7 @@ static int __ctsvc_db_group_update_record(contacts_record_h record)
        }
 
        ret = ctsvc_end_trans(true);
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "DB error : ctsvc_end_trans() Fail(%d)", ret);
+       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "ctsvc_end_trans() Fail(%d)", ret);
 
        return CONTACTS_ERROR_NONE;
 }
@@ -370,7 +347,7 @@ static int __ctsvc_db_group_delete_record(int id)
        char query[CTS_SQL_MAX_LEN] = {0};
 
        ret = ctsvc_begin_trans();
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "DB error : ctsvc_begin_trans() Fail(%d)", ret);
+       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "ctsvc_begin_trans() Fail(%d)", ret);
 
        snprintf(query, sizeof(query),
                        "SELECT addressbook_id FROM %s WHERE group_id = %d",
@@ -378,23 +355,23 @@ static int __ctsvc_db_group_delete_record(int id)
 
        ret = ctsvc_query_get_first_int_result(query, &addressbook_id);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : The id(%d) is Invalid(%d)", id, addressbook_id);
+               ERR("The id(%d) is Invalid(%d)", id, addressbook_id);
                ctsvc_end_trans(false);
                return ret;
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("ctsvc_have_ab_write_permission fail : does not have permission(addressbook_id : %d, group_id : %d)",
-                                       addressbook_id, id);
+               ERR("ctsvc_have_ab_write_permission Fail: does not have permission(addressbook_id : %d, group_id : %d)",
+                               addressbook_id, id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        snprintf(query, sizeof(query),
-                               "SELECT COUNT(contact_id) FROM "CTS_TABLE_GROUP_RELATIONS" WHERE group_id = %d", id);
+                       "SELECT COUNT(contact_id) FROM "CTS_TABLE_GROUP_RELATIONS" WHERE group_id = %d", id);
        ret = ctsvc_query_get_first_int_result(query, &count);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_query_get_first_int_result Fail(%d)", ret);
+               ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -404,7 +381,7 @@ static int __ctsvc_db_group_delete_record(int id)
 
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -426,7 +403,7 @@ static int __ctsvc_db_group_delete_record(int id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -480,15 +457,15 @@ static int __ctsvc_db_group_get_record(int id, contacts_record_h *out_record)
 
        snprintf(query, sizeof(query),
                        "SELECT group_id, addressbook_id, group_name, extra_data, is_read_only, "
-                               "ringtone_path, vibration, message_alert, image_thumbnail_path "
-                               "FROM "CTS_TABLE_GROUPS" WHERE group_id = %d", id);
+                       "ringtone_path, vibration, message_alert, image_thumbnail_path "
+                       "FROM "CTS_TABLE_GROUPS" WHERE group_id = %d", id);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/ != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
@@ -500,7 +477,7 @@ static int __ctsvc_db_group_get_record(int id, contacts_record_h *out_record)
 
        ctsvc_stmt_finalize(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("__ctsvc_db_group_value_set(ALL) Fail(%d)", ret);
+               ERR("__ctsvc_db_group_value_set(ALL) Fail(%d)", ret);
                return ret;
        }
        *out_record = record;
@@ -508,7 +485,7 @@ static int __ctsvc_db_group_get_record(int id, contacts_record_h *out_record)
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_group_get_all_records(int offset, int limit, contacts_list_hout_list)
+static int __ctsvc_db_group_get_all_records(int offset, int limit, contacts_list_h *out_list)
 {
        int ret;
        int len;
@@ -518,8 +495,8 @@ static int __ctsvc_db_group_get_all_records(int offset, int limit, contacts_list
 
        len = snprintf(query, sizeof(query),
                        "SELECT group_id, addressbook_id, group_name, extra_data, is_read_only, "
-                               "ringtone_path, vibration, message_alert, image_thumbnail_path "
-                               "FROM "CTS_TABLE_GROUPS);
+                       "ringtone_path, vibration, message_alert, image_thumbnail_path "
+                       "FROM "CTS_TABLE_GROUPS);
 
 
        len += snprintf(query+len, sizeof(query)-len, " ORDER BY addressbook_id, group_prio");
@@ -531,13 +508,13 @@ static int __ctsvc_db_group_get_all_records(int offset, int limit, contacts_list
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -555,7 +532,7 @@ static int __ctsvc_db_group_get_all_records(int offset, int limit, contacts_list
 }
 
 static int __ctsvc_db_group_get_records_with_query(contacts_query_h query,
-       int offset, int limit, contacts_list_h* out_list)
+               int offset, int limit, contacts_list_h *out_list)
 {
        int ret;
        int i;
@@ -567,7 +544,7 @@ static int __ctsvc_db_group_get_records_with_query(contacts_query_h query,
        char full_path[CTSVC_IMG_FULL_PATH_SIZE_MAX] = {0};
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        ret = ctsvc_db_make_get_records_query_stmt(s_query, offset, limit, &stmt);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_db_make_get_records_query_stmt fail(%d)", ret);
@@ -576,7 +553,7 @@ static int __ctsvc_db_group_get_records_with_query(contacts_query_h query,
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -584,17 +561,18 @@ static int __ctsvc_db_group_get_records_with_query(contacts_query_h query,
 
                contacts_record_create(_contacts_group._uri, &record);
                group = (ctsvc_group_s*)record;
-               if (0 == s_query->projection_count)
+               if (0 == s_query->projection_count) {
                        field_count = s_query->property_count;
-               else {
+               else {
                        field_count = s_query->projection_count;
 
-                       if (CONTACTS_ERROR_NONE != ctsvc_record_set_projection_flags(record, s_query->projection, s_query->projection_count, s_query->property_count)) {
+                       int err = ctsvc_record_set_projection_flags(record, s_query->projection,
+                                       s_query->projection_count, s_query->property_count);
+                       if (CONTACTS_ERROR_NONE != err)
                                ASSERT_NOT_REACHED("To set projection is Fail.\n");
-                       }
                }
 
-               for (i=0;i<field_count;i++) {
+               for (i = 0; i < field_count; i++) {
                        char *temp;
                        int property_id;
                        if (0 == s_query->projection_count)
@@ -602,7 +580,7 @@ static int __ctsvc_db_group_get_records_with_query(contacts_query_h query,
                        else
                                property_id = s_query->projection[i];
 
-                       switch(property_id) {
+                       switch (property_id) {
                        case CTSVC_PROPERTY_GROUP_ID:
                                group->id = ctsvc_stmt_get_int(stmt, i);
                                break;
@@ -659,4 +637,20 @@ static int __ctsvc_db_group_get_records_with_query(contacts_query_h query,
        return CONTACTS_ERROR_NONE;
 }
 
+ctsvc_db_plugin_info_s ctsvc_db_plugin_group = {
+       .is_query_only = false,
+       .insert_record = __ctsvc_db_group_insert_record,
+       .get_record = __ctsvc_db_group_get_record,
+       .update_record = __ctsvc_db_group_update_record,
+       .delete_record = __ctsvc_db_group_delete_record,
+       .get_all_records = __ctsvc_db_group_get_all_records,
+       .get_records_with_query = __ctsvc_db_group_get_records_with_query,
+       .insert_records = NULL,
+       .update_records = NULL,
+       .delete_records = NULL,
+       .get_count = NULL,
+       .get_count_with_query = NULL,
+       .replace_record = NULL,
+       .replace_records = NULL,
+};
 
index 88525fc..b1d0a18 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include <ctype.h>
 #include <unistd.h>
 
  * Whenever deleting group, this function will be called
  * in order to deleting group image file
  */
-void ctsvc_db_group_delete_callback(sqlite3_context *context, int argc, sqlite3_value ** argv)
+void ctsvc_db_group_delete_callback(sqlite3_context *context, int argc, sqlite3_value **argv)
 {
        int ret;
-       const unsigned charpath;
+       const unsigned char *path;
 
        if (1 < argc) {
                sqlite3_result_null(context);
@@ -50,9 +49,8 @@ void ctsvc_db_group_delete_callback(sqlite3_context *context, int argc, sqlite3_
                char full_path[CTSVC_IMG_FULL_PATH_SIZE_MAX] = {0};
                snprintf(full_path, sizeof(full_path), "%s/%s", CTS_GROUP_IMAGE_LOCATION, path);
                ret = unlink(full_path);
-               if (ret < 0) {
-                       CTS_WARN("unlink Failed(%d)", errno);
-               }
+               if (ret < 0)
+                       WARN("unlink() Fail(%d)", errno);
        }
 
        return;
@@ -114,8 +112,7 @@ int ctsvc_db_group_name_sort_callback(void *context, int str1_len, const void *s
        default:
                if (CTSVC_SORT_NUMBER >= str2_sort_type) {
                        ret = 1;
-               }
-               else {
+               } else {
                        if (str1_sort_type != str2_sort_type) {
                                if (str1_sort_type == prim_sort)
                                        ret = -1;
@@ -123,8 +120,7 @@ int ctsvc_db_group_name_sort_callback(void *context, int str1_len, const void *s
                                        ret = 1;
                                else
                                        ret = _ctsvc_db_group_name_collation_str(str_src1, str_src2);
-                       }
-                       else {
+                       } else {
                                ret = _ctsvc_db_group_name_collation_str(str_src1, str_src2);
                        }
                }
index 8d13174..00a860c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #ifndef __CTSVC_DB_PLUGIN_GROUP_HELPER_H__
 #define __CTSVC_DB_PLUGIN_GROUP_HELPER_H__
 
 #include "contacts.h"
 #include "ctsvc_db_sqlite.h"
-#include <tzplatform_config.h>
 
-void ctsvc_db_group_delete_callback(sqlite3_context *context, int argc, sqlite3_value ** argv);
-int ctsvc_db_group_name_sort_callback(void *context, int str1_len, const void *str1, int str2_len, const void *str2);
+void ctsvc_db_group_delete_callback(sqlite3_context *context, int argc,
+               sqlite3_value **argv);
+int ctsvc_db_group_name_sort_callback(void *context, int str1_len, const void *str1,
+               int str2_len, const void *str2);
 
 #endif /* __CTSVC_DB_PLUGIN_GROUP_HELPER_H__ */
index b2ba991..b7e9cd2 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_db_schema.h"
 #include "ctsvc_record.h"
 #include "ctsvc_db_access_control.h"
 
-static int __ctsvc_db_grouprelation_insert_record(contacts_record_h record, int *id);
-static int __ctsvc_db_grouprelation_get_record(int id, contacts_record_h* out_record);
-static int __ctsvc_db_grouprelation_update_record(contacts_record_h record);
-static int __ctsvc_db_grouprelation_delete_record(int id);
-static int __ctsvc_db_grouprelation_get_all_records(int offset, int limit, contacts_list_h* out_list);
-static int __ctsvc_db_grouprelation_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h* out_list);
-
-ctsvc_db_plugin_info_s ctsvc_db_plugin_grouprelation = {
-       .is_query_only = false,
-       .insert_record = __ctsvc_db_grouprelation_insert_record,
-       .get_record = __ctsvc_db_grouprelation_get_record,
-       .update_record = __ctsvc_db_grouprelation_update_record,
-       .delete_record = __ctsvc_db_grouprelation_delete_record,
-       .get_all_records = __ctsvc_db_grouprelation_get_all_records,
-       .get_records_with_query = __ctsvc_db_grouprelation_get_records_with_query,
-       .insert_records = NULL,
-       .update_records = NULL,
-       .delete_records = NULL,
-       .get_count = NULL,
-       .get_count_with_query = NULL,
-       .replace_record = NULL,
-       .replace_records = NULL,
-};
 
 static int __ctsvc_db_grouprelation_insert_record(contacts_record_h record, int *id)
 {
-       CTS_ERR("Please use the contacts_group_add_contact()");
+       ERR("Please use the contacts_group_add_contact()");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_db_grouprelation_get_record(int id, contacts_record_hout_record)
+static int __ctsvc_db_grouprelation_get_record(int id, contacts_record_h *out_record)
 {
-       CTS_ERR("Not support get group-relation");
+       ERR("Not support get group-relation");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
 static int __ctsvc_db_grouprelation_update_record(contacts_record_h record)
 {
-       CTS_ERR("Not support update group-relation");
+       ERR("Not support update group-relation");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
 static int __ctsvc_db_grouprelation_delete_record(int id)
 {
-       CTS_ERR("Please use the contacts_group_remove_contact()");
+       ERR("Please use the contacts_group_remove_contact()");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_db_grouprelation_get_all_records(int offset, int limit, contacts_list_hout_list)
+static int __ctsvc_db_grouprelation_get_all_records(int offset, int limit, contacts_list_h *out_list)
 {
        int len;
        int ret;
@@ -96,12 +72,12 @@ static int __ctsvc_db_grouprelation_get_all_records(int offset, int limit, conta
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -127,7 +103,7 @@ static int __ctsvc_db_grouprelation_get_all_records(int offset, int limit, conta
 }
 
 static int __ctsvc_db_grouprelation_get_records_with_query(contacts_query_h query,
-               int offset, int limit, contacts_list_hout_list)
+               int offset, int limit, contacts_list_h *out_list)
 {
        int ret;
        int i;
@@ -138,7 +114,7 @@ static int __ctsvc_db_grouprelation_get_records_with_query(contacts_query_h quer
        ctsvc_group_relation_s *group_relation;
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        ret = ctsvc_db_make_get_records_query_stmt(s_query, offset, limit, &stmt);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_db_make_get_records_query_stmt fail(%d)", ret);
@@ -147,7 +123,7 @@ static int __ctsvc_db_grouprelation_get_records_with_query(contacts_query_h quer
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -160,12 +136,13 @@ static int __ctsvc_db_grouprelation_get_records_with_query(contacts_query_h quer
                else {
                        field_count = s_query->projection_count;
 
-                       if (CONTACTS_ERROR_NONE != ctsvc_record_set_projection_flags(record, s_query->projection, s_query->projection_count, s_query->property_count)) {
+                       int err = ctsvc_record_set_projection_flags(record, s_query->projection,
+                                       s_query->projection_count, s_query->property_count);
+                       if (CONTACTS_ERROR_NONE != err)
                                ASSERT_NOT_REACHED("To set projection is Fail.\n");
-                       }
                }
 
-               for (i=0;i<field_count;i++) {
+               for (i = 0; i < field_count; i++) {
                        char *temp;
                        int property_id;
                        if (0 == s_query->projection_count)
@@ -176,7 +153,7 @@ static int __ctsvc_db_grouprelation_get_records_with_query(contacts_query_h quer
                        if (CTSVC_PROPERTY_GROUP_RELATION_ID == property_id)
                                continue;
 
-                       switch(property_id) {
+                       switch (property_id) {
                        case CTSVC_PROPERTY_GROUP_RELATION_CONTACT_ID:
                                group_relation->contact_id = ctsvc_stmt_get_int(stmt, i);
                                break;
@@ -201,3 +178,21 @@ static int __ctsvc_db_grouprelation_get_records_with_query(contacts_query_h quer
        *out_list = list;
        return CONTACTS_ERROR_NONE;
 }
+
+ctsvc_db_plugin_info_s ctsvc_db_plugin_grouprelation = {
+       .is_query_only = false,
+       .insert_record = __ctsvc_db_grouprelation_insert_record,
+       .get_record = __ctsvc_db_grouprelation_get_record,
+       .update_record = __ctsvc_db_grouprelation_update_record,
+       .delete_record = __ctsvc_db_grouprelation_delete_record,
+       .get_all_records = __ctsvc_db_grouprelation_get_all_records,
+       .get_records_with_query = __ctsvc_db_grouprelation_get_records_with_query,
+       .insert_records = NULL,
+       .update_records = NULL,
+       .delete_records = NULL,
+       .get_count = NULL,
+       .get_count_with_query = NULL,
+       .replace_record = NULL,
+       .replace_records = NULL,
+};
+
index 8180943..1bca792 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_db_schema.h"
 #include "ctsvc_list.h"
 #include "ctsvc_notification.h"
 
-static int __ctsvc_db_image_insert_record(contacts_record_h record, int *id);
-static int __ctsvc_db_image_get_record(int id, contacts_record_h* out_record);
-static int __ctsvc_db_image_update_record(contacts_record_h record);
-static int __ctsvc_db_image_delete_record(int id);
-static int __ctsvc_db_image_get_all_records(int offset, int limit, contacts_list_h* out_list);
-static int __ctsvc_db_image_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h* out_list);
-
-ctsvc_db_plugin_info_s ctsvc_db_plugin_image = {
-       .is_query_only = false,
-       .insert_record = __ctsvc_db_image_insert_record,
-       .get_record = __ctsvc_db_image_get_record,
-       .update_record = __ctsvc_db_image_update_record,
-       .delete_record = __ctsvc_db_image_delete_record,
-       .get_all_records = __ctsvc_db_image_get_all_records,
-       .get_records_with_query = __ctsvc_db_image_get_records_with_query,
-       .insert_records = NULL,
-       .update_records = NULL,
-       .delete_records = NULL,
-       .get_count = NULL,
-       .get_count_with_query = NULL,
-       .replace_record = NULL,
-       .replace_records = NULL,
-};
 
 static int __ctsvc_db_image_get_default_image_id(int contact_id)
 {
@@ -137,7 +113,7 @@ static int __ctsvc_db_image_update_contact_image(int contact_id, const char *ima
        snprintf(query, sizeof(query), "UPDATE "CTS_TABLE_CONTACTS" SET image_thumbnail_path=? WHERE contact_id = %d", contact_id);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        if (image_path)
                ctsvc_stmt_bind_text(stmt, 1, image_path);
@@ -159,7 +135,7 @@ static int __ctsvc_db_image_update_person_image(int person_id, const char *image
        snprintf(query, sizeof(query), "UPDATE "CTS_TABLE_PERSONS" SET image_thumbnail_path=? WHERE person_id = %d", person_id);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        if (image_path)
                ctsvc_stmt_bind_text(stmt, 1, image_path);
@@ -181,15 +157,14 @@ static int __ctsvc_db_image_insert_record(contacts_record_h record, int *id)
        int person_id;
        int old_default_image_id;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_image_s *image = (ctsvc_image_s *)record;
+       ctsvc_image_s *image = (ctsvc_image_s*)record;
        cts_stmt stmt = NULL;
 
-       RETVM_IF(NULL == image->path, CONTACTS_ERROR_INVALID_PARAMETER,
-               "Invalid parameter : image path is NULL");
+       RETV_IF(NULL == image->path, CONTACTS_ERROR_INVALID_PARAMETER);
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -197,14 +172,14 @@ static int __ctsvc_db_image_insert_record(contacts_record_h record, int *id)
                        "SELECT addressbook_id, person_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", image->contact_id);
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_stmt_step(stmt);
        if (1 != ret) {
-               CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                if (ret == CONTACTS_ERROR_NONE)
@@ -218,7 +193,7 @@ static int __ctsvc_db_image_insert_record(contacts_record_h record, int *id)
        ctsvc_stmt_finalize(stmt);
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this image record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this image record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
@@ -229,7 +204,7 @@ static int __ctsvc_db_image_insert_record(contacts_record_h record, int *id)
 
        ret = ctsvc_db_image_insert(record, image->contact_id, false, id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -245,7 +220,7 @@ static int __ctsvc_db_image_insert_record(contacts_record_h record, int *id)
        snprintf(query + len, sizeof(query) - len, " WHERE contact_id = %d", image->contact_id);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        if (image->is_default)
                ctsvc_stmt_bind_text(stmt, 1, image->path);
@@ -269,14 +244,14 @@ static int __ctsvc_db_image_insert_record(contacts_record_h record, int *id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
-static int __ctsvc_db_image_get_record(int id, contacts_record_hout_record)
+static int __ctsvc_db_image_get_record(int id, contacts_record_h *out_record)
 {
        int ret;
        cts_stmt stmt = NULL;
@@ -287,17 +262,17 @@ static int __ctsvc_db_image_get_record(int id, contacts_record_h* out_record)
 
        snprintf(query, sizeof(query),
                        "SELECT id, data.contact_id, is_default, data1, data2, data3 "
-                               "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                               "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                               "WHERE id = %d AND datatype = %d ",
-                               id, CTSVC_DATA_IMAGE);
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE id = %d AND datatype = %d ",
+                       id, CTSVC_DATA_IMAGE);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/ != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
@@ -320,13 +295,13 @@ static int __ctsvc_db_image_update_record(contacts_record_h record)
        int person_id;
        int addressbook_id;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_image_s *image = (ctsvc_image_s *)record;
+       ctsvc_image_s *image = (ctsvc_image_s*)record;
        cts_stmt stmt = NULL;
        RETVM_IF(NULL == image->path, CONTACTS_ERROR_INVALID_PARAMETER, "path is empty");
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -334,14 +309,14 @@ static int __ctsvc_db_image_update_record(contacts_record_h record)
                        "SELECT addressbook_id, person_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", image->contact_id);
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_stmt_step(stmt);
        if (1 != ret) {
-               CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NONE == ret)
@@ -354,14 +329,14 @@ static int __ctsvc_db_image_update_record(contacts_record_h record)
        ctsvc_stmt_finalize(stmt);
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this image record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this image record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_image_update(record, image->contact_id, false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -377,7 +352,7 @@ static int __ctsvc_db_image_update_record(contacts_record_h record)
        snprintf(query + len, sizeof(query) - len, " WHERE contact_id = %d", image->contact_id);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        if (image->is_default)
                ctsvc_stmt_bind_text(stmt, 1, image->path);
@@ -400,11 +375,11 @@ static int __ctsvc_db_image_update_record(contacts_record_h record)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
 static int __ctsvc_db_image_delete_record(int id)
@@ -422,7 +397,7 @@ static int __ctsvc_db_image_delete_record(int id)
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -431,7 +406,7 @@ static int __ctsvc_db_image_delete_record(int id)
                        "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id);
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -440,7 +415,7 @@ static int __ctsvc_db_image_delete_record(int id)
        if (1 /*CTS_TRUE*/ != ret) {
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
-               CTS_ERR("The id(%d) is Invalid(%d)", id, ret);
+               ERR("The id(%d) is Invalid(%d)", id, ret);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
                else
@@ -452,7 +427,7 @@ static int __ctsvc_db_image_delete_record(int id)
        ctsvc_stmt_finalize(stmt);
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to delete this image record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to delete this image record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
@@ -462,14 +437,14 @@ static int __ctsvc_db_image_delete_record(int id)
 
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_stmt_step(stmt);
        if (1 != ret) {
-               CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NONE == ret)
@@ -485,20 +460,20 @@ static int __ctsvc_db_image_delete_record(int id)
        ret = ctsvc_db_image_delete(id, false);
 
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        version = ctsvc_get_next_ver();
        snprintf(query, sizeof(query),
-               "UPDATE "CTS_TABLE_CONTACTS" SET changed_ver = %d, changed_time = %d, image_changed_ver = %d "
+                       "UPDATE "CTS_TABLE_CONTACTS" SET changed_ver = %d, changed_time = %d, image_changed_ver = %d "
                        "WHERE contact_id = %d",
                        version, (int)time(NULL), version, contact_id);
 
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -511,8 +486,7 @@ static int __ctsvc_db_image_delete_record(int id)
 
                if (image_id) {
                        __ctsvc_db_image_set_default(image_id, contact_id, is_default, is_primary_default);
-               }
-               else {
+               } else {
                        __ctsvc_db_image_update_contact_image(contact_id, NULL);
                        if (is_primary_default) {
                                int default_img_id = 0;
@@ -530,14 +504,14 @@ static int __ctsvc_db_image_delete_record(int id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
-static int __ctsvc_db_image_get_all_records(int offset, int limit, contacts_list_hout_list)
+static int __ctsvc_db_image_get_all_records(int offset, int limit, contacts_list_h *out_list)
 {
        int len;
        int ret;
@@ -548,10 +522,10 @@ static int __ctsvc_db_image_get_all_records(int offset, int limit, contacts_list
 
        len = snprintf(query, sizeof(query),
                        "SELECT id, data.contact_id, is_default, data1, data2, data3 "
-                               "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                               "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                               "WHERE datatype = %d AND is_my_profile=0 ",
-                               CTSVC_DATA_IMAGE);
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE datatype = %d AND is_my_profile=0 ",
+                       CTSVC_DATA_IMAGE);
 
        if (0 != limit) {
                len += snprintf(query+len, sizeof(query)-len, " LIMIT %d", limit);
@@ -560,12 +534,12 @@ static int __ctsvc_db_image_get_all_records(int offset, int limit, contacts_list
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                if (1 /*CTS_TRUE */ != ret) {
-                       CTS_ERR("DB : ctsvc_stmt_step fail(%d)", ret);
+                       ERR("DB : ctsvc_stmt_step fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -581,7 +555,7 @@ static int __ctsvc_db_image_get_all_records(int offset, int limit, contacts_list
 }
 
 static int __ctsvc_db_image_get_records_with_query(contacts_query_h query, int offset,
-               int limit, contacts_list_hout_list)
+               int limit, contacts_list_h *out_list)
 {
        int ret;
        int i;
@@ -592,7 +566,7 @@ static int __ctsvc_db_image_get_records_with_query(contacts_query_h query, int o
        ctsvc_image_s *image;
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        ret = ctsvc_db_make_get_records_query_stmt(s_query, offset, limit, &stmt);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_db_make_get_records_query_stmt fail(%d)", ret);
@@ -601,7 +575,7 @@ static int __ctsvc_db_image_get_records_with_query(contacts_query_h query, int o
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 /*CTS_TRUE */ != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -609,9 +583,9 @@ static int __ctsvc_db_image_get_records_with_query(contacts_query_h query, int o
 
                contacts_record_create(_contacts_image._uri, &record);
                image = (ctsvc_image_s*)record;
-               if (0 == s_query->projection_count)
+               if (0 == s_query->projection_count) {
                        field_count = s_query->property_count;
-               else {
+               else {
                        field_count = s_query->projection_count;
                        ret = ctsvc_record_set_projection_flags(record, s_query->projection,
                                        s_query->projection_count, s_query->property_count);
@@ -620,7 +594,7 @@ static int __ctsvc_db_image_get_records_with_query(contacts_query_h query, int o
                                ASSERT_NOT_REACHED("To set projection is Fail.\n");
                }
 
-               for (i=0;i<field_count;i++) {
+               for (i = 0; i < field_count; i++) {
                        char *temp;
                        int property_id;
                        if (0 == s_query->projection_count)
@@ -628,7 +602,7 @@ static int __ctsvc_db_image_get_records_with_query(contacts_query_h query, int o
                        else
                                property_id = s_query->projection[i];
 
-                       switch(property_id) {
+                       switch (property_id) {
                        case CTSVC_PROPERTY_IMAGE_ID:
                                image->id = ctsvc_stmt_get_int(stmt, i);
                                break;
@@ -663,3 +637,21 @@ static int __ctsvc_db_image_get_records_with_query(contacts_query_h query, int o
        *out_list = list;
        return CONTACTS_ERROR_NONE;
 }
+
+ctsvc_db_plugin_info_s ctsvc_db_plugin_image = {
+       .is_query_only = false,
+       .insert_record = __ctsvc_db_image_insert_record,
+       .get_record = __ctsvc_db_image_get_record,
+       .update_record = __ctsvc_db_image_update_record,
+       .delete_record = __ctsvc_db_image_delete_record,
+       .get_all_records = __ctsvc_db_image_get_all_records,
+       .get_records_with_query = __ctsvc_db_image_get_records_with_query,
+       .insert_records = NULL,
+       .update_records = NULL,
+       .delete_records = NULL,
+       .get_count = NULL,
+       .get_count_with_query = NULL,
+       .replace_record = NULL,
+       .replace_records = NULL,
+};
+
index a6393c3..e7a9073 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_db_schema.h"
 #include "ctsvc_db_access_control.h"
 #include "ctsvc_notify.h"
 
-int ctsvc_db_image_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record, int start_count)
+int ctsvc_db_image_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record,
+               int start_count)
 {
        int ret;
        char *temp;
        ctsvc_image_s *image;
 
-       ret = contacts_record_create(_contacts_image._uri, (contacts_record_h *)&image);
+       ret = contacts_record_create(_contacts_image._uri, (contacts_record_h*)&image);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "contacts_record_create Fail(%d)", ret);
 
        image->id = ctsvc_stmt_get_int(stmt, start_count++);
@@ -85,14 +85,14 @@ int ctsvc_db_image_insert(contacts_record_h record, int contact_id, bool is_my_p
        cts_stmt stmt = NULL;
        char query[CTS_SQL_MAX_LEN] = {0};
        char image_path[CTSVC_IMG_FULL_PATH_SIZE_MAX] = {0};
-       ctsvc_image_s *image = (ctsvc_image_s *)record;
+       ctsvc_image_s *image = (ctsvc_image_s*)record;
 
        /* These check should be done in client side */
        RETV_IF(NULL == image->path, CONTACTS_ERROR_NONE);
        RETVM_IF(contact_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : contact_id(%d) is mandatory field to insert image record", image->contact_id);
+                       "contact_id(%d) is mandatory field to insert image record", image->contact_id);
        RETVM_IF(0 < image->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : id(%d), This record is already inserted", image->id);
+                       "id(%d), This record is already inserted", image->id);
 
        ret = ctsvc_have_file_read_permission(image->path);
        RETVM_IF(ret != CONTACTS_ERROR_NONE, ret, "ctsvc_have_file_read_permission fail(%d)", ret);
@@ -100,7 +100,7 @@ int ctsvc_db_image_insert(contacts_record_h record, int contact_id, bool is_my_p
        image_id = ctsvc_db_get_next_id(CTS_TABLE_DATA);
        ret = ctsvc_contact_add_image_file(contact_id, image_id, image->path, image_path, sizeof(image_path));
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_contact_add_image_file() Fail(%d)", ret);
+               ERR("ctsvc_contact_add_image_file() Fail(%d)", ret);
                return ret;
        }
        free(image->path);
@@ -112,13 +112,13 @@ int ctsvc_db_image_insert(contacts_record_h record, int contact_id, bool is_my_p
                        image_id, contact_id, is_my_profile, CTSVC_DATA_IMAGE, image->is_default, image->is_default, image->type);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        __ctsvc_image_bind_stmt(stmt, image, 1);
 
        ret = ctsvc_stmt_step(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                return ret;
        }
@@ -128,7 +128,7 @@ int ctsvc_db_image_insert(contacts_record_h record, int contact_id, bool is_my_p
                *id = image_id;
        ctsvc_stmt_finalize(stmt);
 
-       if (ctsvc_record_check_property_flag((ctsvc_record_s *)record, _contacts_image.is_default, CTSVC_PROPERTY_FLAG_DIRTY)) {
+       if (ctsvc_record_check_property_flag((ctsvc_record_s*)record, _contacts_image.is_default, CTSVC_PROPERTY_FLAG_DIRTY)) {
                if (image->is_default)
                        __ctsvc_db_image_reset_default(image_id, contact_id);
        }
@@ -143,7 +143,7 @@ int ctsvc_db_image_update(contacts_record_h record, int contact_id, bool is_my_p
 {
        int id;
        int ret = CONTACTS_ERROR_NONE;
-       charset = NULL;
+       char *set = NULL;
        GSList *bind_text = NULL;
        GSList *cursor = NULL;
        ctsvc_image_s *image = (ctsvc_image_s*)record;
@@ -157,12 +157,12 @@ int ctsvc_db_image_update(contacts_record_h record, int contact_id, bool is_my_p
        ret = ctsvc_query_get_first_int_result(query, &id);
        RETV_IF(ret != CONTACTS_ERROR_NONE, ret);
 
-       if (ctsvc_record_check_property_flag((ctsvc_record_s *)record, _contacts_image.path, CTSVC_PROPERTY_FLAG_DIRTY)) {
+       if (ctsvc_record_check_property_flag((ctsvc_record_s*)record, _contacts_image.path, CTSVC_PROPERTY_FLAG_DIRTY)) {
                char image_path[CTSVC_IMG_FULL_PATH_SIZE_MAX] = {0};
                if (image->path) {
                        ret = ctsvc_have_file_read_permission(image->path);
                        if (ret != CONTACTS_ERROR_NONE) {
-                               CTS_ERR("ctsvc_have_file_read_permission Fail(%d)", ret);
+                               ERR("ctsvc_have_file_read_permission Fail(%d)", ret);
                                return ret;
                        }
                }
@@ -176,7 +176,7 @@ int ctsvc_db_image_update(contacts_record_h record, int contact_id, bool is_my_p
                }
        }
 
-       if (ctsvc_record_check_property_flag((ctsvc_record_s *)record, _contacts_image.is_default, CTSVC_PROPERTY_FLAG_DIRTY)) {
+       if (ctsvc_record_check_property_flag((ctsvc_record_s*)record, _contacts_image.is_default, CTSVC_PROPERTY_FLAG_DIRTY)) {
                if (image->is_default)
                        __ctsvc_db_image_reset_default(image->id, contact_id);
        }
@@ -188,11 +188,14 @@ int ctsvc_db_image_update(contacts_record_h record, int contact_id, bool is_my_p
                        ctsvc_set_image_noti();
        } while (0);
 
-       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s *)record);
-       CONTACTS_FREE(set);
+       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s*)record);
+       free(set);
+
        if (bind_text) {
-               for (cursor=bind_text;cursor;cursor=cursor->next)
-                       CONTACTS_FREE(cursor->data);
+               for (cursor = bind_text; cursor; cursor = cursor->next) {
+                       free(cursor->data);
+                       cursor->data = NULL;
+               }
                g_slist_free(bind_text);
        }
        return ret;
@@ -219,10 +222,10 @@ int ctsvc_db_image_delete(int id, bool is_my_profile)
  * Whenever deleting image recode in data table, this funcion will be called
  * in order to delete the image file
  */
-void ctsvc_db_image_delete_callback(sqlite3_context *context, int argc, sqlite3_value ** argv)
+void ctsvc_db_image_delete_callback(sqlite3_context *context, int argc, sqlite3_value **argv)
 {
        int ret;
-       const unsigned charimage_path;
+       const unsigned char *image_path;
 
        if (1 < argc) {
                sqlite3_result_null(context);
@@ -231,8 +234,8 @@ void ctsvc_db_image_delete_callback(sqlite3_context *context, int argc, sqlite3_
        image_path = sqlite3_value_text(argv[0]);
 
        ret = ctsvc_contact_delete_image_file_with_path(image_path);
-       WARN_IF (CONTACTS_ERROR_NONE != ret && CONTACTS_ERROR_NO_DATA != ret,
-                       "ctsvc_contact_delete_image_file_with_path Fail(%d)", ret);
+       WARN_IF(CONTACTS_ERROR_NONE != ret && CONTACTS_ERROR_NO_DATA != ret,
+                       "ctsvc_contact_delete_image_file_with_path() Fail(%d)", ret);
 
        return;
 }
index 706d553..2c20242 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #ifndef __CTSVC_DB_PLUGIN_IMAGE_HELPER_H__
 #define __CTSVC_DB_PLUGIN_IMAGE_HELPER_H__
 
 #include "contacts.h"
 #include "ctsvc_db_sqlite.h"
 
-int ctsvc_db_image_insert(contacts_record_h record, int contact_id, bool is_my_profile, int *id);
+int ctsvc_db_image_insert(contacts_record_h record, int contact_id, bool is_my_profile,
+               int *id);
 int ctsvc_db_image_update(contacts_record_h record, int contact_id, bool is_my_profile);
 int ctsvc_db_image_delete(int id, bool is_my_profile);
-int ctsvc_db_image_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record, int start_count);
-void ctsvc_db_image_delete_callback(sqlite3_context *context, int argc, sqlite3_value ** argv);
+int ctsvc_db_image_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record,
+               int start_count);
+void ctsvc_db_image_delete_callback(sqlite3_context *context, int argc,
+               sqlite3_value **argv);
 
 #endif /* __CTSVC_DB_PLUGIN_RELATIONSHIP_HELPER_H__ */
index fa40178..7377e6d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
 #include "ctsvc_db_query.h"
 #include "ctsvc_list.h"
 
-static int __ctsvc_db_messenger_insert_record(contacts_record_h record, int *id);
-static int __ctsvc_db_messenger_get_record(int id, contacts_record_h* out_record);
-static int __ctsvc_db_messenger_update_record(contacts_record_h record);
-static int __ctsvc_db_messenger_delete_record(int id);
-static int __ctsvc_db_messenger_get_all_records(int offset, int limit, contacts_list_h* out_list);
-static int __ctsvc_db_messenger_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h* out_list);
-
-ctsvc_db_plugin_info_s ctsvc_db_plugin_messenger = {
-       .is_query_only = false,
-       .insert_record = __ctsvc_db_messenger_insert_record,
-       .get_record = __ctsvc_db_messenger_get_record,
-       .update_record = __ctsvc_db_messenger_update_record,
-       .delete_record = __ctsvc_db_messenger_delete_record,
-       .get_all_records = __ctsvc_db_messenger_get_all_records,
-       .get_records_with_query = __ctsvc_db_messenger_get_records_with_query,
-       .insert_records = NULL,
-       .update_records = NULL,
-       .delete_records = NULL,
-       .get_count = NULL,
-       .get_count_with_query = NULL,
-       .replace_record = NULL,
-       .replace_records = NULL,
-};
 
 static int __ctsvc_db_messenger_insert_record(contacts_record_h record, int *id)
 {
        int ret;
        int addressbook_id;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_messenger_s *messenger = (ctsvc_messenger_s *)record;
+       ctsvc_messenger_s *messenger = (ctsvc_messenger_s*)record;
 
-       RETVM_IF(NULL == messenger->im_id, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : messenger id is NULL");
+       RETV_IF(NULL == messenger->im_id, CONTACTS_ERROR_INVALID_PARAMETER);
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -76,31 +52,30 @@ static int __ctsvc_db_messenger_insert_record(contacts_record_h record, int *id)
        if (CONTACTS_ERROR_NONE != ret) {
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NO_DATA == ret) {
-                       CTS_ERR("No data : contact_id (%d) is not exist", messenger->contact_id);
+                       ERR("No data : contact_id (%d) is not exist", messenger->contact_id);
                        return CONTACTS_ERROR_INVALID_PARAMETER;
-               }
-               else {
-                       CTS_ERR("ctsvc_query_get_first_int_result Fail(%d)", ret);
+               } else {
+                       ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                        return ret;
                }
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this messenger record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this messenger record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_messenger_insert(record, messenger->contact_id, false, id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_db_contact_update_changed_time(messenger->contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -108,14 +83,14 @@ static int __ctsvc_db_messenger_insert_record(contacts_record_h record, int *id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
-static int __ctsvc_db_messenger_get_record(int id, contacts_record_hout_record)
+static int __ctsvc_db_messenger_get_record(int id, contacts_record_h *out_record)
 {
        int ret;
        cts_stmt stmt = NULL;
@@ -126,17 +101,17 @@ static int __ctsvc_db_messenger_get_record(int id, contacts_record_h* out_record
 
        snprintf(query, sizeof(query),
                        "SELECT id, data.contact_id, is_default, data1, data2, data3 "
-                               "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                               "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                               "WHERE id = %d AND datatype = %d ",
-                               id, CTSVC_DATA_MESSENGER);
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE id = %d AND datatype = %d ",
+                       id, CTSVC_DATA_MESSENGER);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/ != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
@@ -156,12 +131,12 @@ static int __ctsvc_db_messenger_update_record(contacts_record_h record)
        int ret;
        int addressbook_id;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_messenger_s *messenger = (ctsvc_messenger_s *)record;
+       ctsvc_messenger_s *messenger = (ctsvc_messenger_s*)record;
        RETVM_IF(NULL == messenger->im_id, CONTACTS_ERROR_INVALID_PARAMETER, "im_id is empty");
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -169,27 +144,27 @@ static int __ctsvc_db_messenger_update_record(contacts_record_h record)
                        "SELECT addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", messenger->contact_id);
        ret = ctsvc_query_get_first_int_result(query, &addressbook_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("No data : contact_id (%d) is not exist", messenger->contact_id);
+               ERR("No data : contact_id (%d) is not exist", messenger->contact_id);
                ctsvc_end_trans(false);
                return ret;
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this messenger record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this messenger record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_messenger_update(record, false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("Update record Fail(%d)", ret);
+               ERR("Update record Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_db_contact_update_changed_time(messenger->contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -197,11 +172,11 @@ static int __ctsvc_db_messenger_update_record(contacts_record_h record)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
 static int __ctsvc_db_messenger_delete_record(int id)
@@ -214,22 +189,22 @@ static int __ctsvc_db_messenger_delete_record(int id)
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
        snprintf(query, sizeof(query),
                        "SELECT contact_id, addressbook_id FROM "CTSVC_DB_VIEW_CONTACT " "
-                               "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id);
+                       "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id);
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare Fail(%d)", ret);
+               ERR("ctsvc_query_prepare Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
        ret = ctsvc_stmt_step(stmt);
        if (1 != ret) {
-               CTS_ERR("The id(%d) is Invalid(%d)", id, ret);
+               ERR("The id(%d) is Invalid(%d)", id, ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NONE == ret)
@@ -243,21 +218,21 @@ static int __ctsvc_db_messenger_delete_record(int id)
        ctsvc_stmt_finalize(stmt);
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to delete this messenger record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to delete this messenger record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_messenger_delete(id, false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_db_contact_update_changed_time(contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -265,14 +240,14 @@ static int __ctsvc_db_messenger_delete_record(int id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
-static int __ctsvc_db_messenger_get_all_records(int offset, int limit, contacts_list_hout_list)
+static int __ctsvc_db_messenger_get_all_records(int offset, int limit, contacts_list_h *out_list)
 {
        int len;
        int ret;
@@ -283,10 +258,10 @@ static int __ctsvc_db_messenger_get_all_records(int offset, int limit, contacts_
 
        len = snprintf(query, sizeof(query),
                        "SELECT id, data.contact_id, is_default, data1, data2, data3 "
-                               "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                               "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                               "WHERE datatype = %d AND is_my_profile=0 ",
-                               CTSVC_DATA_MESSENGER);
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE datatype = %d AND is_my_profile=0 ",
+                       CTSVC_DATA_MESSENGER);
 
        if (0 != limit) {
                len += snprintf(query+len, sizeof(query)-len, " LIMIT %d", limit);
@@ -295,12 +270,12 @@ static int __ctsvc_db_messenger_get_all_records(int offset, int limit, contacts_
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                if (1 /*CTS_TRUE */ != ret) {
-                       CTS_ERR("DB : ctsvc_stmt_step fail(%d)", ret);
+                       ERR("DB : ctsvc_stmt_step fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -316,7 +291,7 @@ static int __ctsvc_db_messenger_get_all_records(int offset, int limit, contacts_
 }
 
 static int __ctsvc_db_messenger_get_records_with_query(contacts_query_h query, int offset,
-               int limit, contacts_list_hout_list)
+               int limit, contacts_list_h *out_list)
 {
        int ret;
        int i;
@@ -327,7 +302,7 @@ static int __ctsvc_db_messenger_get_records_with_query(contacts_query_h query, i
        ctsvc_messenger_s *messenger;
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        ret = ctsvc_db_make_get_records_query_stmt(s_query, offset, limit, &stmt);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_db_make_get_records_query_stmt fail(%d)", ret);
@@ -336,7 +311,7 @@ static int __ctsvc_db_messenger_get_records_with_query(contacts_query_h query, i
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 /*CTS_TRUE */ != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -344,9 +319,9 @@ static int __ctsvc_db_messenger_get_records_with_query(contacts_query_h query, i
 
                contacts_record_create(_contacts_messenger._uri, &record);
                messenger = (ctsvc_messenger_s*)record;
-               if (0 == s_query->projection_count)
+               if (0 == s_query->projection_count) {
                        field_count = s_query->property_count;
-               else {
+               else {
                        field_count = s_query->projection_count;
                        ret = ctsvc_record_set_projection_flags(record, s_query->projection,
                                        s_query->projection_count, s_query->property_count);
@@ -355,7 +330,7 @@ static int __ctsvc_db_messenger_get_records_with_query(contacts_query_h query, i
                                ASSERT_NOT_REACHED("To set projection is Fail.\n");
                }
 
-               for (i=0;i<field_count;i++) {
+               for (i = 0; i < field_count; i++) {
                        char *temp;
                        int property_id;
                        if (0 == s_query->projection_count)
@@ -363,7 +338,7 @@ static int __ctsvc_db_messenger_get_records_with_query(contacts_query_h query, i
                        else
                                property_id = s_query->projection[i];
 
-                       switch(property_id) {
+                       switch (property_id) {
                        case CTSVC_PROPERTY_MESSENGER_ID:
                                messenger->id = ctsvc_stmt_get_int(stmt, i);
                                break;
@@ -396,3 +371,20 @@ static int __ctsvc_db_messenger_get_records_with_query(contacts_query_h query, i
        return CONTACTS_ERROR_NONE;
 }
 
+ctsvc_db_plugin_info_s ctsvc_db_plugin_messenger = {
+       .is_query_only = false,
+       .insert_record = __ctsvc_db_messenger_insert_record,
+       .get_record = __ctsvc_db_messenger_get_record,
+       .update_record = __ctsvc_db_messenger_update_record,
+       .delete_record = __ctsvc_db_messenger_delete_record,
+       .get_all_records = __ctsvc_db_messenger_get_all_records,
+       .get_records_with_query = __ctsvc_db_messenger_get_records_with_query,
+       .insert_records = NULL,
+       .update_records = NULL,
+       .delete_records = NULL,
+       .get_count = NULL,
+       .get_count_with_query = NULL,
+       .replace_record = NULL,
+       .replace_records = NULL,
+};
+
index 24fa5ec..4966521 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -33,7 +33,7 @@ int ctsvc_db_messenger_get_value_from_stmt(cts_stmt stmt, contacts_record_h *rec
        char *temp;
        ctsvc_messenger_s *messenger;
 
-       ret = contacts_record_create(_contacts_messenger._uri, (contacts_record_h *)&messenger);
+       ret = contacts_record_create(_contacts_messenger._uri, (contacts_record_h*)&messenger);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "contacts_record_create Fail(%d)", ret);
 
        messenger->id = ctsvc_stmt_get_int(stmt, start_count++);
@@ -53,38 +53,38 @@ int ctsvc_db_messenger_insert(contacts_record_h record, int contact_id, bool is_
 {
        int ret;
        cts_stmt stmt = NULL;
-       ctsvc_messenger_s *messenger =(ctsvc_messenger_s*)record;
+       ctsvc_messenger_s *messenger = (ctsvc_messenger_s*)record;
        char query[CTS_SQL_MAX_LEN] = {0};
 
        RETV_IF(NULL == messenger->im_id, CONTACTS_ERROR_NONE);
        RETVM_IF(contact_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : contact_id(%d) is mandatory field to insert messenger record ", messenger->contact_id);
+                       "contact_id(%d) is mandatory field to insert messenger record ", messenger->contact_id);
        RETVM_IF(0 < messenger->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : id(%d), This record is already inserted", messenger->id);
+                       "id(%d), This record is already inserted", messenger->id);
 
        snprintf(query, sizeof(query),
-               "INSERT INTO "CTS_TABLE_DATA"(contact_id, is_my_profile, datatype, data1, data2, data3) "
-                                       "VALUES(%d, %d, %d, %d, ?, ?)",
+                       "INSERT INTO "CTS_TABLE_DATA"(contact_id, is_my_profile, datatype, data1, data2, data3) "
+                       "VALUES(%d, %d, %d, %d, ?, ?)",
                        contact_id, is_my_profile, CTSVC_DATA_MESSENGER, messenger->type);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        if (messenger->label)
                sqlite3_bind_text(stmt, 1, messenger->label,
-                       strlen(messenger->label), SQLITE_STATIC);
+                               strlen(messenger->label), SQLITE_STATIC);
        if (messenger->im_id)
                sqlite3_bind_text(stmt, 2, messenger->im_id,
                                strlen(messenger->im_id), SQLITE_STATIC);
 
        ret = ctsvc_stmt_step(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                return ret;
        }
 
-       //messenger->id = ctsvc_db_get_last_insert_id();
+       /* messenger->id = ctsvc_db_get_last_insert_id(); */
        if (id)
                *id = ctsvc_db_get_last_insert_id();
        ctsvc_stmt_finalize(stmt);
@@ -99,7 +99,7 @@ int ctsvc_db_messenger_update(contacts_record_h record, bool is_my_profile)
 {
        int id;
        int ret = CONTACTS_ERROR_NONE;
-       charset = NULL;
+       char *set = NULL;
        GSList *bind_text = NULL;
        GSList *cursor = NULL;
        ctsvc_messenger_s *messenger = (ctsvc_messenger_s*)record;
@@ -120,11 +120,14 @@ int ctsvc_db_messenger_update(contacts_record_h record, bool is_my_profile)
                        ctsvc_set_messenger_noti();
        } while (0);
 
-       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s *)record);
-       CONTACTS_FREE(set);
+       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s*)record);
+       free(set);
+
        if (bind_text) {
-               for (cursor=bind_text;cursor;cursor=cursor->next)
-                       CONTACTS_FREE(cursor->data);
+               for (cursor = bind_text; cursor; cursor = cursor->next) {
+                       free(cursor->data);
+                       cursor->data = NULL;
+               }
                g_slist_free(bind_text);
        }
 
index d70c828..27f840d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #ifndef __CTSVC_DB_PLUGIN_MESSENGER_HELPER_H__
 #define __CTSVC_DB_PLUGIN_MESSENGER_HELPER_H__
 
 #include "contacts.h"
 #include "ctsvc_db_sqlite.h"
 
-int ctsvc_db_messenger_insert(contacts_record_h record, int contact_id, bool is_my_profile, int *id);
+int ctsvc_db_messenger_insert(contacts_record_h record, int contact_id,
+               bool is_my_profile, int *id);
 int ctsvc_db_messenger_update(contacts_record_h record, bool is_my_profile);
 int ctsvc_db_messenger_delete(int id, bool is_my_profile);
-int ctsvc_db_messenger_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record, int start_count);
+int ctsvc_db_messenger_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record,
+               int start_count);
 
 #endif /* __CTSVC_DB_PLUGIN_MESSENGER_HELPER_H__ */
index c638970..564a667 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
 
 #define CTSVC_MY_PROFILE_DISPLAY_NAME_MAX_LEN 1024
 
-static int __ctsvc_db_my_profile_insert_record(contacts_record_h record, int *id);
-static int __ctsvc_db_my_profile_get_record(int id, contacts_record_h* out_record);
-static int __ctsvc_db_my_profile_update_record(contacts_record_h record);
-static int __ctsvc_db_my_profile_delete_record(int id);
-
-static int __ctsvc_db_my_profile_get_all_records(int offset, int limit, contacts_list_h* out_list);
-static int __ctsvc_db_my_profile_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h* out_list);
-
-ctsvc_db_plugin_info_s ctsvc_db_plugin_my_profile = {
-       .is_query_only = false,
-       .insert_record = __ctsvc_db_my_profile_insert_record,
-       .get_record = __ctsvc_db_my_profile_get_record,
-       .update_record = __ctsvc_db_my_profile_update_record,
-       .delete_record = __ctsvc_db_my_profile_delete_record,
-       .get_all_records = __ctsvc_db_my_profile_get_all_records,
-       .get_records_with_query = __ctsvc_db_my_profile_get_records_with_query,
-       .insert_records = NULL,
-       .update_records = NULL,
-       .delete_records = NULL,
-       .get_count = NULL,
-       .get_count_with_query = NULL,
-       .replace_record = NULL,
-       .replace_records = NULL,
-};
 
 static int __ctsvc_db_get_my_profile_base_info(int id, ctsvc_my_profile_s *my_profile)
 {
@@ -78,15 +54,15 @@ static int __ctsvc_db_get_my_profile_base_info(int id, ctsvc_my_profile_s *my_pr
 
        snprintf(query, sizeof(query),
                        "SELECT my_profile_id, addressbook_id, changed_time, %s, image_thumbnail_path, uid "
-                               "FROM "CTS_TABLE_MY_PROFILES" WHERE my_profile_id = %d AND deleted = 0",
-                               ctsvc_get_display_column(), id);
+                       "FROM "CTS_TABLE_MY_PROFILES" WHERE my_profile_id = %d AND deleted = 0",
+                       ctsvc_get_display_column(), id);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/ != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
@@ -120,16 +96,16 @@ static int __ctsvc_db_my_profile_get_data(int id, ctsvc_my_profile_s *my_profile
        char query[CTS_SQL_MAX_LEN] = {0};
 
        snprintf(query, sizeof(query),
-                               "SELECT datatype, id, contact_id, is_default, data1, data2, "
-                                       "data3, data4, data5, data6, data7, data8, data9, data10, data11, data12 "
-                                       "FROM "CTS_TABLE_DATA" WHERE contact_id = %d AND is_my_profile = 1", id);
+                       "SELECT datatype, id, contact_id, is_default, data1, data2, "
+                       "data3, data4, data5, data6, data7, data8, data9, data10, data11, data12 "
+                       "FROM "CTS_TABLE_DATA" WHERE contact_id = %d AND is_my_profile = 1", id);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE */!= ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                return ret;
        }
@@ -180,7 +156,7 @@ static int __ctsvc_db_my_profile_get_data(int id, ctsvc_my_profile_s *my_profile
                        ctsvc_get_data_info_extension(stmt, (contacts_list_h)my_profile->extensions);
                        break;
                default:
-                       CTS_ERR("Intenal : Not supported data type (%d)", datatype);
+                       ERR("Intenal : Not supported data type (%d)", datatype);
                        break;
                }
 
@@ -192,7 +168,7 @@ static int __ctsvc_db_my_profile_get_data(int id, ctsvc_my_profile_s *my_profile
 
 }
 
-static int __ctsvc_db_my_profile_get_record(int id, contacts_record_hout_record)
+static int __ctsvc_db_my_profile_get_record(int id, contacts_record_h *out_record)
 {
        int ret;
        contacts_record_h record;
@@ -202,17 +178,17 @@ static int __ctsvc_db_my_profile_get_record(int id, contacts_record_h* out_recor
        *out_record = NULL;
 
        contacts_record_create(_contacts_my_profile._uri, &record);
-       my_profile = (ctsvc_my_profile_s *)record;
+       my_profile = (ctsvc_my_profile_s*)record;
        ret = __ctsvc_db_get_my_profile_base_info(id, my_profile);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("cts_get_main_contacts_info(ALL) Fail(%d)", ret);
+               ERR("cts_get_main_contacts_info(ALL) Fail(%d)", ret);
                contacts_record_destroy(record, true);
                return ret;
        }
 
        ret = __ctsvc_db_my_profile_get_data(id, my_profile);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("__ctsvc_db_my_profile_get_data Fail(%d)", ret);
+               ERR("__ctsvc_db_my_profile_get_data Fail(%d)", ret);
                contacts_record_destroy(record, true);
                return ret;
        }
@@ -230,28 +206,28 @@ static int __ctsvc_db_my_profile_delete_record(int id)
        char query[CTS_SQL_MAX_LEN] = {0};
 
        ret = ctsvc_begin_trans();
-       RETVM_IF(ret, ret, "DB error : ctsvc_begin_trans() Fail(%d)", ret);
+       RETVM_IF(ret, ret, "ctsvc_begin_trans() Fail(%d)", ret);
 
        snprintf(query, sizeof(query),
-               "SELECT addressbook_id FROM "CTSVC_DB_VIEW_MY_PROFILE" WHERE my_profile_id = %d", id);
+                       "SELECT addressbook_id FROM "CTSVC_DB_VIEW_MY_PROFILE" WHERE my_profile_id = %d", id);
        ret  = ctsvc_query_get_first_int_result(query, &addressbook_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_get_first_int_result Fail(%d)", ret);
+               ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to delete this contact");
+               ERR("Does not have permission to delete this contact");
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        snprintf(query, sizeof(query), "UPDATE "CTS_TABLE_MY_PROFILES" "
-                                       "SET deleted = 1, changed_ver = %d WHERE my_profile_id = %d", ctsvc_get_next_ver(), id);
+                       "SET deleted = 1, changed_ver = %d WHERE my_profile_id = %d", ctsvc_get_next_ver(), id);
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -260,11 +236,11 @@ static int __ctsvc_db_my_profile_delete_record(int id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
 static inline int __ctsvc_my_profile_update_data(ctsvc_my_profile_s *my_profile)
@@ -274,7 +250,7 @@ static inline int __ctsvc_my_profile_update_data(ctsvc_my_profile_s *my_profile)
        if (my_profile->name) {
                ret = ctsvc_contact_update_data_name((contacts_list_h)my_profile->name, my_profile->id, true);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_update_data_name() Fail(%d)", ret);
+                       ERR("ctsvc_contact_update_data_name() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -282,7 +258,7 @@ static inline int __ctsvc_my_profile_update_data(ctsvc_my_profile_s *my_profile)
        if (my_profile->company) {
                ret = ctsvc_contact_update_data_company((contacts_list_h)my_profile->company, my_profile->id, true);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_update_data_company() Fail(%d)", ret);
+                       ERR("ctsvc_contact_update_data_company() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -290,7 +266,7 @@ static inline int __ctsvc_my_profile_update_data(ctsvc_my_profile_s *my_profile)
        if (my_profile->note) {
                ret = ctsvc_contact_update_data_note((contacts_list_h)my_profile->note, my_profile->id, true);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_update_data_note() Fail(%d)", ret);
+                       ERR("ctsvc_contact_update_data_note() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -298,7 +274,7 @@ static inline int __ctsvc_my_profile_update_data(ctsvc_my_profile_s *my_profile)
        if (my_profile->events) {
                ret = ctsvc_contact_update_data_event((contacts_list_h)my_profile->events, my_profile->id, true);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_update_data_events() Fail(%d)", ret);
+                       ERR("ctsvc_contact_update_data_events() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -306,7 +282,7 @@ static inline int __ctsvc_my_profile_update_data(ctsvc_my_profile_s *my_profile)
        if (my_profile->messengers) {
                ret = ctsvc_contact_update_data_messenger((contacts_list_h)my_profile->messengers, my_profile->id, true);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_update_data_messengers() Fail(%d)", ret);
+                       ERR("ctsvc_contact_update_data_messengers() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -314,7 +290,7 @@ static inline int __ctsvc_my_profile_update_data(ctsvc_my_profile_s *my_profile)
        if (my_profile->postal_addrs) {
                ret = ctsvc_contact_update_data_address((contacts_list_h)my_profile->postal_addrs, my_profile->id, true);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_update_data_address() Fail(%d)", ret);
+                       ERR("ctsvc_contact_update_data_address() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -322,7 +298,7 @@ static inline int __ctsvc_my_profile_update_data(ctsvc_my_profile_s *my_profile)
        if (my_profile->urls) {
                ret = ctsvc_contact_update_data_url((contacts_list_h)my_profile->urls, my_profile->id, true);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_update_data_url() Fail(%d)", ret);
+                       ERR("ctsvc_contact_update_data_url() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -330,7 +306,7 @@ static inline int __ctsvc_my_profile_update_data(ctsvc_my_profile_s *my_profile)
        if (my_profile->nicknames) {
                ret = ctsvc_contact_update_data_nickname((contacts_list_h)my_profile->nicknames, my_profile->id, true);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_update_data_nickname() Fail(%d)", ret);
+                       ERR("ctsvc_contact_update_data_nickname() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -339,7 +315,7 @@ static inline int __ctsvc_my_profile_update_data(ctsvc_my_profile_s *my_profile)
                bool had_phonenumber;
                ret = ctsvc_contact_update_data_number((contacts_list_h)my_profile->numbers, my_profile->id, true, &had_phonenumber);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_update_data_number() Fail(%d)", ret);
+                       ERR("ctsvc_contact_update_data_number() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -348,7 +324,7 @@ static inline int __ctsvc_my_profile_update_data(ctsvc_my_profile_s *my_profile)
                bool had_email;
                ret = ctsvc_contact_update_data_email((contacts_list_h)my_profile->emails, my_profile->id, true, &had_email);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_update_data_email() Fail(%d)", ret);
+                       ERR("ctsvc_contact_update_data_email() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -356,7 +332,7 @@ static inline int __ctsvc_my_profile_update_data(ctsvc_my_profile_s *my_profile)
        if (my_profile->profiles) {
                ret = ctsvc_contact_update_data_profile((contacts_list_h)my_profile->profiles, my_profile->id, true);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_update_data_profile() Fail(%d)", ret);
+                       ERR("ctsvc_contact_update_data_profile() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -364,7 +340,7 @@ static inline int __ctsvc_my_profile_update_data(ctsvc_my_profile_s *my_profile)
        if (my_profile->relationships) {
                ret = ctsvc_contact_update_data_relationship((contacts_list_h)my_profile->relationships, my_profile->id, true);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_update_data_relationship() Fail(%d)", ret);
+                       ERR("ctsvc_contact_update_data_relationship() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -372,7 +348,7 @@ static inline int __ctsvc_my_profile_update_data(ctsvc_my_profile_s *my_profile)
        if (my_profile->images) {
                ret = ctsvc_contact_update_data_image((contacts_list_h)my_profile->images, my_profile->id, true);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_update_data_image() Fail(%d)", ret);
+                       ERR("ctsvc_contact_update_data_image() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -380,7 +356,7 @@ static inline int __ctsvc_my_profile_update_data(ctsvc_my_profile_s *my_profile)
        if (my_profile->extensions) {
                ret = ctsvc_contact_update_data_extension((contacts_list_h)my_profile->extensions, my_profile->id, true);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_update_data_extension() Fail(%d)", ret);
+                       ERR("ctsvc_contact_update_data_extension() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -406,11 +382,13 @@ 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 && my_profile->name->records->data) {
-               name = (ctsvc_name_s *)my_profile->name->records->data;
+       if (0 < my_profile->name->count && my_profile->name->records
+                       && my_profile->name->records->data) {
+               name = (ctsvc_name_s*)my_profile->name->records->data;
        }
 
-       if (name && (name->first || name->last  || name->prefix || name->addition || name->suffix)) {
+       if (name && (name->first || name->last  || name->prefix || name->addition
+                               || name->suffix)) {
                char *display = NULL;
                int len, display_len;
                int reverse_lang_type = -1;
@@ -426,43 +404,40 @@ static void __ctsvc_make_my_profile_display_name(ctsvc_my_profile_s *my_profile)
                 *    But, if there is only prefix, reverse sort_name is prefix
                 */
                temp_display_len = SAFE_STRLEN(name->first)
-                                               + SAFE_STRLEN(name->addition)
-                                               + SAFE_STRLEN(name->last)
-                                               + SAFE_STRLEN(name->suffix);
+                       + SAFE_STRLEN(name->addition)
+                       + SAFE_STRLEN(name->last)
+                       + SAFE_STRLEN(name->suffix);
                if (0 < temp_display_len) {
                        temp_display_len += 7;
                        temp_display = calloc(1, temp_display_len);
                        if (NULL == temp_display) {
-                               CTS_ERR("calloc() Fail");
+                               ERR("calloc() Fail");
                                return;
                        }
-                       len=0;
+                       len = 0;
 
                        if (name->last) {
-                               len += snprintf(temp_display + len, temp_display_len - len, "%s", name->last);
+                               len += snprintf(temp_display + len, temp_display_len - len, "%s",
+                                               name->last);
 
-                               if (reverse_lang_type < 0) {
+                               if (reverse_lang_type < 0)
                                        reverse_lang_type = ctsvc_check_language_type(temp_display);
-                               }
 
                                if (reverse_lang_type != CTSVC_LANG_KOREAN &&
-                                       reverse_lang_type != CTSVC_LANG_CHINESE &&
-                                       reverse_lang_type != CTSVC_LANG_JAPANESE) {
+                                               reverse_lang_type != CTSVC_LANG_CHINESE &&
+                                               reverse_lang_type != CTSVC_LANG_JAPANESE) {
                                        if (name->first || name->addition)
                                                len += snprintf(temp_display + len, temp_display_len - len, ",");
                                }
                        }
 
                        if (reverse_lang_type < 0) {
-                               if (*temp_display) {
+                               if (*temp_display)
                                        reverse_lang_type = ctsvc_check_language_type(temp_display);
-                               }
-                               else if (name->first) {
+                               else if (name->first)
                                        reverse_lang_type = ctsvc_check_language_type(name->first);
-                               }
-                               else if (name->addition) {
+                               else if (name->addition)
                                        reverse_lang_type = ctsvc_check_language_type(name->addition);
-                               }
                        }
 
                        if (reverse_lang_type == CTSVC_LANG_JAPANESE) {
@@ -478,13 +453,11 @@ static void __ctsvc_make_my_profile_display_name(ctsvc_my_profile_s *my_profile)
                                                len += snprintf(temp_display + len, temp_display_len - len, " ");
                                        len += snprintf(temp_display + len, temp_display_len - len, "%s", name->first);
                                }
-                       }
-                       else {
+                       } else {
                                if (name->first) {
                                        if (*temp_display) {
-                                               if (reverse_lang_type < 0) {
+                                               if (reverse_lang_type < 0)
                                                        reverse_lang_type = ctsvc_check_language_type(temp_display);
-                                               }
 
                                                if (reverse_lang_type != CTSVC_LANG_KOREAN &&
                                                                reverse_lang_type != CTSVC_LANG_CHINESE)
@@ -495,9 +468,8 @@ static void __ctsvc_make_my_profile_display_name(ctsvc_my_profile_s *my_profile)
 
                                if (name->addition) {
                                        if (*temp_display) {
-                                               if (reverse_lang_type < 0) {
+                                               if (reverse_lang_type < 0)
                                                        reverse_lang_type = ctsvc_check_language_type(temp_display);
-                                               }
 
                                                if (reverse_lang_type != CTSVC_LANG_KOREAN &&
                                                                reverse_lang_type != CTSVC_LANG_CHINESE)
@@ -509,15 +481,15 @@ static void __ctsvc_make_my_profile_display_name(ctsvc_my_profile_s *my_profile)
 
                        if (name->suffix) {
                                if (*temp_display) {
-                                       if (reverse_lang_type < 0) {
+                                       if (reverse_lang_type < 0)
                                                reverse_lang_type = ctsvc_check_language_type(temp_display);
-                                       }
 
-                                       if (reverse_lang_type == CTSVC_LANG_JAPANESE)
+                                       if (reverse_lang_type == CTSVC_LANG_JAPANESE) {
                                                len += snprintf(temp_display + len, temp_display_len - len, " ");
-                                       else if (reverse_lang_type != CTSVC_LANG_KOREAN &&
-                                                                       reverse_lang_type != CTSVC_LANG_CHINESE)
+                                       else if (reverse_lang_type != CTSVC_LANG_KOREAN &&
+                                                       reverse_lang_type != CTSVC_LANG_CHINESE) {
                                                len += snprintf(temp_display + len, temp_display_len - len, ", ");
+                                       }
                                }
                                len += snprintf(temp_display + len, temp_display_len - len, "%s", name->suffix);
                        }
@@ -527,18 +499,16 @@ static void __ctsvc_make_my_profile_display_name(ctsvc_my_profile_s *my_profile)
                        display_len = SAFE_STRLEN(name->prefix) + temp_display_len + 2;
                        display = calloc(1, display_len);
                        if (NULL == display) {
-                               CTS_ERR("calloc() Fail");
+                               ERR("calloc() Fail");
                                free(temp_display);
                                return;
                        }
                        snprintf(display, display_len, "%s %s", name->prefix, temp_display);
                        my_profile->reverse_display_name = display;
                        free(temp_display);
-               }
-               else if (temp_display) {
+               } else if (temp_display) {
                        my_profile->reverse_display_name = temp_display;
-               }
-               else if (name->prefix) {
+               } else if (name->prefix) {
                        my_profile->reverse_display_name = strdup(name->prefix);
                }
 
@@ -551,21 +521,21 @@ static void __ctsvc_make_my_profile_display_name(ctsvc_my_profile_s *my_profile)
                 *    But, if there is only prefix, sort_name is prefix
                 */
                if (reverse_lang_type == CTSVC_LANG_KOREAN ||
-                       reverse_lang_type == CTSVC_LANG_CHINESE)
+                               reverse_lang_type == CTSVC_LANG_CHINESE) {
                        my_profile->display_name = SAFE_STRDUP(my_profile->reverse_display_name);
-               else {
+               else {
                        int lang_type = -1;
                        temp_display = NULL;
                        temp_display_len = SAFE_STRLEN(name->first)
-                                                               + SAFE_STRLEN(name->addition)
-                                                               + SAFE_STRLEN(name->last)
-                                                               + SAFE_STRLEN(name->suffix);
+                               + SAFE_STRLEN(name->addition)
+                               + SAFE_STRLEN(name->last)
+                               + SAFE_STRLEN(name->suffix);
                        if (0 < temp_display_len) {
                                temp_display_len += 6;
                                /* make reverse_temp_display_name */
                                temp_display = calloc(1, temp_display_len);
                                if (NULL == temp_display) {
-                                       CTS_ERR("calloc() Fail");
+                                       ERR("calloc() Fail");
                                        return;
                                }
                                len = 0;
@@ -604,43 +574,42 @@ static void __ctsvc_make_my_profile_display_name(ctsvc_my_profile_s *my_profile)
                                display_len = SAFE_STRLEN(name->prefix) + temp_display_len + 2;
                                display = calloc(1, display_len);
                                if (NULL == display) {
-                                       CTS_ERR("calloc() Fail");
+                                       ERR("calloc() Fail");
                                        free(temp_display);
                                        return;
                                }
                                snprintf(display, display_len, "%s %s", name->prefix, temp_display);
                                my_profile->display_name = display;
                                free(temp_display);
-                       }
-                       else if (temp_display) {
+                       } else if (temp_display) {
                                my_profile->display_name = temp_display;
-                       }
-                       else if (name->prefix) {
+                       } else if (name->prefix) {
                                my_profile->display_name = strdup(name->prefix);
                        }
                }
 
-               ctsvc_record_set_property_flag((ctsvc_record_s *)my_profile, _contacts_my_profile.display_name, CTSVC_PROPERTY_FLAG_DIRTY);
-       }
-       else {
+               ctsvc_record_set_property_flag((ctsvc_record_s*)my_profile,
+                               _contacts_my_profile.display_name, CTSVC_PROPERTY_FLAG_DIRTY);
+       else {
                GList *cur;
                if (my_profile->company && my_profile->company->records) {
-                       for (cur=my_profile->company->records;cur;cur=cur->next) {
-                               ctsvc_company_s *company = (ctsvc_company_s *)cur->data;
+                       for (cur = my_profile->company->records; cur; cur = cur->next) {
+                               ctsvc_company_s *company = cur->data;
                                if (company && company->name) {
-                                       ctsvc_record_set_property_flag((ctsvc_record_s *)my_profile, _contacts_my_profile.display_name, CTSVC_PROPERTY_FLAG_DIRTY);
+                                       ctsvc_record_set_property_flag((ctsvc_record_s*)my_profile,
+                                                       _contacts_my_profile.display_name, CTSVC_PROPERTY_FLAG_DIRTY);
                                        my_profile->display_name = SAFE_STRDUP(company->name);
                                        break;
                                }
                        }
                }
 
-               if (false == 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;
+                       for (cur = my_profile->nicknames->records; cur; cur = cur->next) {
+                               ctsvc_nickname_s *nickname = cur->data;
                                if (nickname && nickname->nickname) {
-                                       ctsvc_record_set_property_flag((ctsvc_record_s *)my_profile, _contacts_my_profile.display_name, CTSVC_PROPERTY_FLAG_DIRTY);
+                                       ctsvc_record_set_property_flag((ctsvc_record_s*)my_profile, _contacts_my_profile.display_name, CTSVC_PROPERTY_FLAG_DIRTY);
                                        free(my_profile->display_name);
                                        my_profile->display_name = SAFE_STRDUP(nickname->nickname);
                                        break;
@@ -648,12 +617,12 @@ static void __ctsvc_make_my_profile_display_name(ctsvc_my_profile_s *my_profile)
                        }
                }
 
-               if (false == 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;
+                       for (cur = my_profile->numbers->records; cur; cur = cur->next) {
+                               ctsvc_number_s *number = cur->data;
                                if (number && number->number) {
-                                       ctsvc_record_set_property_flag((ctsvc_record_s *)my_profile, _contacts_my_profile.display_name, CTSVC_PROPERTY_FLAG_DIRTY);
+                                       ctsvc_record_set_property_flag((ctsvc_record_s*)my_profile, _contacts_my_profile.display_name, CTSVC_PROPERTY_FLAG_DIRTY);
                                        free(my_profile->display_name);
                                        my_profile->display_name = SAFE_STRDUP(number->number);
                                        break;
@@ -661,12 +630,12 @@ static void __ctsvc_make_my_profile_display_name(ctsvc_my_profile_s *my_profile)
                        }
                }
 
-               if (false == 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;
+                       for (cur = my_profile->emails->records; cur; cur = cur->next) {
+                               ctsvc_email_s *email = cur->data;
                                if (email && email->email_addr) {
-                                       ctsvc_record_set_property_flag((ctsvc_record_s *)my_profile, _contacts_my_profile.display_name, CTSVC_PROPERTY_FLAG_DIRTY);
+                                       ctsvc_record_set_property_flag((ctsvc_record_s*)my_profile, _contacts_my_profile.display_name, CTSVC_PROPERTY_FLAG_DIRTY);
                                        free(my_profile->display_name);
                                        my_profile->display_name = SAFE_STRDUP(email->email_addr);
                                        break;
@@ -674,12 +643,11 @@ 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 (ctsvc_record_check_property_flag((ctsvc_record_s*)my_profile, _contacts_my_profile.display_name, CTSVC_PROPERTY_FLAG_DIRTY)) {
                        my_profile->reverse_display_name = SAFE_STRDUP(my_profile->display_name);
-               }
-               else {
+               } else {
                        /* Update as NULL */
-                       ctsvc_record_set_property_flag((ctsvc_record_s *)my_profile, _contacts_my_profile.display_name, CTSVC_PROPERTY_FLAG_DIRTY);
+                       ctsvc_record_set_property_flag((ctsvc_record_s*)my_profile, _contacts_my_profile.display_name, CTSVC_PROPERTY_FLAG_DIRTY);
                }
        }
        return;
@@ -700,17 +668,17 @@ static int __ctsvc_db_my_profile_update_record(contacts_record_h record)
        RETVM_IF(ret, ret, "ctsvc_begin_trans() Fail(%d)", ret);
 
        snprintf(query, sizeof(query),
-               "SELECT my_profile_id FROM "CTSVC_DB_VIEW_MY_PROFILE" WHERE my_profile_id = %d", my_profile->id);
+                       "SELECT my_profile_id FROM "CTSVC_DB_VIEW_MY_PROFILE" WHERE my_profile_id = %d", my_profile->id);
        ret = ctsvc_query_get_first_int_result(query, &id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("The index(%d) is Invalid. %d Record(s) is(are) found", my_profile->id, ret);
+               ERR("The index(%d) is Invalid. %d Record(s) is(are) found", my_profile->id, ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        if (false == ctsvc_have_ab_write_permission(my_profile->addressbook_id)) {
-               CTS_ERR("ctsvc_have_ab_write_permission fail : does not have permission(addressbook_id : %d)",
-                                       my_profile->addressbook_id);
+               ERR("ctsvc_have_ab_write_permission Fail: does not have permission(addressbook_id : %d)",
+                               my_profile->addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
@@ -721,7 +689,7 @@ static int __ctsvc_db_my_profile_update_record(contacts_record_h record)
        /* update data */
        ret = __ctsvc_my_profile_update_data(my_profile);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("__ctsvc_my_profile_update_data() Fail(%d)", ret);
+               ERR("__ctsvc_my_profile_update_data() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -738,7 +706,7 @@ static int __ctsvc_db_my_profile_update_record(contacts_record_h record)
                        do {
                                ret = contacts_list_get_current_record_p((contacts_list_h)my_profile->images, (contacts_record_h*)&image);
                                if (CONTACTS_ERROR_NONE != ret) {
-                                       CTS_ERR("contacts_list_get_current_record_p() Fail(%d)", ret);
+                                       ERR("contacts_list_get_current_record_p() Fail(%d)", ret);
                                        ctsvc_end_trans(false);
                                        return CONTACTS_ERROR_DB;
                                }
@@ -750,18 +718,17 @@ static int __ctsvc_db_my_profile_update_record(contacts_record_h record)
                        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);
+                               ctsvc_record_set_property_flag((ctsvc_record_s*)my_profile, _contacts_my_profile.image_thumbnail_path, CTSVC_PROPERTY_FLAG_DIRTY);
 
                                if (ctsvc_contact_check_image_location(image->path))
                                        my_profile->image_thumbnail_path = SAFE_STRDUP(image->path + strlen(CTSVC_CONTACT_IMG_FULL_LOCATION) + 1);
                                else
                                        my_profile->image_thumbnail_path = SAFE_STRDUP(image->path);
                        }
-               }
-               else if (my_profile->image_thumbnail_path) {
+               } else if (my_profile->image_thumbnail_path) {
                        free(my_profile->image_thumbnail_path);
                        my_profile->image_thumbnail_path = NULL;
-                       ctsvc_record_set_property_flag((ctsvc_record_s *)my_profile, _contacts_my_profile.image_thumbnail_path, CTSVC_PROPERTY_FLAG_DIRTY);
+                       ctsvc_record_set_property_flag((ctsvc_record_s*)my_profile, _contacts_my_profile.image_thumbnail_path, CTSVC_PROPERTY_FLAG_DIRTY);
                }
        }
 
@@ -781,7 +748,7 @@ static int __ctsvc_db_my_profile_update_record(contacts_record_h record)
                        len = snprintf(query_set, sizeof(query_set), "%s, ", set);
                len += snprintf(query_set+len, sizeof(query_set)-len, " changed_ver=%d, changed_time=%d", version, (int)time(NULL));
 
-               if (ctsvc_record_check_property_flag((ctsvc_record_s *)my_profile, _contacts_my_profile.display_name, CTSVC_PROPERTY_FLAG_DIRTY)) {
+               if (ctsvc_record_check_property_flag((ctsvc_record_s*)my_profile, _contacts_my_profile.display_name, CTSVC_PROPERTY_FLAG_DIRTY)) {
                        len += snprintf(query_set+len, sizeof(query_set)-len,
                                        ", display_name=?, reverse_display_name=?");
                        bind_text = g_slist_append(bind_text, strdup(SAFE_STR(my_profile->display_name)));
@@ -792,13 +759,13 @@ static int __ctsvc_db_my_profile_update_record(contacts_record_h record)
 
                ret = ctsvc_query_prepare(query, &stmt);
                if (NULL == stmt) {
-                       CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+                       ERR("ctsvc_query_prepare() Fail(%d)", ret);
                        break;
                }
 
                if (bind_text) {
                        int i = 0;
-                       for (cursor=bind_text,i=1;cursor;cursor=cursor->next,i++) {
+                       for (cursor = bind_text, i = 1; cursor; cursor = cursor->next, i++) {
                                const char *text = cursor->data;
                                if (*text)
                                        ctsvc_stmt_bind_text(stmt, i, text);
@@ -807,30 +774,33 @@ static int __ctsvc_db_my_profile_update_record(contacts_record_h record)
 
                ret = ctsvc_stmt_step(stmt);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        break;
                }
                ctsvc_stmt_finalize(stmt);
        } while (0);
 
-       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s *)record);
-       CONTACTS_FREE(set);
+       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s*)record);
+       free(set);
+
        if (bind_text) {
-               for (cursor=bind_text;cursor;cursor=cursor->next)
-                       CONTACTS_FREE(cursor->data);
+               for (cursor = bind_text; cursor; cursor = cursor->next) {
+                       free(cursor->data);
+                       cursor->data = NULL;
+               }
                g_slist_free(bind_text);
        }
 
        ctsvc_set_my_profile_noti();
 
        ret = ctsvc_end_trans(true);
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "DB error : ctsvc_end_trans() Fail(%d)", ret);
+       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "ctsvc_end_trans() Fail(%d)", ret);
 
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_my_profile_get_all_records(int offset, int limit, contacts_list_hout_list)
+static int __ctsvc_db_my_profile_get_all_records(int offset, int limit, contacts_list_h *out_list)
 {
        int ret;
        int len;
@@ -849,13 +819,13 @@ static int __ctsvc_db_my_profile_get_all_records(int offset, int limit, contacts
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -863,7 +833,7 @@ static int __ctsvc_db_my_profile_get_all_records(int offset, int limit, contacts
                my_profile_id = ctsvc_stmt_get_int(stmt, 0);
                ret = ctsvc_db_get_record(_contacts_my_profile._uri, my_profile_id, &record);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("DB error : contacts_db_get_record() Fail(%d)", ret);
+                       ERR("contacts_db_get_record() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -877,7 +847,7 @@ static int __ctsvc_db_my_profile_get_all_records(int offset, int limit, contacts
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_my_profile_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_hout_list)
+static int __ctsvc_db_my_profile_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h *out_list)
 {
        int ret;
        int i;
@@ -891,17 +861,16 @@ static int __ctsvc_db_my_profile_get_records_with_query(contacts_query_h query,
        int my_profile_id = 0;
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        if (s_query->projection) {
-               for (i=0;i<s_query->projection_count;i++) {
+               for (i = 0; i < s_query->projection_count; i++) {
                        if (s_query->projection[i] == CTSVC_PROPERTY_MY_PROFILE_ID) {
                                had_my_profile_id = true;
                                break;
                        }
                }
-       }
-       else {
+       } else {
                s_query->projection_count = 0;
                had_my_profile_id = true;
        }
@@ -909,7 +878,7 @@ static int __ctsvc_db_my_profile_get_records_with_query(contacts_query_h query,
        if (false == had_my_profile_id) {
                s_query->projection = realloc(s_query->projection, s_query->projection_count+1);
                if (NULL == s_query->projection) {
-                       CTS_ERR("realloc() Fail");
+                       ERR("realloc() Fail");
                        return CONTACTS_ERROR_OUT_OF_MEMORY;
                }
                s_query->projection[s_query->projection_count] = CTSVC_PROPERTY_MY_PROFILE_ID;
@@ -923,7 +892,7 @@ static int __ctsvc_db_my_profile_get_records_with_query(contacts_query_h query,
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -931,9 +900,9 @@ static int __ctsvc_db_my_profile_get_records_with_query(contacts_query_h query,
 
                contacts_record_create(_contacts_my_profile._uri, &record);
                my_profile = (ctsvc_my_profile_s*)record;
-               if (0 == s_query->projection_count)
+               if (0 == s_query->projection_count) {
                        field_count = s_query->property_count;
-               else {
+               else {
                        field_count = s_query->projection_count;
                        ret = ctsvc_record_set_projection_flags(record, s_query->projection,
                                        s_query->projection_count, s_query->property_count);
@@ -942,7 +911,7 @@ static int __ctsvc_db_my_profile_get_records_with_query(contacts_query_h query,
                                ASSERT_NOT_REACHED("To set projection is Fail.\n");
                }
 
-               for (i=0;i<field_count;i++) {
+               for (i = 0; i < field_count; i++) {
                        char *temp;
                        int property_id;
                        if (0 == s_query->projection_count)
@@ -950,7 +919,7 @@ static int __ctsvc_db_my_profile_get_records_with_query(contacts_query_h query,
                        else
                                property_id = s_query->projection[i];
 
-                       switch(property_id) {
+                       switch (property_id) {
                        case CTSVC_PROPERTY_MY_PROFILE_ID:
                                my_profile_id = ctsvc_stmt_get_int(stmt, i);
                                if (had_my_profile_id)
@@ -986,7 +955,7 @@ static int __ctsvc_db_my_profile_get_records_with_query(contacts_query_h query,
                }
                ret = __ctsvc_db_my_profile_get_data(my_profile_id, my_profile);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("__ctsvc_db_my_profile_get_data Fail(%d)", ret);
+                       ERR("__ctsvc_db_my_profile_get_data Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -1010,7 +979,7 @@ static int __ctsvc_my_profile_insert_data(ctsvc_my_profile_s *contact)
        if (contact->name) {
                ret = ctsvc_contact_insert_data_name((contacts_list_h)contact->name, contact->id, true);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_insert_data_name() Fail(%d)", ret);
+                       ERR("ctsvc_contact_insert_data_name() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -1019,7 +988,7 @@ static int __ctsvc_my_profile_insert_data(ctsvc_my_profile_s *contact)
        if (contact->company) {
                ret = ctsvc_contact_insert_data_company((contacts_list_h)contact->company, contact->id, true);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_insert_my_profile_data_company() Fail(%d)", ret);
+                       ERR("ctsvc_insert_my_profile_data_company() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -1028,7 +997,7 @@ static int __ctsvc_my_profile_insert_data(ctsvc_my_profile_s *contact)
        if (contact->events) {
                ret = ctsvc_contact_insert_data_event((contacts_list_h)contact->events, contact->id, true);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_insert_my_profile_data_event() Fail(%d)", ret);
+                       ERR("ctsvc_insert_my_profile_data_event() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -1037,7 +1006,7 @@ static int __ctsvc_my_profile_insert_data(ctsvc_my_profile_s *contact)
        if (contact->messengers) {
                ret = ctsvc_contact_insert_data_messenger((contacts_list_h)contact->messengers, contact->id, true);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_insert_my_profile_data_messenger() Fail(%d)", ret);
+                       ERR("ctsvc_insert_my_profile_data_messenger() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -1046,7 +1015,7 @@ static int __ctsvc_my_profile_insert_data(ctsvc_my_profile_s *contact)
        if (contact->postal_addrs) {
                ret = ctsvc_contact_insert_data_address((contacts_list_h)contact->postal_addrs, contact->id, true);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_insert_my_profile_data_postal() Fail(%d)", ret);
+                       ERR("ctsvc_insert_my_profile_data_postal() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -1055,7 +1024,7 @@ static int __ctsvc_my_profile_insert_data(ctsvc_my_profile_s *contact)
        if (contact->urls) {
                ret = ctsvc_contact_insert_data_url((contacts_list_h)contact->urls, contact->id, true);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_insert_my_profile_data_web() Fail(%d)", ret);
+                       ERR("ctsvc_insert_my_profile_data_web() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -1064,7 +1033,7 @@ static int __ctsvc_my_profile_insert_data(ctsvc_my_profile_s *contact)
        if (contact->nicknames) {
                ret = ctsvc_contact_insert_data_nickname((contacts_list_h)contact->nicknames, contact->id, true);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_insert_my_profile_data_nickname() Fail(%d)", ret);
+                       ERR("ctsvc_insert_my_profile_data_nickname() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -1073,7 +1042,7 @@ static int __ctsvc_my_profile_insert_data(ctsvc_my_profile_s *contact)
        if (contact->numbers) {
                ret = ctsvc_contact_insert_data_number((contacts_list_h)contact->numbers, contact->id, true);
                if (ret < CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_contact_insert_data_number() Fail(%d)", ret);
+                       ERR("ctsvc_contact_insert_data_number() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -1082,7 +1051,7 @@ static int __ctsvc_my_profile_insert_data(ctsvc_my_profile_s *contact)
        if (contact->emails) {
                ret = ctsvc_contact_insert_data_email((contacts_list_h)contact->emails, contact->id, true);
                if (ret < CONTACTS_ERROR_NONE) {
-                       CTS_ERR("ctsvc_insert_my_profile_data_email() Fail(%d)", ret);
+                       ERR("ctsvc_insert_my_profile_data_email() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -1091,7 +1060,7 @@ static int __ctsvc_my_profile_insert_data(ctsvc_my_profile_s *contact)
        if (contact->profiles) {
                ret = ctsvc_contact_insert_data_profile((contacts_list_h)contact->profiles, contact->id, true);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_insert_my_profile_data_profile() Fail(%d)", ret);
+                       ERR("ctsvc_insert_my_profile_data_profile() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -1100,7 +1069,7 @@ static int __ctsvc_my_profile_insert_data(ctsvc_my_profile_s *contact)
        if (contact->relationships) {
                ret = ctsvc_contact_insert_data_relationship((contacts_list_h)contact->relationships, contact->id, true);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_insert_data_relationship() Fail(%d)", ret);
+                       ERR("ctsvc_contact_insert_data_relationship() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -1109,7 +1078,7 @@ static int __ctsvc_my_profile_insert_data(ctsvc_my_profile_s *contact)
        if (contact->images) {
                ret = ctsvc_contact_insert_data_image((contacts_list_h)contact->images, contact->id, true);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_insert_data_image() Fail(%d)", ret);
+                       ERR("ctsvc_contact_insert_data_image() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -1118,7 +1087,7 @@ static int __ctsvc_my_profile_insert_data(ctsvc_my_profile_s *contact)
        if (contact->note) {
                ret = ctsvc_contact_insert_data_note((contacts_list_h)contact->note, contact->id, true);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_insert_data_note() Fail(%d)", ret);
+                       ERR("ctsvc_contact_insert_data_note() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -1127,7 +1096,7 @@ static int __ctsvc_my_profile_insert_data(ctsvc_my_profile_s *contact)
        if (contact->extensions) {
                ret = ctsvc_contact_insert_data_extension((contacts_list_h)contact->extensions, contact->id, true);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_contact_insert_data_extension() Fail(%d)", ret);
+                       ERR("ctsvc_contact_insert_data_extension() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -1146,19 +1115,18 @@ static int __ctsvc_db_my_profile_insert_record(contacts_record_h record, int *id
        cts_stmt stmt;
 
        /* These check should be done in client side */
-       RETVM_IF(NULL == my_profile, CONTACTS_ERROR_INVALID_PARAMETER,
-                                       "Invalid parameter : my_profile is NULL");
+       RETV_IF(NULL == my_profile, CONTACTS_ERROR_INVALID_PARAMETER);
        RETVM_IF(my_profile->addressbook_id < 0, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : addressbook_id(%d) is mandatory field to insert my_profile record ", my_profile->addressbook_id);
+                       "addressbook_id(%d) is mandatory field to insert my_profile record ", my_profile->addressbook_id);
        RETVM_IF(0 < my_profile->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : id(%d), This record is already inserted", my_profile->id);
+                       "id(%d), This record is already inserted", my_profile->id);
 
        ret = ctsvc_begin_trans();
        RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "ctsvc_begin_trans() Fail(%d)", ret);
 
        if (false == ctsvc_have_ab_write_permission(my_profile->addressbook_id)) {
-               CTS_ERR("ctsvc_have_ab_write_permission fail : does not have permission(addressbook_id : %d)",
-                                       my_profile->addressbook_id);
+               ERR("ctsvc_have_ab_write_permission Fail: does not have permission(addressbook_id : %d)",
+                               my_profile->addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
@@ -1169,7 +1137,7 @@ static int __ctsvc_db_my_profile_insert_record(contacts_record_h record, int *id
 
        ret = ctsvc_db_get_next_id(CTS_TABLE_MY_PROFILES);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_db_get_next_id() Fail(%d)", ret);
+               ERR("ctsvc_db_get_next_id() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -1183,7 +1151,7 @@ static int __ctsvc_db_my_profile_insert_record(contacts_record_h record, int *id
        /* Insert Data */
        ret = __ctsvc_my_profile_insert_data(my_profile);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("cts_insert_my_profile_data() Fail(%d)", ret);
+               ERR("cts_insert_my_profile_data() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -1201,7 +1169,7 @@ static int __ctsvc_db_my_profile_insert_record(contacts_record_h record, int *id
                        do {
                                ret = contacts_list_get_current_record_p((contacts_list_h)my_profile->images, (contacts_record_h*)&image);
                                if (CONTACTS_ERROR_NONE != ret) {
-                                       CTS_ERR("contacts_list_get_current_record_p() Fail(%d)", ret);
+                                       ERR("contacts_list_get_current_record_p() Fail(%d)", ret);
                                        ctsvc_end_trans(false);
                                        return CONTACTS_ERROR_DB;
                                }
@@ -1217,7 +1185,7 @@ static int __ctsvc_db_my_profile_insert_record(contacts_record_h record, int *id
        version = ctsvc_get_next_ver();
 
        snprintf(query, sizeof(query),
-               "INSERT INTO "CTS_TABLE_MY_PROFILES"(my_profile_id, addressbook_id, "
+                       "INSERT INTO "CTS_TABLE_MY_PROFILES"(my_profile_id, addressbook_id, "
                        "created_ver, changed_ver, changed_time, "
                        "display_name, reverse_display_name, uid, image_thumbnail_path) "
                        "VALUES(%d, %d, %d, %d, %d, ?, ?, ?, ?)",
@@ -1225,7 +1193,7 @@ static int __ctsvc_db_my_profile_insert_record(contacts_record_h record, int *id
 
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -1241,7 +1209,7 @@ static int __ctsvc_db_my_profile_insert_record(contacts_record_h record, int *id
 
        ret = ctsvc_stmt_step(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                return ret;
@@ -1256,3 +1224,20 @@ static int __ctsvc_db_my_profile_insert_record(contacts_record_h record, int *id
        return CONTACTS_ERROR_NONE;
 }
 
+ctsvc_db_plugin_info_s ctsvc_db_plugin_my_profile = {
+       .is_query_only = false,
+       .insert_record = __ctsvc_db_my_profile_insert_record,
+       .get_record = __ctsvc_db_my_profile_get_record,
+       .update_record = __ctsvc_db_my_profile_update_record,
+       .delete_record = __ctsvc_db_my_profile_delete_record,
+       .get_all_records = __ctsvc_db_my_profile_get_all_records,
+       .get_records_with_query = __ctsvc_db_my_profile_get_records_with_query,
+       .insert_records = NULL,
+       .update_records = NULL,
+       .delete_records = NULL,
+       .get_count = NULL,
+       .get_count_with_query = NULL,
+       .replace_record = NULL,
+       .replace_records = NULL,
+};
+
index 6bb2729..b11bada 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_db_schema.h"
 #include "ctsvc_list.h"
 #include "ctsvc_notification.h"
 
-static int __ctsvc_db_name_insert_record(contacts_record_h record, int *id);
-static int __ctsvc_db_name_get_record(int id, contacts_record_h* out_record);
-static int __ctsvc_db_name_update_record(contacts_record_h record);
-static int __ctsvc_db_name_delete_record(int id);
-static int __ctsvc_db_name_get_all_records(int offset, int limit, contacts_list_h* out_list);
-static int __ctsvc_db_name_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h* out_list);
-
-ctsvc_db_plugin_info_s ctsvc_db_plugin_name = {
-       .is_query_only = false,
-       .insert_record = __ctsvc_db_name_insert_record,
-       .get_record = __ctsvc_db_name_get_record,
-       .update_record = __ctsvc_db_name_update_record,
-       .delete_record = __ctsvc_db_name_delete_record,
-       .get_all_records = __ctsvc_db_name_get_all_records,
-       .get_records_with_query = __ctsvc_db_name_get_records_with_query,
-       .insert_records = NULL,
-       .update_records = NULL,
-       .delete_records = NULL,
-       .get_count = NULL,
-       .get_count_with_query = NULL,
-       .replace_record = NULL,
-       .replace_records = NULL,
-};
 
 static int __ctsvc_db_name_insert_record(contacts_record_h record, int *id)
 {
@@ -62,11 +38,11 @@ static int __ctsvc_db_name_insert_record(contacts_record_h record, int *id)
        int name_id = 0;
        int addressbook_id;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_name_s *name = (ctsvc_name_s *)record;
+       ctsvc_name_s *name = (ctsvc_name_s*)record;
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -76,17 +52,16 @@ static int __ctsvc_db_name_insert_record(contacts_record_h record, int *id)
        if (CONTACTS_ERROR_NONE != ret) {
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NO_DATA == ret) {
-                       CTS_ERR("No data : contact_id (%d) is not exist", name->contact_id);
+                       ERR("No data : contact_id (%d) is not exist", name->contact_id);
                        return CONTACTS_ERROR_INVALID_PARAMETER;
-               }
-               else {
-                       CTS_ERR("ctsvc_query_get_first_int_result Fail(%d)", ret);
+               } else {
+                       ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                        return ret;
                }
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this name record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this name record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
@@ -95,14 +70,14 @@ static int __ctsvc_db_name_insert_record(contacts_record_h record, int *id)
                        "SELECT id FROM "CTS_TABLE_DATA" WHERE contact_id = %d AND datatype=%d", name->contact_id, CTSVC_DATA_NAME);
        ret = ctsvc_query_get_first_int_result(query, &name_id);
        if (name_id) {
-               CTS_ERR("name_id (%d) is exist", name_id);
+               ERR("name_id (%d) is exist", name_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
        ret = ctsvc_db_name_insert(record, name->contact_id, false, id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -111,7 +86,7 @@ static int __ctsvc_db_name_insert_record(contacts_record_h record, int *id)
 
        ret = ctsvc_db_contact_update_changed_time(name->contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -119,14 +94,14 @@ static int __ctsvc_db_name_insert_record(contacts_record_h record, int *id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
-static int __ctsvc_db_name_get_record(int id, contacts_record_hout_record)
+static int __ctsvc_db_name_get_record(int id, contacts_record_h *out_record)
 {
        int ret;
        cts_stmt stmt = NULL;
@@ -137,18 +112,18 @@ static int __ctsvc_db_name_get_record(int id, contacts_record_h* out_record)
 
        snprintf(query, sizeof(query),
                        "SELECT id, data.contact_id, is_default, data1, data2, "
-                               "data3, data4, data5, data6, data7, data8, data9, data10, data11, data12 "
-                               "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                               "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                               "WHERE id = %d AND datatype = %d ",
-                               id, CTSVC_DATA_NAME);
+                       "data3, data4, data5, data6, data7, data8, data9, data10, data11, data12 "
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE id = %d AND datatype = %d ",
+                       id, CTSVC_DATA_NAME);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/ != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
@@ -167,7 +142,7 @@ static int __ctsvc_db_name_update_record(contacts_record_h record)
        int ret;
        int addressbook_id;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_name_s *name = (ctsvc_name_s *)record;
+       ctsvc_name_s *name = (ctsvc_name_s*)record;
 
        RETVM_IF(NULL == name->first && NULL == name->last && NULL == name->addition &&
                        NULL == name->prefix && NULL == name->suffix && NULL == name->phonetic_first &&
@@ -175,7 +150,7 @@ static int __ctsvc_db_name_update_record(contacts_record_h record)
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -183,20 +158,20 @@ static int __ctsvc_db_name_update_record(contacts_record_h record)
                        "SELECT addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", name->contact_id);
        ret = ctsvc_query_get_first_int_result(query, &addressbook_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("No data : contact_id (%d) is not exist", name->contact_id);
+               ERR("No data : contact_id (%d) is not exist", name->contact_id);
                ctsvc_end_trans(false);
                return ret;
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this name record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this name record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_name_update(record, false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -205,7 +180,7 @@ static int __ctsvc_db_name_update_record(contacts_record_h record)
 
        ret = ctsvc_db_contact_update_changed_time(name->contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -213,11 +188,11 @@ static int __ctsvc_db_name_update_record(contacts_record_h record)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
 
@@ -231,7 +206,7 @@ static int __ctsvc_db_name_delete_record(int id)
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -240,13 +215,13 @@ static int __ctsvc_db_name_delete_record(int id)
                        "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id);
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare Fail(%d)", ret);
+               ERR("ctsvc_query_prepare Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
        ret = ctsvc_stmt_step(stmt);
        if (1 != ret) {
-               CTS_ERR("The id(%d) is Invalid(%d)", id, ret);
+               ERR("The id(%d) is Invalid(%d)", id, ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NONE == ret)
@@ -260,14 +235,14 @@ static int __ctsvc_db_name_delete_record(int id)
        ctsvc_stmt_finalize(stmt);
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to delete this name record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to delete this name record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_name_delete(id, false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -276,7 +251,7 @@ static int __ctsvc_db_name_delete_record(int id)
 
        ret = ctsvc_db_contact_update_changed_time(contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -284,14 +259,14 @@ static int __ctsvc_db_name_delete_record(int id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
-static int __ctsvc_db_name_get_all_records(int offset, int limit, contacts_list_hout_list)
+static int __ctsvc_db_name_get_all_records(int offset, int limit, contacts_list_h *out_list)
 {
        int len;
        int ret;
@@ -302,11 +277,11 @@ static int __ctsvc_db_name_get_all_records(int offset, int limit, contacts_list_
 
        len = snprintf(query, sizeof(query),
                        "SELECT id, data.contact_id, is_default, data1, data2, "
-                               "data3, data4, data5, data6, data7, data8, data9, data10, data11, data12 "
-                               "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                               "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                               "WHERE datatype = %d AND is_my_profile=0 ",
-                               CTSVC_DATA_NAME);
+                       "data3, data4, data5, data6, data7, data8, data9, data10, data11, data12 "
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE datatype = %d AND is_my_profile=0 ",
+                       CTSVC_DATA_NAME);
 
        if (0 != limit) {
                len += snprintf(query+len, sizeof(query)-len, " LIMIT %d", limit);
@@ -315,12 +290,12 @@ static int __ctsvc_db_name_get_all_records(int offset, int limit, contacts_list_
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error :         ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "   ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -337,7 +312,7 @@ static int __ctsvc_db_name_get_all_records(int offset, int limit, contacts_list_
 }
 
 static int __ctsvc_db_name_get_records_with_query(contacts_query_h query, int offset,
-               int limit, contacts_list_hout_list)
+               int limit, contacts_list_h *out_list)
 {
        int ret;
        int i;
@@ -348,7 +323,7 @@ static int __ctsvc_db_name_get_records_with_query(contacts_query_h query, int of
        ctsvc_name_s *name;
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        ret = ctsvc_db_make_get_records_query_stmt(s_query, offset, limit, &stmt);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_db_make_get_records_query_stmt fail(%d)", ret);
@@ -357,7 +332,7 @@ static int __ctsvc_db_name_get_records_with_query(contacts_query_h query, int of
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -365,9 +340,9 @@ static int __ctsvc_db_name_get_records_with_query(contacts_query_h query, int of
 
                contacts_record_create(_contacts_name._uri, &record);
                name = (ctsvc_name_s*)record;
-               if (0 == s_query->projection_count)
+               if (0 == s_query->projection_count) {
                        field_count = s_query->property_count;
-               else {
+               else {
                        field_count = s_query->projection_count;
                        ret = ctsvc_record_set_projection_flags(record, s_query->projection,
                                        s_query->projection_count, s_query->property_count);
@@ -376,7 +351,7 @@ static int __ctsvc_db_name_get_records_with_query(contacts_query_h query, int of
                                ASSERT_NOT_REACHED("To set projection is Fail.\n");
                }
 
-               for (i=0;i<field_count;i++) {
+               for (i = 0; i < field_count; i++) {
                        char *temp;
                        int property_id;
                        if (0 == s_query->projection_count)
@@ -384,7 +359,7 @@ static int __ctsvc_db_name_get_records_with_query(contacts_query_h query, int of
                        else
                                property_id = s_query->projection[i];
 
-                       switch(property_id) {
+                       switch (property_id) {
                        case CTSVC_PROPERTY_NAME_ID:
                                name->id = ctsvc_stmt_get_int(stmt, i);
                                break;
@@ -443,3 +418,21 @@ static int __ctsvc_db_name_get_records_with_query(contacts_query_h query, int of
        *out_list = list;
        return CONTACTS_ERROR_NONE;
 }
+
+ctsvc_db_plugin_info_s ctsvc_db_plugin_name = {
+       .is_query_only = false,
+       .insert_record = __ctsvc_db_name_insert_record,
+       .get_record = __ctsvc_db_name_get_record,
+       .update_record = __ctsvc_db_name_update_record,
+       .delete_record = __ctsvc_db_name_delete_record,
+       .get_all_records = __ctsvc_db_name_get_all_records,
+       .get_records_with_query = __ctsvc_db_name_get_records_with_query,
+       .insert_records = NULL,
+       .update_records = NULL,
+       .delete_records = NULL,
+       .get_count = NULL,
+       .get_count_with_query = NULL,
+       .replace_record = NULL,
+       .replace_records = NULL,
+};
+
index bb6be67..90235df 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_db_schema.h"
@@ -30,7 +29,7 @@
 #include "ctsvc_server_setting.h"
 #include "ctsvc_notification.h"
 
-enum{
+enum {
        CTSVC_NN_FIRST,
        CTSVC_NN_LAST,
        CTSVC_NN_MAX,
@@ -39,24 +38,23 @@ 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 && NULL == name_last)
+       if (name_first && NULL == name_last) {
                *name_lookup = SAFE_STRDUP(name_first);
-       else if (NULL == name_first && name_last)
+       } else if (NULL == name_first && name_last) {
                *name_lookup = SAFE_STRDUP(name_last);
-       else {
+       else {
                if (CONTACTS_NAME_DISPLAY_ORDER_FIRSTLAST == op_code) {
                        *name_lookup = calloc(1, SAFE_STRLEN(name_first) + SAFE_STRLEN(name_last) + 3);
                        if (NULL == *name_lookup) {
-                               CTS_ERR("calloc() Fail");
+                               ERR("calloc() Fail");
                                return;
                        }
                        snprintf(*name_lookup, SAFE_STRLEN(name_first) + SAFE_STRLEN(name_last) + 3, "%s %c%s",
                                        SAFE_STR(name_first), 0x7E, SAFE_STR(name_last));
-               }
-               else {
+               } else {
                        *name_lookup = calloc(1, SAFE_STRLEN(name_first) + SAFE_STRLEN(name_last) + 5);
                        if (NULL == *name_lookup) {
-                               CTS_ERR("calloc() Fail");
+                               ERR("calloc() Fail");
                                return;
                        }
                        snprintf(*name_lookup, SAFE_STRLEN(name_first) + SAFE_STRLEN(name_last) + 5, "%s,%c %c%s",
@@ -127,8 +125,8 @@ int ctsvc_db_name_insert(contacts_record_h record, int contact_id, bool is_my_pr
        int ret, len = 0;
        cts_stmt stmt = NULL;
        ctsvc_name_s *name = (ctsvc_name_s*)record;
-       char query[CTS_SQL_MAX_LEN]={0};
-       char *normal_name[CTSVC_NN_MAX]={NULL}; /* insert name search info */
+       char query[CTS_SQL_MAX_LEN] = {0};
+       char *normal_name[CTSVC_NN_MAX] = {NULL}; /* insert name search info */
        char *temp_normal_first = NULL;
        char *temp_normal_last = NULL;
        int len_normal_first = 0;
@@ -137,35 +135,35 @@ int ctsvc_db_name_insert(contacts_record_h record, int contact_id, bool is_my_pr
        RETV_IF(NULL == name, CONTACTS_ERROR_INVALID_PARAMETER);
 
        RETVM_IF(contact_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : contact_id(%d) is mandatory field to insert name record ", name->contact_id);
+                       "contact_id(%d) is mandatory field to insert name record ", name->contact_id);
        RETVM_IF(0 < name->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : id(%d), This record is already inserted", name->id);
+                       "id(%d), This record is already inserted", name->id);
 
        if (name->first || name->last || name->addition || name->prefix || name->suffix
-               || name->phonetic_first || name->phonetic_middle || name->phonetic_last) {
+                       || name->phonetic_first || name->phonetic_middle || name->phonetic_last) {
                /*
                 * If name record already exists, delete current name record
                 * If user update record with out-of-date record, name record can be two
                 */
                snprintf(query, sizeof(query),
                                "DELETE FROM "CTS_TABLE_DATA" "
-                                               "WHERE contact_id = %d AND datatype=%d "
-                                                                       "AND is_my_profile = %d",
-                                               contact_id, CTSVC_DATA_NAME, is_my_profile);
+                               "WHERE contact_id = %d AND datatype=%d "
+                               "AND is_my_profile = %d",
+                               contact_id, CTSVC_DATA_NAME, is_my_profile);
                ret = ctsvc_query_exec(query);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_query_exec Faild(%d)", ret);
+                       ERR("ctsvc_query_exec() Faild(%d)", ret);
                        return ret;
                }
 
                snprintf(query, sizeof(query),
-                       "INSERT INTO "CTS_TABLE_DATA"(contact_id, is_my_profile, datatype, is_default, data1, data2, data3, "
-                                               "data4, data5, data6, data7, data8, data9, data10, data11, data12) "
-                                               "VALUES(%d, %d, %d, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
+                               "INSERT INTO "CTS_TABLE_DATA"(contact_id, is_my_profile, datatype, is_default, data1, data2, data3, "
+                               "data4, data5, data6, data7, data8, data9, data10, data11, data12) "
+                               "VALUES(%d, %d, %d, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
                                contact_id, is_my_profile, CTSVC_DATA_NAME);
 
                ret = ctsvc_query_prepare(query, &stmt);
-               RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
                ret = __ctsvc_normalize_name(name, normal_name);
                WARN_IF(ret < CONTACTS_ERROR_NONE, "__ctsvc_normalize_name() Fail(%d)", ret);
@@ -177,11 +175,11 @@ int ctsvc_db_name_insert(contacts_record_h record, int contact_id, bool is_my_pr
                        temp_normal_first = calloc(1, len_normal_first + len_normal_last + 1);
                        if (normal_name[CTSVC_NN_LAST]) {
                                len = snprintf(temp_normal_first, len_normal_first + len_normal_last + 1,
-                                       "%s", normal_name[CTSVC_NN_LAST]);
+                                               "%s", normal_name[CTSVC_NN_LAST]);
                        }
                        if (normal_name[CTSVC_NN_FIRST]) {
                                snprintf(temp_normal_first+len, len_normal_first + len_normal_last + 1 - len,
-                                       "%s", normal_name[CTSVC_NN_FIRST]);
+                                               "%s", normal_name[CTSVC_NN_FIRST]);
                        }
                        temp_normal_last = NULL;
                        break;
@@ -206,10 +204,10 @@ int ctsvc_db_name_insert(contacts_record_h record, int contact_id, bool is_my_pr
 
 
                __ctsvc_make_name_lookup(CONTACTS_NAME_DISPLAY_ORDER_FIRSTLAST,
-                                                                       temp_normal_first, temp_normal_last, &name->lookup);
+                               temp_normal_first, temp_normal_last, &name->lookup);
 
                __ctsvc_make_name_lookup(CONTACTS_NAME_DISPLAY_ORDER_LASTFIRST,
-                                                                       temp_normal_first, temp_normal_last, &name->reverse_lookup);
+                               temp_normal_first, temp_normal_last, &name->reverse_lookup);
 
                free(temp_normal_first);
                free(temp_normal_last);
@@ -220,7 +218,7 @@ int ctsvc_db_name_insert(contacts_record_h record, int contact_id, bool is_my_pr
 
                ret = ctsvc_stmt_step(stmt);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        return ret;
                }
@@ -246,7 +244,7 @@ int ctsvc_db_name_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record,
        char *temp;
        ctsvc_name_s *name;
 
-       ret = contacts_record_create(_contacts_name._uri, (contacts_record_h *)&name);
+       ret = contacts_record_create(_contacts_name._uri, (contacts_record_h*)&name);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "contacts_record_create Fail(%d)", ret);
 
        name->id = ctsvc_stmt_get_int(stmt, start_count++);
@@ -281,9 +279,9 @@ int ctsvc_db_name_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record,
 
 int ctsvc_db_name_update(contacts_record_h record, bool is_my_profile)
 {
-       int ret, len=0;
+       int ret, len = 0;
        int id;
-       charset = NULL;
+       char *set = NULL;
        GSList *cursor = NULL;
        GSList *bind_text = NULL;
        ctsvc_name_s *name = (ctsvc_name_s*)record;
@@ -306,7 +304,7 @@ int ctsvc_db_name_update(contacts_record_h record, bool is_my_profile)
 
        ret = __ctsvc_normalize_name(name, normal_name);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("cts_normalize_name() Fail(%d)", ret);
+               ERR("cts_normalize_name() Fail(%d)", ret);
                return ret;
        }
 
@@ -315,11 +313,11 @@ int ctsvc_db_name_update(contacts_record_h record, bool is_my_profile)
                temp_normal_first = calloc(1, SAFE_STRLEN(normal_name[CTSVC_NN_LAST]) +  SAFE_STRLEN(normal_name[CTSVC_NN_LAST]) + 1);
                if (normal_name[CTSVC_NN_LAST]) {
                        len = snprintf(temp_normal_first, SAFE_STRLEN(normal_name[CTSVC_NN_LAST]) +  SAFE_STRLEN(normal_name[CTSVC_NN_LAST]) + 1,
-                               "%s", normal_name[CTSVC_NN_LAST]);
+                                       "%s", normal_name[CTSVC_NN_LAST]);
                }
                if (normal_name[CTSVC_NN_FIRST]) {
                        snprintf(temp_normal_first+len, SAFE_STRLEN(normal_name[CTSVC_NN_LAST]) +  SAFE_STRLEN(normal_name[CTSVC_NN_LAST]) + 1 - len,
-                               "%s", normal_name[CTSVC_NN_FIRST]);
+                                       "%s", normal_name[CTSVC_NN_FIRST]);
                }
                temp_normal_last = NULL;
                break;
@@ -340,7 +338,7 @@ int ctsvc_db_name_update(contacts_record_h record, bool is_my_profile)
        if (ctsvc_get_primary_sort() == ret)
                name->language_type = CTSVC_LANG_DEFAULT;
        else if (ctsvc_get_secondary_sort() == ret)
-                       name->language_type = CTSVC_LANG_SECONDARY;
+               name->language_type = CTSVC_LANG_SECONDARY;
        else
                name->language_type = ret;
 
@@ -348,10 +346,10 @@ int ctsvc_db_name_update(contacts_record_h record, bool is_my_profile)
        name->last = tmp_last;
 
        __ctsvc_make_name_lookup(CONTACTS_NAME_DISPLAY_ORDER_FIRSTLAST,
-                                                               temp_normal_first, temp_normal_last, &name->lookup);
+                       temp_normal_first, temp_normal_last, &name->lookup);
 
        __ctsvc_make_name_lookup(CONTACTS_NAME_DISPLAY_ORDER_LASTFIRST,
-                                                               temp_normal_first, temp_normal_last, &name->reverse_lookup);
+                       temp_normal_first, temp_normal_last, &name->reverse_lookup);
 
        free(temp_normal_first);
        free(temp_normal_last);
@@ -371,11 +369,14 @@ int ctsvc_db_name_update(contacts_record_h record, bool is_my_profile)
                        ctsvc_set_name_noti();
        } while (0);
 
-       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s *)record);
-       CONTACTS_FREE(set);
+       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s*)record);
+       free(set);
+
        if (bind_text) {
-               for (cursor=bind_text;cursor;cursor=cursor->next)
-                       CONTACTS_FREE(cursor->data);
+               for (cursor = bind_text; cursor; cursor = cursor->next) {
+                       free(cursor->data);
+                       cursor->data = NULL;
+               }
                g_slist_free(bind_text);
        }
 
index 53d8f9c..55edb83 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #ifndef __CTSVC_DB_PLUGIN_NAME_HELPER_H__
 #define __CTSVC_DB_PLUGIN_NAME_HELPER_H__
 
 #include "contacts.h"
 #include "ctsvc_db_sqlite.h"
 
-int ctsvc_db_name_insert(contacts_record_h record, int contact_id, bool is_my_profile, int *id);
+int ctsvc_db_name_insert(contacts_record_h record, int contact_id, bool is_my_profile,
+               int *id);
 int ctsvc_db_name_update(contacts_record_h record, bool is_my_profile);
 int ctsvc_db_name_delete(int id, bool is_my_profile);
 
-int ctsvc_db_name_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record, int start_count);
+int ctsvc_db_name_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record,
+               int start_count);
 
 #endif /* __CTSVC_DB_PLUGIN_NAME_HELPER_H__ */
index 7fcaf52..4992764 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
 #include "ctsvc_list.h"
 #include "ctsvc_notification.h"
 
-static int __ctsvc_db_nickname_insert_record(contacts_record_h record, int *id);
-static int __ctsvc_db_nickname_get_record(int id, contacts_record_h* out_record);
-static int __ctsvc_db_nickname_update_record(contacts_record_h record);
-static int __ctsvc_db_nickname_delete_record(int id);
-static int __ctsvc_db_nickname_get_all_records(int offset, int limit, contacts_list_h* out_list);
-static int __ctsvc_db_nickname_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h* out_list);
-
-ctsvc_db_plugin_info_s ctsvc_db_plugin_nickname = {
-       .is_query_only = false,
-       .insert_record = __ctsvc_db_nickname_insert_record,
-       .get_record = __ctsvc_db_nickname_get_record,
-       .update_record = __ctsvc_db_nickname_update_record,
-       .delete_record = __ctsvc_db_nickname_delete_record,
-       .get_all_records = __ctsvc_db_nickname_get_all_records,
-       .get_records_with_query = __ctsvc_db_nickname_get_records_with_query,
-       .insert_records = NULL,
-       .update_records = NULL,
-       .delete_records = NULL,
-       .get_count = NULL,
-       .get_count_with_query = NULL,
-       .replace_record = NULL,
-       .replace_records = NULL,
-};
 
 static int __ctsvc_db_nickname_insert_record(contacts_record_h record, int *id)
 {
        int ret;
        int addressbook_id;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_nickname_s *nickname = (ctsvc_nickname_s *)record;
+       ctsvc_nickname_s *nickname = (ctsvc_nickname_s*)record;
 
-       RETVM_IF(NULL == nickname->nickname, CONTACTS_ERROR_INVALID_PARAMETER,
-               "Invalid parameter : nickname is NULL");
+       RETV_IF(NULL == nickname->nickname, CONTACTS_ERROR_INVALID_PARAMETER);
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -76,24 +52,23 @@ static int __ctsvc_db_nickname_insert_record(contacts_record_h record, int *id)
        if (CONTACTS_ERROR_NONE != ret) {
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NO_DATA == ret) {
-                       CTS_ERR("No data : contact_id (%d) is not exist", nickname->contact_id);
+                       ERR("No data : contact_id (%d) is not exist", nickname->contact_id);
                        return CONTACTS_ERROR_INVALID_PARAMETER;
-               }
-               else {
-                       CTS_ERR("ctsvc_query_get_first_int_result Fail(%d)", ret);
+               } else {
+                       ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                        return ret;
                }
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this nickname record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this nickname record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_nickname_insert(record, nickname->contact_id, false, id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -102,7 +77,7 @@ static int __ctsvc_db_nickname_insert_record(contacts_record_h record, int *id)
 
        ret = ctsvc_db_contact_update_changed_time(nickname->contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -110,14 +85,14 @@ static int __ctsvc_db_nickname_insert_record(contacts_record_h record, int *id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
-static int __ctsvc_db_nickname_get_record(int id, contacts_record_hout_record)
+static int __ctsvc_db_nickname_get_record(int id, contacts_record_h *out_record)
 {
        int ret;
        cts_stmt stmt = NULL;
@@ -128,17 +103,17 @@ static int __ctsvc_db_nickname_get_record(int id, contacts_record_h* out_record)
 
        snprintf(query, sizeof(query),
                        "SELECT id, data.contact_id, is_default, data1, data2, data3 "
-                               "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                               "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                               "WHERE id = %d AND datatype = %d ",
-                               id, CTSVC_DATA_NICKNAME);
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE id = %d AND datatype = %d ",
+                       id, CTSVC_DATA_NICKNAME);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/ != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
@@ -158,12 +133,12 @@ static int __ctsvc_db_nickname_update_record(contacts_record_h record)
        int ret;
        int addressbook_id;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_nickname_s *nickname = (ctsvc_nickname_s *)record;
+       ctsvc_nickname_s *nickname = (ctsvc_nickname_s*)record;
        RETVM_IF(NULL == nickname->nickname, CONTACTS_ERROR_INVALID_PARAMETER, "nickname is empty");
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -171,20 +146,20 @@ static int __ctsvc_db_nickname_update_record(contacts_record_h record)
                        "SELECT addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", nickname->contact_id);
        ret = ctsvc_query_get_first_int_result(query, &addressbook_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("No data : contact_id (%d) is not exist", nickname->contact_id);
+               ERR("No data : contact_id (%d) is not exist", nickname->contact_id);
                ctsvc_end_trans(false);
                return ret;
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this nickname record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this nickname record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_nickname_update(record, false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("Update record Fail(%d)", ret);
+               ERR("Update record Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -193,7 +168,7 @@ static int __ctsvc_db_nickname_update_record(contacts_record_h record)
 
        ret = ctsvc_db_contact_update_changed_time(nickname->contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -202,11 +177,11 @@ static int __ctsvc_db_nickname_update_record(contacts_record_h record)
        ret = ctsvc_end_trans(true);
 
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
 static int __ctsvc_db_nickname_delete_record(int id)
@@ -219,22 +194,22 @@ static int __ctsvc_db_nickname_delete_record(int id)
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
        snprintf(query, sizeof(query),
                        "SELECT contact_id, addressbook_id FROM "CTSVC_DB_VIEW_CONTACT " "
-                               "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id);
+                       "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id);
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare Fail(%d)", ret);
+               ERR("ctsvc_query_prepare Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
        ret = ctsvc_stmt_step(stmt);
        if (1 != ret) {
-               CTS_ERR("The id(%d) is Invalid(%d)", id, ret);
+               ERR("The id(%d) is Invalid(%d)", id, ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NONE == ret)
@@ -248,14 +223,14 @@ static int __ctsvc_db_nickname_delete_record(int id)
        ctsvc_stmt_finalize(stmt);
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to delete this nickname record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to delete this nickname record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_nickname_delete(id, false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -264,7 +239,7 @@ static int __ctsvc_db_nickname_delete_record(int id)
 
        ret = ctsvc_db_contact_update_changed_time(contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -272,14 +247,14 @@ static int __ctsvc_db_nickname_delete_record(int id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
-static int __ctsvc_db_nickname_get_all_records(int offset, int limit, contacts_list_hout_list)
+static int __ctsvc_db_nickname_get_all_records(int offset, int limit, contacts_list_h *out_list)
 {
        int len;
        int ret;
@@ -290,10 +265,10 @@ static int __ctsvc_db_nickname_get_all_records(int offset, int limit, contacts_l
 
        len = snprintf(query, sizeof(query),
                        "SELECT id, data.contact_id, is_default, data1, data2, data3 "
-                               "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                               "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                               "WHERE datatype = %d AND is_my_profile=0 ",
-                               CTSVC_DATA_NICKNAME);
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE datatype = %d AND is_my_profile=0 ",
+                       CTSVC_DATA_NICKNAME);
 
        if (0 != limit) {
                len += snprintf(query+len, sizeof(query)-len, " LIMIT %d", limit);
@@ -302,12 +277,12 @@ static int __ctsvc_db_nickname_get_all_records(int offset, int limit, contacts_l
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                if (1 /*CTS_TRUE */ != ret) {
-                       CTS_ERR("DB : ctsvc_stmt_step fail(%d)", ret);
+                       ERR("DB : ctsvc_stmt_step fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -323,7 +298,7 @@ static int __ctsvc_db_nickname_get_all_records(int offset, int limit, contacts_l
 }
 
 static int __ctsvc_db_nickname_get_records_with_query(contacts_query_h query, int offset,
-               int limit, contacts_list_hout_list)
+               int limit, contacts_list_h *out_list)
 {
        int ret;
        int i;
@@ -334,7 +309,7 @@ static int __ctsvc_db_nickname_get_records_with_query(contacts_query_h query, in
        ctsvc_nickname_s *nickname;
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        ret = ctsvc_db_make_get_records_query_stmt(s_query, offset, limit, &stmt);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_db_make_get_records_query_stmt fail(%d)", ret);
@@ -343,7 +318,7 @@ static int __ctsvc_db_nickname_get_records_with_query(contacts_query_h query, in
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 /*CTS_TRUE */ != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -351,9 +326,9 @@ static int __ctsvc_db_nickname_get_records_with_query(contacts_query_h query, in
 
                contacts_record_create(_contacts_nickname._uri, &record);
                nickname = (ctsvc_nickname_s*)record;
-               if (0 == s_query->projection_count)
+               if (0 == s_query->projection_count) {
                        field_count = s_query->property_count;
-               else {
+               else {
                        field_count = s_query->projection_count;
                        ret = ctsvc_record_set_projection_flags(record, s_query->projection,
                                        s_query->projection_count, s_query->property_count);
@@ -362,7 +337,7 @@ static int __ctsvc_db_nickname_get_records_with_query(contacts_query_h query, in
                                ASSERT_NOT_REACHED("To set projection is Fail.\n");
                }
 
-               for (i=0;i<field_count;i++) {
+               for (i = 0; i < field_count; i++) {
                        char *temp;
                        int property_id;
                        if (0 == s_query->projection_count)
@@ -370,7 +345,7 @@ static int __ctsvc_db_nickname_get_records_with_query(contacts_query_h query, in
                        else
                                property_id = s_query->projection[i];
 
-                       switch(property_id) {
+                       switch (property_id) {
                        case CTSVC_PROPERTY_NICKNAME_ID:
                                nickname->id = ctsvc_stmt_get_int(stmt, i);
                                break;
@@ -394,3 +369,21 @@ static int __ctsvc_db_nickname_get_records_with_query(contacts_query_h query, in
        *out_list = list;
        return CONTACTS_ERROR_NONE;
 }
+
+ctsvc_db_plugin_info_s ctsvc_db_plugin_nickname = {
+       .is_query_only = false,
+       .insert_record = __ctsvc_db_nickname_insert_record,
+       .get_record = __ctsvc_db_nickname_get_record,
+       .update_record = __ctsvc_db_nickname_update_record,
+       .delete_record = __ctsvc_db_nickname_delete_record,
+       .get_all_records = __ctsvc_db_nickname_get_all_records,
+       .get_records_with_query = __ctsvc_db_nickname_get_records_with_query,
+       .insert_records = NULL,
+       .update_records = NULL,
+       .delete_records = NULL,
+       .get_count = NULL,
+       .get_count_with_query = NULL,
+       .replace_record = NULL,
+       .replace_records = NULL,
+};
+
index 3501348..cf09bea 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -33,7 +33,7 @@ int ctsvc_db_nickname_get_value_from_stmt(cts_stmt stmt, contacts_record_h *reco
        char *temp;
        ctsvc_nickname_s *nickname;
 
-       ret = contacts_record_create(_contacts_nickname._uri, (contacts_record_h *)&nickname);
+       ret = contacts_record_create(_contacts_nickname._uri, (contacts_record_h*)&nickname);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "contacts_record_create Fail(%d)", ret);
 
        nickname->id = ctsvc_stmt_get_int(stmt, start_count++);
@@ -53,21 +53,21 @@ int ctsvc_db_nickname_insert(contacts_record_h record, int contact_id, bool is_m
        int ret;
        cts_stmt stmt = NULL;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_nickname_s *nickname = (ctsvc_nickname_s *)record;
+       ctsvc_nickname_s *nickname = (ctsvc_nickname_s*)record;
 
        RETV_IF(NULL == nickname->nickname, CONTACTS_ERROR_NONE);
        RETVM_IF(contact_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : contact_id(%d) is mandatory field to insert nickname record ", nickname->contact_id);
+                       "contact_id(%d) is mandatory field to insert nickname record ", nickname->contact_id);
        RETVM_IF(0 < nickname->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : id(%d), This record is already inserted", nickname->id);
+                       "id(%d), This record is already inserted", nickname->id);
 
        snprintf(query, sizeof(query),
-               "INSERT INTO "CTS_TABLE_DATA"(contact_id, is_my_profile, datatype, data1, data2, data3) "
-                                                                       "VALUES(%d, %d, %d, %d, ?, ?)",
+                       "INSERT INTO "CTS_TABLE_DATA"(contact_id, is_my_profile, datatype, data1, data2, data3) "
+                       "VALUES(%d, %d, %d, %d, ?, ?)",
                        contact_id, is_my_profile, CTSVC_DATA_NICKNAME, nickname->type);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        if (nickname->label)
                ctsvc_stmt_bind_text(stmt, 1, nickname->label);
@@ -76,7 +76,7 @@ int ctsvc_db_nickname_insert(contacts_record_h record, int contact_id, bool is_m
 
        ret = ctsvc_stmt_step(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                return ret;
        }
@@ -95,7 +95,7 @@ int ctsvc_db_nickname_update(contacts_record_h record, bool is_my_profile)
 {
        int id;
        int ret = CONTACTS_ERROR_NONE;
-       charset = NULL;
+       char *set = NULL;
        GSList *bind_text = NULL;
        GSList *cursor = NULL;
        ctsvc_nickname_s *nickname = (ctsvc_nickname_s*)record;
@@ -116,11 +116,14 @@ int ctsvc_db_nickname_update(contacts_record_h record, bool is_my_profile)
                        ctsvc_set_nickname_noti();
        } while (0);
 
-       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s *)record);
-       CONTACTS_FREE(set);
+       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s*)record);
+       free(set);
+
        if (bind_text) {
-               for (cursor=bind_text;cursor;cursor=cursor->next)
-                       CONTACTS_FREE(cursor->data);
+               for (cursor = bind_text; cursor; cursor = cursor->next) {
+                       free(cursor->data);
+                       cursor->data = NULL;
+               }
                g_slist_free(bind_text);
        }
        return ret;
index fa4a0ed..427a5f5 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #ifndef __CTSVC_DB_PLUGIN_NICKNAME_HELPER_H__
 #define __CTSVC_DB_PLUGIN_NICKNAME_HELPER_H__
 
 #include "contacts.h"
 #include "ctsvc_db_sqlite.h"
 
-int ctsvc_db_nickname_insert(contacts_record_h record, int contact_id, bool is_my_profile, int *id);
+int ctsvc_db_nickname_insert(contacts_record_h record, int contact_id,
+               bool is_my_profile, int *id);
 int ctsvc_db_nickname_update(contacts_record_h record, bool is_my_profile);
 int ctsvc_db_nickname_delete(int id, bool is_my_profile);
-int ctsvc_db_nickname_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record, int start_count);
+int ctsvc_db_nickname_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record,
+               int start_count);
 
 #endif /* __CTSVC_DB_PLUGIN_NICKNAME_HELPER_H__ */
index 858fd9c..3715139 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_db_schema.h"
 #include "ctsvc_record.h"
 #include "ctsvc_notification.h"
 
-static int __ctsvc_db_note_insert_record(contacts_record_h record, int *id);
-static int __ctsvc_db_note_get_record(int id, contacts_record_h* out_record);
-static int __ctsvc_db_note_update_record(contacts_record_h record);
-static int __ctsvc_db_note_delete_record(int id);
-static int __ctsvc_db_note_get_all_records(int offset, int limit, contacts_list_h* out_list);
-static int __ctsvc_db_note_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h* out_list);
-
-ctsvc_db_plugin_info_s ctsvc_db_plugin_note = {
-       .is_query_only = false,
-       .insert_record = __ctsvc_db_note_insert_record,
-       .get_record = __ctsvc_db_note_get_record,
-       .update_record = __ctsvc_db_note_update_record,
-       .delete_record = __ctsvc_db_note_delete_record,
-       .get_all_records = __ctsvc_db_note_get_all_records,
-       .get_records_with_query = __ctsvc_db_note_get_records_with_query,
-       .insert_records = NULL,
-       .update_records = NULL,
-       .delete_records = NULL,
-       .get_count = NULL,
-       .get_count_with_query = NULL,
-       .replace_record = NULL,
-       .replace_records = NULL,
-};
 
-static int __ctsvc_db_note_get_record(int id, contacts_record_hout_record)
+static int __ctsvc_db_note_get_record(int id, contacts_record_h *out_record)
 {
        int ret;
        cts_stmt stmt = NULL;
@@ -66,17 +42,17 @@ static int __ctsvc_db_note_get_record(int id, contacts_record_h* out_record)
 
        snprintf(query, sizeof(query),
                        "SELECT id, data.contact_id, is_default, data1, data2, data3 "
-                               "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                               "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                               "WHERE id = %d AND datatype = %d ",
-                               id, CTSVC_DATA_NOTE);
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE id = %d AND datatype = %d ",
+                       id, CTSVC_DATA_NOTE);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/ != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
@@ -95,14 +71,13 @@ static int __ctsvc_db_note_insert_record(contacts_record_h record, int *id)
        int ret;
        int addressbook_id;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_note_s *note = (ctsvc_note_s *)record;
+       ctsvc_note_s *note = (ctsvc_note_s*)record;
 
-       RETVM_IF(NULL == note->note, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : note is NULL");
+       RETV_IF(NULL == note->note, CONTACTS_ERROR_INVALID_PARAMETER);
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -112,31 +87,30 @@ static int __ctsvc_db_note_insert_record(contacts_record_h record, int *id)
        if (CONTACTS_ERROR_NONE != ret) {
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NO_DATA == ret) {
-                       CTS_ERR("No data : contact_id (%d) is not exist", note->contact_id);
+                       ERR("No data : contact_id (%d) is not exist", note->contact_id);
                        return CONTACTS_ERROR_INVALID_PARAMETER;
-               }
-               else {
-                       CTS_ERR("ctsvc_query_get_first_int_result Fail(%d)", ret);
+               } else {
+                       ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                        return ret;
                }
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this note record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this note record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_note_insert(record, note->contact_id, false, id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_db_contact_update_changed_time(note->contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -144,11 +118,11 @@ static int __ctsvc_db_note_insert_record(contacts_record_h record, int *id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
 static int __ctsvc_db_note_update_record(contacts_record_h record)
@@ -156,13 +130,13 @@ static int __ctsvc_db_note_update_record(contacts_record_h record)
        int ret;
        int addressbook_id;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_note_s *note = (ctsvc_note_s *)record;
+       ctsvc_note_s *note = (ctsvc_note_s*)record;
 
        RETVM_IF(NULL == note->note, CONTACTS_ERROR_INVALID_PARAMETER, "note is empty");
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -170,20 +144,20 @@ static int __ctsvc_db_note_update_record(contacts_record_h record)
                        "SELECT addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", note->contact_id);
        ret = ctsvc_query_get_first_int_result(query, &addressbook_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("No data : contact_id (%d) is not exist", note->contact_id);
+               ERR("No data : contact_id (%d) is not exist", note->contact_id);
                ctsvc_end_trans(false);
                return ret;
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this note record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this note record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_note_update(record, false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("Update record Fail(%d)", ret);
+               ERR("Update record Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -191,7 +165,7 @@ static int __ctsvc_db_note_update_record(contacts_record_h record)
        /* TODO ; contact display note update */
        ret = ctsvc_db_contact_update_changed_time(note->contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -199,11 +173,11 @@ static int __ctsvc_db_note_update_record(contacts_record_h record)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
 
@@ -217,22 +191,22 @@ static int __ctsvc_db_note_delete_record(int id)
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
        snprintf(query, sizeof(query),
                        "SELECT contact_id, addressbook_id FROM "CTSVC_DB_VIEW_CONTACT " "
-                               "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id);
+                       "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id);
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare Fail(%d)", ret);
+               ERR("ctsvc_query_prepare Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
        ret = ctsvc_stmt_step(stmt);
        if (1 != ret) {
-               CTS_ERR("The id(%d) is Invalid(%d)", id, ret);
+               ERR("The id(%d) is Invalid(%d)", id, ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NONE == ret)
@@ -246,14 +220,14 @@ static int __ctsvc_db_note_delete_record(int id)
        ctsvc_stmt_finalize(stmt);
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to delete this note record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to delete this note record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_note_delete(id, false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -261,7 +235,7 @@ static int __ctsvc_db_note_delete_record(int id)
        /* TODO ; contact name update */
        ret = ctsvc_db_contact_update_changed_time(contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -269,14 +243,14 @@ static int __ctsvc_db_note_delete_record(int id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
-static int __ctsvc_db_note_get_all_records(int offset, int limit, contacts_list_hout_list)
+static int __ctsvc_db_note_get_all_records(int offset, int limit, contacts_list_h *out_list)
 {
        int len;
        int ret;
@@ -287,10 +261,10 @@ static int __ctsvc_db_note_get_all_records(int offset, int limit, contacts_list_
 
        len = snprintf(query, sizeof(query),
                        "SELECT id, data.contact_id, is_default, data1, data2, data3 "
-                               "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                               "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                               "WHERE datatype = %d AND is_my_profile=0 ",
-                               CTSVC_DATA_NOTE);
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE datatype = %d AND is_my_profile=0 ",
+                       CTSVC_DATA_NOTE);
 
 
        if (0 != limit) {
@@ -300,12 +274,12 @@ static int __ctsvc_db_note_get_all_records(int offset, int limit, contacts_list_
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                if (1 /*CTS_TRUE */ != ret) {
-                       CTS_ERR("DB : ctsvc_stmt_step fail(%d)", ret);
+                       ERR("DB : ctsvc_stmt_step fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -321,7 +295,7 @@ static int __ctsvc_db_note_get_all_records(int offset, int limit, contacts_list_
 }
 
 static int __ctsvc_db_note_get_records_with_query(contacts_query_h query, int offset,
-               int limit, contacts_list_hout_list)
+               int limit, contacts_list_h *out_list)
 {
        int ret;
        int i;
@@ -332,7 +306,7 @@ static int __ctsvc_db_note_get_records_with_query(contacts_query_h query, int of
        ctsvc_note_s *note;
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        ret = ctsvc_db_make_get_records_query_stmt(s_query, offset, limit, &stmt);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_db_make_get_records_query_stmt fail(%d)", ret);
@@ -341,7 +315,7 @@ static int __ctsvc_db_note_get_records_with_query(contacts_query_h query, int of
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 /*CTS_TRUE */ != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -349,9 +323,9 @@ static int __ctsvc_db_note_get_records_with_query(contacts_query_h query, int of
 
                contacts_record_create(_contacts_note._uri, &record);
                note = (ctsvc_note_s*)record;
-               if (0 == s_query->projection_count)
+               if (0 == s_query->projection_count) {
                        field_count = s_query->property_count;
-               else {
+               else {
                        field_count = s_query->projection_count;
                        ret = ctsvc_record_set_projection_flags(record, s_query->projection,
                                        s_query->projection_count, s_query->property_count);
@@ -360,7 +334,7 @@ static int __ctsvc_db_note_get_records_with_query(contacts_query_h query, int of
                                ASSERT_NOT_REACHED("To set projection is Fail.\n");
                }
 
-               for (i=0;i<field_count;i++) {
+               for (i = 0; i < field_count; i++) {
                        char *temp;
                        int property_id;
                        if (0 == s_query->projection_count)
@@ -368,7 +342,7 @@ static int __ctsvc_db_note_get_records_with_query(contacts_query_h query, int of
                        else
                                property_id = s_query->projection[i];
 
-                       switch(property_id) {
+                       switch (property_id) {
                        case CTSVC_PROPERTY_NOTE_ID:
                                note->id = ctsvc_stmt_get_int(stmt, i);
                                break;
@@ -392,3 +366,21 @@ static int __ctsvc_db_note_get_records_with_query(contacts_query_h query, int of
        *out_list = list;
        return CONTACTS_ERROR_NONE;
 }
+
+ctsvc_db_plugin_info_s ctsvc_db_plugin_note = {
+       .is_query_only = false,
+       .insert_record = __ctsvc_db_note_insert_record,
+       .get_record = __ctsvc_db_note_get_record,
+       .update_record = __ctsvc_db_note_update_record,
+       .delete_record = __ctsvc_db_note_delete_record,
+       .get_all_records = __ctsvc_db_note_get_all_records,
+       .get_records_with_query = __ctsvc_db_note_get_records_with_query,
+       .insert_records = NULL,
+       .update_records = NULL,
+       .delete_records = NULL,
+       .get_count = NULL,
+       .get_count_with_query = NULL,
+       .replace_record = NULL,
+       .replace_records = NULL,
+};
+
index 74f1f0d..ffe9aea 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_db_schema.h"
 #include "ctsvc_notification.h"
 #include "ctsvc_record.h"
 
-int ctsvc_db_note_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record, int start_count)
+int ctsvc_db_note_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record,
+               int start_count)
 {
        int ret;
        char *temp;
        ctsvc_note_s *note;
 
-       ret = contacts_record_create(_contacts_note._uri, (contacts_record_h *)&note);
+       ret = contacts_record_create(_contacts_note._uri, (contacts_record_h*)&note);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "contacts_record_create Fail(%d)", ret);
 
        note->id = ctsvc_stmt_get_int(stmt, start_count++);
@@ -58,23 +58,23 @@ int ctsvc_db_note_insert(contacts_record_h record, int contact_id, bool is_my_pr
 
        RETV_IF(NULL == note->note, CONTACTS_ERROR_NONE);
        RETVM_IF(contact_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : contact_id(%d) is mandatory field to insert note record ", note->contact_id);
+                       "contact_id(%d) is mandatory field to insert note record ", note->contact_id);
        RETVM_IF(0 < note->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : id(%d), This record is already inserted", note->id);
+                       "id(%d), This record is already inserted", note->id);
 
        snprintf(query, sizeof(query),
-               "INSERT INTO "CTS_TABLE_DATA"(contact_id, is_my_profile, datatype, data3) "
-                                       "VALUES(%d, %d, %d, ?)", contact_id, is_my_profile, CTSVC_DATA_NOTE);
+                       "INSERT INTO "CTS_TABLE_DATA"(contact_id, is_my_profile, datatype, data3) "
+                       "VALUES(%d, %d, %d, ?)", contact_id, is_my_profile, CTSVC_DATA_NOTE);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        sqlite3_bind_text(stmt, 1, note->note,
                        strlen(note->note), SQLITE_STATIC);
 
        ret = ctsvc_stmt_step(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                return ret;
        }
@@ -91,7 +91,7 @@ int ctsvc_db_note_update(contacts_record_h record, bool is_my_profile)
 {
        int id;
        int ret = CONTACTS_ERROR_NONE;
-       charset = NULL;
+       char *set = NULL;
        GSList *bind_text = NULL;
        GSList *cursor = NULL;
        ctsvc_note_s *note = (ctsvc_note_s*)record;
@@ -113,11 +113,14 @@ int ctsvc_db_note_update(contacts_record_h record, bool is_my_profile)
                        ctsvc_set_messenger_noti();
        } while (0);
 
-       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s *)record);
-       CONTACTS_FREE(set);
+       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s*)record);
+       free(set);
+
        if (bind_text) {
-               for (cursor=bind_text;cursor;cursor=cursor->next)
-                       CONTACTS_FREE(cursor->data);
+               for (cursor = bind_text; cursor; cursor = cursor->next) {
+                       free(cursor->data);
+                       cursor->data = NULL;
+               }
                g_slist_free(bind_text);
        }
 
index 06a7a01..f96f2c4 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #ifndef __CTSVC_DB_PLUGIN_NOTE_HELPER_H__
 #define __CTSVC_DB_PLUGIN_NOTE_HELPER_H__
 
 #include "contacts.h"
 #include "ctsvc_db_sqlite.h"
 
-int ctsvc_db_note_insert(contacts_record_h record, int contact_id, bool is_my_profile, int *id);
+int ctsvc_db_note_insert(contacts_record_h record, int contact_id, bool is_my_profile,
+               int *id);
 int ctsvc_db_note_update(contacts_record_h record, bool is_my_profile);
 int ctsvc_db_note_delete(int id, bool is_my_profile);
-int ctsvc_db_note_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record, int start_count);
+int ctsvc_db_note_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record,
+               int start_count);
 
 #endif /* __CTSVC_DB_PLUGIN_NOTE_HELPER_H__ */
index 1d852af..942c85c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_db_schema.h"
 #include "ctsvc_notification.h"
 #include "ctsvc_list.h"
 
-static int __ctsvc_db_number_insert_record(contacts_record_h record, int *id);
-static int __ctsvc_db_number_get_record(int id, contacts_record_h* out_record);
-static int __ctsvc_db_number_update_record(contacts_record_h record);
-static int __ctsvc_db_number_delete_record(int id);
-static int __ctsvc_db_number_get_all_records(int offset, int limit, contacts_list_h* out_list);
-static int __ctsvc_db_number_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h* out_list);
-
-ctsvc_db_plugin_info_s ctsvc_db_plugin_number = {
-       .is_query_only = false,
-       .insert_record = __ctsvc_db_number_insert_record,
-       .get_record = __ctsvc_db_number_get_record,
-       .update_record = __ctsvc_db_number_update_record,
-       .delete_record = __ctsvc_db_number_delete_record,
-       .get_all_records = __ctsvc_db_number_get_all_records,
-       .get_records_with_query = __ctsvc_db_number_get_records_with_query,
-       .insert_records = NULL,
-       .update_records = NULL,
-       .delete_records = NULL,
-       .get_count = NULL,
-       .get_count_with_query = NULL,
-       .replace_record = NULL,
-       .replace_records = NULL,
-};
 
 static int __ctsvc_db_number_get_person_default_number(int person_id)
 {
@@ -63,9 +39,9 @@ static int __ctsvc_db_number_get_person_default_number(int person_id)
        char query[CTS_SQL_MAX_LEN] = {0};
 
        snprintf(query, sizeof(query),
-               "SELECT id FROM "CTS_TABLE_CONTACTS" c, "CTS_TABLE_DATA" d "
-               "WHERE c.person_id = %d AND d.datatype = %d AND c.contact_id = d.contact_id AND d.is_default = 1",
-               person_id, CTSVC_DATA_NUMBER);
+                       "SELECT id FROM "CTS_TABLE_CONTACTS" c, "CTS_TABLE_DATA" d "
+                       "WHERE c.person_id = %d AND d.datatype = %d AND c.contact_id = d.contact_id AND d.is_default = 1",
+                       person_id, CTSVC_DATA_NUMBER);
        ret = ctsvc_query_get_first_int_result(query, &default_number_id);
        if (CONTACTS_ERROR_NONE != ret)
                return 0;
@@ -167,13 +143,12 @@ static int __ctsvc_db_number_insert_record(contacts_record_h record, int *id)
        int addressbook_id;
        char query[CTS_SQL_MAX_LEN] = {0};
        cts_stmt stmt = NULL;
-       ctsvc_number_s *number = (ctsvc_number_s *)record;
-       RETVM_IF(NULL == number->number, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : number is NULL");
+       ctsvc_number_s *number = (ctsvc_number_s*)record;
+       RETV_IF(NULL == number->number, CONTACTS_ERROR_INVALID_PARAMETER);
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -181,14 +156,14 @@ static int __ctsvc_db_number_insert_record(contacts_record_h record, int *id)
                        "SELECT addressbook_id, person_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", number->contact_id);
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_stmt_step(stmt);
        if (1 != ret) {
-               CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NO_DATA)
@@ -201,7 +176,7 @@ static int __ctsvc_db_number_insert_record(contacts_record_h record, int *id)
        ctsvc_stmt_finalize(stmt);
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this number record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this number record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
@@ -212,19 +187,19 @@ static int __ctsvc_db_number_insert_record(contacts_record_h record, int *id)
 
        ret = ctsvc_db_number_insert(record, number->contact_id, false, id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        snprintf(query, sizeof(query),
-               "UPDATE "CTS_TABLE_CONTACTS" SET has_phonenumber = %d, changed_ver = %d, changed_time = %d "
+                       "UPDATE "CTS_TABLE_CONTACTS" SET has_phonenumber = %d, changed_ver = %d, changed_time = %d "
                        "WHERE contact_id = %d",
                        1, ctsvc_get_next_ver(), (int)time(NULL), number->contact_id);
 
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -245,29 +220,29 @@ static int __ctsvc_db_number_insert_record(contacts_record_h record, int *id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
-static int __ctsvc_db_number_get_record(int id, contacts_record_hout_record)
+static int __ctsvc_db_number_get_record(int id, contacts_record_h *out_record)
 {
        char query[CTS_SQL_MAX_LEN] = {0};
        int ret;
        cts_stmt stmt = NULL;
 
        snprintf(query, sizeof(query),
-               "SELECT id, contact_id, is_default, data1, data2, data3, data4, data5, data6 "
-                               "FROM "CTSVC_DB_VIEW_NUMBER" WHERE id = %d", id);
+                       "SELECT id, contact_id, is_default, data1, data2, data3, data4, data5, data6 "
+                       "FROM "CTSVC_DB_VIEW_NUMBER" WHERE id = %d", id);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 != ret) {
-               CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
@@ -286,12 +261,12 @@ static int __ctsvc_db_number_update_record(contacts_record_h record)
        int ret;
        int addressbook_id;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_number_s *number = (ctsvc_number_s *)record;
+       ctsvc_number_s *number = (ctsvc_number_s*)record;
        RETVM_IF(NULL == number->number, CONTACTS_ERROR_INVALID_PARAMETER, "number is empty");
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -299,20 +274,20 @@ static int __ctsvc_db_number_update_record(contacts_record_h record)
                        "SELECT addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", number->contact_id);
        ret = ctsvc_query_get_first_int_result(query, &addressbook_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("No data : contact_id (%d) is not exist", number->contact_id);
+               ERR("No data : contact_id (%d) is not exist", number->contact_id);
                ctsvc_end_trans(false);
                return ret;
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this number record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this number record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_number_update(record, false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -327,7 +302,7 @@ static int __ctsvc_db_number_update_record(contacts_record_h record)
 
        ret = ctsvc_db_contact_update_changed_time(number->contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -335,11 +310,11 @@ static int __ctsvc_db_number_update_record(contacts_record_h record)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
 static int __ctsvc_db_number_delete_record(int id)
@@ -357,7 +332,7 @@ static int __ctsvc_db_number_delete_record(int id)
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -367,14 +342,14 @@ static int __ctsvc_db_number_delete_record(int id)
 
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_stmt_step(stmt);
        if (1 != ret) {
-               CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NONE == ret)
@@ -389,7 +364,7 @@ static int __ctsvc_db_number_delete_record(int id)
        ctsvc_stmt_finalize(stmt);
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to delete this number record : addresbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to delete this number record : addresbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
@@ -397,11 +372,11 @@ static int __ctsvc_db_number_delete_record(int id)
        snprintf(query, sizeof(query),
                        "SELECT is_default, is_primary_default FROM "CTS_TABLE_DATA" WHERE id = %d", id);
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 != ret) {
-               CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NONE == ret)
@@ -416,7 +391,7 @@ static int __ctsvc_db_number_delete_record(int id)
        ret = ctsvc_db_number_delete(id, false);
 
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -429,22 +404,22 @@ static int __ctsvc_db_number_delete_record(int id)
                has_phonenumber = true;
 
        snprintf(query, sizeof(query),
-               "UPDATE "CTS_TABLE_CONTACTS" SET has_phonenumber = %d, changed_ver = %d, changed_time = %d "
+                       "UPDATE "CTS_TABLE_CONTACTS" SET has_phonenumber = %d, changed_ver = %d, changed_time = %d "
                        "WHERE contact_id = %d",
                        has_phonenumber, ctsvc_get_next_ver(), (int)time(NULL), contact_id);
 
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        if (is_default) {
                if (number_id) {
-                       __ctsvc_db_number_update_default(number_id, contact_id, is_default, is_primary_default);
-               }
-               else if (is_primary_default) {
+                       __ctsvc_db_number_update_default(number_id, contact_id, is_default,
+                                       is_primary_default);
+               else if (is_primary_default) {
                        int default_number_id = 0;
                        default_number_id = __ctsvc_db_number_get_person_default_number(person_id);
                        if (default_number_id)
@@ -459,11 +434,11 @@ static int __ctsvc_db_number_delete_record(int id)
        ctsvc_set_person_noti();
 
        ret = ctsvc_end_trans(true);
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "DB error : ctsvc_end_trans() Fail(%d)", ret);
+       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "ctsvc_end_trans() Fail(%d)", ret);
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_number_get_all_records(int offset, int limit, contacts_list_hout_list)
+static int __ctsvc_db_number_get_all_records(int offset, int limit, contacts_list_h *out_list)
 {
        int len;
        int ret;
@@ -474,10 +449,10 @@ static int __ctsvc_db_number_get_all_records(int offset, int limit, contacts_lis
 
        len = snprintf(query, sizeof(query),
                        "SELECT id, data.contact_id, is_default, data1, data2, data3, data4, data5, data6 "
-                               "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                               "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                               "WHERE datatype = %d AND is_my_profile=0 ",
-                               CTSVC_DATA_NUMBER);
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE datatype = %d AND is_my_profile=0 ",
+                       CTSVC_DATA_NUMBER);
 
        if (0 != limit) {
                len += snprintf(query+len, sizeof(query)-len, " LIMIT %d", limit);
@@ -486,12 +461,12 @@ static int __ctsvc_db_number_get_all_records(int offset, int limit, contacts_lis
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step Fail (%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -507,7 +482,7 @@ static int __ctsvc_db_number_get_all_records(int offset, int limit, contacts_lis
 }
 
 static int __ctsvc_db_number_get_records_with_query(contacts_query_h query, int offset,
-               int limit, contacts_list_hout_list)
+               int limit, contacts_list_h *out_list)
 {
        int ret;
        int i;
@@ -518,7 +493,7 @@ static int __ctsvc_db_number_get_records_with_query(contacts_query_h query, int
        ctsvc_number_s *number;
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        ret = ctsvc_db_make_get_records_query_stmt(s_query, offset, limit, &stmt);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_db_make_get_records_query_stmt fail(%d)", ret);
@@ -527,7 +502,7 @@ static int __ctsvc_db_number_get_records_with_query(contacts_query_h query, int
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -535,9 +510,9 @@ static int __ctsvc_db_number_get_records_with_query(contacts_query_h query, int
 
                contacts_record_create(_contacts_number._uri, &record);
                number = (ctsvc_number_s*)record;
-               if (0 == s_query->projection_count)
+               if (0 == s_query->projection_count) {
                        field_count = s_query->property_count;
-               else {
+               else {
                        field_count = s_query->projection_count;
                        ret = ctsvc_record_set_projection_flags(record, s_query->projection,
                                        s_query->projection_count, s_query->property_count);
@@ -546,7 +521,7 @@ static int __ctsvc_db_number_get_records_with_query(contacts_query_h query, int
                                ASSERT_NOT_REACHED("To set projection is Fail.\n");
                }
 
-               for (i=0;i<field_count;i++) {
+               for (i = 0; i < field_count; i++) {
                        char *temp;
                        int property_id;
                        if (0 == s_query->projection_count)
@@ -554,7 +529,7 @@ static int __ctsvc_db_number_get_records_with_query(contacts_query_h query, int
                        else
                                property_id = s_query->projection[i];
 
-                       switch(property_id) {
+                       switch (property_id) {
                        case CTSVC_PROPERTY_NUMBER_ID:
                                number->id = ctsvc_stmt_get_int(stmt, i);
                                break;
@@ -594,3 +569,21 @@ static int __ctsvc_db_number_get_records_with_query(contacts_query_h query, int
        *out_list = list;
        return CONTACTS_ERROR_NONE;
 }
+
+ctsvc_db_plugin_info_s ctsvc_db_plugin_number = {
+       .is_query_only = false,
+       .insert_record = __ctsvc_db_number_insert_record,
+       .get_record = __ctsvc_db_number_get_record,
+       .update_record = __ctsvc_db_number_update_record,
+       .delete_record = __ctsvc_db_number_delete_record,
+       .get_all_records = __ctsvc_db_number_get_all_records,
+       .get_records_with_query = __ctsvc_db_number_get_records_with_query,
+       .insert_records = NULL,
+       .update_records = NULL,
+       .delete_records = NULL,
+       .get_count = NULL,
+       .get_count_with_query = NULL,
+       .replace_record = NULL,
+       .replace_records = NULL,
+};
+
index 7032f49..ae7e5d6 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_db_schema.h"
@@ -54,21 +53,21 @@ int ctsvc_db_number_insert(contacts_record_h record, int contact_id, bool is_my_
        int number_id;
        cts_stmt stmt = NULL;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_number_s *number = (ctsvc_number_s *)record;
+       ctsvc_number_s *number = (ctsvc_number_s*)record;
 
        RETV_IF(NULL == number->number, CONTACTS_ERROR_NONE);
        RETVM_IF(contact_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : contact_id(%d) is mandatory field to insert number record ", number->contact_id);
+                       "contact_id(%d) is mandatory field to insert number record ", number->contact_id);
        RETVM_IF(0 < number->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : id(%d), This record is already inserted", number->id);
+                       "id(%d), This record is already inserted", number->id);
 
        snprintf(query, sizeof(query),
-               "INSERT INTO "CTS_TABLE_DATA"(contact_id, is_my_profile, datatype, is_default, data1, data2, data3, data4, data5, data6) "
-                                                                       "VALUES(%d, %d, %d, %d, %d, ?, ?, ?, ?, ?)",
+                       "INSERT INTO "CTS_TABLE_DATA"(contact_id, is_my_profile, datatype, is_default, data1, data2, data3, data4, data5, data6) "
+                       "VALUES(%d, %d, %d, %d, %d, ?, ?, ?, ?, ?)",
                        contact_id, is_my_profile, CTSVC_DATA_NUMBER, number->is_default, number->type);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        if (number->label)
                ctsvc_stmt_bind_text(stmt, 1, number->label);
@@ -92,7 +91,7 @@ int ctsvc_db_number_insert(contacts_record_h record, int contact_id, bool is_my_
 
        ret = ctsvc_stmt_step(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                return ret;
        }
@@ -102,7 +101,7 @@ int ctsvc_db_number_insert(contacts_record_h record, int contact_id, bool is_my_
                *id = number_id;
        ctsvc_stmt_finalize(stmt);
 
-       if (ctsvc_record_check_property_flag((ctsvc_record_s *)record, _contacts_number.is_default, CTSVC_PROPERTY_FLAG_DIRTY)) {
+       if (ctsvc_record_check_property_flag((ctsvc_record_s*)record, _contacts_number.is_default, CTSVC_PROPERTY_FLAG_DIRTY)) {
                if (number->is_default)
                        __ctsvc_db_number_reset_default(number_id, contact_id);
        }
@@ -113,8 +112,8 @@ int ctsvc_db_number_insert(contacts_record_h record, int contact_id, bool is_my_
                int person_id = -1;
                snprintf(query, sizeof(query),
                                "SELECT person_id, data3 FROM "CTS_TABLE_CONTACTS", "CTS_TABLE_DATA" "
-                                                                               "ON "CTS_TABLE_CONTACTS".contact_id = "CTS_TABLE_DATA".contact_id "
-                                                                               "WHERE data.id = %d", number_id);
+                               "ON "CTS_TABLE_CONTACTS".contact_id = "CTS_TABLE_DATA".contact_id "
+                               "WHERE data.id = %d", number_id);
                ret = ctsvc_query_get_first_int_result(query, &person_id);
                if (0 < person_id)
                        ctsvc_db_phone_log_update_person_id(number->number, -1, person_id, false);
@@ -131,7 +130,7 @@ int ctsvc_db_number_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record
        char *temp;
        ctsvc_number_s *number;
 
-       ret = contacts_record_create(_contacts_number._uri, (contacts_record_h *)&number);
+       ret = contacts_record_create(_contacts_number._uri, (contacts_record_h*)&number);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "contacts_record_create Fail(%d)", ret);
 
        number->id = ctsvc_stmt_get_int(stmt, start_count++);
@@ -157,10 +156,10 @@ int ctsvc_db_number_update(contacts_record_h record, bool is_my_profile)
 {
        int id;
        int ret = CONTACTS_ERROR_NONE;
-       charset = NULL;
+       char *set = NULL;
        GSList *bind_text = NULL;
        GSList *cursor = NULL;
-       ctsvc_number_s *number = (ctsvc_number_s *)record;
+       ctsvc_number_s *number = (ctsvc_number_s*)record;
        char query[CTS_SQL_MAX_LEN] = {0};
 
 #ifdef ENABLE_LOG_FEATURE
@@ -172,21 +171,21 @@ int ctsvc_db_number_update(contacts_record_h record, bool is_my_profile)
 
        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");
+                       CONTACTS_ERROR_NONE, "No update");
 
        snprintf(query, sizeof(query),
                        "SELECT id FROM "CTS_TABLE_DATA" WHERE id = %d", number->id);
        ret = ctsvc_query_get_first_int_result(query, &id);
        RETV_IF(ret != CONTACTS_ERROR_NONE, ret);
 
-       if (ctsvc_record_check_property_flag((ctsvc_record_s *)record, _contacts_number.is_default, CTSVC_PROPERTY_FLAG_DIRTY)) {
+       if (ctsvc_record_check_property_flag((ctsvc_record_s*)record, _contacts_number.is_default, CTSVC_PROPERTY_FLAG_DIRTY)) {
                if (number->is_default)
                        __ctsvc_db_number_reset_default(number->id, number->contact_id);
        }
 
        do {
                if (CONTACTS_ERROR_NONE != (ret = ctsvc_db_create_set_query(record, &set, &bind_text))) break;
-               if (ctsvc_record_check_property_flag((ctsvc_record_s *)record, CTSVC_PROPERTY_NUMBER_NUMBER, CTSVC_PROPERTY_FLAG_DIRTY)) {
+               if (ctsvc_record_check_property_flag((ctsvc_record_s*)record, CTSVC_PROPERTY_NUMBER_NUMBER, CTSVC_PROPERTY_FLAG_DIRTY)) {
                        int len;
                        char query_set[CTS_SQL_MAX_LEN] = {0};
 
@@ -194,20 +193,20 @@ int ctsvc_db_number_update(contacts_record_h record, bool is_my_profile)
                        /* updata phonelog */
                        snprintf(query, sizeof(query),
                                        "SELECT person_id, data3 FROM "CTS_TABLE_CONTACTS", "CTS_TABLE_DATA" "
-                                                                                       "ON "CTS_TABLE_CONTACTS".contact_id = "CTS_TABLE_DATA".contact_id "
-                                                                                       "WHERE data.id = %d", number->id);
+                                       "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) {
                                ret = ctsvc_stmt_step(stmt);
                                if (ret == 1) {
                                        person_id = ctsvc_stmt_get_int(stmt, 0);
                                        pre_number = ctsvc_stmt_get_text(stmt, 1);
+                               } else {
+                                       WARN("ctsvc_stmt_step() Fail(%d)", ret);
                                }
-                               else
-                                       WARN("ctsvc_stmt_step fail (%d)", ret);
+                       } else {
+                               WARN("ctsvc_query_prepare Fail(%d)", ret);
                        }
-                       else
-                               WARN("ctsvc_query_prepare fail (%d)", ret);
 #endif /* ENABLE_LOG_FEATURE */
 
                        char clean_num[SAFE_STRLEN(number->number) + 1];
@@ -233,25 +232,25 @@ int ctsvc_db_number_update(contacts_record_h record, bool is_my_profile)
                        }
                }
 #ifdef ENABLE_LOG_FEATURE
-               if (ctsvc_record_check_property_flag((ctsvc_record_s *)record, CTSVC_PROPERTY_NUMBER_TYPE, CTSVC_PROPERTY_FLAG_DIRTY)) {
+               if (ctsvc_record_check_property_flag((ctsvc_record_s*)record, CTSVC_PROPERTY_NUMBER_TYPE, CTSVC_PROPERTY_FLAG_DIRTY)) {
                        if (person_id <= 0) {
                                /* updata phonelog */
                                snprintf(query, sizeof(query),
                                                "SELECT person_id, data3 FROM "CTS_TABLE_CONTACTS", "CTS_TABLE_DATA" "
-                                                                                               "ON "CTS_TABLE_CONTACTS".contact_id = "CTS_TABLE_DATA".contact_id "
-                                                                                               "WHERE data.id = %d", number->id);
+                                               "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) {
                                        ret = ctsvc_stmt_step(stmt);
                                        if (ret == 1) {
                                                person_id = ctsvc_stmt_get_int(stmt, 0);
                                                pre_number = ctsvc_stmt_get_text(stmt, 1);
+                                       } else {
+                                               WARN("ctsvc_stmt_step() Fail(%d)", ret);
                                        }
-                                       else
-                                               WARN("ctsvc_stmt_step fail (%d)", ret);
+                               } else {
+                                       WARN("ctsvc_query_prepare Fail(%d)", ret);
                                }
-                               else
-                                       WARN("ctsvc_query_prepare fail (%d)", ret);
                        }
                }
 #endif /* ENABLE_LOG_FEATURE */
@@ -271,11 +270,14 @@ int ctsvc_db_number_update(contacts_record_h record, bool is_my_profile)
 #endif /* ENABLE_LOG_FEATURE */
        } while (0);
 
-       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s *)record);
-       CONTACTS_FREE(set);
+       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s*)record);
+       free(set);
+
        if (bind_text) {
-               for (cursor=bind_text;cursor;cursor=cursor->next)
-                       CONTACTS_FREE(cursor->data);
+               for (cursor = bind_text; cursor; cursor = cursor->next) {
+                       free(cursor->data);
+                       cursor->data = NULL;
+               }
                g_slist_free(bind_text);
        }
 
@@ -295,20 +297,20 @@ int ctsvc_db_number_delete(int id, bool is_my_profile)
 
        snprintf(query, sizeof(query),
                        "SELECT person_id, data3 FROM "CTS_TABLE_CONTACTS", "CTS_TABLE_DATA" "
-                                                                       "ON "CTS_TABLE_CONTACTS".contact_id = "CTS_TABLE_DATA".contact_id "
-                                                                       "WHERE data.id = %d", id);
+                       "ON "CTS_TABLE_CONTACTS".contact_id = "CTS_TABLE_DATA".contact_id "
+                       "WHERE data.id = %d", id);
        ret = ctsvc_query_prepare(query, &stmt);
        if (stmt) {
                ret = ctsvc_stmt_step(stmt);
                if (ret == 1) {
                        person_id = ctsvc_stmt_get_int(stmt, 0);
                        pre_number = ctsvc_stmt_get_text(stmt, 1);
+               } else {
+                       WARN("ctsvc_stmt_step() Fail(%d)", ret);
                }
-               else
-                       WARN("ctsvc_stmt_step fail (%d)", ret);
+       } else {
+               WARN("ctsvc_query_prepare Fail(%d)", ret);
        }
-       else
-               WARN("ctsvc_query_prepare fail (%d)", ret);
 #endif /* ENABLE_LOG_FEATURE */
 
        snprintf(query, sizeof(query), "DELETE FROM "CTS_TABLE_DATA" WHERE id = %d AND datatype = %d",
@@ -316,7 +318,7 @@ int ctsvc_db_number_delete(int id, bool is_my_profile)
 
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
 #ifdef ENABLE_LOG_FEATURE
                ctsvc_stmt_finalize(stmt);
 #endif /* ENABLE_LOG_FEATURE */
index f5b9747..01c4b24 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #ifndef __CTSVC_DB_PLUGIN_NUMBER_HELPER_H__
 #define __CTSVC_DB_PLUGIN_NUMBER_HELPER_H__
 
 #include "contacts.h"
 #include "ctsvc_db_sqlite.h"
 
-int ctsvc_db_number_insert(contacts_record_h record, int contact_id, bool is_my_profile, int *id);
+int ctsvc_db_number_insert(contacts_record_h record, int contact_id, bool is_my_profile,
+               int *id);
 int ctsvc_db_number_update(contacts_record_h record, bool is_my_profile);
 int ctsvc_db_number_delete(int id, bool is_my_profile);
 
-int ctsvc_db_number_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record, int start_count);
+int ctsvc_db_number_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record,
+               int start_count);
 
 #endif /* __CTSVC_DB_PLUGIN_NUMBER_HELPER_H__ */
index 4343c62..e3bd138 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_db_schema.h"
 #include "ctsvc_server_change_subject.h"
 #endif
 
-static int __ctsvc_db_person_insert_record(contacts_record_h record, int *id);
-static int __ctsvc_db_person_get_record(int id, contacts_record_h* out_record);
-static int __ctsvc_db_person_update_record(contacts_record_h record);
-static int __ctsvc_db_person_delete_record(int id);
-static int __ctsvc_db_person_get_all_records(int offset, int limit, contacts_list_h* out_list);
-static int __ctsvc_db_person_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h* out_list);
-
-ctsvc_db_plugin_info_s ctsvc_db_plugin_person = {
-       .is_query_only = false,
-       .insert_record = __ctsvc_db_person_insert_record,
-       .get_record = __ctsvc_db_person_get_record,
-       .update_record = __ctsvc_db_person_update_record,
-       .delete_record = __ctsvc_db_person_delete_record,
-       .get_all_records = __ctsvc_db_person_get_all_records,
-       .get_records_with_query = __ctsvc_db_person_get_records_with_query,
-       .insert_records = NULL,
-       .update_records = NULL,
-       .delete_records = NULL,
-       .get_count = NULL,
-       .get_count_with_query = NULL,
-       .replace_record = NULL,
-       .replace_records = NULL,
-};
 
 static int __ctsvc_db_person_insert_record(contacts_record_h record, int *id)
 {
-       CTS_ERR("Can not insert person record directly");
+       ERR("Can not insert person record directly");
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-static int __ctsvc_db_person_get_record(int id, contacts_record_hout_record)
+static int __ctsvc_db_person_get_record(int id, contacts_record_h *out_record)
 {
        int ret;
        cts_stmt stmt = NULL;
@@ -76,20 +52,20 @@ static int __ctsvc_db_person_get_record(int id, contacts_record_h* out_record)
        *out_record = NULL;
 
        snprintf(query, sizeof(query),
-               "SELECT persons.person_id, "
-                               "%s, "
-                               "_NORMALIZE_INDEX_(%s), "
-                               "name_contact_id, "
-                               "persons.image_thumbnail_path, "
-                               "persons.ringtone_path, "
-                               "persons.vibration, "
-                               "persons.message_alert, "
-                               "status, "
-                               "link_count, "
-                               "addressbook_ids, "
-                               "persons.has_phonenumber, "
-                               "persons.has_email, "
-                               "EXISTS(SELECT person_id FROM "CTS_TABLE_FAVORITES" WHERE person_id=persons.person_id) is_favorite "
+                       "SELECT persons.person_id, "
+                       "%s, "
+                       "_NORMALIZE_INDEX_(%s), "
+                       "name_contact_id, "
+                       "persons.image_thumbnail_path, "
+                       "persons.ringtone_path, "
+                       "persons.vibration, "
+                       "persons.message_alert, "
+                       "status, "
+                       "link_count, "
+                       "addressbook_ids, "
+                       "persons.has_phonenumber, "
+                       "persons.has_email, "
+                       "EXISTS(SELECT person_id FROM "CTS_TABLE_FAVORITES" WHERE person_id=persons.person_id) is_favorite "
                        "FROM "CTS_TABLE_PERSONS" "
                        "LEFT JOIN "CTS_TABLE_CONTACTS" "
                        "ON (name_contact_id = contacts.contact_id AND contacts.deleted = 0) "
@@ -97,11 +73,11 @@ static int __ctsvc_db_person_get_record(int id, contacts_record_h* out_record)
                        ctsvc_get_display_column(), ctsvc_get_sort_name_column(), id);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/ != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
@@ -112,7 +88,7 @@ static int __ctsvc_db_person_get_record(int id, contacts_record_h* out_record)
        ctsvc_stmt_finalize(stmt);
 
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_db_person_create_record_from_stmt() Fail(%d)", ret);
+               ERR("ctsvc_db_person_create_record_from_stmt() Fail(%d)", ret);
                return ret;
        }
 
@@ -130,7 +106,7 @@ static int __ctsvc_db_person_update_record(contacts_record_h record)
        GSList *cursor = NULL;
        char contact_query[CTS_SQL_MIN_LEN] = {0};
        char query[CTS_SQL_MIN_LEN] = {0};
-       ctsvc_person_s *person = (ctsvc_person_s *)record;
+       ctsvc_person_s *person = (ctsvc_person_s*)record;
        const char *display_name = NULL;
        int index_favorite = 0;
 
@@ -144,12 +120,12 @@ static int __ctsvc_db_person_update_record(contacts_record_h record)
                        "SELECT person_id FROM "CTS_TABLE_PERSONS" WHERE person_id = %d", person->person_id);
        ret = ctsvc_query_get_first_int_result(query, &person_id);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_query_get_first_int_result Fail(%d)", ret);
+               ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
-       if (ctsvc_record_check_property_flag((ctsvc_record_s *)person, _contacts_person.display_contact_id, CTSVC_PROPERTY_FLAG_DIRTY)) {
+       if (ctsvc_record_check_property_flag((ctsvc_record_s*)person, _contacts_person.display_contact_id, CTSVC_PROPERTY_FLAG_DIRTY)) {
                /* check name_contact_id validation */
                char *temp;
                char check_query[CTS_SQL_MIN_LEN] = {0};
@@ -158,7 +134,7 @@ static int __ctsvc_db_person_update_record(contacts_record_h record)
                                ctsvc_get_display_column(), person->person_id, person->name_contact_id);
                ret = ctsvc_query_prepare(check_query, &stmt);
                if (NULL == stmt) {
-                       CTS_ERR("ctsvc_query_prepare() Fail(%d)", ret);
+                       ERR("ctsvc_query_prepare() Fail(%d)", ret);
                        ctsvc_end_trans(false);
                        return ret;
                }
@@ -166,14 +142,13 @@ static int __ctsvc_db_person_update_record(contacts_record_h record)
                ret = ctsvc_stmt_step(stmt);
                if (1 != ret) {
                        if (CONTACTS_ERROR_NONE == ret) {
-                               CTS_ERR("Invalid parameter : the name_contact_id(%d) is not linked with person_id(%d)",
-                                       person->name_contact_id, person->person_id);
+                               ERR("the name_contact_id(%d) is not linked with person_id(%d)",
+                                               person->name_contact_id, person->person_id);
                                ctsvc_stmt_finalize(stmt);
                                ctsvc_end_trans(false);
                                return CONTACTS_ERROR_INVALID_PARAMETER;
-                       }
-                       else {
-                               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+                       } else {
+                               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                                ctsvc_stmt_finalize(stmt);
                                ctsvc_end_trans(false);
                                return ret;
@@ -188,10 +163,10 @@ static int __ctsvc_db_person_update_record(contacts_record_h record)
        /* update favorite */
        index_favorite = CTSVC_PROPERTY_PERSON_IS_FAVORITE & 0x000000FF;
        if (person->base.properties_flags &&
-                               ctsvc_record_check_property_flag((ctsvc_record_s *)person, index_favorite, CTSVC_PROPERTY_FLAG_DIRTY)) {
+                       ctsvc_record_check_property_flag((ctsvc_record_s*)person, index_favorite, CTSVC_PROPERTY_FLAG_DIRTY)) {
                ret = ctsvc_db_person_set_favorite(person->person_id, person->is_favorite, true);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_db_person_set_favorite() Fail(%d)", ret);
+                       ERR("ctsvc_db_person_set_favorite() Fail(%d)", ret);
                        ctsvc_end_trans(false);
                        return ret;
                }
@@ -214,13 +189,13 @@ static int __ctsvc_db_person_update_record(contacts_record_h record)
 
                ret = ctsvc_query_prepare(query, &stmt);
                if (NULL == stmt) {
-                       CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+                       ERR("ctsvc_query_prepare() Fail(%d)", ret);
                        break;
                }
 
                if (bind_text) {
                        int i = 0;
-                       for (cursor=bind_text,i=1;cursor;cursor=cursor->next,i++) {
+                       for (cursor = bind_text, i = 1; cursor; cursor = cursor->next, i++) {
                                const char *text = cursor->data;
                                if (text && *text)
                                        ctsvc_stmt_bind_text(stmt, i, text);
@@ -228,7 +203,7 @@ static int __ctsvc_db_person_update_record(contacts_record_h record)
                }
                ret = ctsvc_stmt_step(stmt);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        break;
                }
@@ -237,51 +212,57 @@ static int __ctsvc_db_person_update_record(contacts_record_h record)
 
        if (CONTACTS_ERROR_NONE != ret) {
                ctsvc_end_trans(false);
-               CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s *)record);
-               CONTACTS_FREE(set);
+               CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s*)record);
+               free(set);
+
                if (bind_text) {
-                       for (cursor=bind_text;cursor;cursor=cursor->next)
-                               CONTACTS_FREE(cursor->data);
+                       for (cursor = bind_text; cursor; cursor = cursor->next) {
+                               free(cursor->data);
+                               cursor->data = NULL;
+                       }
                        g_slist_free(bind_text);
                }
                return ret;
        }
 
        len = snprintf(contact_query, sizeof(contact_query), "UPDATE "CTS_TABLE_CONTACTS" SET changed_ver=%d ", ctsvc_get_next_ver());
-       if (ctsvc_record_check_property_flag((ctsvc_record_s *)person, _contacts_person.ringtone_path, CTSVC_PROPERTY_FLAG_DIRTY))
+       if (ctsvc_record_check_property_flag((ctsvc_record_s*)person, _contacts_person.ringtone_path, CTSVC_PROPERTY_FLAG_DIRTY))
                len += snprintf(contact_query + len, sizeof(contact_query) - len, ", ringtone_path=? ");
-       if (ctsvc_record_check_property_flag((ctsvc_record_s *)person, _contacts_person.vibration, CTSVC_PROPERTY_FLAG_DIRTY))
+       if (ctsvc_record_check_property_flag((ctsvc_record_s*)person, _contacts_person.vibration, CTSVC_PROPERTY_FLAG_DIRTY))
                len += snprintf(contact_query + len, sizeof(contact_query) - len, ", vibration=? ");
-       if (ctsvc_record_check_property_flag((ctsvc_record_s *)person, _contacts_person.message_alert, CTSVC_PROPERTY_FLAG_DIRTY))
+       if (ctsvc_record_check_property_flag((ctsvc_record_s*)person, _contacts_person.message_alert, CTSVC_PROPERTY_FLAG_DIRTY))
                len += snprintf(contact_query + len, sizeof(contact_query) - len, ", message_alert=? ");
        snprintf(contact_query+len, sizeof(contact_query)-len, " WHERE person_id=%d AND deleted = 0", person->person_id);
 
        ret = ctsvc_query_prepare(contact_query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                ctsvc_end_trans(false);
-               CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s *)record);
-               CONTACTS_FREE(set);
+               CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s*)record);
+               free(set);
+
                if (bind_text) {
-                       for (cursor=bind_text;cursor;cursor=cursor->next)
-                               CONTACTS_FREE(cursor->data);
+                       for (cursor = bind_text; cursor; cursor = cursor->next) {
+                               free(cursor->data);
+                               cursor->data = NULL;
+                       }
                        g_slist_free(bind_text);
                }
                return ret;
        }
 
        i = 1;
-       if (ctsvc_record_check_property_flag((ctsvc_record_s *)person, _contacts_person.ringtone_path, CTSVC_PROPERTY_FLAG_DIRTY)) {
+       if (ctsvc_record_check_property_flag((ctsvc_record_s*)person, _contacts_person.ringtone_path, CTSVC_PROPERTY_FLAG_DIRTY)) {
                if (person->ringtone_path)
                        ctsvc_stmt_bind_text(stmt, i, person->ringtone_path);
                i++;
        }
-       if (ctsvc_record_check_property_flag((ctsvc_record_s *)person, _contacts_person.vibration, CTSVC_PROPERTY_FLAG_DIRTY)) {
+       if (ctsvc_record_check_property_flag((ctsvc_record_s*)person, _contacts_person.vibration, CTSVC_PROPERTY_FLAG_DIRTY)) {
                if (person->vibration)
                        ctsvc_stmt_bind_text(stmt, i, person->vibration);
                i++;
        }
-       if (ctsvc_record_check_property_flag((ctsvc_record_s *)person, _contacts_person.message_alert, CTSVC_PROPERTY_FLAG_DIRTY)) {
+       if (ctsvc_record_check_property_flag((ctsvc_record_s*)person, _contacts_person.message_alert, CTSVC_PROPERTY_FLAG_DIRTY)) {
                if (person->message_alert)
                        ctsvc_stmt_bind_text(stmt, i, person->message_alert);
                i++;
@@ -289,25 +270,31 @@ static int __ctsvc_db_person_update_record(contacts_record_h record)
 
        ret = ctsvc_stmt_step(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
-               CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s *)record);
-               CONTACTS_FREE(set);
+               CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s*)record);
+               free(set);
+
                if (bind_text) {
-                       for (cursor=bind_text;cursor;cursor=cursor->next)
-                               CONTACTS_FREE(cursor->data);
+                       for (cursor = bind_text; cursor; cursor = cursor->next) {
+                               free(cursor->data);
+                               cursor->data = NULL;
+                       }
                        g_slist_free(bind_text);
                }
                return ret;
        }
        ctsvc_stmt_finalize(stmt);
 
-       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s *)record);
-       CONTACTS_FREE(set);
+       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s*)record);
+       free(set);
+
        if (bind_text) {
-               for (cursor=bind_text;cursor;cursor=cursor->next)
-                       CONTACTS_FREE(cursor->data);
+               for (cursor = bind_text; cursor; cursor = cursor->next) {
+                       free(cursor->data);
+                       cursor->data = NULL;
+               }
                g_slist_free(bind_text);
        }
 
@@ -328,7 +315,7 @@ static int __ctsvc_db_person_update_record(contacts_record_h record)
 #endif
 
        ret = ctsvc_end_trans(true);
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "DB error : ctsvc_end_trans() Fail(%d)", ret);
+       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "ctsvc_end_trans() Fail(%d)", ret);
 
        return CONTACTS_ERROR_NONE;
 }
@@ -343,13 +330,13 @@ static int __ctsvc_db_person_delete_record(int id)
        int count;
 
        ret = ctsvc_begin_trans();
-       RETVM_IF(ret, ret, "DB error : ctsvc_begin_trans() Fail(%d)", ret);
+       RETVM_IF(ret, ret, "ctsvc_begin_trans() Fail(%d)", ret);
 
        snprintf(query, sizeof(query),
                        "SELECT person_id FROM "CTS_TABLE_PERSONS" WHERE person_id = %d", id);
        ret = ctsvc_query_get_first_int_result(query, &person_id);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_query_get_first_int_result Fail(%d)", ret);
+               ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -357,14 +344,14 @@ static int __ctsvc_db_person_delete_record(int id)
        version = ctsvc_get_next_ver();
        snprintf(query, sizeof(query),
                        "UPDATE "CTS_TABLE_GROUPS" SET member_changed_ver=%d "
-                               "WHERE group_id IN (SELECT distinct group_id "
-                                                                       "FROM "CTS_TABLE_CONTACTS" C, "CTS_TABLE_GROUP_RELATIONS" R "
-                                                                       "ON C.contact_id=R.contact_id AND R.deleted = 0 AND C.deleted = 0 "
-                                                                       "WHERE person_id = %d)",
-                               version, id);
+                       "WHERE group_id IN (SELECT distinct group_id "
+                       "FROM "CTS_TABLE_CONTACTS" C, "CTS_TABLE_GROUP_RELATIONS" R "
+                       "ON C.contact_id=R.contact_id AND R.deleted = 0 AND C.deleted = 0 "
+                       "WHERE person_id = %d)",
+                       version, id);
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -373,7 +360,7 @@ static int __ctsvc_db_person_delete_record(int id)
 
        ret = ctsvc_get_write_permitted_addressbook_ids(&addressbook_ids, &count);
        if (CONTACTS_ERROR_INTERNAL == ret) {
-               CTS_ERR("ctsvc_get_write_permitted_addressbook_ids() Fail(%d)", ret);
+               ERR("ctsvc_get_write_permitted_addressbook_ids() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -382,10 +369,10 @@ static int __ctsvc_db_person_delete_record(int id)
                int i;
                int len = snprintf(query, sizeof(query),
                                "UPDATE "CTS_TABLE_CONTACTS" SET deleted = 1, person_id = 0, changed_ver = %d "
-                                       "WHERE person_id = %d AND (",
+                               "WHERE person_id = %d AND (",
                                version, id);
 
-               for (i=0;i<count;i++) {
+               for (i = 0; i < count; i++) {
                        if (i == 0)
                                len += snprintf(query+len, sizeof(query) + len, "addressbook_id = %d ", addressbook_ids[i]);
                        else
@@ -395,7 +382,7 @@ static int __ctsvc_db_person_delete_record(int id)
 
                ret = ctsvc_query_exec(query);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+                       ERR("ctsvc_query_exec() Fail(%d)", ret);
                        ctsvc_end_trans(false);
                        free(addressbook_ids);
                        return ret;
@@ -409,7 +396,7 @@ static int __ctsvc_db_person_delete_record(int id)
                        version, id);
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -421,7 +408,7 @@ static int __ctsvc_db_person_delete_record(int id)
        snprintf(query, sizeof(query), "DELETE FROM "CTS_TABLE_PERSONS" WHERE person_id = %d", id);
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -433,14 +420,14 @@ static int __ctsvc_db_person_delete_record(int id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
-static int __ctsvc_db_person_get_all_records(int offset, int limit, contacts_list_hout_list)
+static int __ctsvc_db_person_get_all_records(int offset, int limit, contacts_list_h *out_list)
 {
        int ret;
        int len;
@@ -449,21 +436,21 @@ static int __ctsvc_db_person_get_all_records(int offset, int limit, contacts_lis
        contacts_list_h list;
 
        len = snprintf(query, sizeof(query),
-               "SELECT person_id, "
-                               "%s, "
-                               "_NORMALIZE_INDEX_(%s), "
-                               "name_contact_id, "
-                               "image_thumbnail_path, "
-                               "ringtone_path, "
-                               "vibration, "
-                               "message_alert, "
-                               "status, "
-                               "link_count, "
-                               "addressbook_ids, "
-                               "has_phonenumber, "
-                               "has_email, "
-                               "is_favorite "
-               "FROM "CTSVC_DB_VIEW_PERSON,
+                       "SELECT person_id, "
+                       "%s, "
+                       "_NORMALIZE_INDEX_(%s), "
+                       "name_contact_id, "
+                       "image_thumbnail_path, "
+                       "ringtone_path, "
+                       "vibration, "
+                       "message_alert, "
+                       "status, "
+                       "link_count, "
+                       "addressbook_ids, "
+                       "has_phonenumber, "
+                       "has_email, "
+                       "is_favorite "
+                       "FROM "CTSVC_DB_VIEW_PERSON,
                        ctsvc_get_display_column(), ctsvc_get_sort_name_column());
 
        len += snprintf(query+len, sizeof(query)-len, " ORDER BY %s", ctsvc_get_sort_column());
@@ -475,20 +462,20 @@ static int __ctsvc_db_person_get_all_records(int offset, int limit, contacts_lis
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
                }
                ret = ctsvc_db_person_create_record_from_stmt(stmt, &record);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("DB error : ctsvc_db_person_create_record_from_stmt() Fail(%d)", ret);
+                       ERR("ctsvc_db_person_create_record_from_stmt() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -503,7 +490,7 @@ static int __ctsvc_db_person_get_all_records(int offset, int limit, contacts_lis
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_person_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_hout_list)
+static int __ctsvc_db_person_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h *out_list)
 {
        int ret;
        int i;
@@ -515,7 +502,7 @@ static int __ctsvc_db_person_get_records_with_query(contacts_query_h query, int
        char full_path[CTSVC_IMG_FULL_PATH_SIZE_MAX] = {0};
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        ret = ctsvc_db_make_get_records_query_stmt(s_query, offset, limit, &stmt);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_db_make_get_records_query_stmt fail(%d)", ret);
@@ -524,7 +511,7 @@ static int __ctsvc_db_person_get_records_with_query(contacts_query_h query, int
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -532,17 +519,18 @@ static int __ctsvc_db_person_get_records_with_query(contacts_query_h query, int
 
                contacts_record_create(_contacts_person._uri, &record);
                person = (ctsvc_person_s*)record;
-               if (0 == s_query->projection_count)
+               if (0 == s_query->projection_count) {
                        field_count = s_query->property_count;
-               else {
+               else {
                        field_count = s_query->projection_count;
 
-                       if (CONTACTS_ERROR_NONE != ctsvc_record_set_projection_flags(record, s_query->projection, s_query->projection_count, s_query->property_count)) {
+                       int err = ctsvc_record_set_projection_flags(record, s_query->projection,
+                                       s_query->projection_count, s_query->property_count);
+                       if (CONTACTS_ERROR_NONE != err)
                                ASSERT_NOT_REACHED("To set projection is Fail.\n");
-                       }
                }
 
-               for (i=0;i<field_count;i++) {
+               for (i = 0; i < field_count; i++) {
                        char *temp;
                        int property_id;
                        if (0 == s_query->projection_count)
@@ -550,7 +538,7 @@ static int __ctsvc_db_person_get_records_with_query(contacts_query_h query, int
                        else
                                property_id = s_query->projection[i];
 
-                       switch(property_id) {
+                       switch (property_id) {
                        case CTSVC_PROPERTY_PERSON_ID:
                                person->person_id = ctsvc_stmt_get_int(stmt, i);
                                break;
@@ -626,3 +614,20 @@ static int __ctsvc_db_person_get_records_with_query(contacts_query_h query, int
        return CONTACTS_ERROR_NONE;
 }
 
+ctsvc_db_plugin_info_s ctsvc_db_plugin_person = {
+       .is_query_only = false,
+       .insert_record = __ctsvc_db_person_insert_record,
+       .get_record = __ctsvc_db_person_get_record,
+       .update_record = __ctsvc_db_person_update_record,
+       .delete_record = __ctsvc_db_person_delete_record,
+       .get_all_records = __ctsvc_db_person_get_all_records,
+       .get_records_with_query = __ctsvc_db_person_get_records_with_query,
+       .insert_records = NULL,
+       .update_records = NULL,
+       .delete_records = NULL,
+       .get_count = NULL,
+       .get_count_with_query = NULL,
+       .replace_record = NULL,
+       .replace_records = NULL,
+};
+
index a96677e..694cbfd 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -45,11 +45,11 @@ int ctsvc_db_person_create_record_from_stmt_with_projection(cts_stmt stmt, unsig
        person = (ctsvc_person_s*)*record;
 
        int i;
-       for (i=0;i<projection_count;i++) {
+       for (i = 0; i < projection_count; i++) {
                char *temp;
                int property_id = projection[i];
 
-               switch(property_id) {
+               switch (property_id) {
                case CTSVC_PROPERTY_PERSON_ID:
                        person->person_id = ctsvc_stmt_get_int(stmt, i);
                        break;
@@ -113,13 +113,13 @@ int ctsvc_db_person_create_record_from_stmt_with_projection(cts_stmt stmt, unsig
                        break;
                case CTSVC_PROPERTY_PERSON_FAVORITE_PRIORITY:
                        {
-                       /* TODO: Fixme (BS) */
+                               /* TODO: Fixme (BS) */
                                int value = ctsvc_stmt_get_int(stmt, i);
                                value++; /* fix warning */
                        }
                        break;
                default:
-                       ASSERT_NOT_REACHED("Invalid parameter : property_id(0x%0x) is not supported in value(person)", property_id);
+                       ASSERT_NOT_REACHED("property_id(0x%0x) is not supported in value(person)", property_id);
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
        }
@@ -130,28 +130,28 @@ int ctsvc_db_person_create_record_from_stmt_with_projection(cts_stmt stmt, unsig
 int ctsvc_db_person_create_record_from_stmt_with_query(cts_stmt stmt, contacts_query_h query, contacts_record_h *record)
 {
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       ctsvc_query_s *s_query = (ctsvc_query_s *)query;
+       ctsvc_query_s *s_query = (ctsvc_query_s*)query;
 
        if (0 == s_query->projection_count) {
                int i;
                unsigned int *projection = malloc(sizeof(unsigned int)*s_query->property_count);
                if (NULL == projection) {
-                       CTS_ERR("malloc() Fail");
+                       ERR("malloc() Fail");
                        return CONTACTS_ERROR_OUT_OF_MEMORY;
                }
 
-               for (i=0;i<s_query->property_count;i++) {
+               for (i = 0; i < s_query->property_count; i++)
                        projection[i] = s_query->properties[i].property_id;
-               }
 
-               int ret = ctsvc_db_person_create_record_from_stmt_with_projection(stmt, projection, s_query->property_count, record);
+               int ret = ctsvc_db_person_create_record_from_stmt_with_projection(stmt,
+                               projection, s_query->property_count, record);
 
                free(projection);
 
                return ret;
-       }
-       else
+       } else {
                return ctsvc_db_person_create_record_from_stmt_with_projection(stmt, s_query->projection, s_query->projection_count, record);
+       }
 
 }
 
@@ -165,7 +165,7 @@ int ctsvc_db_person_create_record_from_stmt(cts_stmt stmt, contacts_record_h *re
        i = 0;
        ret = contacts_record_create(_contacts_person._uri, record);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "contacts_record_create Fail(%d)", ret);
-       person = (ctsvc_person_s *)*record;
+       person = (ctsvc_person_s*)*record;
        person->person_id = ctsvc_stmt_get_int(stmt, i++);
 
        temp = ctsvc_stmt_get_text(stmt, i++);
@@ -201,13 +201,12 @@ int ctsvc_db_person_create_record_from_stmt(cts_stmt stmt, contacts_record_h *re
        return CONTACTS_ERROR_NONE;
 }
 
-inline static const char* __ctsvc_get_image_filename(const char* src)
+static inline const char* __ctsvc_get_image_filename(const char *src)
 {
-       const chardir = CTSVC_CONTACT_IMG_FULL_LOCATION;
-       int pos=0;
-       while (dir[pos]==src[pos]) {
+       const char *dir = CTSVC_CONTACT_IMG_FULL_LOCATION;
+       int pos = 0;
+       while (dir[pos] == src[pos])
                pos++;
-       }
 
        if ('/' == src[pos])
                return src + pos + 1;
@@ -224,17 +223,16 @@ int ctsvc_db_person_set_favorite(int person_id, bool set, bool propagate)
 
        if (set) {
                snprintf(query, sizeof(query),
-                       "SELECT MAX(favorite_prio) FROM "CTS_TABLE_FAVORITES);
+                               "SELECT MAX(favorite_prio) FROM "CTS_TABLE_FAVORITES);
 
                ret = ctsvc_query_prepare(query, &stmt);
-               RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
                ret = ctsvc_stmt_step(stmt);
                if (1 /*CTS_TRUE*/ == ret) {
                        prio = ctsvc_stmt_get_dbl(stmt, 0);
-               }
-               else if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               } else if (CONTACTS_ERROR_NONE != ret) {
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        return ret;
                }
@@ -242,29 +240,28 @@ int ctsvc_db_person_set_favorite(int person_id, bool set, bool propagate)
 
                prio = prio + 1.0;
                snprintf(query, sizeof(query),
-                       "INSERT OR REPLACE INTO "CTS_TABLE_FAVORITES" values(%d, %f)", person_id, prio);
-       }
-       else {
+                               "INSERT OR REPLACE INTO "CTS_TABLE_FAVORITES" values(%d, %f)", person_id, prio);
+       } else {
                snprintf(query, sizeof(query),
-                       "DELETE FROM "CTS_TABLE_FAVORITES" WHERE person_id = %d", person_id);
+                               "DELETE FROM "CTS_TABLE_FAVORITES" WHERE person_id = %d", person_id);
        }
 
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                return ret;
        }
 
        if (propagate) {
                snprintf(query, sizeof(query),
-                        "UPDATE "CTS_TABLE_CONTACTS" SET is_favorite=%d, "
-                        "changed_time=%d, changed_ver=%d WHERE "
-                        "person_id=%d AND deleted = 0",
-                        set ? 1 : 0, (int)time(NULL), ctsvc_get_next_ver(),
-                        person_id);
+                               "UPDATE "CTS_TABLE_CONTACTS" SET is_favorite=%d, "
+                               "changed_time=%d, changed_ver=%d WHERE "
+                               "person_id=%d AND deleted = 0",
+                               set ? 1 : 0, (int)time(NULL), ctsvc_get_next_ver(),
+                               person_id);
                ret = ctsvc_query_exec(query);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+                       ERR("ctsvc_query_exec() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -282,12 +279,12 @@ int ctsvc_db_insert_person(contacts_record_h record)
        char *status = NULL;
 
        snprintf(query, sizeof(query),
-               "SELECT status FROM %s "
-               "WHERE contact_id=%d "
-               "ORDER BY timestamp DESC LIMIT 1",
-               CTS_TABLE_ACTIVITIES, contact->id);
+                       "SELECT status FROM %s "
+                       "WHERE contact_id=%d "
+                       "ORDER BY timestamp DESC LIMIT 1",
+                       CTS_TABLE_ACTIVITIES, contact->id);
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        if (1 == ctsvc_stmt_step(stmt))
                status = SAFE_STRDUP(ctsvc_stmt_get_text(stmt, 0));
@@ -295,7 +292,7 @@ int ctsvc_db_insert_person(contacts_record_h record)
 
        version = ctsvc_get_next_ver();
        snprintf(query, sizeof(query),
-               "INSERT INTO "CTS_TABLE_PERSONS"(name_contact_id, created_ver, changed_ver, "
+                       "INSERT INTO "CTS_TABLE_PERSONS"(name_contact_id, created_ver, changed_ver, "
                        "has_phonenumber, has_email, ringtone_path, vibration, message_alert, status, "
                        "image_thumbnail_path, link_count, addressbook_ids) "
                        "VALUES(%d, %d, %d, %d, %d, ?, ?, ?, ?, ?, 1, '%d') ",
@@ -304,7 +301,7 @@ int ctsvc_db_insert_person(contacts_record_h record)
 
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                free(status);
                return ret;
        }
@@ -316,12 +313,14 @@ int ctsvc_db_insert_person(contacts_record_h record)
                ctsvc_stmt_bind_text(stmt, 3, contact->message_alert);
        if (status)
                ctsvc_stmt_bind_text(stmt, 4, status);
-       if (contact->image_thumbnail_path)
-               ctsvc_stmt_bind_text(stmt, 5, __ctsvc_get_image_filename(contact->image_thumbnail_path));
+       if (contact->image_thumbnail_path) {
+               ctsvc_stmt_bind_text(stmt, 5,
+                               __ctsvc_get_image_filename(contact->image_thumbnail_path));
+       }
 
        ret = ctsvc_stmt_step(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                free(status);
                return ret;
@@ -331,12 +330,12 @@ int ctsvc_db_insert_person(contacts_record_h record)
        ctsvc_stmt_finalize(stmt);
 
        snprintf(query, sizeof(query),
-               "UPDATE "CTS_TABLE_DATA" SET is_primary_default = 1 "
+                       "UPDATE "CTS_TABLE_DATA" SET is_primary_default = 1 "
                        "WHERE is_default = 1 AND contact_id = %d  AND is_my_profile = 0", contact->id);
 
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                free(status);
                return ret;
        }
@@ -345,7 +344,7 @@ int ctsvc_db_insert_person(contacts_record_h record)
        if (contact->is_favorite) {
                ret = ctsvc_db_person_set_favorite(index, contact->is_favorite, false);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_db_person_set_favorite() Fail(%d)", ret);
+                       ERR("ctsvc_db_person_set_favorite() Fail(%d)", ret);
                        return ret;
                }
        }
@@ -368,33 +367,33 @@ static inline int __ctsvc_db_update_person_default(int person_id, int datatype)
        char *image_thumbnail_path = NULL;
 
        snprintf(query, sizeof(query),
-               "SELECT D.id FROM "CTS_TABLE_CONTACTS" C, "CTS_TABLE_DATA" D "
-               "ON C.contact_id = D.contact_id AND C.deleted = 0 "
-               "WHERE C.person_id=%d AND D.datatype=%d AND is_primary_default=1 AND D.is_my_profile = 0",
-               person_id, datatype);
+                       "SELECT D.id FROM "CTS_TABLE_CONTACTS" C, "CTS_TABLE_DATA" D "
+                       "ON C.contact_id = D.contact_id AND C.deleted = 0 "
+                       "WHERE C.person_id=%d AND D.datatype=%d AND is_primary_default=1 AND D.is_my_profile = 0",
+                       person_id, datatype);
 
        ret = ctsvc_query_get_first_int_result(query, &data_id);
        if (CONTACTS_ERROR_NO_DATA == ret) {
                snprintf(query, sizeof(query),
-                       "SELECT D.id, D.data3 FROM "CTS_TABLE_CONTACTS" C, "CTS_TABLE_DATA" D "
-                       "ON C.contact_id = D.contact_id AND C.deleted = 0 "
-                       "WHERE C.person_id=%d AND D.datatype=%d AND D.is_default=1 AND D.is_my_profile = 0 ORDER BY D.id",
-                       person_id, datatype);
+                               "SELECT D.id, D.data3 FROM "CTS_TABLE_CONTACTS" C, "CTS_TABLE_DATA" D "
+                               "ON C.contact_id = D.contact_id AND C.deleted = 0 "
+                               "WHERE C.person_id=%d AND D.datatype=%d AND D.is_default=1 AND D.is_my_profile = 0 ORDER BY D.id",
+                               person_id, datatype);
 
                ret = ctsvc_query_prepare(query, &stmt);
-               RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
                ret = ctsvc_stmt_step(stmt);
                if (1 == ret) {
                        data_id = ctsvc_stmt_get_int(stmt, 0);
 
                        snprintf(query, sizeof(query),
-                                       "UPDATE "CTS_TABLE_DATA" SET is_primary_default=1 WHERE id=%d"
-                                       ,data_id);
+                                       "UPDATE "CTS_TABLE_DATA" SET is_primary_default=1 WHERE id=%d",
+                                       data_id);
 
                        ret = ctsvc_query_exec(query);
                        if (CONTACTS_ERROR_NONE != ret) {
-                               CTS_ERR("ctsvc_query_exec Fail(%d)", ret);
+                               ERR("ctsvc_query_exec() Fail(%d)", ret);
                                ctsvc_stmt_finalize(stmt);
                                return ret;
                        }
@@ -408,18 +407,17 @@ static inline int __ctsvc_db_update_person_default(int person_id, int datatype)
                                snprintf(query, sizeof(query),
                                                "UPDATE "CTS_TABLE_PERSONS" SET image_thumbnail_path=? WHERE person_id=%d", person_id);
                                ret = ctsvc_query_prepare(query, &stmt);
-                               RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+                               RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
                                ctsvc_stmt_bind_text(stmt, 1, image_thumbnail_path);
                                ret = ctsvc_stmt_step(stmt);
                                ctsvc_stmt_finalize(stmt);
                                free(image_thumbnail_path);
                                if (CONTACTS_ERROR_NONE != ret) {
-                                       CTS_ERR("ctsvc_stmt_step Fail(%d)", ret);
+                                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                                        return ret;
                                }
                        }
-               }
-               else {
+               } else {
                        free(image_thumbnail_path);
                }
        }
@@ -434,9 +432,9 @@ static bool __ctsvc_get_has_column(int person_id, const char *culumn)
        char query[CTS_SQL_MIN_LEN] = {0};
 
        snprintf(query, sizeof(query),
-                               "SELECT count(contact_id) FROM "CTS_TABLE_CONTACTS" "
-                               "WHERE person_id=%d AND %s=1 AND deleted = 0",
-                               person_id, culumn);
+                       "SELECT count(contact_id) FROM "CTS_TABLE_CONTACTS" "
+                       "WHERE person_id=%d AND %s=1 AND deleted = 0",
+                       person_id, culumn);
 
        ret = ctsvc_query_get_first_int_result(query, &contact_count);
        RETV_IF(CONTACTS_ERROR_NONE != ret, false);
@@ -464,11 +462,11 @@ static int __ctsvc_get_thumbnail_contact_id(int person_id)
 
 int ctsvc_db_update_person(contacts_record_h record)
 {
-       int ret, i=1, len=0;
+       int ret, i = 1, len = 0;
        cts_stmt stmt = NULL;
        char query[CTS_SQL_MIN_LEN] = {0};
        ctsvc_contact_s *contact = (ctsvc_contact_s*)record;
-       bool has_phonenumber=false, has_email=false;
+       bool has_phonenumber = false, has_email = false;
        int thumbnail_contact_id = 0;
        int person_id = 0;
        int is_favorite = 0;
@@ -488,13 +486,13 @@ int ctsvc_db_update_person(contacts_record_h record)
                        "UPDATE "CTS_TABLE_PERSONS" SET changed_ver=%d, has_phonenumber=%d, has_email=%d ",
                        ctsvc_get_next_ver(), has_phonenumber, has_email);
 
-       if (ctsvc_record_check_property_flag((ctsvc_record_s *)record, _contacts_contact.ringtone_path, CTSVC_PROPERTY_FLAG_DIRTY))
+       if (ctsvc_record_check_property_flag((ctsvc_record_s*)record, _contacts_contact.ringtone_path, CTSVC_PROPERTY_FLAG_DIRTY))
                len += snprintf(query+len, sizeof(query)-len, ", ringtone_path=?");
-       if (ctsvc_record_check_property_flag((ctsvc_record_s *)record, _contacts_contact.vibration, CTSVC_PROPERTY_FLAG_DIRTY))
+       if (ctsvc_record_check_property_flag((ctsvc_record_s*)record, _contacts_contact.vibration, CTSVC_PROPERTY_FLAG_DIRTY))
                len += snprintf(query+len, sizeof(query)-len, ", vibration=?");
-       if (ctsvc_record_check_property_flag((ctsvc_record_s *)record, _contacts_contact.message_alert, CTSVC_PROPERTY_FLAG_DIRTY))
+       if (ctsvc_record_check_property_flag((ctsvc_record_s*)record, _contacts_contact.message_alert, CTSVC_PROPERTY_FLAG_DIRTY))
                len += snprintf(query+len, sizeof(query)-len, ", message_alert=?");
-       if (ctsvc_record_check_property_flag((ctsvc_record_s *)record, _contacts_contact.image_thumbnail_path, CTSVC_PROPERTY_FLAG_DIRTY) &&
+       if (ctsvc_record_check_property_flag((ctsvc_record_s*)record, _contacts_contact.image_thumbnail_path, CTSVC_PROPERTY_FLAG_DIRTY) &&
                        (contact->id == thumbnail_contact_id || thumbnail_contact_id == -1))
                len += snprintf(query+len, sizeof(query)-len, ", image_thumbnail_path=?");
 
@@ -503,27 +501,27 @@ int ctsvc_db_update_person(contacts_record_h record)
 
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
-       if (ctsvc_record_check_property_flag((ctsvc_record_s *)record, _contacts_contact.ringtone_path, CTSVC_PROPERTY_FLAG_DIRTY)) {
+       if (ctsvc_record_check_property_flag((ctsvc_record_s*)record, _contacts_contact.ringtone_path, CTSVC_PROPERTY_FLAG_DIRTY)) {
                if (contact->ringtone_path)
                        ctsvc_stmt_bind_text(stmt, i, contact->ringtone_path);
                i++;
        }
-       if (ctsvc_record_check_property_flag((ctsvc_record_s *)record, _contacts_contact.vibration, CTSVC_PROPERTY_FLAG_DIRTY)) {
+       if (ctsvc_record_check_property_flag((ctsvc_record_s*)record, _contacts_contact.vibration, CTSVC_PROPERTY_FLAG_DIRTY)) {
                if (contact->vibration)
                        ctsvc_stmt_bind_text(stmt, i, contact->vibration);
                i++;
        }
-       if (ctsvc_record_check_property_flag((ctsvc_record_s *)record, _contacts_contact.message_alert, CTSVC_PROPERTY_FLAG_DIRTY)) {
+       if (ctsvc_record_check_property_flag((ctsvc_record_s*)record, _contacts_contact.message_alert, CTSVC_PROPERTY_FLAG_DIRTY)) {
                if (contact->message_alert)
                        ctsvc_stmt_bind_text(stmt, i, contact->message_alert);
                i++;
        }
-       if (ctsvc_record_check_property_flag((ctsvc_record_s *)record, _contacts_contact.image_thumbnail_path, CTSVC_PROPERTY_FLAG_DIRTY) &&
+       if (ctsvc_record_check_property_flag((ctsvc_record_s*)record, _contacts_contact.image_thumbnail_path, CTSVC_PROPERTY_FLAG_DIRTY) &&
                        (contact->id == thumbnail_contact_id || thumbnail_contact_id == -1)) {
                if (contact->image_thumbnail_path)
                        ctsvc_stmt_bind_text(stmt, i, contact->image_thumbnail_path);
@@ -532,7 +530,7 @@ int ctsvc_db_update_person(contacts_record_h record)
 
        ret = ctsvc_stmt_step(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                return ret;
@@ -544,7 +542,7 @@ int ctsvc_db_update_person(contacts_record_h record)
                        "SELECT is_favorite FROM "CTS_TABLE_CONTACTS" WHERE contact_id =%d ", contact->id);
        ret = ctsvc_query_get_first_int_result(query, &is_favorite);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
+               ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -555,31 +553,28 @@ int ctsvc_db_update_person(contacts_record_h record)
        if (CONTACTS_ERROR_NO_DATA == ret && is_favorite) {
                ret = ctsvc_db_person_set_favorite(contact->person_id, true, false);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_db_person_set_favorite() Fail(%d)", ret);
+                       ERR("ctsvc_db_person_set_favorite() Fail(%d)", ret);
                        ctsvc_end_trans(false);
                        return ret;
                }
-       }
-       else if (CONTACTS_ERROR_NONE == ret && false == 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);
+                               "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);
                if (CONTACTS_ERROR_NO_DATA == ret) {
                        ret = ctsvc_db_person_set_favorite(contact->person_id, false, false);
                        if (CONTACTS_ERROR_NONE != ret) {
-                               CTS_ERR("ctsvc_db_person_set_favorite() Fail(%d)", ret);
+                               ERR("ctsvc_db_person_set_favorite() Fail(%d)", ret);
                                ctsvc_end_trans(false);
                                return ret;
                        }
-               }
-               else if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
+               } else if (CONTACTS_ERROR_NONE != ret) {
+                       ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                        ctsvc_end_trans(false);
                        return ret;
                }
-       }
-       else if (ret < CONTACTS_ERROR_NONE && CONTACTS_ERROR_NO_DATA != ret) {
-               CTS_ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
+       } else if (ret < CONTACTS_ERROR_NONE && CONTACTS_ERROR_NO_DATA != ret) {
+               ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -592,16 +587,16 @@ int ctsvc_db_update_person(contacts_record_h record)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
 /* This function will return group letter of the person */
-void ctsvc_db_normalize_str_callback(sqlite3_context context,
-               int argc, sqlite3_value ** argv)
+void ctsvc_db_normalize_str_callback(sqlite3_context  *context,
+               int argc, sqlite3_value **argv)
 {
        const char *display_name;
        int display_name_language = CTSVC_LANG_OTHERS;
@@ -615,15 +610,14 @@ void ctsvc_db_normalize_str_callback(sqlite3_context * context,
        if (display_name_language == CTSVC_SORT_OTHERS || display_name_language == CTSVC_SORT_NUMBER) {
                sqlite3_result_text(context, "#", 1, SQLITE_TRANSIENT);
                return;
-       }
-       else {
+       } else {
                display_name = (const char *)sqlite3_value_text(argv[0]);
                if (display_name) {
                        int ret;
                        char *dest = NULL;
                        ret = ctsvc_normalize_index(display_name, &dest);
                        if (ret < CONTACTS_ERROR_NONE) {
-                               CTS_ERR("ctsvc_normalize_index() Fail(%d)", ret);
+                               ERR("ctsvc_normalize_index() Fail(%d)", ret);
                                sqlite3_result_null(context);
                                return;
                        }
index 910115e..aef48a7 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #ifndef __CTSVC_DB_PLUGIN_PERSON_HELPER_H__
 #define __CTSVC_DB_PLUGIN_PERSON_HELPER_H__
 
 int ctsvc_db_insert_person(contacts_record_h contact);
 int ctsvc_db_update_person(contacts_record_h contact);
 int ctsvc_db_person_create_record_from_stmt(cts_stmt stmt, contacts_record_h *record);
-int ctsvc_db_person_create_record_from_stmt_with_query(cts_stmt stmt, contacts_query_h query, contacts_record_h *record);
-int ctsvc_db_person_create_record_from_stmt_with_projection(cts_stmt stmt, unsigned int *projection, int projection_count, contacts_record_h *record);
-void ctsvc_db_normalize_str_callback(sqlite3_context * context,        int argc, sqlite3_value ** argv);
+int ctsvc_db_person_create_record_from_stmt_with_query(cts_stmt stmt,
+               contacts_query_h query, contacts_record_h *record);
+int ctsvc_db_person_create_record_from_stmt_with_projection(cts_stmt stmt,
+               unsigned int *projection, int projection_count, contacts_record_h *record);
+void ctsvc_db_normalize_str_callback(sqlite3_context  *context,        int argc,
+               sqlite3_value **argv);
 int ctsvc_db_person_set_favorite(int person_id, bool set, bool propagate);
 
 #endif /* __CTSVC_DB_PLUGIN_PERSON_HELPER_H__ */
index e245028..3b42c24 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
 #include "ctsvc_server_sim.h"
 #endif /* _CONTACTS_IPC_SERVER */
 
-static int __ctsvc_db_phonelog_insert_record(contacts_record_h record, int *id);
-static int __ctsvc_db_phonelog_get_record(int id, contacts_record_h* out_record);
-static int __ctsvc_db_phonelog_update_record(contacts_record_h record);
-static int __ctsvc_db_phonelog_delete_record(int id);
-static int __ctsvc_db_phonelog_get_all_records(int offset, int limit, contacts_list_h* out_list);
-static int __ctsvc_db_phonelog_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h* out_list);
-
-ctsvc_db_plugin_info_s ctsvc_db_plugin_phonelog = {
-       .is_query_only = false,
-       .insert_record = __ctsvc_db_phonelog_insert_record,
-       .get_record = __ctsvc_db_phonelog_get_record,
-       .update_record = __ctsvc_db_phonelog_update_record,
-       .delete_record = __ctsvc_db_phonelog_delete_record,
-       .get_all_records = __ctsvc_db_phonelog_get_all_records,
-       .get_records_with_query = __ctsvc_db_phonelog_get_records_with_query,
-       .insert_records = NULL,
-       .update_records = NULL,
-       .delete_records = NULL,
-       .get_count = NULL,
-       .get_count_with_query = NULL,
-       .replace_record = NULL,
-       .replace_records = NULL,
-};
 
 static int __ctsvc_db_phonelog_value_set(cts_stmt stmt, contacts_record_h *record)
 {
@@ -91,7 +68,7 @@ static int __ctsvc_db_phonelog_value_set(cts_stmt stmt, contacts_record_h *recor
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_phonelog_get_record(int id, contacts_record_hout_record)
+static int __ctsvc_db_phonelog_get_record(int id, contacts_record_h *out_record)
 {
        int ret;
        cts_stmt stmt = NULL;
@@ -106,11 +83,11 @@ static int __ctsvc_db_phonelog_get_record(int id, contacts_record_h* out_record)
                        "FROM "CTS_TABLE_PHONELOGS" WHERE id = %d", id);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/ != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
@@ -122,7 +99,7 @@ static int __ctsvc_db_phonelog_get_record(int id, contacts_record_h* out_record)
 
        ctsvc_stmt_finalize(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("__ctsvc_db_phonelog_value_set(ALL) Fail(%d)", ret);
+               ERR("__ctsvc_db_phonelog_value_set(ALL) Fail(%d)", ret);
                return ret;
        }
 
@@ -135,18 +112,18 @@ static int __ctsvc_db_phonelog_update_record(contacts_record_h record)
 {
        int phonelog_id;
        char query[CTS_SQL_MIN_LEN] = {0};
-       ctsvc_phonelog_s *phonelog = (ctsvc_phonelog_s *)record;
+       ctsvc_phonelog_s *phonelog = (ctsvc_phonelog_s*)record;
        int ret = CONTACTS_ERROR_NONE;
-       charset = NULL;
+       char *set = NULL;
        GSList *bind_text = NULL;
        GSList *cursor = NULL;
 
-       RETVM_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : record is null");
+       RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
        RETVM_IF(phonelog->id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : The phone_log has ID(%d)", phonelog->id);
+                       "The phone_log has ID(%d)", phonelog->id);
        RETVM_IF(phonelog->log_type != CONTACTS_PLOG_TYPE_VOICE_INCOMMING_SEEN &&
                        phonelog->log_type != CONTACTS_PLOG_TYPE_VIDEO_INCOMMING_SEEN, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : the type is can not updated(%d)", phonelog->log_type);
+                       "the type is can not updated(%d)", phonelog->log_type);
        RETVM_IF(CTSVC_PROPERTY_FLAG_DIRTY != (phonelog->base.property_flag & CTSVC_PROPERTY_FLAG_DIRTY), CONTACTS_ERROR_NONE, "No update");
 
        ret = ctsvc_begin_trans();
@@ -156,7 +133,7 @@ static int __ctsvc_db_phonelog_update_record(contacts_record_h record)
                        "SELECT id FROM "CTS_TABLE_PHONELOGS" WHERE id = %d", phonelog->id);
        ret = ctsvc_query_get_first_int_result(query, &phonelog_id);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_query_get_first_int_result Fail(%d)", ret);
+               ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -174,16 +151,19 @@ static int __ctsvc_db_phonelog_update_record(contacts_record_h record)
                }
        } while (0);
 
-       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s *)record);
-       CONTACTS_FREE(set);
+       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s*)record);
+       free(set);
+
        if (bind_text) {
-               for (cursor=bind_text;cursor;cursor=cursor->next)
-                       CONTACTS_FREE(cursor->data);
+               for (cursor = bind_text; cursor; cursor = cursor->next) {
+                       free(cursor->data);
+                       cursor->data = NULL;
+               }
                g_slist_free(bind_text);
        }
 
        ret = ctsvc_end_trans(true);
-       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "DB error : ctsvc_end_trans() Fail(%d)", ret);
+       RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "ctsvc_end_trans() Fail(%d)", ret);
 
        return CONTACTS_ERROR_NONE;
 }
@@ -201,7 +181,7 @@ static int __ctsvc_db_phonelog_delete_record(int id)
                        "SELECT id FROM "CTS_TABLE_PHONELOGS" WHERE id = %d", id);
        ret = ctsvc_query_get_first_int_result(query, &phonelog_id);
        if (ret != CONTACTS_ERROR_NONE) {
-               CTS_ERR("ctsvc_query_get_first_int_result Fail(%d)", ret);
+               ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -211,7 +191,7 @@ static int __ctsvc_db_phonelog_delete_record(int id)
 
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -220,15 +200,15 @@ static int __ctsvc_db_phonelog_delete_record(int id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
 static int __ctsvc_db_phonelog_get_all_records(int offset, int limit,
-               contacts_list_hout_list)
+               contacts_list_h *out_list)
 {
        int ret;
        int len;
@@ -238,7 +218,7 @@ static int __ctsvc_db_phonelog_get_all_records(int offset, int limit,
 
        len = snprintf(query, sizeof(query),
                        "SELECT id, number, person_id, log_type, log_time, data1, data2, sim_id "
-                                       "FROM "CTS_TABLE_PHONELOGS);
+                       "FROM "CTS_TABLE_PHONELOGS);
 
        if (0 != limit) {
                len += snprintf(query+len, sizeof(query)-len, " LIMIT %d", limit);
@@ -247,13 +227,13 @@ static int __ctsvc_db_phonelog_get_all_records(int offset, int limit,
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -270,7 +250,7 @@ static int __ctsvc_db_phonelog_get_all_records(int offset, int limit,
 }
 
 static int __ctsvc_db_phonelog_get_records_with_query(contacts_query_h query, int offset,
-               int limit, contacts_list_hout_list)
+               int limit, contacts_list_h *out_list)
 {
        int ret;
        int i;
@@ -281,7 +261,7 @@ static int __ctsvc_db_phonelog_get_records_with_query(contacts_query_h query, in
        ctsvc_phonelog_s *phonelog;
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        ret = ctsvc_db_make_get_records_query_stmt(s_query, offset, limit, &stmt);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_db_make_get_records_query_stmt fail(%d)", ret);
@@ -290,7 +270,7 @@ static int __ctsvc_db_phonelog_get_records_with_query(contacts_query_h query, in
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -298,17 +278,18 @@ static int __ctsvc_db_phonelog_get_records_with_query(contacts_query_h query, in
 
                contacts_record_create(_contacts_phone_log._uri, &record);
                phonelog = (ctsvc_phonelog_s*)record;
-               if (0 == s_query->projection_count)
+               if (0 == s_query->projection_count) {
                        field_count = s_query->property_count;
-               else {
+               else {
                        field_count = s_query->projection_count;
 
-                       if (CONTACTS_ERROR_NONE != ctsvc_record_set_projection_flags(record, s_query->projection, s_query->projection_count, s_query->property_count)) {
+                       int err = ctsvc_record_set_projection_flags(record, s_query->projection,
+                                       s_query->projection_count, s_query->property_count);
+                       if (CONTACTS_ERROR_NONE != err)
                                ASSERT_NOT_REACHED("To set projection is Fail.\n");
-                       }
                }
 
-               for (i=0;i<field_count;i++) {
+               for (i = 0; i < field_count; i++) {
                        char *temp;
                        int property_id;
                        if (0 == s_query->projection_count)
@@ -316,7 +297,7 @@ static int __ctsvc_db_phonelog_get_records_with_query(contacts_query_h query, in
                        else
                                property_id = s_query->projection[i];
 
-                       switch(property_id) {
+                       switch (property_id) {
                        case CTSVC_PROPERTY_PHONELOG_ID:
                                phonelog->id = ctsvc_stmt_get_int(stmt, i);
                                break;
@@ -367,7 +348,7 @@ static int __ctsvc_db_phonelog_increase_used_count(ctsvc_phonelog_s *phonelog)
        int type = CONTACTS_USAGE_STAT_TYPE_NONE;
        char query[CTS_SQL_MIN_LEN] = {0};
 
-       switch(phonelog->log_type) {
+       switch (phonelog->log_type) {
        case CONTACTS_PLOG_TYPE_VOICE_OUTGOING:
        case CONTACTS_PLOG_TYPE_VIDEO_OUTGOING:
                type = CONTACTS_USAGE_STAT_TYPE_OUTGOING_CALL;
@@ -409,15 +390,14 @@ static int __ctsvc_db_phonelog_increase_used_count(ctsvc_phonelog_s *phonelog)
                snprintf(query, sizeof(query),
                                "INSERT INTO %s(person_id, usage_type, times_used) VALUES(%d, %d, 1)",
                                CTS_TABLE_CONTACT_STAT, phonelog->person_id, type);
-       }
-       else {
+       } else {
                snprintf(query, sizeof(query),
                                "UPDATE %s SET times_used = times_used + 1 WHERE person_id = %d and usage_type = %d",
                                CTS_TABLE_CONTACT_STAT, phonelog->person_id, type);
        }
 
        ret = ctsvc_query_exec(query);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_exec() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_exec() Fail(%d)", ret);
 
        return CONTACTS_ERROR_NONE;
 }
@@ -429,7 +409,7 @@ static int  __ctsvc_db_phonelog_insert(ctsvc_phonelog_s *phonelog, int *id)
        char query[CTS_SQL_MAX_LEN] = {0};
 
        RETVM_IF((phonelog->log_type < CONTACTS_PLOG_TYPE_NONE
-                       || CONTACTS_PLOG_TYPE_EMAIL_SENT < phonelog->log_type)
+                               || CONTACTS_PLOG_TYPE_EMAIL_SENT < phonelog->log_type)
                        , CONTACTS_ERROR_INVALID_PARAMETER, "phonelog type(%d) is invaid", phonelog->log_type);
 
        snprintf(query, sizeof(query), "INSERT INTO "CTS_TABLE_PHONELOGS"("
@@ -438,7 +418,7 @@ static int  __ctsvc_db_phonelog_insert(ctsvc_phonelog_s *phonelog, int *id)
                        phonelog->log_type, phonelog->log_time, phonelog->extra_data1);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        if (phonelog->address) {
                ctsvc_stmt_bind_text(stmt, 1, phonelog->address);
@@ -470,13 +450,13 @@ static int  __ctsvc_db_phonelog_insert(ctsvc_phonelog_s *phonelog, int *id)
                sim_info_id = ctsvc_server_sim_get_info_id_by_sim_slot_no(phonelog->sim_slot_no);
                if (0 < sim_info_id)
                        ctsvc_stmt_bind_int(stmt, 7, sim_info_id);
-       }
-       else
+       } else {
                ctsvc_stmt_bind_int(stmt, 7, -1);
+       }
 
        ret = ctsvc_stmt_step(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                return ret;
        }
@@ -494,18 +474,18 @@ static int  __ctsvc_db_phonelog_insert(ctsvc_phonelog_s *phonelog, int *id)
 static int __ctsvc_db_phonelog_insert_record(contacts_record_h record, int *id)
 {
        int ret;
-       ctsvc_phonelog_s *phonelog = (ctsvc_phonelog_s *)record;
+       ctsvc_phonelog_s *phonelog = (ctsvc_phonelog_s*)record;
 
-       RETVM_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : record is null");
+       RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
        RETVM_IF(phonelog->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : The phone_log has ID(%d)", phonelog->id);
+                       "The phone_log has ID(%d)", phonelog->id);
 
        ret = ctsvc_begin_trans();
        RETVM_IF(ret, ret, "ctsvc_begin_trans() Fail(%d)", ret);
 
        ret = __ctsvc_db_phonelog_insert(phonelog, id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("__ctsvc_db_phonelog_insert() Fail(%d)", ret);
+               ERR("__ctsvc_db_phonelog_insert() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -522,9 +502,26 @@ static int __ctsvc_db_phonelog_insert_record(contacts_record_h record, int *id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
        }
        return CONTACTS_ERROR_NONE;
 }
 
+ctsvc_db_plugin_info_s ctsvc_db_plugin_phonelog = {
+       .is_query_only = false,
+       .insert_record = __ctsvc_db_phonelog_insert_record,
+       .get_record = __ctsvc_db_phonelog_get_record,
+       .update_record = __ctsvc_db_phonelog_update_record,
+       .delete_record = __ctsvc_db_phonelog_delete_record,
+       .get_all_records = __ctsvc_db_phonelog_get_all_records,
+       .get_records_with_query = __ctsvc_db_phonelog_get_records_with_query,
+       .insert_records = NULL,
+       .update_records = NULL,
+       .delete_records = NULL,
+       .get_count = NULL,
+       .get_count_with_query = NULL,
+       .replace_record = NULL,
+       .replace_records = NULL,
+};
+
index 2f590a2..64a20d0 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
 #include "ctsvc_list.h"
 #include "ctsvc_notification.h"
 
-static int __ctsvc_db_profile_insert_record(contacts_record_h record, int *id);
-static int __ctsvc_db_profile_get_record(int id, contacts_record_h* out_record);
-static int __ctsvc_db_profile_update_record(contacts_record_h record);
-static int __ctsvc_db_profile_delete_record(int id);
-static int __ctsvc_db_profile_get_all_records(int offset, int limit, contacts_list_h* out_list);
-static int __ctsvc_db_profile_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h* out_list);
-
-ctsvc_db_plugin_info_s ctsvc_db_plugin_profile = {
-       .is_query_only = false,
-       .insert_record = __ctsvc_db_profile_insert_record,
-       .get_record = __ctsvc_db_profile_get_record,
-       .update_record = __ctsvc_db_profile_update_record,
-       .delete_record = __ctsvc_db_profile_delete_record,
-       .get_all_records = __ctsvc_db_profile_get_all_records,
-       .get_records_with_query = __ctsvc_db_profile_get_records_with_query,
-       .insert_records = NULL,
-       .update_records = NULL,
-       .delete_records = NULL,
-       .get_count = NULL,
-       .get_count_with_query = NULL,
-       .replace_record = NULL,
-       .replace_records = NULL,
-};
 
 static int __ctsvc_db_profile_insert_record(contacts_record_h record, int *id)
 {
        int ret;
        int addressbook_id;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_profile_s *profile = (ctsvc_profile_s *)record;
+       ctsvc_profile_s *profile = (ctsvc_profile_s*)record;
 
-       RETVM_IF(NULL == profile->text, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : profile text is NULL");
+       RETV_IF(NULL == profile->text, CONTACTS_ERROR_INVALID_PARAMETER);
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -77,31 +53,30 @@ static int __ctsvc_db_profile_insert_record(contacts_record_h record, int *id)
        if (CONTACTS_ERROR_NONE != ret) {
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NO_DATA == ret) {
-                       CTS_ERR("No data : contact_id (%d) is not exist", profile->contact_id);
+                       ERR("No data : contact_id (%d) is not exist", profile->contact_id);
                        return CONTACTS_ERROR_INVALID_PARAMETER;
-               }
-               else {
-                       CTS_ERR("ctsvc_query_get_first_int_result Fail(%d)", ret);
+               } else {
+                       ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                        return ret;
                }
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this profile record : addressbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this profile record : addressbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_profile_insert(record, profile->contact_id, false, id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_db_contact_update_changed_time(profile->contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -109,14 +84,14 @@ static int __ctsvc_db_profile_insert_record(contacts_record_h record, int *id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
-static int __ctsvc_db_profile_get_record(int id, contacts_record_hout_record)
+static int __ctsvc_db_profile_get_record(int id, contacts_record_h *out_record)
 {
        int ret;
        cts_stmt stmt = NULL;
@@ -127,18 +102,18 @@ static int __ctsvc_db_profile_get_record(int id, contacts_record_h* out_record)
 
        snprintf(query, sizeof(query),
                        "SELECT id, data.contact_id, is_default, data1, data2, "
-                               "data3, data4, data5, data6, data7, data8, data9, data10, data11, data12 "
-                               "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                               "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                               "WHERE id = %d AND datatype = %d ",
-                               id, CTSVC_DATA_PROFILE);
+                       "data3, data4, data5, data6, data7, data8, data9, data10, data11, data12 "
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE id = %d AND datatype = %d ",
+                       id, CTSVC_DATA_PROFILE);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/ != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
@@ -158,12 +133,12 @@ static int __ctsvc_db_profile_update_record(contacts_record_h record)
        int ret;
        int addressbook_id;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_profile_s *profile = (ctsvc_profile_s *)record;
+       ctsvc_profile_s *profile = (ctsvc_profile_s*)record;
        RETVM_IF(NULL == profile->text, CONTACTS_ERROR_INVALID_PARAMETER, "profile text is empty");
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -171,27 +146,27 @@ static int __ctsvc_db_profile_update_record(contacts_record_h record)
                        "SELECT addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", profile->contact_id);
        ret = ctsvc_query_get_first_int_result(query, &addressbook_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("No data : contact_id (%d) is not exist", profile->contact_id);
+               ERR("No data : contact_id (%d) is not exist", profile->contact_id);
                ctsvc_end_trans(false);
                return ret;
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this profile record : addressbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this profile record : addressbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_profile_update(record, false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("Update record Fail(%d)", ret);
+               ERR("Update record Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_db_contact_update_changed_time(profile->contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -199,11 +174,11 @@ static int __ctsvc_db_profile_update_record(contacts_record_h record)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
 static int __ctsvc_db_profile_delete_record(int id)
@@ -216,22 +191,22 @@ static int __ctsvc_db_profile_delete_record(int id)
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
        snprintf(query, sizeof(query),
                        "SELECT contact_id, addressbook_id FROM "CTSVC_DB_VIEW_CONTACT " "
-                               "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id);
+                       "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id);
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare Fail(%d", ret);
+               ERR("ctsvc_query_prepare Fail(%d", ret);
                ctsvc_end_trans(false);
                return ret;
        }
        ret = ctsvc_stmt_step(stmt);
        if (1 != ret) {
-               CTS_ERR("The id(%d) is Invalid(%d)", id, ret);
+               ERR("The id(%d) is Invalid(%d)", id, ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NONE == ret)
@@ -245,21 +220,21 @@ static int __ctsvc_db_profile_delete_record(int id)
        ctsvc_stmt_finalize(stmt);
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to delete this profile record : addressbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to delete this profile record : addressbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_profile_delete(id, false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_db_contact_update_changed_time(contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -267,14 +242,14 @@ static int __ctsvc_db_profile_delete_record(int id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
-static int __ctsvc_db_profile_get_all_records(int offset, int limit, contacts_list_hout_list)
+static int __ctsvc_db_profile_get_all_records(int offset, int limit, contacts_list_h *out_list)
 {
        int len;
        int ret;
@@ -285,11 +260,11 @@ static int __ctsvc_db_profile_get_all_records(int offset, int limit, contacts_li
 
        len = snprintf(query, sizeof(query),
                        "SELECT id, data.contact_id, is_default, data1, data2, "
-                               "data3, data4, data5, data6, data7, data8, data9, data10, data11 "
-                               "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                               "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                               "WHERE datatype = %d AND is_my_profile=0 ",
-                               CTSVC_DATA_PROFILE);
+                       "data3, data4, data5, data6, data7, data8, data9, data10, data11 "
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE datatype = %d AND is_my_profile=0 ",
+                       CTSVC_DATA_PROFILE);
 
        if (0 != limit) {
                len += snprintf(query+len, sizeof(query)-len, " LIMIT %d", limit);
@@ -298,12 +273,12 @@ static int __ctsvc_db_profile_get_all_records(int offset, int limit, contacts_li
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                if (1 /*CTS_TRUE */ != ret) {
-                       CTS_ERR("DB : ctsvc_stmt_step fail(%d)", ret);
+                       ERR("DB : ctsvc_stmt_step fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -319,7 +294,7 @@ static int __ctsvc_db_profile_get_all_records(int offset, int limit, contacts_li
 }
 
 static int __ctsvc_db_profile_get_records_with_query(contacts_query_h query, int offset,
-               int limit, contacts_list_hout_list)
+               int limit, contacts_list_h *out_list)
 {
        int ret;
        int i;
@@ -330,7 +305,7 @@ static int __ctsvc_db_profile_get_records_with_query(contacts_query_h query, int
        ctsvc_profile_s *profile;
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        ret = ctsvc_db_make_get_records_query_stmt(s_query, offset, limit, &stmt);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_db_make_get_records_query_stmt fail(%d)", ret);
@@ -339,7 +314,7 @@ static int __ctsvc_db_profile_get_records_with_query(contacts_query_h query, int
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 /*CTS_TRUE */ != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -347,9 +322,9 @@ static int __ctsvc_db_profile_get_records_with_query(contacts_query_h query, int
 
                contacts_record_create(_contacts_profile._uri, &record);
                profile = (ctsvc_profile_s*)record;
-               if (0 == s_query->projection_count)
+               if (0 == s_query->projection_count) {
                        field_count = s_query->property_count;
-               else {
+               else {
                        field_count = s_query->projection_count;
                        ret = ctsvc_record_set_projection_flags(record, s_query->projection,
                                        s_query->projection_count, s_query->property_count);
@@ -358,7 +333,7 @@ static int __ctsvc_db_profile_get_records_with_query(contacts_query_h query, int
                                ASSERT_NOT_REACHED("To set projection is Fail.\n");
                }
 
-               for (i=0;i<field_count;i++) {
+               for (i = 0; i < field_count; i++) {
                        char *temp;
                        int property_id;
                        if (0 == s_query->projection_count)
@@ -366,7 +341,7 @@ static int __ctsvc_db_profile_get_records_with_query(contacts_query_h query, int
                        else
                                property_id = s_query->projection[i];
 
-                       switch(property_id) {
+                       switch (property_id) {
                        case CTSVC_PROPERTY_PROFILE_ID:
                                profile->id = ctsvc_stmt_get_int(stmt, i);
                                break;
@@ -428,3 +403,21 @@ static int __ctsvc_db_profile_get_records_with_query(contacts_query_h query, int
        *out_list = list;
        return CONTACTS_ERROR_NONE;
 }
+
+ctsvc_db_plugin_info_s ctsvc_db_plugin_profile = {
+       .is_query_only = false,
+       .insert_record = __ctsvc_db_profile_insert_record,
+       .get_record = __ctsvc_db_profile_get_record,
+       .update_record = __ctsvc_db_profile_update_record,
+       .delete_record = __ctsvc_db_profile_delete_record,
+       .get_all_records = __ctsvc_db_profile_get_all_records,
+       .get_records_with_query = __ctsvc_db_profile_get_records_with_query,
+       .insert_records = NULL,
+       .update_records = NULL,
+       .delete_records = NULL,
+       .get_count = NULL,
+       .get_count_with_query = NULL,
+       .replace_record = NULL,
+       .replace_records = NULL,
+};
+
index 425d22e..79f7bfe 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_db_schema.h"
@@ -34,7 +33,7 @@ int ctsvc_db_profile_get_value_from_stmt(cts_stmt stmt, contacts_record_h *recor
        char *temp;
        ctsvc_profile_s *profile;
 
-       ret = contacts_record_create(_contacts_profile._uri, (contacts_record_h *)&profile);
+       ret = contacts_record_create(_contacts_profile._uri, (contacts_record_h*)&profile);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "contacts_record_create Fail(%d)", ret);
 
        profile->id = ctsvc_stmt_get_int(stmt, start_count++);
@@ -91,28 +90,28 @@ int ctsvc_db_profile_insert(contacts_record_h record, int contact_id, bool is_my
        int ret;
        cts_stmt stmt = NULL;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_profile_s *profile = (ctsvc_profile_s *)record;
+       ctsvc_profile_s *profile = (ctsvc_profile_s*)record;
 
        RETV_IF(NULL == profile->text, CONTACTS_ERROR_NONE);
        RETVM_IF(contact_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : contact_id(%d) is mandatory field to insert profile record ", profile->contact_id);
+                       "contact_id(%d) is mandatory field to insert profile record ", profile->contact_id);
        RETVM_IF(0 < profile->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : id(%d), This record is already inserted", profile->id);
+                       "id(%d), This record is already inserted", profile->id);
 
        snprintf(query, sizeof(query),
-               "INSERT INTO "CTS_TABLE_DATA"(contact_id, is_my_profile, datatype, data3, data4, data5, "
-                               "data6, data7, data8, data9, data10, data11) "
-                               "VALUES(%d, %d, %d, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
-                               contact_id, is_my_profile, CTSVC_DATA_PROFILE);
+                       "INSERT INTO "CTS_TABLE_DATA"(contact_id, is_my_profile, datatype, data3, data4, data5, "
+                       "data6, data7, data8, data9, data10, data11) "
+                       "VALUES(%d, %d, %d, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
+                       contact_id, is_my_profile, CTSVC_DATA_PROFILE);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        __ctsvc_profile_bind_stmt(stmt, profile, 1);
 
        ret = ctsvc_stmt_step(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                return ret;
        }
@@ -133,7 +132,7 @@ int ctsvc_db_profile_update(contacts_record_h record, bool is_my_profile)
 {
        int id;
        int ret = CONTACTS_ERROR_NONE;
-       charset = NULL;
+       char *set = NULL;
        GSList *bind_text = NULL;
        GSList *cursor = NULL;
        ctsvc_profile_s *profile = (ctsvc_profile_s*)record;
@@ -155,11 +154,14 @@ int ctsvc_db_profile_update(contacts_record_h record, bool is_my_profile)
                        ctsvc_set_profile_noti();
        } while (0);
 
-       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s *)record);
-       CONTACTS_FREE(set);
+       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s*)record);
+       free(set);
+
        if (bind_text) {
-               for (cursor=bind_text;cursor;cursor=cursor->next)
-                       CONTACTS_FREE(cursor->data);
+               for (cursor = bind_text; cursor; cursor = cursor->next) {
+                       free(cursor->data);
+                       cursor->data = NULL;
+               }
                g_slist_free(bind_text);
        }
 
index a918470..ec7f8cd 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #ifndef __CTSVC_DB_PLUGIN_PROFILE_HELPER_H__
 #define __CTSVC_DB_PLUGIN_PROFILE_HELPER_H__
 
 #include "contacts.h"
 #include "ctsvc_db_sqlite.h"
 
-int ctsvc_db_profile_insert(contacts_record_h record, int contact_id, bool is_my_profile, int *id);
+int ctsvc_db_profile_insert(contacts_record_h record, int contact_id, bool is_my_profile,
+               int *id);
 int ctsvc_db_profile_update(contacts_record_h record, bool is_my_profile);
 int ctsvc_db_profile_delete(int id, bool is_my_profile);
-int ctsvc_db_profile_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record, int start_count);
+int ctsvc_db_profile_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record,
+               int start_count);
 
 #endif /* __CTSVC_DB_PLUGIN_PROFILE_HELPER_H__ */
index 31ad456..0eaa1cd 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_db_schema.h"
 #include "ctsvc_notification.h"
 
 
-static int __ctsvc_db_relationship_insert_record(contacts_record_h record, int *id);
-static int __ctsvc_db_relationship_get_record(int id, contacts_record_h* out_record);
-static int __ctsvc_db_relationship_update_record(contacts_record_h record);
-static int __ctsvc_db_relationship_delete_record(int id);
-static int __ctsvc_db_relationship_get_all_records(int offset, int limit, contacts_list_h* out_list);
-static int __ctsvc_db_relationship_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h* out_list);
-
-ctsvc_db_plugin_info_s ctsvc_db_plugin_relationship = {
-       .is_query_only = false,
-       .insert_record = __ctsvc_db_relationship_insert_record,
-       .get_record = __ctsvc_db_relationship_get_record,
-       .update_record = __ctsvc_db_relationship_update_record,
-       .delete_record = __ctsvc_db_relationship_delete_record,
-       .get_all_records = __ctsvc_db_relationship_get_all_records,
-       .get_records_with_query = __ctsvc_db_relationship_get_records_with_query,
-       .insert_records = NULL,
-       .update_records = NULL,
-       .delete_records = NULL,
-       .get_count = NULL,
-       .get_count_with_query = NULL,
-       .replace_record = NULL,
-       .replace_records = NULL,
-};
-
 static int __ctsvc_db_relationship_insert_record(contacts_record_h record, int *id)
 {
        int ret;
        int addressbook_id;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_relationship_s *relationship = (ctsvc_relationship_s *)record;
+       ctsvc_relationship_s *relationship = (ctsvc_relationship_s*)record;
 
-       RETVM_IF(NULL == relationship->name, CONTACTS_ERROR_INVALID_PARAMETER,
-               "Invalid parameter : relationship name is NULL");
+       RETV_IF(NULL == relationship->name, CONTACTS_ERROR_INVALID_PARAMETER);
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -78,31 +52,30 @@ static int __ctsvc_db_relationship_insert_record(contacts_record_h record, int *
        if (CONTACTS_ERROR_NONE != ret) {
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NO_DATA == ret) {
-                       CTS_ERR("No data : contact_id (%d) is not exist", relationship->contact_id);
+                       ERR("No data : contact_id (%d) is not exist", relationship->contact_id);
                        return CONTACTS_ERROR_INVALID_PARAMETER;
-               }
-               else {
-                       CTS_ERR("ctsvc_query_get_first_int_result Fail(%d)", ret);
+               } else {
+                       ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                        return ret;
                }
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this relationship record : addressbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this relationship record : addressbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_relationship_insert(record, relationship->contact_id, false, id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_db_contact_update_changed_time(relationship->contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -110,14 +83,14 @@ static int __ctsvc_db_relationship_insert_record(contacts_record_h record, int *
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
-static int __ctsvc_db_relationship_get_record(int id, contacts_record_hout_record)
+static int __ctsvc_db_relationship_get_record(int id, contacts_record_h *out_record)
 {
        int ret;
        cts_stmt stmt = NULL;
@@ -128,17 +101,17 @@ static int __ctsvc_db_relationship_get_record(int id, contacts_record_h* out_rec
 
        snprintf(query, sizeof(query),
                        "SELECT id, data.contact_id, is_default, data1, data2, data3 "
-                               "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                               "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                               "WHERE id = %d AND datatype = %d ",
-                               id, CTSVC_DATA_RELATIONSHIP);
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE id = %d AND datatype = %d ",
+                       id, CTSVC_DATA_RELATIONSHIP);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/ != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
@@ -158,12 +131,12 @@ static int __ctsvc_db_relationship_update_record(contacts_record_h record)
        int ret;
        int addressbook_id;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_relationship_s *relationship = (ctsvc_relationship_s *)record;
+       ctsvc_relationship_s *relationship = (ctsvc_relationship_s*)record;
        RETVM_IF(NULL == relationship->name, CONTACTS_ERROR_INVALID_PARAMETER, "name is empty");
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -171,27 +144,27 @@ static int __ctsvc_db_relationship_update_record(contacts_record_h record)
                        "SELECT addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", relationship->contact_id);
        ret = ctsvc_query_get_first_int_result(query, &addressbook_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("No data : contact_id (%d) is not exist", relationship->contact_id);
+               ERR("No data : contact_id (%d) is not exist", relationship->contact_id);
                ctsvc_end_trans(false);
                return ret;
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this relationship record : addressbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this relationship record : addressbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_relationship_update(record, false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("Update record Fail(%d)", ret);
+               ERR("Update record Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_db_contact_update_changed_time(relationship->contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -199,11 +172,11 @@ static int __ctsvc_db_relationship_update_record(contacts_record_h record)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
 static int __ctsvc_db_relationship_delete_record(int id)
@@ -216,22 +189,22 @@ static int __ctsvc_db_relationship_delete_record(int id)
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
        snprintf(query, sizeof(query),
                        "SELECT contact_id, addressbook_id FROM "CTSVC_DB_VIEW_CONTACT " "
-                               "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id);
+                       "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id);
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare Fail(%d)", ret);
+               ERR("ctsvc_query_prepare Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
        ret = ctsvc_stmt_step(stmt);
        if (1 != ret) {
-               CTS_ERR("The id(%d) is Invalid(%d)", id, ret);
+               ERR("The id(%d) is Invalid(%d)", id, ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NONE == ret)
@@ -245,21 +218,21 @@ static int __ctsvc_db_relationship_delete_record(int id)
        ctsvc_stmt_finalize(stmt);
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to delete this relationship record : addressbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to delete this relationship record : addressbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_relationship_delete(id, false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_db_contact_update_changed_time(contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -267,14 +240,14 @@ static int __ctsvc_db_relationship_delete_record(int id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
-static int __ctsvc_db_relationship_get_all_records(int offset, int limit, contacts_list_hout_list)
+static int __ctsvc_db_relationship_get_all_records(int offset, int limit, contacts_list_h *out_list)
 {
        int len;
        int ret;
@@ -285,10 +258,10 @@ static int __ctsvc_db_relationship_get_all_records(int offset, int limit, contac
 
        len = snprintf(query, sizeof(query),
                        "SELECT id, data.contact_id, is_default, data1, data2, data3 "
-                               "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                               "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                               "WHERE datatype = %d AND is_my_profile=0 ",
-                               CTSVC_DATA_RELATIONSHIP);
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE datatype = %d AND is_my_profile=0 ",
+                       CTSVC_DATA_RELATIONSHIP);
 
        if (0 != limit) {
                len += snprintf(query+len, sizeof(query)-len, " LIMIT %d", limit);
@@ -297,12 +270,12 @@ static int __ctsvc_db_relationship_get_all_records(int offset, int limit, contac
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                if (1 /*CTS_TRUE */ != ret) {
-                       CTS_ERR("DB : ctsvc_stmt_step fail(%d)", ret);
+                       ERR("DB : ctsvc_stmt_step fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -318,7 +291,7 @@ static int __ctsvc_db_relationship_get_all_records(int offset, int limit, contac
 }
 
 static int __ctsvc_db_relationship_get_records_with_query(contacts_query_h query, int offset,
-               int limit, contacts_list_hout_list)
+               int limit, contacts_list_h *out_list)
 {
        int ret;
        int i;
@@ -329,7 +302,7 @@ static int __ctsvc_db_relationship_get_records_with_query(contacts_query_h query
        ctsvc_relationship_s *relationship;
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        ret = ctsvc_db_make_get_records_query_stmt(s_query, offset, limit, &stmt);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_db_make_get_records_query_stmt fail(%d)", ret);
@@ -338,7 +311,7 @@ static int __ctsvc_db_relationship_get_records_with_query(contacts_query_h query
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 /*CTS_TRUE */ != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -346,9 +319,9 @@ static int __ctsvc_db_relationship_get_records_with_query(contacts_query_h query
 
                contacts_record_create(_contacts_relationship._uri, &record);
                relationship = (ctsvc_relationship_s*)record;
-               if (0 == s_query->projection_count)
+               if (0 == s_query->projection_count) {
                        field_count = s_query->property_count;
-               else {
+               else {
                        field_count = s_query->projection_count;
                        ret = ctsvc_record_set_projection_flags(record, s_query->projection,
                                        s_query->projection_count, s_query->property_count);
@@ -357,7 +330,7 @@ static int __ctsvc_db_relationship_get_records_with_query(contacts_query_h query
                                ASSERT_NOT_REACHED("To set projection is Fail.\n");
                }
 
-               for (i=0;i<field_count;i++) {
+               for (i = 0; i < field_count; i++) {
                        char *temp;
                        int property_id;
                        if (0 == s_query->projection_count)
@@ -365,7 +338,7 @@ static int __ctsvc_db_relationship_get_records_with_query(contacts_query_h query
                        else
                                property_id = s_query->projection[i];
 
-                       switch(property_id) {
+                       switch (property_id) {
                        case CTSVC_PROPERTY_RELATIONSHIP_ID:
                                relationship->id = ctsvc_stmt_get_int(stmt, i);
                                break;
@@ -397,3 +370,21 @@ static int __ctsvc_db_relationship_get_records_with_query(contacts_query_h query
        *out_list = list;
        return CONTACTS_ERROR_NONE;
 }
+
+ctsvc_db_plugin_info_s ctsvc_db_plugin_relationship = {
+       .is_query_only = false,
+       .insert_record = __ctsvc_db_relationship_insert_record,
+       .get_record = __ctsvc_db_relationship_get_record,
+       .update_record = __ctsvc_db_relationship_update_record,
+       .delete_record = __ctsvc_db_relationship_delete_record,
+       .get_all_records = __ctsvc_db_relationship_get_all_records,
+       .get_records_with_query = __ctsvc_db_relationship_get_records_with_query,
+       .insert_records = NULL,
+       .update_records = NULL,
+       .delete_records = NULL,
+       .get_count = NULL,
+       .get_count_with_query = NULL,
+       .replace_record = NULL,
+       .replace_records = NULL,
+};
+
index a6939df..53d10b7 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_db_schema.h"
@@ -34,7 +33,7 @@ int ctsvc_db_relationship_get_value_from_stmt(cts_stmt stmt, contacts_record_h *
        char *temp;
        ctsvc_relationship_s *relationship;
 
-       ret = contacts_record_create(_contacts_relationship._uri, (contacts_record_h *)&relationship);
+       ret = contacts_record_create(_contacts_relationship._uri, (contacts_record_h*)&relationship);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "contacts_record_create Fail(%d)", ret);
 
        relationship->id = ctsvc_stmt_get_int(stmt, start_count++);
@@ -64,28 +63,28 @@ int ctsvc_db_relationship_insert(contacts_record_h record, int contact_id, bool
        int ret;
        cts_stmt stmt = NULL;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_relationship_s *relationship = (ctsvc_relationship_s *)record;
+       ctsvc_relationship_s *relationship = (ctsvc_relationship_s*)record;
 
        /* These check should be done in client side */
        RETV_IF(NULL == relationship->name, CONTACTS_ERROR_NONE);
        RETVM_IF(contact_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : contact_id(%d) is mandatory field to insert relationship record", relationship->contact_id);
+                       "contact_id(%d) is mandatory field to insert relationship record", relationship->contact_id);
        RETVM_IF(0 < relationship->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : id(%d), This record is already inserted", relationship->id);
+                       "id(%d), This record is already inserted", relationship->id);
 
        snprintf(query, sizeof(query),
-               "INSERT INTO "CTS_TABLE_DATA"(contact_id, is_my_profile, datatype, data1, data2, data3) "
-                                                                       "VALUES(%d, %d, %d, %d, ?, ?)",
-                                       contact_id, is_my_profile, CTSVC_DATA_RELATIONSHIP, relationship->type);
+                       "INSERT INTO "CTS_TABLE_DATA"(contact_id, is_my_profile, datatype, data1, data2, data3) "
+                       "VALUES(%d, %d, %d, %d, ?, ?)",
+                       contact_id, is_my_profile, CTSVC_DATA_RELATIONSHIP, relationship->type);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        __ctsvc_relationship_bind_stmt(stmt, relationship, 1);
 
        ret = ctsvc_stmt_step(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                return ret;
        }
@@ -105,7 +104,7 @@ int ctsvc_db_relationship_update(contacts_record_h record, bool is_my_profile)
 {
        int id;
        int ret = CONTACTS_ERROR_NONE;
-       charset = NULL;
+       char *set = NULL;
        GSList *bind_text = NULL;
        GSList *cursor = NULL;
        ctsvc_relationship_s *relationship = (ctsvc_relationship_s*)record;
@@ -126,11 +125,14 @@ int ctsvc_db_relationship_update(contacts_record_h record, bool is_my_profile)
                        ctsvc_set_relationship_noti();
        } while (0);
 
-       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s *)record);
-       CONTACTS_FREE(set);
+       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s*)record);
+       free(set);
+
        if (bind_text) {
-               for (cursor=bind_text;cursor;cursor=cursor->next)
-                       CONTACTS_FREE(cursor->data);
+               for (cursor = bind_text; cursor; cursor = cursor->next) {
+                       free(cursor->data);
+                       cursor->data = NULL;
+               }
                g_slist_free(bind_text);
        }
 
index 8e2c0b7..340c0bd 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #ifndef __CTSVC_DB_PLUGIN_RELATIONSHIP_HELPER_H__
 #define __CTSVC_DB_PLUGIN_RELATIONSHIP_HELPER_H__
 
 #include "contacts.h"
 #include "ctsvc_db_sqlite.h"
 
-int ctsvc_db_relationship_insert(contacts_record_h record, int contact_id, bool is_my_profile, int *id);
+int ctsvc_db_relationship_insert(contacts_record_h record, int contact_id,
+               bool is_my_profile, int *id);
 int ctsvc_db_relationship_update(contacts_record_h record, bool is_my_profile);
 int ctsvc_db_relationship_delete(int id, bool is_my_profile);
-int ctsvc_db_relationship_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record, int start_count);
+int ctsvc_db_relationship_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record,
+               int start_count);
 
 #endif /* __CTSVC_DB_PLUGIN_RELATIONSHIP_HELPER_H__ */
index 5ff5cad..ce0ec02 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_db_schema.h"
 #include "ctsvc_notification.h"
 #include "ctsvc_server_utils.h"
 
-static int __ctsvc_db_sdn_get_record(int id, contacts_record_h* record);
-static int __ctsvc_db_sdn_get_all_records(int offset, int limit, contacts_list_h* out_list);
-static int __ctsvc_db_sdn_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h* out_list);
-
-ctsvc_db_plugin_info_s ctsvc_db_plugin_sdn = {
-       .is_query_only = false,
-       .insert_record = NULL,
-       .get_record = __ctsvc_db_sdn_get_record,
-       .update_record = NULL,
-       .delete_record = NULL,
-       .get_all_records = __ctsvc_db_sdn_get_all_records,
-       .get_records_with_query = __ctsvc_db_sdn_get_records_with_query,
-       .insert_records = NULL,
-       .update_records = NULL,
-       .delete_records = NULL,
-       .get_count = NULL,
-       .get_count_with_query = NULL,
-       .replace_record = NULL,
-       .replace_records = NULL,
-};
 
 static int __ctsvc_db_sdn_value_set(cts_stmt stmt, contacts_record_h *record)
 {
@@ -73,7 +52,7 @@ static int __ctsvc_db_sdn_value_set(cts_stmt stmt, contacts_record_h *record)
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_sdn_get_record(int id, contacts_record_hout_record)
+static int __ctsvc_db_sdn_get_record(int id, contacts_record_h *out_record)
 {
        RETVM_IF(false == ctsvc_server_have_telephony_feature(), CONTACTS_ERROR_NOT_SUPPORTED, "Telephony feature disabled");
 
@@ -86,14 +65,14 @@ static int __ctsvc_db_sdn_get_record(int id, contacts_record_h* out_record)
        *out_record = NULL;
 
        snprintf(query, sizeof(query),
-                               "SELECT id, name, number, sim_slot_no FROM "CTS_TABLE_SDN" WHERE id = %d", id);
+                       "SELECT id, name, number, sim_slot_no FROM "CTS_TABLE_SDN" WHERE id = %d", id);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/ != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
@@ -105,7 +84,7 @@ static int __ctsvc_db_sdn_get_record(int id, contacts_record_h* out_record)
 
        ctsvc_stmt_finalize(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("__ctsvc_db_sdn_value_set(ALL) Fail(%d)", ret);
+               ERR("__ctsvc_db_sdn_value_set(ALL) Fail(%d)", ret);
                return ret;
        }
 
@@ -115,7 +94,7 @@ static int __ctsvc_db_sdn_get_record(int id, contacts_record_h* out_record)
 }
 
 static int __ctsvc_db_sdn_get_all_records(int offset, int limit,
-       contacts_list_h* out_list)
+               contacts_list_h *out_list)
 {
        RETVM_IF(false == ctsvc_server_have_telephony_feature(), CONTACTS_ERROR_NOT_SUPPORTED, "Telephony feature disabled");
 
@@ -126,7 +105,7 @@ static int __ctsvc_db_sdn_get_all_records(int offset, int limit,
        contacts_list_h list;
 
        len = snprintf(query, sizeof(query),
-                               "SELECT id, name, number, sim_slot_no FROM "CTS_TABLE_SDN);
+                       "SELECT id, name, number, sim_slot_no FROM "CTS_TABLE_SDN);
 
        if (0 != limit) {
                len += snprintf(query+len, sizeof(query)-len, " LIMIT %d", limit);
@@ -135,13 +114,13 @@ static int __ctsvc_db_sdn_get_all_records(int offset, int limit,
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -157,7 +136,7 @@ static int __ctsvc_db_sdn_get_all_records(int offset, int limit,
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_sdn_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_hout_list)
+static int __ctsvc_db_sdn_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h *out_list)
 {
        RETVM_IF(false == ctsvc_server_have_telephony_feature(), CONTACTS_ERROR_NOT_SUPPORTED, "Telephony feature disabled");
 
@@ -170,7 +149,7 @@ static int __ctsvc_db_sdn_get_records_with_query(contacts_query_h query, int off
        ctsvc_sdn_s *sdn;
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        ret = ctsvc_db_make_get_records_query_stmt(s_query, offset, limit, &stmt);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_db_make_get_records_query_stmt fail(%d)", ret);
@@ -179,7 +158,7 @@ static int __ctsvc_db_sdn_get_records_with_query(contacts_query_h query, int off
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -187,17 +166,18 @@ static int __ctsvc_db_sdn_get_records_with_query(contacts_query_h query, int off
 
                contacts_record_create(_contacts_sdn._uri, &record);
                sdn = (ctsvc_sdn_s*)record;
-               if (0 == s_query->projection_count)
+               if (0 == s_query->projection_count) {
                        field_count = s_query->property_count;
-               else {
+               else {
                        field_count = s_query->projection_count;
 
-                       if (CONTACTS_ERROR_NONE != ctsvc_record_set_projection_flags(record, s_query->projection, s_query->projection_count, s_query->property_count)) {
+                       int err = ctsvc_record_set_projection_flags(record, s_query->projection,
+                                       s_query->projection_count, s_query->property_count);
+                       if (CONTACTS_ERROR_NONE != err)
                                ASSERT_NOT_REACHED("To set projection is Fail.\n");
-                       }
                }
 
-               for (i=0;i<field_count;i++) {
+               for (i = 0; i < field_count; i++) {
                        char *temp;
                        int property_id;
                        if (0 == s_query->projection_count)
@@ -205,7 +185,7 @@ static int __ctsvc_db_sdn_get_records_with_query(contacts_query_h query, int off
                        else
                                property_id = s_query->projection[i];
 
-                       switch(property_id) {
+                       switch (property_id) {
                        case CTSVC_PROPERTY_SDN_ID:
                                sdn->id = ctsvc_stmt_get_int(stmt, i);
                                break;
@@ -236,3 +216,20 @@ static int __ctsvc_db_sdn_get_records_with_query(contacts_query_h query, int off
        return CONTACTS_ERROR_NONE;
 }
 
+ctsvc_db_plugin_info_s ctsvc_db_plugin_sdn = {
+       .is_query_only = false,
+       .insert_record = NULL,
+       .get_record = __ctsvc_db_sdn_get_record,
+       .update_record = NULL,
+       .delete_record = NULL,
+       .get_all_records = __ctsvc_db_sdn_get_all_records,
+       .get_records_with_query = __ctsvc_db_sdn_get_records_with_query,
+       .insert_records = NULL,
+       .update_records = NULL,
+       .delete_records = NULL,
+       .get_count = NULL,
+       .get_count_with_query = NULL,
+       .replace_record = NULL,
+       .replace_records = NULL,
+};
+
index 0437b50..455f2a6 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #ifndef __CTSVC_DB_PLUGIN_SDN_H__
 #define __CTSVC_DB_PLUGIN_SDN_H__
 
index 7bb242d..2de94f0 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
 #include "ctsvc_db_access_control.h"
 #include "ctsvc_notify.h"
 
-static int __ctsvc_db_simple_contact_get_record(int id, contacts_record_h* out_record);
-static int __ctsvc_db_simple_contact_get_all_records(int offset, int limit, contacts_list_h* out_list);
-static int __ctsvc_db_simple_contact_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h* out_list);
-
-ctsvc_db_plugin_info_s ctsvc_db_plugin_simple_contact = {
-       .is_query_only = false,
-       .insert_record = NULL,
-       .get_record = __ctsvc_db_simple_contact_get_record,
-       .update_record = NULL,
-       .delete_record = NULL,
-       .get_all_records = __ctsvc_db_simple_contact_get_all_records,
-       .get_records_with_query = __ctsvc_db_simple_contact_get_records_with_query,
-       .insert_records = NULL,
-       .update_records = NULL,
-       .delete_records = NULL,
-       .get_count = NULL,
-       .get_count_with_query = NULL,
-       .replace_record = NULL,
-       .replace_records = NULL,
-};
 
 static int __ctsvc_db_simple_contact_value_set(cts_stmt stmt, contacts_record_h *record)
 {
@@ -97,7 +77,7 @@ static int __ctsvc_db_simple_contact_value_set(cts_stmt stmt, contacts_record_h
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_simple_contact_get_record(int id, contacts_record_hout_record)
+static int __ctsvc_db_simple_contact_get_record(int id, contacts_record_h *out_record)
 {
        int ret;
        cts_stmt stmt = NULL;
@@ -108,18 +88,18 @@ static int __ctsvc_db_simple_contact_get_record(int id, contacts_record_h* out_r
        *out_record = NULL;
 
        snprintf(query, sizeof(query),
-                               "SELECT contact_id, addressbook_id, person_id, changed_time, %s, "
-                                       "display_name_source, image_thumbnail_path, "
-                                       "ringtone_path, vibration, message_alert, uid, is_favorite, has_phonenumber, has_email "
-                                       "FROM "CTS_TABLE_CONTACTS" WHERE contact_id = %d AND deleted = 0",
-                                       ctsvc_get_display_column(), id);
+                       "SELECT contact_id, addressbook_id, person_id, changed_time, %s, "
+                       "display_name_source, image_thumbnail_path, "
+                       "ringtone_path, vibration, message_alert, uid, is_favorite, has_phonenumber, has_email "
+                       "FROM "CTS_TABLE_CONTACTS" WHERE contact_id = %d AND deleted = 0",
+                       ctsvc_get_display_column(), id);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/ != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
@@ -131,7 +111,7 @@ static int __ctsvc_db_simple_contact_get_record(int id, contacts_record_h* out_r
 
        ctsvc_stmt_finalize(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("__ctsvc_db_simple_contact_value_set(ALL) Fail(%d)", ret);
+               ERR("__ctsvc_db_simple_contact_value_set(ALL) Fail(%d)", ret);
                return ret;
        }
 
@@ -141,7 +121,7 @@ static int __ctsvc_db_simple_contact_get_record(int id, contacts_record_h* out_r
 }
 
 static int __ctsvc_db_simple_contact_get_all_records(int offset, int limit,
-       contacts_list_h* out_list)
+               contacts_list_h *out_list)
 {
        int ret;
        int len;
@@ -151,9 +131,9 @@ static int __ctsvc_db_simple_contact_get_all_records(int offset, int limit,
 
        len = snprintf(query, sizeof(query),
                        "SELECT contact_id, addressbook_id, person_id, changed_time, "
-                               "%s, display_name_source, image_thumbnail_path, "
-                               "ringtone_path, vibration, message_alert, uid, is_favorite, has_phonenumber, has_email "
-                               "FROM "CTS_TABLE_CONTACTS" WHERE deleted = 0", ctsvc_get_display_column());
+                       "%s, display_name_source, image_thumbnail_path, "
+                       "ringtone_path, vibration, message_alert, uid, is_favorite, has_phonenumber, has_email "
+                       "FROM "CTS_TABLE_CONTACTS" WHERE deleted = 0", ctsvc_get_display_column());
 
        if (0 != limit) {
                len += snprintf(query+len, sizeof(query)-len, " LIMIT %d", limit);
@@ -162,13 +142,13 @@ static int __ctsvc_db_simple_contact_get_all_records(int offset, int limit,
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -185,7 +165,7 @@ static int __ctsvc_db_simple_contact_get_all_records(int offset, int limit,
 }
 
 static int __ctsvc_db_simple_contact_get_records_with_query(contacts_query_h query,
-       int offset, int limit, contacts_list_h* out_list)
+               int offset, int limit, contacts_list_h *out_list)
 {
        int ret;
        int i;
@@ -197,7 +177,7 @@ static int __ctsvc_db_simple_contact_get_records_with_query(contacts_query_h que
        char full_path[CTSVC_IMG_FULL_PATH_SIZE_MAX] = {0};
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        ret = ctsvc_db_make_get_records_query_stmt(s_query, offset, limit, &stmt);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_db_make_get_records_query_stmt fail(%d)", ret);
@@ -206,7 +186,7 @@ static int __ctsvc_db_simple_contact_get_records_with_query(contacts_query_h que
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -214,17 +194,18 @@ static int __ctsvc_db_simple_contact_get_records_with_query(contacts_query_h que
 
                contacts_record_create(_contacts_simple_contact._uri, &record);
                contact = (ctsvc_simple_contact_s*)record;
-               if (0 == s_query->projection_count)
+               if (0 == s_query->projection_count) {
                        field_count = s_query->property_count;
-               else {
+               else {
                        field_count = s_query->projection_count;
 
-                       if (CONTACTS_ERROR_NONE != ctsvc_record_set_projection_flags(record, s_query->projection, s_query->projection_count, s_query->property_count)) {
+                       int err = ctsvc_record_set_projection_flags(record, s_query->projection,
+                                       s_query->projection_count, s_query->property_count);
+                       if (CONTACTS_ERROR_NONE != err)
                                ASSERT_NOT_REACHED("To set projection is Fail.\n");
-                       }
                }
 
-               for (i=0;i<field_count;i++) {
+               for (i = 0; i < field_count; i++) {
                        char *temp;
                        int property_id;
                        if (0 == s_query->projection_count)
@@ -232,7 +213,7 @@ static int __ctsvc_db_simple_contact_get_records_with_query(contacts_query_h que
                        else
                                property_id = s_query->projection[i];
 
-                       switch(property_id) {
+                       switch (property_id) {
                        case CTSVC_PROPERTY_CONTACT_ID:
                                contact->contact_id = ctsvc_stmt_get_int(stmt, i);
                                break;
@@ -303,3 +284,21 @@ static int __ctsvc_db_simple_contact_get_records_with_query(contacts_query_h que
 
        return CONTACTS_ERROR_NONE;
 }
+
+ctsvc_db_plugin_info_s ctsvc_db_plugin_simple_contact = {
+       .is_query_only = false,
+       .insert_record = NULL,
+       .get_record = __ctsvc_db_simple_contact_get_record,
+       .update_record = NULL,
+       .delete_record = NULL,
+       .get_all_records = __ctsvc_db_simple_contact_get_all_records,
+       .get_records_with_query = __ctsvc_db_simple_contact_get_records_with_query,
+       .insert_records = NULL,
+       .update_records = NULL,
+       .delete_records = NULL,
+       .get_count = NULL,
+       .get_count_with_query = NULL,
+       .replace_record = NULL,
+       .replace_records = NULL,
+};
+
index 4250b27..e6f5bbe 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_db_schema.h"
 #include "ctsvc_notification.h"
 #include "ctsvc_notify.h"
 
-static int __ctsvc_db_speeddial_insert_record(contacts_record_h record, int *id);
-static int __ctsvc_db_speeddial_get_record(int id, contacts_record_h* out_record);
-static int __ctsvc_db_speeddial_update_record(contacts_record_h record);
-static int __ctsvc_db_speeddial_delete_record(int id);
-static int __ctsvc_db_speeddial_get_all_records(int offset, int limit, contacts_list_h* out_list);
-static int __ctsvc_db_speeddial_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h* out_list);
-
-ctsvc_db_plugin_info_s ctsvc_db_plugin_speeddial = {
-       .is_query_only = false,
-       .insert_record = __ctsvc_db_speeddial_insert_record,
-       .get_record = __ctsvc_db_speeddial_get_record,
-       .update_record = __ctsvc_db_speeddial_update_record,
-       .delete_record = __ctsvc_db_speeddial_delete_record,
-       .get_all_records = __ctsvc_db_speeddial_get_all_records,
-       .get_records_with_query = __ctsvc_db_speeddial_get_records_with_query,
-       .insert_records = NULL,
-       .update_records = NULL,
-       .delete_records = NULL,
-       .get_count = NULL,
-       .get_count_with_query = NULL,
-       .replace_record = NULL,
-       .replace_records = NULL,
-};
 
 static int __ctsvc_db_speeddial_insert_record(contacts_record_h record, int *id)
 {
@@ -66,13 +42,13 @@ static int __ctsvc_db_speeddial_insert_record(contacts_record_h record, int *id)
        /* check number_id validation */
        snprintf(query, sizeof(query),
                        "SELECT data.id FROM "CTS_TABLE_DATA", "CTS_TABLE_CONTACTS" "
-                                               "ON "CTS_TABLE_DATA".contact_id = "CTS_TABLE_CONTACTS".contact_id "
-                                                               "AND contacts.deleted = 0  AND is_my_profile = 0 AND datatype = %d "
-                                               "WHERE id = %d ",
-                                               CTSVC_DATA_NUMBER, speeddial->number_id);
+                       "ON "CTS_TABLE_DATA".contact_id = "CTS_TABLE_CONTACTS".contact_id "
+                       "AND contacts.deleted = 0  AND is_my_profile = 0 AND datatype = %d "
+                       "WHERE id = %d ",
+                       CTSVC_DATA_NUMBER, speeddial->number_id);
        ret = ctsvc_query_get_first_int_result(query, &number_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_get_first_int_result() Fail(%d) : number_id is invalid", ret);
+               ERR("ctsvc_query_get_first_int_result() Fail(%d) : number_id is invalid", ret);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
@@ -83,7 +59,7 @@ static int __ctsvc_db_speeddial_insert_record(contacts_record_h record, int *id)
 
        ret = ctsvc_query_exec(query);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -93,9 +69,8 @@ static int __ctsvc_db_speeddial_insert_record(contacts_record_h record, int *id)
                if (id)
                        *id  = speeddial->dial_number;
                ctsvc_set_speed_noti();
-       }
-       else {
-               CTS_ERR("already exist");
+       } else {
+               ERR("already exist");
        }
 
        ret = ctsvc_end_trans(true);
@@ -139,7 +114,7 @@ static int __ctsvc_db_speeddial_value_set(cts_stmt stmt, contacts_record_h *reco
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_speeddial_get_record(int id, contacts_record_hout_record)
+static int __ctsvc_db_speeddial_get_record(int id, contacts_record_h *out_record)
 {
        int ret;
        cts_stmt stmt = NULL;
@@ -148,17 +123,17 @@ static int __ctsvc_db_speeddial_get_record(int id, contacts_record_h* out_record
 
        snprintf(query, sizeof(query),
                        "SELECT person_id, %s, image_thumbnail_path, number_id, "
-                                       "type, label, number, speed_number  "
+                       "type, label, number, speed_number  "
                        "FROM "CTSVC_DB_VIEW_SPEEDIDAL " "
                        "WHERE speed_number = %d",
                        ctsvc_get_display_column(), id);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/ != ret) {
-               CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
@@ -170,7 +145,7 @@ static int __ctsvc_db_speeddial_get_record(int id, contacts_record_h* out_record
 
        ctsvc_stmt_finalize(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("__ctsvc_db_speeddial_value_set(ALL) Fail(%d)", ret);
+               ERR("__ctsvc_db_speeddial_value_set(ALL) Fail(%d)", ret);
                return ret;
        }
 
@@ -186,34 +161,34 @@ static int __ctsvc_db_speeddial_update_record(contacts_record_h record)
        int speeddial_id;
        cts_stmt stmt;
        char query[CTS_SQL_MIN_LEN] = {0};
-       ctsvc_speeddial_s *speeddial = (ctsvc_speeddial_s *)record;
+       ctsvc_speeddial_s *speeddial = (ctsvc_speeddial_s*)record;
 
-       RETVM_IF (speeddial->dial_number < 0, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : dial number (%d)", speeddial->dial_number);
-       RETVM_IF (speeddial->number_id < 0, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : number id (%d)", speeddial->number_id);
+       RETVM_IF(speeddial->dial_number < 0, CONTACTS_ERROR_INVALID_PARAMETER,
+                       "dial number (%d)", speeddial->dial_number);
+       RETVM_IF(speeddial->number_id < 0, CONTACTS_ERROR_INVALID_PARAMETER,
+                       "number id (%d)", speeddial->number_id);
        ret = ctsvc_begin_trans();
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, CONTACTS_ERROR_DB, "DB error : ctsvc_begin_trans() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, CONTACTS_ERROR_DB, "ctsvc_begin_trans() Fail(%d)", ret);
 
        /* check number_id validation */
        snprintf(query, sizeof(query),
                        "SELECT data.id FROM "CTS_TABLE_DATA", "CTS_TABLE_CONTACTS" "
-                                               "ON "CTS_TABLE_DATA".contact_id = "CTS_TABLE_CONTACTS".contact_id "
-                                                               "AND contacts.deleted = 0  AND is_my_profile = 0 AND datatype = %d "
-                                               "WHERE id = %d ",
-                                               CTSVC_DATA_NUMBER, speeddial->number_id);
+                       "ON "CTS_TABLE_DATA".contact_id = "CTS_TABLE_CONTACTS".contact_id "
+                       "AND contacts.deleted = 0  AND is_my_profile = 0 AND datatype = %d "
+                       "WHERE id = %d ",
+                       CTSVC_DATA_NUMBER, speeddial->number_id);
        ret = ctsvc_query_get_first_int_result(query, &number_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_query_get_first_int_result() Fail(%d) : number_id is invalid", ret);
+               ERR("ctsvc_query_get_first_int_result() Fail(%d) : number_id is invalid", ret);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
        snprintf(query, sizeof(query),
-               "SELECT speed_number FROM "CTS_TABLE_SPEEDDIALS" WHERE speed_number = %d", speeddial->dial_number);
+                       "SELECT speed_number FROM "CTS_TABLE_SPEEDDIALS" WHERE speed_number = %d", speeddial->dial_number);
        ret = ctsvc_query_get_first_int_result(query, &speeddial_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_query_get_first_int_result() Fail(%d)", ret);
+               ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -223,14 +198,14 @@ static int __ctsvc_db_speeddial_update_record(contacts_record_h record)
                        speeddial->number_id, speeddial->dial_number);
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_stmt_step(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                return ret;
@@ -241,8 +216,7 @@ static int __ctsvc_db_speeddial_update_record(contacts_record_h record)
        if (0 < ret) {
                ctsvc_set_speed_noti();
                ret = ctsvc_end_trans(true);
-       }
-       else {
+       } else {
                ctsvc_end_trans(false);
                ret = CONTACTS_ERROR_NO_DATA;
        }
@@ -261,13 +235,13 @@ static int __ctsvc_db_speeddial_delete_record(int id)
        char query[CTS_SQL_MIN_LEN] = {0};
 
        ret = ctsvc_begin_trans();
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, CONTACTS_ERROR_DB, "DB error : ctsvc_begin_trans() Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, CONTACTS_ERROR_DB, "ctsvc_begin_trans() Fail(%d)", ret);
 
        snprintf(query, sizeof(query),
-               "SELECT speed_number FROM "CTS_TABLE_SPEEDDIALS" WHERE speed_number = %d", id);
+                       "SELECT speed_number FROM "CTS_TABLE_SPEEDDIALS" WHERE speed_number = %d", id);
        ret = ctsvc_query_get_first_int_result(query, &speeddial_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_query_get_first_int_result() Fail(%d)", ret);
+               ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -276,14 +250,14 @@ static int __ctsvc_db_speeddial_delete_record(int id)
                        CTS_TABLE_SPEEDDIALS, id);
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_stmt_step(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                return ret;
@@ -294,8 +268,7 @@ static int __ctsvc_db_speeddial_delete_record(int id)
        if (0 < ret) {
                ctsvc_set_speed_noti();
                ret = ctsvc_end_trans(true);
-       }
-       else {
+       } else {
                ctsvc_end_trans(false);
                ret = CONTACTS_ERROR_NO_DATA;
        }
@@ -306,7 +279,7 @@ static int __ctsvc_db_speeddial_delete_record(int id)
                return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_speeddial_get_all_records(int offset, int limit, contacts_list_hout_list)
+static int __ctsvc_db_speeddial_get_all_records(int offset, int limit, contacts_list_h *out_list)
 {
        int ret;
        int len;
@@ -315,9 +288,9 @@ static int __ctsvc_db_speeddial_get_all_records(int offset, int limit, contacts_
        contacts_list_h list;
 
        len = snprintf(query, sizeof(query),
-                                       "SELECT person_id, %s, image_thumbnail_path, number_id, "
-                                                       "type, label, number, speed_number      "
-                                       "FROM "CTSVC_DB_VIEW_SPEEDIDAL " ",     ctsvc_get_display_column());
+                       "SELECT person_id, %s, image_thumbnail_path, number_id, "
+                       "type, label, number, speed_number      "
+                       "FROM "CTSVC_DB_VIEW_SPEEDIDAL " ",     ctsvc_get_display_column());
 
        if (0 != limit) {
                len += snprintf(query+len, sizeof(query)-len, " LIMIT %d", limit);
@@ -326,13 +299,13 @@ static int __ctsvc_db_speeddial_get_all_records(int offset, int limit, contacts_
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -349,7 +322,7 @@ static int __ctsvc_db_speeddial_get_all_records(int offset, int limit, contacts_
 }
 
 static int __ctsvc_db_speeddial_get_records_with_query(contacts_query_h query,
-               int offset, int limit, contacts_list_hout_list)
+               int offset, int limit, contacts_list_h *out_list)
 {
        int ret;
        int i;
@@ -361,7 +334,7 @@ static int __ctsvc_db_speeddial_get_records_with_query(contacts_query_h query,
        char full_path[CTSVC_IMG_FULL_PATH_SIZE_MAX] = {0};
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        ret = ctsvc_db_make_get_records_query_stmt(s_query, offset, limit, &stmt);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_db_make_get_records_query_stmt Fail(%d)", ret);
@@ -370,7 +343,7 @@ static int __ctsvc_db_speeddial_get_records_with_query(contacts_query_h query,
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -378,17 +351,18 @@ static int __ctsvc_db_speeddial_get_records_with_query(contacts_query_h query,
 
                contacts_record_create(_contacts_speeddial._uri, &record);
                speeddial = (ctsvc_speeddial_s*)record;
-               if (0 == s_query->projection_count)
+               if (0 == s_query->projection_count) {
                        field_count = s_query->property_count;
-               else {
+               else {
                        field_count = s_query->projection_count;
 
-                       if (CONTACTS_ERROR_NONE != ctsvc_record_set_projection_flags(record, s_query->projection, s_query->projection_count, s_query->property_count)) {
-                               ASSERT_NOT_REACHED("To set projection is Fail.\n");
-                       }
+                       int err = ctsvc_record_set_projection_flags(record, s_query->projection,
+                                       s_query->projection_count, s_query->property_count);
+                       if (CONTACTS_ERROR_NONE != err)
+                               ASSERT_NOT_REACHED("ctsvc_record_set_projection_flags() Fail(%d)", err);
                }
 
-               for (i=0;i<field_count;i++) {
+               for (i = 0; i < field_count; i++) {
                        char *temp;
                        int property_id;
                        if (0 == s_query->projection_count)
@@ -396,7 +370,7 @@ static int __ctsvc_db_speeddial_get_records_with_query(contacts_query_h query,
                        else
                                property_id = s_query->projection[i];
 
-                       switch(property_id) {
+                       switch (property_id) {
                        case CTSVC_PROPERTY_SPEEDDIAL_DIAL_NUMBER:
                                speeddial->dial_number = ctsvc_stmt_get_int(stmt, i);
                                speeddial->id = speeddial->dial_number; /* dial_number is an unique key */
@@ -446,3 +420,21 @@ static int __ctsvc_db_speeddial_get_records_with_query(contacts_query_h query,
 
        return CONTACTS_ERROR_NONE;
 }
+
+ctsvc_db_plugin_info_s ctsvc_db_plugin_speeddial = {
+       .is_query_only = false,
+       .insert_record = __ctsvc_db_speeddial_insert_record,
+       .get_record = __ctsvc_db_speeddial_get_record,
+       .update_record = __ctsvc_db_speeddial_update_record,
+       .delete_record = __ctsvc_db_speeddial_delete_record,
+       .get_all_records = __ctsvc_db_speeddial_get_all_records,
+       .get_records_with_query = __ctsvc_db_speeddial_get_records_with_query,
+       .insert_records = NULL,
+       .update_records = NULL,
+       .delete_records = NULL,
+       .get_count = NULL,
+       .get_count_with_query = NULL,
+       .replace_record = NULL,
+       .replace_records = NULL,
+};
+
index 7a98df3..11b8f30 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_db_schema.h"
 #include "ctsvc_notification.h"
 #include "ctsvc_db_access_control.h"
 
-static int __ctsvc_db_url_insert_record(contacts_record_h record, int *id);
-static int __ctsvc_db_url_get_record(int id, contacts_record_h* out_record);
-static int __ctsvc_db_url_update_record(contacts_record_h record);
-static int __ctsvc_db_url_delete_record(int id);
-static int __ctsvc_db_url_get_all_records(int offset, int limit, contacts_list_h* out_list);
-static int __ctsvc_db_url_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h* out_list);
-
-ctsvc_db_plugin_info_s ctsvc_db_plugin_url = {
-       .is_query_only = false,
-       .insert_record = __ctsvc_db_url_insert_record,
-       .get_record = __ctsvc_db_url_get_record,
-       .update_record = __ctsvc_db_url_update_record,
-       .delete_record = __ctsvc_db_url_delete_record,
-       .get_all_records = __ctsvc_db_url_get_all_records,
-       .get_records_with_query = __ctsvc_db_url_get_records_with_query,
-       .insert_records = NULL,
-       .update_records = NULL,
-       .delete_records = NULL,
-       .get_count = NULL,
-       .get_count_with_query = NULL,
-       .replace_record = NULL,
-       .replace_records = NULL,
-};
 
 static int __ctsvc_db_url_insert_record(contacts_record_h record, int *id)
 {
        int ret;
        int addressbook_id;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_url_s *url = (ctsvc_url_s *)record;
+       ctsvc_url_s *url = (ctsvc_url_s*)record;
 
-       RETVM_IF(NULL == url->url, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : url is NULL");
+       RETV_IF(NULL == url->url, CONTACTS_ERROR_INVALID_PARAMETER);
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -76,31 +52,30 @@ static int __ctsvc_db_url_insert_record(contacts_record_h record, int *id)
        if (CONTACTS_ERROR_NONE != ret) {
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NO_DATA == ret) {
-                       CTS_ERR("No data : contact_id (%d) is not exist", url->contact_id);
+                       ERR("No data : contact_id (%d) is not exist", url->contact_id);
                        return CONTACTS_ERROR_INVALID_PARAMETER;
-               }
-               else {
-                       CTS_ERR("ctsvc_query_get_first_int_result Fail(%d)", ret);
+               } else {
+                       ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
                        return ret;
                }
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this url record : addressbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this url record : addressbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_url_insert(record, url->contact_id, false, id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_db_contact_update_changed_time(url->contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -108,14 +83,14 @@ static int __ctsvc_db_url_insert_record(contacts_record_h record, int *id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
-static int __ctsvc_db_url_get_record(int id, contacts_record_hout_record)
+static int __ctsvc_db_url_get_record(int id, contacts_record_h *out_record)
 {
        int ret;
        cts_stmt stmt = NULL;
@@ -126,17 +101,17 @@ static int __ctsvc_db_url_get_record(int id, contacts_record_h* out_record)
 
        snprintf(query, sizeof(query),
                        "SELECT id, data.contact_id, is_default, data1, data2, data3 "
-                               "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                               "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                               "WHERE id = %d AND datatype = %d ",
-                               id, CTSVC_DATA_URL);
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE id = %d AND datatype = %d ",
+                       id, CTSVC_DATA_URL);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
        if (1 /*CTS_TRUE*/ != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                if (CONTACTS_ERROR_NONE == ret)
                        return CONTACTS_ERROR_NO_DATA;
@@ -156,12 +131,12 @@ static int __ctsvc_db_url_update_record(contacts_record_h record)
        int ret;
        int addressbook_id;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_url_s *url = (ctsvc_url_s *)record;
+       ctsvc_url_s *url = (ctsvc_url_s*)record;
        RETVM_IF(NULL == url->url, CONTACTS_ERROR_INVALID_PARAMETER, "url is empty");
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -169,27 +144,27 @@ static int __ctsvc_db_url_update_record(contacts_record_h record)
                        "SELECT addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", url->contact_id);
        ret = ctsvc_query_get_first_int_result(query, &addressbook_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("No data : contact_id (%d) is not exist", url->contact_id);
+               ERR("No data : contact_id (%d) is not exist", url->contact_id);
                ctsvc_end_trans(false);
                return ret;
        }
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to update this url record : addressbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to update this url record : addressbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_url_update(record, false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("Update record Fail(%d)", ret);
+               ERR("Update record Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_db_contact_update_changed_time(url->contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -197,11 +172,11 @@ static int __ctsvc_db_url_update_record(contacts_record_h record)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
 static int __ctsvc_db_url_delete_record(int id)
@@ -214,22 +189,22 @@ static int __ctsvc_db_url_delete_record(int id)
 
        ret = ctsvc_begin_trans();
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_begin_trans() Fail(%d)", ret);
                return ret;
        }
 
        snprintf(query, sizeof(query),
                        "SELECT contact_id, addressbook_id FROM "CTSVC_DB_VIEW_CONTACT " "
-                               "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id);
+                       "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id);
        ret = ctsvc_query_prepare(query, &stmt);
        if (NULL == stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare Fail(%d)", ret);
+               ERR("ctsvc_query_prepare Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
        ret = ctsvc_stmt_step(stmt);
        if (1 != ret) {
-               CTS_ERR("The id(%d) is Invalid(%d)", id, ret);
+               ERR("The id(%d) is Invalid(%d)", id, ret);
                ctsvc_stmt_finalize(stmt);
                ctsvc_end_trans(false);
                if (CONTACTS_ERROR_NONE == ret)
@@ -243,21 +218,21 @@ static int __ctsvc_db_url_delete_record(int id)
        ctsvc_stmt_finalize(stmt);
 
        if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
-               CTS_ERR("Does not have permission to delete this url record : addressbook_id(%d)", addressbook_id);
+               ERR("Does not have permission to delete this url record : addressbook_id(%d)", addressbook_id);
                ctsvc_end_trans(false);
                return CONTACTS_ERROR_PERMISSION_DENIED;
        }
 
        ret = ctsvc_db_url_delete(id, false);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret);
+               ERR("ctsvc_db_url_delete() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
 
        ret = ctsvc_db_contact_update_changed_time(contact_id);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
+               ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret);
                ctsvc_end_trans(false);
                return ret;
        }
@@ -265,14 +240,14 @@ static int __ctsvc_db_url_delete_record(int id)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
-       }
-       else
+       } else {
                return CONTACTS_ERROR_NONE;
+       }
 }
 
-static int __ctsvc_db_url_get_all_records(int offset, int limit, contacts_list_hout_list)
+static int __ctsvc_db_url_get_all_records(int offset, int limit, contacts_list_h *out_list)
 {
        int len;
        int ret;
@@ -283,10 +258,10 @@ static int __ctsvc_db_url_get_all_records(int offset, int limit, contacts_list_h
 
        len = snprintf(query, sizeof(query),
                        "SELECT id, data.contact_id, is_default, data1, data2, data3 "
-                               "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
-                               "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
-                               "WHERE datatype = %d AND is_my_profile=0 ",
-                               CTSVC_DATA_URL);
+                       "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" "
+                       "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id "
+                       "WHERE datatype = %d AND is_my_profile=0 ",
+                       CTSVC_DATA_URL);
 
        if (0 != limit) {
                len += snprintf(query+len, sizeof(query)-len, " LIMIT %d", limit);
@@ -295,12 +270,12 @@ static int __ctsvc_db_url_get_all_records(int offset, int limit, contacts_list_h
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                if (1 /*CTS_TRUE */ != ret) {
-                       CTS_ERR("DB : ctsvc_stmt_step fail(%d)", ret);
+                       ERR("DB : ctsvc_stmt_step fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -316,7 +291,7 @@ static int __ctsvc_db_url_get_all_records(int offset, int limit, contacts_list_h
 }
 
 static int __ctsvc_db_url_get_records_with_query(contacts_query_h query, int offset,
-               int limit, contacts_list_hout_list)
+               int limit, contacts_list_h *out_list)
 {
        int ret;
        int i;
@@ -327,7 +302,7 @@ static int __ctsvc_db_url_get_records_with_query(contacts_query_h query, int off
        ctsvc_url_s *url;
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        ret = ctsvc_db_make_get_records_query_stmt(s_query, offset, limit, &stmt);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_db_make_get_records_query_stmt fail(%d)", ret);
@@ -336,7 +311,7 @@ static int __ctsvc_db_url_get_records_with_query(contacts_query_h query, int off
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 /*CTS_TRUE */ != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -344,9 +319,9 @@ static int __ctsvc_db_url_get_records_with_query(contacts_query_h query, int off
 
                contacts_record_create(_contacts_url._uri, &record);
                url = (ctsvc_url_s*)record;
-               if (0 == s_query->projection_count)
+               if (0 == s_query->projection_count) {
                        field_count = s_query->property_count;
-               else {
+               else {
                        field_count = s_query->projection_count;
                        ret = ctsvc_record_set_projection_flags(record, s_query->projection,
                                        s_query->projection_count, s_query->property_count);
@@ -355,7 +330,7 @@ static int __ctsvc_db_url_get_records_with_query(contacts_query_h query, int off
                                ASSERT_NOT_REACHED("To set projection is Fail.\n");
                }
 
-               for (i=0;i<field_count;i++) {
+               for (i = 0; i < field_count; i++) {
                        char *temp;
                        int property_id;
                        if (0 == s_query->projection_count)
@@ -363,7 +338,7 @@ static int __ctsvc_db_url_get_records_with_query(contacts_query_h query, int off
                        else
                                property_id = s_query->projection[i];
 
-                       switch(property_id) {
+                       switch (property_id) {
                        case CTSVC_PROPERTY_URL_ID:
                                url->id = ctsvc_stmt_get_int(stmt, i);
                                break;
@@ -395,3 +370,21 @@ static int __ctsvc_db_url_get_records_with_query(contacts_query_h query, int off
        *out_list = list;
        return CONTACTS_ERROR_NONE;
 }
+
+ctsvc_db_plugin_info_s ctsvc_db_plugin_url = {
+       .is_query_only = false,
+       .insert_record = __ctsvc_db_url_insert_record,
+       .get_record = __ctsvc_db_url_get_record,
+       .update_record = __ctsvc_db_url_update_record,
+       .delete_record = __ctsvc_db_url_delete_record,
+       .get_all_records = __ctsvc_db_url_get_all_records,
+       .get_records_with_query = __ctsvc_db_url_get_records_with_query,
+       .insert_records = NULL,
+       .update_records = NULL,
+       .delete_records = NULL,
+       .get_count = NULL,
+       .get_count_with_query = NULL,
+       .replace_record = NULL,
+       .replace_records = NULL,
+};
+
index d89fea8..ed8f2af 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include "contacts.h"
 #include "ctsvc_internal.h"
 #include "ctsvc_db_schema.h"
@@ -35,7 +34,7 @@ int ctsvc_db_url_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record, i
        char *temp;
        ctsvc_url_s *url;
 
-       ret = contacts_record_create(_contacts_url._uri, (contacts_record_h *)&url);
+       ret = contacts_record_create(_contacts_url._uri, (contacts_record_h*)&url);
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "contacts_record_create Fail(%d)", ret);
 
        url->id = ctsvc_stmt_get_int(stmt, start_count++);
@@ -56,21 +55,21 @@ int ctsvc_db_url_insert(contacts_record_h record, int contact_id, bool is_my_pro
        int ret;
        cts_stmt stmt = NULL;
        char query[CTS_SQL_MAX_LEN] = {0};
-       ctsvc_url_s *url = (ctsvc_url_s *)record;
+       ctsvc_url_s *url = (ctsvc_url_s*)record;
 
        RETV_IF(NULL == url->url, CONTACTS_ERROR_NONE);
        RETVM_IF(contact_id <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : contact_id(%d) is mandatory field to insert url record ", url->contact_id);
+                       "contact_id(%d) is mandatory field to insert url record ", url->contact_id);
        RETVM_IF(0 < url->id, CONTACTS_ERROR_INVALID_PARAMETER,
-                               "Invalid parameter : id(%d), This record is already inserted", url->id);
+                       "id(%d), This record is already inserted", url->id);
 
        snprintf(query, sizeof(query),
-               "INSERT INTO "CTS_TABLE_DATA"(contact_id, is_my_profile, datatype, data1, data2, data3) "
-                                                                       "VALUES(%d, %d, %d, %d, ?, ?)",
-                                                       contact_id, is_my_profile, CTSVC_DATA_URL, url->type);
+                       "INSERT INTO "CTS_TABLE_DATA"(contact_id, is_my_profile, datatype, data1, data2, data3) "
+                       "VALUES(%d, %d, %d, %d, ?, ?)",
+                       contact_id, is_my_profile, CTSVC_DATA_URL, url->type);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        if (url->label)
                ctsvc_stmt_bind_text(stmt, 1, url->label);
@@ -79,7 +78,7 @@ int ctsvc_db_url_insert(contacts_record_h record, int contact_id, bool is_my_pro
 
        ret = ctsvc_stmt_step(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                return ret;
        }
@@ -100,7 +99,7 @@ int ctsvc_db_url_update(contacts_record_h record, bool is_my_profile)
        int id;
        int ret = CONTACTS_ERROR_NONE;
        ctsvc_url_s *url = (ctsvc_url_s*)record;
-       charset = NULL;
+       char *set = NULL;
        GSList *bind_text = NULL;
        GSList *cursor = NULL;
        char query[CTS_SQL_MAX_LEN] = {0};
@@ -120,11 +119,14 @@ int ctsvc_db_url_update(contacts_record_h record, bool is_my_profile)
                        ctsvc_set_url_noti();
        } while (0);
 
-       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s *)record);
-       CONTACTS_FREE(set);
+       CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s*)record);
+       free(set);
+
        if (bind_text) {
-               for (cursor=bind_text;cursor;cursor=cursor->next)
-                       CONTACTS_FREE(cursor->data);
+               for (cursor = bind_text; cursor; cursor = cursor->next) {
+                       free(cursor->data);
+                       cursor->data = NULL;
+               }
                g_slist_free(bind_text);
        }
        return ret;
index 1e508b1..ed9ed35 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
  * limitations under the License.
  *
  */
-
 #ifndef __CTSVC_DB_PLUGIN_URL_HELPER_H__
 #define __CTSVC_DB_PLUGIN_URL_HELPER_H__
 
 #include "contacts.h"
 #include "ctsvc_db_sqlite.h"
 
-int ctsvc_db_url_insert(contacts_record_h record, int contact_id, bool is_my_profile, int *id);
+int ctsvc_db_url_insert(contacts_record_h record, int contact_id, bool is_my_profile,
+               int *id);
 int ctsvc_db_url_update(contacts_record_h record, bool is_my_profile);
 int ctsvc_db_url_delete(int id, bool is_my_profile);
-int ctsvc_db_url_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record, int start_count);
+int ctsvc_db_url_get_value_from_stmt(cts_stmt stmt, contacts_record_h *record,
+               int start_count);
 
 #endif /* __CTSVC_DB_PLUGIN_URL_HELPER_H__ */
index 7fb9d2d..9491cf3 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
@@ -20,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include <glib.h>
 
 #include "contacts.h"
@@ -80,7 +75,7 @@ typedef enum {
        QUERY_SORTKEY,
        QUERY_FILTER,
        QUERY_PROJECTION,
-}db_query_property_type_e;
+} db_query_property_type_e;
 
 static contacts_db_status_e __db_status = CONTACTS_DB_STATUS_NORMAL;
 
@@ -89,34 +84,37 @@ static const char * __ctsvc_db_get_property_field_name(const property_info_s *pr
 {
        int i;
 
-       for (i=0;i<count;i++) {
+       for (i = 0; i < count; i++) {
                property_info_s *p = (property_info_s*)&(properties[i]);
                if (property_id == p->property_id) {
                        if (p->fields) {
                                if (property_type == QUERY_PROJECTION) {
-                                       if (p->property_type == CTSVC_SEARCH_PROPERTY_PROJECTION || p->property_type == CTSVC_SEARCH_PROPERTY_ALL)
+                                       if (p->property_type == CTSVC_SEARCH_PROPERTY_PROJECTION
+                                                       || p->property_type == CTSVC_SEARCH_PROPERTY_ALL) {
                                                return p->fields;
-                               }
-                               else if (property_type == QUERY_FILTER) {
-                                       if (p->property_type == CTSVC_SEARCH_PROPERTY_FILTER || p->property_type == CTSVC_SEARCH_PROPERTY_ALL)
+                                       }
+                               } else if (property_type == QUERY_FILTER) {
+                                       if (p->property_type == CTSVC_SEARCH_PROPERTY_FILTER
+                                                       || p->property_type == CTSVC_SEARCH_PROPERTY_ALL) {
                                                return p->fields;
-                               }
-                               else if (property_type == QUERY_SORTKEY) {
+                                       }
+                               else if (property_type == QUERY_SORTKEY) {
                                        return p->fields;
                                }
+
                                return NULL;
-                       }
-                       /*
-                       else if (property_id == CTSVC_PROPERTY_PERSON_DISPLAY_NAME_INDEX) {
+#if 0
+                       } else if (property_id == CTSVC_PROPERTY_PERSON_DISPLAY_NAME_INDEX) {
                                if (property_type != QUERY_PROJECTION)
                                        return NULL;
-                               const char* temp = ctsvc_get_display_column();
-                               // snprintf(temp, sizeof(temp), "_NORMALIZE_INDEX_(%s)", ctsvc_get_display_column());
+                               const char *temp = ctsvc_get_display_column();
+                               /* snprintf(temp, sizeof(temp), "_NORMALIZE_INDEX_(%s)",
+                                  ctsvc_get_display_column()); */
                                return "_NORMALIZE_INDEX_"temp;
-                       }
-                       */
-                       else
+#endif
+                       } else {
                                return ctsvc_get_display_column();
+                       }
                }
        }
        return NULL;
@@ -130,12 +128,13 @@ static inline int __ctsvc_db_get_property_type(const property_info_s *properties
                int count, unsigned int property_id)
 {
        int i;
-       for (i=0;i<count;i++) {
+       for (i = 0; i < count; i++) {
                property_info_s *p = (property_info_s*)&(properties[i]);
-               if (property_id == p->property_id) {
+
+               if (property_id == p->property_id)
                        return (property_id & CTSVC_VIEW_DATA_TYPE_MASK);
-               }
        }
+
        return -1;
 }
 
@@ -146,9 +145,9 @@ static inline int __ctsvc_db_create_int_condition(ctsvc_composite_filter_s *com_
        char out_cond[CTS_SQL_MAX_LEN] = {0};
 
        field_name = __ctsvc_db_get_property_field_name(com_filter->properties,
-                                                       com_filter->property_count, QUERY_FILTER, filter->property_id);
+                       com_filter->property_count, QUERY_FILTER, filter->property_id);
        RETVM_IF(NULL == field_name, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : property id(%d)", filter->property_id);
+                       "property id(%d)", filter->property_id);
 
 #ifdef _CONTACTS_IPC_SERVER
        if (filter->property_id == CTSVC_PROPERTY_PHONELOG_SIM_SLOT_NO) {
@@ -163,7 +162,7 @@ static inline int __ctsvc_db_create_int_condition(ctsvc_composite_filter_s *com_
        }
 #endif /* _CONTACTS_IPC_SERVER */
 
-       switch(filter->match) {
+       switch (filter->match) {
        case CONTACTS_MATCH_EQUAL:
                snprintf(out_cond, sizeof(out_cond), "%s = %d", field_name, filter->value.i);
                break;
@@ -185,8 +184,8 @@ static inline int __ctsvc_db_create_int_condition(ctsvc_composite_filter_s *com_
        case CONTACTS_MATCH_NONE:
                snprintf(out_cond, sizeof(out_cond), "%s IS NULL", field_name);
                break;
-       default :
-               CTS_ERR("Invalid parameter : int match rule(%d) is not supported", filter->match);
+       default:
+               ERR("Invalid : match rule(%d) is not supported", filter->match);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
@@ -194,18 +193,20 @@ static inline int __ctsvc_db_create_int_condition(ctsvc_composite_filter_s *com_
        return CONTACTS_ERROR_NONE;
 }
 
-static inline int __ctsvc_db_create_double_condition(ctsvc_composite_filter_s *com_filter,
-               ctsvc_attribute_filter_s *filter, char **condition)
+static inline int __ctsvc_db_create_double_condition(
+               ctsvc_composite_filter_s *com_filter,
+               ctsvc_attribute_filter_s *filter,
+               char **condition)
 {
        const char *field_name;
        char out_cond[CTS_SQL_MAX_LEN] = {0};
 
        field_name = __ctsvc_db_get_property_field_name(com_filter->properties,
-                                                       com_filter->property_count, QUERY_FILTER, filter->property_id);
+                       com_filter->property_count, QUERY_FILTER, filter->property_id);
        RETVM_IF(NULL == field_name, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : property id(%d)", filter->property_id);
+                       "property id(%d)", filter->property_id);
 
-       switch(filter->match) {
+       switch (filter->match) {
        case CONTACTS_MATCH_EQUAL:
                snprintf(out_cond, sizeof(out_cond), "%s = %lf", field_name, filter->value.d);
                break;
@@ -227,8 +228,8 @@ static inline int __ctsvc_db_create_double_condition(ctsvc_composite_filter_s *c
        case CONTACTS_MATCH_NONE:
                snprintf(out_cond, sizeof(out_cond), "%s IS NULL", field_name);
                break;
-       default :
-               CTS_ERR("Invalid parameter : int match rule(%d) is not supported", filter->match);
+       default:
+               ERR("Invalid : match rule(%d) is not supported", filter->match);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
@@ -243,11 +244,11 @@ static inline int __ctsvc_db_create_lli_condition(ctsvc_composite_filter_s *com_
        char out_cond[CTS_SQL_MAX_LEN] = {0};
 
        field_name = __ctsvc_db_get_property_field_name(com_filter->properties,
-                                                       com_filter->property_count, QUERY_FILTER, filter->property_id);
+                       com_filter->property_count, QUERY_FILTER, filter->property_id);
        RETVM_IF(NULL == field_name, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : property id(%d)", filter->property_id);
+                       "property id(%d)", filter->property_id);
 
-       switch(filter->match) {
+       switch (filter->match) {
        case CONTACTS_MATCH_EQUAL:
                snprintf(out_cond, sizeof(out_cond), "%s = %lld", field_name, filter->value.l);
                break;
@@ -269,8 +270,8 @@ static inline int __ctsvc_db_create_lli_condition(ctsvc_composite_filter_s *com_
        case CONTACTS_MATCH_NONE:
                snprintf(out_cond, sizeof(out_cond), "%s IS NULL", field_name);
                break;
-       default :
-               CTS_ERR("Invalid parameter : int match rule(%d) is not supported", filter->match);
+       default:
+               ERR("Invalid : match rule(%d) is not supported", filter->match);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
@@ -280,7 +281,7 @@ static inline int __ctsvc_db_create_lli_condition(ctsvc_composite_filter_s *com_
 
 #define CTSVC_DB_ESCAPE_CHAR   '\\'
 
-static char * __ctsvc_db_get_str_with_escape(char *str, int len, bool with_escape)
+static char* __db_get_str_with_escape(char *str, int len, bool with_escape)
 {
        int i, j = 0;
        char temp_str[len*2+1];
@@ -288,10 +289,10 @@ static char * __ctsvc_db_get_str_with_escape(char *str, int len, bool with_escap
        if (false == with_escape)
                return strdup(str);
 
-       for (i=0;i<len;i++) {
-               if (str[i] == '\'' || str[i] == '_' || str[i] == '%' || str[i] == '\\') {
+       for (i = 0; i < len; i++) {
+               if (str[i] == '\'' || str[i] == '_' || str[i] == '%' || str[i] == '\\')
                        temp_str[j++] = CTSVC_DB_ESCAPE_CHAR;
-               }
+
                temp_str[j++] = str[i];
        }
        temp_str[j] = '\0';
@@ -299,41 +300,254 @@ static char * __ctsvc_db_get_str_with_escape(char *str, int len, bool with_escap
        return strdup(temp_str);
 }
 
-static inline int __ctsvc_db_add_str_matching_rule(const char *field_name, int match, char **condition, bool *with_escape)
+static int __db_add_str_matching_rule(const char *field_name, int match,
+               char **condition, bool *with_escape)
 {
-       int cond_len = 0;
-       char out_cond[CTS_SQL_MAX_LEN] = {0};
+       int len = 0;
+       char cond[CTS_SQL_MAX_LEN] = {0};
 
        *with_escape = true;
-       switch(match) {
+       switch (match) {
        case CONTACTS_MATCH_EXACTLY:
-               cond_len = snprintf(out_cond, sizeof(out_cond), "%s = ?", field_name);
+               len = snprintf(cond, sizeof(cond), "%s = ?", field_name);
                *with_escape = false;
                break;
        case CONTACTS_MATCH_FULLSTRING:
-               cond_len = snprintf(out_cond, sizeof(out_cond), "%s LIKE ? ESCAPE '%c'", field_name, CTSVC_DB_ESCAPE_CHAR);
+               len = snprintf(cond, sizeof(cond), "%s LIKE ? ESCAPE '%c'",
+                               field_name, CTSVC_DB_ESCAPE_CHAR);
                break;
        case CONTACTS_MATCH_CONTAINS:
-               cond_len = snprintf(out_cond, sizeof(out_cond), "%s LIKE ('%%' || ? || '%%') ESCAPE '%c'", field_name, CTSVC_DB_ESCAPE_CHAR);
+               len = snprintf(cond, sizeof(cond),      "%s LIKE ('%%' || ? || '%%') ESCAPE '%c'",
+                               field_name, CTSVC_DB_ESCAPE_CHAR);
                break;
        case CONTACTS_MATCH_STARTSWITH:
-               cond_len = snprintf(out_cond, sizeof(out_cond), "%s LIKE (? || '%%') ESCAPE '%c'", field_name, CTSVC_DB_ESCAPE_CHAR);
+               len = snprintf(cond, sizeof(cond), "%s LIKE (? || '%%') ESCAPE '%c'",
+                               field_name, CTSVC_DB_ESCAPE_CHAR);
                break;
        case CONTACTS_MATCH_ENDSWITH:
-               cond_len = snprintf(out_cond, sizeof(out_cond), "%s LIKE ('%%' || ?) ESCAPE '%c'", field_name, CTSVC_DB_ESCAPE_CHAR);
+               len = snprintf(cond, sizeof(cond), "%s LIKE ('%%' || ?) ESCAPE '%c'",
+                               field_name, CTSVC_DB_ESCAPE_CHAR);
                break;
        case CONTACTS_MATCH_EXISTS:
-               cond_len = snprintf(out_cond, sizeof(out_cond), "%s IS NOT NULL", field_name);
+               len = snprintf(cond, sizeof(cond), "%s IS NOT NULL", field_name);
                break;
-       default :
-               CTS_ERR("Invalid parameter : int match rule (%d) is not supported", match);
+       default:
+               ERR("Invalid : match rule (%d) is not supported", match);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
-       if (0 < cond_len)
-               *condition = strdup(out_cond);
+       if (0 < len)
+               *condition = strdup(cond);
+
+       return len;
+}
+
+
+static inline void __db_create_str_condtion_number(
+               ctsvc_composite_filter_s *com_filter,
+               ctsvc_attribute_filter_s *filter,
+               bool with_escape,
+               GSList **bind_text,
+               int cond_len,
+               char *out_cond,
+               int out_cond_size)
+{
+       /*
+        * number filter is for matching number
+        * depends on internal rule _NUMBER_COMPARE_
+        */
+       int ret;
+       char clean_num[strlen(filter->value.s)+1+5];   /* for cc */
+       char normal_num[strlen(filter->value.s)+1+5];  /* for cc */
+       bool add_condition = false;
+
+       ret = ctsvc_clean_number(filter->value.s, clean_num, sizeof(clean_num), false);
+       if (0 < ret) {
+               ret = ctsvc_normalize_number(clean_num, normal_num, sizeof(normal_num), false);
+               normal_num[sizeof(normal_num) -1] = '\0';
+               if (0 < ret) {
+                       char min_match[strlen(filter->value.s)+1+5];   /* for cc */
+                       ret = ctsvc_get_minmatch_number(normal_num, min_match,
+                                       sizeof(min_match), ctsvc_get_phonenumber_min_match_digit());
+                       if (CONTACTS_ERROR_NONE == ret) {
+                               /* minmatch filter is to improve performance */
+                               size_t min_match_sz = strlen(min_match);
+                               *bind_text = g_slist_append(*bind_text,
+                                               __db_get_str_with_escape(min_match, min_match_sz, with_escape));
+
+                               /* _NUMBER_COMPARE_(noraml_num, normalized keyword) */
+                               if (STRING_EQUAL != strcmp(normal_num, "+")) {
+                                       const char *number_field = NULL;
+                                       int property_id = filter->property_id;
+                                       if (property_id == CTSVC_PROPERTY_NUMBER_NUMBER_FILTER) {
+                                               number_field = __ctsvc_db_get_property_field_name(
+                                                               com_filter->properties,
+                                                               com_filter->property_count,
+                                                               QUERY_FILTER,
+                                                               CTSVC_PROPERTY_NUMBER_NORMALIZED_NUMBER);
+                                       } else if (property_id == CTSVC_PROPERTY_PHONELOG_ADDRESS_FILTER) {
+                                               number_field = __ctsvc_db_get_property_field_name(
+                                                               com_filter->properties,
+                                                               com_filter->property_count,
+                                                               QUERY_FILTER,
+                                                               CTSVC_PROPERTY_PHONELOG_NORMALIZED_ADDRESS);
+                                       } else if (property_id == CTSVC_PROPERTY_SPEEDDIAL_NUMBER_FILTER) {
+                                               number_field = __ctsvc_db_get_property_field_name(
+                                                               com_filter->properties,
+                                                               com_filter->property_count,
+                                                               QUERY_FILTER,
+                                                               CTSVC_PROPERTY_SPEEDDIAL_NORMALIZED_NUMBER);
+                                       }
+
+                                       if (number_field) {
+                                               cond_len += snprintf(out_cond+cond_len, out_cond_size - cond_len,
+                                                               " AND _NUMBER_COMPARE_(%s, ?, NULL, NULL)", number_field);
+                                               *bind_text = g_slist_append(*bind_text, strdup(normal_num));
+                                               add_condition = true;
+                                       }
+                               }
+                       }
+               }
+       }
+
+       if (add_condition == false) {
+               /* If Failto get normalized number then compare with original number */
+               const char *number_field = NULL;
+               if (filter->property_id == CTSVC_PROPERTY_NUMBER_NUMBER_FILTER) {
+                       number_field = __ctsvc_db_get_property_field_name(com_filter->properties,
+                                       com_filter->property_count,
+                                       QUERY_FILTER,
+                                       CTSVC_PROPERTY_NUMBER_NUMBER);
+               } else if (filter->property_id == CTSVC_PROPERTY_PHONELOG_ADDRESS_FILTER) {
+                       number_field = __ctsvc_db_get_property_field_name(com_filter->properties,
+                                       com_filter->property_count,
+                                       QUERY_FILTER,
+                                       CTSVC_PROPERTY_PHONELOG_ADDRESS);
+               } else if (filter->property_id == CTSVC_PROPERTY_SPEEDDIAL_NUMBER_FILTER) {
+                       number_field = __ctsvc_db_get_property_field_name(com_filter->properties,
+                                       com_filter->property_count,
+                                       QUERY_FILTER,
+                                       CTSVC_PROPERTY_SPEEDDIAL_NUMBER);
+               }
+
+               if (number_field) {
+                       snprintf(out_cond, out_cond_size, "%s = ?", number_field);
+                       *bind_text = g_slist_append(*bind_text, strdup(filter->value.s));
+               }
+       }
+}
+
+static inline int __db_create_str_condtion_normalized_number(
+               ctsvc_composite_filter_s *com_filter,
+               ctsvc_attribute_filter_s *filter,
+               bool with_escape,
+               GSList **bind_text,
+               int cond_len,
+               char *out_cond,
+               int out_cond_sz)
+{
+       int ret;
+       char *tmp = NULL;
+       char clean_num[strlen(filter->value.s)+1+5];   /* for cc */
+
+       ret = ctsvc_clean_number(filter->value.s, clean_num, sizeof(clean_num), false);
+       if (0 < ret) {
+               bool add_condition = true;
+               const char *clean_field = NULL;
+               /* has clean number or normalized number */
+               const char *cc = ctsvc_get_network_cc(false);
+               if (cc && cc[0] == '7' && clean_num[0] == '8') {   /* Russia */
+                       char normal_num[strlen(clean_num)+1+5];   /* for cc */
+                       int normal_num_sz = sizeof(normal_num);
+
+                       ret = ctsvc_normalize_number(clean_num, normal_num, normal_num_sz, false);
+                       if (0 < ret) {
+                               *bind_text = g_slist_append(*bind_text,
+                                               __db_get_str_with_escape(normal_num, normal_num_sz, with_escape));
+                       } else {
+                               *bind_text = g_slist_append(*bind_text,
+                                               __db_get_str_with_escape(clean_num, normal_num_sz, with_escape));
+                       }
+               } else if (STRING_EQUAL != strcmp(clean_num, "+")) {
+                       *bind_text = g_slist_append(*bind_text,
+                                       __db_get_str_with_escape(clean_num, strlen(clean_num), with_escape));
+               } else {
+                       add_condition = false;
+               }
+
+               if (filter->property_id == CTSVC_PROPERTY_NUMBER_NORMALIZED_NUMBER) {
+                       clean_field = __ctsvc_db_get_property_field_name(com_filter->properties,
+                                       com_filter->property_count,
+                                       QUERY_FILTER,
+                                       CTSVC_PROPERTY_NUMBER_CLEANED_NUMBER);
+               } else if (filter->property_id == CTSVC_PROPERTY_PHONELOG_NORMALIZED_ADDRESS) {
+                       clean_field =  __ctsvc_db_get_property_field_name(com_filter->properties,
+                                       com_filter->property_count,
+                                       QUERY_FILTER,
+                                       CTSVC_PROPERTY_PHONELOG_CLEANED_ADDRESS);
+               } else if (filter->property_id == CTSVC_PROPERTY_SPEEDDIAL_NORMALIZED_NUMBER) {
+                       clean_field =  __ctsvc_db_get_property_field_name(com_filter->properties,
+                                       com_filter->property_count,
+                                       QUERY_FILTER,
+                                       CTSVC_PROPERTY_SPEEDDIAL_CLEANED_NUMBER);
+               }
+
+               if (clean_field) {
+                       if (add_condition)
+                               cond_len += snprintf(out_cond+cond_len, out_cond_sz - cond_len, " OR ");
+                       ret = __db_add_str_matching_rule(clean_field, filter->match, &tmp,
+                                       &with_escape);
+                       if (ret <= 0) {
+                               ERR("__db_add_str_matching_rule() Fail");
+                               return CONTACTS_ERROR_INVALID_PARAMETER;
+                       }
+                       cond_len += snprintf(out_cond + cond_len, out_cond_sz - cond_len, "%s", tmp);
+                       free(tmp);
+                       tmp = NULL;
+                       *bind_text = g_slist_append(*bind_text,
+                                       __db_get_str_with_escape(clean_num, strlen(clean_num), with_escape));
+               }
+       } else if (ret == 0) {
+               /* If Failto get cleaned number then compare with original number */
+               const char *number_field = NULL;
+               if (filter->property_id == CTSVC_PROPERTY_NUMBER_NORMALIZED_NUMBER) {
+                       number_field = __ctsvc_db_get_property_field_name(com_filter->properties,
+                                       com_filter->property_count,
+                                       QUERY_FILTER,
+                                       CTSVC_PROPERTY_NUMBER_NUMBER);
+               } else if (filter->property_id == CTSVC_PROPERTY_PHONELOG_NORMALIZED_ADDRESS) {
+                       number_field =  __ctsvc_db_get_property_field_name(com_filter->properties,
+                                       com_filter->property_count,
+                                       QUERY_FILTER,
+                                       CTSVC_PROPERTY_PHONELOG_ADDRESS);
+               } else if (filter->property_id == CTSVC_PROPERTY_SPEEDDIAL_NORMALIZED_NUMBER) {
+                       number_field =  __ctsvc_db_get_property_field_name(com_filter->properties,
+                                       com_filter->property_count,
+                                       QUERY_FILTER,
+                                       CTSVC_PROPERTY_SPEEDDIAL_NUMBER);
+               }
+
+               if (number_field) {
+                       ret = __db_add_str_matching_rule(number_field, filter->match, &tmp,
+                                       &with_escape);
+                       if (ret <= 0) {
+                               ERR("__db_add_str_matching_rule() Fail");
+                               return CONTACTS_ERROR_INVALID_PARAMETER;
+                       }
+
+                       cond_len = snprintf(out_cond, out_cond_sz, "%s", tmp);
+                       free(tmp);
+                       tmp = NULL;
+                       *bind_text = g_slist_append(*bind_text,
+                                       __db_get_str_with_escape(filter->value.s, strlen(filter->value.s),
+                                               with_escape)
+                                       );
+               }
+       } else {
+               return CONTACTS_ERROR_INVALID_PARAMETER;
+       }
 
-       return cond_len;
+       return CONTACTS_ERROR_NONE;
 }
 
 static inline int __ctsvc_db_create_str_condition(ctsvc_composite_filter_s *com_filter,
@@ -342,16 +556,16 @@ static inline int __ctsvc_db_create_str_condition(ctsvc_composite_filter_s *com_
        int ret;
        const char *field_name;
        char out_cond[CTS_SQL_MAX_LEN] = {0};
-       char *temp = NULL;
+       char *tmp = NULL;
        int cond_len = 0;
        bool with_escape = true;
 
        *condition = NULL;
 
        field_name = __ctsvc_db_get_property_field_name(com_filter->properties,
-                                                       com_filter->property_count, QUERY_FILTER, filter->property_id);
+                       com_filter->property_count, QUERY_FILTER, filter->property_id);
        RETVM_IF(NULL == field_name, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : property id(%d)", filter->property_id);
+                       "property id(%d)", filter->property_id);
 
        /*
         * number_filter condition is only used to find exactly matched number
@@ -362,226 +576,131 @@ static inline int __ctsvc_db_create_str_condition(ctsvc_composite_filter_s *com_
                        || filter->property_id == CTSVC_PROPERTY_SPEEDDIAL_NUMBER_FILTER)
                filter->match = CONTACTS_MATCH_EXACTLY;
 
-       ret = __ctsvc_db_add_str_matching_rule(field_name, filter->match, &temp, &with_escape);
-       if(ret <= 0 ){
-               free(temp);
-               CTS_ERR("__ctsvc_db_add_str_matching_rule Fail");
+       ret = __db_add_str_matching_rule(field_name, filter->match, &tmp, &with_escape);
+       if (ret <= 0) {
+               ERR("__db_add_str_matching_rule() Fail(%d)", ret);
+               free(tmp);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
-       cond_len = snprintf(out_cond, sizeof(out_cond), "%s", temp);
-       free(temp);
-       temp = NULL;
+       cond_len = snprintf(out_cond, sizeof(out_cond), "%s", tmp);
+       free(tmp);
+       tmp = NULL;
 
        if (filter->value.s) {
-               /* number filter */
                if (filter->property_id == CTSVC_PROPERTY_NUMBER_NUMBER_FILTER
-                       || filter->property_id == CTSVC_PROPERTY_PHONELOG_ADDRESS_FILTER
-                       || filter->property_id == CTSVC_PROPERTY_SPEEDDIAL_NUMBER_FILTER) {
-                       /*
-                        * number filter is for matching number
-                        * depends on internal rule _NUMBER_COMPARE_
-                        */
-                       char clean_num[strlen(filter->value.s)+1+5];   /* for cc */
-                       char normal_num[strlen(filter->value.s)+1+5];  /* for cc */
-                       bool add_condition = false;
-                       ret = ctsvc_clean_number(filter->value.s, clean_num, sizeof(clean_num), false);
-                       if (0 < ret) {
-                               ret = ctsvc_normalize_number(clean_num, normal_num, sizeof(normal_num), false);
-                               normal_num[sizeof(normal_num) -1] = '\0';
-                               if (0 < ret) {
-                                       char min_match[strlen(filter->value.s)+1+5];   /* for cc */
-                                       ret = ctsvc_get_minmatch_number(normal_num, min_match, sizeof(min_match), ctsvc_get_phonenumber_min_match_digit());
-                                       if (CONTACTS_ERROR_NONE == ret) {
-                                               /* minmatch filter is to improve performance */
-                                               *bind_text = g_slist_append(*bind_text, __ctsvc_db_get_str_with_escape(min_match, strlen(min_match), with_escape));
-
-                                               /* _NUMBER_COMPARE_(noraml_num, normalized keyword) */
-                                               if (STRING_EQUAL != strcmp(normal_num, "+")) {
-                                                       const char *number_field = NULL;
-                                                       if (filter->property_id == CTSVC_PROPERTY_NUMBER_NUMBER_FILTER)
-                                                               number_field = __ctsvc_db_get_property_field_name(com_filter->properties,
-                                                                                               com_filter->property_count, QUERY_FILTER, CTSVC_PROPERTY_NUMBER_NORMALIZED_NUMBER);
-                                                       else if (filter->property_id == CTSVC_PROPERTY_PHONELOG_ADDRESS_FILTER)
-                                                               number_field = __ctsvc_db_get_property_field_name(com_filter->properties,
-                                                                                               com_filter->property_count, QUERY_FILTER, CTSVC_PROPERTY_PHONELOG_NORMALIZED_ADDRESS);
-                                                       else if (filter->property_id == CTSVC_PROPERTY_SPEEDDIAL_NUMBER_FILTER)
-                                                               number_field = __ctsvc_db_get_property_field_name(com_filter->properties,
-                                                                                               com_filter->property_count, QUERY_FILTER, CTSVC_PROPERTY_SPEEDDIAL_NORMALIZED_NUMBER);
-
-                                                       if (number_field) {
-                                                               cond_len += snprintf(out_cond+cond_len, sizeof(out_cond)-cond_len, " AND _NUMBER_COMPARE_(%s, ?, NULL, NULL)", number_field);
-                                                               *bind_text = g_slist_append(*bind_text, strdup(normal_num));
-                                                               add_condition = true;
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-
-                       if (add_condition == false) {
-                               /* If fail to get normalized number then compare with original number */
-                               const char *number_field = NULL;
-                               if (filter->property_id == CTSVC_PROPERTY_NUMBER_NUMBER_FILTER)
-                                       number_field = __ctsvc_db_get_property_field_name(com_filter->properties,
-                                                                       com_filter->property_count, QUERY_FILTER, CTSVC_PROPERTY_NUMBER_NUMBER);
-                               else if (filter->property_id == CTSVC_PROPERTY_PHONELOG_ADDRESS_FILTER)
-                                       number_field = __ctsvc_db_get_property_field_name(com_filter->properties,
-                                                                       com_filter->property_count, QUERY_FILTER, CTSVC_PROPERTY_PHONELOG_ADDRESS);
-                               else if (filter->property_id == CTSVC_PROPERTY_SPEEDDIAL_NUMBER_FILTER)
-                                       number_field = __ctsvc_db_get_property_field_name(com_filter->properties,
-                                                                       com_filter->property_count, QUERY_FILTER, CTSVC_PROPERTY_SPEEDDIAL_NUMBER);
-
-
-                               if (number_field) {
-                                       snprintf(out_cond, sizeof(out_cond), "%s = ?", number_field);
-                                       *bind_text = g_slist_append(*bind_text, strdup(filter->value.s));
-                               }
-                       }
-               }
-               /* normalized number */
-               else if (filter->property_id == CTSVC_PROPERTY_NUMBER_NORMALIZED_NUMBER
+                               || filter->property_id == CTSVC_PROPERTY_PHONELOG_ADDRESS_FILTER
+                               || filter->property_id == CTSVC_PROPERTY_SPEEDDIAL_NUMBER_FILTER) {
+                       /* number filter */
+                       __db_create_str_condtion_number(com_filter, filter, with_escape, bind_text,
+                                       cond_len, out_cond, sizeof(out_cond));
+               } else if (filter->property_id == CTSVC_PROPERTY_NUMBER_NORMALIZED_NUMBER
                                || filter->property_id == CTSVC_PROPERTY_PHONELOG_NORMALIZED_ADDRESS
                                || filter->property_id == CTSVC_PROPERTY_SPEEDDIAL_NORMALIZED_NUMBER) {
-                       char clean_num[strlen(filter->value.s)+1+5];   /* for cc */
-                       ret = ctsvc_clean_number(filter->value.s, clean_num, sizeof(clean_num), false);
-                       if (0 < ret) {
-                               bool add_condition = true;
-                               const char *clean_field = NULL;
-                               /* has clean number or normalized number */
-                               const char *cc = ctsvc_get_network_cc(false);
-                               if (cc && cc[0] == '7' && clean_num[0] == '8') {   /* Russia */
-                                       char normal_num[strlen(clean_num)+1+5];   /* for cc */
-                                       ret = ctsvc_normalize_number(clean_num, normal_num, sizeof(normal_num), false);
-                                       if (0 < ret)
-                                               *bind_text = g_slist_append(*bind_text, __ctsvc_db_get_str_with_escape(normal_num, strlen(normal_num), with_escape));
-                                       else
-                                               *bind_text = g_slist_append(*bind_text, __ctsvc_db_get_str_with_escape(clean_num, strlen(clean_num), with_escape));
-                               }
-                               else if (STRING_EQUAL != strcmp(clean_num, "+")) {
-                                       *bind_text = g_slist_append(*bind_text, __ctsvc_db_get_str_with_escape(clean_num, strlen(clean_num), with_escape));
-                               }
-                               else
-                                       add_condition = false;
-
-                               if (filter->property_id == CTSVC_PROPERTY_NUMBER_NORMALIZED_NUMBER)
-                                       clean_field = __ctsvc_db_get_property_field_name(com_filter->properties,
-                                                                       com_filter->property_count, QUERY_FILTER, CTSVC_PROPERTY_NUMBER_CLEANED_NUMBER);
-                               else if (filter->property_id == CTSVC_PROPERTY_PHONELOG_NORMALIZED_ADDRESS)
-                                       clean_field =  __ctsvc_db_get_property_field_name(com_filter->properties,
-                                                                               com_filter->property_count, QUERY_FILTER, CTSVC_PROPERTY_PHONELOG_CLEANED_ADDRESS);
-                               else if (filter->property_id == CTSVC_PROPERTY_SPEEDDIAL_NORMALIZED_NUMBER)
-                                       clean_field =  __ctsvc_db_get_property_field_name(com_filter->properties,
-                                                                               com_filter->property_count, QUERY_FILTER, CTSVC_PROPERTY_SPEEDDIAL_CLEANED_NUMBER);
-
-                               if (clean_field) {
-                                       if (add_condition)
-                                               cond_len += snprintf(out_cond+cond_len, sizeof(out_cond)-cond_len, " OR ");
-                                       ret = __ctsvc_db_add_str_matching_rule(clean_field, filter->match, &temp, &with_escape);
-                                       if(ret <= 0){
-                                               free(temp);
-                                               CTS_ERR("__ctsvc_db_add_str_matching_rule Fail");
-                                               return CONTACTS_ERROR_INVALID_PARAMETER;
-                                       }
-                                       cond_len += snprintf(out_cond+cond_len, sizeof(out_cond)-cond_len, "%s", temp);
-                                       free(temp);
-                                       temp = NULL;
-                                       *bind_text = g_slist_append(*bind_text, __ctsvc_db_get_str_with_escape(clean_num, strlen(clean_num), with_escape));
-                               }
-                       }
-                       else if (ret == 0) {
-                               /* If fail to get cleaned number then compare with original number */
-                               const char *number_field = NULL;
-                               if (filter->property_id == CTSVC_PROPERTY_NUMBER_NORMALIZED_NUMBER)
-                                       number_field = __ctsvc_db_get_property_field_name(com_filter->properties,
-                                                                       com_filter->property_count, QUERY_FILTER, CTSVC_PROPERTY_NUMBER_NUMBER);
-                               else if (filter->property_id == CTSVC_PROPERTY_PHONELOG_NORMALIZED_ADDRESS)
-                                       number_field =  __ctsvc_db_get_property_field_name(com_filter->properties,
-                                                                               com_filter->property_count, QUERY_FILTER, CTSVC_PROPERTY_PHONELOG_ADDRESS);
-                               else if (filter->property_id == CTSVC_PROPERTY_SPEEDDIAL_NORMALIZED_NUMBER)
-                                       number_field =  __ctsvc_db_get_property_field_name(com_filter->properties,
-                                                                               com_filter->property_count, QUERY_FILTER, CTSVC_PROPERTY_SPEEDDIAL_NUMBER);
-
-                               if (number_field) {
-                                       ret = __ctsvc_db_add_str_matching_rule(number_field, filter->match, &temp, &with_escape);
-                                       RETVM_IF(ret <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
-                                                               "__ctsvc_db_add_str_matching_rule Fail");
-                                       cond_len = snprintf(out_cond, sizeof(out_cond), "%s", temp);
-                                       free(temp);
-                                       temp = NULL;
-                                       *bind_text = g_slist_append(*bind_text, __ctsvc_db_get_str_with_escape(filter->value.s, strlen(filter->value.s), with_escape));
-                               }
+                       /* normalized number */
+                       ret = __db_create_str_condtion_normalized_number(com_filter, filter,
+                                       with_escape, bind_text, cond_len, out_cond, sizeof(out_cond));
+                       if (CONTACTS_ERROR_NONE != ret) {
+                               ERR("__db_create_str_condtion_normalized_number() Fail(%d)", ret);
+                               return ret;
                        }
-                       else
-                               return CONTACTS_ERROR_INVALID_PARAMETER;
-               }
-               /* cleaned number */
-               else if (filter->property_id == CTSVC_PROPERTY_NUMBER_CLEANED_NUMBER
+               } else if (filter->property_id == CTSVC_PROPERTY_NUMBER_CLEANED_NUMBER
                                || filter->property_id == CTSVC_PROPERTY_PHONELOG_CLEANED_ADDRESS
                                || filter->property_id == CTSVC_PROPERTY_SPEEDDIAL_CLEANED_NUMBER) {
+                       /* cleaned number */
                        char clean_num[strlen(filter->value.s)+1+5];   /* for cc */
-                       ret = ctsvc_clean_number(filter->value.s, clean_num, sizeof(clean_num), false);
+
+                       ret = ctsvc_clean_number(filter->value.s, clean_num, sizeof(clean_num),
+                                       false);
                        if (0 < ret) {
-                               *bind_text = g_slist_append(*bind_text, __ctsvc_db_get_str_with_escape(clean_num, strlen(clean_num), with_escape));
-                       }
-                       else if (ret == 0) {
-                               /* If fail to get cleaned number then compare with original number */
+                               *bind_text = g_slist_append(*bind_text,
+                                               __db_get_str_with_escape(clean_num, strlen(clean_num),
+                                                       with_escape));
+                       } else if (ret == 0) {
+                               /* If Failto get cleaned number then compare with original number */
                                const char *number_field = NULL;
-                               if (filter->property_id == CTSVC_PROPERTY_NUMBER_CLEANED_NUMBER)
-                                       number_field = __ctsvc_db_get_property_field_name(com_filter->properties,
-                                                                       com_filter->property_count, QUERY_FILTER, CTSVC_PROPERTY_NUMBER_NUMBER);
-                               else if (filter->property_id == CTSVC_PROPERTY_PHONELOG_CLEANED_ADDRESS)
-                                       number_field =  __ctsvc_db_get_property_field_name(com_filter->properties,
-                                                                               com_filter->property_count, QUERY_FILTER, CTSVC_PROPERTY_PHONELOG_ADDRESS);
-                               else if (filter->property_id == CTSVC_PROPERTY_SPEEDDIAL_CLEANED_NUMBER)
-                                       number_field =  __ctsvc_db_get_property_field_name(com_filter->properties,
-                                                                               com_filter->property_count, QUERY_FILTER, CTSVC_PROPERTY_SPEEDDIAL_NUMBER);
+                               if (filter->property_id == CTSVC_PROPERTY_NUMBER_CLEANED_NUMBER) {
+                                       number_field = __ctsvc_db_get_property_field_name(
+                                                       com_filter->properties,
+                                                       com_filter->property_count,
+                                                       QUERY_FILTER,
+                                                       CTSVC_PROPERTY_NUMBER_NUMBER);
+                               } else if (filter->property_id == CTSVC_PROPERTY_PHONELOG_CLEANED_ADDRESS) {
+                                       number_field =  __ctsvc_db_get_property_field_name(
+                                                       com_filter->properties,
+                                                       com_filter->property_count,
+                                                       QUERY_FILTER,
+                                                       CTSVC_PROPERTY_PHONELOG_ADDRESS);
+                               } else if (filter->property_id == CTSVC_PROPERTY_SPEEDDIAL_CLEANED_NUMBER) {
+                                       number_field =  __ctsvc_db_get_property_field_name(
+                                                       com_filter->properties,
+                                                       com_filter->property_count,
+                                                       QUERY_FILTER,
+                                                       CTSVC_PROPERTY_SPEEDDIAL_NUMBER);
+                               }
 
                                if (number_field) {
-                                       ret = __ctsvc_db_add_str_matching_rule(number_field, filter->match, &temp, &with_escape);
+                                       ret = __db_add_str_matching_rule(number_field, filter->match, &tmp,
+                                                       &with_escape);
                                        RETVM_IF(ret <= 0, CONTACTS_ERROR_INVALID_PARAMETER,
-                                                               "__ctsvc_db_add_str_matching_rule Fail");
-                                       cond_len = snprintf(out_cond, sizeof(out_cond), "%s", temp);
-                                       free(temp);
-                                       temp = NULL;
-                                       *bind_text = g_slist_append(*bind_text, __ctsvc_db_get_str_with_escape(filter->value.s, strlen(filter->value.s), with_escape));
+                                                       "__db_add_str_matching_rule Fail");
+                                       cond_len = snprintf(out_cond, sizeof(out_cond), "%s", tmp);
+                                       free(tmp);
+                                       tmp = NULL;
+                                       *bind_text = g_slist_append(*bind_text,
+                                                       __db_get_str_with_escape(filter->value.s,
+                                                               strlen(filter->value.s), with_escape));
                                }
-                       }
-                       else
+                       } else {
                                return CONTACTS_ERROR_INVALID_PARAMETER;
-               }
-               else if (filter->property_id == CTSVC_PROPERTY_CONTACT_IMAGE_THUMBNAIL
+                       }
+               else if (filter->property_id == CTSVC_PROPERTY_CONTACT_IMAGE_THUMBNAIL
                                || 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 (STRING_EQUAL == strncmp(filter->value.s, CTSVC_CONTACT_IMG_FULL_LOCATION, strlen(CTSVC_CONTACT_IMG_FULL_LOCATION))) {
+                       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,
+                                               __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));
+                       } else {
                                *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));
+                                               __db_get_str_with_escape(filter->value.s, strlen(filter->value.s),
+                                                       with_escape));
                        }
-                       else
-                               *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 (STRING_EQUAL == strncmp(filter->value.s, CTS_GROUP_IMAGE_LOCATION, strlen(CTS_GROUP_IMAGE_LOCATION))) {
+               } else if (filter->property_id == CTSVC_PROPERTY_GROUP_IMAGE) {
+                       if (STRING_EQUAL == strncmp(filter->value.s, CTS_GROUP_IMAGE_LOCATION,
+                                               strlen(CTS_GROUP_IMAGE_LOCATION))) {
+                               *bind_text = g_slist_append(*bind_text,
+                                               __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));
+                       } else {
                                *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));
+                                               __db_get_str_with_escape(filter->value.s, strlen(filter->value.s),
+                                                       with_escape));
                        }
-                       else
-                               *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 (STRING_EQUAL == strncmp(filter->value.s, CTS_LOGO_IMAGE_LOCATION, strlen(CTS_LOGO_IMAGE_LOCATION))) {
+               } else if (filter->property_id == CTSVC_PROPERTY_COMPANY_LOGO) {
+                       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));
+                                               __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));
+                       } else {
+                               *bind_text = g_slist_append(*bind_text,
+                                               __db_get_str_with_escape(filter->value.s, strlen(filter->value.s),
+                                                       with_escape));
                        }
-                       else
-                               *bind_text = g_slist_append(*bind_text, __ctsvc_db_get_str_with_escape(filter->value.s, strlen(filter->value.s), with_escape));
 
+               } else {
+                       *bind_text = g_slist_append(*bind_text,
+                                       __db_get_str_with_escape(filter->value.s, strlen(filter->value.s),
+                                               with_escape));
                }
-               else
-                       *bind_text = g_slist_append(*bind_text, __ctsvc_db_get_str_with_escape(filter->value.s, strlen(filter->value.s), with_escape));
        }
 
        *condition = strdup(out_cond);
@@ -596,11 +715,11 @@ static inline int __ctsvc_db_create_bool_condition(ctsvc_composite_filter_s *com
        char out_cond[CTS_SQL_MAX_LEN] = {0};
 
        field_name = __ctsvc_db_get_property_field_name(com_filter->properties,
-                                                       com_filter->property_count, QUERY_FILTER, filter->property_id);
+                       com_filter->property_count, QUERY_FILTER, filter->property_id);
        RETVM_IF(NULL == field_name, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : property id(%d)", filter->property_id);
+                       "property id(%d)", filter->property_id);
 
-       snprintf(out_cond, sizeof(out_cond), "%s = %d", field_name, filter->value.b?1:0);
+       snprintf(out_cond, sizeof(out_cond), "%s = %d", field_name, filter->value.b ? 1 : 0);
        *condition = strdup(out_cond);
        return CONTACTS_ERROR_NONE;
 }
@@ -629,8 +748,8 @@ static int __ctsvc_db_create_attribute_condition(ctsvc_composite_filter_s *com_f
        case CTSVC_FILTER_DOUBLE:
                ret = __ctsvc_db_create_double_condition(com_filter, filter, &cond);
                break;
-       default :
-               CTS_ERR("The filter type is not supported (%d)", filter->filter_type);
+       default:
+               ERR("The filter type is not supported (%d)", filter->filter_type);
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
@@ -643,12 +762,12 @@ static int __ctsvc_db_create_attribute_condition(ctsvc_composite_filter_s *com_f
 #define CTSVC_FILTER_LENGTH    100
 
 /*
- * If there are too many condition, sqlite return fail SQLITE_ERROR(1).
+ * If there are too many condition, sqlite return FailSQLITE_ERROR(1).
  * Expression tree is too large (maximum depth 1000).
  * It is related to SQLITE_LIMIT_EXPR_DEPTH.
  */
-static inline int __ctsvc_db_create_composite_condition(ctsvc_composite_filter_s *com_filter,
-               char **condition, GSList **bind_text)
+static inline int __db_create_composite_condition(
+               ctsvc_composite_filter_s *com_filter, char **condition, GSList **bind_text)
 {
        RETV_IF(NULL == com_filter, CONTACTS_ERROR_INVALID_PARAMETER);
 
@@ -667,21 +786,25 @@ static inline int __ctsvc_db_create_composite_condition(ctsvc_composite_filter_s
 
        *condition = NULL;
        /* the case : did not set filter condition after calling contacts_filter_create() */
+
        RETV_IF(NULL == filters, CONTACTS_ERROR_NONE);
 
        cond = NULL;
        bind = NULL;
 
-       filter = (ctsvc_filter_s *)filters->data;
-       if (filter->filter_type == CTSVC_FILTER_COMPOSITE)
-               __ctsvc_db_create_composite_condition((ctsvc_composite_filter_s *)filter, &cond, bind_text);
-       else
-               __ctsvc_db_create_attribute_condition(com_filter, (ctsvc_attribute_filter_s*)filter, &cond, bind_text);
+       filter = (ctsvc_filter_s*)filters->data;
+       if (filter->filter_type == CTSVC_FILTER_COMPOSITE) {
+               __db_create_composite_condition((ctsvc_composite_filter_s*)filter, &cond,
+                               bind_text);
+       } else {
+               __ctsvc_db_create_attribute_condition(com_filter,
+                               (ctsvc_attribute_filter_s*)filter, &cond, bind_text);
+       }
 
        buf_size = CTSVC_FILTER_LENGTH;
        out_cond = calloc(1, buf_size);
        if (NULL == out_cond) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                free(cond);
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
@@ -689,24 +812,33 @@ static inline int __ctsvc_db_create_composite_condition(ctsvc_composite_filter_s
        len = 0;
        if (cond) {
                temp_len = SAFE_SNPRINTF(&out_cond, &buf_size, len, "(");
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len)
+                       len += temp_len;
+
                temp_len = SAFE_SNPRINTF(&out_cond, &buf_size, len, cond);
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len)
+                       len += temp_len;
+
                temp_len = SAFE_SNPRINTF(&out_cond, &buf_size, len, ")");
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len)
+                       len += temp_len;
                free(cond);
        }
 
        cursor_filter = filters->next;
-       for (cursor_ops=ops; cursor_ops && cursor_filter; cursor_filter=cursor_filter->next, cursor_ops=cursor_ops->next) {
+       for (cursor_ops = ops; cursor_ops && cursor_filter;
+                       cursor_filter = cursor_filter->next, cursor_ops = cursor_ops->next) {
                cond = NULL;
                bind = NULL;
 
-               filter = (ctsvc_filter_s *)cursor_filter->data;
-               if (filter->filter_type == CTSVC_FILTER_COMPOSITE)
-                       __ctsvc_db_create_composite_condition((ctsvc_composite_filter_s *)filter, &cond, &bind);
-               else
-                       __ctsvc_db_create_attribute_condition(com_filter, (ctsvc_attribute_filter_s*)filter, &cond, &bind);
+               filter = cursor_filter->data;
+               if (filter->filter_type == CTSVC_FILTER_COMPOSITE) {
+                       __db_create_composite_condition((ctsvc_composite_filter_s*)filter,
+                                       &cond, &bind);
+               } else {
+                       __ctsvc_db_create_attribute_condition(com_filter,
+                                       (ctsvc_attribute_filter_s*)filter, &cond, &bind);
+               }
 
                if (cond) {
                        op = (contacts_filter_operator_e)cursor_ops->data;
@@ -714,12 +846,15 @@ static inline int __ctsvc_db_create_composite_condition(ctsvc_composite_filter_s
                                temp_len = SAFE_SNPRINTF(&out_cond, &buf_size, len, " AND (");
                        else
                                temp_len = SAFE_SNPRINTF(&out_cond, &buf_size, len, " OR (");
-                       if (0 <= temp_len) len+= temp_len;
+                       if (0 <= temp_len)
+                               len += temp_len;
 
                        temp_len = SAFE_SNPRINTF(&out_cond, &buf_size, len, cond);
-                       if (0 <= temp_len) len+= temp_len;
+                       if (0 <= temp_len)
+                               len += temp_len;
                        temp_len = SAFE_SNPRINTF(&out_cond, &buf_size, len, ")");
-                       if (0 <= temp_len) len+= temp_len;
+                       if (0 <= temp_len)
+                               len += temp_len;
 
                        if (bind)
                                *bind_text = g_slist_concat(*bind_text, bind);
@@ -733,7 +868,8 @@ static inline int __ctsvc_db_create_composite_condition(ctsvc_composite_filter_s
 }
 
 /* Make and execute 'UPDATE' sqlite statement to update record */
-int ctsvc_db_update_record_with_set_query(const char *set, GSList *bind_text, const char *table, int id)
+int ctsvc_db_update_record_with_set_query(const char *set, GSList *bind_text,
+               const char *table, int id)
 {
        int ret = CONTACTS_ERROR_NONE;
        char query[CTS_SQL_MAX_LEN] = {0};
@@ -743,11 +879,11 @@ int ctsvc_db_update_record_with_set_query(const char *set, GSList *bind_text, co
        snprintf(query, sizeof(query), "UPDATE %s SET %s WHERE id = %d", table, set, id);
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        if (bind_text) {
                int i = 0;
-               for (cursor=bind_text,i=1;cursor;cursor=cursor->next,i++) {
+               for (cursor = bind_text, i = 1; cursor; cursor = cursor->next, i++) {
                        const char *text = cursor->data;
                        if (text && *text)
                                ctsvc_stmt_bind_text(stmt, i, text);
@@ -755,7 +891,7 @@ int ctsvc_db_update_record_with_set_query(const char *set, GSList *bind_text, co
        }
        ret = ctsvc_stmt_step(stmt);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d)", ret);
+               ERR("ctsvc_stmt_step() Fail(%d)", ret);
                ctsvc_stmt_finalize(stmt);
                return ret;
        }
@@ -768,7 +904,7 @@ int ctsvc_db_create_set_query(contacts_record_h record, char **set, GSList **bin
 {
        ctsvc_record_s *s_record;
        int i = 0;
-       const property_info_sproperty_info = NULL;
+       const property_info_s *property_info = NULL;
        unsigned int property_info_count = 0;
        char out_set[CTS_SQL_MAX_LEN] = {0};
        int len = 0;
@@ -777,65 +913,64 @@ int ctsvc_db_create_set_query(contacts_record_h record, char **set, GSList **bin
 
        RETV_IF(record == NULL, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       s_record = (ctsvc_record_s *)record;
+       s_record = (ctsvc_record_s*)record;
        if (0 == s_record->property_max_count || NULL == s_record->properties_flags) {
-               CTS_ERR("record don't have properties");
+               ERR("record don't have properties");
                return CONTACTS_ERROR_INVALID_PARAMETER;
        }
 
-       property_info = ctsvc_view_get_all_property_infos(s_record->view_uri, &property_info_count);
+       property_info = ctsvc_view_get_all_property_infos(s_record->view_uri,
+                       &property_info_count);
 
-       for (i=0;i<property_info_count;i++) {
-               if (ctsvc_record_check_property_flag(s_record, property_info[i].property_id, CTSVC_PROPERTY_FLAG_DIRTY)) {
+       for (i = 0; i < property_info_count; i++) {
+               if (ctsvc_record_check_property_flag(s_record, property_info[i].property_id,
+                                       CTSVC_PROPERTY_FLAG_DIRTY)) {
                        field_name = property_info[i].fields;
                        if (NULL == field_name)
                                continue;
 
                        if (CTSVC_VIEW_CHECK_DATA_TYPE(property_info[i].property_id, CTSVC_VIEW_DATA_TYPE_BOOL)) {
                                bool tmp = false;
-                               ret = contacts_record_get_bool(record,property_info[i].property_id, &tmp);
+                               ret = contacts_record_get_bool(record, property_info[i].property_id, &tmp);
                                if (ret != CONTACTS_ERROR_NONE)
                                        continue;
                                if (len != 0)
                                        len += snprintf(out_set+len, sizeof(out_set)-len, ", ");
                                len += snprintf(out_set+len, sizeof(out_set)-len, "%s=%d", field_name, tmp);
-                       }
-                       else if (CTSVC_VIEW_CHECK_DATA_TYPE(property_info[i].property_id, CTSVC_VIEW_DATA_TYPE_INT)) {
+                       } else if (CTSVC_VIEW_CHECK_DATA_TYPE(property_info[i].property_id, CTSVC_VIEW_DATA_TYPE_INT)) {
                                int tmp = 0;
-                               ret = contacts_record_get_int(record,property_info[i].property_id, &tmp);
+                               ret = contacts_record_get_int(record, property_info[i].property_id, &tmp);
                                if (ret != CONTACTS_ERROR_NONE)
                                        continue;
                                if (len != 0)
                                        len += snprintf(out_set+len, sizeof(out_set)-len, ", ");
                                len += snprintf(out_set+len, sizeof(out_set)-len, "%s=%d", field_name, tmp);
-                       }
-                       else if (CTSVC_VIEW_CHECK_DATA_TYPE(property_info[i].property_id, CTSVC_VIEW_DATA_TYPE_LLI)) {
+                       } else if (CTSVC_VIEW_CHECK_DATA_TYPE(property_info[i].property_id, CTSVC_VIEW_DATA_TYPE_LLI)) {
                                long long int tmp = 0;
                                ret = contacts_record_get_lli(record, property_info[i].property_id, &tmp);
                                if (ret != CONTACTS_ERROR_NONE)
                                        continue;
                                if (len != 0)
                                        len += snprintf(out_set+len, sizeof(out_set)-len, ", ");
-                               len += snprintf(out_set+len, sizeof(out_set)-len, "%s=%lld", field_name,tmp);
-                       }
-                       else if (CTSVC_VIEW_CHECK_DATA_TYPE(property_info[i].property_id, CTSVC_VIEW_DATA_TYPE_STR)) {
+                               len += snprintf(out_set+len, sizeof(out_set)-len, "%s=%lld", field_name, tmp);
+                       } else if (CTSVC_VIEW_CHECK_DATA_TYPE(property_info[i].property_id, CTSVC_VIEW_DATA_TYPE_STR)) {
                                char *tmp = NULL;
-                               ret = contacts_record_get_str_p(record,property_info[i].property_id, &tmp);
+                               ret = contacts_record_get_str_p(record, property_info[i].property_id, &tmp);
                                if (ret != CONTACTS_ERROR_NONE)
                                        continue;
                                if (len != 0)
                                        len += snprintf(out_set+len, sizeof(out_set)-len, ", ");
                                len += snprintf(out_set+len, sizeof(out_set)-len, "%s=?", field_name);
                                *bind_text = g_slist_append(*bind_text, strdup(SAFE_STR(tmp)));
-                       }
-                       else if (CTSVC_VIEW_CHECK_DATA_TYPE(property_info[i].property_id, CTSVC_VIEW_DATA_TYPE_DOUBLE)) {
+                       } else if (CTSVC_VIEW_CHECK_DATA_TYPE(property_info[i].property_id, CTSVC_VIEW_DATA_TYPE_DOUBLE)) {
                                double tmp = 0;
                                ret = contacts_record_get_double(record, property_info[i].property_id, &tmp);
                                if (ret != CONTACTS_ERROR_NONE)
                                        continue;
                                if (len != 0)
                                        len += snprintf(out_set+len, sizeof(out_set)-len, ", ");
-                               len += snprintf(out_set+len, sizeof(out_set)-len, "%s=%lf", field_name, tmp);
+                               len += snprintf(out_set+len, sizeof(out_set)-len, "%s=%lf", field_name,
+                                               tmp);
                        }
                }
        }
@@ -844,8 +979,11 @@ int ctsvc_db_create_set_query(contacts_record_h record, char **set, GSList **bin
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_create_projection(const char *view_uri, const property_info_s *properties, int ids_count,
-               unsigned int *projections, int pro_count, char **projection)
+static int __db_create_projection(const char *view_uri,
+               const property_info_s *properties, int ids_count,
+               unsigned int *projections,
+               int pro_count,
+               char **projection)
 {
        bool first;
        int i;
@@ -857,45 +995,51 @@ static int __ctsvc_db_create_projection(const char *view_uri, const property_inf
        len = 0;
        first = true;
        if (0 < pro_count) {
-               for (i=0;i<pro_count;i++) {
+               for (i = 0; i < pro_count; i++) {
                        if (projections[i] == CTSVC_PROPERTY_PERSON_DISPLAY_NAME_INDEX) {
-                               snprintf(temp, sizeof(temp), "_NORMALIZE_INDEX_(%s)", ctsvc_get_sort_name_column());
+                               snprintf(temp, sizeof(temp), "_NORMALIZE_INDEX_(%s)",
+                                               ctsvc_get_sort_name_column());
                                field_name = temp;
+                       } else {
+                               field_name = __ctsvc_db_get_property_field_name(properties, ids_count,
+                                               QUERY_PROJECTION, projections[i]);
                        }
-                       else
-                               field_name = __ctsvc_db_get_property_field_name(properties, ids_count, QUERY_PROJECTION, projections[i]);
 
                        if (field_name) {
                                if (first) {
-                                       len += snprintf(out_projection+len, sizeof(out_projection)-len, "%s", field_name);
+                                       len += snprintf(out_projection+len, sizeof(out_projection)-len,
+                                                       "%s", field_name);
                                        first = false;
+                               } else {
+                                       len += snprintf(out_projection+len, sizeof(out_projection)-len,
+                                                       ", %s", field_name);
                                }
-                               else
-                                       len += snprintf(out_projection+len, sizeof(out_projection)-len, ", %s", field_name);
                        }
                }
-       }
-       else {
+       } else {
                /* add all properties */
-               for (i=0;i<ids_count;i++) {
+               for (i = 0; i < ids_count; i++) {
                        if (CTSVC_VIEW_DATA_TYPE_REC == (properties[i].property_id & CTSVC_VIEW_DATA_TYPE_MASK))
                                continue;
 
-                       if (properties[i].fields)
+                       if (properties[i].fields) {
                                field_name = properties[i].fields;
-                       else if (properties[i].property_id == CTSVC_PROPERTY_PERSON_DISPLAY_NAME_INDEX) {
-                               snprintf(temp, sizeof(temp), "_NORMALIZE_INDEX_(%s)", ctsvc_get_sort_name_column());
+                       } else if (properties[i].property_id == CTSVC_PROPERTY_PERSON_DISPLAY_NAME_INDEX) {
+                               snprintf(temp, sizeof(temp), "_NORMALIZE_INDEX_(%s)",
+                                               ctsvc_get_sort_name_column());
                                field_name = temp;
-                       }
-                       else
+                       } else {
                                field_name = ctsvc_get_display_column();
+                       }
 
                        if (first) {
-                               len += snprintf(out_projection+len, sizeof(out_projection)-len, "%s", field_name);
+                               len += snprintf(out_projection+len, sizeof(out_projection)-len, "%s",
+                                               field_name);
                                first = false;
+                       } else {
+                               len += snprintf(out_projection+len, sizeof(out_projection)-len, ", %s",
+                                               field_name);
                        }
-                       else
-                               len += snprintf(out_projection+len, sizeof(out_projection)-len, ", %s", field_name);
                }
        }
 
@@ -912,7 +1056,7 @@ static inline bool __ctsvc_db_view_has_display_name(const char *view_uri,
                return false;
 #endif /* ENABLE_LOG_FEATURE */
 
-       for (i=0;i<count;i++) {
+       for (i = 0; i < count; i++) {
                property_info_s *p = (property_info_s*)&(properties[i]);
                switch (p->property_id) {
                case CTSVC_PROPERTY_PERSON_DISPLAY_NAME:
@@ -927,7 +1071,8 @@ static inline bool __ctsvc_db_view_has_display_name(const char *view_uri,
 
 #define SORT_CHECK_LEN 7
 
-int ctsvc_db_make_get_records_query_stmt(ctsvc_query_s *s_query, int offset, int limit, cts_stmt *stmt)
+int ctsvc_db_make_get_records_query_stmt(ctsvc_query_s *s_query, int offset, int limit,
+               cts_stmt *stmt)
 {
        char *query = NULL;
        char temp_str[100] = {0};
@@ -944,19 +1089,22 @@ int ctsvc_db_make_get_records_query_stmt(ctsvc_query_s *s_query, int offset, int
        GSList *cursor;
 
        ret = ctsvc_db_get_table_name(s_query->view_uri, &table);
-       RETVM_IF (CONTACTS_ERROR_NONE != ret, ret, "Invalid parameter : view uri (%s)", s_query->view_uri);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "Invalid view uri(%s)", s_query->view_uri);
 
-       ret = __ctsvc_db_create_projection(s_query->view_uri, s_query->properties, s_query->property_count,
-                                                               s_query->projection, s_query->projection_count, &projection);
+       ret = __db_create_projection(s_query->view_uri, s_query->properties,
+                       s_query->property_count,
+                       s_query->projection,
+                       s_query->projection_count,
+                       &projection);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("__ctsvc_db_create_projection Fail(%d)", ret);
+               ERR("__db_create_projection() Fail(%d)", ret);
                return ret;
        }
 
        query_size = CTS_SQL_MAX_LEN;
        query = calloc(1, query_size);
        if (NULL == query) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                free(projection);
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
@@ -966,33 +1114,34 @@ int ctsvc_db_make_get_records_query_stmt(ctsvc_query_s *s_query, int offset, int
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, "SELECT DISTINCT ");
        else
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, "SELECT ");
-       if (0 <= temp_len) len+= temp_len;
+       if (0 <= temp_len) len += temp_len;
        temp_len = SAFE_SNPRINTF(&query, &query_size, len, projection);
-       if (0 <= temp_len) len+= temp_len;
+       if (0 <= temp_len) len += temp_len;
        temp_len = SAFE_SNPRINTF(&query, &query_size, len, " FROM ");
-       if (0 <= temp_len) len+= temp_len;
+       if (0 <= temp_len) len += temp_len;
 
        temp_len = SAFE_SNPRINTF(&query, &query_size, len, " (");
-       if (0 <= temp_len) len+= temp_len;
+       if (0 <= temp_len) len += temp_len;
        temp_len = SAFE_SNPRINTF(&query, &query_size, len, table);
-       if (0 <= temp_len) len+= temp_len;
+       if (0 <= temp_len) len += temp_len;
        temp_len = SAFE_SNPRINTF(&query, &query_size, len, ")");
-       if (0 <= temp_len) len+= temp_len;
+       if (0 <= temp_len) len += temp_len;
 
        if (s_query->filter) {
-               ret = __ctsvc_db_create_composite_condition(s_query->filter, &condition, &bind_text);
+               ret = __db_create_composite_condition(s_query->filter, &condition,
+                               &bind_text);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("__ctsvc_db_create_composite_condition Fail(%d)", ret);
+                       ERR("__db_create_composite_condition Fail(%d)", ret);
                        free(projection);
                        return ret;
                }
                if (condition && *condition) {
                        temp_len = SAFE_SNPRINTF(&query, &query_size, len, " WHERE (");
-                       if (0 <= temp_len) len+= temp_len;
+                       if (0 <= temp_len) len += temp_len;
                        temp_len = SAFE_SNPRINTF(&query, &query_size, len, condition);
-                       if (0 <= temp_len) len+= temp_len;
+                       if (0 <= temp_len) len += temp_len;
                        temp_len = SAFE_SNPRINTF(&query, &query_size, len, ")");
-                       if (0 <= temp_len) len+= temp_len;
+                       if (0 <= temp_len) len += temp_len;
                }
        }
 
@@ -1003,67 +1152,67 @@ int ctsvc_db_make_get_records_query_stmt(ctsvc_query_s *s_query, int offset, int
        if (s_query->sort_property_id) {
                const char *field_name;
 
-               switch(s_query->sort_property_id) {
+               switch (s_query->sort_property_id) {
                case CTSVC_PROPERTY_PERSON_DISPLAY_NAME:
                case CTSVC_PROPERTY_CONTACT_DISPLAY_NAME:
                        if (sortkey) {
                                temp_len = SAFE_SNPRINTF(&query, &query_size, len, " ORDER BY ");
-                               if (0 <= temp_len) len+= temp_len;
+                               if (0 <= temp_len) len += temp_len;
                                temp_len = SAFE_SNPRINTF(&query, &query_size, len, sortkey);
-                               if (0 <= temp_len) len+= temp_len;
+                               if (0 <= temp_len) len += temp_len;
                                if (false == s_query->sort_asc) {
                                        temp_len = SAFE_SNPRINTF(&query, &query_size, len, " DESC ");
-                                       if (0 <= temp_len) len+= temp_len;
+                                       if (0 <= temp_len) len += temp_len;
                                }
                        }
                        break;
-               default :
+               default:
                        field_name = __ctsvc_db_get_property_field_name(s_query->properties,
-                                                               s_query->property_count, QUERY_SORTKEY, s_query->sort_property_id);
+                                       s_query->property_count, QUERY_SORTKEY, s_query->sort_property_id);
                        if (field_name) {
                                temp_len = SAFE_SNPRINTF(&query, &query_size, len, " ORDER BY ");
-                               if (0 <= temp_len) len+= temp_len;
+                               if (0 <= temp_len) len += temp_len;
                                temp_len = SAFE_SNPRINTF(&query, &query_size, len, field_name);
-                               if (0 <= temp_len) len+= temp_len;
+                               if (0 <= temp_len) len += temp_len;
 
                                if (CTSVC_PROPERTY_GROUP_NAME == s_query->sort_property_id) {
                                        temp_len = SAFE_SNPRINTF(&query, &query_size, len, " COLLATE _NAME_SORT_ ");
-                                       if (0 <= temp_len) len+= temp_len;
+                                       if (0 <= temp_len) len += temp_len;
                                }
 
                                if (false == s_query->sort_asc) {
                                        temp_len = SAFE_SNPRINTF(&query, &query_size, len, " DESC ");
-                                       if (0 <= temp_len) len+= temp_len;
+                                       if (0 <= temp_len) len += temp_len;
                                }
-                       }
-                       else if (sortkey) {
+                       } else if (sortkey) {
                                temp_len = SAFE_SNPRINTF(&query, &query_size, len, " ORDER BY ");
-                               if (0 <= temp_len) len+= temp_len;
+                               if (0 <= temp_len) len += temp_len;
                                temp_len = SAFE_SNPRINTF(&query, &query_size, len, sortkey);
-                               if (0 <= temp_len) len+= temp_len;
+                               if (0 <= temp_len) len += temp_len;
                        }
                        break;
                }
-       }
-       else if (sortkey) {
+       } else if (sortkey) {
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, " ORDER BY ");
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len)
+                       len += temp_len;
+
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, sortkey);
-               if (0 <= temp_len) len+= temp_len;
-       }
-       else if (STRING_EQUAL == strcmp(s_query->view_uri, CTSVC_VIEW_URI_GROUP)) {
+               if (0 <= temp_len)
+                       len += temp_len;
+       else if (STRING_EQUAL == strcmp(s_query->view_uri, CTSVC_VIEW_URI_GROUP)) {
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, " ORDER BY group_prio");
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len) len += temp_len;
        }
 
        if (0 != limit) {
                snprintf(temp_str, sizeof(temp_str), " LIMIT %d", limit);
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, temp_str);
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len) len += temp_len;
                if (0 < offset) {
                        snprintf(temp_str, sizeof(temp_str), " OFFSET %d", offset);
                        temp_len = SAFE_SNPRINTF(&query, &query_size, len, temp_str);
-                       if (0 <= temp_len) len+= temp_len;
+                       if (0 <= temp_len) len += temp_len;
                }
        }
 
@@ -1073,17 +1222,17 @@ int ctsvc_db_make_get_records_query_stmt(ctsvc_query_s *s_query, int offset, int
        ret = ctsvc_query_prepare(query, stmt);
        free(query);
        if (NULL == *stmt) {
-               CTS_ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret);
-               for (cursor=bind_text;cursor;cursor=cursor->next)
+               ERR("ctsvc_query_prepare() Fail(%d)", ret);
+               for (cursor = bind_text; cursor; cursor = cursor->next)
                        free(cursor->data);
                g_slist_free(bind_text);
                return ret;
        }
 
-       for (cursor=bind_text, i=1; cursor;cursor=cursor->next, i++)
+       for (cursor = bind_text, i = 1; cursor; cursor = cursor->next, i++)
                ctsvc_stmt_bind_copy_text(*stmt, i, cursor->data, strlen(cursor->data));
 
-       for (cursor=bind_text;cursor;cursor=cursor->next)
+       for (cursor = bind_text; cursor; cursor = cursor->next)
                free(cursor->data);
        g_slist_free(bind_text);
 
@@ -1091,7 +1240,7 @@ int ctsvc_db_make_get_records_query_stmt(ctsvc_query_s *s_query, int offset, int
 }
 
 static int __ctsvc_db_get_records_with_query_exec(ctsvc_query_s *query, int offset,
-               int limit, contacts_list_hout_list)
+               int limit, contacts_list_h *out_list)
 {
        int ret;
        int i;
@@ -1100,14 +1249,17 @@ static int __ctsvc_db_get_records_with_query_exec(ctsvc_query_s *query, int offs
        contacts_list_h list = NULL;
 
        ret = ctsvc_db_make_get_records_query_stmt(query, offset, limit, &stmt);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_db_make_get_records_query_stmt(%d)", ret);
+       if (CONTACTS_ERROR_NONE != ret) {
+               ERR("ctsvc_db_make_get_records_query_stmt() Fail(%d)", ret);
+               return ret;
+       }
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                int field_count;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -1115,36 +1267,39 @@ static int __ctsvc_db_get_records_with_query_exec(ctsvc_query_s *query, int offs
 
                contacts_record_create(query->view_uri, (contacts_record_h*)&record);
 
-               if (0 == query->projection_count)
+               if (0 == query->projection_count) {
                        field_count = query->property_count;
-               else {
+               else {
                        field_count = query->projection_count;
 
-                       if (CONTACTS_ERROR_NONE != ctsvc_record_set_projection_flags(record, query->projection, query->projection_count, query->property_count)) {
+                       ret = ctsvc_record_set_projection_flags(record, query->projection,
+                                       query->projection_count, query->property_count);
+                       if (CONTACTS_ERROR_NONE != ret)
                                ASSERT_NOT_REACHED("To set projection is Fail.\n");
-                       }
                }
 
-               for (i=0;i<field_count;i++) {
+               for (i = 0; i < field_count; i++) {
                        int property_id;
+
                        if (0 == query->projection_count)
                                property_id = query->properties[i].property_id;
-                       else {
+                       else
                                property_id = query->projection[i];
-                       }
-                       type = __ctsvc_db_get_property_type(query->properties, query->property_count, property_id);
+
+                       type = __ctsvc_db_get_property_type(query->properties, query->property_count,
+                                       property_id);
                        if (type == CTSVC_VIEW_DATA_TYPE_INT)
                                ctsvc_record_set_int(record, property_id, ctsvc_stmt_get_int(stmt, i));
                        else if (type == CTSVC_VIEW_DATA_TYPE_STR)
                                ctsvc_record_set_str(record, property_id, ctsvc_stmt_get_text(stmt, i));
                        else if (type == CTSVC_VIEW_DATA_TYPE_BOOL)
-                               ctsvc_record_set_bool(record, property_id, (ctsvc_stmt_get_int(stmt, i)?true:false));
+                               ctsvc_record_set_bool(record, property_id, (ctsvc_stmt_get_int(stmt, i) ? true : false));
                        else if (type == CTSVC_VIEW_DATA_TYPE_LLI)
                                ctsvc_record_set_lli(record, property_id, ctsvc_stmt_get_int64(stmt, i));
                        else if (type == CTSVC_VIEW_DATA_TYPE_DOUBLE)
                                ctsvc_record_set_double(record, property_id, ctsvc_stmt_get_dbl(stmt, i));
                        else
-                               CTS_ERR("DB error : unknown type (%d)", type);
+                               ERR("unknown type(%d)", type);
                }
                ctsvc_list_prepend(list, record);
        }
@@ -1155,8 +1310,13 @@ static int __ctsvc_db_get_records_with_query_exec(ctsvc_query_s *query, int offs
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_get_all_records_exec(const char *view_uri, const property_info_s* properties, int ids_count,
-               const char *projection, int offset,     int limit, contacts_list_h* out_list)
+static int __ctsvc_db_get_all_records_exec(const char *view_uri,
+               const property_info_s *properties,
+               int ids_count,
+               const char *projection,
+               int offset,
+               int limit,
+               contacts_list_h *out_list)
 {
        char query[CTS_SQL_MAX_LEN] = {0};
        const char *table;
@@ -1169,7 +1329,7 @@ static int __ctsvc_db_get_all_records_exec(const char *view_uri, const property_
        const char *sortkey;
 
        ret = ctsvc_db_get_table_name(view_uri, &table);
-       RETVM_IF (CONTACTS_ERROR_NONE != ret, ret, "Invalid parameter : view uri (%s)", view_uri);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "Invalid view uri (%s)", view_uri);
 
        len = snprintf(query, sizeof(query), "SELECT %s FROM ", projection);
 
@@ -1188,33 +1348,33 @@ static int __ctsvc_db_get_all_records_exec(const char *view_uri, const property_
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
                }
 
                contacts_record_create(view_uri, &record);
-               for (i=0;i<ids_count;i++) {
+               for (i = 0; i < ids_count; i++) {
                        type = (properties[i].property_id & CTSVC_VIEW_DATA_TYPE_MASK);
                        if (type == CTSVC_VIEW_DATA_TYPE_INT)
                                ctsvc_record_set_int(record, properties[i].property_id, ctsvc_stmt_get_int(stmt, i));
                        else if (type == CTSVC_VIEW_DATA_TYPE_STR)
                                ctsvc_record_set_str(record, properties[i].property_id, ctsvc_stmt_get_text(stmt, i));
                        else if (type == CTSVC_VIEW_DATA_TYPE_BOOL)
-                               ctsvc_record_set_bool(record, properties[i].property_id, (ctsvc_stmt_get_int(stmt, i)?true:false));
+                               ctsvc_record_set_bool(record, properties[i].property_id, (ctsvc_stmt_get_int(stmt, i) ? true : false));
                        else if (type == CTSVC_VIEW_DATA_TYPE_LLI)
                                ctsvc_record_set_lli(record, properties[i].property_id, ctsvc_stmt_get_int64(stmt, i));
                        else if (type == CTSVC_VIEW_DATA_TYPE_DOUBLE)
                                ctsvc_record_set_double(record, properties[i].property_id, ctsvc_stmt_get_dbl(stmt, i));
                        else
-                               CTS_ERR("DB error : unknown type (%d)", type);
+                               ERR("unknown type (%d)", type);
                }
                ctsvc_list_prepend(list, record);
        }
@@ -1225,15 +1385,16 @@ static int __ctsvc_db_get_all_records_exec(const char *view_uri, const property_
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_get_all_records(const char* view_uri, int offset, int limit, contacts_list_h* out_list)
+static int __ctsvc_db_get_all_records(const char *view_uri, int offset, int limit,
+               contacts_list_h *out_list)
 {
        int ret;
        unsigned int count;
        char *projection;
 
        const property_info_s *p = ctsvc_view_get_all_property_infos(view_uri, &count);
-       ret = __ctsvc_db_create_projection(view_uri, p, count, NULL, 0, &projection);
-       RETVM_IF (CONTACTS_ERROR_NONE != ret, ret, "__ctsvc_db_create_projection Fail(%d)", ret);
+       ret = __db_create_projection(view_uri, p, count, NULL, 0, &projection);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "__db_create_projection Fail(%d)", ret);
 
        ret = __ctsvc_db_get_all_records_exec(view_uri, p, count, projection, offset, limit, out_list);
        free(projection);
@@ -1246,12 +1407,12 @@ static inline bool __ctsvc_db_view_can_keyword_search(const char *view_uri)
        RETV_IF(NULL == view_uri, false);
 
        if (STRING_EQUAL == strcmp(view_uri, CTSVC_VIEW_URI_PERSON)
-               || STRING_EQUAL == strcmp(view_uri, CTSVC_VIEW_URI_READ_ONLY_PERSON_CONTACT)
-               || STRING_EQUAL == strcmp(view_uri, CTSVC_VIEW_URI_READ_ONLY_PERSON_NUMBER)
-               || STRING_EQUAL == strcmp(view_uri, CTSVC_VIEW_URI_READ_ONLY_PERSON_EMAIL)
-               || STRING_EQUAL == strcmp(view_uri, CTSVC_VIEW_URI_READ_ONLY_PERSON_GROUP)
-               || STRING_EQUAL == strcmp(view_uri, CTSVC_VIEW_URI_READ_ONLY_PERSON_GROUP_ASSIGNED)
-               || STRING_EQUAL == strcmp(view_uri, CTSVC_VIEW_URI_READ_ONLY_PERSON_GROUP_NOT_ASSIGNED)) {
+                       || STRING_EQUAL == strcmp(view_uri, CTSVC_VIEW_URI_READ_ONLY_PERSON_CONTACT)
+                       || STRING_EQUAL == strcmp(view_uri, CTSVC_VIEW_URI_READ_ONLY_PERSON_NUMBER)
+                       || STRING_EQUAL == strcmp(view_uri, CTSVC_VIEW_URI_READ_ONLY_PERSON_EMAIL)
+                       || STRING_EQUAL == strcmp(view_uri, CTSVC_VIEW_URI_READ_ONLY_PERSON_GROUP)
+                       || STRING_EQUAL == strcmp(view_uri, CTSVC_VIEW_URI_READ_ONLY_PERSON_GROUP_ASSIGNED)
+                       || STRING_EQUAL == strcmp(view_uri, CTSVC_VIEW_URI_READ_ONLY_PERSON_GROUP_NOT_ASSIGNED)) {
                return true;
        }
        return false;
@@ -1268,8 +1429,8 @@ static char* __ctsvc_db_make_search_keyword(const char *keyword)
                int i = 0;
                int j = 0;
                char search_keyword[size * 2+1];
-               for (i=0;i<size;i++) {
-                       if (j>0 && keyword[i] == ' ') {
+               for (i = 0; i < size; i++) {
+                       if (0 < j && keyword[i] == ' ') {
                                if (search_keyword[j-1] != ' ')
                                        search_keyword[j++] = '*';
                        }
@@ -1279,15 +1440,15 @@ static char* __ctsvc_db_make_search_keyword(const char *keyword)
                        search_keyword[j++] = '*';
                search_keyword[j] = '\0';
                return strdup(search_keyword);
-       }
-       else {
+       } else {
                char search_keyword[size+2];
                snprintf(search_keyword, sizeof(search_keyword), "%s*", keyword);
                return strdup(search_keyword);
        }
 }
 
-static int __ctsvc_db_append_search_query_range(char **query, int *query_size, int len, int range, char *name, char *number, char *data)
+static int __ctsvc_db_append_search_query_range(char **query, int *query_size, int len,
+               int range, char *name, char *number, char *data)
 {
        bool first = true;
        int temp_len;
@@ -1331,32 +1492,31 @@ static int __ctsvc_db_append_search_query_range(char **query, int *query_size, i
        return len;
 }
 
-static int __ctsvc_db_append_search_query(const char *src, char **query, int *query_size, int len, int range)
+static int __db_append_search_query(const char *src, char **query, int *query_size,
+               int len, int range)
 {
        bool phonenumber = true;
        int i = 0;
        int keyword_temp_len = 0;
        int temp_len;
 
-       if (ctsvc_is_phonenumber(src) == false || STRING_EQUAL == strcmp(src, "+")) {
+       if (ctsvc_is_phonenumber(src) == false || STRING_EQUAL == strcmp(src, "+"))
                phonenumber = false;
-       }
 
        if (strstr(src, "@")) {
                /* If the search key is email address format, DO NOT search it from NAME */
                range &= ~CONTACTS_SEARCH_RANGE_NAME;
        }
 
-       if (STRING_EQUAL == strcmp(src, "+")) {
+       if (STRING_EQUAL == strcmp(src, "+"))
                range &= ~CONTACTS_SEARCH_RANGE_NUMBER;
-       }
 
-       charkeyword = NULL;
+       char *keyword = NULL;
        int keyword_size = 0;
        bool use_replaced_keyword = true;
        /* full width characters -> half width characters (apply to only FW ASCII & some symbols) */
        if (ctsvc_get_halfwidth_string(src, &keyword, &keyword_size) != CONTACTS_ERROR_NONE) {
-               CTS_ERR("UChar converting error : ctsvc_get_halfwidth_string() Fail");
+               ERR("UChar converting error : ctsvc_get_halfwidth_string() Fail");
                keyword = (char*)src;
                use_replaced_keyword = false;
        }
@@ -1364,7 +1524,7 @@ static int __ctsvc_db_append_search_query(const char *src, char **query, int *qu
        char *search_keyword = NULL;
        search_keyword = __ctsvc_db_make_search_keyword(keyword);
        if (NULL == search_keyword) {
-               CTS_ERR("__ctsvc_db_make_search_keyword() Fail");
+               ERR("__ctsvc_db_make_search_keyword() Fail");
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
 
@@ -1381,7 +1541,7 @@ static int __ctsvc_db_append_search_query(const char *src, char **query, int *qu
                if (0 <= temp_len) len += temp_len;
 
                temp_len = __ctsvc_db_append_search_query_range(query, query_size, len,
-                                                               range, search_keyword, search_keyword, search_keyword);
+                               range, search_keyword, search_keyword, search_keyword);
                if (0 <= temp_len) len = temp_len;
 
                if (range & CONTACTS_SEARCH_RANGE_NUMBER) {
@@ -1393,24 +1553,38 @@ static int __ctsvc_db_append_search_query(const char *src, char **query, int *qu
                        int err = ctsvc_clean_number(keyword, clean_number, sizeof(clean_number), false);
                        if (0 < err) {
                                const char *cc = ctsvc_get_network_cc(false);
-                               temp_len = SAFE_SNPRINTF(query, query_size, len, " UNION SELECT contact_id FROM ");
-                               if (0 <= temp_len) len += temp_len;
+                               temp_len = SAFE_SNPRINTF(query, query_size, len,
+                                               " UNION SELECT contact_id FROM ");
+                               if (0 <= temp_len)
+                                       len += temp_len;
+
                                temp_len = SAFE_SNPRINTF(query, query_size, len, CTS_TABLE_PHONE_LOOKUP);
-                               if (0 <= temp_len) len += temp_len;
-                               temp_len = SAFE_SNPRINTF(query, query_size, len, " WHERE number LIKE '%%");
-                               if (0 <= temp_len) len += temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
+
+                               temp_len = SAFE_SNPRINTF(query, query_size, len,
+                                               " WHERE number LIKE '%%");
+                               if (0 <= temp_len)
+                                       len += temp_len;
+
                                temp_len = SAFE_SNPRINTF(query, query_size, len, clean_number);
-                               if (0 <= temp_len) len += temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
 
                                if (cc && cc[0] == '7' && clean_number[0] == '8') {   /* Russia */
                                        char normal_num[strlen(clean_number)+1+5];   /* for cc */
                                        int ret;
-                                       ret = ctsvc_normalize_number(clean_number, normal_num, sizeof(normal_num), false);
+                                       ret = ctsvc_normalize_number(clean_number, normal_num,
+                                                       sizeof(normal_num), false);
                                        if (0 < ret) {
-                                               temp_len = SAFE_SNPRINTF(query, query_size, len, "%%' OR number LIKE '%%");
-                                               if (0 <= temp_len) len+= temp_len;
+                                               temp_len = SAFE_SNPRINTF(query, query_size, len,
+                                                               "%%' OR number LIKE '%%");
+                                               if (0 <= temp_len)
+                                                       len += temp_len;
+
                                                temp_len = SAFE_SNPRINTF(query, query_size, len, normal_num);
-                                               if (0 <= temp_len) len+= temp_len;
+                                               if (0 <= temp_len)
+                                                       len += temp_len;
                                        }
                                }
 
@@ -1420,8 +1594,7 @@ static int __ctsvc_db_append_search_query(const char *src, char **query, int *qu
                }
                temp_len = SAFE_SNPRINTF(query, query_size, len, ")");
                if (0 <= temp_len) len += temp_len;
-       }
-       else {
+       } else {
                char *normalized_name = NULL;
                int lang = CTSVC_LANG_OTHERS;
                char *hiragana = NULL;
@@ -1451,12 +1624,11 @@ static int __ctsvc_db_append_search_query(const char *src, char **query, int *qu
 
                        if (CTSVC_LANG_JAPANESE == lang) {
                                temp_len = __ctsvc_db_append_search_query_range(query, query_size, len,
-                                                                       CONTACTS_SEARCH_RANGE_NUMBER, NULL, search_hiragana, NULL);
+                                               CONTACTS_SEARCH_RANGE_NUMBER, NULL, search_hiragana, NULL);
                                if (0 <= temp_len) len = temp_len;
-                       }
-                       else {
+                       } else {
                                temp_len = __ctsvc_db_append_search_query_range(query, query_size, len,
-                                                                       CONTACTS_SEARCH_RANGE_NUMBER, NULL, search_keyword, NULL);
+                                               CONTACTS_SEARCH_RANGE_NUMBER, NULL, search_keyword, NULL);
                                if (0 <= temp_len) len = temp_len;
                        }
                        need_union = true;
@@ -1464,39 +1636,48 @@ static int __ctsvc_db_append_search_query(const char *src, char **query, int *qu
 
                if (range & CONTACTS_SEARCH_RANGE_DATA) {
                        if (need_union) {
-                               temp_len = SAFE_SNPRINTF(query, query_size, len, " UNION SELECT contact_id FROM (");
-                               if (0 <= temp_len) len += temp_len;
+                               temp_len = SAFE_SNPRINTF(query, query_size, len,
+                                               " UNION SELECT contact_id FROM (");
+                               if (0 <= temp_len)
+                                       len += temp_len;
                        }
                        temp_len = SAFE_SNPRINTF(query, query_size, len, " SELECT contact_id FROM ");
-                       if (0 <= temp_len) len += temp_len;
+                       if (0 <= temp_len)
+                               len += temp_len;
+
                        temp_len = SAFE_SNPRINTF(query, query_size, len, CTS_TABLE_SEARCH_INDEX);
-                       if (0 <= temp_len) len += temp_len;
+                       if (0 <= temp_len)
+                               len += temp_len;
+
                        temp_len = SAFE_SNPRINTF(query, query_size, len, " WHERE ");
-                       if (0 <= temp_len) len += temp_len;
+                       if (0 <= temp_len)
+                               len += temp_len;
+
                        temp_len = SAFE_SNPRINTF(query, query_size, len, CTS_TABLE_SEARCH_INDEX);
-                       if (0 <= temp_len) len += temp_len;
+                       if (0 <= temp_len)
+                               len += temp_len;
+
                        temp_len = SAFE_SNPRINTF(query, query_size, len, " MATCH ");
-                       if (0 <= temp_len) len += temp_len;
+                       if (0 <= temp_len)
+                               len += temp_len;
 
                        if (CTSVC_LANG_JAPANESE == lang) {
                                temp_len = __ctsvc_db_append_search_query_range(query, query_size, len,
-                                                                       CONTACTS_SEARCH_RANGE_DATA, NULL, NULL, search_hiragana);
+                                               CONTACTS_SEARCH_RANGE_DATA, NULL, NULL, search_hiragana);
                                if (0 <= temp_len) len = temp_len;
-                       }
-                       else {
+                       } else {
                                keyword_temp_len = strlen(search_keyword);
                                /* replace '-' -> '_' because FTS does not support search '-' */
                                char temp_str[keyword_temp_len+1];
-                               for (i=0;i<keyword_temp_len;i++) {
-                                       if (search_keyword[i] == '-') {
+                               for (i = 0; i < keyword_temp_len; i++) {
+                                       if (search_keyword[i] == '-')
                                                temp_str[i] = '_';
-                                       }
                                        else
                                                temp_str[i] = search_keyword[i];
                                }
                                temp_str[i] = '\0';
                                temp_len = __ctsvc_db_append_search_query_range(query, query_size, len,
-                                                                       CONTACTS_SEARCH_RANGE_DATA, NULL, NULL, temp_str);
+                                               CONTACTS_SEARCH_RANGE_DATA, NULL, NULL, temp_str);
                                if (0 <= temp_len) len = temp_len;
                        }
                        if (need_union) {
@@ -1508,8 +1689,10 @@ static int __ctsvc_db_append_search_query(const char *src, char **query, int *qu
 
                if (range & CONTACTS_SEARCH_RANGE_NAME) {
                        if (need_union) {
-                               temp_len = SAFE_SNPRINTF(query, query_size, len, " UNION SELECT contact_id FROM (");
-                               if (0 <= temp_len) len += temp_len;
+                               temp_len = SAFE_SNPRINTF(query, query_size, len,
+                                               " UNION SELECT contact_id FROM (");
+                               if (0 <= temp_len)
+                                       len += temp_len;
                        }
 
                        if (CTSVC_LANG_KOREAN == lang) {   /* chosung search */
@@ -1526,115 +1709,175 @@ static int __ctsvc_db_append_search_query(const char *src, char **query, int *qu
                                 */
 
                                count = ctsvc_get_chosung(keyword, chosung, strlen(keyword) * 5);
-                               ctsvc_get_korean_search_pattern(keyword, korean_pattern, strlen(keyword) * 5);
+                               ctsvc_get_korean_search_pattern(keyword, korean_pattern,
+                                               strlen(keyword) * 5);
 
                                if (0 < count)
                                        search_chosung = __ctsvc_db_make_search_keyword(chosung);
                                else
                                        search_chosung = __ctsvc_db_make_search_keyword(keyword);
 
-                               temp_len = SAFE_SNPRINTF(query, query_size, len, " SELECT contact_id FROM ");
-                               if (0 <= temp_len) len += temp_len;
+                               temp_len = SAFE_SNPRINTF(query, query_size, len,
+                                               " SELECT contact_id FROM ");
+                               if (0 <= temp_len)
+                                       len += temp_len;
+
                                temp_len = SAFE_SNPRINTF(query, query_size, len, CTS_TABLE_SEARCH_INDEX);
-                               if (0 <= temp_len) len += temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
+
                                temp_len = SAFE_SNPRINTF(query, query_size, len, " WHERE ");
-                               if (0 <= temp_len) len += temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
+
                                temp_len = SAFE_SNPRINTF(query, query_size, len, CTS_TABLE_SEARCH_INDEX);
-                               if (0 <= temp_len) len += temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
+
                                temp_len = SAFE_SNPRINTF(query, query_size, len, " MATCH ");
-                               if (0 <= temp_len) len += temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
 
                                temp_len = __ctsvc_db_append_search_query_range(query, query_size, len,
-                                                                       CONTACTS_SEARCH_RANGE_NAME, search_chosung, NULL, NULL);
-                               if (0 <= temp_len) len = temp_len;
+                                               CONTACTS_SEARCH_RANGE_NAME, search_chosung, NULL, NULL);
+                               if (0 <= temp_len)
+                                       len = temp_len;
+
+                               temp_len = SAFE_SNPRINTF(query, query_size, len,
+                                               " INTERSECT SELECT contact_id FROM ");
+                               if (0 <= temp_len)
+                                       len += temp_len;
 
-                               temp_len = SAFE_SNPRINTF(query, query_size, len,  " INTERSECT SELECT contact_id FROM ");
-                               if (0 <= temp_len) len += temp_len;
                                temp_len = SAFE_SNPRINTF(query, query_size, len, CTS_TABLE_NAME_LOOKUP);
-                               if (0 <= temp_len) len += temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
+
                                temp_len = SAFE_SNPRINTF(query, query_size, len, " WHERE name GLOB '*");
-                               if (0 <= temp_len) len += temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
+
                                temp_len = SAFE_SNPRINTF(query, query_size, len, korean_pattern);
-                               if (0 <= temp_len) len += temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
+
                                temp_len = SAFE_SNPRINTF(query, query_size, len, "*' ");
-                               if (0 <= temp_len) len += temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
 
                                free(chosung);
                                free(korean_pattern);
                                free(search_chosung);
-                       }
-                       else if (CTSVC_LANG_JAPANESE == lang) {   /* hiragana search */
-                               temp_len = SAFE_SNPRINTF(query, query_size, len,  " SELECT contact_id FROM ");
-                               if (0 <= temp_len) len += temp_len;
+                       } else if (CTSVC_LANG_JAPANESE == lang) {   /* hiragana search */
+                               temp_len = SAFE_SNPRINTF(query, query_size, len,
+                                               " SELECT contact_id FROM ");
+                               if (0 <= temp_len)
+                                       len += temp_len;
+
                                temp_len = SAFE_SNPRINTF(query, query_size, len, CTS_TABLE_SEARCH_INDEX);
-                               if (0 <= temp_len) len += temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
+
                                temp_len = SAFE_SNPRINTF(query, query_size, len, " WHERE ");
-                               if (0 <= temp_len) len += temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
+
                                temp_len = SAFE_SNPRINTF(query, query_size, len, CTS_TABLE_SEARCH_INDEX);
-                               if (0 <= temp_len) len += temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
+
                                temp_len = SAFE_SNPRINTF(query, query_size, len, " MATCH ");
-                               if (0 <= temp_len) len += temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
 
                                temp_len = __ctsvc_db_append_search_query_range(query, query_size, len,
-                                                                       CONTACTS_SEARCH_RANGE_NAME, search_hiragana, NULL, NULL);
-                               if (0 <= temp_len) len = temp_len;
-                       }
-                       else if (CONTACTS_ERROR_NONE <= lang) {   /* normalized string search */
+                                               CONTACTS_SEARCH_RANGE_NAME, search_hiragana, NULL, NULL);
+                               if (0 <= temp_len)
+                                       len = temp_len;
+                       else if (CONTACTS_ERROR_NONE <= lang) {   /* normalized string search */
                                char *search_normal_name = NULL;
                                search_normal_name = __ctsvc_db_make_search_keyword(normalized_name);
-                               temp_len = SAFE_SNPRINTF(query, query_size, len,  " SELECT contact_id FROM ");
-                               if (0 <= temp_len) len += temp_len;
+                               temp_len = SAFE_SNPRINTF(query, query_size, len,
+                                               " SELECT contact_id FROM ");
+                               if (0 <= temp_len)
+                                       len += temp_len;
                                temp_len = SAFE_SNPRINTF(query, query_size, len, CTS_TABLE_SEARCH_INDEX);
-                               if (0 <= temp_len) len += temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
                                temp_len = SAFE_SNPRINTF(query, query_size, len, " WHERE ");
-                               if (0 <= temp_len) len += temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
                                temp_len = SAFE_SNPRINTF(query, query_size, len, CTS_TABLE_SEARCH_INDEX);
-                               if (0 <= temp_len) len += temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
                                temp_len = SAFE_SNPRINTF(query, query_size, len, " MATCH ");
-                               if (0 <= temp_len) len += temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
 
                                temp_len = __ctsvc_db_append_search_query_range(query, query_size, len,
-                                                                       CONTACTS_SEARCH_RANGE_NAME, search_normal_name, NULL, NULL);
-                               if (0 <= temp_len) len = temp_len;
+                                               CONTACTS_SEARCH_RANGE_NAME, search_normal_name, NULL, NULL);
+                               if (0 <= temp_len)
+                                       len = temp_len;
                                free(search_normal_name);
-                       }
-                       else {   /* original keyword search */
-                               temp_len = SAFE_SNPRINTF(query, query_size, len,  " SELECT contact_id FROM ");
-                               if (0 <= temp_len) len += temp_len;
+                       } else {   /* original keyword search */
+                               temp_len = SAFE_SNPRINTF(query, query_size, len,
+                                               " SELECT contact_id FROM ");
+                               if (0 <= temp_len)
+                                       len += temp_len;
+
                                temp_len = SAFE_SNPRINTF(query, query_size, len, CTS_TABLE_SEARCH_INDEX);
-                               if (0 <= temp_len) len += temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
+
                                temp_len = SAFE_SNPRINTF(query, query_size, len, " WHERE ");
-                               if (0 <= temp_len) len += temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
+
                                temp_len = SAFE_SNPRINTF(query, query_size, len, CTS_TABLE_SEARCH_INDEX);
-                               if (0 <= temp_len) len += temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
+
                                temp_len = SAFE_SNPRINTF(query, query_size, len, " MATCH ");
-                               if (0 <= temp_len) len += temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
 
                                temp_len = __ctsvc_db_append_search_query_range(query, query_size, len,
-                                                                       CONTACTS_SEARCH_RANGE_NAME, search_keyword, NULL, NULL);
-                               if (0 <= temp_len) len = temp_len;
+                                               CONTACTS_SEARCH_RANGE_NAME, search_keyword, NULL, NULL);
+                               if (0 <= temp_len)
+                                       len = temp_len;
                        }
 
                        int j = 0;
                        keyword_temp_len = strlen(keyword);
                        char temp_str[keyword_temp_len*2+1];
-                       for (i=0;i<keyword_temp_len;i++) {
-                               if (keyword[i] == '\'' || keyword[i] == '_' || keyword[i] == '%' || keyword[i] == '\\') {
+                       for (i = 0; i < keyword_temp_len; i++) {
+                               if (keyword[i] == '\'' || keyword[i] == '_'
+                                               || keyword[i] == '%' || keyword[i] == '\\') {
                                        temp_str[j++] = CTSVC_DB_ESCAPE_CHAR;
                                }
                                temp_str[j++] = keyword[i];
                        }
                        temp_str[j] = '\0';
-                       temp_len = SAFE_SNPRINTF(query, query_size, len, " UNION SELECT contact_id FROM ");
-                       if (0 <= temp_len) len += temp_len;
+                       temp_len = SAFE_SNPRINTF(query, query_size, len,
+                                       " UNION SELECT contact_id FROM ");
+                       if (0 <= temp_len)
+                               len += temp_len;
+
                        temp_len = SAFE_SNPRINTF(query, query_size, len, CTS_TABLE_NAME_LOOKUP);
-                       if (0 <= temp_len) len += temp_len;
+                       if (0 <= temp_len)
+                               len += temp_len;
+
                        temp_len = SAFE_SNPRINTF(query, query_size, len, " WHERE name LIKE '");
-                       if (0 <= temp_len) len += temp_len;
+                       if (0 <= temp_len)
+                               len += temp_len;
+
                        temp_len = SAFE_SNPRINTF(query, query_size, len, temp_str);
-                       if (0 <= temp_len) len += temp_len;
-                       temp_len = SAFE_SNPRINTF(query, query_size, len, "%%' ESCAPE '\\' ");   /* CTSVC_DB_ESCAPE_CHAR */
-                       if (0 <= temp_len) len += temp_len;
+                       if (0 <= temp_len)
+                               len += temp_len;
+
+                       /* CTSVC_DB_ESCAPE_CHAR */
+                       temp_len = SAFE_SNPRINTF(query, query_size, len, "%%' ESCAPE '\\' ");
+                       if (0 <= temp_len)
+                               len += temp_len;
 
                        if (need_union) {
                                temp_len = SAFE_SNPRINTF(query, query_size, len, ") ");
@@ -1666,7 +1909,7 @@ static int __ctsvc_db_search_records_character_count(const char *keyword)
        int count = 0;
        bool after_space = true;
 
-       for (i=0;i<str_len; i+=char_len) {
+       for (i = 0; i < str_len; i += char_len) {
                char_len = ctsvc_check_utf8(keyword[i]);
                if (char_len == 1 && keyword[i] == ' ') {
                        after_space = true;
@@ -1689,7 +1932,7 @@ static int __ctsvc_db_search_records_append_sort(const char *view_uri,
        if (ctsvc_get_primary_sort() == CTSVC_SORT_KOREAN) {
                contacts_name_sorting_order_e order;
                const char *field = NULL;
-               char *temp_keyword = NULL;
+               char *tmp_keyword = NULL;
                ctsvc_setting_get_name_sorting_order(&order);
 
                if (CONTACTS_NAME_SORTING_ORDER_FIRSTLAST == order)
@@ -1707,13 +1950,13 @@ static int __ctsvc_db_search_records_append_sort(const char *view_uri,
                                char temp_str[((250*keyword_len) + 30) * SORT_CHECK_LEN + 50];
                                int temp_str_len = 0;
 
-                               temp_str_len = snprintf(temp_str+temp_str_len, sizeof(temp_str)-temp_str_len,
-                                                               " ORDER BY CASE ");
+                               temp_str_len = snprintf(temp_str + temp_str_len,
+                                               sizeof(temp_str) - temp_str_len, " ORDER BY CASE ");
 
-                               for (j=1;j<=SORT_CHECK_LEN;j++) {
-                                       temp_str_len += snprintf(temp_str+temp_str_len, sizeof(temp_str)-temp_str_len,
-                                                                                       " WHEN ");
-                                       for (i=0, m=0;i<keyword_len;i+=char_len, m++) {
+                               for (j = 1; j <= SORT_CHECK_LEN; j++) {
+                                       temp_str_len += snprintf(temp_str + temp_str_len,
+                                                       sizeof(temp_str) - temp_str_len, " WHEN ");
+                                       for (i = 0, m = 0; i < keyword_len; i += char_len, m++) {
                                                char temp[10] = {0};
                                                int k = -1;
                                                char_len = ctsvc_check_utf8(keyword[i]);
@@ -1726,87 +1969,104 @@ static int __ctsvc_db_search_records_append_sort(const char *view_uri,
 
                                                if (char_len == 1 && temp[0] == ' ')
                                                        continue;
-                                               if (first == false && i != 0)
-                                                       temp_str_len += snprintf(temp_str+temp_str_len, sizeof(temp_str)-temp_str_len, " AND ");
+                                               if (first == false && i != 0) {
+                                                       temp_str_len += snprintf(temp_str + temp_str_len,
+                                                                       sizeof(temp_str)-temp_str_len, " AND ");
+                                               }
                                                if (ctsvc_is_chosung(temp)) {
-                                                       for (k=0;k<19;k++) {
+                                                       for (k = 0; k < 19; k++) {
                                                                if (STRING_EQUAL == strcmp(hangul_syllable[k][0], temp))
                                                                        break;
                                                        }
                                                }
 
-                                               if (0<=k && k<=18) {
-                                                       temp_str_len += snprintf(temp_str+temp_str_len, sizeof(temp_str)-temp_str_len,
-                                                                                       " ((substr(%s, %d, 1) BETWEEN '%s' AND '%s') OR (substr(%s, %d, 1) = '%s'))  ",
-                                                                                       field, j+m, hangul_syllable[k][1], hangul_syllable[k][2],
-                                                                                       field, j+m, temp);
+                                               if (0 <= k && k <= 18) {
+                                                       temp_str_len += snprintf(temp_str+temp_str_len,
+                                                                       sizeof(temp_str)-temp_str_len,
+                                                                       " ((substr(%s, %d, 1) BETWEEN '%s' AND '%s') OR (substr(%s, %d, 1) = '%s'))  ",
+                                                                       field,
+                                                                       j+m,
+                                                                       hangul_syllable[k][1],
+                                                                       hangul_syllable[k][2],
+                                                                       field,
+                                                                       j+m,
+                                                                       temp);
+                                               } else {
+                                                       temp_str_len += snprintf(temp_str+temp_str_len,
+                                                                       sizeof(temp_str)-temp_str_len,
+                                                                       " (substr(%s, %d, 1) = '%s')  ",
+                                                                       field,
+                                                                       j+m,
+                                                                       temp);
                                                }
-                                               else
-                                                       temp_str_len += snprintf(temp_str+temp_str_len, sizeof(temp_str)-temp_str_len,
-                                                                                       " (substr(%s, %d, 1) = '%s')  ",
-                                                                                       field, j+m, temp);
                                                if (first)
                                                        first = false;
                                        }
-                                       temp_str_len += snprintf(temp_str+temp_str_len, sizeof(temp_str)-temp_str_len,
-                                                               " THEN %d ", j);
+                                       temp_str_len += snprintf(temp_str + temp_str_len,
+                                                       sizeof(temp_str) - temp_str_len, " THEN %d ", j);
                                }
-                               temp_str_len = snprintf(temp_str+temp_str_len, sizeof(temp_str)-temp_str_len,
-                                                               " ELSE %d END ", j);
+                               temp_str_len = snprintf(temp_str + temp_str_len,
+                                               sizeof(temp_str) - temp_str_len, " ELSE %d END ", j);
+
                                temp_len = SAFE_SNPRINTF(query, query_size, len, temp_str);
-                               if (0 <= temp_len) len+= temp_len;
-                       }
-                       else {
+                               if (0 <= temp_len)
+                                       len += temp_len;
+                       else {
                                temp_len = SAFE_SNPRINTF(query, query_size, len, " ORDER BY ");
-                               if (0 <= temp_len) len+= temp_len;
+                               if (0 <= temp_len) len += temp_len;
                                temp_len = SAFE_SNPRINTF(query, query_size, len, sortkey);
-                               if (0 <= temp_len) len+= temp_len;
+                               if (0 <= temp_len) len += temp_len;
                        }
-               }
-               else {
-                       temp_keyword = __ctsvc_db_get_str_with_escape((char*)keyword, strlen((char*)keyword), true);
-                       if (NULL == temp_keyword) {
-                               CTS_ERR("__ctsvc_db_get_str_with_escape() Fail");
+               } else {
+                       tmp_keyword = __db_get_str_with_escape((char*)keyword, strlen(keyword), true);
+                       if (NULL == tmp_keyword) {
+                               ERR("__db_get_str_with_escape() Fail");
                                return CONTACTS_ERROR_OUT_OF_MEMORY;
                        }
 
-                       char temp_str[CTS_SQL_MIN_LEN + (strlen(field) + strlen(temp_keyword)) * SORT_CHECK_LEN];
+                       char temp_str[CTS_SQL_MIN_LEN + (strlen(field) + strlen(tmp_keyword)) * SORT_CHECK_LEN];
                        snprintf(temp_str, sizeof(temp_str),
-                                                       " ORDER BY "
-                                                       "       CASE "
-                                                       "               WHEN %s LIKE '%s%%' THEN 1 "
-                                                       "               WHEN %s LIKE '_%s%%' THEN 2 "
-                                                       "               WHEN %s LIKE '__%s%%' THEN 3 "
-                                                       "               WHEN %s LIKE '___%s%%' THEN 4 "
-                                                       "               WHEN %s LIKE '____%s%%' THEN 5 "
-                                                       "               WHEN %s LIKE '_____%s%%' THEN 6 "
-                                                       "               WHEN %s LIKE '______%s%%' THEN 7 "
-                                                       "               ELSE 8 "
-                                                       "       END ",
-                                                       field, temp_keyword, field, temp_keyword,
-                                                       field, temp_keyword, field, temp_keyword,
-                                                       field, temp_keyword, field, temp_keyword,
-                                                               field, temp_keyword);
+                                       " ORDER BY "
+                                       "       CASE "
+                                       "               WHEN %s LIKE '%s%%' THEN 1 "
+                                       "               WHEN %s LIKE '_%s%%' THEN 2 "
+                                       "               WHEN %s LIKE '__%s%%' THEN 3 "
+                                       "               WHEN %s LIKE '___%s%%' THEN 4 "
+                                       "               WHEN %s LIKE '____%s%%' THEN 5 "
+                                       "               WHEN %s LIKE '_____%s%%' THEN 6 "
+                                       "               WHEN %s LIKE '______%s%%' THEN 7 "
+                                       "               ELSE 8 "
+                                       "       END ",
+                                       field, tmp_keyword, field, tmp_keyword,
+                                       field, tmp_keyword, field, tmp_keyword,
+                                       field, tmp_keyword, field, tmp_keyword,
+                                       field, tmp_keyword);
                        temp_len = SAFE_SNPRINTF(query, query_size, len, temp_str);
-                       if (0 <= temp_len) len+= temp_len;
-                               free(temp_keyword);
+                       if (0 <= temp_len) len += temp_len;
+                       free(tmp_keyword);
                }
                temp_len = SAFE_SNPRINTF(query, query_size, len, ", ");
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len) len += temp_len;
                temp_len = SAFE_SNPRINTF(query, query_size, len, sortkey);
-               if (0 <= temp_len) len+= temp_len;
-       }
-       else {
+               if (0 <= temp_len) len += temp_len;
+       } else {
                temp_len = SAFE_SNPRINTF(query, query_size, len, " ORDER BY ");
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len) len += temp_len;
                temp_len = SAFE_SNPRINTF(query, query_size, len, sortkey);
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len) len += temp_len;
        }
        return len;
 }
 
-static int __ctsvc_db_search_records_exec(const char *view_uri, const property_info_s* properties,
-               int ids_count, const char *projection, const char *keyword, int offset, int limit, int range, contacts_list_h* out_list)
+static int __ctsvc_db_search_records_exec(const char *view_uri,
+               const property_info_s *properties,
+               int ids_count,
+               const char *projection,
+               const char *keyword,
+               int offset,
+               int limit,
+               int range,
+               contacts_list_h *out_list)
 {
        char *query = NULL;
        char temp_query[CTS_SQL_MAX_LEN];
@@ -1823,20 +2083,19 @@ static int __ctsvc_db_search_records_exec(const char *view_uri, const property_i
        const char *sortkey = NULL;
 
        ret = ctsvc_db_get_table_name(view_uri, &table);
-       RETVM_IF (CONTACTS_ERROR_NONE != ret, ret, "Invalid parameter : view uri (%s)", view_uri);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "Invalid view uri (%s)", view_uri);
 
        query_size = CTS_SQL_MAX_LEN;
        query = calloc(1, query_size);
        if (NULL == query) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
 
        len = 0;
 
-       if (STRING_EQUAL == strcmp(keyword, "+")) {
+       if (STRING_EQUAL == strcmp(keyword, "+"))
                range &= ~CONTACTS_SEARCH_RANGE_NUMBER;
-       }
 
        if (STRING_EQUAL == strcmp(view_uri, CTSVC_VIEW_URI_READ_ONLY_PERSON_CONTACT)
                        || STRING_EQUAL == strcmp(view_uri, CTSVC_VIEW_URI_READ_ONLY_PERSON_GROUP)
@@ -1848,37 +2107,36 @@ static int __ctsvc_db_search_records_exec(const char *view_uri, const property_i
                }
 
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, "SELECT ");
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len) len += temp_len;
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, projection);
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len) len += temp_len;
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, " FROM ");
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len) len += temp_len;
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, table);
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len) len += temp_len;
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, " WHERE contact_id IN ");
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len) len += temp_len;
 
-               temp_len = __ctsvc_db_append_search_query(keyword, &query, &query_size, len, range);
+               temp_len = __db_append_search_query(keyword, &query, &query_size, len, range);
                if (0 <= temp_len) len = temp_len;
-       }
-       else if (STRING_EQUAL == strcmp(view_uri, CTSVC_VIEW_URI_READ_ONLY_PERSON_NUMBER)) {
+       } else if (STRING_EQUAL == strcmp(view_uri, CTSVC_VIEW_URI_READ_ONLY_PERSON_NUMBER)) {
                bool need_or = false;
                if (range & CONTACTS_SEARCH_RANGE_DATA || range & CONTACTS_SEARCH_RANGE_EMAIL) {
                        free(query);
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, "SELECT ");
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len) len += temp_len;
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, projection);
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len) len += temp_len;
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, " FROM (");
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len) len += temp_len;
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, " SELECT * FROM ");
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len) len += temp_len;
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, table);
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len) len += temp_len;
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, " WHERE ");
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len) len += temp_len;
 
                if ((range & CONTACTS_SEARCH_RANGE_NUMBER) && ctsvc_is_phonenumber(keyword)) {
                        char clean_num[strlen(keyword)+1+5];   /* for cc */
@@ -1892,46 +2150,66 @@ static int __ctsvc_db_search_records_exec(const char *view_uri, const property_i
                        if (0 < ret) {
                                const char *cc = ctsvc_get_network_cc(false);
 
-                               temp_len = SAFE_SNPRINTF(&query, &query_size, len, "(normalized_number LIKE '%%");
-                               if (0 <= temp_len) len+= temp_len;
+                               temp_len = SAFE_SNPRINTF(&query, &query_size, len,
+                                               "(normalized_number LIKE '%%");
+                               if (0 <= temp_len)
+                                       len += temp_len;
 
                                if (cc && cc[0] == '7' && clean_num[0] == '8') {   /* Russia */
                                        char normal_num[strlen(clean_num)+1+5];   /* for cc */
-                                       ret = ctsvc_normalize_number(clean_num, normal_num, sizeof(normal_num), false);
-                                       if (0 < ret) {
+                                       ret = ctsvc_normalize_number(clean_num, normal_num,
+                                                       sizeof(normal_num), false);
+                                       if (0 < ret)
                                                temp_len = SAFE_SNPRINTF(&query, &query_size, len, normal_num);
-                                       }
                                        else
                                                temp_len = SAFE_SNPRINTF(&query, &query_size, len, clean_num);
-                               }
-                               else
+                               } else {
                                        temp_len = SAFE_SNPRINTF(&query, &query_size, len, clean_num);
-                               if (0 <= temp_len) len+= temp_len;
+                               }
+                               if (0 <= temp_len)
+                                       len += temp_len;
+
+                               temp_len = SAFE_SNPRINTF(&query, &query_size, len,
+                                               "%%' OR cleaned_number LIKE '%%");
+                               if (0 <= temp_len)
+                                       len += temp_len;
 
-                               temp_len = SAFE_SNPRINTF(&query, &query_size, len, "%%' OR cleaned_number LIKE '%%");
-                               if (0 <= temp_len) len+= temp_len;
                                temp_len = SAFE_SNPRINTF(&query, &query_size, len, clean_num);
-                               if (0 <= temp_len) len+= temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
+
                                temp_len = SAFE_SNPRINTF(&query, &query_size, len, "%%')");
-                               if (0 <= temp_len) len+= temp_len;
-                       }
-                       else {
-                               char *temp_keyword = __ctsvc_db_get_str_with_escape((char*)keyword, strlen((char*)keyword), true);
+                               if (0 <= temp_len)
+                                       len += temp_len;
+                       } else {
+                               char *temp_keyword = __db_get_str_with_escape((char*)keyword,
+                                               strlen(keyword), true);
                                if (NULL == temp_keyword) {
-                                       CTS_ERR("__ctsvc_db_get_str_with_escape() Fail");
+                                       ERR("__db_get_str_with_escape() Fail");
                                        free(query);
                                        return CONTACTS_ERROR_OUT_OF_MEMORY;
                                }
+
                                temp_len = SAFE_SNPRINTF(&query, &query_size, len, " SELECT * FROM ");
-                               if (0 <= temp_len) len+= temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
+
                                temp_len = SAFE_SNPRINTF(&query, &query_size, len, table);
-                               if (0 <= temp_len) len+= temp_len;
-                               temp_len = SAFE_SNPRINTF(&query, &query_size, len, " WHERE number LIKE '%%");
-                               if (0 <= temp_len) len+= temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
+
+                               temp_len = SAFE_SNPRINTF(&query, &query_size, len,
+                                               " WHERE number LIKE '%%");
+                               if (0 <= temp_len)
+                                       len += temp_len;
+
                                temp_len = SAFE_SNPRINTF(&query, &query_size, len, temp_keyword);
-                               if (0 <= temp_len) len+= temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
+
                                temp_len = SAFE_SNPRINTF(&query, &query_size, len, "%%' ESCAPE '\\'");
-                               if (0 <= temp_len) len+= temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
                                free(temp_keyword);
                        }
                        need_or = true;
@@ -1940,13 +2218,15 @@ static int __ctsvc_db_search_records_exec(const char *view_uri, const property_i
                if (range & CONTACTS_SEARCH_RANGE_NAME) {
                        if (need_or) {
                                temp_len = SAFE_SNPRINTF(&query, &query_size, len, " OR ");
-                               if (0 <= temp_len) len+= temp_len;
+                               if (0 <= temp_len) len += temp_len;
                        }
                        snprintf(temp_query, sizeof(temp_query),
-                                               "person_id IN (SELECT person_id "
-                                               "FROM "CTS_TABLE_CONTACTS" WHERE deleted = 0 AND  contact_id ");
+                                       "person_id IN (SELECT person_id "
+                                       "FROM "CTS_TABLE_CONTACTS" WHERE deleted = 0 AND  contact_id ");
+
                        temp_len = SAFE_SNPRINTF(&query, &query_size, len, temp_query);
-                       if (0 <= temp_len) len+= temp_len;
+                       if (0 <= temp_len)
+                               len += temp_len;
 
                        /*
                         * search contact from search_index table by name and join the results
@@ -1954,17 +2234,23 @@ static int __ctsvc_db_search_records_exec(const char *view_uri, const property_i
                         * If contact display_name is 'abc def', then the contact should be searched by 'def'
                         */
                        temp_len = SAFE_SNPRINTF(&query, &query_size, len, " IN ");
-                       if (0 <= temp_len) len+= temp_len;
-                       temp_len = __ctsvc_db_append_search_query(keyword, &query, &query_size, len, CONTACTS_SEARCH_RANGE_NAME);
-                       if (0 <= temp_len) len = temp_len;
+                       if (0 <= temp_len)
+                               len += temp_len;
+
+                       temp_len = __db_append_search_query(keyword, &query, &query_size, len,
+                                       CONTACTS_SEARCH_RANGE_NAME);
+                       if (0 <= temp_len)
+                               len = temp_len;
+
                        temp_len = SAFE_SNPRINTF(&query, &query_size, len, ") ");
-                       if (0 <= temp_len) len+= temp_len;
+                       if (0 <= temp_len)
+                               len += temp_len;
                }
 
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, ") ");
-               if (0 <= temp_len) len+= temp_len;
-       }
-       else if (STRING_EQUAL == strcmp(view_uri, CTSVC_VIEW_URI_READ_ONLY_PERSON_EMAIL)) {
+               if (0 <= temp_len)
+                       len += temp_len;
+       else if (STRING_EQUAL == strcmp(view_uri, CTSVC_VIEW_URI_READ_ONLY_PERSON_EMAIL)) {
                bool need_or = false;
                if (range & CONTACTS_SEARCH_RANGE_NUMBER || range & CONTACTS_SEARCH_RANGE_DATA) {
                        free(query);
@@ -1972,29 +2258,45 @@ static int __ctsvc_db_search_records_exec(const char *view_uri, const property_i
                }
 
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, "SELECT ");
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len)
+                       len += temp_len;
+
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, projection);
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len)
+                       len += temp_len;
+
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, " FROM (");
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len)
+                       len += temp_len;
+
                if (range & CONTACTS_SEARCH_RANGE_EMAIL) {
                        /* search contact which has email address started with keyword */
-                       char *temp_keyword = __ctsvc_db_get_str_with_escape((char*)keyword, strlen((char*)keyword), true);
+                       char *temp_keyword = __db_get_str_with_escape((char*)keyword,
+                                       strlen(keyword), true);
                        if (NULL == temp_keyword) {
-                               CTS_ERR("__ctsvc_db_get_str_with_escape() Fail");
+                               ERR("__db_get_str_with_escape() Fail");
                                free(query);
                                return CONTACTS_ERROR_OUT_OF_MEMORY;
                        }
                        temp_len = SAFE_SNPRINTF(&query, &query_size, len, "SELECT * FROM ");
-                       if (0 <= temp_len) len+= temp_len;
+                       if (0 <= temp_len)
+                               len += temp_len;
+
                        temp_len = SAFE_SNPRINTF(&query, &query_size, len, table);
-                       if (0 <= temp_len) len+= temp_len;
+                       if (0 <= temp_len)
+                               len += temp_len;
+
                        temp_len = SAFE_SNPRINTF(&query, &query_size, len, " WHERE (email LIKE '");
-                       if (0 <= temp_len) len+= temp_len;
+                       if (0 <= temp_len)
+                               len += temp_len;
+
                        temp_len = SAFE_SNPRINTF(&query, &query_size, len, temp_keyword);
-                       if (0 <= temp_len) len+= temp_len;
+                       if (0 <= temp_len)
+                               len += temp_len;
+
                        temp_len = SAFE_SNPRINTF(&query, &query_size, len, "%%' ESCAPE '\\')");
-                       if (0 <= temp_len) len+= temp_len;
+                       if (0 <= temp_len)
+                               len += temp_len;
                        free(temp_keyword);
                        need_or = true;
                }
@@ -2002,75 +2304,81 @@ static int __ctsvc_db_search_records_exec(const char *view_uri, const property_i
                if (range & CONTACTS_SEARCH_RANGE_NAME) {
                        if (need_or) {
                                temp_len = SAFE_SNPRINTF(&query, &query_size, len, " OR ");
-                               if (0 <= temp_len) len+= temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
                        }
 
                        snprintf(temp_query, sizeof(temp_query),
-                                               "person_id IN (SELECT person_id "
-                                               "FROM "CTS_TABLE_CONTACTS" WHERE deleted = 0 AND  contact_id ");
+                                       "person_id IN (SELECT person_id "
+                                       "FROM "CTS_TABLE_CONTACTS" WHERE deleted = 0 AND  contact_id ");
                        temp_len = SAFE_SNPRINTF(&query, &query_size, len, temp_query);
-                       if (0 <= temp_len) len+= temp_len;
+                       if (0 <= temp_len) len += temp_len;
 
                        temp_len = SAFE_SNPRINTF(&query, &query_size, len, " IN ");
-                       if (0 <= temp_len) len+= temp_len;
-                       temp_len = __ctsvc_db_append_search_query(keyword, &query, &query_size, len, CONTACTS_SEARCH_RANGE_NAME);
-                       if (0 <= temp_len) len = temp_len;
+                       if (0 <= temp_len)
+                               len += temp_len;
+                       temp_len = __db_append_search_query(keyword, &query, &query_size, len,
+                                       CONTACTS_SEARCH_RANGE_NAME);
+                       if (0 <= temp_len)
+                               len = temp_len;
                        temp_len = SAFE_SNPRINTF(&query, &query_size, len, ") ");
-                       if (0 <= temp_len) len+= temp_len;
+                       if (0 <= temp_len)
+                               len += temp_len;
                }
 
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, ") ");
-               if (0 <= temp_len) len+= temp_len;
-       }
-       else {   /* CTSVC_VIEW_URI_PERSON */
+               if (0 <= temp_len) len += temp_len;
+       } else {   /* CTSVC_VIEW_URI_PERSON */
                if (range & CONTACTS_SEARCH_RANGE_EMAIL) {
                        free(query);
                        return CONTACTS_ERROR_INVALID_PARAMETER;
                }
 
                snprintf(temp_query, sizeof(temp_query), "SELECT %s FROM %s, "
-                                       "(SELECT person_id person_id_in_contact, addressbook_id "
-                                                       "FROM "CTS_TABLE_CONTACTS " "
-                                                       "WHERE deleted = 0 AND contact_id IN ",
-                                                       projection, table);
+                               "(SELECT person_id person_id_in_contact, addressbook_id "
+                               "FROM "CTS_TABLE_CONTACTS " "
+                               "WHERE deleted = 0 AND contact_id IN ",
+                               projection, table);
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, temp_query);
-               if (0 <= temp_len) len+= temp_len;
-               temp_len = __ctsvc_db_append_search_query(keyword, &query, &query_size, len, range);
+               if (0 <= temp_len) len += temp_len;
+               temp_len = __db_append_search_query(keyword, &query, &query_size, len, range);
                if (0 <= temp_len) len = temp_len;
-               temp_len = SAFE_SNPRINTF(&query, &query_size, len, "GROUP BY person_id_in_contact) temp_contacts ON ");
-               if (0 <= temp_len) len+= temp_len;
+               temp_len = SAFE_SNPRINTF(&query, &query_size, len,
+                               "GROUP BY person_id_in_contact) temp_contacts ON ");
+               if (0 <= temp_len) len += temp_len;
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, table);
-               if (0 <= temp_len) len+= temp_len;
-               temp_len = SAFE_SNPRINTF(&query, &query_size, len, ".person_id = temp_contacts.person_id_in_contact");
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len) len += temp_len;
+               temp_len = SAFE_SNPRINTF(&query, &query_size, len,
+                               ".person_id = temp_contacts.person_id_in_contact");
+               if (0 <= temp_len) len += temp_len;
        }
 
        if (__ctsvc_db_view_has_display_name(view_uri, properties, ids_count))
                sortkey = ctsvc_get_sort_column();
 
        if (sortkey) {
-               len = __ctsvc_db_search_records_append_sort(view_uri, sortkey, keyword, len, &query, &query_size);
-       }
-       else if (STRING_EQUAL == strcmp(view_uri, CTSVC_VIEW_URI_GROUP)) {
+               len = __ctsvc_db_search_records_append_sort(view_uri, sortkey, keyword, len,
+                               &query, &query_size);
+       else if (STRING_EQUAL == strcmp(view_uri, CTSVC_VIEW_URI_GROUP)) {
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, " ORDER BY group_prio");
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len) len += temp_len;
        }
 
        if (0 != limit) {
                snprintf(temp_query, sizeof(temp_query), " LIMIT %d", limit);
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, temp_query);
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len) len += temp_len;
 
                if (0 < offset) {
                        snprintf(temp_query, sizeof(temp_query), " OFFSET %d", offset);
                        temp_len = SAFE_SNPRINTF(&query, &query_size, len, temp_query);
-                       if (0 <= temp_len) len+= temp_len;
+                       if (0 <= temp_len) len += temp_len;
                }
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
        free(query);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        r_type = ctsvc_view_get_record_type(view_uri);
 
@@ -2078,7 +2386,7 @@ static int __ctsvc_db_search_records_exec(const char *view_uri, const property_i
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -2086,35 +2394,39 @@ static int __ctsvc_db_search_records_exec(const char *view_uri, const property_i
 
                if (r_type == CTSVC_RECORD_PERSON) {
                        unsigned int *project = malloc(sizeof(unsigned int)*ids_count);
-                       for (i=0;i<ids_count;i++) {
+                       for (i = 0; i < ids_count; i++)
                                project[i] = properties[i].property_id;
-                       }
 
-                       int ret = ctsvc_db_person_create_record_from_stmt_with_projection(stmt, project, ids_count, &record);
+                       int ret = ctsvc_db_person_create_record_from_stmt_with_projection(stmt,
+                                       project, ids_count, &record);
 
                        free(project);
 
-                       if (CONTACTS_ERROR_NONE != ret) {
-                               CTS_ERR("DB error : make record Fail(%d)", ret);
-                       }
-               }
-               else {
+                       if (CONTACTS_ERROR_NONE != ret)
+                               ERR("make record Fail(%d)", ret);
+               } else {
                        contacts_record_create(view_uri, &record);
 
-                       for (i=0;i<ids_count;i++) {
+                       for (i = 0; i < ids_count; i++) {
                                type = (properties[i].property_id & CTSVC_VIEW_DATA_TYPE_MASK);
-                               if (type == CTSVC_VIEW_DATA_TYPE_INT)
-                                       ctsvc_record_set_int(record, properties[i].property_id, ctsvc_stmt_get_int(stmt, i));
-                               else if (type == CTSVC_VIEW_DATA_TYPE_STR)
-                                       ctsvc_record_set_str(record, properties[i].property_id, ctsvc_stmt_get_text(stmt, i));
-                               else if (type == CTSVC_VIEW_DATA_TYPE_BOOL)
-                                       ctsvc_record_set_bool(record, properties[i].property_id, (ctsvc_stmt_get_int(stmt, i)?true:false));
-                               else if (type == CTSVC_VIEW_DATA_TYPE_LLI)
-                                       ctsvc_record_set_lli(record, properties[i].property_id, ctsvc_stmt_get_int64(stmt, i));
-                               else if (type == CTSVC_VIEW_DATA_TYPE_DOUBLE)
-                                       ctsvc_record_set_double(record, properties[i].property_id, ctsvc_stmt_get_dbl(stmt, i));
-                               else
-                                       CTS_ERR("DB error : unknown type (%d)", type);
+                               if (type == CTSVC_VIEW_DATA_TYPE_INT) {
+                                       ctsvc_record_set_int(record, properties[i].property_id,
+                                                       ctsvc_stmt_get_int(stmt, i));
+                               } else if (type == CTSVC_VIEW_DATA_TYPE_STR) {
+                                       ctsvc_record_set_str(record, properties[i].property_id,
+                                                       ctsvc_stmt_get_text(stmt, i));
+                               } else if (type == CTSVC_VIEW_DATA_TYPE_BOOL) {
+                                       ctsvc_record_set_bool(record, properties[i].property_id,
+                                                       (ctsvc_stmt_get_int(stmt, i) ? true : false));
+                               } else if (type == CTSVC_VIEW_DATA_TYPE_LLI) {
+                                       ctsvc_record_set_lli(record, properties[i].property_id,
+                                                       ctsvc_stmt_get_int64(stmt, i));
+                               } else if (type == CTSVC_VIEW_DATA_TYPE_DOUBLE) {
+                                       ctsvc_record_set_double(record, properties[i].property_id,
+                                                       ctsvc_stmt_get_dbl(stmt, i));
+                               } else {
+                                       ERR("unknown type (%d)", type);
+                               }
                        }
                }
 
@@ -2127,8 +2439,8 @@ static int __ctsvc_db_search_records_exec(const char *view_uri, const property_i
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_search_records(const charview_uri, const char *keyword,
-               int offset, int limit, contacts_list_hout_list)
+static int __ctsvc_db_search_records(const char *view_uri, const char *keyword,
+               int offset, int limit, contacts_list_h *out_list)
 {
        int ret;
        unsigned int count;
@@ -2137,25 +2449,28 @@ static int __ctsvc_db_search_records(const char* view_uri, const char *keyword,
        bool can_keyword_search = false;
        int range = CONTACTS_SEARCH_RANGE_NAME | CONTACTS_SEARCH_RANGE_NUMBER | CONTACTS_SEARCH_RANGE_DATA;
 
-       RETVM_IF(NULL == keyword, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : keyword is NULL");
+       RETV_IF(NULL == keyword, CONTACTS_ERROR_INVALID_PARAMETER);
 
        can_keyword_search = __ctsvc_db_view_can_keyword_search(view_uri);
        RETVM_IF(false == can_keyword_search, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : can not keyword search");
+                       "can not keyword search");
 
        p = ctsvc_view_get_all_property_infos(view_uri, &count);
-       ret = __ctsvc_db_create_projection(view_uri, p, count, NULL, 0, &projection);
-       RETVM_IF (CONTACTS_ERROR_NONE != ret, ret, "__ctsvc_db_create_projection Fail(%d)", ret);
+       ret = __db_create_projection(view_uri, p, count, NULL, 0, &projection);
+       if (CONTACTS_ERROR_NONE != ret) {
+               ERR("__db_create_projection() Fail(%d)", ret);
+               return ret;
+       }
 
-       ret = __ctsvc_db_search_records_exec(view_uri, p, count, projection, keyword, offset, limit, range, out_list);
+       ret = __ctsvc_db_search_records_exec(view_uri, p, count, projection, keyword, offset,
+                       limit, range, out_list);
        free(projection);
 
        return ret;
 }
 
-static int __ctsvc_db_search_records_with_range(const charview_uri, const char *keyword,
-               int offset, int limit, int range, contacts_list_hout_list)
+static int __ctsvc_db_search_records_with_range(const char *view_uri, const char *keyword,
+               int offset, int limit, int range, contacts_list_h *out_list)
 {
        int ret;
        unsigned int count;
@@ -2163,25 +2478,30 @@ static int __ctsvc_db_search_records_with_range(const char* view_uri, const char
        const property_info_s *p;
        bool can_keyword_search = false;
 
-       RETVM_IF(NULL == keyword, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : keyword is NULL");
+       RETV_IF(NULL == keyword, CONTACTS_ERROR_INVALID_PARAMETER);
 
        can_keyword_search = __ctsvc_db_view_can_keyword_search(view_uri);
-       RETVM_IF(false == can_keyword_search, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : can not keyword search");
+       RETV_IF(false == can_keyword_search, CONTACTS_ERROR_INVALID_PARAMETER);
 
        p = ctsvc_view_get_all_property_infos(view_uri, &count);
-       ret = __ctsvc_db_create_projection(view_uri, p, count, NULL, 0, &projection);
-       RETVM_IF (CONTACTS_ERROR_NONE != ret, ret, "__ctsvc_db_create_projection Fail(%d)", ret);
+       ret = __db_create_projection(view_uri, p, count, NULL, 0, &projection);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "__db_create_projection() Fail(%d)", ret);
 
-       ret = __ctsvc_db_search_records_exec(view_uri, p, count, projection, keyword, offset, limit, range, out_list);
+       ret = __ctsvc_db_search_records_exec(view_uri, p, count, projection, keyword, offset,
+                       limit, range, out_list);
        free(projection);
 
        return ret;
 }
 
-static inline int __ctsvc_db_search_records_with_query_exec(ctsvc_query_s *s_query, const char *projection,
-       const char *condition, GSList *bind, const char *keyword, int offset, int limit, contacts_list_h * out_list)
+static inline int __ctsvc_db_search_records_with_query_exec(ctsvc_query_s *s_query,
+               const char *projection,
+               const char *condition,
+               GSList *bind,
+               const char *keyword,
+               int offset,
+               int limit,
+               contacts_list_h *out_list)
 {
        char *query = NULL;
        int query_size;
@@ -2201,12 +2521,12 @@ static inline int __ctsvc_db_search_records_with_query_exec(ctsvc_query_s *s_que
        RETV_IF(NULL == projection || '\0' == *projection, CONTACTS_ERROR_INVALID_PARAMETER);
 
        ret = ctsvc_db_get_table_name(s_query->view_uri, &table);
-       RETVM_IF (CONTACTS_ERROR_NONE != ret, ret, "Invalid parameter : view uri (%s)", s_query->view_uri);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "Invalid view uri(%s)", s_query->view_uri);
 
        query_size = CTS_SQL_MAX_LEN;
        query = calloc(1, query_size);
        if (NULL == query) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
 
@@ -2216,76 +2536,106 @@ static inline int __ctsvc_db_search_records_with_query_exec(ctsvc_query_s *s_que
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, "SELECT DISTINCT ");
        else
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, "SELECT ");
-       if (0 <= temp_len) len+= temp_len;
+       if (0 <= temp_len) len += temp_len;
        temp_len = SAFE_SNPRINTF(&query, &query_size, len, projection);
-       if (0 <= temp_len) len+= temp_len;
+       if (0 <= temp_len) len += temp_len;
        temp_len = SAFE_SNPRINTF(&query, &query_size, len, " FROM ");
-       if (0 <= temp_len) len+= temp_len;
+       if (0 <= temp_len) len += temp_len;
 
        if (STRING_EQUAL == strcmp(s_query->view_uri, CTSVC_VIEW_URI_READ_ONLY_PERSON_CONTACT)
                        || STRING_EQUAL == strcmp(s_query->view_uri, CTSVC_VIEW_URI_READ_ONLY_PERSON_GROUP)
                        || STRING_EQUAL == strcmp(s_query->view_uri, CTSVC_VIEW_URI_READ_ONLY_PERSON_GROUP_ASSIGNED)
                        || STRING_EQUAL == strcmp(s_query->view_uri, CTSVC_VIEW_URI_READ_ONLY_PERSON_GROUP_NOT_ASSIGNED)) {
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, table);
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len)
+                       len += temp_len;
+
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, " WHERE person_id IN ");
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len)
+                       len += temp_len;
+
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, " ( SELECT person_id FROM ");
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len)
+                       len += temp_len;
+
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, CTS_TABLE_CONTACTS);
-               if (0 <= temp_len) len+= temp_len;
-               temp_len = SAFE_SNPRINTF(&query, &query_size, len, " WHERE deleted = 0 AND contact_id IN ");
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len)
+                       len += temp_len;
+
+               temp_len = SAFE_SNPRINTF(&query, &query_size, len,
+                               " WHERE deleted = 0 AND contact_id IN ");
+               if (0 <= temp_len)
+                       len += temp_len;
+
                person_contact_query = true;
-       }
-       else if (STRING_EQUAL == strcmp(s_query->view_uri, CTSVC_VIEW_URI_READ_ONLY_PERSON_NUMBER)
+       } else if (STRING_EQUAL == strcmp(s_query->view_uri, CTSVC_VIEW_URI_READ_ONLY_PERSON_NUMBER)
                        || STRING_EQUAL == strcmp(s_query->view_uri, CTSVC_VIEW_URI_READ_ONLY_PERSON_EMAIL)) {
                free(query);
                return CONTACTS_ERROR_INVALID_PARAMETER;
-       }
-       else {   /* CTSVC_VIEW_URI_PERSON */
+       } else {   /* CTSVC_VIEW_URI_PERSON */
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, table);
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len)
+                       len += temp_len;
+
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, ", "
-                                               "(SELECT contact_id, person_id person_id_in_contact, addressbook_id FROM ");
-               if (0 <= temp_len) len+= temp_len;
+                               "(SELECT contact_id, person_id person_id_in_contact, addressbook_id FROM ");
+               if (0 <= temp_len)
+                       len += temp_len;
+
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, CTS_TABLE_CONTACTS);
-               if (0 <= temp_len) len+= temp_len;
-               temp_len = SAFE_SNPRINTF(&query, &query_size, len, " WHERE deleted = 0) temp_contacts ON ");
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len)
+                       len += temp_len;
+
+               temp_len = SAFE_SNPRINTF(&query, &query_size, len,
+                               " WHERE deleted = 0) temp_contacts ON ");
+               if (0 <= temp_len)
+                       len += temp_len;
+
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, table);
-               if (0 <= temp_len) len+= temp_len;
-               temp_len = SAFE_SNPRINTF(&query, &query_size, len, ".person_id = temp_contacts.person_id_in_contact WHERE temp_contacts.contact_id IN ");
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len)
+                       len += temp_len;
+
+               temp_len = SAFE_SNPRINTF(&query, &query_size, len,
+                               ".person_id = temp_contacts.person_id_in_contact WHERE temp_contacts.contact_id IN ");
+               if (0 <= temp_len)
+                       len += temp_len;
        }
 
-       temp_len = __ctsvc_db_append_search_query(keyword, &query, &query_size, len, range);
-       if (0 <= temp_len) len = temp_len;
+       temp_len = __db_append_search_query(keyword, &query, &query_size, len, range);
+       if (0 <= temp_len)
+               len = temp_len;
 
        if (person_contact_query) {
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, " ) ");
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len)
+                       len += temp_len;
        }
 
        if (condition && *condition) {
                if (person_contact_query) {
                        temp_len = SAFE_SNPRINTF(&query, &query_size, len, " AND contact_id IN (");
-                       if (0 <= temp_len) len+= temp_len;
+                       if (0 <= temp_len)
+                               len += temp_len;
                        temp_len = SAFE_SNPRINTF(&query, &query_size, len, " SELECT contact_id FROM ");
-                       if (0 <= temp_len) len+= temp_len;
+                       if (0 <= temp_len)
+                               len += temp_len;
                        temp_len = SAFE_SNPRINTF(&query, &query_size, len, table);
-                       if (0 <= temp_len) len+= temp_len;
+                       if (0 <= temp_len)
+                               len += temp_len;
                        temp_len = SAFE_SNPRINTF(&query, &query_size, len, " WHERE ");
-                       if (0 <= temp_len) len+= temp_len;
-               }
-               else {
+                       if (0 <= temp_len)
+                               len += temp_len;
+               else {
                        temp_len = SAFE_SNPRINTF(&query, &query_size, len, " AND (");
-                       if (0 <= temp_len) len+= temp_len;
+                       if (0 <= temp_len)
+                               len += temp_len;
                }
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, condition);
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len)
+                       len += temp_len;
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, ")");
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len)
+                       len += temp_len;
        }
 
        if (__ctsvc_db_view_has_display_name(s_query->view_uri, s_query->properties, s_query->property_count))
@@ -2294,78 +2644,85 @@ static inline int __ctsvc_db_search_records_with_query_exec(ctsvc_query_s *s_que
        if (s_query->sort_property_id) {
                const char *field_name;
 
-               switch(s_query->sort_property_id) {
+               switch (s_query->sort_property_id) {
                case CTSVC_PROPERTY_PERSON_DISPLAY_NAME:
                case CTSVC_PROPERTY_CONTACT_DISPLAY_NAME:
                        if (sortkey) {
                                temp_len = SAFE_SNPRINTF(&query, &query_size, len, " ORDER BY ");
-                               if (0 <= temp_len) len+= temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
                                temp_len = SAFE_SNPRINTF(&query, &query_size, len, sortkey);
-                               if (0 <= temp_len) len+= temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
                                if (false == s_query->sort_asc) {
                                        temp_len = SAFE_SNPRINTF(&query, &query_size, len, " DESC ");
-                                       if (0 <= temp_len) len+= temp_len;
+                                       if (0 <= temp_len)
+                                               len += temp_len;
                                }
                        }
                        break;
-               default :
+               default:
                        field_name = __ctsvc_db_get_property_field_name(s_query->properties,
-                                                               s_query->property_count, QUERY_SORTKEY, s_query->sort_property_id);
+                                       s_query->property_count, QUERY_SORTKEY, s_query->sort_property_id);
                        if (field_name) {
                                temp_len = SAFE_SNPRINTF(&query, &query_size, len, " ORDER BY ");
-                               if (0 <= temp_len) len+= temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
                                temp_len = SAFE_SNPRINTF(&query, &query_size, len, field_name);
-                               if (0 <= temp_len) len+= temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
                                if (false == s_query->sort_asc) {
                                        temp_len = SAFE_SNPRINTF(&query, &query_size, len, " DESC ");
-                                       if (0 <= temp_len) len+= temp_len;
+                                       if (0 <= temp_len)
+                                               len += temp_len;
                                }
-                       }
-                       else if (sortkey) {
+                       } else if (sortkey) {
                                len += snprintf(query+len, sizeof(query)-len, " ORDER BY %s", sortkey);
                                temp_len = SAFE_SNPRINTF(&query, &query_size, len, " ORDER BY ");
-                               if (0 <= temp_len) len+= temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
                                temp_len = SAFE_SNPRINTF(&query, &query_size, len, sortkey);
-                               if (0 <= temp_len) len+= temp_len;
+                               if (0 <= temp_len)
+                                       len += temp_len;
                        }
                        break;
                }
-       }
-       else if (sortkey) {
-               len = __ctsvc_db_search_records_append_sort(s_query->view_uri, sortkey, keyword, len, &query, &query_size);
-       }
-       else if (STRING_EQUAL == strcmp(s_query->view_uri, CTSVC_VIEW_URI_GROUP)) {
+       } else if (sortkey) {
+               len = __ctsvc_db_search_records_append_sort(s_query->view_uri, sortkey, keyword,
+                               len, &query, &query_size);
+       } else if (STRING_EQUAL == strcmp(s_query->view_uri, CTSVC_VIEW_URI_GROUP)) {
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, " ORDER BY group_prio");
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len)
+                       len += temp_len;
        }
 
        if (0 != limit) {
                char temp_str[20] = {0};
                snprintf(temp_str, sizeof(temp_str), " LIMIT %d", limit);
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, temp_str);
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len) len += temp_len;
 
                if (0 < offset) {
                        snprintf(temp_str, sizeof(temp_str), " OFFSET %d", offset);
                        temp_len = SAFE_SNPRINTF(&query, &query_size, len, temp_str);
-                       if (0 <= temp_len) len+= temp_len;
+                       if (0 <= temp_len) len += temp_len;
                }
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
        free(query);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        i = 1;
        len = g_slist_length(bind);
-       for (cursor=bind; cursor;cursor=cursor->next, i++)
+       for (cursor = bind; cursor; cursor = cursor->next, i++)
                ctsvc_stmt_bind_text(stmt, i, cursor->data);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
@@ -2381,33 +2738,34 @@ static inline int __ctsvc_db_search_records_with_query_exec(ctsvc_query_s *s_que
 
                        project = malloc(sizeof(unsigned int)*ids_count);
 
-                       for (i=0;i<ids_count;i++) {
+                       for (i = 0; i < ids_count; i++) {
                                if (0 == s_query->projection_count)
                                        project[i] = s_query->properties[i].property_id;
                                else
                                        project[i] = s_query->projection[i];
                        }
 
-                       ret = ctsvc_db_person_create_record_from_stmt_with_projection(stmt, project, ids_count, &record);
-                       free(project);
-
+                       ret = ctsvc_db_person_create_record_from_stmt_with_projection(stmt, project,
+                                       ids_count, &record);
                        if (CONTACTS_ERROR_NONE != ret)
-                               CTS_ERR("DB error : make record Fail(%d)", ret);
-               }
-               else {
+                               ERR("ctsvc_db_person_create_record_from_stmt_with_projection() Fail(%d)", ret);
+
+                       free(project);
+               } else {
                        contacts_record_create(s_query->view_uri, (contacts_record_h*)&record);
                        int field_count;
-                       if (0 == s_query->projection_count)
+                       if (0 == s_query->projection_count) {
                                field_count = s_query->property_count;
-                       else {
+                       else {
                                field_count = s_query->projection_count;
 
-                               if (CONTACTS_ERROR_NONE != ctsvc_record_set_projection_flags(record, s_query->projection, s_query->projection_count, s_query->property_count)) {
-                                       ASSERT_NOT_REACHED("To set projection is Fail.\n");
-                               }
+                               int err = ctsvc_record_set_projection_flags(record, s_query->projection,
+                                               s_query->projection_count, s_query->property_count);
+                               if (CONTACTS_ERROR_NONE != err)
+                                       ASSERT_NOT_REACHED("To set projection is Fail");
                        }
 
-                       for (i=0;i<field_count;i++) {
+                       for (i = 0; i < field_count; i++) {
                                int property_id;
 
                                if (0 == s_query->projection_count)
@@ -2415,19 +2773,20 @@ static inline int __ctsvc_db_search_records_with_query_exec(ctsvc_query_s *s_que
                                else
                                        property_id = s_query->projection[i];
 
-                               type = __ctsvc_db_get_property_type(s_query->properties, s_query->property_count, property_id);
+                               type = __ctsvc_db_get_property_type(s_query->properties,
+                                               s_query->property_count, property_id);
                                if (type == CTSVC_VIEW_DATA_TYPE_INT)
-                                       ctsvc_record_set_int(record,property_id, ctsvc_stmt_get_int(stmt, i));
+                                       ctsvc_record_set_int(record, property_id, ctsvc_stmt_get_int(stmt, i));
                                else if (type == CTSVC_VIEW_DATA_TYPE_STR)
                                        ctsvc_record_set_str(record, property_id, ctsvc_stmt_get_text(stmt, i));
                                else if (type == CTSVC_VIEW_DATA_TYPE_BOOL)
-                                       ctsvc_record_set_bool(record, property_id, (ctsvc_stmt_get_int(stmt, i)?true:false));
+                                       ctsvc_record_set_bool(record, property_id, (ctsvc_stmt_get_int(stmt, i) ? true : false));
                                else if (type == CTSVC_VIEW_DATA_TYPE_LLI)
                                        ctsvc_record_set_lli(record, property_id, ctsvc_stmt_get_int64(stmt, i));
                                else if (type == CTSVC_VIEW_DATA_TYPE_DOUBLE)
                                        ctsvc_record_set_double(record, property_id, ctsvc_stmt_get_dbl(stmt, i));
                                else
-                                       CTS_ERR("DB error : unknown type (%d)", type);
+                                       ERR("unknown type (%d)", type);
                        }
                }
                ctsvc_list_prepend(list, record);
@@ -2440,42 +2799,44 @@ static inline int __ctsvc_db_search_records_with_query_exec(ctsvc_query_s *s_que
 }
 
 static int __ctsvc_db_search_records_with_query(contacts_query_h query, const char *keyword,
-               int offset, int limit, contacts_list_hout_list)
+               int offset, int limit, contacts_list_h *out_list)
 {
        int ret;
        char *condition = NULL;
        char *projection;
-       ctsvc_query_s *s_query;
+       ctsvc_query_s *s_query = (ctsvc_query_s*)query;
        GSList *bind_text = NULL;
        GSList *cursor = NULL;
        bool can_keyword_search;
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       RETVM_IF(NULL == keyword, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : keyword is NULL");
-       s_query = (ctsvc_query_s *)query;
+       RETV_IF(NULL == keyword, CONTACTS_ERROR_INVALID_PARAMETER);
 
        can_keyword_search = __ctsvc_db_view_can_keyword_search(s_query->view_uri);
-       RETVM_IF(false == can_keyword_search, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : can not keyword search");
+       RETV_IF(false == can_keyword_search, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       ret = __ctsvc_db_create_projection(s_query->view_uri, s_query->properties, s_query->property_count,
-                                                               s_query->projection, s_query->projection_count, &projection);
-       RETVM_IF (CONTACTS_ERROR_NONE != ret, ret, "__ctsvc_db_create_projection Fail(%d)", ret);
+       ret = __db_create_projection(s_query->view_uri, s_query->properties,
+                       s_query->property_count,
+                       s_query->projection,
+                       s_query->projection_count,
+                       &projection);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "__db_create_projection Fail(%d)", ret);
 
        if (s_query->filter) {
-               ret = __ctsvc_db_create_composite_condition(s_query->filter, &condition, &bind_text);
+               ret = __db_create_composite_condition(s_query->filter, &condition,
+                               &bind_text);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("__ctsvc_db_create_composite_condition Fail(%d)", ret);
+                       ERR("__db_create_composite_condition Fail(%d)", ret);
                        free(projection);
                        return ret;
                }
        }
 
-       ret = __ctsvc_db_search_records_with_query_exec(s_query, projection, condition, bind_text, keyword, offset, limit, out_list);
+       ret = __ctsvc_db_search_records_with_query_exec(s_query, projection, condition,
+                       bind_text, keyword, offset, limit, out_list);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("__ctsvc_db_search_records_with_query_exec Fail(%d)", ret);
-               for (cursor=bind_text;cursor;cursor=cursor->next)
+               ERR("__ctsvc_db_search_records_with_query_exec Fail(%d)", ret);
+               for (cursor = bind_text; cursor; cursor = cursor->next)
                        free(cursor->data);
                g_slist_free(bind_text);
 
@@ -2484,7 +2845,7 @@ static int __ctsvc_db_search_records_with_query(contacts_query_h query, const ch
                return ret;
        }
 
-       for (cursor=bind_text;cursor;cursor=cursor->next)
+       for (cursor = bind_text; cursor; cursor = cursor->next)
                free(cursor->data);
        g_slist_free(bind_text);
 
@@ -2502,7 +2863,7 @@ typedef struct {
        const char *view_uri;
        void *cb;
        void *user_data;
-}ctsvc_bulk_info_s;
+} ctsvc_bulk_info_s;
 
 static int __ctsvc_db_insert_records(contacts_list_h list, int **ids)
 {
@@ -2514,7 +2875,7 @@ static int __ctsvc_db_insert_records(contacts_list_h list, int **ids)
 
        ret = contacts_list_get_count(list, &count);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("contacts_list_get_count() Fail(%d)", ret);
+               ERR("contacts_list_get_count() Fail(%d)", ret);
                return ret;
        }
 
@@ -2528,7 +2889,7 @@ static int __ctsvc_db_insert_records(contacts_list_h list, int **ids)
        do {
                ret = contacts_list_get_current_record_p(list, &record);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("contacts_list_get_current_record_p is faild(%d)", ret);
+                       ERR("contacts_list_get_current_record_p() Fail(%d)", ret);
                        ctsvc_end_trans(false);
                        free(id);
                        return ret;
@@ -2536,7 +2897,7 @@ static int __ctsvc_db_insert_records(contacts_list_h list, int **ids)
 
                ret = ctsvc_db_insert_record(record, &id[index++]);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("contacts_db_insert_record is faild(%d)", ret);
+                       ERR("contacts_db_insert_record() Fail(%d)", ret);
                        ctsvc_end_trans(false);
                        free(id);
                        return ret;
@@ -2545,7 +2906,7 @@ static int __ctsvc_db_insert_records(contacts_list_h list, int **ids)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                free(id);
                return ret;
        }
@@ -2557,7 +2918,7 @@ static int __ctsvc_db_insert_records(contacts_list_h list, int **ids)
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_delete_records(const charview_uri, int ids[], int count)
+static int __ctsvc_db_delete_records(const char *view_uri, int ids[], int count)
 {
        int ret = CONTACTS_ERROR_NONE;
        int index;
@@ -2569,11 +2930,10 @@ static int __ctsvc_db_delete_records(const char* view_uri, int ids[], int count)
        do {
                ret = ctsvc_db_delete_record(view_uri, ids[index++]);
                if (CONTACTS_ERROR_NO_DATA == ret) {
-                       CTS_DBG("the record is not exist : %d", ret);
+                       DBG("the record is not exist : %d", ret);
                        continue;
-               }
-               else if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("contacts_db_delete_record is faild(%d)", ret);
+               } else if (ret != CONTACTS_ERROR_NONE) {
+                       ERR("contacts_db_delete_record() Fail(%d)", ret);
                        ctsvc_end_trans(false);
                        return ret;
                }
@@ -2581,7 +2941,7 @@ static int __ctsvc_db_delete_records(const char* view_uri, int ids[], int count)
 
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
        }
 
@@ -2595,38 +2955,38 @@ static int __ctsvc_db_update_records(contacts_list_h list)
        contacts_record_h record;
 
        ret = contacts_list_get_count(list, &count);
-       RETVM_IF(ret != CONTACTS_ERROR_NONE, ret, "contacts_list_get_count is falied(%d)", ret);
-       RETVM_IF(count <= 0, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : count is 0");
+       RETVM_IF(ret != CONTACTS_ERROR_NONE, ret, "contacts_list_get_count() Fail(%d)", ret);
+       RETVM_IF(count <= 0, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid count(%d)", count);
 
        ret = ctsvc_begin_trans();
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_begin_trans Fail(%d)", ret);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_begin_trans() Fail(%d)", ret);
 
        contacts_list_first(list);
        do {
                ret = contacts_list_get_current_record_p(list, &record);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("contacts_list_get_current_record_p is faild(%d)", ret);
+                       ERR("contacts_list_get_current_record_p() Fail(%d)", ret);
                        ctsvc_end_trans(false);
                        return ret;
                }
 
                ret = ctsvc_db_update_record(record);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("contacts_db_update_record is faild(%d)", ret);
+                       ERR("contacts_db_update_record() Fail(%d)", ret);
                        ctsvc_end_trans(false);
                        return ret;
                }
        } while (CONTACTS_ERROR_NONE == contacts_list_next(list));
        ret = ctsvc_end_trans(true);
        if (ret < CONTACTS_ERROR_NONE) {
-               CTS_ERR("DB error : ctsvc_end_trans() Fail(%d)", ret);
+               ERR("ctsvc_end_trans() Fail(%d)", ret);
                return ret;
        }
 
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_get_count_exec(const char *view_uri, const property_info_sproperties, int ids_count,
+static int __ctsvc_db_get_count_exec(const char *view_uri, const property_info_s *properties, int ids_count,
                const char *projection, int *out_count)
 {
        char query[CTS_SQL_MAX_LEN] = {0};
@@ -2635,7 +2995,7 @@ static int __ctsvc_db_get_count_exec(const char *view_uri, const property_info_s
        int ret;
 
        ret = ctsvc_db_get_table_name(view_uri, &table);
-       RETVM_IF (CONTACTS_ERROR_NONE != ret, ret, "Invalid parameter : view uri (%s)", view_uri);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "Invalid view uri(%s)", view_uri);
 
        len = snprintf(query, sizeof(query), "SELECT COUNT(*) FROM (SELECT %s FROM ", projection);
 
@@ -2644,20 +3004,23 @@ static int __ctsvc_db_get_count_exec(const char *view_uri, const property_info_s
        len += snprintf(query+len, sizeof(query)-len, ") ");
 
        ret = ctsvc_query_get_first_int_result(query, out_count);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_get_first_int_result() Fail(%d)", ret);
+       if (CONTACTS_ERROR_NONE != ret) {
+               ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
+               return ret;
+       }
 
        return ret;
 }
 
-static int __ctsvc_db_get_count(const charview_uri, int *out_count)
+static int __ctsvc_db_get_count(const char *view_uri, int *out_count)
 {
        int ret;
        unsigned int count;
        char *projection;
 
        const property_info_s *p = ctsvc_view_get_all_property_infos(view_uri, &count);
-       ret = __ctsvc_db_create_projection(view_uri, p, count, NULL, 0, &projection);
-       RETVM_IF (CONTACTS_ERROR_NONE != ret, ret, "__ctsvc_db_create_projection Fail(%d)", ret);
+       ret = __db_create_projection(view_uri, p, count, NULL, 0, &projection);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "__db_create_projection Fail(%d)", ret);
 
        __ctsvc_db_get_count_exec(view_uri, p, count, projection, out_count);
        free(projection);
@@ -2665,8 +3028,8 @@ static int __ctsvc_db_get_count(const char* view_uri, int *out_count)
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_get_count_with_query_exec(ctsvc_query_s *s_query, const char *projection,
-       const char *condition, GSList *bind_text, int *out_count)
+static int __db_get_count_with_query_exec(ctsvc_query_s *s_query, const char *projection,
+               const char *condition, GSList *bind_text, int *out_count)
 {
        char *query = NULL;
        int query_size;
@@ -2678,47 +3041,62 @@ static int __ctsvc_db_get_count_with_query_exec(ctsvc_query_s *s_query, const ch
        RETV_IF(NULL == projection || '\0' == *projection, CONTACTS_ERROR_INVALID_PARAMETER);
 
        ret = ctsvc_db_get_table_name(s_query->view_uri, &table);
-       RETVM_IF (CONTACTS_ERROR_NONE != ret, ret, "Invalid parameter : view uri (%s)", s_query->view_uri);
+       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "Invalid view uri(%s)", s_query->view_uri);
 
        query_size = CTS_SQL_MAX_LEN;
        query = calloc(1, query_size);
        if (NULL == query) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
 
        len = 0;
        if (s_query->distinct) {
-               temp_len = SAFE_SNPRINTF(&query, &query_size, len, "SELECT COUNT(*) FROM (SELECT DISTINCT ");
+               temp_len = SAFE_SNPRINTF(&query, &query_size, len,
+                               "SELECT COUNT(*) FROM (SELECT DISTINCT ");
+       } else {
+               temp_len = SAFE_SNPRINTF(&query, &query_size, len,
+                               "SELECT COUNT(*) FROM (SELECT ");
        }
-       else {
-               temp_len = SAFE_SNPRINTF(&query, &query_size, len, "SELECT COUNT(*) FROM (SELECT ");
-       }
-       if (0 <= temp_len) len+= temp_len;
+       if (0 <= temp_len)
+               len += temp_len;
+
        temp_len = SAFE_SNPRINTF(&query, &query_size, len, projection);
-       if (0 <= temp_len) len+= temp_len;
+       if (0 <= temp_len)
+               len += temp_len;
+
        temp_len = SAFE_SNPRINTF(&query, &query_size, len, " FROM ");
-       if (0 <= temp_len) len+= temp_len;
+       if (0 <= temp_len)
+               len += temp_len;
 
        temp_len = SAFE_SNPRINTF(&query, &query_size, len, " (");
-       if (0 <= temp_len) len+= temp_len;
+       if (0 <= temp_len)
+               len += temp_len;
+
        temp_len = SAFE_SNPRINTF(&query, &query_size, len,  table);
-       if (0 <= temp_len) len+= temp_len;
+       if (0 <= temp_len)
+               len += temp_len;
 
        temp_len = SAFE_SNPRINTF(&query, &query_size, len, ") ");
-       if (0 <= temp_len) len+= temp_len;
+       if (0 <= temp_len)
+               len += temp_len;
 
        if (condition && *condition) {
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, " WHERE (");
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len)
+                       len += temp_len;
+
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, condition);
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len)
+                       len += temp_len;
+
                temp_len = SAFE_SNPRINTF(&query, &query_size, len, ") ");
-               if (0 <= temp_len) len+= temp_len;
+               if (0 <= temp_len)
+                       len += temp_len;
        }
 
        temp_len = SAFE_SNPRINTF(&query, &query_size, len, ") ");
-       if (0 <= temp_len) len+= temp_len;
+       if (0 <= temp_len) len += temp_len;
 
        if (bind_text) {
                cts_stmt stmt;
@@ -2726,17 +3104,22 @@ static int __ctsvc_db_get_count_with_query_exec(ctsvc_query_s *s_query, const ch
                int i;
                ret = ctsvc_query_prepare(query, &stmt);
                free(query);
-               RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+               RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
-               for (cursor=bind_text, i=1; cursor;cursor=cursor->next, i++)
+               for (cursor = bind_text, i = 1; cursor; cursor = cursor->next, i++)
                        ctsvc_stmt_bind_copy_text(stmt, i, cursor->data, strlen(cursor->data));
                ret = ctsvc_stmt_get_first_int_result(stmt, out_count);
-               RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_stmt_get_first_int_result() Fail(%d)", ret);
-       }
-       else {
+               if (CONTACTS_ERROR_NONE != ret) {
+                       ERR("ctsvc_stmt_get_first_int_result() Fail(%d)", ret);
+                       return ret;
+               }
+       } else {
                ret = ctsvc_query_get_first_int_result(query, out_count);
                free(query);
-               RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_get_first_int_result() Fail(%d)", ret);
+               if (CONTACTS_ERROR_NONE != ret) {
+                       ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
+                       return ret;
+               }
        }
        return ret;
 }
@@ -2751,26 +3134,31 @@ static int __ctsvc_db_get_count_with_query(contacts_query_h query, int *out_coun
        GSList *cursor;
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s *)query;
+       s_query = (ctsvc_query_s*)query;
 
        if (s_query->filter) {
-               ret = __ctsvc_db_create_composite_condition(s_query->filter, &condition, &bind_text);
-               RETVM_IF (CONTACTS_ERROR_NONE != ret, ret, "__ctsvc_db_create_composite_condition Fail(%d)", ret);
+               ret = __db_create_composite_condition(s_query->filter, &condition, &bind_text);
+               RETVM_IF(CONTACTS_ERROR_NONE != ret, ret,
+                               "__db_create_composite_condition() Fail(%d)", ret);
        }
 
-       ret = __ctsvc_db_create_projection(s_query->view_uri, s_query->properties, s_query->property_count,
-                                                               s_query->projection, s_query->projection_count, &projection);
+       ret = __db_create_projection(s_query->view_uri, s_query->properties,
+                       s_query->property_count,
+                       s_query->projection,
+                       s_query->projection_count,
+                       &projection);
        if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("__ctsvc_db_create_projection Fail(%d)", ret);
-               for (cursor=bind_text;cursor;cursor=cursor->next)
+               ERR("__db_create_projection() Fail(%d)", ret);
+               for (cursor = bind_text; cursor; cursor = cursor->next)
                        free(cursor->data);
                g_slist_free(bind_text);
                free(condition);
                return ret;
        }
 
-       ret = __ctsvc_db_get_count_with_query_exec(s_query, projection, condition, bind_text, out_count);
-       for (cursor=bind_text;cursor;cursor=cursor->next)
+       ret = __db_get_count_with_query_exec(s_query, projection, condition, bind_text,
+                       out_count);
+       for (cursor = bind_text; cursor; cursor = cursor->next)
                free(cursor->data);
        g_slist_free(bind_text);
 
@@ -2781,19 +3169,19 @@ static int __ctsvc_db_get_count_with_query(contacts_query_h query, int *out_coun
 }
 
 int ctsvc_db_get_records_with_query(contacts_query_h query, int offset, int limit,
-       contacts_list_h* out_list)
+               contacts_list_h *out_list)
 {
        int ret = CONTACTS_ERROR_NONE;
-       ctsvc_db_plugin_info_s* plugin_info = NULL;
-       ctsvc_query_s *s_query;
+       ctsvc_query_s *s_query = (ctsvc_query_s*)query;
+       ctsvc_db_plugin_info_s *plugin_info = NULL;
 
        RETV_IF(NULL == out_list, CONTACTS_ERROR_INVALID_PARAMETER);
        *out_list = NULL;
 
        RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
-       s_query = (ctsvc_query_s*)query;
 
-       if ((plugin_info = ctsvc_db_get_plugin_info(ctsvc_view_get_record_type(s_query->view_uri)))) {
+       plugin_info = ctsvc_db_get_plugin_info(ctsvc_view_get_record_type(s_query->view_uri));
+       if (plugin_info) {
                if (plugin_info->get_records_with_query) {
                        ret = plugin_info->get_records_with_query(query, offset, limit, out_list);
                        return ret;
@@ -2803,8 +3191,8 @@ int ctsvc_db_get_records_with_query(contacts_query_h query, int offset, int limi
        return __ctsvc_db_get_records_with_query_exec(s_query, offset, limit, out_list);
 }
 
-static int __ctsvc_db_get_contact_changes(const charview_uri, int addressbook_id,
-               int version, contacts_list_h* out_list, int* out_current_version)
+static int __ctsvc_db_get_contact_changes(const char *view_uri, int addressbook_id,
+               int version, contacts_list_h *out_list, int *out_current_version)
 {
        int ret;
        char query[CTS_SQL_MAX_LEN] = {0};
@@ -2813,43 +3201,42 @@ static int __ctsvc_db_get_contact_changes(const char* view_uri, int addressbook_
 
        if (0 <= addressbook_id) {
                snprintf(query, sizeof(query),
-                       "SELECT %d, contact_id, changed_ver, created_ver, addressbook_id, image_changed_ver "
-                                       "FROM "CTS_TABLE_CONTACTS" "
-                                       "WHERE changed_ver > %d AND addressbook_id = %d AND deleted = 0 "
-                       "UNION "
-                       "SELECT %d, contact_id, deleted_ver, -1, addressbook_id, 0 "
-                                       "FROM "CTS_TABLE_DELETEDS" "
-                                       "WHERE deleted_ver > %d AND created_ver <= %d AND addressbook_id = %d "
-                       "UNION "
-                       "SELECT %d, contact_id, changed_ver, -1, addressbook_id, 0 "
-                                       "FROM "CTS_TABLE_CONTACTS" "
-                                       "WHERE changed_ver > %d AND created_ver <= %d AND addressbook_id = %d AND deleted = 1 "
-                                               "AND addressbook_id = (SELECT addressbook_id FROM "CTS_TABLE_ADDRESSBOOKS" WHERE addressbook_id = %d)",
-                       CONTACTS_CHANGE_UPDATED, version, addressbook_id,
-                       CONTACTS_CHANGE_DELETED, version, version, addressbook_id,
-                       CONTACTS_CHANGE_DELETED, version, version, addressbook_id, addressbook_id);
-       }
-       else {
+                               "SELECT %d, contact_id, changed_ver, created_ver, addressbook_id, image_changed_ver "
+                               "FROM "CTS_TABLE_CONTACTS" "
+                               "WHERE changed_ver > %d AND addressbook_id = %d AND deleted = 0 "
+                               "UNION "
+                               "SELECT %d, contact_id, deleted_ver, -1, addressbook_id, 0 "
+                               "FROM "CTS_TABLE_DELETEDS" "
+                               "WHERE deleted_ver > %d AND created_ver <= %d AND addressbook_id = %d "
+                               "UNION "
+                               "SELECT %d, contact_id, changed_ver, -1, addressbook_id, 0 "
+                               "FROM "CTS_TABLE_CONTACTS" "
+                               "WHERE changed_ver > %d AND created_ver <= %d AND addressbook_id = %d AND deleted = 1 "
+                               "AND addressbook_id = (SELECT addressbook_id FROM "CTS_TABLE_ADDRESSBOOKS" WHERE addressbook_id = %d)",
+                               CONTACTS_CHANGE_UPDATED, version, addressbook_id,
+                               CONTACTS_CHANGE_DELETED, version, version, addressbook_id,
+                               CONTACTS_CHANGE_DELETED, version, version, addressbook_id, addressbook_id);
+       } else {
                snprintf(query, sizeof(query),
-                       "SELECT %d, contact_id, changed_ver, created_ver, addressbook_id, image_changed_ver "
-                                       "FROM "CTS_TABLE_CONTACTS" "
-                                       "WHERE changed_ver > %d AND deleted = 0 "
-                       "UNION "
-                       "SELECT %d, contact_id, deleted_ver, -1, addressbook_id, 0 "
-                                       "FROM "CTS_TABLE_DELETEDS" "
-                                       "WHERE deleted_ver > %d AND created_ver <= %d "
-                       "UNION "
-                       "SELECT %d, contact_id, changed_ver, -1, "CTS_TABLE_CONTACTS".addressbook_id, 0 "
-                                       "FROM "CTS_TABLE_CONTACTS",  "CTS_TABLE_ADDRESSBOOKS" "
-                                       "WHERE changed_ver > %d AND created_ver <= %d AND deleted = 1 "
-                                               "AND "CTS_TABLE_CONTACTS".addressbook_id = "CTS_TABLE_ADDRESSBOOKS".addressbook_id",
-                       CONTACTS_CHANGE_UPDATED, version,
-                       CONTACTS_CHANGE_DELETED, version, version,
-                       CONTACTS_CHANGE_DELETED, version,version);
+                               "SELECT %d, contact_id, changed_ver, created_ver, addressbook_id, image_changed_ver "
+                               "FROM "CTS_TABLE_CONTACTS" "
+                               "WHERE changed_ver > %d AND deleted = 0 "
+                               "UNION "
+                               "SELECT %d, contact_id, deleted_ver, -1, addressbook_id, 0 "
+                               "FROM "CTS_TABLE_DELETEDS" "
+                               "WHERE deleted_ver > %d AND created_ver <= %d "
+                               "UNION "
+                               "SELECT %d, contact_id, changed_ver, -1, "CTS_TABLE_CONTACTS".addressbook_id, 0 "
+                               "FROM "CTS_TABLE_CONTACTS",  "CTS_TABLE_ADDRESSBOOKS" "
+                               "WHERE changed_ver > %d AND created_ver <= %d AND deleted = 1 "
+                               "AND "CTS_TABLE_CONTACTS".addressbook_id = "CTS_TABLE_ADDRESSBOOKS".addressbook_id",
+                               CONTACTS_CHANGE_UPDATED, version,
+                               CONTACTS_CHANGE_DELETED, version, version,
+                               CONTACTS_CHANGE_DELETED, version, version);
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
@@ -2857,20 +3244,22 @@ static int __ctsvc_db_get_contact_changes(const char* view_uri, int addressbook_
                ctsvc_updated_info_s *update_info;
 
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
                }
 
                ret = contacts_record_create(_contacts_contact_updated_info._uri, &record);
-               update_info = (ctsvc_updated_info_s *)record;
+               update_info = (ctsvc_updated_info_s*)record;
                update_info->changed_type = ctsvc_stmt_get_int(stmt, 0);
                update_info->id = ctsvc_stmt_get_int(stmt, 1);
                update_info->changed_ver = ctsvc_stmt_get_int(stmt, 2);
 
-               if (ctsvc_stmt_get_int(stmt, 3) == update_info->changed_ver || version < ctsvc_stmt_get_int(stmt, 3))
+               if (ctsvc_stmt_get_int(stmt, 3) == update_info->changed_ver
+                               || version < ctsvc_stmt_get_int(stmt, 3)) {
                        update_info->changed_type = CONTACTS_CHANGE_INSERTED;
+               }
 
                update_info->addressbook_id = ctsvc_stmt_get_int(stmt, 4);
 
@@ -2884,14 +3273,17 @@ static int __ctsvc_db_get_contact_changes(const char* view_uri, int addressbook_
 
        snprintf(query, sizeof(query), "SELECT ver FROM "CTS_TABLE_VERSION);
        ret = ctsvc_query_get_first_int_result(query, out_current_version);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_get_first_int_result() Fail(%d)", ret);
+       if (CONTACTS_ERROR_NONE != ret) {
+               ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
+               return ret;
+       }
        *out_list = list;
 
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_get_group_changes(const charview_uri, int addressbook_id,
-               int version, contacts_list_h* out_list, int* out_current_version)
+static int __ctsvc_db_get_group_changes(const char *view_uri, int addressbook_id,
+               int version, contacts_list_h *out_list, int *out_current_version)
 {
        int ret;
        char query[CTS_SQL_MAX_LEN] = {0};
@@ -2900,27 +3292,26 @@ static int __ctsvc_db_get_group_changes(const char* view_uri, int addressbook_id
 
        if (0 <= addressbook_id) {
                snprintf(query, sizeof(query),
-                       "SELECT %d, group_id, changed_ver, created_ver, addressbook_id FROM %s "
-                       "WHERE changed_ver > %d AND addressbook_id = %d "
-                       "UNION "
-                       "SELECT %d, group_id, deleted_ver, -1, addressbook_id FROM %s "
-                       "WHERE deleted_ver > %d AND created_ver <= %d AND addressbook_id = %d",
-                       CONTACTS_CHANGE_UPDATED, CTS_TABLE_GROUPS, version, addressbook_id,
-                       CONTACTS_CHANGE_DELETED, CTS_TABLE_GROUP_DELETEDS, version, version, addressbook_id);
-       }
-       else {
+                               "SELECT %d, group_id, changed_ver, created_ver, addressbook_id FROM %s "
+                               "WHERE changed_ver > %d AND addressbook_id = %d "
+                               "UNION "
+                               "SELECT %d, group_id, deleted_ver, -1, addressbook_id FROM %s "
+                               "WHERE deleted_ver > %d AND created_ver <= %d AND addressbook_id = %d",
+                               CONTACTS_CHANGE_UPDATED, CTS_TABLE_GROUPS, version, addressbook_id,
+                               CONTACTS_CHANGE_DELETED, CTS_TABLE_GROUP_DELETEDS, version, version, addressbook_id);
+       } else {
                snprintf(query, sizeof(query),
-                       "SELECT %d, group_id, changed_ver, created_ver, addressbook_id FROM %s "
-                       "WHERE changed_ver > %d "
-                       "UNION "
-                       "SELECT %d, group_id, deleted_ver, -1, addressbook_id FROM %s "
-                       "WHERE deleted_ver > %d AND created_ver <= %d",
-                       CONTACTS_CHANGE_UPDATED, CTS_TABLE_GROUPS, version,
-                       CONTACTS_CHANGE_DELETED, CTS_TABLE_GROUP_DELETEDS, version, version);
+                               "SELECT %d, group_id, changed_ver, created_ver, addressbook_id FROM %s "
+                               "WHERE changed_ver > %d "
+                               "UNION "
+                               "SELECT %d, group_id, deleted_ver, -1, addressbook_id FROM %s "
+                               "WHERE deleted_ver > %d AND created_ver <= %d",
+                               CONTACTS_CHANGE_UPDATED, CTS_TABLE_GROUPS, version,
+                               CONTACTS_CHANGE_DELETED, CTS_TABLE_GROUP_DELETEDS, version, version);
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
@@ -2928,20 +3319,22 @@ static int __ctsvc_db_get_group_changes(const char* view_uri, int addressbook_id
                ctsvc_updated_info_s *update_info;
 
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
                }
 
                ret = contacts_record_create(_contacts_group_updated_info._uri, &record);
-               update_info = (ctsvc_updated_info_s *)record;
+               update_info = (ctsvc_updated_info_s*)record;
                update_info->changed_type = ctsvc_stmt_get_int(stmt, 0);
                update_info->id = ctsvc_stmt_get_int(stmt, 1);
                update_info->changed_ver = ctsvc_stmt_get_int(stmt, 2);
 
-               if (ctsvc_stmt_get_int(stmt, 3) == update_info->changed_ver || version < ctsvc_stmt_get_int(stmt, 3))
+               if (ctsvc_stmt_get_int(stmt, 3) == update_info->changed_ver
+                               || version < ctsvc_stmt_get_int(stmt, 3)) {
                        update_info->changed_type = CONTACTS_CHANGE_INSERTED;
+               }
 
                update_info->addressbook_id = ctsvc_stmt_get_int(stmt, 4);
 
@@ -2952,14 +3345,20 @@ static int __ctsvc_db_get_group_changes(const char* view_uri, int addressbook_id
 
        snprintf(query, sizeof(query), "SELECT ver FROM "CTS_TABLE_VERSION);
        ret = ctsvc_query_get_first_int_result(query, out_current_version);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_get_first_int_result() Fail(%d)", ret);
+       if (CONTACTS_ERROR_NONE != ret) {
+               ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
+               return ret;
+       }
        *out_list = list;
 
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_get_group_relations_changes(const char* view_uri, int addressbook_id,
-               int version, contacts_list_h* out_list, int* out_current_version)
+static int __ctsvc_db_get_group_relations_changes(const char *view_uri,
+               int addressbook_id,
+               int version,
+               contacts_list_h *out_list,
+               int *out_current_version)
 {
        int len;
        int ret;
@@ -2970,38 +3369,43 @@ static int __ctsvc_db_get_group_relations_changes(const char* view_uri, int addr
 
        len = snprintf(temp_query, sizeof(temp_query),
                        "SELECT %d, group_id, contact_id, addressbook_id, ver "
-                               "FROM "CTS_TABLE_GROUP_RELATIONS", "CTS_TABLE_GROUPS" USING (group_id) "
-                               "WHERE ver > %d AND deleted = 0 "
+                       "FROM "CTS_TABLE_GROUP_RELATIONS", "CTS_TABLE_GROUPS" USING (group_id) "
+                       "WHERE ver > %d AND deleted = 0 "
                        "UNION SELECT %d, group_id, contact_id, addressbook_id, ver "
-                               "FROM "CTS_TABLE_GROUP_RELATIONS", "CTS_TABLE_GROUPS" USING (group_id) "
-                               "WHERE ver > %d AND deleted = 1 ",
-                               CONTACTS_CHANGE_INSERTED, version,
-                               CONTACTS_CHANGE_DELETED, version);
+                       "FROM "CTS_TABLE_GROUP_RELATIONS", "CTS_TABLE_GROUPS" USING (group_id) "
+                       "WHERE ver > %d AND deleted = 1 ",
+                       CONTACTS_CHANGE_INSERTED, version,
+                       CONTACTS_CHANGE_DELETED, version);
 
        if (0 <= addressbook_id) {
                len += snprintf(query, sizeof(query),
-                                       "SELECT * FROM (%s) WHERE addressbook_id = %d ", temp_query, addressbook_id);
+                               "SELECT * FROM (%s) WHERE addressbook_id = %d ", temp_query, addressbook_id);
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
                }
 
                ret = contacts_record_create(view_uri, &record);
-               ctsvc_record_set_int(record, _contacts_grouprel_updated_info.type, ctsvc_stmt_get_int(stmt, 0));
-               ctsvc_record_set_int(record, _contacts_grouprel_updated_info.group_id, ctsvc_stmt_get_int(stmt, 1));
-               ctsvc_record_set_int(record, _contacts_grouprel_updated_info.contact_id, ctsvc_stmt_get_int(stmt, 2));
-               ctsvc_record_set_int(record, _contacts_grouprel_updated_info.address_book_id, ctsvc_stmt_get_int(stmt, 3));
-               ctsvc_record_set_int(record, _contacts_grouprel_updated_info.version, ctsvc_stmt_get_int(stmt, 4));
+               ctsvc_record_set_int(record, _contacts_grouprel_updated_info.type,
+                               ctsvc_stmt_get_int(stmt, 0));
+               ctsvc_record_set_int(record, _contacts_grouprel_updated_info.group_id,
+                               ctsvc_stmt_get_int(stmt, 1));
+               ctsvc_record_set_int(record, _contacts_grouprel_updated_info.contact_id,
+                               ctsvc_stmt_get_int(stmt, 2));
+               ctsvc_record_set_int(record, _contacts_grouprel_updated_info.address_book_id,
+                               ctsvc_stmt_get_int(stmt, 3));
+               ctsvc_record_set_int(record, _contacts_grouprel_updated_info.version,
+                               ctsvc_stmt_get_int(stmt, 4));
 
                ctsvc_list_prepend(list, record);
        }
@@ -3010,14 +3414,18 @@ static int __ctsvc_db_get_group_relations_changes(const char* view_uri, int addr
 
        snprintf(query, sizeof(query), "SELECT ver FROM "CTS_TABLE_VERSION);
        ret = ctsvc_query_get_first_int_result(query, out_current_version);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_get_first_int_result() Fail(%d)", ret);
+       if (CONTACTS_ERROR_NONE != ret) {
+               ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
+               return ret;
+       }
+
        *out_list = list;
 
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_get_group_member_changes(const charview_uri, int addressbook_id,
-               int version, contacts_list_h* out_list, int* out_current_version)
+static int __ctsvc_db_get_group_member_changes(const char *view_uri, int addressbook_id,
+               int version, contacts_list_h *out_list, int *out_current_version)
 {
        int len;
        int ret;
@@ -3027,28 +3435,33 @@ static int __ctsvc_db_get_group_member_changes(const char* view_uri, int address
 
        len = snprintf(query, sizeof(query),
                        "SELECT group_id, member_changed_ver, addressbook_id "
-                               "FROM "CTS_TABLE_GROUPS" WHERE member_changed_ver > %d", version);
+                       "FROM "CTS_TABLE_GROUPS" WHERE member_changed_ver > %d", version);
 
-       if (0 <= addressbook_id)
-               len += snprintf(query+len, sizeof(query)-len, " AND addressbook_id = %d ", addressbook_id);
+       if (0 <= addressbook_id) {
+               len += snprintf(query+len, sizeof(query)-len, " AND addressbook_id = %d ",
+                               addressbook_id);
+       }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
                }
 
                ret = contacts_record_create(view_uri, &record);
-               ctsvc_record_set_int(record, _contacts_group_member_updated_info.group_id, ctsvc_stmt_get_int(stmt, 0));
-               ctsvc_record_set_int(record, _contacts_group_member_updated_info.version, ctsvc_stmt_get_int(stmt, 1));
-               ctsvc_record_set_int(record, _contacts_group_member_updated_info.address_book_id, ctsvc_stmt_get_int(stmt, 2));
+               ctsvc_record_set_int(record, _contacts_group_member_updated_info.group_id,
+                               ctsvc_stmt_get_int(stmt, 0));
+               ctsvc_record_set_int(record, _contacts_group_member_updated_info.version,
+                               ctsvc_stmt_get_int(stmt, 1));
+               ctsvc_record_set_int(record, _contacts_group_member_updated_info.address_book_id,
+                               ctsvc_stmt_get_int(stmt, 2));
 
                ctsvc_list_prepend(list, record);
        }
@@ -3057,14 +3470,18 @@ static int __ctsvc_db_get_group_member_changes(const char* view_uri, int address
 
        snprintf(query, sizeof(query), "SELECT ver FROM "CTS_TABLE_VERSION);
        ret = ctsvc_query_get_first_int_result(query, out_current_version);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_get_first_int_result() Fail(%d)", ret);
+       if (CONTACTS_ERROR_NONE != ret) {
+               ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
+               return ret;
+       }
+
        *out_list = list;
 
        return CONTACTS_ERROR_NONE;
 }
 
-static int __ctsvc_db_get_my_profile_changes(const charview_uri, int addressbook_id,
-               int version, contacts_list_h* out_list, int* out_current_version)
+static int __ctsvc_db_get_my_profile_changes(const char *view_uri, int addressbook_id,
+               int version, contacts_list_h *out_list, int *out_current_version)
 {
        int ret;
        char query[CTS_SQL_MAX_LEN] = {0};
@@ -3073,50 +3490,52 @@ static int __ctsvc_db_get_my_profile_changes(const char* view_uri, int addressbo
 
        if (0 <= addressbook_id) {
                snprintf(query, sizeof(query),
-                       "SELECT changed_ver, addressbook_id, %d FROM %s "
-                       "WHERE changed_ver > %d AND changed_ver == created_ver AND deleted = 0 AND addressbook_id = %d "
-                       "UNION "
-                       "SELECT changed_ver, addressbook_id, %d FROM %s "
-                       "WHERE changed_ver > %d AND changed_ver != created_ver AND deleted = 0 AND addressbook_id = %d "
-                       "UNION "
-                       "SELECT changed_ver, addressbook_id, %d FROM %s "
-                       "WHERE changed_ver > %d AND deleted = 1 AND addressbook_id = %d",
-                       CONTACTS_CHANGE_INSERTED, CTS_TABLE_MY_PROFILES, version, addressbook_id,
-                       CONTACTS_CHANGE_UPDATED, CTS_TABLE_MY_PROFILES, version, addressbook_id,
-                       CONTACTS_CHANGE_DELETED, CTS_TABLE_MY_PROFILES, version, addressbook_id);
-       }
-       else {
+                               "SELECT changed_ver, addressbook_id, %d FROM %s "
+                               "WHERE changed_ver > %d AND changed_ver == created_ver AND deleted = 0 AND addressbook_id = %d "
+                               "UNION "
+                               "SELECT changed_ver, addressbook_id, %d FROM %s "
+                               "WHERE changed_ver > %d AND changed_ver != created_ver AND deleted = 0 AND addressbook_id = %d "
+                               "UNION "
+                               "SELECT changed_ver, addressbook_id, %d FROM %s "
+                               "WHERE changed_ver > %d AND deleted = 1 AND addressbook_id = %d",
+                               CONTACTS_CHANGE_INSERTED, CTS_TABLE_MY_PROFILES, version, addressbook_id,
+                               CONTACTS_CHANGE_UPDATED, CTS_TABLE_MY_PROFILES, version, addressbook_id,
+                               CONTACTS_CHANGE_DELETED, CTS_TABLE_MY_PROFILES, version, addressbook_id);
+       } else {
                snprintf(query, sizeof(query),
-                       "SELECT changed_ver, addressbook_id, %d FROM %s "
-                       "WHERE changed_ver > %d AND changed_ver == created_ver AND deleted = 0 "
-                       "UNION "
-                       "SELECT changed_ver, addressbook_id, %d FROM %s "
-                       "WHERE changed_ver > %d AND changed_ver != created_ver AND deleted = 0 "
-                       "UNION "
-                       "SELECT changed_ver, addressbook_id, %d FROM %s "
-                       "WHERE changed_ver > %d AND deleted = 1",
-                       CONTACTS_CHANGE_INSERTED, CTS_TABLE_MY_PROFILES, version,
-                       CONTACTS_CHANGE_UPDATED, CTS_TABLE_MY_PROFILES, version,
-                       CONTACTS_CHANGE_DELETED, CTS_TABLE_MY_PROFILES, version);
+                               "SELECT changed_ver, addressbook_id, %d FROM %s "
+                               "WHERE changed_ver > %d AND changed_ver == created_ver AND deleted = 0 "
+                               "UNION "
+                               "SELECT changed_ver, addressbook_id, %d FROM %s "
+                               "WHERE changed_ver > %d AND changed_ver != created_ver AND deleted = 0 "
+                               "UNION "
+                               "SELECT changed_ver, addressbook_id, %d FROM %s "
+                               "WHERE changed_ver > %d AND deleted = 1",
+                               CONTACTS_CHANGE_INSERTED, CTS_TABLE_MY_PROFILES, version,
+                               CONTACTS_CHANGE_UPDATED, CTS_TABLE_MY_PROFILES, version,
+                               CONTACTS_CHANGE_DELETED, CTS_TABLE_MY_PROFILES, version);
        }
 
        ret = ctsvc_query_prepare(query, &stmt);
-       RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret);
+       RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret);
 
        contacts_list_create(&list);
        while ((ret = ctsvc_stmt_step(stmt))) {
                contacts_record_h record;
                if (1 != ret) {
-                       CTS_ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret);
+                       ERR("ctsvc_stmt_step() Fail(%d)", ret);
                        ctsvc_stmt_finalize(stmt);
                        contacts_list_destroy(list, true);
                        return ret;
                }
 
                ret = contacts_record_create(view_uri, &record);
-               ctsvc_record_set_int(record, _contacts_my_profile_updated_info.version, ctsvc_stmt_get_int(stmt, 0));
-               ctsvc_record_set_int(record, _contacts_my_profile_updated_info.address_book_id, ctsvc_stmt_get_int(stmt, 1));
-               ctsvc_record_set_int(record, _contacts_my_profile_updated_info.last_changed_type, ctsvc_stmt_get_int(stmt, 2));
+               ctsvc_record_set_int(record, _contacts_my_profile_updated_info.version,
+                               ctsvc_stmt_get_int(stmt, 0));
+               ctsvc_record_set_int(record, _contacts_my_profile_updated_info.address_book_id,
+                               ctsvc_stmt_get_int(stmt, 1));
+               ctsvc_record_set_int(record, _contacts_my_profile_updated_info.last_changed_type,
+                               ctsvc_stmt_get_int(stmt, 2));
                ctsvc_list_prepend(list, record);
        }
        ctsvc_stmt_finalize(stmt);
@@ -3124,14 +3543,18 @@ static int __ctsvc_db_get_my_profile_changes(const char* view_uri, int addressbo
 
        snprintf(query, sizeof(query), "SELECT ver FROM "CTS_TABLE_VERSION);
        ret = ctsvc_query_get_first_int_result(query, out_current_version);
-       RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "DB error : ctsvc_query_get_first_int_result() Fail(%d)", ret);
+       if (CONTACTS_ERROR_NONE != ret) {
+               ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
+               return ret;
+       }
+
        *out_list = list;
 
        return CONTACTS_ERROR_NONE;
 }
 
-int ctsvc_db_get_changes_by_version(const charview_uri, int addressbook_id,
-               int version, contacts_list_h* out_list, int* out_current_version)
+int ctsvc_db_get_changes_by_version(const char *view_uri, int addressbook_id,
+               int version, contacts_list_h *out_list, int *out_current_version)
 {
        int ret;
        RETV_IF(version < 0, CONTACTS_ERROR_INVALID_PARAMETER);
@@ -3142,78 +3565,77 @@ int ctsvc_db_get_changes_by_version(const char* view_uri, int addressbook_id,
 
        if (STRING_EQUAL == strcmp(view_uri, _contacts_contact_updated_info._uri)) {
                ret = __ctsvc_db_get_contact_changes(view_uri, addressbook_id,
-                                       version, out_list, out_current_version);
+                               version, out_list, out_current_version);
                return ret;
-       }
-       else if (STRING_EQUAL == strcmp(view_uri, _contacts_group_updated_info._uri)) {
+       } else if (STRING_EQUAL == strcmp(view_uri, _contacts_group_updated_info._uri)) {
                ret = __ctsvc_db_get_group_changes(view_uri, addressbook_id,
-                                       version, out_list, out_current_version);
+                               version, out_list, out_current_version);
                return ret;
-       }
-       else if (STRING_EQUAL == strcmp(view_uri, _contacts_group_member_updated_info._uri)) {
+       } else if (STRING_EQUAL == strcmp(view_uri, _contacts_group_member_updated_info._uri)) {
                ret = __ctsvc_db_get_group_member_changes(view_uri, addressbook_id,
-                                       version, out_list, out_current_version);
+                               version, out_list, out_current_version);
                return ret;
-       }
-       else if (STRING_EQUAL == strcmp(view_uri, _contacts_grouprel_updated_info._uri)) {
+       } else if (STRING_EQUAL == strcmp(view_uri, _contacts_grouprel_updated_info._uri)) {
                ret = __ctsvc_db_get_group_relations_changes(view_uri, addressbook_id,
-                                       version, out_list, out_current_version);
+                               version, out_list, out_current_version);
                return ret;
-       }
-       else if (STRING_EQUAL == strcmp(view_uri, _contacts_my_profile_updated_info._uri)) {
+       } else if (STRING_EQUAL == strcmp(view_uri, _contacts_my_profile_updated_info._uri)) {
                ret = __ctsvc_db_get_my_profile_changes(view_uri, addressbook_id,
-                                       version, out_list, out_current_version);
+                               version, out_list, out_current_version);
                return ret;
        }
 
-       CTS_ERR("Invalid parameter : this API does not support uri(%s)", view_uri);
+       ERR("this API does not support uri(%s)", view_uri);
        return CONTACTS_ERROR_INVALID_PARAMETER;
 }
 
-int ctsvc_db_get_current_version(intout_current_version)
+int ctsvc_db_get_current_version(int *out_current_version)
 {
-       RETVM_IF(NULL == out_current_version, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter");
+       RETV_IF(NULL == out_current_version, CONTACTS_ERROR_INVALID_PARAMETER);
+
        return ctsvc_get_current_version(out_current_version);
 }
 
-int ctsvc_db_search_records(const charview_uri, const char *keyword,
-               int offset, int limit, contacts_list_hout_list)
+int ctsvc_db_search_records(const char *view_uri, const char *keyword,
+               int offset, int limit, contacts_list_h *out_list)
 {
        RETV_IF(NULL == out_list, CONTACTS_ERROR_INVALID_PARAMETER);
        *out_list = NULL;
-       RETVM_IF(NULL == view_uri, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter");
+       RETV_IF(NULL == view_uri, CONTACTS_ERROR_INVALID_PARAMETER);
 
        return __ctsvc_db_search_records(view_uri, keyword, offset, limit, out_list);
 }
 
-int ctsvc_db_search_records_with_range(const charview_uri, const char *keyword,
-               int offset, int limit, int range, contacts_list_hout_list)
+int ctsvc_db_search_records_with_range(const char *view_uri, const char *keyword,
+               int offset, int limit, int range, contacts_list_h *out_list)
 {
        RETV_IF(NULL == out_list, CONTACTS_ERROR_INVALID_PARAMETER);
        *out_list = NULL;
-       RETVM_IF(range == 0, CONTACTS_ERROR_INVALID_PARAMETER, "range is 0");
-       RETVM_IF(NULL == view_uri, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter");
+       RETV_IF(range == 0, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == view_uri, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       return __ctsvc_db_search_records_with_range(view_uri, keyword, offset, limit, range, out_list);
+       return __ctsvc_db_search_records_with_range(view_uri, keyword, offset, limit, range,
+                       out_list);
 }
 
 int ctsvc_db_search_records_with_query(contacts_query_h query, const char *keyword,
-               int offset, int limit, contacts_list_hout_list)
+               int offset, int limit, contacts_list_h *out_list)
 {
        RETV_IF(NULL == out_list, CONTACTS_ERROR_INVALID_PARAMETER);
        *out_list = NULL;
-       RETVM_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter");
+       RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
+
        return __ctsvc_db_search_records_with_query(query, keyword, offset, limit, out_list);
 }
 
-int ctsvc_db_get_count(const charview_uri, int *out_count)
+int ctsvc_db_get_count(const char *view_uri, int *out_count)
 {
        int ret;
-       ctsvc_db_plugin_info_splugin_info = NULL;
+       ctsvc_db_plugin_info_s *plugin_info = NULL;
 
        RETV_IF(NULL == out_count, CONTACTS_ERROR_INVALID_PARAMETER);
        *out_count = 0;
-       RETVM_IF(NULL == view_uri, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter");
+       RETV_IF(NULL == view_uri, CONTACTS_ERROR_INVALID_PARAMETER);
 
        if ((plugin_info = ctsvc_db_get_plugin_info(ctsvc_view_get_record_type(view_uri)))) {
                if (plugin_info->get_count) {
@@ -3229,14 +3651,13 @@ int ctsvc_db_get_count_with_query(contacts_query_h query, int *out_count)
 {
        int ret = CONTACTS_ERROR_NONE;
        ctsvc_record_type_e type = CTSVC_RECORD_INVALID;
-       ctsvc_db_plugin_info_splugin_info = NULL;
-       ctsvc_query_s *s_query;
+       ctsvc_db_plugin_info_s *plugin_info = NULL;
+       ctsvc_query_s *s_query = (ctsvc_query_s*)query;
 
        RETV_IF(NULL == out_count, CONTACTS_ERROR_INVALID_PARAMETER);
        *out_count = 0;
+       RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
 
-       RETVM_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter");
-       s_query = (ctsvc_query_s*)query;
        type = ctsvc_view_get_record_type(s_query->view_uri);
        plugin_info = ctsvc_db_get_plugin_info(type);
 
@@ -3252,88 +3673,89 @@ int ctsvc_db_get_count_with_query(contacts_query_h query, int *out_count)
 
 int ctsvc_db_insert_record(contacts_record_h record, int *id)
 {
-       ctsvc_db_plugin_info_splugin_info = NULL;
+       ctsvc_db_plugin_info_s *plugin_info = NULL;
 
        if (id)
                *id = 0;
 
-       RETVM_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter");
+       RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
 
        plugin_info = ctsvc_db_get_plugin_info(((ctsvc_record_s*)record)->r_type);
-       RETVM_IF(NULL == plugin_info, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter");
-       RETVM_IF(NULL == plugin_info->insert_record, CONTACTS_ERROR_INVALID_PARAMETER, "Not permitted");
+       RETV_IF(NULL == plugin_info, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == plugin_info->insert_record, CONTACTS_ERROR_INVALID_PARAMETER);
 
        return plugin_info->insert_record(record, id);
 }
 
 int ctsvc_db_update_record(contacts_record_h record)
 {
-       ctsvc_db_plugin_info_splugin_info = NULL;
+       ctsvc_db_plugin_info_s *plugin_info = NULL;
 
-       RETVM_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter");
+       RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
 
        plugin_info = ctsvc_db_get_plugin_info(((ctsvc_record_s*)record)->r_type);
-       RETVM_IF(NULL == plugin_info, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter");
-       RETVM_IF(NULL == plugin_info->update_record, CONTACTS_ERROR_INVALID_PARAMETER, "Not permitted");
+       RETV_IF(NULL == plugin_info, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == plugin_info->update_record, CONTACTS_ERROR_INVALID_PARAMETER);
 
        return plugin_info->update_record(record);
 }
 
-int ctsvc_db_delete_record(const charview_uri, int id)
+int ctsvc_db_delete_record(const char *view_uri, int id)
 {
        ctsvc_record_type_e type = CTSVC_RECORD_INVALID;
-       ctsvc_db_plugin_info_splugin_info = NULL;
+       ctsvc_db_plugin_info_s *plugin_info = NULL;
 
-       RETVM_IF(NULL == view_uri, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter");
+       RETV_IF(NULL == view_uri, CONTACTS_ERROR_INVALID_PARAMETER);
 
        type = ctsvc_view_get_record_type(view_uri);
        plugin_info = ctsvc_db_get_plugin_info(type);
-       RETVM_IF(NULL == plugin_info, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter");
-       RETVM_IF(NULL == plugin_info->delete_record, CONTACTS_ERROR_INVALID_PARAMETER, "Not permitted");
+       RETV_IF(NULL == plugin_info, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == plugin_info->delete_record, CONTACTS_ERROR_INVALID_PARAMETER);
 
        return plugin_info->delete_record(id);
 }
 
-int ctsvc_db_get_record(const char* view_uri, int id, contacts_record_h* out_record)
+int ctsvc_db_get_record(const char *view_uri, int id, contacts_record_h *out_record)
 {
        ctsvc_record_type_e type = CTSVC_RECORD_INVALID;
-       ctsvc_db_plugin_info_splugin_info = NULL;
+       ctsvc_db_plugin_info_s *plugin_info = NULL;
 
        RETV_IF(NULL == out_record, CONTACTS_ERROR_INVALID_PARAMETER);
        *out_record = NULL;
-       RETVM_IF(NULL == view_uri, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter");
+       RETV_IF(NULL == view_uri, CONTACTS_ERROR_INVALID_PARAMETER);
 
        type = ctsvc_view_get_record_type(view_uri);
        plugin_info = ctsvc_db_get_plugin_info(type);
 
-       RETVM_IF(NULL == plugin_info, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter");
-       RETVM_IF(NULL == plugin_info->get_record, CONTACTS_ERROR_INVALID_PARAMETER, "Not permitted");
+       RETV_IF(NULL == plugin_info, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == plugin_info->get_record, CONTACTS_ERROR_INVALID_PARAMETER);
 
        return plugin_info->get_record(id, out_record);
 }
 
 int ctsvc_db_replace_record(contacts_record_h record, int id)
 {
-       ctsvc_db_plugin_info_splugin_info = NULL;
+       ctsvc_db_plugin_info_s *plugin_info = NULL;
 
-       RETVM_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : record is NULL");
+       RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER);
 
        plugin_info = ctsvc_db_get_plugin_info(((ctsvc_record_s*)record)->r_type);
-       RETVM_IF(NULL == plugin_info, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter");
-       RETVM_IF(NULL == plugin_info->replace_record, CONTACTS_ERROR_INVALID_PARAMETER, "Not permitted");
+       RETV_IF(NULL == plugin_info, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == plugin_info->replace_record, CONTACTS_ERROR_INVALID_PARAMETER);
 
        return plugin_info->replace_record(record, id);
 }
 
-int ctsvc_db_get_all_records(const char* view_uri, int offset, int limit, contacts_list_h* out_list)
+int ctsvc_db_get_all_records(const char *view_uri, int offset, int limit,
+               contacts_list_h *out_list)
 {
        int ret = CONTACTS_ERROR_NONE;
        ctsvc_record_type_e type = CTSVC_RECORD_INVALID;
-       ctsvc_db_plugin_info_splugin_info = NULL;
+       ctsvc_db_plugin_info_s *plugin_info = NULL;
 
        RETV_IF(NULL == out_list, CONTACTS_ERROR_INVALID_PARAMETER);
        *out_list = NULL;
-       RETVM_IF(NULL == view_uri, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter");
+       RETV_IF(NULL == view_uri, CONTACTS_ERROR_INVALID_PARAMETER);
 
        type = ctsvc_view_get_record_type(view_uri);
        plugin_info = ctsvc_db_get_plugin_info(type);
@@ -3351,9 +3773,9 @@ int ctsvc_db_get_all_records(const char* view_uri, int offset, int limit, contac
 int ctsvc_db_insert_records(contacts_list_h list, int **ids, int *count)
 {
        int ret = CONTACTS_ERROR_NONE;
-       ctsvc_db_plugin_info_splugin_info = NULL;
+       ctsvc_db_plugin_info_s *plugin_info = NULL;
 
-       RETVM_IF(NULL == list, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter");
+       RETV_IF(NULL == list, CONTACTS_ERROR_INVALID_PARAMETER);
 
        if (count)
                contacts_list_get_count(list, count);
@@ -3370,9 +3792,9 @@ int ctsvc_db_insert_records(contacts_list_h list, int **ids, int *count)
 int ctsvc_db_update_records(contacts_list_h list)
 {
        int ret = CONTACTS_ERROR_NONE;
-       ctsvc_db_plugin_info_splugin_info = NULL;
+       ctsvc_db_plugin_info_s *plugin_info = NULL;
 
-       RETVM_IF(NULL == list, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter");
+       RETV_IF(NULL == list, CONTACTS_ERROR_INVALID_PARAMETER);
 
        if ((plugin_info = ctsvc_db_get_plugin_info(((ctsvc_list_s*)list)->l_type))) {
                if (plugin_info->update_records) {
@@ -3384,10 +3806,10 @@ int ctsvc_db_update_records(contacts_list_h list)
        return __ctsvc_db_update_records(list);
 }
 
-int ctsvc_db_delete_records(const char* view_uri, int* ids, int count)
+int ctsvc_db_delete_records(const char *view_uri, int *ids, int count)
 {
        int ret = CONTACTS_ERROR_NONE;
-       ctsvc_db_plugin_info_splugin_info = NULL;
+       ctsvc_db_plugin_info_s *plugin_info = NULL;
 
        RETV_IF(NULL == ids, CONTACTS_ERROR_INVALID_PARAMETER);
 
@@ -3409,10 +3831,11 @@ static int __ctsvc_db_replace_records(contacts_list_h list, int ids[], int count
        int i;
 
        ret = contacts_list_get_count(list, &record_count);
-       RETVM_IF(ret != CONTACTS_ERROR_NONE, ret, "contacts_list_get_count is falied(%d)", ret);
-       RETVM_IF(record_count <= 0, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : count is 0");
+       RETVM_IF(ret != CONTACTS_ERROR_NONE, ret, "contacts_list_get_count() Fail(%d)", ret);
+       RETVM_IF(record_count <= 0, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid count(%d)",
+                       record_count);
        RETVM_IF(record_count != count, CONTACTS_ERROR_INVALID_PARAMETER,
-                       "Invalid parameter : list count and ids count are not matched");
+                       "record_count(%d) and count(%d) are not matched", record_count, count);
 
        ret = ctsvc_begin_trans();
        RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_begin_trans Fail(%d)", ret);
@@ -3422,14 +3845,14 @@ static int __ctsvc_db_replace_records(contacts_list_h list, int ids[], int count
        do {
                ret = contacts_list_get_current_record_p(list, &record);
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("contacts_list_get_current_record_p is faild(%d)", ret);
+                       ERR("contacts_list_get_current_record_p() Fail(%d)", ret);
                        ctsvc_end_trans(false);
                        return ret;
                }
 
                ret = ctsvc_db_replace_record(record, ids[i++]);
                if (ret != CONTACTS_ERROR_NONE) {
-                       CTS_ERR("contacts_db_replace_record is faild(%d)", ret);
+                       ERR("contacts_db_replace_record() Fail(%d)", ret);
                        ctsvc_end_trans(false);
                        return ret;
                }
@@ -3444,10 +3867,10 @@ static int __ctsvc_db_replace_records(contacts_list_h list, int ids[], int count
 int ctsvc_db_replace_records(contacts_list_h list, int ids[], int count)
 {
        int ret = CONTACTS_ERROR_NONE;
-       ctsvc_db_plugin_info_splugin_info = NULL;
+       ctsvc_db_plugin_info_s *plugin_info = NULL;
 
-       RETVM_IF(NULL == list, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter");
-       RETVM_IF(NULL == ids, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter");
+       RETV_IF(NULL == list, CONTACTS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == ids, CONTACTS_ERROR_INVALID_PARAMETER);
 
        if ((plugin_info = ctsvc_db_get_plugin_info(((ctsvc_list_s*)list)->l_type))) {
                if (plugin_info->replace_records) {
index d6ba18f..8d68e4c 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
@@ -20,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #ifndef __CTSVC_DB_QUERY_H__
 #define __CTSVC_DB_QUERY_H__
 
 #include "ctsvc_db_sqlite.h"
 
 int ctsvc_db_insert_record(contacts_record_h record, int *id);
-int ctsvc_db_get_record(const char* view_uri, int id, contacts_record_h* out_record);
+int ctsvc_db_get_record(const char *view_uri, int id, contacts_record_h *out_record);
 int ctsvc_db_update_record(contacts_record_h record);
-int ctsvc_db_delete_record(const charview_uri, int id);
+int ctsvc_db_delete_record(const char *view_uri, int id);
 int ctsvc_db_replace_record(contacts_record_h record, int id);
-int ctsvc_db_get_all_records(const char* view_uri, int offset, int limit, contacts_list_h* out_list );
-int ctsvc_db_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h* out_list );
-int ctsvc_db_get_count(const char* view_uri, int *out_count);
+int ctsvc_db_get_all_records(const char *view_uri, int offset, int limit,
+               contacts_list_h *out_list);
+int ctsvc_db_get_records_with_query(contacts_query_h query, int offset, int limit,
+               contacts_list_h *out_list);
+int ctsvc_db_get_count(const char *view_uri, int *out_count);
 int ctsvc_db_get_count_with_query(contacts_query_h query, int *out_count);
-int ctsvc_db_get_changes_by_version(const char* view_uri, int addressbook_id, int version, contacts_list_h* out_list, int* out_current_version );
-int ctsvc_db_get_current_version(int* out_current_version);
-int ctsvc_db_search_records(const char* view_uri, const char *keyword, int offset, int limit, contacts_list_h* out_list);
-int ctsvc_db_search_records_with_range(const char* view_uri, const char *keyword, int offset, int limit, int range, contacts_list_h* out_list);
-int ctsvc_db_search_records_with_query(contacts_query_h query, const char *keyword, int offset, int limit, contacts_list_h* out_list);
+int ctsvc_db_get_changes_by_version(const char *view_uri, int addressbook_id,
+               int version, contacts_list_h *out_list, int *out_current_version);
+int ctsvc_db_get_current_version(int *out_current_version);
+int ctsvc_db_search_records(const char *view_uri, const char *keyword, int offset,
+               int limit, contacts_list_h *out_list);
+int ctsvc_db_search_records_with_range(const char *view_uri, const char *keyword,
+               int offset, int limit, int range, contacts_list_h *out_list);
+int ctsvc_db_search_records_with_query(contacts_query_h query, const char *keyword,
+               int offset, int limit, contacts_list_h *out_list);
 int ctsvc_db_get_status(contacts_db_status_e *status);
-int ctsvc_db_insert_records_with_vcard(const char* vcard_stream, int **record_id_array, int *count);
-int ctsvc_db_replace_records_with_vcard(const char* vcard_stream, int *record_id_array, int count);
+int ctsvc_db_insert_records_with_vcard(const char *vcard_stream, int **record_id_array,
+               int *count);
+int ctsvc_db_replace_records_with_vcard(const char *vcard_stream, int *record_id_array,
+               int count);
 
 
 int ctsvc_db_insert_records(contacts_list_h list, int **ids, int *count);
 int ctsvc_db_update_records(contacts_list_h list);
-int ctsvc_db_delete_records(const charview_uri, int *ids, int count);
+int ctsvc_db_delete_records(const char *view_uri, int *ids, int count);
 int ctsvc_db_replace_records(contacts_list_h list, int ids[], int count);
 
-int ctsvc_db_make_get_records_query_stmt(ctsvc_query_s *s_query, int offset, int limit, cts_stmt *stmt);
+int ctsvc_db_make_get_records_query_stmt(ctsvc_query_s *s_query, int offset, int limit,
+               cts_stmt *stmt);
 int ctsvc_db_create_set_query(contacts_record_h record, char **set, GSList **bind_text);
-int ctsvc_db_update_record_with_set_query(const char *set, GSList *bind_text, const char *table, int id);
+int ctsvc_db_update_record_with_set_query(const char *set, GSList *bind_text,
+               const char *table, int id);
 
 void ctsvc_db_set_status(contacts_db_status_e status);
 
index 931ba5d..d2dda18 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
  * limitations under the License.
  *
  */
-
 #ifndef __CTSVC_DB_SCHEMA_H__
 #define __CTSVC_DB_SCHEMA_H__
 
 #include <tzplatform_config.h>
 
-#define CTSVC_DB_PATH tzplatform_mkpath(TZ_USER_DB,"/.contacts-svc.db")
-#define CTSVC_DB_JOURNAL_PATH tzplatform_mkpath(TZ_USER_DB,"/.contacts-svc.db-journal")
+#define CTSVC_DB_PATH tzplatform_mkpath(TZ_USER_DB, "/.contacts-svc.db")
+#define CTSVC_DB_JOURNAL_PATH tzplatform_mkpath(TZ_USER_DB, "/.contacts-svc.db-journal")
 
 /* For Security */
 #define CTS_SECURITY_FILE_GROUP 5000
index b559d7c..c2bb549 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/time.h>
@@ -53,46 +52,74 @@ int ctsvc_db_open(void)
 
        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);
-               ret = sqlite3_create_function(ctsvc_db, "_DATA_DELETE_", 2, SQLITE_UTF8, NULL,
-                               ctsvc_db_data_delete_callback, NULL, NULL);
-               RETVM_IF(SQLITE_OK != ret, CONTACTS_ERROR_DB,
-                               "sqlite3_create_function() Fail(%d)", ret);
-               ret = sqlite3_create_function(ctsvc_db, "_DATA_IMAGE_DELETE_", 1, SQLITE_UTF8, NULL,
-                               ctsvc_db_image_delete_callback, NULL, NULL);
-               RETVM_IF(SQLITE_OK != ret, CONTACTS_ERROR_DB,
-                               "sqlite3_create_function() Fail(%d)", ret);
-               ret = sqlite3_create_function(ctsvc_db, "_DATA_COMPANY_DELETE_", 1, SQLITE_UTF8, NULL,
-                               ctsvc_db_company_delete_callback, NULL, NULL);
-               RETVM_IF(SQLITE_OK != ret, CONTACTS_ERROR_DB,
-                               "sqlite3_create_function() Fail(%d)", ret);
-               ret = sqlite3_create_function(ctsvc_db, "_NORMALIZE_INDEX_", 2, SQLITE_UTF8, NULL,
-                               ctsvc_db_normalize_str_callback, NULL, NULL);
-               RETVM_IF(SQLITE_OK != ret, CONTACTS_ERROR_DB,
-                               "sqlite3_create_function() Fail(%d)", ret);
+               if (SQLITE_OK != ret) {
+                       ERR("db_util_open() Fail(%d)", ret);
+                       return CONTACTS_ERROR_DB; /*CTS_ERR_DB_NOT_OPENED*/
+               }
+
+               ret = sqlite3_create_function(ctsvc_db, "_DATA_DELETE_", 2, SQLITE_UTF8,
+                               NULL, ctsvc_db_data_delete_callback, NULL, NULL);
+               if (SQLITE_OK != ret) {
+                       ERR("sqlite3_create_function() Fail(%d)", ret);
+                       return CONTACTS_ERROR_DB;
+               }
+
+               ret = sqlite3_create_function(ctsvc_db, "_DATA_IMAGE_DELETE_", 1, SQLITE_UTF8,
+                               NULL, ctsvc_db_image_delete_callback, NULL, NULL);
+               if (SQLITE_OK != ret) {
+                       ERR("sqlite3_create_function() Fail(%d)", ret);
+                       return CONTACTS_ERROR_DB;
+               }
+
+               ret = sqlite3_create_function(ctsvc_db, "_DATA_COMPANY_DELETE_", 1, SQLITE_UTF8,
+                               NULL, ctsvc_db_company_delete_callback, NULL, NULL);
+               if (SQLITE_OK != ret) {
+                       ERR("sqlite3_create_function() Fail(%d)", ret);
+                       return CONTACTS_ERROR_DB;
+               }
+
+               ret = sqlite3_create_function(ctsvc_db, "_NORMALIZE_INDEX_", 2, SQLITE_UTF8,
+                               NULL, ctsvc_db_normalize_str_callback, NULL, NULL);
+               if (SQLITE_OK != ret) {
+                       ERR("sqlite3_create_function() Fail(%d)", ret);
+                       return CONTACTS_ERROR_DB;
+               }
 #ifdef ENABLE_LOG_FEATURE
-               ret = sqlite3_create_function(ctsvc_db, "_PHONE_LOG_DELETE_", 1, SQLITE_UTF8, NULL,
-                               ctsvc_db_phone_log_delete_callback, NULL, NULL);
-               RETVM_IF(SQLITE_OK != ret, CONTACTS_ERROR_DB,
-                               "sqlite3_create_function() Fail(%d)", ret);
+               ret = sqlite3_create_function(ctsvc_db, "_PHONE_LOG_DELETE_", 1, SQLITE_UTF8,
+                               NULL, ctsvc_db_phone_log_delete_callback, NULL, NULL);
+               if (SQLITE_OK != ret) {
+                       ERR("sqlite3_create_function() Fail(%d)", ret);
+                       return CONTACTS_ERROR_DB;
+               }
 #endif /* ENABLE_LOG_FEATURE */
-               ret = sqlite3_create_function(ctsvc_db, "_PERSON_DELETE_", 1, SQLITE_UTF8, NULL,
-                               ctsvc_db_person_delete_callback, NULL, NULL);
-               RETVM_IF(SQLITE_OK != ret, CONTACTS_ERROR_DB,
-                               "sqlite3_create_function() Fail(%d)", ret);
-               ret = sqlite3_create_function(ctsvc_db, "_GROUP_DELETE_", 1, SQLITE_UTF8, NULL,
-                               ctsvc_db_group_delete_callback, NULL, NULL);
-               RETVM_IF(SQLITE_OK != ret, CONTACTS_ERROR_DB,
-                               "sqlite3_create_function() Fail(%d)", ret);
-               ret = sqlite3_create_function(ctsvc_db, "_NUMBER_COMPARE_", 4, SQLITE_UTF8, NULL,
-                               ctsvc_db_phone_number_equal_callback, NULL, NULL);
-               RETVM_IF(SQLITE_OK != ret, CONTACTS_ERROR_DB,
-                               "sqlite3_create_function() Fail(%d)", ret);
-               ret = sqlite3_create_collation(ctsvc_db, "_NAME_SORT_", SQLITE_UTF8, (void *)SQLITE_UTF8,
-                               ctsvc_db_group_name_sort_callback);
-               RETVM_IF(SQLITE_OK != ret, CONTACTS_ERROR_DB,
-                               "sqlite3_create_collation() Fail(%d)", ret);
+
+               ret = sqlite3_create_function(ctsvc_db, "_PERSON_DELETE_", 1, SQLITE_UTF8,
+                               NULL, ctsvc_db_person_delete_callback, NULL, NULL);
+               if (SQLITE_OK != ret) {
+                       ERR("sqlite3_create_function() Fail(%d)", ret);
+                       return CONTACTS_ERROR_DB;
+               }
+
+               ret = sqlite3_create_function(ctsvc_db, "_GROUP_DELETE_", 1, SQLITE_UTF8,
+                               NULL, ctsvc_db_group_delete_callback, NULL, NULL);
+               if (SQLITE_OK != ret) {
+                       ERR("sqlite3_create_function() Fail(%d)", ret);
+                       return CONTACTS_ERROR_DB;
+               }
+
+               ret = sqlite3_create_function(ctsvc_db, "_NUMBER_COMPARE_", 4, SQLITE_UTF8,
+                               NULL, ctsvc_db_phone_number_equal_callback, NULL, NULL);
+               if (SQLITE_OK != ret) {
+                       ERR("sqlite3_create_function() Fail(%d)", ret);
+                       return CONTACTS_ERROR_DB;
+               }
+
+               ret = sqlite3_create_collation(ctsvc_db, "_NAME_SORT_", SQLITE_UTF8,
+                               (void *)SQLITE_UTF8, ctsvc_db_group_name_sort_callback);
+               if (SQLITE_OK != ret) {
+                       ERR("sqlite3_create_collation() Fail(%d)", ret);
+                       return CONTACTS_ERROR_DB;
+               }
        }
 
        return CONTACTS_ERROR_NONE /*CTS_SUCCESS*/;
@@ -106,7 +133,7 @@ int ctsvc_db_close(void)
                ret = db_util_close(ctsvc_db);
                WARN_IF(SQLITE_OK != ret, "db_util_close() Fail(%d)", ret);
                ctsvc_db = NULL;
-               CTS_DBG("The database disconnected really.");
+               DBG("The database disconnected really.");
        }
 
        return CONTACTS_ERROR_NONE /*CTS_SUCCESS*/;
@@ -132,8 +159,8 @@ int ctsvc_db_get_next_id(const char *table)
                        CTS_SCHEMA_SQLITE_SEQ, table);
 
        ret = ctsvc_query_get_first_int_result(query, &id);
-       if (ret != CONTACTS_ERROR_NONE /*CTS_SUCCESS*/) {
-               if (CONTACTS_ERROR_NO_DATA /*CONTACTS_ERR_DB_RECORD_NOT_FOUND*/ == ret)
+       if (ret != CONTACTS_ERROR_NONE) {
+               if (CONTACTS_ERROR_NO_DATA == ret)
                        return 1;
                else
                        return id;
@@ -148,26 +175,28 @@ int ctsvc_query_get_first_int_result(const char *query, int *result)
        struct timeval from, now, diff;
        bool retry = false;
        cts_stmt stmt = NULL;
-       RETVM_IF(NULL == ctsvc_db, CONTACTS_ERROR_DB /*CTS_ERR_DB_NOT_OPENED*/, "DB error : Database is not opended");
+
+       RETV_IF(NULL == ctsvc_db, CONTACTS_ERROR_DB);
 
        gettimeofday(&from, NULL);
        do {
                ret = sqlite3_prepare_v2(ctsvc_db, query, strlen(query), &stmt, NULL);
                if (ret != SQLITE_OK)
-                       CTS_ERR("DB error : sqlite3_prepare_v2() Fail(%d, %s)", ret, sqlite3_errmsg(ctsvc_db));
+                       ERR("sqlite3_prepare_v2() Fail(%d, %s)", ret, sqlite3_errmsg(ctsvc_db));
 
                if (ret == SQLITE_BUSY || ret == SQLITE_LOCKED) {
                        gettimeofday(&now, NULL);
                        timersub(&now, &from, &diff);
-                       retry = (diff.tv_sec < CTSVC_QUERY_RETRY_TIME)? true:false;
+                       retry = (diff.tv_sec < CTSVC_QUERY_RETRY_TIME) ? true : false;
                        if (retry)
                                usleep(CTSVC_QUERY_RETRY_INTERVAL);
-               } else
+               } else {
                        retry = false;
+               }
        } while (retry);
 
        if (SQLITE_OK != ret) {
-               CTS_ERR("DB error : sqlite3_prepare_v2() Fail(%s)", sqlite3_errmsg(ctsvc_db));
+               ERR("sqlite3_prepare_v2() Fail(%s)", sqlite3_errmsg(ctsvc_db));
                if (ret == SQLITE_BUSY || ret == SQLITE_LOCKED)
                        return CONTACTS_ERROR_DB_LOCKED;
                else
@@ -178,29 +207,30 @@ int ctsvc_query_get_first_int_result(const char *query, int *result)
        gettimeofday(&from, NULL);
        do {
                ret = sqlite3_step(stmt);
-               if (ret != SQLITE_ROW && SQLITE_DONE != ret)
-                       CTS_ERR("DB error : sqlite3_step() Fail(%d, %s, %d)", ret, sqlite3_errmsg(ctsvc_db),
+               if (ret != SQLITE_ROW && SQLITE_DONE != ret) {
+                       ERR("sqlite3_step() Fail(%d, %s, %d)", ret, sqlite3_errmsg(ctsvc_db),
                                        sqlite3_extended_errcode(ctsvc_db));
+               }
 
                if (ret == SQLITE_BUSY || ret == SQLITE_LOCKED) {
                        gettimeofday(&now, NULL);
                        timersub(&now, &from, &diff);
-                       retry = (diff.tv_sec < CTSVC_QUERY_RETRY_TIME)? true:false;
+                       retry = (diff.tv_sec < CTSVC_QUERY_RETRY_TIME) ? true : false;
                        if (retry)
                                usleep(CTSVC_QUERY_RETRY_INTERVAL);
-               }
-               else
+               } else {
                        retry = false;
+               }
        } while (retry);
 
        if (SQLITE_ROW != ret) {
                sqlite3_finalize(stmt);
                if (SQLITE_DONE == ret) {
-                       CTS_INFO("sqlite3_step() return with SQLITE_DONE (it means NO_DATA) (%d, %s)",
+                       INFO("sqlite3_step() return with SQLITE_DONE (it means NO_DATA) (%d, %s)",
                                        ret, sqlite3_errmsg(ctsvc_db));
                        return CONTACTS_ERROR_NO_DATA /*CONTACTS_ERR_DB_RECORD_NOT_FOUND*/;
                }
-               CTS_ERR("sqlite3_step() Fail(%d, %s, %d)", ret, sqlite3_errmsg(ctsvc_db),
+               ERR("sqlite3_step() Fail(%d, %s, %d)", ret, sqlite3_errmsg(ctsvc_db),
                                sqlite3_extended_errcode(ctsvc_db));
                if (ret == SQLITE_BUSY || ret == SQLITE_LOCKED)
                        return CONTACTS_ERROR_DB_LOCKED;
@@ -220,15 +250,15 @@ int ctsvc_query_exec(const char *query)
        cts_stmt stmt = NULL;
        char *err_msg = NULL;
 
-       RETVM_IF(NULL == ctsvc_db, CONTACTS_ERROR_DB, "DB error : Database is not opended");
+       RETV_IF(NULL == ctsvc_db, CONTACTS_ERROR_DB);
 
        ret = ctsvc_query_prepare((char*)query, &stmt);
        RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare fail(%d)", ret);
 
        ret = ctsvc_stmt_step(stmt);
-       if (CONTACTS_ERROR_NONE != ret) {
-               CTS_ERR("ctsvc_stmt_step() Fail(%d, %s)", ret, err_msg);
-       }
+       if (CONTACTS_ERROR_NONE != ret)
+               ERR("ctsvc_stmt_step() Fail(%d, %s)", ret, err_msg);
+
        ctsvc_stmt_finalize(stmt);
 
        return ret;
@@ -241,23 +271,23 @@ int ctsvc_query_prepare(char *query, cts_stmt *stmt)
        bool retry = false;
        *stmt = NULL;
 
-       RETVM_IF(NULL == ctsvc_db, CONTACTS_ERROR_DB, "DB error : Database is not opened");
+       RETV_IF(NULL == ctsvc_db, CONTACTS_ERROR_DB);
 
        gettimeofday(&from, NULL);
        do {
                ret = sqlite3_prepare_v2(ctsvc_db, query, strlen(query), stmt, NULL);
-
                if (ret != SQLITE_OK)
-                       CTS_ERR("DB error : sqlite3_prepare_v2() Fail(%d, %s)", ret, sqlite3_errmsg(ctsvc_db));
+                       ERR("sqlite3_prepare_v2() Fail(%d, %s)", ret, sqlite3_errmsg(ctsvc_db));
 
                if (ret == SQLITE_BUSY || ret == SQLITE_LOCKED) {
                        gettimeofday(&now, NULL);
                        timersub(&now, &from, &diff);
-                       retry = (diff.tv_sec < CTSVC_QUERY_RETRY_TIME)? true:false;
+                       retry = (diff.tv_sec < CTSVC_QUERY_RETRY_TIME) ? true : false;
                        if (retry)
                                usleep(CTSVC_QUERY_RETRY_INTERVAL);
-               } else
+               } else {
                        retry = false;
+               }
        } while (retry);
 
        if (ret == SQLITE_BUSY || ret == SQLITE_LOCKED)
@@ -273,32 +303,34 @@ int ctsvc_stmt_get_first_int_result(cts_stmt stmt, int *result)
        int ret;
        struct timeval from, now, diff;
        bool retry = false;
-       RETVM_IF(NULL == ctsvc_db, CONTACTS_ERROR_DB /*CTS_ERR_DB_NOT_OPENED*/, "DB error : Database is not opened");
+       RETV_IF(NULL == ctsvc_db, CONTACTS_ERROR_DB);
 
        gettimeofday(&from, NULL);
        do {
                ret = sqlite3_step(stmt);
                if (SQLITE_ROW != ret && SQLITE_DONE != ret)
-                       CTS_ERR("sqlite3_step() Fail(%d, %s, %d)", ret, sqlite3_errmsg(ctsvc_db),
+                       ERR("sqlite3_step() Fail(%d, %s, %d)", ret, sqlite3_errmsg(ctsvc_db),
                                        sqlite3_extended_errcode(ctsvc_db));
 
                if (ret == SQLITE_BUSY || ret == SQLITE_LOCKED) {
                        gettimeofday(&now, NULL);
                        timersub(&now, &from, &diff);
-                       retry = (diff.tv_sec < CTSVC_QUERY_RETRY_TIME)? true:false;
+                       retry = (diff.tv_sec < CTSVC_QUERY_RETRY_TIME) ? true : false;
                        if (retry)
                                usleep(CTSVC_QUERY_RETRY_INTERVAL);
-               }
-               else
+               } else {
                        retry = false;
+               }
        } while (retry);
 
        if (SQLITE_ROW != ret) {
-               CTS_ERR("sqlite3_step() Fail(%d, %s, %d)", ret, sqlite3_errmsg(ctsvc_db),
+               ERR("sqlite3_step() Fail(%d, %s, %d)", ret, sqlite3_errmsg(ctsvc_db),
                                sqlite3_extended_errcode(ctsvc_db));
+
                sqlite3_finalize(stmt);
                if (SQLITE_DONE == ret)
-                       return CONTACTS_ERROR_NO_DATA /*CONTACTS_ERR_DB_RECORD_NOT_FOUND*/;
+                       return CONTACTS_ERROR_NO_DATA;
+
                if (ret == SQLITE_BUSY || ret == SQLITE_LOCKED)
                        return CONTACTS_ERROR_DB_LOCKED;
                else
@@ -321,19 +353,20 @@ int ctsvc_stmt_step(cts_stmt stmt)
        do {
                ret = sqlite3_step(stmt);
 
-               if (ret != SQLITE_ROW && ret != SQLITE_DONE)
-                       CTS_ERR("DB error : sqlite3_step() Fail(%d, %s, %d)", ret,
-                                       sqlite3_errmsg(ctsvc_db), sqlite3_extended_errcode(ctsvc_db));
+               if (ret != SQLITE_ROW && ret != SQLITE_DONE) {
+                       ERR("sqlite3_step() Fail(%d, %s, %d)", ret, sqlite3_errmsg(ctsvc_db),
+                                       sqlite3_extended_errcode(ctsvc_db));
+               }
 
                if (ret == SQLITE_BUSY || ret == SQLITE_LOCKED) {
                        gettimeofday(&now, NULL);
                        timersub(&now, &from, &diff);
-                       retry = (diff.tv_sec < CTSVC_QUERY_RETRY_TIME)? true:false;
+                       retry = (diff.tv_sec < CTSVC_QUERY_RETRY_TIME) ? true : false;
                        if (retry)
                                usleep(CTSVC_QUERY_RETRY_INTERVAL);
-               }
-               else
+               } else {
                        retry = false;
+               }
        } while (retry);
 
        switch (ret) {
@@ -361,10 +394,10 @@ int ctsvc_stmt_step(cts_stmt stmt)
                ret = CONTACTS_ERROR_DB;
                break;
        default:
-               CTS_ERR("sqlite3_step() Fail(%d)", ret);
+               ERR("sqlite3_step() Fail(%d)", ret);
                ret = CONTACTS_ERROR_DB;
-               break;
        }
+
        return ret;
 }
 
index a45dadb..bb10244 100644 (file)
@@ -1,11 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Dohyung Jin <dh.jin@samsung.com>
- *                 Jongwon Lee <gogosing.lee@samsung.com>
- *                 Donghee Ye <donghee.ye@samsung.com>
+ * 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.
index d3b0ffc..2cc3714 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -51,7 +51,7 @@ static __thread int transaction_count = 0;
 static __thread int transaction_ver = 0;
 static __thread bool version_up = false;
 
-struct image_transform{
+struct image_transform {
        int ret;
        uint64_t size;
        void *buffer;
@@ -78,7 +78,7 @@ int ctsvc_begin_trans(void)
                        progress *= 2;
                }
                if (CONTACTS_ERROR_NONE != ret) {
-                       CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+                       ERR("ctsvc_query_exec() Fail(%d)", ret);
                        return ret;
                }
 
@@ -99,10 +99,10 @@ int ctsvc_end_trans(bool is_success)
        char query[CTS_SQL_MIN_LEN] = {0};
 
        transaction_count--;
-       INFO("%s, transaction_count : %d", is_success?"True": "False",  transaction_count);
+       INFO("%s, transaction_count : %d", is_success ? "True" : "False",  transaction_count);
 
        if (0 != transaction_count) {
-               CTS_DBG("contact transaction_count : %d.", transaction_count);
+               DBG("contact transaction_count : %d.", transaction_count);
                return CONTACTS_ERROR_NONE;
        }
 
@@ -119,33 +119,37 @@ int ctsvc_end_trans(bool is_success)
                snprintf(query, sizeof(query), "UPDATE %s SET ver = %d",
                                CTS_TABLE_VERSION, transaction_ver);
                ret = ctsvc_query_exec(query);
-               WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_query_exec(version up) Fail(%d)", ret);
+               if (CONTACTS_ERROR_NONE != ret)
+                       ERR("ctsvc_query_exec(version up) Fail(%d)", ret);
        }
 
        INFO("start commit");
        progress = 100000;
        ret = ctsvc_query_exec("COMMIT TRANSACTION");
-       while (CONTACTS_ERROR_DB == ret && progress<CTS_COMMIT_TRY_MAX) {
+       while (CONTACTS_ERROR_DB == ret && progress < CTS_COMMIT_TRY_MAX) {
                usleep(progress);
                ret = ctsvc_query_exec("COMMIT TRANSACTION");
                progress *= 2;
        }
-       INFO("%s", (CONTACTS_ERROR_NONE == ret)?"commit": "rollback");
+       INFO("%s", (CONTACTS_ERROR_NONE == ret) ? "commit" : "rollback");
 
        if (CONTACTS_ERROR_NONE != ret) {
                int tmp_ret;
-               CTS_ERR("ctsvc_query_exec() Fail(%d)", ret);
+               ERR("ctsvc_query_exec() Fail(%d)", ret);
                ctsvc_nofitication_cancel();
                ctsvc_change_subject_clear_changed_info();
+
                tmp_ret = ctsvc_query_exec("ROLLBACK TRANSACTION");
-               WARN_IF(CONTACTS_ERROR_NONE != tmp_ret, "ctsvc_query_exec(ROLLBACK) Fail(%d)", tmp_ret);
+               if (CONTACTS_ERROR_NONE != tmp_ret)
+                       ERR("ctsvc_query_exec(ROLLBACK) Fail(%d)", tmp_ret);
+
                return ret;
        }
 
        ctsvc_notification_send();
        ctsvc_change_subject_publish_changed_info();
 
-       CTS_DBG("Transaction shut down! : (%d)\n", transaction_ver);
+       DBG("Transaction shut down! : (%d)\n", transaction_ver);
 
        return CONTACTS_ERROR_NONE;
 }
@@ -183,7 +187,8 @@ const char* ctsvc_get_sort_column(void)
                return "reverse_display_name_language, reverse_sortkey";
 }
 
-void ctsvc_utils_make_image_file_name(int parent_id, int id, char *src_img, char *dest, int dest_size)
+void ctsvc_utils_make_image_file_name(int parent_id, int id, char *src_img, char *dest,
+               int dest_size)
 {
        char *ext;
        char *temp;
@@ -195,7 +200,7 @@ void ctsvc_utils_make_image_file_name(int parent_id, int id, char *src_img, char
 
        lower_ext = strdup(ext);
        if (NULL == lower_ext) {
-               CTS_ERR("strdup() Fail");
+               ERR("strdup() Fail");
                return;
        }
        temp = lower_ext;
@@ -211,13 +216,14 @@ void ctsvc_utils_make_image_file_name(int parent_id, int id, char *src_img, char
        free(lower_ext);
 }
 
-static inline bool ctsvc_check_available_image_space(void) {
+static inline bool ctsvc_check_available_image_space(void)
+{
        int ret;
        struct statfs buf;
        long long size;
-       ret = statfs(CTSVC_NOTI_IMG_REPERTORY, &buf);
 
-       RETVM_IF(ret!=0, false, "statfs Fail(%d)", ret);
+       ret = statfs(CTSVC_NOTI_IMG_REPERTORY, &buf);
+       RETVM_IF(ret != 0, false, "statfs() Fail(%d)", ret);
 
        size = (long long)buf.f_bavail * (buf.f_bsize);
 
@@ -234,8 +240,8 @@ static image_util_rotation_e _ctsvc_image_get_rotation_info(const char *path)
        int orientation = 0;
 
        ed = exif_data_new_from_file(path);
-       if (ed == NULL) {
-               CTS_ERR("exif_data_new_from_file : ExifData is NULL");
+       if (NULL == ed) {
+               ERR("exif_data_new_from_file() Fail");
                return IMAGE_UTIL_ROTATION_NONE;
        }
 
@@ -250,7 +256,7 @@ static image_util_rotation_e _ctsvc_image_get_rotation_info(const char *path)
        if (ed)
                exif_data_unref(ed);
 
-       switch(orientation) {
+       switch (orientation) {
        case 1: /* Top-left */
                rotation = IMAGE_UTIL_ROTATION_NONE;
                break;
@@ -284,7 +290,7 @@ typedef struct {
        const char *src;
        const char *dest;
        int ret;
-}image_info;
+} image_info;
 
 static int _ctsvc_image_get_mimetype(image_util_colorspace_e colorspace,
                int *p_mimetype)
@@ -341,41 +347,41 @@ static media_format_h _ctsvc_image_create_media_format(int mimetype, int width,
 
        ret = media_format_create(&fmt);
        if (MEDIA_FORMAT_ERROR_NONE != ret) {
-               CTS_ERR("media_format_create() Fail(%d)", ret);
+               ERR("media_format_create() Fail(%d)", ret);
                return NULL;
        }
 
        ret = media_format_set_video_mime(fmt, mimetype);
        if (MEDIA_FORMAT_ERROR_NONE != ret) {
-               CTS_ERR("media_format_set_video_mime() Fail(%d)", ret);
+               ERR("media_format_set_video_mime() Fail(%d)", ret);
                media_format_unref(fmt);
                return NULL;
        }
 
        ret = media_format_set_video_width(fmt, width);
        if (MEDIA_FORMAT_ERROR_NONE != ret) {
-               CTS_ERR("media_format_set_video_width() Fail(%d)", ret);
+               ERR("media_format_set_video_width() Fail(%d)", ret);
                media_format_unref(fmt);
                return NULL;
        }
 
        ret = media_format_set_video_height(fmt, height);
        if (MEDIA_FORMAT_ERROR_NONE != ret) {
-               CTS_ERR("media_format_set_video_height() Fail(%d)", ret);
+               ERR("media_format_set_video_height() Fail(%d)", ret);
                media_format_unref(fmt);
                return NULL;
        }
 
        ret = media_format_set_video_avg_bps(fmt, 2000000); /* image_util guide */
        if (MEDIA_FORMAT_ERROR_NONE != ret) {
-               CTS_ERR("media_format_set_video_avg_bps() Fail(%d)", ret);
+               ERR("media_format_set_video_avg_bps() Fail(%d)", ret);
                media_format_unref(fmt);
                return NULL;
        }
 
        ret = media_format_set_video_max_bps(fmt, 15000000); /* image_util guide */
        if (MEDIA_FORMAT_ERROR_NONE != ret) {
-               CTS_ERR("media_format_set_video_max_bps() Fail(%d)", ret);
+               ERR("media_format_set_video_max_bps() Fail(%d)", ret);
                media_format_unref(fmt);
                return NULL;
        }
@@ -403,20 +409,20 @@ static media_packet_h _ctsvc_image_create_media_packet(media_format_h fmt,
        ret = media_packet_create_alloc(fmt, _ctsvc_image_packet_create_alloc_finalize_cb,
                        NULL, &packet);
        if (MEDIA_PACKET_ERROR_NONE != ret) {
-               CTS_ERR("media_packet_create_alloc() Fail(%d)", ret);
+               ERR("media_packet_create_alloc() Fail(%d)", ret);
                return NULL;
        }
 
        ret = media_packet_get_buffer_size(packet, &mp_buffer_size);
        if (MEDIA_PACKET_ERROR_NONE != ret) {
-               CTS_ERR("media_packet_get_buffer_size() Fail(%d)", ret);
+               ERR("media_packet_get_buffer_size() Fail(%d)", ret);
                media_packet_destroy(packet);
                return NULL;
        }
 
        ret = media_packet_get_buffer_data_ptr(packet, &mp_buffer);
        if (MEDIA_PACKET_ERROR_NONE != ret) {
-               CTS_ERR("media_packet_get_buffer_data_ptr() Fail(%d)", ret);
+               ERR("media_packet_get_buffer_data_ptr() Fail(%d)", ret);
                media_packet_destroy(packet);
                return NULL;
        }
@@ -427,7 +433,7 @@ static media_packet_h _ctsvc_image_create_media_packet(media_format_h fmt,
        return packet;
 }
 
-static void _ctsvc_image_transform_completed_cb(media_packet_h *dst,
+static void _image_transform_completed_cb(media_packet_h *dst,
                image_util_error_e error, void *user_data)
 {
        int ret;
@@ -443,7 +449,7 @@ static void _ctsvc_image_transform_completed_cb(media_packet_h *dst,
        if (IMAGE_UTIL_ERROR_NONE == error) {
                ret = media_packet_get_buffer_size(*dst, &size);
                if (MEDIA_PACKET_ERROR_NONE != ret) {
-                       CTS_ERR("media_packet_get_buffer_size() Fail(%d)", ret);
+                       ERR("media_packet_get_buffer_size() Fail(%d)", ret);
                        info->ret = CONTACTS_ERROR_SYSTEM;
                        media_packet_destroy(*dst);
                        g_mutex_lock(&info->mutex);
@@ -454,7 +460,7 @@ static void _ctsvc_image_transform_completed_cb(media_packet_h *dst,
 
                ret = media_packet_get_buffer_data_ptr(*dst, &buffer);
                if (MEDIA_PACKET_ERROR_NONE != ret) {
-                       CTS_ERR("media_packet_get_buffer_data_ptr() Fail(%d)", ret);
+                       ERR("media_packet_get_buffer_data_ptr() Fail(%d)", ret);
                        info->ret = CONTACTS_ERROR_SYSTEM;
                        media_packet_destroy(*dst);
                        g_mutex_lock(&info->mutex);
@@ -465,7 +471,7 @@ static void _ctsvc_image_transform_completed_cb(media_packet_h *dst,
 
                info->buffer = calloc(1, (int)size);
                if (NULL == info->buffer) {
-                       CTS_ERR("calloc() Fail");
+                       ERR("calloc() Fail");
                        info->ret = CONTACTS_ERROR_SYSTEM;
                        media_packet_destroy(*dst);
                        g_mutex_lock(&info->mutex);
@@ -476,9 +482,8 @@ static void _ctsvc_image_transform_completed_cb(media_packet_h *dst,
                memcpy(info->buffer, buffer, (int)size);
                info->size = size;
                info->ret = CONTACTS_ERROR_NONE;
-       }
-       else {
-               CTS_ERR("transform_run() Fail(%d)", error);
+       } else {
+               ERR("transform_run() Fail(%d)", error);
                info->ret = CONTACTS_ERROR_SYSTEM;
        }
        media_packet_destroy(*dst);
@@ -498,7 +503,7 @@ static int _ctsvc_image_util_transform_run(transformation_h transform,
 
        info = calloc(1, sizeof(struct image_transform));
        if (NULL == info) {
-               CTS_ERR("calloc() Fail");
+               ERR("calloc() Fail");
                return CONTACTS_ERROR_OUT_OF_MEMORY;
        }
 
@@ -506,12 +511,12 @@ static int _ctsvc_image_util_transform_run(transformation_h transform,
        g_mutex_init(&info->mutex);
 
        g_mutex_lock(&info->mutex);
-       image_util_transform_run(transform, packet, _ctsvc_image_transform_completed_cb, info);
+       image_util_transform_run(transform, packet, _image_transform_completed_cb, info);
 
        end_time = g_get_monotonic_time() + CTS_IMAGE_TRANSFORM_WAIT_TIME;
        if (!g_cond_wait_until(&info->cond, &info->mutex, end_time)) {
                /* timeout has passed */
-               CTS_ERR("g_cond_wait_until() return FALSE");
+               ERR("g_cond_wait_until() return FALSE");
                info->ret = CONTACTS_ERROR_SYSTEM;
        }
        g_mutex_unlock(&info->mutex);
@@ -519,7 +524,7 @@ static int _ctsvc_image_util_transform_run(transformation_h transform,
        g_cond_clear(&info->cond);
 
        if (CONTACTS_ERROR_NONE != info->ret) {
-               CTS_ERR("image_util_transform_run() Fail(%d)", info->ret);
+               ERR("image_util_transform_run() Fail(%d)", info->ret);
                free(info->buffer);
                free(info);
                return CONTACTS_ERROR_SYSTEM;
@@ -540,13 +545,13 @@ static int _ctsvc_image_rotate(media_packet_h packet, image_util_rotation_e rota
 
        ret = image_util_transform_create(&transform);
        if (IMAGE_UTIL_ERROR_NONE != ret) {
-               CTS_ERR("image_util_transform_create() Fail(%d)", ret);
+               ERR("image_util_transform_create() Fail(%d)", ret);
                return CONTACTS_ERROR_SYSTEM;
        }
 
        ret = image_util_transform_set_rotation(transform, rotation);
        if (IMAGE_UTIL_ERROR_NONE != ret) {
-               CTS_ERR("image_util_transform_set_rotation() Fail(%d)", ret);
+               ERR("image_util_transform_set_rotation() Fail(%d)", ret);
                image_util_transform_destroy(transform);
                return CONTACTS_ERROR_SYSTEM;
        }
@@ -565,13 +570,13 @@ static int _ctsvc_image_resize(media_packet_h packet, int width, int height,
 
        ret = image_util_transform_create(&transform);
        if (IMAGE_UTIL_ERROR_NONE != ret) {
-               CTS_ERR("image_util_transform_create() Fail(%d)", ret);
+               ERR("image_util_transform_create() Fail(%d)", ret);
                return CONTACTS_ERROR_SYSTEM;
        }
 
        ret = image_util_transform_set_resolution(transform, width, height);
        if (IMAGE_UTIL_ERROR_NONE != ret) {
-               CTS_ERR("image_util_transform_set_resolution() Fail(%d)", ret);
+               ERR("image_util_transform_set_resolution() Fail(%d)", ret);
                image_util_transform_destroy(transform);
                return CONTACTS_ERROR_SYSTEM;
        }
@@ -603,8 +608,8 @@ static bool _ctsvc_image_util_supported_jpeg_colorspace_cb(
                return true;
        }
 
-       ret = image_util_decode_jpeg(info->src, colorspace, (unsigned char **)&buffer, &width,
-                       &height, (unsigned int *)&size);
+       ret = image_util_decode_jpeg(info->src, colorspace, (unsigned char **)&buffer,
+                       &width, &height, (unsigned int *)&size);
        if (IMAGE_UTIL_ERROR_NONE != ret) {
                info->ret = CONTACTS_ERROR_SYSTEM;
                return true;
@@ -617,7 +622,7 @@ static bool _ctsvc_image_util_supported_jpeg_colorspace_cb(
 
                fmt = _ctsvc_image_create_media_format(mimetype, width, height);
                if (NULL == fmt) {
-                       CTS_ERR("_ctsvc_image_create_media_format() Fail");
+                       ERR("_ctsvc_image_create_media_format() Fail");
                        info->ret = CONTACTS_ERROR_SYSTEM;
                        free(buffer);
                        return false;
@@ -625,7 +630,7 @@ static bool _ctsvc_image_util_supported_jpeg_colorspace_cb(
 
                packet = _ctsvc_image_create_media_packet(fmt, buffer, (unsigned int)size);
                if (NULL == packet) {
-                       CTS_ERR("_ctsvc_image_create_media_packet() Fail");
+                       ERR("_ctsvc_image_create_media_packet() Fail");
                        media_format_unref(fmt);
                        info->ret = CONTACTS_ERROR_SYSTEM;
                        free(buffer);
@@ -659,11 +664,10 @@ static bool _ctsvc_image_util_supported_jpeg_colorspace_cb(
                media_packet_h packet;
 
                /* set resize */
-               if (width>height) {
+               if (width > height) {
                        resized_width = CTS_IMAGE_MAX_SIZE;
                        resized_height = height * CTS_IMAGE_MAX_SIZE / width;
-               }
-               else {
+               } else {
                        resized_height = CTS_IMAGE_MAX_SIZE;
                        resized_width = width * CTS_IMAGE_MAX_SIZE / height;
                }
@@ -676,7 +680,7 @@ static bool _ctsvc_image_util_supported_jpeg_colorspace_cb(
 
                fmt = _ctsvc_image_create_media_format(mimetype, width, height);
                if (NULL == fmt) {
-                       CTS_ERR("_ctsvc_image_create_media_format() Fail");
+                       ERR("_ctsvc_image_create_media_format() Fail");
                        info->ret = CONTACTS_ERROR_SYSTEM;
                        free(buffer);
                        return false;
@@ -684,7 +688,7 @@ static bool _ctsvc_image_util_supported_jpeg_colorspace_cb(
 
                packet = _ctsvc_image_create_media_packet(fmt, buffer, (unsigned int)size);
                if (NULL == packet) {
-                       CTS_ERR("_ctsvc_image_create_media_packet() Fail");
+                       ERR("_ctsvc_image_create_media_packet() Fail");
                        media_format_unref(fmt);
                        info->ret = CONTACTS_ERROR_SYSTEM;
                        free(buffer);
@@ -713,21 +717,21 @@ static bool _ctsvc_image_util_supported_jpeg_colorspace_cb(
                        CTS_IMAGE_ENCODE_QUALITY, info->dest);
        free(buffer);
        if (IMAGE_UTIL_ERROR_NONE != ret) {
-               CTS_ERR("image_util_encode_jpeg Fail(%d)", ret);
+               ERR("image_util_encode_jpeg Fail(%d)", ret);
                info->ret = CONTACTS_ERROR_SYSTEM;
                return false;
        }
 
        dest_fd = open(info->dest, O_RDONLY);
        if (dest_fd < 0) {
-               CTS_ERR("System : Open Fail(%d)", errno);
+               ERR("System : Open Fail(%d)", errno);
                info->ret = CONTACTS_ERROR_SYSTEM;
                return false;
        }
 
        ret = fchown(dest_fd, getuid(), CTS_SECURITY_FILE_GROUP);
        if (0 != ret) {
-               CTS_ERR("fchown Fail(%d)", errno);
+               ERR("fchown Fail(%d)", errno);
                info->ret = CONTACTS_ERROR_SYSTEM;
                close(dest_fd);
                return false;
@@ -735,7 +739,7 @@ static bool _ctsvc_image_util_supported_jpeg_colorspace_cb(
 
        ret = fchmod(dest_fd, CTS_SECURITY_IMAGE_PERMISSION);
        if (0 != ret) {
-               CTS_ERR("fchmod Fail(%d)", errno);
+               ERR("fchmod Fail(%d)", errno);
                info->ret = CONTACTS_ERROR_SYSTEM;
                close(dest_fd);
                return false;
@@ -778,17 +782,20 @@ int ctsvc_utils_copy_image(const char *dir, const char *src, const char *file)
                return CONTACTS_ERROR_FILE_NO_SPACE;
 
        ret = _ctsvc_image_encode(src, dest);
-       if (CONTACTS_ERROR_NONE == ret) {
+       if (CONTACTS_ERROR_NONE == ret)
                return ret;
-       }
        else
-               CTS_ERR("_ctsvc_image_encode Fail(%d)", ret);
+               ERR("_ctsvc_image_encode Fail(%d)", ret);
 
        src_fd = open(src, O_RDONLY);
-       RETVM_IF(src_fd < 0, CONTACTS_ERROR_SYSTEM, "System : Open(src:%s) Fail(%d)", src, errno);
+       if (src_fd < 0) {
+               ERR("System : Open(%s) Fail(%d)", src, errno);
+               return CONTACTS_ERROR_SYSTEM;
+       }
+
        dest_fd = open(dest, O_WRONLY|O_CREAT|O_TRUNC, 0660);
        if (dest_fd < 0) {
-               CTS_ERR("Open Fail(%d)", errno);
+               ERR("Open Fail(%d)", errno);
                close(src_fd);
                return CONTACTS_ERROR_SYSTEM;
        }
@@ -796,10 +803,10 @@ int ctsvc_utils_copy_image(const char *dir, const char *src, const char *file)
        while (0 < (size = read(src_fd, buf, CTSVC_COPY_SIZE_MAX))) {
                ret = write(dest_fd, buf, size);
                if (ret <= 0) {
-                       if (EINTR == errno)
+                       if (EINTR == errno) {
                                continue;
-                       else {
-                               CTS_ERR("write() Fail(%d)", errno);
+                       else {
+                               ERR("write() Fail(%d)", errno);
                                if (ENOSPC == errno)
                                        ret = CONTACTS_ERROR_FILE_NO_SPACE; /* No space */
                                else
@@ -813,13 +820,13 @@ int ctsvc_utils_copy_image(const char *dir, const char *src, const char *file)
        }
 
        ret = fchown(dest_fd, getuid(), CTS_SECURITY_FILE_GROUP);
-       if (0 != ret) {
-               CTS_ERR("fchown() Fail(%d)", ret);
-       }
+       if (0 != ret)
+               ERR("fchown() Fail(%d)", ret);
+
        ret = fchmod(dest_fd, CTS_SECURITY_IMAGE_PERMISSION);
-       if (0 != ret) {
-               CTS_ERR("fchmod() Fail(%d)", ret);
-       }
+       if (0 != ret)
+               ERR("fchmod() Fail(%d)", ret);
+
        close(src_fd);
        close(dest_fd);
 
@@ -842,22 +849,28 @@ int ctsvc_get_next_ver(void)
 
        /* In this case, contacts-service already works abnormally. */
        if (CONTACTS_ERROR_NONE != ret)
-               CTS_ERR("ctsvc_query_get_first_int_result : get version error(%d)", ret);
+               ERR("ctsvc_query_get_first_int_result : get version error(%d)", ret);
 
        return (1 + version);
 }
 
-int ctsvc_get_current_version(int* out_current_version) {
+int ctsvc_get_current_version(int *out_current_version)
+{
        if (transaction_count <= 0) {
                int ret;
                int version = 0;
                const char *query = "SELECT ver FROM "CTS_TABLE_VERSION;
+
                ret = ctsvc_query_get_first_int_result(query, &version);
-               RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_query_get_first_int_result() Fail(%d)", ret);
+               if (CONTACTS_ERROR_NONE != ret) {
+                       ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret);
+                       return ret;
+               }
+
                *out_current_version = version;
-       }
-       else
+       } else {
                *out_current_version = transaction_ver;
+       }
        return CONTACTS_ERROR_NONE;
 }
 
@@ -878,8 +891,7 @@ int SAFE_SNPRINTF(char **buf, int *buf_size, int len, const char *src)
        if (strlen(src) + 1 < remain) {
                temp_len = snprintf((*buf)+len, remain, "%s", src);
                return temp_len;
-       }
-       else {
+       } else {
                char *temp;
                while (1) {
                        temp = realloc(*buf, *buf_size*2);
index 26db927..d05862a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Contacts Service
  *
- * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * 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.
@@ -16,7 +16,6 @@
  * limitations under the License.
  *
  */
-
 #ifndef __CTSVC_DB_UTILS_H__
 #define __CTSVC_DB_UTILS_H__
 
@@ -27,11 +26,12 @@ const char* ctsvc_get_sort_name_column(void);
 int ctsvc_begin_trans(void);
 int ctsvc_end_trans(bool is_success);
 int ctsvc_get_next_ver(void);
-int ctsvc_get_current_version(intout_current_version);
+int ctsvc_get_current_version(int *out_current_version);
 int ctsvc_get_transaction_ver(void);
 
 int ctsvc_utils_copy_image(const char *dir, const char *src, const char *file);
-void ctsvc_utils_make_image_file_name(int parent_id, int id, char *src_img, char *dest, int dest_size);
+void ctsvc_utils_make_image_file_name(int parent_id, int id, char *src_img, char *dest,
+               int dest_size);
 
 int SAFE_SNPRINTF(char **buf, int *buf_size, int len, const char *src);