VirtualBox

Changeset 103285 in vbox


Ignore:
Timestamp:
Feb 8, 2024 3:27:12 PM (13 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
161579
Message:

Re-applied r161549 again (Got rid of a lot of deprecated strcpy / strcat calls; now using the IPRT pendants (found by Parfait)), left out some stuff which wasn't wanted, less bloated version of DrvAudio.cpp. bugref:3409

Location:
trunk/src/VBox
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Debugger/DBGPlugInDarwin.cpp

    r103275 r103285  
    716716            {
    717717                char szTmp[RTDBG_SEGMENT_NAME_LENGTH + sizeof("_start")];
    718                 strcat(strcpy(szTmp, aSegs[iSeg].szName), "_start");
    719                 rc = RTDbgModSymbolAdd(hMod, szTmp, iSeg, 0 /*uRva*/, 0 /*cb*/, 0 /*fFlags*/, NULL);
     718                rc = RTStrCat(RTStrCopy2(szTmp, sizeof(szTmp), aSegs[iSeg].szName), sizeof(szTmp), "_start");
     719                if (RT_SUCCESS(rc))
     720                    rc = RTDbgModSymbolAdd(hMod, szTmp, iSeg, 0 /*uRva*/, 0 /*cb*/, 0 /*fFlags*/, NULL);
    720721            }
    721722            uRvaNext += aSegs[iSeg].cb;
  • trunk/src/VBox/Devices/Audio/DrvAudio.cpp

    r103275 r103285  
    48424842#define QUERY_VAL_RET(a_Width, a_szName, a_pValue, a_uDefault, a_ExprValid, a_szValidRange) \
    48434843            do { \
    4844                 rc = RT_CONCAT(pHlp->pfnCFGMQueryU,a_Width)(pDirNode, strcpy(szNm, a_szName), a_pValue); \
     4844                AssertCompile(sizeof(szNm) - 1 >= (sizeof(a_szName) - 1) + (sizeof("Out") - 1)); \
     4845                rc = RT_CONCAT(pHlp->pfnCFGMQueryU,a_Width)(pDirNode, RTStrCopy2(szNm, sizeof(szNm), a_szName), a_pValue); \
    48454846                if (rc == VERR_CFGM_VALUE_NOT_FOUND || rc == VERR_CFGM_NO_PARENT) \
    48464847                { \
    4847                     rc = RT_CONCAT(pHlp->pfnCFGMQueryU,a_Width)(pCfg, strcat(szNm, pszDir), a_pValue); \
     4848                    rc = RT_CONCAT(pHlp->pfnCFGMQueryU,a_Width)(pCfg, RTStrCat2(szNm, sizeof(szNm), pszDir), a_pValue); \
    48484849                    if (rc == VERR_CFGM_VALUE_NOT_FOUND || rc == VERR_CFGM_NO_PARENT) \
    48494850                    { \
  • trunk/src/VBox/Devices/Network/testcase/tstIntNet-1.cpp

    r103275 r103285  
    847847    }
    848848
    849     strcat(szPath, "/../VMMR0.r0");
     849    rc = RTStrCat(szPath, sizeof(szPath), "/../VMMR0.r0");
     850    if (RT_FAILURE(rc))
     851    {
     852        RTPrintf("tstIntNet-1: RTStrCat -> %Rrc\n", rc);
     853        return 1;
     854    }
    850855
    851856    char szAbsPath[RTPATH_MAX];
  • trunk/src/VBox/HostDrivers/Support/testcase/tstInt.cpp

    r103275 r103285  
    6262    int rcRet = 0;
    6363    int i;
    64     int rc;
    6564    int cIterations = argc > 1 ? RTStrToUInt32(argv[1]) : 32;
    6665    if (cIterations == 0)
     
    7271    RTR3InitExe(argc, &argv, 0);
    7372    PSUPDRVSESSION pSession;
    74     rc = SUPR3Init(&pSession);
     73    int rc = SUPR3Init(&pSession);
    7574    rcRet += rc != 0;
    7675    RTPrintf("tstInt: SUPR3Init -> rc=%Rrc\n", rc);
    7776    char szFile[RTPATH_MAX];
    78     if (!rc)
    79     {
    80         rc = RTPathExecDir(szFile, sizeof(szFile) - sizeof("/VMMR0.r0"));
    81     }
     77    if (RT_SUCCESS(rc))
     78        rc = RTPathExecDir(szFile, sizeof(szFile));
     79
    8280    char szAbsFile[RTPATH_MAX];
    8381    if (RT_SUCCESS(rc))
    8482    {
    85         strcat(szFile, "/VMMR0.r0");
    86         rc = RTPathAbs(szFile, szAbsFile, sizeof(szAbsFile));
     83        rc = RTPathAppend(szFile, sizeof(szFile), "VMMR0.r0");
     84        if (RT_SUCCESS(rc))
     85            rc = RTPathAbs(szFile, szAbsFile, sizeof(szAbsFile));
    8786    }
    8887    if (RT_SUCCESS(rc))
     
    236235    }
    237236
     237    if (RT_FAILURE(rc))
     238        RTPrintf("Failed with rc=%Rrc\n", rc);
     239
    238240    return !!rc;
    239241}
  • trunk/src/VBox/HostServices/SharedFolders/testcase/tstShflCase.cpp

    r103275 r103285  
    11/** @file
    22 * Testcase for shared folder case conversion code.
     3 *
     4 * @todo r=andy Testcase needs to be rewritten using the test framework.
     5 *              Otherwise it's almost pointless to run this on the testboxes.
    36 */
    47
     
    4245#include <iprt/path.h>
    4346#include <iprt/string.h>
     47#include <iprt/test.h>
    4448#include <iprt/uni.h>
    4549#include <stdio.h>
     
    205209}
    206210
    207 static int vbsfCorrectCasing(char *pszFullPath, char *pszStartComponent)
     211static int vbsfCorrectCasing(char *pszFullPath, char *pszStartComponent, size_t cbStartComponent)
    208212{
    209213    PRTDIRENTRYEX  pDirEntry = NULL;
     
    230234    Assert(*(pszStartComponent-1) == RTPATH_DELIMITER);
    231235    *(pszStartComponent-1) = 0;
    232     strcpy(pDirEntry->szName, pszFullPath);
     236    rc = RTStrCopy(pDirEntry->szName, sizeof(pDirEntry->szName), pszFullPath);
     237    if (RT_FAILURE(rc))
     238        goto end;
    233239    szWildCard[0] = RTPATH_DELIMITER;
    234240    szWildCard[1] = '*';
    235241    szWildCard[2] = 0;
    236     strcat(pDirEntry->szName, szWildCard);
    237 
     242    rc = RTStrCat(pDirEntry->szName, sizeof(pDirEntry->szName), szWildCard);
     243    if (RT_FAILURE(rc))
     244        goto end;
    238245    rc = RTDirOpenFiltered(&hSearch, pDirEntry->szName, RTDIRFILTER_WINNT, 0 /*fFlags*/);
    239246    *(pszStartComponent-1) = RTPATH_DELIMITER;
     
    263270        {
    264271            Log(("Found original name %s (%s)\n", &pDirEntry->szName[0], pszStartComponent));
    265             strcpy(pszStartComponent, &pDirEntry->szName[0]);
    266             rc = VINF_SUCCESS;
     272            rc = RTStrCopy(pszStartComponent, cbStartComponent, &pDirEntry->szName[0]);
    267273            break;
    268274        }
     
    282288
    283289
    284 static int testCase(char *pszFullPath, bool fWildCard = false)
     290static int testCase(char *pszFullPath, size_t cbFullPath, bool fWildCard = false)
    285291{
    286292    int rc;
     
    291297    {
    292298        /* strip off the last path component, that contains the wildcard(s) */
    293         size_t   len = strlen(pszFullPath);
    294         char    *src = pszFullPath + len - 1;
    295 
    296         while(src > pszFullPath)
    297         {
    298             if (*src == RTPATH_DELIMITER)
     299        size_t cchLlen = strlen(pszFullPath);
     300        char  *pszSrc  = pszFullPath + cchLlen - 1;
     301
     302        while(pszSrc > pszFullPath)
     303        {
     304            if (*pszSrc == RTPATH_DELIMITER)
    299305                break;
    300             src--;
    301         }
    302         if (*src == RTPATH_DELIMITER)
     306            pszSrc--;
     307        }
     308        if (*pszSrc == RTPATH_DELIMITER)
    303309        {
    304310            bool fHaveWildcards = false;
    305             char *temp = src;
     311            char *temp = pszSrc;
    306312
    307313            while(*temp)
     
    319325            if (fHaveWildcards)
    320326            {
    321                 pszWildCardComponent = src;
     327                pszWildCardComponent = pszSrc;
    322328                *pszWildCardComponent = 0;
    323329            }
     
    328334    if (rc == VERR_FILE_NOT_FOUND || rc == VERR_PATH_NOT_FOUND)
    329335    {
    330         size_t   len = strlen(pszFullPath);
    331         char    *src = pszFullPath + len - 1;
     336        size_t cchLen = strlen(pszFullPath);
     337        char  *pszSrc = pszFullPath + cchLen - 1;
    332338
    333339        Log(("Handle case insensitive guest fs on top of host case sensitive fs for %s\n", pszFullPath));
    334340
    335341        /* Find partial path that's valid */
    336         while(src > pszFullPath)
    337         {
    338             if (*src == RTPATH_DELIMITER)
     342        while(pszSrc > pszFullPath)
     343        {
     344            if (*pszSrc == RTPATH_DELIMITER)
    339345            {
    340                 *src = 0;
     346                *pszSrc = 0;
    341347                rc = RTPathQueryInfo (pszFullPath, &info, RTFSOBJATTRADD_NOTHING);
    342                 *src = RTPATH_DELIMITER;
     348                *pszSrc = RTPATH_DELIMITER;
    343349                if (rc == VINF_SUCCESS)
    344350                {
    345351#ifdef DEBUG
    346                     *src = 0;
     352                    *pszSrc = 0;
    347353                    Log(("Found valid partial path %s\n", pszFullPath));
    348                     *src = RTPATH_DELIMITER;
     354                    *pszSrc = RTPATH_DELIMITER;
    349355#endif
    350356                    break;
     
    352358            }
    353359
    354             src--;
    355         }
    356         Assert(*src == RTPATH_DELIMITER && RT_SUCCESS(rc));
    357         if (    *src == RTPATH_DELIMITER
     360            pszSrc--;
     361        }
     362        Assert(*pszSrc == RTPATH_DELIMITER && RT_SUCCESS(rc));
     363        if (    *pszSrc == RTPATH_DELIMITER
    358364            &&  RT_SUCCESS(rc))
    359365        {
    360             src++;
     366            pszSrc++;
    361367            for(;;)
    362368            {
    363                 char *end = src;
     369                char *end = pszSrc;
    364370                bool fEndOfString = true;
    365371
     
    375381                    fEndOfString = false;
    376382                    *end = 0;
    377                     rc = RTPathQueryInfo(src, &info, RTFSOBJATTRADD_NOTHING);
     383                    rc = RTPathQueryInfo(pszSrc, &info, RTFSOBJATTRADD_NOTHING);
    378384                    Assert(rc == VINF_SUCCESS || rc == VERR_FILE_NOT_FOUND || rc == VERR_PATH_NOT_FOUND);
    379385                }
    380386                else
    381                 if (end == src)
     387                if (end == pszSrc)
    382388                    rc = VINF_SUCCESS;  /* trailing delimiter */
    383389                else
     
    387393                {
    388394                    /* path component is invalid; try to correct the casing */
    389                     rc = vbsfCorrectCasing(pszFullPath, src);
     395                    rc = vbsfCorrectCasing(pszFullPath, pszSrc, cbFullPath - (pszFullPath - pszSrc));
    390396                    if (RT_FAILURE(rc))
    391397                    {
     
    400406
    401407                *end = RTPATH_DELIMITER;
    402                 src = end + 1;
     408                pszSrc = end + 1;
    403409            }
    404410            if (RT_FAILURE(rc))
     
    430436    RTLogFlags(NULL, "unbuffered");
    431437
    432     strcpy(szTest, "c:\\test Dir\\z.bAt");
    433     testCase(szTest);
    434     strcpy(szTest, "c:\\test dir\\z.bAt");
    435     testCase(szTest);
    436     strcpy(szTest, "c:\\test dir\\SUBDIR\\z.bAt");
    437     testCase(szTest);
    438     strcpy(szTest, "c:\\test dir\\SUBDiR\\atestje.bat");
    439     testCase(szTest);
    440     strcpy(szTest, "c:\\TEST dir\\subDiR\\aTestje.baT");
    441     testCase(szTest);
    442     strcpy(szTest, "c:\\TEST dir\\subDiR\\*");
    443     testCase(szTest, true);
    444     strcpy(szTest, "c:\\TEST dir\\subDiR\\");
    445     testCase(szTest ,true);
    446     strcpy(szTest, "c:\\test dir\\SUBDIR\\");
    447     testCase(szTest);
    448     strcpy(szTest, "c:\\test dir\\invalid\\SUBDIR\\test.bat");
    449     testCase(szTest);
     438    RTTESTI_CHECK_RC_OK(RTStrCopy(szTest, sizeof(szTest), "c:\\test Dir\\z.bAt"));
     439    testCase(szTest, sizeof(szTest));
     440    RTTESTI_CHECK_RC_OK(RTStrCopy(szTest, sizeof(szTest), "c:\\test dir\\z.bAt"));
     441    testCase(szTest, sizeof(szTest));
     442    RTTESTI_CHECK_RC_OK(RTStrCopy(szTest, sizeof(szTest), "c:\\test dir\\SUBDIR\\z.bAt"));
     443    testCase(szTest, sizeof(szTest));
     444    RTTESTI_CHECK_RC_OK(RTStrCopy(szTest, sizeof(szTest), "c:\\test dir\\SUBDiR\\atestje.bat"));
     445    testCase(szTest, sizeof(szTest));
     446    RTTESTI_CHECK_RC_OK(RTStrCopy(szTest, sizeof(szTest), "c:\\TEST dir\\subDiR\\aTestje.baT"));
     447    testCase(szTest, sizeof(szTest));
     448    RTTESTI_CHECK_RC_OK(RTStrCopy(szTest, sizeof(szTest), "c:\\TEST dir\\subDiR\\*"));
     449    testCase(szTest, sizeof(szTest), true);
     450    RTTESTI_CHECK_RC_OK(RTStrCopy(szTest, sizeof(szTest), "c:\\TEST dir\\subDiR\\"));
     451    testCase(szTest ,sizeof(szTest), true);
     452    RTTESTI_CHECK_RC_OK(RTStrCopy(szTest, sizeof(szTest), "c:\\test dir\\SUBDIR\\"));
     453    testCase(szTest, sizeof(szTest));
     454    RTTESTI_CHECK_RC_OK(RTStrCopy(szTest, sizeof(szTest), "c:\\test dir\\invalid\\SUBDIR\\test.bat"));
     455    testCase(szTest, sizeof(szTest));
    450456    return 0;
    451457}
  • trunk/src/VBox/Main/src-server/linux/PerformanceLinux.cpp

    r103275 r103285  
    531531        return;
    532532    }
    533     strcat(szVolInfo, "/" VBOXVOLINFO_NAME " ");
    534     strcat(szVolInfo, pcszVolume);
     533    vrc = RTStrCat(szVolInfo, sizeof(szVolInfo), "/" VBOXVOLINFO_NAME " ");
     534    AssertRCReturnVoid(vrc);
     535    vrc = RTStrCat(szVolInfo, sizeof(szVolInfo), pcszVolume);
     536    AssertRCReturnVoid(vrc);
    535537
    536538    FILE *fp = popen(szVolInfo, "r");
  • trunk/src/VBox/Main/src-server/xpcom/server_module.cpp

    r103275 r103285  
    7575
    7676/** Name of the server executable. */
    77 const char VBoxSVC_exe[] = RTPATH_SLASH_STR "VBoxSVC" HOSTSUFF_EXE;
     77const char g_szVBoxSVC_exe[] = RTPATH_SLASH_STR "VBoxSVC" HOSTSUFF_EXE;
    7878
    7979enum
     
    8888 *  Full path to the VBoxSVC executable.
    8989 */
    90 static char VBoxSVCPath[RTPATH_MAX];
    91 static bool IsVBoxSVCPathSet = false;
     90static char g_szVBoxSVCPath[RTPATH_MAX];
     91static bool g_fIsVBoxSVCPathSet = false;
    9292
    9393/*
     
    116116        const char *apszArgs[] =
    117117        {
    118             VBoxSVCPath,
     118            g_szVBoxSVCPath,
    119119            "--auto-shutdown",
    120120            "--inherit-startup-pipe",
     
    132132        hStdNil.u.hFile = NIL_RTFILE;
    133133
    134         vrc = RTProcCreateEx(VBoxSVCPath, apszArgs, RTENV_DEFAULT,
     134        vrc = RTProcCreateEx(g_szVBoxSVCPath, apszArgs, RTENV_DEFAULT,
    135135                             RTPROC_FLAGS_DETACHED, &hStdNil, &hStdNil, &hStdNil,
    136136                             NULL /* pszAsUser */, NULL /* pszPassword */, NULL /* pExtraData */,
     
    187187        }
    188188
    189         if (!IsVBoxSVCPathSet)
     189        if (!g_fIsVBoxSVCPathSet)
    190190        {
    191191            /* Get the directory containing XPCOM components -- the VBoxSVC
     
    204204
    205205                    LogFlowFunc(("component directory = \"%s\"\n", path.get()));
    206                     AssertBreakStmt(path.Length() + strlen(VBoxSVC_exe) < RTPATH_MAX,
     206                    AssertBreakStmt(path.Length() + strlen(g_szVBoxSVC_exe) < RTPATH_MAX,
    207207                                    rc = NS_ERROR_FAILURE);
    208208
     
    212212                    if (cbKernArch > 0)
    213213                    {
    214                         sprintf(VBoxSVCPath, "/opt/VirtualBox/%s%s", achKernArch, VBoxSVC_exe);
    215                         IsVBoxSVCPathSet = true;
     214                        sprintf(g_szVBoxSVCPath, "/opt/VirtualBox/%s%s", achKernArch, g_szVBoxSVC_exe);
     215                        g_fIsVBoxSVCPathSet = true;
    216216                    }
    217217                    else
    218218                        rc = NS_ERROR_UNEXPECTED;
    219219#else
    220                     strcpy(VBoxSVCPath, path.get());
    221                     RTPathStripFilename(VBoxSVCPath);
    222                     strcat(VBoxSVCPath, VBoxSVC_exe);
    223 
    224                     IsVBoxSVCPathSet = true;
     220                    int vrc = RTStrCopy(g_szVBoxSVCPath, sizeof(g_szVBoxSVCPath), path.get());
     221                    AssertRCBreakStmt(vrc, rc = NS_ERROR_FAILURE);
     222                    RTPathStripFilename(g_szVBoxSVCPath);
     223                    vrc = RTStrCat(g_szVBoxSVCPath, sizeof(g_szVBoxSVCPath), g_szVBoxSVC_exe);
     224                    AssertRCBreakStmt(vrc, rc = NS_ERROR_FAILURE);
     225
     226                    g_fIsVBoxSVCPathSet = true;
    225227#endif
    226228                }
     
    247249            if (NS_FAILED(rc))
    248250            {
    249                 LogFlowFunc(("Starting server \"%s\"...\n", VBoxSVCPath));
     251                LogFlowFunc(("Starting server \"%s\"...\n", g_szVBoxSVCPath));
    250252
    251253                startedOnce = true;
  • trunk/src/VBox/Runtime/common/dbg/dbgmod.cpp

    r103275 r103285  
    610610            if (pszName)
    611611            {
    612                 size_t cchName = strlen(pszName);
    613                 char *pszExtFileBuf = (char *)alloca(cchName + strlen(pszExt) + 1);
    614                 if (pszExtFileBuf)
    615                 {
    616                     memcpy(pszExtFileBuf, pszName, cchName + 1);
    617                     RTPathStripSuffix(pszExtFileBuf);
    618                     pszExtFile = strcat(pszExtFileBuf, pszExt);
    619                 }
     612                size_t const cchName       = strlen(pszName);
     613                size_t const cchExtFileBuf = cchName + strlen(pszExt) + 1;
     614
     615                char *pszExtFileBuf = (char *)alloca(cchExtFileBuf);
     616                AssertPtrReturn(pszExtFileBuf, VERR_NO_MEMORY);
     617
     618                memcpy(pszExtFileBuf, pszName, cchName + 1);
     619                RTPathStripSuffix(pszExtFileBuf);
     620                int rc2 = RTStrCat(pszExtFileBuf, cchExtFileBuf, pszExt);
     621                AssertRCReturn(rc2, rc2);
     622
     623                pszExtFile = pszExtFileBuf;
    620624            }
    621625        }
  • trunk/src/VBox/Runtime/r3/xml.cpp

    r103275 r103285  
    23102310        if (RT_FAILURE(rc))
    23112311            throw EIPRTFailure(rc, "RTStrCopy");
    2312         strcat(szTmpFilename, s_pszTmpSuff);
     2312        rc = RTStrCat(szTmpFilename, sizeof(szTmpFilename), s_pszTmpSuff);
     2313        if (RT_FAILURE(rc))
     2314            throw EIPRTFailure(rc, "RTStrCat");
    23132315
    23142316        char szPrevFilename[RTPATH_MAX];
  • trunk/src/VBox/Runtime/testcase/tstRTR0CommonDriver.h

    r103275 r103285  
    121121        rc = RTPathAppend(szPath, RTPATH_MAX, pszTestServiceName);
    122122    if (RT_SUCCESS(rc))
    123         strcat(szPath, ".r0");
     123        rc = RTStrCat(szPath, sizeof(szPath), ".r0");
    124124    if (RT_FAILURE(rc))
    125125    {
     
    129129
    130130    char szSrvReqHandler[sizeof(g_szSrvName) + sizeof("SrvReqHandler")];
    131     strcpy(szSrvReqHandler, pszTestServiceName);
    132     strcat(szSrvReqHandler, "SrvReqHandler");
     131    rc = RTStrCopy(szSrvReqHandler, sizeof(szSrvReqHandler), pszTestServiceName);
     132    if (RT_SUCCESS(rc))
     133        rc = RTStrCat(szSrvReqHandler, sizeof(szSrvReqHandler), "SrvReqHandler");
     134    if (RT_FAILURE(rc))
     135    {
     136        RTTestFailed(g_hTest, "RTStrCat failed with rc=%Rrc\n", rc);
     137        return RTTestSummaryAndDestroy(g_hTest);
     138    }
     139
    133140    for (size_t off = 0; RT_C_IS_LOWER(szSrvReqHandler[off]); off++)
    134141        szSrvReqHandler[off] = RT_C_TO_UPPER(szSrvReqHandler[off]);
  • trunk/src/VBox/VMM/VMMR3/DBGFR3PlugIn.cpp

    r103275 r103285  
    280280    int rc = RTPathAppend(pszModule, cchModule, DBGF_PLUG_IN_PREFIX);
    281281    AssertRCReturn(rc, VERR_TRY_AGAIN);
    282     strcat(&pszModule[cchPath], pPlugIn->szName);
    283     strcat(&pszModule[cchPath + sizeof(DBGF_PLUG_IN_PREFIX) - 1 + pPlugIn->cchName], pszSuff);
     282    rc = RTStrCat(pszModule, cchModule, pPlugIn->szName);
     283    AssertRCReturn(rc, VERR_TRY_AGAIN);
     284    rc = RTStrCat(pszModule, cchModule, pszSuff);
     285    AssertRCReturn(rc, VERR_TRY_AGAIN);
    284286    Assert(strlen(pszModule) < cchModule - 4);
    285287
     
    480482    rc = RTPathAppend(szPath, sizeof(szPath) - cchSuff, DBGF_PLUG_IN_PREFIX "*");
    481483    AssertRCReturnVoid(rc);
    482     strcat(szPath, pszSuff);
     484    rc = RTStrCat(szPath, sizeof(szPath), pszSuff);
     485    AssertRCReturnVoid(rc);
    483486
    484487    RTDIR hDir;
  • trunk/src/VBox/ValidationKit/utils/fs/FsPerf.cpp

    r103275 r103285  
    29542954{
    29552955    char szRenamed[FSPERF_MAX_PATH];
    2956     strcat(strcpy(szRenamed, pszFile), "-renamed");
     2956    RTTESTI_CHECK_RC_OK(RTStrCat(RTStrCopy2(szRenamed, sizeof(szRenamed), pszFile), sizeof(szRenamed), "-renamed"));
    29572957    if (!(iIteration & 1))
    29582958        return RTPathRename(pszFile, szRenamed, 0);
     
    29712971
    29722972    /* Non-existing files. */
    2973     strcpy(szPath, InEmptyDir(RT_STR_TUPLE("other-no-such-file")));
     2973    RTTESTI_CHECK_RC_OK(RTStrCopy(szPath, sizeof(szPath), InEmptyDir(RT_STR_TUPLE("other-no-such-file"))));
    29742974    RTTESTI_CHECK_RC(RTPathRename(InEmptyDir(RT_STR_TUPLE("no-such-file")), szPath, 0), VERR_FILE_NOT_FOUND);
    2975     strcpy(szPath, InEmptyDir(RT_STR_TUPLE("no-such-dir" RTPATH_SLASH_STR "other-no-such-file")));
     2975
     2976    RTTESTI_CHECK_RC_OK(RTStrCopy(szPath, sizeof(szPath), InEmptyDir(RT_STR_TUPLE("no-such-dir" RTPATH_SLASH_STR "other-no-such-file"))));
    29762977    RTTESTI_CHECK_RC(RTPathRename(InEmptyDir(RT_STR_TUPLE("no-such-dir" RTPATH_SLASH_STR "no-such-file")), szPath, 0),
    29772978                     FSPERF_VERR_PATH_NOT_FOUND);
    2978     strcpy(szPath, InEmptyDir(RT_STR_TUPLE("other-no-such-file")));
     2979
     2980    RTTESTI_CHECK_RC_OK(RTStrCopy(szPath, sizeof(szPath), InEmptyDir(RT_STR_TUPLE("other-no-such-file"))));
    29792981    RTTESTI_CHECK_RC(RTPathRename(InDir(RT_STR_TUPLE("known-file" RTPATH_SLASH_STR "no-such-file")), szPath, 0), VERR_PATH_NOT_FOUND);
    29802982
     
    29832985                                     RTFILE_O_CREATE_REPLACE | RTFILE_O_DENY_NONE | RTFILE_O_WRITE), VINF_SUCCESS);
    29842986    RTTESTI_CHECK_RC(RTFileClose(hFile1), VINF_SUCCESS);
    2985     strcat(strcpy(szPath, g_szDir), "-no-such-dir" RTPATH_SLASH_STR "file16");
     2987    RTTESTI_CHECK_RC_OK(RTStrCat(RTStrCopy2(szPath, sizeof(szPath), g_szDir), sizeof(szPath), "-no-such-dir" RTPATH_SLASH_STR "file16"));
    29862988    RTTESTI_CHECK_RC(RTPathRename(szPath, g_szDir, 0), FSPERF_VERR_PATH_NOT_FOUND);
    29872989    RTTESTI_CHECK_RC(RTPathRename(g_szDir, szPath, 0), FSPERF_VERR_PATH_NOT_FOUND);
    29882990
    29892991    /* Shallow: */
    2990     strcat(strcpy(szPath, g_szDir), "-other");
     2992    RTTESTI_CHECK_RC_OK(RTStrCat(RTStrCopy2(szPath, sizeof(szPath), g_szDir), sizeof(szPath), "-other"));
    29912993    PROFILE_FN(RTPathRename(iIteration & 1 ? szPath : g_szDir, iIteration & 1 ? g_szDir : szPath, 0), g_nsTestRun, "RTPathRename");
    29922994
     
    29962998    RTTESTI_CHECK_RC(RTFileClose(hFile1), VINF_SUCCESS);
    29972999
    2998     strcat(strcpy(szPath, g_szDeepDir), "-other");
     3000    RTTESTI_CHECK_RC_OK(RTStrCat(RTStrCopy2(szPath, sizeof(szPath), g_szDeepDir), sizeof(szPath), "-other"));
    29993001    PROFILE_FN(RTPathRename(iIteration & 1 ? szPath : g_szDeepDir, iIteration & 1 ? g_szDeepDir : szPath, 0),
    30003002               g_nsTestRun, "RTPathRename/deep");
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette