VirtualBox

Ignore:
Timestamp:
Feb 7, 2024 4:56:08 PM (13 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
161549
Message:

Got rid of a lot of deprecated strcpy / strcat calls; now using the IPRT pendants (found by Parfait). bugref:3409

Location:
trunk/src/VBox/ValidationKit/utils
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/utils/fs/FsPerf.cpp

    r103005 r103260  
    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");
  • trunk/src/VBox/ValidationKit/utils/misc/loadgenerator.cpp

    r98103 r103260  
    9898    if (RT_SUCCESS(rc))
    9999    {
    100         strcat(szPath, "/loadgeneratorR0.r0");
    101         void *pvImageBase;
    102         rc = SUPR3LoadServiceModule(szPath, "loadgeneratorR0", "LoadGenR0ServiceReqHandler", &pvImageBase);
     100        rc = RTStrCat(szPath, sizeof(szPath), "/loadgeneratorR0.r0");
    103101        if (RT_SUCCESS(rc))
    104102        {
    105             /* done */
     103            void *pvImageBase;
     104            rc = SUPR3LoadServiceModule(szPath, "loadgeneratorR0", "LoadGenR0ServiceReqHandler", &pvImageBase);
     105            if (RT_SUCCESS(rc))
     106            {
     107                /* done */
     108            }
     109            else
     110                RTMsgError("SUPR3LoadServiceModule(%s): %Rrc", szPath, rc);
    106111        }
    107112        else
    108             RTMsgError("SUPR3LoadServiceModule(%s): %Rrc", szPath, rc);
     113            RTMsgError("RTStrCat(%s): %Rrc", szPath, rc);
    109114    }
    110115    else
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