VirtualBox

Changeset 34507 in vbox for trunk/src/VBox/Runtime/r3


Ignore:
Timestamp:
Nov 30, 2010 1:14:14 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
68295
Message:

IPRT: Visual C++ warnings.

Location:
trunk/src/VBox/Runtime/r3
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/socket.cpp

    r33540 r34507  
    958958    AssertReturn(pThis->u32Magic == RTSOCKET_MAGIC, VERR_INVALID_HANDLE);
    959959    AssertReturn(RTMemPoolRefCount(pThis) >= (pThis->cUsers ? 2U : 1U), VERR_CALLER_NO_REFERENCE);
     960    int const fdMax = (int)pThis->hNative + 1;
     961    AssertReturn(fdMax - 1 == pThis->hNative, VERR_INTERNAL_ERROR_5);
    960962
    961963    /*
     
    970972    int rc;
    971973    if (cMillies == RT_INDEFINITE_WAIT)
    972         rc = select(pThis->hNative + 1, &fdsetR, NULL, &fdsetE, NULL);
     974        rc = select(fdMax, &fdsetR, NULL, &fdsetE, NULL);
    973975    else
    974976    {
     
    976978        timeout.tv_sec = cMillies / 1000;
    977979        timeout.tv_usec = (cMillies % 1000) * 1000;
    978         rc = select(pThis->hNative + 1, &fdsetR, NULL, &fdsetE, &timeout);
     980        rc = select(fdMax, &fdsetR, NULL, &fdsetE, &timeout);
    979981    }
    980982    if (rc > 0)
     
    10011003    AssertReturn(!(fEvents & ~RTSOCKET_EVT_VALID_MASK), VERR_INVALID_PARAMETER);
    10021004    AssertReturn(RTMemPoolRefCount(pThis) >= (pThis->cUsers ? 2U : 1U), VERR_CALLER_NO_REFERENCE);
     1005    int const fdMax = (int)pThis->hNative + 1;
     1006    AssertReturn(fdMax - 1 == pThis->hNative, VERR_INTERNAL_ERROR_5);
    10031007
    10041008    *pfEvents = 0;
     
    10231027    int rc;
    10241028    if (cMillies == RT_INDEFINITE_WAIT)
    1025         rc = select(pThis->hNative + 1, &fdsetR, &fdsetW, &fdsetE, NULL);
     1029        rc = select(fdMax, &fdsetR, &fdsetW, &fdsetE, NULL);
    10261030    else
    10271031    {
     
    10291033        timeout.tv_sec = cMillies / 1000;
    10301034        timeout.tv_usec = (cMillies % 1000) * 1000;
    1031         rc = select(pThis->hNative + 1, &fdsetR, &fdsetW, &fdsetE, &timeout);
     1035        rc = select(fdMax, &fdsetR, &fdsetW, &fdsetE, &timeout);
    10321036    }
    10331037    if (rc > 0)
  • trunk/src/VBox/Runtime/r3/win/dir-win.cpp

    r34002 r34507  
    384384        PCRTUTF16 pwszSrc = (PCRTUTF16)pDir->Data.cAlternateFileName;
    385385        PRTUTF16  pwszDst = pDirEntry->wszShortName;
    386         while (*pwszSrc)
    387             *pwszDst++ = *pwszSrc++;
    388         pDirEntry->cwcShortName = pwszDst - &pDirEntry->wszShortName[0];
     386        uint32_t  off = 0;
     387        while (pwszSrc[off] && off < RT_ELEMENTS(pDirEntry->wszShortName) - 1U)
     388        {
     389            pwszDst[off] = pwszSrc[off];
     390            off++;
     391        }
     392        pDirEntry->cwcShortName = (uint16_t)off;
     393
    389394        /* zero the rest */
    390         const PRTUTF16 pwszEnd = &pDirEntry->wszShortName[RT_ELEMENTS(pDirEntry->wszShortName)];
    391         while (pwszDst < pwszEnd)
    392             *pwszDst++ = '\0';
     395        do
     396            pwszDst[off++] = '\0';
     397        while (off < RT_ELEMENTS(pDirEntry->wszShortName));
    393398    }
    394399    else
  • trunk/src/VBox/Runtime/r3/win/thread-win.cpp

    r34256 r34507  
    196196{
    197197    Assert((DWORD_PTR)u64Mask == u64Mask || u64Mask == ~(uint64_t)0);
    198     DWORD dwRet = SetThreadAffinityMask(GetCurrentThread(), (DWORD_PTR)u64Mask);
     198    DWORD_PTR dwRet = SetThreadAffinityMask(GetCurrentThread(), (DWORD_PTR)u64Mask);
    199199    if (dwRet)
    200200        return VINF_SUCCESS;
     
    216216    {
    217217        HANDLE hThread = GetCurrentThread();
    218         DWORD dwRet = SetThreadAffinityMask(hThread, dwProcAff);
     218        DWORD_PTR dwRet = SetThreadAffinityMask(hThread, dwProcAff);
    219219        if (dwRet)
    220220        {
    221             DWORD dwSet = SetThreadAffinityMask(hThread, dwRet);
     221            DWORD_PTR dwSet = SetThreadAffinityMask(hThread, dwRet);
    222222            Assert(dwSet == dwProcAff); NOREF(dwRet);
    223223            return dwRet;
  • trunk/src/VBox/Runtime/r3/win/tls-win.cpp

    r28800 r34507  
    6969    if (iTls == NIL_RTTLS)
    7070        return VINF_SUCCESS;
    71     if (TlsFree(iTls))
     71    if (TlsFree((DWORD)iTls))
    7272        return VINF_SUCCESS;
    7373    return RTErrConvertFromWin32(GetLastError());
    74 
    7574}
    7675
     
    7877RTR3DECL(void *) RTTlsGet(RTTLS iTls)
    7978{
    80     return TlsGetValue(iTls);
     79    return TlsGetValue((DWORD)iTls);
    8180}
    8281
     
    8483RTR3DECL(int) RTTlsGetEx(RTTLS iTls, void **ppvValue)
    8584{
    86     void *pv = TlsGetValue(iTls);
     85    void *pv = TlsGetValue((DWORD)iTls);
    8786    if (pv)
    8887    {
     
    9998RTR3DECL(int) RTTlsSet(RTTLS iTls, void *pvValue)
    10099{
    101     if (TlsSetValue(iTls, pvValue))
     100    if (TlsSetValue((DWORD)iTls, pvValue))
    102101        return VINF_SUCCESS;
    103102    return RTErrConvertFromWin32(GetLastError());
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette