VirtualBox

Changeset 82458 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Dec 6, 2019 1:14:36 PM (5 years ago)
Author:
vboxsync
Message:

Devices/Audio/*: No need to +1 on RTPATH_MAX.

Location:
trunk/src/VBox/Devices/Audio
Files:
5 edited

Legend:

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

    r82406 r82458  
    14451445            RTStrPrintf(szName, sizeof(szName), "MixerSink-%s", pSink->pszName);
    14461446
    1447             char szFile[RTPATH_MAX + 1];
     1447            char szFile[RTPATH_MAX];
    14481448            rc2 = DrvAudioHlpFileNameGet(szFile, RT_ELEMENTS(szFile), szTemp, szName,
    14491449                                         0 /* Instance */, PDMAUDIOFILETYPE_WAV, PDMAUDIOFILENAME_FLAGS_NONE);
  • trunk/src/VBox/Devices/Audio/DrvAudio.cpp

    r82255 r82458  
    25472547        pStream->cRefs = 1;
    25482548
     2549        char szFile[RTPATH_MAX];
    25492550        if (pCfgHost->enmDir == PDMAUDIODIR_IN)
    25502551        {
    25512552            if (pThis->In.Cfg.Dbg.fEnabled)
    25522553            {
    2553                 char szFile[RTPATH_MAX + 1];
    2554 
    2555                 int rc2 = DrvAudioHlpFileNameGet(szFile, RT_ELEMENTS(szFile), pThis->In.Cfg.Dbg.szPathOut, "CaptureNonInterleaved",
     2554                int rc2 = DrvAudioHlpFileNameGet(szFile, sizeof(szFile), pThis->In.Cfg.Dbg.szPathOut, "CaptureNonInterleaved",
    25562555                                                 pThis->pDrvIns->iInstance, PDMAUDIOFILETYPE_WAV, PDMAUDIOFILENAME_FLAGS_NONE);
    25572556                if (RT_SUCCESS(rc2))
     
    25662565                if (RT_SUCCESS(rc2))
    25672566                {
    2568                     rc2 = DrvAudioHlpFileNameGet(szFile, RT_ELEMENTS(szFile), pThis->In.Cfg.Dbg.szPathOut, "StreamRead",
     2567                    rc2 = DrvAudioHlpFileNameGet(szFile, sizeof(szFile), pThis->In.Cfg.Dbg.szPathOut, "StreamRead",
    25692568                                                 pThis->pDrvIns->iInstance, PDMAUDIOFILETYPE_WAV, PDMAUDIOFILENAME_FLAGS_NONE);
    25702569                    if (RT_SUCCESS(rc2))
     
    25862585            if (pThis->Out.Cfg.Dbg.fEnabled)
    25872586            {
    2588                 char szFile[RTPATH_MAX + 1];
    2589 
    2590                 int rc2 = DrvAudioHlpFileNameGet(szFile, RT_ELEMENTS(szFile), pThis->Out.Cfg.Dbg.szPathOut, "PlayNonInterleaved",
     2587                int rc2 = DrvAudioHlpFileNameGet(szFile, sizeof(szFile), pThis->Out.Cfg.Dbg.szPathOut, "PlayNonInterleaved",
    25912588                                                 pThis->pDrvIns->iInstance, PDMAUDIOFILETYPE_WAV, PDMAUDIOFILENAME_FLAGS_NONE);
    25922589                if (RT_SUCCESS(rc2))
     
    26012598                if (RT_SUCCESS(rc2))
    26022599                {
    2603                     rc2 = DrvAudioHlpFileNameGet(szFile, RT_ELEMENTS(szFile), pThis->Out.Cfg.Dbg.szPathOut, "StreamWrite",
     2600                    rc2 = DrvAudioHlpFileNameGet(szFile, sizeof(szFile), pThis->Out.Cfg.Dbg.szPathOut, "StreamWrite",
    26042601                                                 pThis->pDrvIns->iInstance, PDMAUDIOFILETYPE_WAV, PDMAUDIOFILENAME_FLAGS_NONE);
    26052602                    if (RT_SUCCESS(rc2))
  • trunk/src/VBox/Devices/Audio/DrvAudio.h

    r82255 r82458  
    101101        /** Where to store the debugging files.
    102102         *  Defaults to VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH if not set. */
    103         char             szPathOut[RTPATH_MAX + 1];
     103        char             szPathOut[RTPATH_MAX];
    104104    } Dbg;
    105105} DRVAUDIOCFG, *PDRVAUDIOCFG;
  • trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp

    r82259 r82458  
    15201520    do
    15211521    {
    1522         char szFilePath[RTPATH_MAX + 1];
    1523         RTStrPrintf2(szFilePath, sizeof(szFilePath), "%s", pszPath);
     1522        char szFilePath[RTPATH_MAX];
     1523        rc = RTStrCopy(szFilePath, sizeof(szFilePath), pszPath);
     1524        AssertRCBreak(rc);
    15241525
    15251526        /* Create it when necessary. */
     
    15311532        }
    15321533
    1533         char szFileName[RTPATH_MAX + 1];
     1534        char szFileName[RTPATH_MAX];
    15341535        szFileName[0] = '\0';
    15351536
     
    15881589            break;
    15891590
    1590         RTStrPrintf2(pszFile, cchFile, "%s", szFilePath);
     1591        rc = RTStrCopy(pszFile, cchFile, szFilePath);
    15911592
    15921593    } while (0);
  • trunk/src/VBox/Devices/Audio/DrvHostValidationKit.cpp

    r82255 r82458  
    142142    RT_NOREF(pDrv, pCfgAcq);
    143143
    144     int rc = VINF_SUCCESS;
    145 
    146144    pStreamDbg->tsStarted = 0;
    147145    pStreamDbg->uSamplesSinceStarted = 0;
     
    149147    pStreamDbg->Out.cbPlayBuffer  = DrvAudioHlpFramesToBytes(pCfgReq->Backend.cFramesBufferSize, &pCfgReq->Props);
    150148    pStreamDbg->Out.pu8PlayBuffer = (uint8_t *)RTMemAlloc(pStreamDbg->Out.cbPlayBuffer);
    151     if (!pStreamDbg->Out.pu8PlayBuffer)
    152         rc = VERR_NO_MEMORY;
    153 
     149    AssertReturn(pStreamDbg->Out.pu8PlayBuffer, VERR_NO_MEMORY);
     150
     151    char szTemp[RTPATH_MAX];
     152    int rc = RTPathTemp(szTemp, sizeof(szTemp));
    154153    if (RT_SUCCESS(rc))
    155     {
    156         char szTemp[RTPATH_MAX];
    157         rc = RTPathTemp(szTemp, sizeof(szTemp));
    158 
    159         RTPathAppend(szTemp, sizeof(szTemp), "VBoxTestTmp\\VBoxAudioValKit");
    160 
     154        rc = RTPathAppend(szTemp, sizeof(szTemp), "VBoxTestTmp\\VBoxAudioValKit");
     155    if (RT_SUCCESS(rc))
     156    {
     157        char szFile[RTPATH_MAX];
     158        rc = DrvAudioHlpFileNameGet(szFile, sizeof(szFile), szTemp, "VaKit",
     159                                    0 /* Instance */, PDMAUDIOFILETYPE_WAV, PDMAUDIOFILENAME_FLAGS_NONE);
    161160        if (RT_SUCCESS(rc))
    162161        {
    163             char szFile[RTPATH_MAX + 1];
    164 
    165             rc = DrvAudioHlpFileNameGet(szFile, RT_ELEMENTS(szFile), szTemp, "VaKit",
    166                                         0 /* Instance */, PDMAUDIOFILETYPE_WAV, PDMAUDIOFILENAME_FLAGS_NONE);
     162            rc = DrvAudioHlpFileCreate(PDMAUDIOFILETYPE_WAV, szFile, PDMAUDIOFILE_FLAGS_NONE, &pStreamDbg->pFile);
    167163            if (RT_SUCCESS(rc))
    168             {
    169                 rc = DrvAudioHlpFileCreate(PDMAUDIOFILETYPE_WAV, szFile, PDMAUDIOFILE_FLAGS_NONE, &pStreamDbg->pFile);
    170                 if (RT_SUCCESS(rc))
    171                     rc = DrvAudioHlpFileOpen(pStreamDbg->pFile, PDMAUDIOFILE_DEFAULT_OPEN_FLAGS, &pCfgReq->Props);
    172             }
    173 
    174             if (RT_FAILURE(rc))
    175             {
    176                 LogRel(("VaKitAudio: Creating output file '%s' failed with %Rrc\n", szFile, rc));
    177             }
    178             else
    179             {
    180                 size_t cch;
    181                 char szTimingInfo[128];
    182                 cch = RTStrPrintf(szTimingInfo, sizeof(szTimingInfo), "# %uHz %uch %ubit\n",
    183                                   pCfgReq->Props.uHz, pCfgReq->Props.cChannels, pCfgReq->Props.cbSample * 8);
    184 
    185                 RTFileWrite(pStreamDbg->hFileTiming, szTimingInfo, cch, NULL);
    186             }
     164                rc = DrvAudioHlpFileOpen(pStreamDbg->pFile, PDMAUDIOFILE_DEFAULT_OPEN_FLAGS, &pCfgReq->Props);
    187165        }
     166
     167        if (RT_FAILURE(rc))
     168            LogRel(("VaKitAudio: Creating output file '%s' failed with %Rrc\n", szFile, rc));
    188169        else
    189             LogRel(("VaKitAudio: Unable to retrieve temp dir: %Rrc\n", rc));
    190     }
    191 
     170        {
     171            size_t cch;
     172            char szTimingInfo[128];
     173            cch = RTStrPrintf(szTimingInfo, sizeof(szTimingInfo), "# %uHz %uch %ubit\n",
     174                              pCfgReq->Props.uHz, pCfgReq->Props.cChannels, pCfgReq->Props.cbSample * 8);
     175
     176            RTFileWrite(pStreamDbg->hFileTiming, szTimingInfo, cch, NULL);
     177        }
     178    }
     179    else
     180        LogRel(("VaKitAudio: Unable to retrieve temp dir: %Rrc\n", rc));
    192181    return rc;
    193182}
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