Modify warnings in focus module 42/44842/7
authorinhyeok <i_bc.kim@samsung.com>
Tue, 28 Jul 2015 10:48:59 +0000 (19:48 +0900)
committerInHyeok Kim <i_bc.kim@samsung.com>
Thu, 30 Jul 2015 01:59:22 +0000 (18:59 -0700)
[Version] Release 0.9.247
[Profile] Common
[Issue Type] Fix bugs

Change-Id: I5fe86dab243176f68c883bf59f76b975ab783269
Signed-off-by: inhyeok <i_bc.kim@samsung.com>
focus_server/include/mm_sound_mgr_focus.h
focus_server/include/mm_sound_mgr_focus_ipc.h
focus_server/mm_sound_focus_server.c
focus_server/mm_sound_mgr_focus.c
focus_server/mm_sound_mgr_focus_dbus.c
focus_server/mm_sound_mgr_focus_ipc.c
mm_sound_client.c
packaging/libmm-sound.spec

index 75eb45f..caf773f 100644 (file)
@@ -89,6 +89,9 @@ int mm_sound_mgr_focus_request_acquire (const _mm_sound_mgr_focus_param_t *param
 int mm_sound_mgr_focus_request_release (const _mm_sound_mgr_focus_param_t *param);
 int mm_sound_mgr_focus_set_watch_cb (const _mm_sound_mgr_focus_param_t *param);
 int mm_sound_mgr_focus_unset_watch_cb (const _mm_sound_mgr_focus_param_t *param);
+#ifdef SUPPORT_CONTAINER
+void mm_sound_mgr_focus_update_container_data(int pid,int handle, const char* container_name, int container_pid);
+#endif
 
 
 #endif /* __MM_SOUND_MGR_FOCUS_H__ */
index 46cc7ba..1e427a8 100644 (file)
@@ -34,9 +34,9 @@ typedef struct container_info
 
 //int __mm_sound_mgr_ipc_create_focus_node(mm_ipc_msg_t *msg);
 #ifdef SUPPORT_CONTAINER
-int __mm_sound_mgr_focus_ipc_register_focus(int client_pid, int handle_id, char* stream_type ,const char* container_name, int container_pid);
+int __mm_sound_mgr_focus_ipc_register_focus(int client_pid, int handle_id, const char* stream_type ,const char* container_name, int container_pid);
 #else
-int __mm_sound_mgr_focus_ipc_register_focus(int client_pid, int handle_id, char* stream_type);
+int __mm_sound_mgr_focus_ipc_register_focus(int client_pid, int handle_id, const char* stream_type);
 #endif
 //int __mm_sound_mgr_ipc_destroy_focus_node(mm_ipc_msg_t *msg);
 int __mm_sound_mgr_focus_ipc_unregister_focus(int pid, int handle_id);
index ea7aff4..4260b01 100644 (file)
@@ -43,6 +43,7 @@
 
 #include "../include/mm_sound_common.h"
 #include "../include/mm_sound_utils.h"
+#include "include/mm_sound_mgr_focus.h"
 #include "include/mm_sound_mgr_focus_ipc.h"
 #include "include/mm_sound_mgr_focus_dbus.h"
 
@@ -199,8 +200,6 @@ static int getOption(int argc, char **argv, server_arg *arg)
 //__attribute__ ((destructor))
 static void _exit_handler(int sig)
 {
-       int ret = MM_ERROR_NONE;
-
        switch(sig)
        {
        case SIGINT:
index c0faa40..e22df98 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
 
 #include "include/mm_sound_mgr_focus.h"
 #include "../include/mm_sound_common.h"
@@ -32,6 +33,7 @@
 #include <fcntl.h>
 
 #include "include/mm_sound_mgr_focus_ipc.h"
+#include "include/mm_sound_mgr_focus_dbus.h"
 #include "../include/mm_sound_utils.h"
 #include <sys/time.h>
 #include <sys/stat.h>
@@ -104,6 +106,7 @@ static container_info_t* __get_container_info(int instance_id)
                        return &node->container;
                }
        }
+       return NULL;
 }
 #endif /* SUPPORT_CONTAINER */
 
@@ -114,7 +117,10 @@ static char* __get_focus_pipe_path(int instance_id, int handle, const char* post
 
 #ifdef SUPPORT_CONTAINER
        container_info_t* container_info = __get_container_info(instance_id);
-
+       if (!container_info) {
+               debug_error ("__get_container_info failed");
+               return NULL;
+       }
        if (instance_id == container_info->pid) {
                debug_error ("This might be in the HOST(%s)[%d], let's form normal path",
                                        container_info->name, instance_id);
@@ -185,7 +191,7 @@ static int _mm_sound_mgr_focus_get_priority_from_stream_type(int *priority, cons
 }
 
 static int _mm_sound_mgr_focus_do_watch_callback(focus_type_e focus_type, focus_command_e command,
-                                                                                               focus_node_t *my_node, _mm_sound_mgr_focus_param_t *param)
+                                                                                               focus_node_t *my_node, const _mm_sound_mgr_focus_param_t *param)
 {
        char *filename = NULL;
        char *filename2 = NULL;
@@ -201,9 +207,6 @@ static int _mm_sound_mgr_focus_do_watch_callback(focus_type_e focus_type, focus_
 
        GList *list = NULL;
        focus_node_t *node = NULL;
-
-       int i = 0;
-
        focus_cb_data cb_data;
 
        debug_fenter();
@@ -338,7 +341,7 @@ fail:
        return -1;
 }
 
-int _mm_sound_mgr_focus_do_callback(focus_command_e command, focus_node_t *victim_node, _mm_sound_mgr_focus_param_t *assaulter_param, const char *assaulter_stream_type)
+int _mm_sound_mgr_focus_do_callback(focus_command_e command, focus_node_t *victim_node, const _mm_sound_mgr_focus_param_t *assaulter_param, const char *assaulter_stream_type)
 {
        char *filename = NULL;
        char *filename2 = NULL;
@@ -487,7 +490,7 @@ int _mm_sound_mgr_focus_do_callback(focus_command_e command, focus_node_t *victi
        }
        if(ret == victim_node->handle_id) {
                /* return from client is success, ret will be its handle_id */
-               victim_node->status = (command == FOCUS_COMMAND_RELEASE) ? (victim_node->status &= ~(cb_data.type)) : (victim_node->status |= cb_data.type);
+               victim_node->status = (command == FOCUS_COMMAND_RELEASE) ? (victim_node->status & ~(cb_data.type)) : (victim_node->status | cb_data.type);
        } else {
                victim_node->status = FOCUS_STATUS_DEACTIVATED;
        }
@@ -575,7 +578,7 @@ static void _mm_sound_mgr_focus_fill_info_from_msg (focus_node_t *node, const _m
 }
 
 #ifdef SUPPORT_CONTAINER
-void _mm_sound_mgr_focus_update_container_data(int pid,int handle, const char* container_name, int container_pid)
+void mm_sound_mgr_focus_update_container_data(int pid,int handle, const char* container_name, int container_pid)
 {
        __set_container_data(pid, handle, container_name, container_pid);
        //__temp_print_list(NULL);
@@ -795,7 +798,7 @@ int mm_sound_mgr_focus_request_release (const _mm_sound_mgr_focus_param_t *param
                        if (my_node->status == FOCUS_STATUS_DEACTIVATED) {
                                ret = MM_ERROR_SOUND_INVALID_STATE;
                                goto FINISH;
-                       } else if ((my_node->status != FOCUS_STATUS_ACTIVATED_BOTH) && (my_node->status != param->request_type)) {
+                       } else if ((my_node->status != FOCUS_STATUS_ACTIVATED_BOTH) && (my_node->status != (focus_status_e)param->request_type)) {
                                ret = MM_ERROR_SOUND_INVALID_STATE;
                                goto FINISH;
                        }
index 4f11963..135573c 100644 (file)
@@ -204,48 +204,6 @@ static const char* _convert_error_code(int err_code)
        return "org.tizen.multimedia.common.Unknown";
 }
 
-
-static int mm_sound_mgr_focus_dbus_send_signal(int signal_type, GVariant *parameter)
-{
-       int ret = MM_ERROR_NONE;
-       GDBusConnection *conn = NULL;
-       GError* err = NULL;
-       gboolean emit_success = FALSE;
-
-       if (signal_type < 0 || signal_type >= SIGNAL_MAX || !parameter) {
-               debug_error("Invalid Argument");
-               return MM_ERROR_SOUND_INTERNAL;
-       }
-
-       debug_log("Signal Emit : %s", signals[signal_type].info.name);
-
-       if (!conn_g) {
-               conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
-               if (!conn && err) {
-                       debug_error ("g_bus_get_sync() error (%s) ", err->message);
-                       g_error_free (err);
-                       return MM_ERROR_SOUND_INTERNAL;
-               }
-               conn_g = conn;
-       }
-/*
-       if (!g_variant_is_of_type(parameter, G_VARIANT_TYPE(signals[signal_type].info.argument))) {
-               debug_error("Invalid Signal Parameter");
-               return MM_ERROR_INVALID_ARGUMENT;
-       }
-       */
-
-       emit_success = g_dbus_connection_emit_signal(conn_g, NULL, OBJECT_FOCUS_SERVER, INTERFACE_FOCUS_SERVER,
-                                                                                               signals[signal_type].info.name, parameter, &err);
-       if (!emit_success && err) {
-               debug_error("Emit signal (%s) failed, (%s)", signals[signal_type].info.name, err->message);
-               g_error_free(err);
-               return MM_ERROR_SOUND_INTERNAL;
-       }
-
-       return ret;
-}
-
 static int _get_sender_pid(GDBusMethodInvocation* invocation)
 {
        GVariant* value;
@@ -291,7 +249,7 @@ static void _method_call_return_error(GDBusMethodInvocation *invocation, int ret
 static void handle_method_register_focus(GDBusMethodInvocation* invocation)
 {
        int ret = MM_ERROR_NONE;
-       int pid = 0, handle_id = 0;
+       int handle_id = 0;
        const char* stream_type = NULL;
        GVariant *params = NULL;
 #ifdef SUPPORT_CONTAINER
@@ -300,6 +258,8 @@ static void handle_method_register_focus(GDBusMethodInvocation* invocation)
 #ifdef USE_SECURITY
        GVariant* cookie_data;
 #endif /* USE_SECURITY */
+#else
+       int pid = 0;
 #endif /* SUPPORT_CONTAINER */
 
 
@@ -427,7 +387,7 @@ send_reply:
 static void handle_method_watch_focus(GDBusMethodInvocation* invocation)
 {
        int ret = MM_ERROR_NONE;
-       int pid = 0, handle_id = 0, focus_type = 0;
+       int handle_id = 0, focus_type = 0;
        GVariant *params = NULL;
 #ifdef SUPPORT_CONTAINER
        int container_pid = -1;
@@ -435,6 +395,8 @@ static void handle_method_watch_focus(GDBusMethodInvocation* invocation)
 #ifdef USE_SECURITY
        GVariant* cookie_data;
 #endif /* USE_SECURITY */
+#else
+       int pid = 0;
 #endif /* SUPPORT_CONTAINER */
 
        debug_fenter();
@@ -593,7 +555,6 @@ static void handle_signal(GDBusConnection  *connection,
 static void on_bus_acquired(GDBusConnection *connection, const gchar *name, gpointer user_data)
 {
        guint reg_id;
-       guint subs_id;
        debug_log("Bus Acquired (%s)", name);
 
        conn_g = connection;
@@ -608,15 +569,6 @@ static void on_bus_acquired(GDBusConnection *connection, const gchar *name, gpoi
                debug_error("Register object(%s) failed", OBJECT_FOCUS_SERVER);
                return ;
        }
-#if 0
-       subs_id = g_dbus_connection_signal_subscribe(connection, NULL, INTERFACE_ASM, "EmergentExit", OBJECT_ASM, \
-                        NULL, G_DBUS_SIGNAL_FLAGS_NONE, handle_signal, NULL, NULL );
-
-       if (!subs_id) {
-               debug_error ("g_dbus_connection_signal_subscribe() failed ");
-               return;
-       }
-#endif
 }
 
 static void on_name_acquired(GDBusConnection *connection, const gchar *name, gpointer user_data)
@@ -668,8 +620,6 @@ int __mm_sound_mgr_focus_dbus_get_stream_list(stream_list_t* stream_list)
        GError *err = NULL;
        int i = 0;
 
-       g_type_init();
-
        conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
        if (!conn && err) {
                LOGE("g_bus_get_sync() error (%s)", err->message);
index df6214f..d5af16b 100644 (file)
@@ -45,7 +45,7 @@
 
 #ifdef SUPPORT_CONTAINER
 // method + add callback
-int __mm_sound_mgr_focus_ipc_register_focus(int client_pid, int handle_id, char* stream_type, const char* container_name, int container_pid)
+int __mm_sound_mgr_focus_ipc_register_focus(int client_pid, int handle_id, const char* stream_type, const char* container_name, int container_pid)
 {
        _mm_sound_mgr_focus_param_t param;
        int ret = MM_ERROR_NONE;
@@ -57,12 +57,12 @@ int __mm_sound_mgr_focus_ipc_register_focus(int client_pid, int handle_id, char*
 
        ret = mm_sound_mgr_focus_create_node(&param);
 
-       _mm_sound_mgr_focus_update_container_data(client_pid, handle_id, container_name, container_pid);
+       mm_sound_mgr_focus_update_container_data(client_pid, handle_id, container_name, container_pid);
 
        return ret;
 }
 #else
-int __mm_sound_mgr_focus_ipc_register_focus(int client_pid, int handle_id, char* stream_type)
+int __mm_sound_mgr_focus_ipc_register_focus(int client_pid, int handle_id, const char* stream_type)
 {
        _mm_sound_mgr_focus_param_t param;
        int ret = MM_ERROR_NONE;
@@ -139,7 +139,7 @@ int __mm_sound_mgr_focus_ipc_watch_focus(int pid, int handle_id, int focus_type,
        param.request_type = focus_type;
 
        ret = mm_sound_mgr_focus_set_watch_cb(&param);
-       _mm_sound_mgr_focus_update_container_data(pid, -1, container_name, container_pid);
+       mm_sound_mgr_focus_update_container_data(pid, -1, container_name, container_pid);
 
        return ret;
 }
index addd142..5db0a89 100644 (file)
@@ -354,7 +354,7 @@ int mm_sound_client_play_sound(MMSoundPlayParam *param, int tone, int *handle)
        }
 
        if (is_focus_registered)
-               param->skip_session == true;
+               param->skip_session = true;
 
        if (param->skip_session == false) {
                if(MM_ERROR_NONE != _mm_session_util_read_information(-1, &session_type, &session_options))
index b8f17d2..89d4c71 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-sound
 Summary:    MMSound Package contains client lib and sound_server binary
-Version:    0.9.246
+Version:    0.9.247
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0