Correct format specifiers in test app 00/226800/1 submit/tizen/20200324.064811
authorDewal Agarwal <d1.agarwal@samsung.com>
Thu, 27 Feb 2020 09:37:01 +0000 (15:07 +0530)
committerDewal Agarwal <d1.agarwal@samsung.com>
Thu, 5 Mar 2020 10:30:05 +0000 (10:30 +0000)
Change-Id: Ie150ee419dc7fd8f4e6a201d2753101e43895005
Signed-off-by: Dewal Agarwal <d1.agarwal@samsung.com>
test/test_cli_app/src/bmt_usage.c

index b20c9c7..6861a5d 100644 (file)
@@ -46,22 +46,24 @@ static gboolean bmt_testapp_get_total_usage_by_app_id()
  * battery_usage - battery usage consumption for the app-id
 */
 
-       char app_name[56];
+       char app_name[56] = {0, };
        int duration = -1;
        int error_code = BATTERY_MONITOR_ERROR_NONE;
        int battery_usage = -1;
 
        testapp_print("\n Input AppID using Look Up table:\n");
-       if (0 >= scanf("%55[^\n]", app_name)) {
+       if (0 >= scanf("%55s", app_name)) {
                testapp_print("Invalid input ");
                return FALSE;
        }
+       testapp_print("\n AppID: %s \n", app_name);
 
        testapp_print("\n Input Duration using Look Up table:\n");
        if (0 >= scanf("%d", &duration)) {
                testapp_print("Invalid input ");
                return FALSE;
        }
+       testapp_print("\n Duration: %d \n", duration);
 
        error_code = battery_monitor_get_total_usage_by_app_id(app_name, duration, &battery_usage);
        if (error_code == BATTERY_MONITOR_ERROR_NONE)
@@ -89,12 +91,14 @@ static gboolean bmt_testapp_get_total_usage_by_resource_id()
                testapp_print("Invalid input ");
                return FALSE;
        }
+       testapp_print("\n ResourceID: %d \n", resource_id);
 
        testapp_print("\n Input Duration using Look Up table:\n");
        if (0 >= scanf("%d", &duration)) {
                testapp_print("Invalid input ");
                return FALSE;
        }
+       testapp_print("\n Duration: %d \n", duration);
 
        error_code = battery_monitor_get_total_usage_by_resource_id(resource_id, duration, &battery_usage);
        if (error_code == BATTERY_MONITOR_ERROR_NONE)
@@ -113,22 +117,24 @@ static gboolean bmt_testapp_get_total_usage_by_app_id_for_all_resource_id()
 */
 
        int duration = -1;
-       char app_name[56];
+       char app_name[56] = {0, };
        int error_code = BATTERY_MONITOR_ERROR_NONE;
 
        battery_monitor_h data_handle = NULL;
 
        testapp_print("\n Input AppID using Look Up table:\n");
-       if (0 >= scanf("%55[^\n]", app_name)) {
+       if (0 >= scanf("%55s", app_name)) {
                testapp_print("Invalid input ");
                return FALSE;
        }
+       testapp_print("\n AppID: %s \n", app_name);
 
        testapp_print("\n Input Duration using Look Up table:\n");
        if (0 >= scanf("%d", &duration)) {
                testapp_print("Invalid input ");
                return FALSE;
        }
+       testapp_print("\n Duration: %d \n", duration);
 
        error_code = battery_monitor_get_usage_by_app_id_for_all_resource_id(app_name, duration, &data_handle);
 
@@ -195,28 +201,31 @@ static gboolean bmt_testapp_get_total_usage_by_app_id_for_resource_id()
  */
 
        int duration = -1;
-       char app_name[56];
+       char app_name[56] = {0, };
        int battery_usage = -1;
        int resource_id = -1;
        int error_code = BATTERY_MONITOR_ERROR_NONE;
 
        testapp_print("\n Input AppID using Look Up table:\n");
-       if (0 >= scanf("%55[^\n]", app_name)) {
-               testapp_print("Invalid input ");
+       if (0 >= scanf("%55s", app_name)) {
+               testapp_print("Invalid input");
                return FALSE;
        }
+       testapp_print("\n AppID: %s \n", app_name);
 
        testapp_print("\n Input Duration using Look Up table:\n");
        if (0 >= scanf("%d", &duration)) {
                testapp_print("Invalid input ");
                return FALSE;
        }
+       testapp_print("\n Duration: %d \n", duration);
 
        testapp_print("\n Input Resource Id using Look Up Table: \n");
        if (0 >= scanf("%d", &resource_id)) {
                testapp_print("Invalid input ");
                return FALSE;
        }
+       testapp_print("\n ResourceID: %d \n", resource_id);
 
        error_code = battery_monitor_get_usage_by_app_id_for_resource_id(app_name, resource_id, duration, &battery_usage);