[ITC][notification/bundle][NonACR][print cleanup moodify/added] 07/245607/4
authorNibha Sharma <nibha.sharma@samsung.com>
Tue, 13 Oct 2020 06:22:48 +0000 (11:52 +0530)
committershobhit verma <shobhit.v@samsung.com>
Tue, 13 Oct 2020 07:08:30 +0000 (07:08 +0000)
Change-Id: I74dd1a1c75a51446e4e7aad64849aaca82f88652
Signed-off-by: Nibha Sharma <nibha.sharma@samsung.com>
src/itc/bundle/ITs-bundle-common.h
src/itc/bundle/ITs-bundle.c
src/itc/notification/ITs-notification.c

index 106ff65fec89443632287e71e8bc4a45d9687e6a..b6fb5171710d14707a6d8cd4c32b3649139d4ad2 100755 (executable)
        }\
 }
 
+#define CHECK_HANDLE_CLEANUP(Handle, API, FreeResource) {\
+       if ( Handle == NULL )\
+{\
+       FPRINTF("[Line : %d][%s] %s failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE, API);\
+       FreeResource;\
+       return 1;\
+}\
+}
+
 /**
 * @function            BundleGetType
 * @description         Maps Types of given values to string.
index 7d0a4787e846bf161f56afbd30584fc6b26332e6..9882c1702fb6c803a7d096c690e613fac386a57a 100755 (executable)
@@ -171,11 +171,11 @@ int ITc_bundle_encode_decode_p(void)
        {
                char* pTempBundleStr = NULL;
                nRetVal = bundle_get_str(tempBundle, (char *)KEY1, &pTempBundleStr);
-               PRINT_RESULT(BUNDLE_ERROR_NONE, nRetVal, "bundle_get_str", BundleGetError(nRetVal));
-               CHECK_HANDLE(pTempBundleStr,"bundle_get_str");
+               PRINT_RESULT_CLEANUP(BUNDLE_ERROR_NONE, nRetVal, "bundle_get_str", BundleGetError(nRetVal), FREE_MEMORY(pstBundleRaw);bundle_free(tempBundle));
+               CHECK_HANDLE_CLEANUP(pTempBundleStr,"bundle_get_str",FREE_MEMORY(pstBundleRaw);bundle_free(tempBundle));
                if ( strcmp((char *)KEY1_VALUE, pTempBundleStr) != 0 )//not equal
                {
-                       FPRINTF("[Line : %d][%s] bundle_decode failed, error returned = %s\\n", __LINE__, API_NAMESPACE,  BundleGetError(nRetVal));
+                       FPRINTF("[Line : %d][%s] bundle_get_str failed, error returned = %s\\n", __LINE__, API_NAMESPACE,  BundleGetError(nRetVal));
                        FREE_MEMORY(pstBundleRaw);
                        bundle_free(tempBundle);
                        return 1;
index 4e58acda4b85a8eea7913bbb9b2f89a0b0dfc4b5..418da43a77bd83b8f555ebc929fbe32f139b15ec 100755 (executable)
@@ -1738,10 +1738,10 @@ int ITc_notification_set_get_auto_remove_p(void)
        eRetNotiErr  = notification_set_auto_remove(g_NotificationHandle, bSetAutoRmv);
        PRINT_RESULT_CLEANUP(NOTIFICATION_ERROR_NONE, eRetNotiErr, "notification_set_auto_remove", NotificationGetError(eRetNotiErr), FreeAndDeleteNotificationResourceHandle());
 
-       eRetNotiErr = notification_get_auto_remove(g_NotificationHandle, &bGetAutoRmv); 
+       eRetNotiErr = notification_get_auto_remove(g_NotificationHandle, &bGetAutoRmv);
        PRINT_RESULT_CLEANUP(NOTIFICATION_ERROR_NONE, eRetNotiErr, "notification_get_auto_remove", NotificationGetError(eRetNotiErr), FreeAndDeleteNotificationResourceHandle());
 
-       if ( bGetAutoRmv != false )
+       if ( bGetAutoRmv != bSetAutoRmv )
        {
                FPRINTF("[Line : %d][%s] set and get auto remove mis-match occurs, set auto remove = %d, get auto remove = %d\\n", __LINE__, API_NAMESPACE, bSetAutoRmv, bGetAutoRmv);
                FreeAndDeleteNotificationResourceHandle();
@@ -1857,16 +1857,16 @@ int ITc_notification_set_text_input_p(void)
        char* pSetAppID = "org.tizen.app";      //dummy app id
        notification_h hNotification;
        app_control_h hAppControl;
-       
+
        hNotification = notification_create(NOTIFICATION_TYPE_NOTI);
        CHECK_HANDLE(hNotification, "notification_create");
 
        int nRet = notification_set_text_input(hNotification, 160);
        PRINT_RESULT_CLEANUP(NOTIFICATION_ERROR_NONE, nRet, "notification_set_text_input", NotificationGetError(nRet),FREE_MEMORY(hNotification));
-       
+
        nRet  = notification_set_text(hNotification, NOTIFICATION_TEXT_TYPE_TEXT_INPUT_PLACEHOLDER, "I'm Title", "TITLE", NOTIFICATION_VARIABLE_TYPE_NONE);
        PRINT_RESULT_CLEANUP(NOTIFICATION_ERROR_NONE, nRet, "notification_set_text", NotificationGetError(nRet),FREE_MEMORY(hNotification));
-       
+
        nRet  = notification_set_text(hNotification, NOTIFICATION_TEXT_TYPE_TEXT_INPUT_BUTTON, "I'm Title", "TITLE", NOTIFICATION_VARIABLE_TYPE_NONE);
        PRINT_RESULT_CLEANUP(NOTIFICATION_ERROR_NONE, nRet, "notification_set_text", NotificationGetError(nRet),FREE_MEMORY(hNotification));
 
@@ -1875,23 +1875,24 @@ int ITc_notification_set_text_input_p(void)
        if(NULL == hAppControl)
        {
                FPRINTF("[Line : %d][%s]app_control_create returned NULL handle value\\n", __LINE__, API_NAMESPACE);
+               FREE_MEMORY(hNotification);
                return 1;
        }
 
        nRet = app_control_set_app_id(hAppControl, pSetAppID);
-       PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_app_id", Application_AppControlGetError(nRet), app_control_destroy(hAppControl););
+       PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_app_id", Application_AppControlGetError(nRet), FREE_MEMORY(hNotification);app_control_destroy(hAppControl));
 
        nRet = app_control_set_operation(hAppControl, APP_CONTROL_OPERATION_DEFAULT);
-       PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_operation", Application_AppControlGetError(nRet), app_control_destroy(hAppControl););
+       PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_operation", Application_AppControlGetError(nRet), FREE_MEMORY(hNotification);app_control_destroy(hAppControl););
 
        nRet = notification_set_event_handler(hNotification, NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON, hAppControl);
-       PRINT_RESULT_CLEANUP(NOTIFICATION_ERROR_NONE, nRet, "notification_set_event_handler", NotificationGetError(nRet), FreeAndDeleteNotificationResourceHandle();app_control_destroy(hAppControl););
+       PRINT_RESULT_CLEANUP(NOTIFICATION_ERROR_NONE, nRet, "notification_set_event_handler", NotificationGetError(nRet), FreeAndDeleteNotificationResourceHandle();FREE_MEMORY(hNotification);app_control_destroy(hAppControl););
 
        nRet = app_control_destroy(hAppControl);
-       PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "app_control_destroy", Application_AppControlGetError(nRet));
+       PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_destroy", Application_AppControlGetError(nRet),FREE_MEMORY(hNotification));
 
        nRet  = notification_post(hNotification);
-       PRINT_RESULT(APP_CONTROL_ERROR_NONE, nRet, "notification_post", Application_AppControlGetError(nRet));
+       PRINT_RESULT_NORETURN(APP_CONTROL_ERROR_NONE, nRet, "notification_post", Application_AppControlGetError(nRet));
        FREE_MEMORY(hNotification);
 
        return 0;