VirtualBox

Changeset 98265 in vbox


Ignore:
Timestamp:
Jan 24, 2023 9:26:46 AM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
155468
Message:

Main/ConsoleImpl.cpp: rc -> hrc/vrc. Made Console::i_reconfigureMediumAttachments return rather than throw it's failures, as it's just stupid code bloat to throw HRESULT have the Session's api wrapper code catch them. bugref:10223

File:
1 edited

Legend:

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

    r98264 r98265  
    53345334        ::FireHostAudioDeviceChangedEvent(mEventSource, aDevice, aNew, aState, aErrInfo);
    53355335
    5336     LogFlowThisFunc(("Leaving rc=%#x\n", S_OK));
     5336    LogFlowThisFunc(("Leaving S_OK\n"));
    53375337    return S_OK;
    53385338}
     
    68276827HRESULT Console::i_reconfigureMediumAttachments(const std::vector<ComPtr<IMediumAttachment> > &aAttachments)
    68286828{
    6829     HRESULT rc = S_OK;
    68306829
    68316830    AutoCaller autoCaller(this);
    6832     if (FAILED(autoCaller.hrc())) return autoCaller.hrc();
     6831    if (FAILED(autoCaller.hrc()))
     6832        return autoCaller.hrc();
    68336833
    68346834    /* get the VM handle. */
     
    68396839    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    68406840
     6841    HRESULT rc = S_OK;
    68416842    for (size_t i = 0; i < aAttachments.size(); ++i)
    68426843    {
    6843         ComPtr<IStorageController> pStorageController;
    6844         Bstr controllerName;
    6845         ULONG lInstance;
    6846         StorageControllerType_T enmController;
    6847         StorageBus_T enmBus;
    6848         BOOL fUseHostIOCache;
    6849 
    68506844        /*
    68516845         * We could pass the objects, but then EMT would have to do lots of
     
    68536847         * Better query needed values here and pass them.
    68546848         */
    6855         rc = aAttachments[i]->COMGETTER(Controller)(controllerName.asOutParam());
    6856         if (FAILED(rc))
    6857             throw rc;
    6858 
    6859         rc = mMachine->GetStorageControllerByName(controllerName.raw(), pStorageController.asOutParam());
    6860         if (FAILED(rc))
    6861             throw rc;
    6862 
    6863         rc = pStorageController->COMGETTER(ControllerType)(&enmController);
    6864         if (FAILED(rc))
    6865             throw rc;
    6866         rc = pStorageController->COMGETTER(Instance)(&lInstance);
    6867         if (FAILED(rc))
    6868             throw rc;
    6869         rc = pStorageController->COMGETTER(Bus)(&enmBus);
    6870         if (FAILED(rc))
    6871             throw rc;
    6872         rc = pStorageController->COMGETTER(UseHostIOCache)(&fUseHostIOCache);
    6873         if (FAILED(rc))
    6874             throw rc;
    6875 
    6876         const char *pcszDevice = i_storageControllerTypeToStr(enmController);
     6849        Bstr controllerName;
     6850        HRESULT hrc = aAttachments[i]->COMGETTER(Controller)(controllerName.asOutParam());
     6851        if (FAILED(hrc))
     6852            return hrc;
     6853
     6854        ComPtr<IStorageController> pStorageController;
     6855        hrc = mMachine->GetStorageControllerByName(controllerName.raw(), pStorageController.asOutParam());
     6856        if (FAILED(hrc))
     6857            return hrc;
     6858
     6859        StorageControllerType_T enmController;
     6860        hrc = pStorageController->COMGETTER(ControllerType)(&enmController);
     6861        if (FAILED(hrc))
     6862            return hrc;
     6863        const char * const pcszDevice = i_storageControllerTypeToStr(enmController);
     6864
     6865        ULONG lInstance;
     6866        hrc = pStorageController->COMGETTER(Instance)(&lInstance);
     6867        if (FAILED(hrc))
     6868            return hrc;
     6869
     6870        StorageBus_T enmBus;
     6871        hrc = pStorageController->COMGETTER(Bus)(&enmBus);
     6872        if (FAILED(hrc))
     6873            return hrc;
     6874
     6875        BOOL fUseHostIOCache;
     6876        hrc = pStorageController->COMGETTER(UseHostIOCache)(&fUseHostIOCache);
     6877        if (FAILED(hrc))
     6878            return hrc;
    68776879
    68786880        BOOL fBuiltinIOCache;
    68796881        rc = mMachine->COMGETTER(IOCacheEnabled)(&fBuiltinIOCache);
    68806882        if (FAILED(rc))
    6881             throw rc;
     6883            return hrc;
    68826884
    68836885        bool fInsertDiskIntegrityDrv = false;
    68846886        Bstr strDiskIntegrityFlag;
    6885         rc = mMachine->GetExtraData(Bstr("VBoxInternal2/EnableDiskIntegrityDriver").raw(),
    6886                                     strDiskIntegrityFlag.asOutParam());
    6887         if (   rc   == S_OK
     6887        hrc = mMachine->GetExtraData(Bstr("VBoxInternal2/EnableDiskIntegrityDriver").raw(),
     6888                                     strDiskIntegrityFlag.asOutParam());
     6889        if (   hrc   == S_OK
    68886890            && strDiskIntegrityFlag == "1")
    68896891            fInsertDiskIntegrityDrv = true;
     
    68916893        alock.release();
    68926894
     6895        hrc = S_OK;
    68936896        IMediumAttachment *pAttachment = aAttachments[i];
    68946897        int vrc = ptrVM.vtable()->pfnVMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY,
     
    69006903        if (RT_FAILURE(vrc))
    69016904            throw setErrorBoth(E_FAIL, vrc, "%Rrc", vrc);
    6902         if (FAILED(rc))
    6903             throw rc;
     6905        if (FAILED(hrc))
     6906            throw hrc;
    69046907
    69056908        alock.acquire();
    69066909    }
    69076910
    6908     return rc;
     6911    return S_OK;
    69096912}
    69106913
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