VirtualBox

Changeset 24364 in vbox


Ignore:
Timestamp:
Nov 5, 2009 2:18:31 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
54388
Message:

Main: Fixed XPCOM warnings caused by Machine::GetCpuIdLeaf not setting error info. Use UINT32_MAX instead of -1, avoids gcc warnings.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/settings.h

    r24296 r24364  
    395395{
    396396    CpuIdLeaf()
    397         : ulId(-1),
     397        : ulId(UINT32_MAX),
    398398          ulEax(0),
    399399          ulEbx(0),
  • trunk/src/VBox/Main/MachineImpl.cpp

    r24354 r24364  
    13821382STDMETHODIMP Machine::GetCpuIdLeaf(ULONG id, ULONG *aValEax, ULONG *aValEbx, ULONG *aValEcx, ULONG *aValEdx)
    13831383{
    1384     if (!aValEax || !aValEbx || !aValEcx || !aValEdx)
    1385         return E_POINTER;
     1384    CheckComArgOutPointerValid(aValEax);
     1385    CheckComArgOutPointerValid(aValEbx);
     1386    CheckComArgOutPointerValid(aValEcx);
     1387    CheckComArgOutPointerValid(aValEdx);
    13861388
    13871389    AutoCaller autoCaller(this);
     
    14041406    case 0xA:
    14051407        if (mHWData->mCpuIdStdLeafs[id].ulId != id)
    1406             return E_INVALIDARG;    /* not set */
     1408            return setError(E_INVALIDARG, tr("CpuId override leaf %#x is not set"), id);
    14071409
    14081410        *aValEax = mHWData->mCpuIdStdLeafs[id].ulEax;
     
    14241426    case 0x8000000A:
    14251427        if (mHWData->mCpuIdExtLeafs[id - 0x80000000].ulId != id)
    1426             return E_INVALIDARG;    /* not set */
     1428            return setError(E_INVALIDARG, tr("CpuId override leaf %#x is not set"), id);
    14271429
    14281430        *aValEax = mHWData->mCpuIdExtLeafs[id - 0x80000000].ulEax;
     
    14331435
    14341436    default:
    1435         return E_INVALIDARG;
     1437        return setError(E_INVALIDARG, tr("CpuId override leaf %#x is out of range"), id);
    14361438    }
    14371439    return S_OK;
     
    14611463    case 0x9:
    14621464    case 0xA:
     1465        AssertCompile(RT_ELEMENTS(mHWData->mCpuIdStdLeafs) == 0xA);
    14631466        AssertRelease(id < RT_ELEMENTS(mHWData->mCpuIdStdLeafs));
    14641467        mHWData->mCpuIdStdLeafs[id].ulId  = id;
     
    14801483    case 0x80000009:
    14811484    case 0x8000000A:
     1485        AssertCompile(RT_ELEMENTS(mHWData->mCpuIdExtLeafs) == 0xA);
    14821486        AssertRelease(id - 0x80000000 < RT_ELEMENTS(mHWData->mCpuIdExtLeafs));
    14831487        mHWData->mCpuIdExtLeafs[id - 0x80000000].ulId  = id;
     
    14891493
    14901494    default:
    1491         return E_INVALIDARG;
     1495        return setError(E_INVALIDARG, tr("CpuId override leaf %#x is out of range"), id);
    14921496    }
    14931497    return S_OK;
     
    15171521    case 0x9:
    15181522    case 0xA:
     1523        AssertCompile(RT_ELEMENTS(mHWData->mCpuIdStdLeafs) == 0xA);
    15191524        AssertRelease(id < RT_ELEMENTS(mHWData->mCpuIdStdLeafs));
    15201525        /* Invalidate leaf. */
    1521         mHWData->mCpuIdStdLeafs[id].ulId = -1;
     1526        mHWData->mCpuIdStdLeafs[id].ulId = UINT32_MAX;
    15221527        break;
    15231528
     
    15331538    case 0x80000009:
    15341539    case 0x8000000A:
     1540        AssertCompile(RT_ELEMENTS(mHWData->mCpuIdExtLeafs) == 0xA);
    15351541        AssertRelease(id - 0x80000000 < RT_ELEMENTS(mHWData->mCpuIdExtLeafs));
    15361542        /* Invalidate leaf. */
    1537         mHWData->mCpuIdExtLeafs[id - 0x80000000].ulId  = -1;
     1543        mHWData->mCpuIdExtLeafs[id - 0x80000000].ulId = UINT32_MAX;
    15381544        break;
    15391545
    15401546    default:
    1541         return E_INVALIDARG;
     1547        return setError(E_INVALIDARG, tr("CpuId override leaf %#x is out of range"), id);
    15421548    }
    15431549    return S_OK;
     
    15561562    /* Invalidate all standard leafs. */
    15571563    for (unsigned i = 0; i < RT_ELEMENTS(mHWData->mCpuIdStdLeafs); i++)
    1558         mHWData->mCpuIdStdLeafs[i].ulId  = -1;
     1564        mHWData->mCpuIdStdLeafs[i].ulId = UINT32_MAX;
    15591565
    15601566    /* Invalidate all extended leafs. */
    15611567    for (unsigned i = 0; i < RT_ELEMENTS(mHWData->mCpuIdExtLeafs); i++)
    1562         mHWData->mCpuIdExtLeafs[i].ulId = -1;
     1568        mHWData->mCpuIdExtLeafs[i].ulId = UINT32_MAX;
    15631569
    15641570    return S_OK;
     
    65946600        for (unsigned idx = 0; idx < RT_ELEMENTS(mHWData->mCpuIdStdLeafs); idx++)
    65956601        {
    6596             if (mHWData->mCpuIdStdLeafs[idx].ulId != -1)
     6602            if (mHWData->mCpuIdStdLeafs[idx].ulId != UINT32_MAX)
    65976603                data.llCpuIdLeafs.push_back(mHWData->mCpuIdStdLeafs[idx]);
    65986604        }
    65996605        for (unsigned idx = 0; idx < RT_ELEMENTS(mHWData->mCpuIdExtLeafs); idx++)
    66006606        {
    6601             if (mHWData->mCpuIdExtLeafs[idx].ulId != -1)
     6607            if (mHWData->mCpuIdExtLeafs[idx].ulId != UINT32_MAX)
    66026608                data.llCpuIdLeafs.push_back(mHWData->mCpuIdExtLeafs[idx]);
    66036609        }
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