Fix SVACE, Coverity issues and build warnings 69/281369/1 accepted/tizen/unified/20220919.021608
authorTaeminYeom <taemin.yeom@samsung.com>
Fri, 16 Sep 2022 06:00:46 +0000 (15:00 +0900)
committerTaeminYeom <taemin.yeom@samsung.com>
Fri, 16 Sep 2022 06:00:46 +0000 (15:00 +0900)
Change-Id: I70cf97cdfc627c640db7eab0912044f1fb0e33ce
Signed-off-by: TaeminYeom <taemin.yeom@samsung.com>
src/api/api-sensor-internal.cpp
src/api/sensor-listener.cpp
src/api/sensor-provider.cpp
src/shared/channel.cpp

index 99a1ba6..db98eb0 100644 (file)
@@ -571,7 +571,8 @@ API bool sensord_start(int handle, int option)
        sensor::sensor_listener *listener;
        int prev_pause;
        int pause;
-       int interval, batch_latency;
+       int interval;
+       unsigned int batch_latency;
 
        AUTOLOCK(lock);
 
index 224f25a..4dbb18d 100644 (file)
@@ -75,6 +75,7 @@ sensor_listener::sensor_listener(sensor_t sensor, GMainLoop *loop)
 , m_attr_int_changed_handler(NULL)
 , m_attr_str_changed_handler(NULL)
 , m_loop(loop)
+, g_src(NULL)
 , m_connected(false)
 , m_started(false)
 {
index a4693cd..eb11fa9 100644 (file)
@@ -56,7 +56,9 @@ static gboolean provider_handler(GIOChannel *ch, GIOCondition condition, gpointe
 }
 
 sensor_provider::sensor_provider(const char *uri)
-: m_connected(false)
+: g_src(NULL)
+, m_socket(NULL)
+, m_connected(false)
 , m_start_cb(NULL)
 , m_stop_cb(NULL)
 , m_interval_changed_cb(NULL)
@@ -65,7 +67,6 @@ sensor_provider::sensor_provider(const char *uri)
 , m_stop_user_data(NULL)
 , m_interval_changed_user_data(NULL)
 , m_attribute_str_user_data(NULL)
-, g_src(NULL)
 {
        init(uri);
        m_loop = g_main_loop_new(NULL, FALSE);
@@ -155,7 +156,7 @@ int sensor_provider::send_sensor_info(sensor_info *info)
 int sensor_provider::connect(void)
 {
        m_socket = new(std::nothrow) ipc::socket();
-       retvm_if(!m_socket, NULL, "Failed to allocate memory");
+       retvm_if(!m_socket, 0, "Failed to allocate memory");
 
        if (!m_socket->create(SENSOR_CHANNEL_PATH)) {
                delete m_socket;
@@ -168,7 +169,7 @@ int sensor_provider::connect(void)
        GIOChannel *ch = NULL;
 
        ch = g_io_channel_unix_new(m_socket->get_fd());
-       retvm_if(!ch, NULL, "Failed to create g_io_channel_unix_new");
+       retvm_if(!ch, 0, "Failed to create g_io_channel_unix_new");
 
        g_src = g_io_create_watch(ch, (GIOCondition) (ipc::EVENT_IN | ipc::EVENT_HUP | ipc::EVENT_NVAL));
        g_io_channel_unref(ch);
index 6308b48..06502c8 100644 (file)
@@ -164,7 +164,7 @@ uint64_t channel::bind(event_loop *loop, bool loop_bind)
 uint64_t channel::connect(channel_handler *handler, event_loop *loop, bool loop_bind)
 {
        m_socket = new(std::nothrow) socket();
-       retvm_if(!m_socket, NULL, "Failed to allocate memory");
+       retvm_if(!m_socket, 0, "Failed to allocate memory");
 
        if (!m_socket->create(SENSOR_CHANNEL_PATH)) {
                delete m_socket;
@@ -175,7 +175,7 @@ uint64_t channel::connect(channel_handler *handler, event_loop *loop, bool loop_
                return 0;
 
        m_handler = new(std::nothrow) channel_event_handler(this, handler);
-       retvm_if(!m_handler, NULL, "Failed to allocate memory");
+       retvm_if(!m_handler, 0, "Failed to allocate memory");
 
        bind(loop, loop_bind);