VirtualBox

Changeset 82356 in vbox for trunk/src/VBox/Devices/Audio


Ignore:
Timestamp:
Dec 3, 2019 9:26:49 PM (5 years ago)
Author:
vboxsync
Message:

DevIchAc97: Removed a bunch of unnecessary AssertPtrReturn statements on input - these should not generally be needed in internal static functions, at least not for checking basic stuff like 'pThis' or 'pStream'. These assertions are prefect for hiding unused parameters and thereby making refactoring the code harder. bugref:9218

File:
1 edited

Legend:

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

    r82346 r82356  
    677677DECLINLINE(PAUDMIXSINK) ichac97R3IndexToSink(PAC97STATE pThis, uint8_t uIndex)
    678678{
    679     AssertPtrReturn(pThis, NULL);
    680 
    681679    switch (uIndex)
    682680    {
     
    811809static bool ichac97R3StreamIsEnabled(PAC97STATE pThis, PAC97STREAM pStream)
    812810{
    813     AssertPtrReturn(pThis,   false);
    814     AssertPtrReturn(pStream, false);
    815 
    816811    PAUDMIXSINK pSink = ichac97R3IndexToSink(pThis, pStream->u8SD);
    817812    bool fIsEnabled = RT_BOOL(AudioMixerSinkGetStatus(pSink) & AUDMIXSINK_STS_RUNNING);
     
    832827static int ichac97R3StreamEnable(PAC97STATE pThis, PAC97STREAM pStream, bool fEnable)
    833828{
    834     AssertPtrReturn(pThis,   VERR_INVALID_POINTER);
    835     AssertPtrReturn(pStream, VERR_INVALID_POINTER);
    836 
    837829    ichac97R3StreamLock(pStream);
    838830
     
    900892static void ichac97R3StreamReset(PAC97STATE pThis, PAC97STREAM pStream)
    901893{
    902     AssertPtrReturnVoid(pThis);
    903     AssertPtrReturnVoid(pStream);
    904 
    905894    ichac97R3StreamLock(pStream);
    906895
     
    937926{
    938927    RT_NOREF(pThis);
    939     AssertPtrReturn(pStream, VERR_INVALID_PARAMETER);
    940     /** @todo Validate u8Strm. */
    941928
    942929    LogFunc(("[SD%RU8] pStream=%p\n", u8SD, pStream));
     
    10901077{
    10911078    RT_NOREF(pThis);
    1092     AssertPtrReturn(pDstStream,  VERR_INVALID_POINTER);
    1093     AssertPtrReturn(pSrcMixSink, VERR_INVALID_POINTER);
    1094     AssertReturn(cbToWrite,      VERR_INVALID_PARAMETER);
     1079    AssertReturn(cbToWrite > 0,  VERR_INVALID_PARAMETER);
    10951080    /* pcbWritten is optional. */
    10961081
     
    11361121{
    11371122    RT_NOREF(pThis);
    1138     AssertPtrReturn(pSrcStream,  VERR_INVALID_POINTER);
    1139     AssertPtrReturn(pDstMixSink, VERR_INVALID_POINTER);
    1140     AssertReturn(cbToRead,       VERR_INVALID_PARAMETER);
     1123    AssertReturn(cbToRead > 0, VERR_INVALID_PARAMETER);
    11411124    /* pcbRead is optional. */
    11421125
     
    17001683static int ichac97R3MixerAddDrvStream(PAC97STATE pThis, PAUDMIXSINK pMixSink, PPDMAUDIOSTREAMCFG pCfg, PAC97DRIVER pDrv)
    17011684{
    1702     AssertPtrReturn(pThis,    VERR_INVALID_POINTER);
    17031685    AssertPtrReturn(pMixSink, VERR_INVALID_POINTER);
    1704     AssertPtrReturn(pCfg,     VERR_INVALID_POINTER);
    17051686
    17061687    PPDMAUDIOSTREAMCFG pStreamCfg = DrvAudioHlpStreamCfgDup(pCfg);
     
    17831764static int ichac97R3MixerAddDrvStreams(PAC97STATE pThis, PAUDMIXSINK pMixSink, PPDMAUDIOSTREAMCFG pCfg)
    17841765{
    1785     AssertPtrReturn(pThis,    VERR_INVALID_POINTER);
    17861766    AssertPtrReturn(pMixSink, VERR_INVALID_POINTER);
    1787     AssertPtrReturn(pCfg,     VERR_INVALID_POINTER);
    17881767
    17891768    if (!DrvAudioHlpStreamCfgIsValid(pCfg))
     
    18561835static void ichac97R3MixerRemoveDrv(PAC97STATE pThis, PAC97DRIVER pDrv)
    18571836{
    1858     AssertPtrReturnVoid(pThis);
    1859     AssertPtrReturnVoid(pDrv);
    1860 
    18611837    if (pDrv->MicIn.pMixStrm)
    18621838    {
     
    19011877                                          PDMAUDIODIR enmDir, PDMAUDIODSTSRCUNION dstSrc, PAC97DRIVER pDrv)
    19021878{
    1903     AssertPtrReturnVoid(pThis);
    1904     AssertPtrReturnVoid(pMixSink);
    1905 
    19061879    PAC97DRIVERSTREAM pDrvStream = ichac97R3MixerGetDrvStream(pThis, pDrv, enmDir, dstSrc);
    19071880    if (pDrvStream)
     
    19281901                                           PDMAUDIODIR enmDir, PDMAUDIODSTSRCUNION dstSrc)
    19291902{
    1930     AssertPtrReturnVoid(pThis);
    19311903    AssertPtrReturnVoid(pMixSink);
    19321904
     
    21532125static void ichac97R3StreamLock(PAC97STREAM pStream)
    21542126{
    2155     AssertPtrReturnVoid(pStream);
    21562127    int rc2 = RTCritSectEnter(&pStream->State.CritSect);
    21572128    AssertRC(rc2);
     
    21662137static void ichac97R3StreamUnlock(PAC97STREAM pStream)
    21672138{
    2168     AssertPtrReturnVoid(pStream);
    21692139    int rc2 = RTCritSectLeave(&pStream->State.CritSect);
    21702140    AssertRC(rc2);
     
    21792149static uint32_t ichac97R3StreamGetUsed(PAC97STREAM pStream)
    21802150{
    2181     AssertPtrReturn(pStream, 0);
    2182 
    21832151    if (!pStream->State.pCircBuf)
    21842152        return 0;
     
    21952163static uint32_t ichac97R3StreamGetFree(PAC97STREAM pStream)
    21962164{
    2197     AssertPtrReturn(pStream, 0);
    2198 
    21992165    if (!pStream->State.pCircBuf)
    22002166        return 0;
     
    24932459static int ichac97R3MixerReset(PAC97STATE pThis)
    24942460{
    2495     AssertPtrReturn(pThis, VERR_INVALID_PARAMETER);
    2496 
    24972461    LogFlowFuncEnter();
    24982462
     
    26682632static int ichac97R3StreamTransfer(PPDMDEVINS pDevIns, PAC97STATE pThis, PAC97STREAM pStream, uint32_t cbToProcessMax)
    26692633{
    2670     AssertPtrReturn(pThis,       VERR_INVALID_POINTER);
    2671     AssertPtrReturn(pStream,     VERR_INVALID_POINTER);
    2672 
    26732634    if (!cbToProcessMax)
    26742635        return VINF_SUCCESS;
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