From: TaeminYeom Date: Fri, 16 Sep 2022 06:00:46 +0000 (+0900) Subject: Fix SVACE, Coverity issues and build warnings X-Git-Tag: accepted/tizen/unified/20220919.021608^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6c8ae53684ac07f6ff6d5ad018c6ffa727b9e657;p=platform%2Fcore%2Fapi%2Fsensor.git Fix SVACE, Coverity issues and build warnings Change-Id: I70cf97cdfc627c640db7eab0912044f1fb0e33ce Signed-off-by: TaeminYeom --- diff --git a/src/api/api-sensor-internal.cpp b/src/api/api-sensor-internal.cpp index 99a1ba6..db98eb0 100644 --- a/src/api/api-sensor-internal.cpp +++ b/src/api/api-sensor-internal.cpp @@ -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); diff --git a/src/api/sensor-listener.cpp b/src/api/sensor-listener.cpp index 224f25a..4dbb18d 100644 --- a/src/api/sensor-listener.cpp +++ b/src/api/sensor-listener.cpp @@ -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) { diff --git a/src/api/sensor-provider.cpp b/src/api/sensor-provider.cpp index a4693cd..eb11fa9 100644 --- a/src/api/sensor-provider.cpp +++ b/src/api/sensor-provider.cpp @@ -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); diff --git a/src/shared/channel.cpp b/src/shared/channel.cpp index 6308b48..06502c8 100644 --- a/src/shared/channel.cpp +++ b/src/shared/channel.cpp @@ -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);