VirtualBox

Ignore:
Timestamp:
Jan 24, 2023 4:02:15 PM (23 months ago)
Author:
vboxsync
Message:

Main/src-server: rc -> hrc/vrc (partial). bugref:10223

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/MachineImplMoveVM.cpp

    r98262 r98289  
    5050    HRESULT add(const Utf8Str &folder, const Utf8Str &file)
    5151    {
    52         HRESULT rc = S_OK;
    5352        m_list.insert(std::make_pair(folder, file));
    54         return rc;
     53        return S_OK;
    5554    }
    5655
    5756    HRESULT add(const Utf8Str &fullPath)
    5857    {
    59         HRESULT rc = S_OK;
    6058        Utf8Str folder = fullPath;
    6159        folder.stripFilename();
     
    6361        filename.stripPath();
    6462        m_list.insert(std::make_pair(folder, filename));
    65         return rc;
     63        return S_OK;
    6664    }
    6765
    6866    HRESULT removeFileFromList(const Utf8Str &fullPath)
    6967    {
    70         HRESULT rc = S_OK;
    7168        Utf8Str folder = fullPath;
    7269        folder.stripFilename();
     
    8683        }
    8784
    88         return rc;
     85        return S_OK;
    8986    }
    9087
    9188    HRESULT removeFileFromList(const Utf8Str &path, const Utf8Str &fileName)
    9289    {
    93         HRESULT rc = S_OK;
    9490        rangeRes_t res = m_list.equal_range(path);
    9591        for (it_t it=res.first; it!=res.second;)
     
    104100                ++it;
    105101        }
    106         return rc;
     102        return S_OK;
    107103    }
    108104
    109105    HRESULT removeFolderFromList(const Utf8Str &path)
    110106    {
    111         HRESULT rc = S_OK;
    112107        m_list.erase(path);
    113         return rc;
     108        return S_OK;
    114109    }
    115110
     
    590585
    591586    BOOL fCanceled = false;
    592     HRESULT rc = pProgress->COMGETTER(Canceled)(&fCanceled);
    593     if (FAILED(rc)) return VERR_GENERAL_FAILURE;
     587    HRESULT hrc = pProgress->COMGETTER(Canceled)(&fCanceled);
     588    if (FAILED(hrc)) return VERR_GENERAL_FAILURE;
    594589    /* If canceled by the user tell it to the copy operation. */
    595590    if (fCanceled) return VERR_CANCELLED;
    596591    /* Set the new process. */
    597     rc = pProgress->SetCurrentOperationProgress(uPercentage);
    598     if (FAILED(rc)) return VERR_GENERAL_FAILURE;
     592    hrc = pProgress->SetCurrentOperationProgress(uPercentage);
     593    if (FAILED(hrc)) return VERR_GENERAL_FAILURE;
    599594
    600595    return VINF_SUCCESS;
     
    11411136                                    const Utf8Str &strTargetFolder)
    11421137{
    1143     HRESULT rc = S_OK;
     1138    HRESULT hrc = S_OK;
    11441139    ComObjPtr<Machine> &machine = m_pMachine;
    11451140    Utf8Str strLocation;
     
    11581153            Bstr bstrSrcName;
    11591154
    1160             rc = pMedium->COMGETTER(Name)(bstrSrcName.asOutParam());
    1161             if (FAILED(rc)) throw rc;
     1155            hrc = pMedium->COMGETTER(Name)(bstrSrcName.asOutParam());
     1156            if (FAILED(hrc)) throw hrc;
    11621157
    11631158            if (strTargetFolder.isNotEmpty())
    11641159            {
    11651160                strTargetImageName = strTargetFolder;
    1166                 rc = pMedium->COMGETTER(Location)(bstrLocation.asOutParam());
    1167                 if (FAILED(rc)) throw rc;
     1161                hrc = pMedium->COMGETTER(Location)(bstrLocation.asOutParam());
     1162                if (FAILED(hrc)) throw hrc;
    11681163                strLocation = bstrLocation;
    11691164
     
    11741169
    11751170                strTargetImageName.append(RTPATH_DELIMITER).append(strLocation);
    1176                 rc = m_pProgress->SetNextOperation(BstrFmt(tr("Moving medium '%ls' ..."),
    1177                                                            bstrSrcName.raw()).raw(),
    1178                                                    mt.uWeight);
    1179                 if (FAILED(rc)) throw rc;
     1171                hrc = m_pProgress->SetNextOperation(BstrFmt(tr("Moving medium '%ls' ..."), bstrSrcName.raw()).raw(), mt.uWeight);
     1172                if (FAILED(hrc)) throw hrc;
    11801173            }
    11811174            else
    11821175            {
    11831176                strTargetImageName = mt.strBaseName;//Should contain full path to the image
    1184                 rc = m_pProgress->SetNextOperation(BstrFmt(tr("Moving medium '%ls' back..."),
    1185                                                            bstrSrcName.raw()).raw(),
    1186                                                    mt.uWeight);
    1187                 if (FAILED(rc)) throw rc;
     1177                hrc = m_pProgress->SetNextOperation(BstrFmt(tr("Moving medium '%ls' back..."), bstrSrcName.raw()).raw(), mt.uWeight);
     1178                if (FAILED(hrc)) throw hrc;
    11881179            }
    11891180
     
    11961187
    11971188            MediumType_T mediumType;//immutable, shared, passthrough
    1198             rc = pMedium->COMGETTER(Type)(&mediumType);
    1199             if (FAILED(rc)) throw rc;
     1189            hrc = pMedium->COMGETTER(Type)(&mediumType);
     1190            if (FAILED(hrc)) throw hrc;
    12001191
    12011192            DeviceType_T deviceType;//floppy, hard, DVD
    1202             rc = pMedium->COMGETTER(DeviceType)(&deviceType);
    1203             if (FAILED(rc)) throw rc;
     1193            hrc = pMedium->COMGETTER(DeviceType)(&deviceType);
     1194            if (FAILED(hrc)) throw hrc;
    12041195
    12051196            /* Drop lock early because IMedium::MoveTo needs to get the VirtualBox one. */
     
    12071198
    12081199            ComPtr<IProgress> moveDiskProgress;
    1209             rc = pMedium->MoveTo(bstrLocation.raw(), moveDiskProgress.asOutParam());
    1210             if (SUCCEEDED(rc))
     1200            hrc = pMedium->MoveTo(bstrLocation.raw(), moveDiskProgress.asOutParam());
     1201            if (SUCCEEDED(hrc))
    12111202            {
    12121203                /* In case of failure moveDiskProgress would be in the invalid state or not initialized at all
     
    12141205                 */
    12151206                /* Wait until the other process has finished. */
    1216                 rc = m_pProgress->WaitForOtherProgressCompletion(moveDiskProgress, 0 /* indefinite wait */);
     1207                hrc = m_pProgress->WaitForOtherProgressCompletion(moveDiskProgress, 0 /* indefinite wait */);
    12171208            }
    12181209
     
    12201211            machineLock.acquire();
    12211212
    1222             if (FAILED(rc)) throw rc;
     1213            if (FAILED(hrc)) throw hrc;
    12231214
    12241215            Log2(("Moving %s has been finished\n", strTargetImageName.c_str()));
     
    12291220        machineLock.release();
    12301221    }
    1231     catch(HRESULT hrc)
     1222    catch (HRESULT hrcXcpt)
     1223    {
     1224        Log2(("Exception during moving the disk %s: %Rhrc\n", strLocation.c_str(), hrcXcpt));
     1225        hrc = hrcXcpt;
     1226        machineLock.release();
     1227    }
     1228    catch (...)
    12321229    {
    12331230        Log2(("Exception during moving the disk %s\n", strLocation.c_str()));
    1234         rc = hrc;
     1231        hrc = VirtualBoxBase::handleUnexpectedExceptions(m_pMachine, RT_SRC_POS);
    12351232        machineLock.release();
    12361233    }
    1237     catch (...)
    1238     {
    1239         Log2(("Exception during moving the disk %s\n", strLocation.c_str()));
    1240         rc = VirtualBoxBase::handleUnexpectedExceptions(m_pMachine, RT_SRC_POS);
    1241         machineLock.release();
    1242     }
    1243 
    1244     return rc;
     1234
     1235    return hrc;
    12451236}
    12461237
     
    12481239{
    12491240    ComObjPtr<Snapshot> pSnapshot;
    1250     HRESULT rc = m_pMachine->i_findSnapshotById(Guid() /* zero */, pSnapshot, true);
    1251     if (SUCCEEDED(rc) && !pSnapshot.isNull())
     1241    HRESULT hrc = m_pMachine->i_findSnapshotById(Guid() /* zero */, pSnapshot, true);
     1242    if (SUCCEEDED(hrc) && !pSnapshot.isNull())
    12521243        pSnapshot->i_updateSavedStatePaths(sourcePath.c_str(),
    12531244                                           targetPath.c_str());
     
    12691260{
    12701261    ComObjPtr<Snapshot> pSnapshot;
    1271     HRESULT rc = m_pMachine->i_findSnapshotById(Guid() /* zero */, pSnapshot, true);
    1272     if (SUCCEEDED(rc) && !pSnapshot.isNull())
     1262    HRESULT hrc = m_pMachine->i_findSnapshotById(Guid() /* zero */, pSnapshot, true);
     1263    if (SUCCEEDED(hrc) && !pSnapshot.isNull())
    12731264        pSnapshot->i_updateNVRAMPaths(sourcePath.c_str(),
    12741265                                      targetPath.c_str());
     
    14131404{
    14141405    ComPtr<IMedium> pBaseMedium;
    1415     HRESULT rc = pMedium->COMGETTER(Base)(pBaseMedium.asOutParam());
    1416     if (FAILED(rc)) return rc;
     1406    HRESULT hrc = pMedium->COMGETTER(Base)(pBaseMedium.asOutParam());
     1407    if (FAILED(hrc)) return hrc;
    14171408    Bstr bstrBaseName;
    1418     rc = pBaseMedium->COMGETTER(Name)(bstrBaseName.asOutParam());
    1419     if (FAILED(rc)) return rc;
     1409    hrc = pBaseMedium->COMGETTER(Name)(bstrBaseName.asOutParam());
     1410    if (FAILED(hrc)) return hrc;
    14201411    strBaseName = bstrBaseName;
    1421     return rc;
     1412    return hrc;
    14221413}
    14231414
     
    14251416{
    14261417    Bstr name;
    1427     HRESULT rc = pSnapshot->COMGETTER(Name)(name.asOutParam());
    1428     if (FAILED(rc)) return rc;
     1418    HRESULT hrc = pSnapshot->COMGETTER(Name)(name.asOutParam());
     1419    if (FAILED(hrc)) return hrc;
    14291420
    14301421    ComPtr<IMachine> l_pMachine;
    1431     rc = pSnapshot->COMGETTER(Machine)(l_pMachine.asOutParam());
    1432     if (FAILED(rc)) return rc;
     1422    hrc = pSnapshot->COMGETTER(Machine)(l_pMachine.asOutParam());
     1423    if (FAILED(hrc)) return hrc;
    14331424    machineList.push_back((Machine*)(IMachine*)l_pMachine);
    14341425
    14351426    SafeIfaceArray<ISnapshot> sfaChilds;
    1436     rc = pSnapshot->COMGETTER(Children)(ComSafeArrayAsOutParam(sfaChilds));
    1437     if (FAILED(rc)) return rc;
     1427    hrc = pSnapshot->COMGETTER(Children)(ComSafeArrayAsOutParam(sfaChilds));
     1428    if (FAILED(hrc)) return hrc;
    14381429    for (size_t i = 0; i < sfaChilds.size(); ++i)
    14391430    {
    1440         rc = createMachineList(sfaChilds[i]);
    1441         if (FAILED(rc)) return rc;
    1442     }
    1443 
    1444     return rc;
     1431        hrc = createMachineList(sfaChilds[i]);
     1432        if (FAILED(hrc)) return hrc;
     1433    }
     1434
     1435    return hrc;
    14451436}
    14461437
     
    14501441     * adding all directly and indirectly attached disk images to the worker
    14511442     * list. */
    1452     HRESULT rc = S_OK;
     1443    HRESULT hrc = S_OK;
    14531444    for (size_t i = 0; i < machineList.size(); ++i)
    14541445    {
     
    14581449         * machines to a worker list. */
    14591450        SafeIfaceArray<IMediumAttachment> sfaAttachments;
    1460         rc = machine->COMGETTER(MediumAttachments)(ComSafeArrayAsOutParam(sfaAttachments));
    1461         if (FAILED(rc)) return rc;
     1451        hrc = machine->COMGETTER(MediumAttachments)(ComSafeArrayAsOutParam(sfaAttachments));
     1452        if (FAILED(hrc)) return hrc;
    14621453        for (size_t a = 0; a < sfaAttachments.size(); ++a)
    14631454        {
    14641455            const ComPtr<IMediumAttachment> &pAtt = sfaAttachments[a];
    14651456            DeviceType_T deviceType;//floppy, hard, DVD
    1466             rc = pAtt->COMGETTER(Type)(&deviceType);
    1467             if (FAILED(rc)) return rc;
     1457            hrc = pAtt->COMGETTER(Type)(&deviceType);
     1458            if (FAILED(hrc)) return hrc;
    14681459
    14691460            /* Valid medium attached? */
    14701461            ComPtr<IMedium> pMedium;
    1471             rc = pAtt->COMGETTER(Medium)(pMedium.asOutParam());
    1472             if (FAILED(rc)) return rc;
     1462            hrc = pAtt->COMGETTER(Medium)(pMedium.asOutParam());
     1463            if (FAILED(hrc)) return hrc;
    14731464
    14741465            if (pMedium.isNull())
     
    14761467
    14771468            Bstr bstrLocation;
    1478             rc = pMedium->COMGETTER(Location)(bstrLocation.asOutParam());
    1479             if (FAILED(rc)) return rc;
     1469            hrc = pMedium->COMGETTER(Location)(bstrLocation.asOutParam());
     1470            if (FAILED(hrc)) return hrc;
    14801471
    14811472            /* Cast to ComObjPtr<Medium> */
     
    14831474
    14841475            /* Check for "read-only" medium in terms that VBox can't create this one */
    1485             rc = isMediumTypeSupportedForMoving(pMedium);
    1486             if (FAILED(rc))
    1487             {
    1488                 if (rc == S_FALSE)
    1489                 {
    1490                     Log2(("Skipping file %ls because of this medium type hasn't been supported for moving.\n",
    1491                           bstrLocation.raw()));
    1492                     continue;
    1493                 }
    1494                 else
    1495                     return rc;
     1476            hrc = isMediumTypeSupportedForMoving(pMedium);
     1477            if (FAILED(hrc))
     1478            {
     1479                if (hrc != S_FALSE)
     1480                    return hrc;
     1481                Log2(("Skipping file %ls because of this medium type hasn't been supported for moving.\n", bstrLocation.raw()));
     1482                continue;
    14961483            }
    14971484
     
    15051492                /* Refresh the state so that the file size get read. */
    15061493                MediumState_T e;
    1507                 rc = pMedium->RefreshState(&e);
    1508                 if (FAILED(rc)) return rc;
     1494                hrc = pMedium->RefreshState(&e);
     1495                if (FAILED(hrc)) return hrc;
    15091496
    15101497                LONG64 lSize;
    1511                 rc = pMedium->COMGETTER(Size)(&lSize);
    1512                 if (FAILED(rc)) return rc;
     1498                hrc = pMedium->COMGETTER(Size)(&lSize);
     1499                if (FAILED(hrc)) return hrc;
    15131500
    15141501                MediumType_T mediumType;//immutable, shared, passthrough
    1515                 rc = pMedium->COMGETTER(Type)(&mediumType);
    1516                 if (FAILED(rc)) return rc;
    1517 
    1518                 rc = pMedium->COMGETTER(Location)(bstrLocation.asOutParam());
    1519                 if (FAILED(rc)) return rc;
     1502                hrc = pMedium->COMGETTER(Type)(&mediumType);
     1503                if (FAILED(hrc)) return hrc;
     1504
     1505                hrc = pMedium->COMGETTER(Location)(bstrLocation.asOutParam());
     1506                if (FAILED(hrc)) return hrc;
    15201507
    15211508                MEDIUMTASKMOVE mt;// = {false, "basename", NULL, 0, 0};
     
    15341521
    15351522                /* Query next parent. */
    1536                 rc = pMedium->COMGETTER(Parent)(pMedium.asOutParam());
    1537                 if (FAILED(rc)) return rc;
     1523                hrc = pMedium->COMGETTER(Parent)(pMedium.asOutParam());
     1524                if (FAILED(hrc)) return hrc;
    15381525            }
    15391526
     
    15421529
    15431530        /* Add the save state files of this machine if there is one. */
    1544         rc = addSaveState(machine);
    1545         if (FAILED(rc)) return rc;
     1531        hrc = addSaveState(machine);
     1532        if (FAILED(hrc)) return hrc;
    15461533
    15471534        /* Add the NVRAM files of this machine if there is one. */
    1548         rc = addNVRAM(machine);
    1549         if (FAILED(rc)) return rc;
     1535        hrc = addNVRAM(machine);
     1536        if (FAILED(hrc)) return hrc;
    15501537    }
    15511538
     
    15611548    }
    15621549
    1563     return rc;
     1550    return hrc;
    15641551}
    15651552
     
    15671554{
    15681555    Bstr bstrSrcSaveStatePath;
    1569     HRESULT rc = machine->COMGETTER(StateFilePath)(bstrSrcSaveStatePath.asOutParam());
    1570     if (FAILED(rc)) return rc;
     1556    HRESULT hrc = machine->COMGETTER(StateFilePath)(bstrSrcSaveStatePath.asOutParam());
     1557    if (FAILED(hrc)) return hrc;
    15711558    if (!bstrSrcSaveStatePath.isEmpty())
    15721559    {
     
    15951582{
    15961583    ComPtr<INvramStore> pNvramStore;
    1597     HRESULT rc = machine->COMGETTER(NonVolatileStore)(pNvramStore.asOutParam());
    1598     if (FAILED(rc)) return rc;
     1584    HRESULT hrc = machine->COMGETTER(NonVolatileStore)(pNvramStore.asOutParam());
     1585    if (FAILED(hrc)) return hrc;
    15991586    Bstr bstrSrcNVRAMPath;
    1600     rc = pNvramStore->COMGETTER(NonVolatileStorageFile)(bstrSrcNVRAMPath.asOutParam());
    1601     if (FAILED(rc)) return rc;
     1587    hrc = pNvramStore->COMGETTER(NonVolatileStorageFile)(bstrSrcNVRAMPath.asOutParam());
     1588    if (FAILED(hrc)) return hrc;
    16021589    Utf8Str strSrcNVRAMPath(bstrSrcNVRAMPath);
    16031590    if (!strSrcNVRAMPath.isEmpty() && RTFileExists(strSrcNVRAMPath.c_str()))
     
    16521639{
    16531640    Bstr bstrLocation;
    1654     HRESULT rc = pMedium->COMGETTER(Location)(bstrLocation.asOutParam());
    1655     if (FAILED(rc))
    1656         return rc;
     1641    HRESULT hrc = pMedium->COMGETTER(Location)(bstrLocation.asOutParam());
     1642    if (FAILED(hrc))
     1643        return hrc;
    16571644
    16581645    DeviceType_T deviceType;
    1659     rc = pMedium->COMGETTER(DeviceType)(&deviceType);
    1660     if (FAILED(rc))
    1661         return rc;
     1646    hrc = pMedium->COMGETTER(DeviceType)(&deviceType);
     1647    if (FAILED(hrc))
     1648        return hrc;
    16621649
    16631650    ComPtr<IMediumFormat> mediumFormat;
    1664     rc = pMedium->COMGETTER(MediumFormat)(mediumFormat.asOutParam());
    1665     if (FAILED(rc))
    1666         return rc;
     1651    hrc = pMedium->COMGETTER(MediumFormat)(mediumFormat.asOutParam());
     1652    if (FAILED(hrc))
     1653        return hrc;
    16671654
    16681655    /* Check whether VBox is able to create this medium format or not, i.e. medium can be "read-only" */
    16691656    Bstr bstrFormatName;
    1670     rc = mediumFormat->COMGETTER(Name)(bstrFormatName.asOutParam());
    1671     if (FAILED(rc))
    1672         return rc;
     1657    hrc = mediumFormat->COMGETTER(Name)(bstrFormatName.asOutParam());
     1658    if (FAILED(hrc))
     1659        return hrc;
    16731660
    16741661    Utf8Str formatName = Utf8Str(bstrFormatName);
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