From: paras.kumar Date: Fri, 18 Mar 2016 09:17:24 +0000 (+0530) Subject: Fix Build Warnings & set -Werror rule to CMakeLists.txt X-Git-Tag: submit/tizen/20160325.024623~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=51eae4a0dc1f1b69edbd380aa689492290015b8a;p=platform%2Fcore%2Fconnectivity%2Fbluetooth-share.git Fix Build Warnings & set -Werror rule to CMakeLists.txt Change-Id: I533c1de195b05ec864ca21c12ba591d72c9e80d4 Signed-off-by: paras.kumar --- diff --git a/bt-share/CMakeLists.txt b/bt-share/CMakeLists.txt index ee57bc4..fc45835 100644 --- a/bt-share/CMakeLists.txt +++ b/bt-share/CMakeLists.txt @@ -33,7 +33,7 @@ FOREACH(flag ${pkgs_CFLAGS} ${CALENDAR_SERVICE2_CFLAGS} ${CONTACTS_SERVICE2_CFLA ENDFOREACH(flag) #SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -finstrument-functions") -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Werror") SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie") SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(EXEC_PREFIX "\${prefix}") diff --git a/bt-share/include/bt-share-noti-handler.h b/bt-share/include/bt-share-noti-handler.h index 472cff3..6b80696 100644 --- a/bt-share/include/bt-share-noti-handler.h +++ b/bt-share/include/bt-share-noti-handler.h @@ -31,7 +31,9 @@ extern "C" { #define BT_DOWNLOAD_PHONE_FOLDER "/opt/usr/media/Downloads" #define BT_DOWNLOAD_MMC_FOLDER "/opt/storage/sdcard/Downloads" #define BT_DOWNLOAD_MEDIA_FOLDER tzplatform_getenv(TZ_USER_CONTENT) +/* #define BT_FTP_FOLDER tzplatform_mkpath(TZ_SYS_SHARE, "bt-ftp") +*/ #define BT_DOWNLOAD_PHONE_ROOT "/opt/usr/media" #define BT_DOWNLOAD_MMC_ROOT "/opt/storage/sdcard" diff --git a/bt-share/src/bt-share-ipc.c b/bt-share/src/bt-share-ipc.c index b6682d9..ea96378 100644 --- a/bt-share/src/bt-share-ipc.c +++ b/bt-share/src/bt-share-ipc.c @@ -49,8 +49,7 @@ DBusConnection *dbus_connection = NULL; extern struct bt_appdata *app_state; static void __bt_create_send_data(opc_transfer_info_t *node); -static void __bt_create_send_failed_data(char *filepath, char *dev_name, - char *addr, char *type, unsigned int size); + static void __bt_share_update_tr_info(int tr_uid, int tr_type); static void __bt_tr_data_free(bt_tr_data_t *data) @@ -572,42 +571,6 @@ static char *__bt_conv_addr_type_to_addr_string(char *addr) return g_strdup(address); } -static void __bt_create_send_failed_data(char *filepath, char *dev_name, - char *addr, char *type, unsigned int size) -{ - int session_id; - sqlite3 *db = NULL; - - db = bt_share_open_db(); - if (!db) - return; - - session_id = bt_share_get_last_session_id(db, BT_DB_OUTBOUND); - - INFO("Last session id = %d", session_id); - - bt_tr_data_t *tmp; - tmp = g_malloc0(sizeof(bt_tr_data_t)); - if(tmp == NULL) - return; - - tmp->tr_status = BT_TR_FAIL; - tmp->sid = session_id + 1; - tmp->file_path = g_strdup(filepath); - tmp->content = g_strdup(filepath); - tmp->dev_name = g_strdup(dev_name); - tmp->type = g_strdup(type); - tmp->timestamp = __bt_get_current_timedata(); - tmp->addr = __bt_conv_addr_type_to_addr_string(addr); - tmp->size = size; - bt_share_add_tr_data(db, BT_DB_OUTBOUND, tmp); - __bt_tr_data_free(tmp); - - bt_share_close_db(db); - - return; -} - static void __bt_create_send_data(opc_transfer_info_t *node) { DBG("__bt_create_send_data \n"); @@ -767,7 +730,7 @@ static void __bt_share_update_tr_info(int tr_uid, int tr_type) return; if ((ad->send_data.tr_success + ad->send_data.tr_fail) != 0) { - snprintf(str, sizeof(str), BT_TR_STATUS, + snprintf(str, sizeof(str), "%s %d %d", BT_TR_STATUS, ad->send_data.tr_success, ad->send_data.tr_fail); _bt_update_notification(ad, ad->send_noti, @@ -807,7 +770,7 @@ static void __bt_share_update_tr_info(int tr_uid, int tr_type) return; if ((ad->recv_data.tr_success + ad->recv_data.tr_fail) != 0) { - snprintf(str, sizeof(str), BT_TR_STATUS, + snprintf(str, sizeof(str), "%s %d %d", BT_TR_STATUS, ad->recv_data.tr_success, ad->recv_data.tr_fail); _bt_update_notification(ad, ad->receive_noti, diff --git a/bt-share/src/bt-share-main.c b/bt-share/src/bt-share-main.c index b089e80..28f01a6 100644 --- a/bt-share/src/bt-share-main.c +++ b/bt-share/src/bt-share-main.c @@ -38,6 +38,7 @@ #include "bt-share-cynara.h" #include "bluetooth-share-api.h" +#include "notification_internal.h" #define BLUETOOTH_SHARE_BUS "org.projectx.bluetooth.share" @@ -140,7 +141,7 @@ static void __bt_update_notification_status_values() } if ((ad->send_data.tr_success + ad->send_data.tr_fail) != 0) { - snprintf(str, sizeof(str), BT_TR_STATUS, + snprintf(str, sizeof(str), "%s %d %d", BT_TR_STATUS, ad->send_data.tr_success, ad->send_data.tr_fail); noti = _bt_create_notification(BT_NOTI_T); @@ -178,7 +179,7 @@ static void __bt_update_notification_status_values() if ((ad->recv_data.tr_success + ad->recv_data.tr_fail) != 0) { - snprintf(str, sizeof(str), BT_TR_STATUS, + snprintf(str, sizeof(str), "%s %d %d", BT_TR_STATUS, ad->recv_data.tr_success, ad->recv_data.tr_fail); DBG("str = [%s] \n", str); @@ -239,7 +240,7 @@ failed: } -static int __bt_lang_changed_cb(void *data) +static int __bt_lang_changed_cb(void *data, void *user_data) { if (appcore_set_i18n(BT_COMMON_PKG, BT_COMMON_RES) < 0) return -1; @@ -318,8 +319,6 @@ int main(void) signal(SIGTERM, __bt_sigterm_handler); - g_type_init(); - if (__bt_dbus_request_name() == FALSE) { DBG("Aleady dbus instance existed\n"); exit(0); diff --git a/bt-share/src/bt-share-noti-handler.c b/bt-share/src/bt-share-noti-handler.c index e22c400..297a459 100644 --- a/bt-share/src/bt-share-noti-handler.c +++ b/bt-share/src/bt-share-noti-handler.c @@ -20,6 +20,7 @@ #include #include #include +#include /* For multi-user support */ #include @@ -28,7 +29,8 @@ #include "bluetooth-api.h" #include "bt-share-noti-handler.h" #include "bt-share-main.h" - +#include "obex-event-handler.h" +#include "bt-share-notification.h" static void __bt_default_memory_changed_cb(keynode_t *node, void *data) { @@ -45,8 +47,8 @@ static void __bt_default_memory_changed_cb(keynode_t *node, void *data) if (vconf_keynode_get_type(node) == VCONF_TYPE_INT) { /* Phone memory is 0, MMC is 1 */ default_memory = vconf_keynode_get_int(node); - root_path = default_memory ? BT_DOWNLOAD_MMC_FOLDER : BT_DOWNLOAD_MEDIA_FOLDER; - download_path = default_memory ? BT_DOWNLOAD_MMC_FOLDER : BT_DOWNLOAD_PHONE_FOLDER; + root_path = default_memory ? (char *)BT_DOWNLOAD_MMC_FOLDER : (char *)BT_DOWNLOAD_MEDIA_FOLDER; + download_path = default_memory ? (char *)BT_DOWNLOAD_MMC_FOLDER : (char *)BT_DOWNLOAD_PHONE_FOLDER; if (access(download_path, W_OK) != 0) { if (mkdir(download_path, 0755) < 0) { diff --git a/bt-share/src/bt-share-notification.c b/bt-share/src/bt-share-notification.c index 9e70171..9418b0a 100644 --- a/bt-share/src/bt-share-notification.c +++ b/bt-share/src/bt-share-notification.c @@ -30,6 +30,8 @@ #include "obex-event-handler.h" #include "bluetooth-share-api.h" #include "bt-share-resource.h" +#include "notification_text_domain.h" +#include "notification_internal.h" #define BT_PERCENT_STR_LEN 5 #define BT_PRIV_ID_STR_LEN 8 @@ -60,7 +62,6 @@ notification_h _bt_insert_notification(struct bt_appdata *ad, bt_notification_ty notification_h noti = NULL; notification_error_e ret = NOTIFICATION_ERROR_NONE; notification_type_e noti_type = NOTIFICATION_TYPE_NONE; - char str[NOTIFICATION_TEXT_LEN_MAX] = { 0 }; char *title = NULL; char *content = NULL; char *icon_path = NULL; @@ -242,7 +243,6 @@ int _bt_update_notification(struct bt_appdata *ad, notification_h noti, INFO("Update noti : %d", noti); notification_error_e ret = NOTIFICATION_ERROR_NONE; - char str[NOTIFICATION_TEXT_LEN_MAX] = { 0 }; int success = 0; int fail = 0; @@ -634,50 +634,6 @@ static void __bt_notification_changed_cb(void *data, notification_type_e type, n } -static void __bt_noti_changed_cb(void *data, notification_type_e type) -{ - DBG("+\n"); - - struct bt_appdata *ad = (struct bt_appdata *)data; - if (NULL == ad) - return; - - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; - int count = 0; - sqlite3 *db = NULL; - - noti_err = notification_get_count(NOTIFICATION_TYPE_NOTI, BT_SHARE_BIN_PATH, - NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE, &count); - if (noti_err != NOTIFICATION_ERROR_NONE) { - return; - } - - /* This callback used only for clear button of notification bar. */ - /* So need to check the clear button of in/outbound list view */ - if (count >= 1) - return; - - ad->send_data.tr_fail = 0; - ad->send_data.tr_success = 0; - ad->recv_data.tr_fail = 0; - ad->recv_data.tr_success = 0; - - db = bt_share_open_db(); - if (!db) - return; - - bt_share_remove_tr_data_by_notification(db, BT_DB_INBOUND); - bt_share_remove_tr_data_by_notification(db, BT_DB_OUTBOUND); - DBG("DB record of notification was removed\n"); - - ad->send_noti = NULL; - ad->receive_noti = NULL; - - bt_share_close_db(db); - - DBG("-\n"); -} - void _bt_register_notification_cb(struct bt_appdata *ad) { notification_error_e noti_err = NOTIFICATION_ERROR_NONE; diff --git a/bt-share/src/obex-event-handler.c b/bt-share/src/obex-event-handler.c index 4546f24..07f0f40 100644 --- a/bt-share/src/obex-event-handler.c +++ b/bt-share/src/obex-event-handler.c @@ -75,6 +75,8 @@ static gboolean isFirstReceivedPacket = FALSE; static gboolean isTransferConnectedReceived = FALSE; +gboolean __bt_scan_media_file(char *file_path); + void *_bt_obex_writeclose(bt_file_info_t *info); static void __bt_obex_file_push_auth(bt_obex_server_authorize_into_t *server_auth_info); @@ -784,29 +786,6 @@ static gboolean __bt_get_available_ext_memory(unsigned long long *available_mem_ return TRUE; } -static gboolean __bt_get_available_memory(long *available_mem_size) -{ - struct statfs fs = {0, }; - int val = -1; - char *default_memory = NULL; - - if (-1 == vconf_get_int(VCONFKEY_SETAPPL_DEFAULT_MEM_BLUETOOTH_INT, - (void *)&val)) { - ERR("vconf error\n"); - return FALSE; - } - if (val == 0) /* Phone memory is 0, MMC is 1 */ - default_memory = BT_DOWNLOAD_MEDIA_FOLDER; - else - default_memory = BT_DOWNLOAD_MMC_FOLDER; - if (statfs(default_memory, &fs) != 0) { - *available_mem_size = 0; - return FALSE; - } - *available_mem_size = fs.f_bavail * (fs.f_bsize/1024); - return TRUE; -} - static gchar *__bt_get_unique_file_name(char *storage_path, char *filename) { char temp_filepath[BT_FILE_PATH_LEN_MAX] = { 0, }; @@ -990,7 +969,6 @@ static gboolean __bt_save_v_object(char *file_path, bt_file_type_t file_type) { retv_if(NULL == file_path, FALSE); - int ret; DBG("file_path = %s, file_type = %d\n", file_path, file_type); diff --git a/lib/bt-share-db.c b/lib/bt-share-db.c index 859bb25..9dc5454 100644 --- a/lib/bt-share-db.c +++ b/lib/bt-share-db.c @@ -65,7 +65,9 @@ sqlite3 *__bt_db_open(void) if (ret == -1 && errno == ENOENT) { DBG("DB %s doesn't exist, it needs to be created and initialized", BT_TRANSFER_DB); - system(SCRIPT_INIT_DB); + ret = system(SCRIPT_INIT_DB); + if (ret != EXIT_SUCCESS) + ERR("Exit code of epp not clean: %i", ret); } ret = db_util_open(BT_TRANSFER_DB, &db, DB_UTIL_REGISTER_HOOK_METHOD);