VirtualBox

Ignore:
Timestamp:
May 8, 2022 7:57:08 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
151334
Message:

Main/src-client/VirtualBoxClientImpl.cpp: Adjust to the new rules wrt. to rc -> hrc,vrc usage, ​bugref:10223

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/VirtualBoxClientImpl.cpp

    r93115 r94926  
    141141HRESULT VirtualBoxClient::FinalConstruct()
    142142{
    143     HRESULT rc = init();
     143    HRESULT hrc = init();
    144144    BaseFinalConstruct();
    145     return rc;
     145    return hrc;
    146146}
    147147
     
    177177     * unhelpful ones which cause us a lot of grief with troubleshooting. */
    178178
    179     HRESULT rc = S_OK;
     179    HRESULT hrc = S_OK;
    180180    try
    181181    {
     
    186186        mData.m_SemEvWatcher = NIL_RTSEMEVENT;
    187187
    188         rc = mData.m_pVirtualBox.createLocalObject(CLSID_VirtualBox);
    189         if (FAILED(rc))
     188        hrc = mData.m_pVirtualBox.createLocalObject(CLSID_VirtualBox);
     189        if (FAILED(hrc))
    190190#ifdef RT_OS_WINDOWS
    191             throw i_investigateVirtualBoxObjectCreationFailure(rc);
     191            throw i_investigateVirtualBoxObjectCreationFailure(hrc);
    192192#else
    193             throw rc;
     193            throw hrc;
    194194#endif
    195195
    196196        /* VirtualBox error return is postponed to method calls, fetch it. */
    197197        ULONG rev;
    198         rc = mData.m_pVirtualBox->COMGETTER(Revision)(&rev);
    199         if (FAILED(rc))
    200             throw rc;
    201 
    202         rc = unconst(mData.m_pEventSource).createObject();
    203         AssertComRCThrow(rc, setError(rc, "Could not create EventSource for VirtualBoxClient"));
    204         rc = mData.m_pEventSource->init();
    205         AssertComRCThrow(rc, setError(rc, "Could not initialize EventSource for VirtualBoxClient"));
     198        hrc = mData.m_pVirtualBox->COMGETTER(Revision)(&rev);
     199        if (FAILED(hrc))
     200            throw hrc;
     201
     202        hrc = unconst(mData.m_pEventSource).createObject();
     203        AssertComRCThrow(hrc, setError(hrc, "Could not create EventSource for VirtualBoxClient"));
     204        hrc = mData.m_pEventSource->init();
     205        AssertComRCThrow(hrc, setError(hrc, "Could not initialize EventSource for VirtualBoxClient"));
    206206
    207207        /* HACK ALERT! This is for DllCanUnloadNow(). */
     
    226226            if (RT_SUCCESS(vrc))
    227227            {
    228                 rc = i_reloadApiLanguage();
    229                 if (SUCCEEDED(rc))
     228                hrc = i_reloadApiLanguage();
     229                if (SUCCEEDED(hrc))
    230230                    i_registerEventListener(); /* for updates */
    231231                else
    232                     LogRelFunc(("i_reloadApiLanguage failed: %Rhrc\n", rc));
     232                    LogRelFunc(("i_reloadApiLanguage failed: %Rhrc\n", hrc));
    233233            }
    234234            else
     
    245245        {
    246246            mData.m_SemEvWatcher = NIL_RTSEMEVENT;
    247             AssertRCStmt(vrc, throw setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Failed to create semaphore (rc=%Rrc)"), vrc));
     247            AssertRCStmt(vrc, throw setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Failed to create semaphore (vrc=%Rrc)"), vrc));
    248248        }
    249249
     
    254254            RTSemEventDestroy(mData.m_SemEvWatcher);
    255255            mData.m_SemEvWatcher = NIL_RTSEMEVENT;
    256             AssertRCStmt(vrc, throw setErrorBoth(VBOX_E_IPRT_ERROR, vrc,  tr("Failed to create watcher thread (rc=%Rrc)"), vrc));
     256            AssertRCStmt(vrc, throw setErrorBoth(VBOX_E_IPRT_ERROR, vrc,  tr("Failed to create watcher thread (vrc=%Rrc)"), vrc));
    257257        }
    258258    }
     
    260260    {
    261261        /* we assume that error info is set by the thrower */
    262         rc = err;
     262        hrc = err;
    263263    }
    264264    catch (...)
    265265    {
    266         rc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
     266        hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
    267267    }
    268268
    269269    /* Confirm a successful initialization when it's the case. Must be last,
    270270     * as on failure it will uninitialize the object. */
    271     if (SUCCEEDED(rc))
     271    if (SUCCEEDED(hrc))
    272272        autoInitSpan.setSucceeded();
    273273    else
    274         autoInitSpan.setFailed(rc);
    275 
    276     LogFlowThisFunc(("rc=%Rhrc\n", rc));
     274        autoInitSpan.setFailed(hrc);
     275
     276    LogFlowThisFunc(("hrc=%Rhrc\n", hrc));
    277277    LogFlowThisFuncLeave();
    278278    /* Unconditionally return success, because the error return is delayed to
     
    641641    /* this is not stored in this object, no need to lock */
    642642    ComPtr<ISession> pSession;
    643     HRESULT rc = pSession.createInprocObject(CLSID_Session);
    644     if (SUCCEEDED(rc))
     643    HRESULT hrc = pSession.createInprocObject(CLSID_Session);
     644    if (SUCCEEDED(hrc))
    645645        aSession = pSession;
    646     return rc;
     646    return hrc;
    647647}
    648648
     
    672672{
    673673    BOOL fAccessible = FALSE;
    674     HRESULT rc = aMachine->COMGETTER(Accessible)(&fAccessible);
    675     if (FAILED(rc))
    676         return setError(rc, tr("Could not check the accessibility status of the VM"));
     674    HRESULT hrc = aMachine->COMGETTER(Accessible)(&fAccessible);
     675    if (FAILED(hrc))
     676        return setError(hrc, tr("Could not check the accessibility status of the VM"));
    677677    else if (!fAccessible)
    678678    {
    679679        ComPtr<IVirtualBoxErrorInfo> pAccessError;
    680         rc = aMachine->COMGETTER(AccessError)(pAccessError.asOutParam());
    681         if (FAILED(rc))
    682             return setError(rc, tr("Could not get the access error message of the VM"));
     680        hrc = aMachine->COMGETTER(AccessError)(pAccessError.asOutParam());
     681        if (FAILED(hrc))
     682            return setError(hrc, tr("Could not get the access error message of the VM"));
    683683        else
    684684        {
     
    705705    RTSEMEVENT sem = pThis->mData.m_SemEvWatcher;
    706706    RTMSINTERVAL cMillies = VBOXCLIENT_DEFAULT_INTERVAL;
    707     int vrc;
    708707
    709708    /* The likelihood of early crashes are high, so start with a short wait. */
    710     vrc = RTSemEventWait(sem, cMillies / 2);
     709    int vrc = RTSemEventWait(sem, cMillies / 2);
    711710
    712711    /* As long as the waiting times out keep retrying the wait. */
     
    714713    {
    715714        {
    716             HRESULT rc = S_OK;
     715            HRESULT hrc = S_OK;
    717716            ComPtr<IVirtualBox> pV;
    718717            {
     
    723722            {
    724723                ULONG rev;
    725                 rc = pV->COMGETTER(Revision)(&rev);
    726                 if (FAILED_DEAD_INTERFACE(rc))
     724                hrc = pV->COMGETTER(Revision)(&rev);
     725                if (FAILED_DEAD_INTERFACE(hrc))
    727726                {
    728                     LogRel(("VirtualBoxClient: detected unresponsive VBoxSVC (rc=%Rhrc)\n", rc));
     727                    LogRel(("VirtualBoxClient: detected unresponsive VBoxSVC (hrc=%Rhrc)\n", hrc));
    729728                    {
    730729                        AutoWriteLock alock(pThis COMMA_LOCKVAL_SRC_POS);
     
    744743                ComPtr<IVirtualBox> pVirtualBox;
    745744                ComPtr<IToken> pToken;
    746                 rc = pVirtualBox.createLocalObject(CLSID_VirtualBox);
    747                 if (FAILED(rc))
     745                hrc = pVirtualBox.createLocalObject(CLSID_VirtualBox);
     746                if (FAILED(hrc))
    748747                    cMillies = 3 * VBOXCLIENT_DEFAULT_INTERVAL;
    749748                else
    750749                {
    751                     LogRel(("VirtualBoxClient: detected working VBoxSVC (rc=%Rhrc)\n", rc));
     750                    LogRel(("VirtualBoxClient: detected working VBoxSVC (hrc=%Rhrc)\n", hrc));
    752751                    {
    753752                        AutoWriteLock alock(pThis COMMA_LOCKVAL_SRC_POS);
     
    779778        return S_OK;
    780779
    781     HRESULT rc = mData.m_pVBoxTranslator->loadLanguage(mData.m_pVirtualBox);
    782     if (FAILED(rc))
    783         setError(rc, tr("Failed to load user language instance"));
    784     return rc;
     780    HRESULT hrc = mData.m_pVBoxTranslator->loadLanguage(mData.m_pVirtualBox);
     781    if (FAILED(hrc))
     782        setError(hrc, tr("Failed to load user language instance"));
     783    return hrc;
    785784}
    786785
    787786HRESULT VirtualBoxClient::i_registerEventListener()
    788787{
    789     HRESULT rc = mData.m_pVirtualBox->COMGETTER(EventSource)(mData.m_pVBoxEventSource.asOutParam());
    790     if (SUCCEEDED(rc))
     788    HRESULT hrc = mData.m_pVirtualBox->COMGETTER(EventSource)(mData.m_pVBoxEventSource.asOutParam());
     789    if (SUCCEEDED(hrc))
    791790    {
    792791        ComObjPtr<VBoxEventListenerImpl> pVBoxListener;
     
    796795        com::SafeArray<VBoxEventType_T> eventTypes;
    797796        eventTypes.push_back(VBoxEventType_OnLanguageChanged);
    798         rc = mData.m_pVBoxEventSource->RegisterListener(pVBoxListener, ComSafeArrayAsInParam(eventTypes), true);
    799         if (FAILED(rc))
    800         {
    801             rc = setError(rc, tr("Failed to register listener"));
     797        hrc = mData.m_pVBoxEventSource->RegisterListener(pVBoxListener, ComSafeArrayAsInParam(eventTypes), true);
     798        if (FAILED(hrc))
     799        {
     800            hrc = setError(hrc, tr("Failed to register listener"));
    802801            mData.m_pVBoxEventListener.setNull();
    803802            mData.m_pVBoxEventSource.setNull();
     
    805804    }
    806805    else
    807         rc = setError(rc, tr("Failed to get event source from VirtualBox"));
    808     return rc;
     806        hrc = setError(hrc, tr("Failed to get event source from VirtualBox"));
     807    return hrc;
    809808}
    810809
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