VirtualBox

Changeset 90789 in vbox


Ignore:
Timestamp:
Aug 23, 2021 10:27:29 AM (3 years ago)
Author:
vboxsync
Message:

IPRT: More VALID_PTR -> RT_VALID_PTR/AssertPtr.

Location:
trunk/src/VBox/Runtime
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/ldr/ldr.cpp

    r82968 r90789  
    5050    AssertMsgReturn(rtldrIsValid(hLdrMod), ("hLdrMod=%p\n", hLdrMod), VERR_INVALID_HANDLE);
    5151    AssertMsgReturn(pszSymbol, ("pszSymbol=%p\n", pszSymbol), VERR_INVALID_PARAMETER);
    52     AssertMsgReturn(VALID_PTR(ppvValue), ("ppvValue=%p\n", ppvValue), VERR_INVALID_PARAMETER);
     52    AssertPtrReturn(ppvValue, VERR_INVALID_POINTER);
    5353    PRTLDRMODINTERNAL pMod = (PRTLDRMODINTERNAL)hLdrMod;
    5454    //AssertMsgReturn(pMod->eState == LDR_STATE_OPENED, ("eState=%d\n", pMod->eState), VERR_WRONG_ORDER);
  • trunk/src/VBox/Runtime/common/ldr/ldrEx.cpp

    r89969 r90789  
    279279     */
    280280    AssertMsgReturn(rtldrIsValid(hLdrMod), ("hLdrMod=%p\n", hLdrMod), VERR_INVALID_HANDLE);
    281     AssertMsgReturn(VALID_PTR(pvBits), ("pvBits=%p\n", pvBits), VERR_INVALID_PARAMETER);
    282     AssertMsgReturn(VALID_PTR(pfnGetImport), ("pfnGetImport=%p\n", pfnGetImport), VERR_INVALID_PARAMETER);
     281    AssertPtrReturn(pvBits, VERR_INVALID_POINTER);
     282    AssertPtrReturn(pfnGetImport, VERR_INVALID_POINTER);
    283283    PRTLDRMODINTERNAL pMod = (PRTLDRMODINTERNAL)hLdrMod;
    284284    AssertMsgReturn(pMod->eState == LDR_STATE_OPENED, ("eState=%d\n", pMod->eState), VERR_WRONG_ORDER);
     
    395395    AssertMsgReturn(rtldrIsValid(hLdrMod), ("hLdrMod=%p\n", hLdrMod), VERR_INVALID_HANDLE);
    396396    AssertMsgReturn(!pvBits || VALID_PTR(pvBits), ("pvBits=%p\n", pvBits), VERR_INVALID_PARAMETER);
    397     AssertMsgReturn(VALID_PTR(pfnCallback), ("pfnCallback=%p\n", pfnCallback), VERR_INVALID_PARAMETER);
     397    AssertPtrReturn(pfnCallback, VERR_INVALID_POINTER);
    398398    PRTLDRMODINTERNAL pMod = (PRTLDRMODINTERNAL)hLdrMod;
    399399    //AssertMsgReturn(pMod->eState == LDR_STATE_OPENED, ("eState=%d\n", pMod->eState), VERR_WRONG_ORDER);
     
    419419    AssertMsgReturn(rtldrIsValid(hLdrMod), ("hLdrMod=%p\n", hLdrMod), VERR_INVALID_HANDLE);
    420420    AssertMsgReturn(!pvBits || RT_VALID_PTR(pvBits), ("pvBits=%p\n", pvBits), VERR_INVALID_PARAMETER);
    421     AssertMsgReturn(RT_VALID_PTR(pfnCallback), ("pfnCallback=%p\n", pfnCallback), VERR_INVALID_PARAMETER);
     421    AssertPtrReturn(pfnCallback, VERR_INVALID_POINTER);
    422422    PRTLDRMODINTERNAL pMod = (PRTLDRMODINTERNAL)hLdrMod;
    423423    //AssertMsgReturn(pMod->eState == LDR_STATE_OPENED, ("eState=%d\n", pMod->eState), VERR_WRONG_ORDER);
     
    447447     */
    448448    AssertMsgReturn(rtldrIsValid(hLdrMod), ("hLdrMod=%p\n", hLdrMod), VERR_INVALID_HANDLE);
    449     AssertMsgReturn(RT_VALID_PTR(pfnCallback), ("pfnCallback=%p\n", pfnCallback), VERR_INVALID_PARAMETER);
     449    AssertPtrReturn(pfnCallback, VERR_INVALID_POINTER);
    450450    PRTLDRMODINTERNAL pMod = (PRTLDRMODINTERNAL)hLdrMod;
    451451    //AssertMsgReturn(pMod->eState == LDR_STATE_OPENED, ("eState=%d\n", pMod->eState), VERR_WRONG_ORDER);
  • trunk/src/VBox/Runtime/generic/RTFileCopyByHandlesEx-generic.cpp

    r82968 r90789  
    4545    AssertMsgReturn(RTFileIsValid(hFileSrc), ("hFileSrc=%RTfile\n", hFileSrc), VERR_INVALID_PARAMETER);
    4646    AssertMsgReturn(RTFileIsValid(hFileDst), ("hFileDst=%RTfile\n", hFileDst), VERR_INVALID_PARAMETER);
    47     AssertMsgReturn(!pfnProgress || VALID_PTR(pfnProgress), ("pfnProgress=%p\n", pfnProgress), VERR_INVALID_PARAMETER);
     47    AssertPtrNullReturn(pfnProgress, VERR_INVALID_POINTER);
    4848
    4949    /*
  • trunk/src/VBox/Runtime/generic/RTFileCopyEx-generic.cpp

    r82968 r90789  
    4141     * Validate input.
    4242     */
    43     AssertMsgReturn(VALID_PTR(pszSrc), ("pszSrc=%p\n", pszSrc), VERR_INVALID_PARAMETER);
     43    AssertPtrReturn(pszSrc, VERR_INVALID_POINTER);
    4444    AssertMsgReturn(*pszSrc, ("pszSrc=%p\n", pszSrc), VERR_INVALID_PARAMETER);
    45     AssertMsgReturn(VALID_PTR(pszDst), ("pszDst=%p\n", pszDst), VERR_INVALID_PARAMETER);
     45    AssertPtrReturn(pszDst, VERR_INVALID_POINTER);
    4646    AssertMsgReturn(*pszDst, ("pszDst=%p\n", pszDst), VERR_INVALID_PARAMETER);
    47     AssertMsgReturn(!pfnProgress || VALID_PTR(pfnProgress), ("pfnProgress=%p\n", pfnProgress), VERR_INVALID_PARAMETER);
     47    AssertPtrReturn(pfnProgress, VERR_INVALID_POINTER);
    4848    AssertMsgReturn(!(fFlags & ~RTFILECOPY_FLAGS_MASK), ("%#x\n", fFlags), VERR_INVALID_PARAMETER);
    4949
  • trunk/src/VBox/Runtime/include/internal/dir.h

    r85121 r90789  
    162162DECLINLINE(bool) rtDirValidHandle(PRTDIRINTERNAL pDir)
    163163{
    164     AssertMsgReturn(VALID_PTR(pDir), ("%p\n", pDir), false);
     164    AssertPtrReturn(pDir, false);
    165165    AssertMsgReturn(pDir->u32Magic == RTDIR_MAGIC, ("%#RX32\n", pDir->u32Magic), false);
    166166    return true;
  • trunk/src/VBox/Runtime/include/internal/ldr.h

    r86524 r90789  
    576576DECLINLINE(bool) rtldrIsValid(RTLDRMOD hLdrMod)
    577577{
    578     return VALID_PTR(hLdrMod)
     578    return RT_VALID_PTR(hLdrMod)
    579579        && ((PRTLDRMODINTERNAL)hLdrMod)->u32Magic == RTLDRMOD_MAGIC;
    580580}
  • trunk/src/VBox/Runtime/r0drv/solaris/semeventwait-r0drv-solaris.h

    r82968 r90789  
    201201    kthread_t      *pThread = pWait->pThread;
    202202    kmutex_t       *pMtx    = (kmutex_t *)ASMAtomicReadPtr(&pWait->pvMtx);
    203     if (VALID_PTR(pMtx))
     203    if (RT_VALID_PTR(pMtx))
    204204    {
    205205        /* Enter the mutex here to make sure the thread has gone to sleep
     
    234234    kthread_t      *pThread = pWait->pThread;
    235235    kmutex_t       *pMtx    = (kmutex_t *)ASMAtomicReadPtr((void * volatile *)&pWait->pvMtx);
    236     if (VALID_PTR(pMtx))
     236    if (RT_VALID_PTR(pMtx))
    237237    {
    238238        /* Enter the mutex here to make sure the thread has gone to sleep
  • trunk/src/VBox/Runtime/r3/darwin/krnlmod-darwin.cpp

    r86300 r90789  
    229229                                        uint32_t *pcEntries)
    230230{
    231     AssertReturn(VALID_PTR(pahKrnlModInfo) || cEntriesMax == 0, VERR_INVALID_PARAMETER);
     231    AssertPtrReturn(pahKrnlModInfo, VERR_INVALID_POINTER);
     232    AssertReturn(cEntriesMax == 0, VERR_INVALID_PARAMETER);
    232233
    233234    int rc = VINF_SUCCESS;
  • trunk/src/VBox/Runtime/r3/linux/RTFileSetAllocationSize-linux.cpp

    r82968 r90789  
    5656                    VERR_NOT_SUPPORTED);
    5757
    58     int rc = VINF_SUCCESS;
     58    int rc;
    5959    PFNLNXFALLOCATE pfnLnxFAllocate = (PFNLNXFALLOCATE)(uintptr_t)dlsym(RTLD_DEFAULT, "fallocate64");
    60     if (VALID_PTR(pfnLnxFAllocate))
     60    if (RT_VALID_PTR(pfnLnxFAllocate))
    6161    {
    6262        int fLnxFlags = (fFlags & RTFILE_ALLOC_SIZE_F_KEEP_SIZE) ? LNX_FALLOC_FL_KEEP_SIZE : 0;
    6363        int rcLnx = pfnLnxFAllocate(RTFileToNative(hFile), fLnxFlags, 0, cbSize);
    64         if (rcLnx != 0)
    65         {
    66             if (errno == EOPNOTSUPP)
    67                 rc = VERR_NOT_SUPPORTED;
    68             else
    69                 rc = RTErrConvertFromErrno(errno);
    70         }
     64        if (rcLnx == 0)
     65            rc = VINF_SUCCESS;
     66        else if (errno == EOPNOTSUPP)
     67            rc = VERR_NOT_SUPPORTED;
     68        else
     69            rc = RTErrConvertFromErrno(errno);
    7170    }
    7271    else
  • trunk/src/VBox/Runtime/r3/linux/fileaio-linux.cpp

    r82968 r90789  
    451451         * completion port.
    452452         */
    453         AssertMsg(VALID_PTR(pReqInt->pCtxInt),
    454                   ("Invalid state. Request was canceled but wasn't submitted\n"));
     453        AssertMsg(RT_VALID_PTR(pReqInt->pCtxInt), ("Invalid state. Request was canceled but wasn't submitted\n"));
    455454
    456455        ASMAtomicDecS32(&pReqInt->pCtxInt->cRequests);
  • trunk/src/VBox/Runtime/r3/linux/krnlmod-linux.cpp

    r86301 r90789  
    196196                                        uint32_t *pcEntries)
    197197{
    198     AssertReturn(VALID_PTR(pahKrnlModInfo) || cEntriesMax == 0, VERR_INVALID_PARAMETER);
     198    AssertPtrReturn(pahKrnlModInfo, VERR_INVALID_POINTER);
     199    AssertReturn(cEntriesMax == 0, VERR_INVALID_PARAMETER);
    199200
    200201    uint32_t cKmodsLoaded = RTKrnlModLoadedGetCount();
  • trunk/src/VBox/Runtime/r3/linux/semeventmulti-linux.cpp

    r82968 r90789  
    202202     */
    203203    struct RTSEMEVENTMULTIINTERNAL *pThis = hEventMultiSem;
    204     AssertReturn(VALID_PTR(pThis) && pThis->u32Magic == RTSEMEVENTMULTI_MAGIC,
    205                 VERR_INVALID_HANDLE);
     204    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
     205    AssertReturn(pThis->u32Magic == RTSEMEVENTMULTI_MAGIC, VERR_INVALID_HANDLE);
    206206
    207207#ifdef RTSEMEVENTMULTI_STRICT
     
    236236     */
    237237    struct RTSEMEVENTMULTIINTERNAL *pThis = hEventMultiSem;
    238     AssertReturn(VALID_PTR(pThis) && pThis->u32Magic == RTSEMEVENTMULTI_MAGIC,
    239                 VERR_INVALID_HANDLE);
     238    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
     239    AssertReturn(pThis->u32Magic == RTSEMEVENTMULTI_MAGIC, VERR_INVALID_HANDLE);
    240240#ifdef RT_STRICT
    241241    int32_t i = pThis->iState;
  • trunk/src/VBox/Runtime/r3/posix/fs-posix.cpp

    r82968 r90789  
    5858     * Validate input.
    5959     */
    60     AssertMsgReturn(VALID_PTR(pszFsPath) && *pszFsPath, ("%p", pszFsPath), VERR_INVALID_PARAMETER);
     60    AssertPtrReturn(pszFsPath, VERR_INVALID_POINTER);
     61    AssertReturn(*pszFsPath != '\0', VERR_INVALID_PARAMETER);
    6162
    6263    /*
     
    103104     * Validate input.
    104105     */
    105     AssertMsgReturn(VALID_PTR(pszFsPath) && *pszFsPath, ("%p", pszFsPath), VERR_INVALID_PARAMETER);
    106     AssertMsgReturn(VALID_PTR(pu32Serial), ("%p", pu32Serial), VERR_INVALID_PARAMETER);
     106    AssertPtrReturn(pszFsPath, VERR_INVALID_POINTER);
     107    AssertReturn(*pszFsPath != '\0', VERR_INVALID_PARAMETER);
     108    AssertPtrReturn(pu32Serial, VERR_INVALID_POINTER);
    107109
    108110    /*
     
    135137     * Validate.
    136138     */
    137     AssertMsgReturn(VALID_PTR(pszFsPath) && *pszFsPath, ("%p", pszFsPath), VERR_INVALID_PARAMETER);
    138     AssertMsgReturn(VALID_PTR(pProperties), ("%p", pProperties), VERR_INVALID_PARAMETER);
     139    AssertPtrReturn(pszFsPath, VERR_INVALID_POINTER);
     140    AssertReturn(*pszFsPath != '\0', VERR_INVALID_PARAMETER);
     141    AssertPtrReturn(pProperties, VERR_INVALID_POINTER);
    139142
    140143    /*
  • trunk/src/VBox/Runtime/r3/solaris/fileaio-solaris.cpp

    r82968 r90789  
    237237         * completion port.
    238238         */
    239         AssertMsg(VALID_PTR(pReqInt->pCtxInt),
    240                   ("Invalid state. Request was canceled but wasn't submitted\n"));
     239        AssertMsg(RT_VALID_PTR(pReqInt->pCtxInt), ("Invalid state. Request was canceled but wasn't submitted\n"));
    241240
    242241        ASMAtomicDecS32(&pReqInt->pCtxInt->cRequests);
  • trunk/src/VBox/Runtime/r3/solaris/krnlmod-solaris.cpp

    r86301 r90789  
    196196                                        uint32_t *pcEntries)
    197197{
    198     AssertReturn(VALID_PTR(pahKrnlModInfo) || cEntriesMax == 0, VERR_INVALID_PARAMETER);
     198    AssertPtrReturn(pahKrnlModInfo, VERR_INVALID_POINTER);
     199    AssertReturn(cEntriesMax == 0, VERR_INVALID_PARAMETER);
    199200
    200201    uint32_t cKmodsLoaded = RTKrnlModLoadedGetCount();
  • trunk/src/VBox/Runtime/r3/win/fs-win.cpp

    r82968 r90789  
    187187     * Validate & get valid root path.
    188188     */
    189     AssertMsgReturn(VALID_PTR(pszFsPath) && *pszFsPath, ("%p", pszFsPath), VERR_INVALID_PARAMETER);
     189    AssertPtrReturn(pszFsPath, VERR_INVALID_POINTER);
     190    AssertReturn(*pszFsPath != '\0', VERR_INVALID_PARAMETER);
    190191    PRTUTF16 pwszFsRoot;
    191192    int rc = rtFsGetRoot(pszFsPath, &pwszFsRoot);
     
    258259     * Validate & get valid root path.
    259260     */
    260     AssertMsgReturn(VALID_PTR(pszFsPath) && *pszFsPath, ("%p", pszFsPath), VERR_INVALID_PARAMETER);
    261     AssertMsgReturn(VALID_PTR(pu32Serial), ("%p", pu32Serial), VERR_INVALID_PARAMETER);
     261    AssertPtrReturn(pszFsPath, VERR_INVALID_POINTER);
     262    AssertReturn(*pszFsPath != '\0', VERR_INVALID_PARAMETER);
     263    AssertPtrReturn(pu32Serial, VERR_INVALID_POINTER);
    262264    PRTUTF16 pwszFsRoot;
    263265    int rc = rtFsGetRoot(pszFsPath, &pwszFsRoot);
     
    298300     * Validate & get valid root path.
    299301     */
    300     AssertMsgReturn(VALID_PTR(pszFsPath) && *pszFsPath, ("%p", pszFsPath), VERR_INVALID_PARAMETER);
    301     AssertMsgReturn(VALID_PTR(pProperties), ("%p", pProperties), VERR_INVALID_PARAMETER);
     302    AssertPtrReturn(pszFsPath, VERR_INVALID_POINTER);
     303    AssertReturn(*pszFsPath != '\0', VERR_INVALID_PARAMETER);
     304    AssertPtrReturn(pProperties, VERR_INVALID_POINTER);
    302305    PRTUTF16 pwszFsRoot;
    303306    int rc = rtFsGetRoot(pszFsPath, &pwszFsRoot);
  • trunk/src/VBox/Runtime/r3/win/krnlmod-win.cpp

    r86301 r90789  
    186186                                        uint32_t *pcEntries)
    187187{
    188     AssertReturn(VALID_PTR(pahKrnlModInfo) || cEntriesMax == 0, VERR_INVALID_PARAMETER);
     188    AssertPtrReturn(pahKrnlModInfo, VERR_INVALID_POINTER);
     189    AssertReturn(cEntriesMax == 0, VERR_INVALID_PARAMETER);
    189190
    190191    PRTL_PROCESS_MODULES pKrnlMods = NULL;
  • trunk/src/VBox/Runtime/r3/win/serialport-win.cpp

    r86017 r90789  
    334334{
    335335    AssertPtrReturn(phSerialPort, VERR_INVALID_POINTER);
    336     AssertReturn(VALID_PTR(pszPortAddress) && *pszPortAddress != '\0', VERR_INVALID_PARAMETER);
     336    AssertReturn(RT_VALID_PTR(pszPortAddress) && *pszPortAddress != '\0', VERR_INVALID_PARAMETER);
    337337    AssertReturn(!(fFlags & ~RTSERIALPORT_OPEN_F_VALID_MASK), VERR_INVALID_PARAMETER);
    338338    AssertReturn((fFlags & RTSERIALPORT_OPEN_F_READ) || (fFlags & RTSERIALPORT_OPEN_F_WRITE),
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