[ITC][SVACE-Fix][Fixed SVACE defects for ITC modules]
authorABHISHEK JAIN <j.abhishek@samsung.com>
Tue, 16 Oct 2018 09:19:02 +0000 (14:49 +0530)
committerABHISHEK JAIN <j.abhishek@samsung.com>
Tue, 16 Oct 2018 11:40:30 +0000 (17:10 +0530)
Change-Id: Ib6db4d55156dc7d03a806dbae89c0d0542ea8389
Signed-off-by: ABHISHEK JAIN <j.abhishek@samsung.com>
src/itc/base-utils/ITs-base-utils-loc-disp-names.c
src/itc/capi-network-inm/ITs-capi-network-inm-common.c
src/itc/capi-network-inm/ITs-capi-network-inm.c
src/itc/capi-network-softap/ITs-capi-network-softap.c
src/itc/media-content/ITs-media-content-audio-meta.c
src/itc/media-content/ITs-media-content-image-meta.c
src/itc/media-content/ITs-media-content-info.c
src/itc/media-content/ITs-media-content-video-meta.c
src/itc/wifi-manager/ITs-wifi-manager-config.c

index 18507a4383a78f71abbbf5aeed4b5e7665f6a7c7..a7e3ef4a610daaa1c59ffc92d4c6863dc529d048 100755 (executable)
@@ -50,7 +50,7 @@ void ITs_base_utils_loc_disp_names_cleanup(void)
        if(g_hLocDisp != NULL)
        {
                int nRet =i18n_loc_disp_names_destroy(g_hLocDisp);
-               FPRINTF(I18N_ERROR_NONE, nRet, "i18n_loc_disp_names_destroy", BaseUtilsGetError(nRet));
+               FPRINTF("[Line : %d][%s] g_hLocDisp handle destroy failed. \\n", __LINE__, API_NAMESPACE);
                g_hLocDisp = NULL;
        }
        return;
@@ -139,7 +139,7 @@ int ITs_base_utils_i18n_loc_disp_names_create_from_dialect_p(void)
                if(hLocDisp == NULL)
                {
                        FPRINTF("[Line : %d][%s] hLocDisp handle creation failed. dialect = %d. \\n", __LINE__, API_NAMESPACE,eDialect[nCounter]);
-                       bLocaleFail = false;
+                       bLocaleFail = true;
                }
                else
                {
@@ -295,7 +295,7 @@ int ITs_base_utils_i18n_loc_disp_names_get_context_p(void)
                int nRet = i18n_loc_disp_names_get_context(g_hLocDisp, eType[nCounter], &eContext);
                PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_loc_disp_names_get_context", BaseUtilsGetError(nRet));
 
-               if( !(eContext == (eType[nCounter] << 8 + 0) || eContext == (eType[nCounter] << 8 + 1) || eContext == (eType[nCounter] << 8 + 1) || eContext == (eType[nCounter]<< 8 + 2) || eContext == (eType[nCounter] << 8 + 3) || eContext == (eType[nCounter]<< 8 + 4) ))
+               if( !(eContext == (eType[nCounter] << 8 + 0) || eContext == (eType[nCounter] << 8 + 1) || eContext == (eType[nCounter]<< 8 + 2) || eContext == (eType[nCounter] << 8 + 3) || eContext == (eType[nCounter]<< 8 + 4) ))
                {
                        FPRINTF("[Line : %d][%s] i18n_loc_disp_names_get_context mismatch. eContext = %d. \\n", __LINE__, API_NAMESPACE, eContext);
                        bContext = true;
index 814ecf774c48f44a180b87af15d83c8f256e8b02..e6cf6dcae107b707a77a6be926b39c1096a24b9c 100755 (executable)
@@ -237,20 +237,21 @@ void InmWifiScanStateChangedCallback(inm_wifi_scan_state_e state, void* user_dat
 
 bool   InmConnectionStateChangedCallback(inm_connection_state_e state, void* user_data)
 {
-       char *pszProfileName;
+       char *pszProfileName = NULL;
        inm_connection_h profile = user_data;
 
        if (profile == NULL)
-               return;
+               return false;
 
        int nRet = inm_connection_get_name(profile, NULL);
        PRINT_RETURN("inm_connection_get_name", nRet);
        if (nRet != INM_ERROR_NONE) {
                FREE_MEMORY_TC(pszProfileName);
-               return;
+               return false;
        }
        g_nCallbackRet = true;
        FREE_MEMORY_TC(pszProfileName);
+       return true;
 }
 
 bool InmWifiApForeachVsieCallback(unsigned char *vsie_bytes, int vsie_len, void *user_data)
index 1f29f6dc001541010d4a712227ca681afaaf0dfb..113f25617763dd37166a6068e327bf532f00b40f 100755 (executable)
@@ -416,9 +416,9 @@ int ITc_inm_get_statistics_p(void)
        int nStatTypeSize = sizeof(eStatType)/sizeof(eStatType[0]);
        int nConnectionTypeSize = sizeof(eConnectionType)/sizeof(eConnectionType[0]);
 
-       for(int connectionTypeIndex = 0; connectionTypeIndex<nConnectionTypeSize; connectionTypeIndex++)
+       for(int connectionTypeIndex = 0; connectionTypeIndex < nConnectionTypeSize; connectionTypeIndex++)
        {
-               for(int statTypeIndex = 0; statTypeIndex<=nStatTypeSize; statTypeIndex++)
+               for(int statTypeIndex = 0; statTypeIndex < nStatTypeSize; statTypeIndex++)
                {
                        llStat=0;
                        nRet = inm_get_statistics(g_hInm, eConnectionType[connectionTypeIndex], eStatType[statTypeIndex], &llStat);
@@ -428,11 +428,14 @@ int ITc_inm_get_statistics_p(void)
                                return 0;
                        }
                        PRINT_RESULT(nRet, INM_ERROR_NONE, "inm_get_statistics", InmGetError(nRet));
-                       if(llStat<0)
+
+// This variable needs to be checked whether within range.
+/*                     if(llStat< 0)
                        {
                                FPRINTF("[Line : %d][%s] %s failed. Stat value = %ull\\n", __LINE__, API_NAMESPACE, "inm_get_statistics", llStat);
                                return 1;
                        }
+*/
                }
        }
 
@@ -482,9 +485,9 @@ int ITc_inm_reset_statistics_p(void)
        int nStatTypeSize = sizeof(eStatType)/sizeof(eStatType[0]);
        int nConnectionTypeSize = sizeof(eConnectionType)/sizeof(eConnectionType[0]);
 
-       for(int connectionTypeIndex = 0; connectionTypeIndex<nConnectionTypeSize; connectionTypeIndex++)
+       for(int connectionTypeIndex = 0; connectionTypeIndex < nConnectionTypeSize; connectionTypeIndex++)
        {
-               for(int statTypeIndex = 0; statTypeIndex<=nStatTypeSize; statTypeIndex++)
+               for(int statTypeIndex = 0; statTypeIndex < nStatTypeSize; statTypeIndex++)
                {
                        nRet = inm_reset_statistics(g_hInm, eConnectionType[connectionTypeIndex], eStatType[statTypeIndex]);
                        if(!bConnectionTypeFeatureChecks[connectionTypeIndex])
index d4aa3364f492e1c0881b34b87d38eeab60819b51..3b38487a0b94fd55b503b1e3d04fb9b51352c1e4 100644 (file)
@@ -476,7 +476,7 @@ int ITs_softap_set_get_ssid_p(void)
 {
        START_TEST_CHECK_INITIALIZE
        int nRet = 0;
-        const char *sSid = "ABCDEFGH";
+        const char sSid[] = "ABCDEFGH";
        nRet = softap_set_ssid(g_hSoftapHandle, sSid);
        PRINT_RESULT(SOFTAP_ERROR_NONE, nRet, "softap_set_ssid", SoftApGetError(nRet));
 
@@ -484,15 +484,13 @@ int ITs_softap_set_get_ssid_p(void)
        nRet = softap_get_ssid(g_hSoftapHandle, &sRetSid);
        PRINT_RESULT_CLEANUP(SOFTAP_ERROR_NONE, nRet, "softap_get_ssid", SoftApGetError(nRet),FREE_MEMORY(sRetSid));
 
-       if(strncmp(sSid, sRetSid,sizeof(sSid)) != 0)
+       if(strncmp(sSid, sRetSid, sizeof(sSid)) != 0)
        {
                FPRINTF("\\n[Line : %d][%s] softap_get_ssid Failed returned wrong value = %s, error returned = %s", __LINE__, API_NAMESPACE, sRetSid, SoftApGetError(nRet));
-               if(sRetSid)
-                 FREE_MEMORY(sRetSid);
-                return 1;
+               FREE_MEMORY(sRetSid);
+               return 1;
        }
-       if(sRetSid)
-         FREE_MEMORY(sRetSid);
+       FREE_MEMORY(sRetSid);
        return 0;
 }
 //& purpose:  Set and get ssid visibility.
@@ -774,7 +772,7 @@ int ITs_softap_set_get_mode_p(void)
        int nEnumSize = sizeof(eSetMode) / sizeof(eSetMode[0]);
        int enum_counter = 0;
        softap_wireless_mode_e eGetMode;
-       for(int enum_counter = 0; enum_counter < nEnumSize; enum_counter)
+       for(int enum_counter = 0; enum_counter < nEnumSize; enum_counter++)
        {
                nRet = softap_set_mode(g_hSoftapHandle, eSetMode[enum_counter]);
                PRINT_RESULT(SOFTAP_ERROR_NONE, nRet, "softap_set_mode", SoftApGetError(nRet));
index 9d22ea345363b23162a46aad7509330d77a64799..f44aa4feeb58cf25cc7fd37d6f96c9920e532911 100755 (executable)
@@ -99,7 +99,14 @@ void ITs_media_content_audio_meta_cleanup(void)
        }
        if(g_bMediaContentStartup && g_bIsScanFeatureSupported)
        {
-               remove("audio");
+               struct stat stBuff;
+               if ( stat("audio", &stBuff) == 0 )
+               {
+                       if (remove("audio"))
+                       {
+                               FPRINTF("[Line : %d][%s] TEST SUIT clean-up FAIL because the ERR_LOG file is not removed\\n", __LINE__, API_NAMESPACE);
+                       }
+               }
                if(g_szAudioPath)
                {
                        media_content_scan_file(g_szAudioPath);
index 631670dc402d4b48aa167e9ecb16ec571de0bced..ffe4eacda70d166e740db7e5f2efa80ff2833349 100755 (executable)
@@ -114,7 +114,14 @@ void ITs_media_content_image_meta_cleanup(void)
        }
        if(g_bMediaContentStartup && g_bIsScanFeatureSupported)
        {
-               remove("image");
+               struct stat stBuff;
+               if ( stat("image", &stBuff) == 0 )
+               {
+                       if (remove("image"))
+                       {
+                               FPRINTF("[Line : %d][%s] TEST SUIT clean-up FAIL because the ERR_LOG file is not removed\\n", __LINE__, API_NAMESPACE);
+                       }
+               }
                if(g_szImagePath)
                {
                        media_content_scan_file(g_szImagePath);
index 0f6aca21c2cce7141d32e4d0f58cc53f22f58ff8..ef72f315fa1c556ff6be730ce23b51a2ac3f9117 100755 (executable)
@@ -710,7 +710,7 @@ int ITc_media_info_insert_to_db_p(void)
        nRet = media_info_get_media_id(g_hAudioInfo, &pszMediaId);
        PRINT_RESULT(MEDIA_CONTENT_ERROR_NONE, nRet, "media_info_get_media_id", MediaContentGetError(nRet));
        memset(g_szAudioId, 0, PATHLEN);
-       strcpy(g_szAudioId, pszMediaId);
+       strncpy(g_szAudioId, pszMediaId, sizeof(g_szAudioId));
        FREE_MEMORY(pszMediaId);
 
        return 0;
index e9c0b88e7c5fc4fc8d8bef0e2febd083e8995562..d103c68be28e1f8bb764e300d4ea5111573c13fa 100755 (executable)
@@ -99,7 +99,14 @@ void ITs_media_content_video_meta_cleanup(void)
        }
        if(g_bMediaContentStartup && g_bIsScanFeatureSupported)
        {
-               remove("video");
+               struct stat stBuff;
+               if ( stat("video", &stBuff) == 0 )
+               {
+                       if (remove("video"))
+                       {
+                               FPRINTF("[Line : %d][%s] TEST SUIT clean-up FAIL because the ERR_LOG file is not removed\\n", __LINE__, API_NAMESPACE);
+                       }
+               }
                if(g_szVideoPath)
                {
                        media_content_scan_file(g_szVideoPath);
index d78a1bf005f9523b81e4133222be01955d8ca2bf..e119539e934ea6b572b53ade83efa2720e8c4589 100755 (executable)
@@ -1089,7 +1089,7 @@ int ITc_wifi_manager_config_set_get_dns_address_p(void)
                        PRINT_RESULT(nRet, WIFI_MANAGER_ERROR_NONE, "wifi_manager_config_get_dns_address", WifiManagerGetError(nRet));
                        CHECK_HANDLE(pszGetdnsAddress, "wifi_manager_config_get_dns_address");
 
-                       if( strncmp(pszGetdnsAddress, pszSetDnsAddress[nOrderIndex], sizeof (pszGetdnsAddress)) != 0)
+                       if( strncmp(pszSetDnsAddress[nOrderIndex], pszGetdnsAddress, sizeof(pszSetDnsAddress[nOrderIndex])) != 0)
                        {
                                FPRINTF("[Line : %d][%s] %s failed. mismatch in expected: %s and returned: %s\\n", __LINE__,API_NAMESPACE, "wifi_manager_config_set_get_dns_address", pszSetDnsAddress[nOrderIndex], pszGetdnsAddress);
                                FREE_MEMORY(pszGetdnsAddress);