summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packaging/capi-network-ua.spec2
-rw-r--r--test/uat-devices.c23
-rw-r--r--test/uat-init.c3
-rw-r--r--test/uat-menu.c4
-rw-r--r--test/uat-sensors.c9
5 files changed, 22 insertions, 19 deletions
diff --git a/packaging/capi-network-ua.spec b/packaging/capi-network-ua.spec
index b86c856..732f610 100644
--- a/packaging/capi-network-ua.spec
+++ b/packaging/capi-network-ua.spec
@@ -1,6 +1,6 @@
Name: capi-network-ua
Summary: User Awareness Framework CAPI
-Version: 0.6.0
+Version: 0.6.1
Release: 1
License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
diff --git a/test/uat-devices.c b/test/uat-devices.c
index dddce90..5308ddb 100644
--- a/test/uat-devices.c
+++ b/test/uat-devices.c
@@ -291,7 +291,7 @@ static int run_ua_device_destroy(
ret = ua_device_destroy(g_device_h);
g_device_h = NULL;
- snprintf(g_sensor_type_str, MENU_DATA_SIZE, "N/A");
+ snprintf(g_sensor_type_str, strlen("N/A"), "N/A");
msg(" - ua_device_destroy() ret: [0x%X] [%s]",
ret, uat_get_error_str(ret));
@@ -309,7 +309,7 @@ static int run_ua_device_set_mac_type(
if (strlen(g_sensor_type)) {
mac_type = (unsigned char)strtol(g_sensor_type, NULL, 10);
- snprintf(g_sensor_type_str, MENU_DATA_SIZE, "%s",
+ snprintf(g_sensor_type_str, sizeof(g_sensor_type_str), "%s",
uat_get_sensor_str(mac_type));
}
@@ -338,13 +338,14 @@ static void update_device_info(void)
ret = ua_device_get_mac_type(g_device_h, &mac_type);
if (UA_ERROR_NONE == ret) {
memset(g_sensor_type_str, 0, MENU_DATA_SIZE + 1);
- snprintf(g_sensor_type_str, MENU_DATA_SIZE, "%s",
+ snprintf(g_sensor_type_str, sizeof(g_sensor_type_str), "%s",
uat_get_mac_type_str(mac_type));
- snprintf(g_sensor_type, MENU_DATA_SIZE, "%d", _convert_mac_type_to_idx(mac_type));
+ snprintf(g_sensor_type, sizeof(g_sensor_type), "%d",
+ _convert_mac_type_to_idx(mac_type));
}
ret = ua_device_get_os_info(g_device_h, &ostype);
- snprintf(g_os_type_str, MENU_DATA_SIZE, "%s",
+ snprintf(g_os_type_str, sizeof(g_os_type_str), "%s",
ostype == 1 ? "Tizen" :
ostype == 2 ? "Android" :
ostype == 3 ? "iOS" : "N/A");
@@ -352,33 +353,33 @@ static void update_device_info(void)
ret = ua_device_get_mobile_id(g_device_h, &mobile_device_id);
if (UA_ERROR_NONE == ret && mobile_device_id) {
memset(g_mobile_id_str, 0, MENU_DATA_SIZE + 1);
- memcpy(g_mobile_id_str, mobile_device_id, MENU_DATA_SIZE);
+ memcpy(g_mobile_id_str, mobile_device_id, sizeof(g_mobile_id_str));
g_free(mobile_device_id);
}
ret = ua_device_get_mac_address(g_device_h, &mac);
if (UA_ERROR_NONE == ret && mac) {
memset(g_mac_address_str, 0, MENU_DATA_SIZE + 1);
- memcpy(g_mac_address_str, mac, MENU_DATA_SIZE);
+ memcpy(g_mac_address_str, mac, sizeof(g_mac_address_str));
g_free(mac);
}
ret = ua_device_get_wifi_bssid(g_device_h, &wifi_bssid);
if (UA_ERROR_NONE == ret && wifi_bssid) {
memset(g_bss_id_str, 0, MENU_DATA_SIZE + 1);
- memcpy(g_bss_id_str, wifi_bssid, MENU_DATA_SIZE);
+ memcpy(g_bss_id_str, wifi_bssid, sizeof(g_bss_id_str));
g_free(wifi_bssid);
}
ret = ua_device_get_discriminant(g_device_h, &discriminant);
if (UA_ERROR_NONE == ret) {
- snprintf(g_discriminant, MENU_DATA_SIZE, "%d", discriminant ? 1 : 0);
+ snprintf(g_discriminant, sizeof(g_discriminant), "%d", discriminant ? 1 : 0);
}
ret = ua_device_get_wifi_ipv4_address(g_device_h, &ipv4);
if (UA_ERROR_NONE == ret && ipv4) {
memset(g_ipv4_address_str, 0, MENU_DATA_SIZE + 1);
- memcpy(g_ipv4_address_str, ipv4, MENU_DATA_SIZE);
+ memcpy(g_ipv4_address_str, ipv4, sizeof(g_ipv4_address_str));
g_free(ipv4);
}
@@ -407,7 +408,7 @@ static int run_ua_device_set_os_info(
else if (ostype < UA_OS_TYPE_NOT_DEFINE)
ostype = UA_OS_TYPE_TIZEN;
- snprintf(g_os_type_str, MENU_DATA_SIZE, "%s",
+ snprintf(g_os_type_str, sizeof(g_os_type_str), "%s",
ostype == 1 ? "Tizen" :
ostype == 2 ? "Android" :
ostype == 3 ? "iOS" : "N/A");
diff --git a/test/uat-init.c b/test/uat-init.c
index a2cdac0..e8c66fa 100644
--- a/test/uat-init.c
+++ b/test/uat-init.c
@@ -108,7 +108,8 @@ static int run_ua_monitor_create(MManager *mm, struct menu_data *menu)
g_sensor_list |= i;
buf = uat_get_sensor_bitmask_str(i);
- strncat(g_sensor_list_str, buf, strnlen(buf, MENU_DATA_SIZE));
+ strncat(g_sensor_list_str, buf,
+ sizeof(g_sensor_list_str) - strlen(g_sensor_list_str) - 1);
strncat(g_sensor_list_str, " ", 2);
}
diff --git a/test/uat-menu.c b/test/uat-menu.c
index 4a88dcb..7ad706b 100644
--- a/test/uat-menu.c
+++ b/test/uat-menu.c
@@ -162,7 +162,7 @@ static void _show_menu(MManager *m, struct menu_data menu[])
memset(title_buf, 0, 256);
if (item->title) {
- snprintf(title_buf, MAX_TITLE, "%s", item->title);
+ snprintf(title_buf, sizeof(title_buf), "%s", item->title);
if (strlen(item->title) >= MAX_TITLE) {
title_buf[MAX_TITLE - 2] = '.';
@@ -343,7 +343,7 @@ gboolean on_menu_manager_keyboard(GIOChannel *src, GIOCondition con,
MManager *mm = data;
char local_buf[MENU_DATA_SIZE + 1] = { 0, };
- if (fgets(local_buf, MENU_DATA_SIZE, stdin) == NULL)
+ if (fgets(local_buf, sizeof(local_buf), stdin) == NULL)
return TRUE;
if (strlen(local_buf) > 0) {
diff --git a/test/uat-sensors.c b/test/uat-sensors.c
index efc9d6a..8a955ac 100644
--- a/test/uat-sensors.c
+++ b/test/uat-sensors.c
@@ -70,7 +70,8 @@ static unsigned int __sensor_type_to_bitmask(int idx)
static bool __ua_monitor_foreach_sensor_cb(ua_sensor_e sensor, void *user_data)
{
const char *buf = uat_get_sensor_bitmask_str(sensor);
- strncat(g_sensor_list_str, buf, strnlen(buf, MENU_DATA_SIZE));
+ strncat(g_sensor_list_str, buf,
+ sizeof(g_sensor_list_str) - strlen(g_sensor_list_str) - 1);
strncat(g_sensor_list_str, " ", 2);
return TRUE;
}
@@ -94,7 +95,7 @@ static int run_ua_monitor_add_sensor(
if (strlen(g_sensor_type)) {
sensortype = (unsigned char)strtol(g_sensor_type, NULL, 10);
- snprintf(g_sensor_type_str, MENU_DATA_SIZE, "%s",
+ snprintf(g_sensor_type_str, sizeof(g_sensor_type_str), "%s",
uat_get_sensor_str(sensortype));
}
@@ -122,7 +123,7 @@ static int run_ua_monitor_remove_sensor(
if (strlen(g_sensor_type)) {
sensortype = (unsigned char)strtol(g_sensor_type, NULL, 10);
- snprintf(g_sensor_type_str, MENU_DATA_SIZE, "%s",
+ snprintf(g_sensor_type_str, sizeof(g_sensor_type_str), "%s",
uat_get_sensor_str(sensortype));
}
@@ -152,7 +153,7 @@ static int run_ua_monitor_is_sensor_available(
if (strlen(g_sensor_type)) {
sensortype = (unsigned char)strtol(g_sensor_type, NULL, 10);
- snprintf(g_sensor_type_str, MENU_DATA_SIZE, "%s",
+ snprintf(g_sensor_type_str, sizeof(g_sensor_type_str), "%s",
uat_get_sensor_str(sensortype));
}