VirtualBox

Changeset 103430 in vbox


Ignore:
Timestamp:
Feb 19, 2024 12:02:55 PM (11 months ago)
Author:
vboxsync
Message:

DrvAudio: No need to use either RTStrCopy[2] or RTStrCat[2] here, memcpy is all you need. bugref:3409

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DrvAudio.cpp

    r103285 r103430  
    48394839        PDRVAUDIOCFG pAudioCfg = iDir == 0 ? &pThis->CfgIn : &pThis->CfgOut;
    48404840        const char  *pszDir    = iDir == 0 ? "In"           : "Out";
     4841        size_t const cbDir     = iDir == 0 ? sizeof("In")   : sizeof("Out");
    48414842
    48424843#define QUERY_VAL_RET(a_Width, a_szName, a_pValue, a_uDefault, a_ExprValid, a_szValidRange) \
    48434844            do { \
    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); \
     4845                AssertCompile(sizeof(szNm) >= sizeof(a_szName "Out")); \
     4846                memcpy(szNm, a_szName, sizeof(a_szName)); \
     4847                rc = RT_CONCAT(pHlp->pfnCFGMQueryU,a_Width)(pDirNode, szNm, a_pValue); \
    48464848                if (rc == VERR_CFGM_VALUE_NOT_FOUND || rc == VERR_CFGM_NO_PARENT) \
    48474849                { \
    4848                     rc = RT_CONCAT(pHlp->pfnCFGMQueryU,a_Width)(pCfg, RTStrCat2(szNm, sizeof(szNm), pszDir), a_pValue); \
     4850                    memcpy(&szNm[sizeof(a_szName) - 1], pszDir, cbDir); \
     4851                    rc = RT_CONCAT(pHlp->pfnCFGMQueryU,a_Width)(pCfg, szNm, a_pValue); \
    48494852                    if (rc == VERR_CFGM_VALUE_NOT_FOUND || rc == VERR_CFGM_NO_PARENT) \
    48504853                    { \
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