Changeset 44039 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Dec 5, 2012 12:08:52 PM (12 years ago)
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r43041 r44039 2640 2640 if (cHardDisks == 1) 2641 2641 { 2642 if (hdUuid.is Empty())2642 if (hdUuid.isZero()) 2643 2643 hdUuid = thisUuid; 2644 2644 else … … 2647 2647 else 2648 2648 { 2649 if (thisUuid.isEmpty())2649 if (thisUuid.isZero()) 2650 2650 fInconsistent = true; 2651 2651 else if (thisUuid == hdUuid) … … 2700 2700 settings::AttachedDevice &d = *dit; 2701 2701 2702 if (d.uuid.is Empty())2702 if (d.uuid.isZero()) 2703 2703 // empty DVD and floppy media 2704 2704 continue; -
trunk/src/VBox/Main/src-server/HostImpl.cpp
r43958 r44039 1434 1434 return E_NOTIMPL; 1435 1435 #else 1436 if ( Guid(id).isEmpty())1436 if (!Guid(id).isValid()) 1437 1437 return E_INVALIDARG; 1438 1438 if (!networkInterface) … … 1538 1538 { 1539 1539 #ifdef VBOX_WITH_USB 1540 CheckComArgExpr(aId, Guid (aId).is Empty() == false);1540 CheckComArgExpr(aId, Guid (aId).isValid() == true); 1541 1541 CheckComArgOutPointerValid(aDevice); 1542 1542 … … 1869 1869 1870 1870 Guid uuid(strNameOrId); 1871 if ( !uuid.isEmpty())1871 if (uuid.isValid() && !uuid.isZero()) 1872 1872 return findHostDriveById(mediumType, uuid, true /* fRefresh */, pMedium); 1873 1873 -
trunk/src/VBox/Main/src-server/HostNetworkInterfaceImpl.cpp
r43933 r44039 70 70 71 71 ComAssertRet(!aInterfaceName.isEmpty(), E_INVALIDARG); 72 ComAssertRet(!aGuid.is Empty(), E_INVALIDARG);72 ComAssertRet(!aGuid.isValid(), E_INVALIDARG); 73 73 74 74 /* Enclose the state transition NotReady->InInit->Ready */ … … 185 185 186 186 // ComAssertRet(aInterfaceName, E_INVALIDARG); 187 // ComAssertRet( !aGuid.isEmpty(), E_INVALIDARG);187 // ComAssertRet(aGuid.isValid(), E_INVALIDARG); 188 188 ComAssertRet(pIf, E_INVALIDARG); 189 189 -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r43949 r44039 685 685 AssertReturn(!isSessionMachine(), E_FAIL); 686 686 AssertReturn(!isSnapshotMachine(), E_FAIL); 687 AssertReturn( !mData->mUuid.isEmpty(), E_FAIL);687 AssertReturn(mData->mUuid.isValid(), E_FAIL); 688 688 AssertReturn(!mData->mAccessible, E_FAIL); 689 689 … … 854 854 * because at this point we did not call uninitDataAndChildObjects() yet 855 855 * and therefore also removeBackReference() for all these mediums was not called! */ 856 if (!uuidMachine.isEmpty()) // can be empty if we're called from a failure of Machine::init 856 857 if (uuidMachine.isValid() && !uuidMachine.isZero()) // can be empty if we're called from a failure of Machine::init 857 858 mParent->unregisterMachineMedia(uuidMachine); 858 859 … … 1000 1001 // never be found by findMachine() 1001 1002 Guid test(aName); 1002 if (test.isNotEmpty()) 1003 //if (test.isNotEmpty()) 1004 if (test.isValid()) 1003 1005 return setError(E_INVALIDARG, tr("A machine cannot have a UUID as its name")); 1004 1006 … … 1338 1340 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1339 1341 1340 if ( !mHWData->mHardwareUUID.isEmpty())1342 if (mHWData->mHardwareUUID.isValid()) 1341 1343 mHWData->mHardwareUUID.toUtf16().cloneTo(aUUID); 1342 1344 else … … 1349 1351 { 1350 1352 Guid hardwareUUID(aUUID); 1351 if ( hardwareUUID.isEmpty())1353 if (!hardwareUUID.isValid()) 1352 1354 return E_INVALIDARG; 1353 1355 … … 5293 5295 { 5294 5296 Guid uuid(aNameOrId); 5295 if ( !uuid.isEmpty())5297 if (uuid.isValid()) 5296 5298 rc = findSnapshotById(uuid, pSnapshot, true /* aSetError */); 5297 5299 else … … 9029 9031 } 9030 9032 9031 if (aId.is Empty())9033 if (aId.isZero()) 9032 9034 aSnapshot = mData->mFirstSnapshot; 9033 9035 else -
trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp
r42109 r44039 951 951 * with the stuff from the snapshot. */ 952 952 settings::Snapshot sn; 953 if (!d->snapshotId.isEmpty()) 953 954 if (d->snapshotId.isValid() && !d->snapshotId.isZero()) 954 955 if (!d->findSnapshot(trgMCF.llFirstSnapshot, d->snapshotId, sn)) 955 956 throw p->setError(E_FAIL, … … 960 961 if (d->mode == CloneMode_MachineState) 961 962 { 962 if ( !sn.uuid.isEmpty())963 if (sn.uuid.isValid() && !sn.uuid.isZero()) 963 964 { 964 965 trgMCF.hardwareMachine = sn.hardware; … … 971 972 } 972 973 else if ( d->mode == CloneMode_MachineAndChildStates 973 && !sn.uuid.isEmpty()) 974 && sn.uuid.isValid() 975 && !sn.uuid.isZero()) 974 976 { 975 977 if (!d->pOldMachineState.isNull()) … … 1323 1325 /* Update the path in the configuration either for the current 1324 1326 * machine state or the snapshots. */ 1325 if ( sst.snapshotUuid.isEmpty())1327 if (!sst.snapshotUuid.isValid() || sst.snapshotUuid.isZero()) 1326 1328 trgMCF.strStateFile = strTrgSaveState; 1327 1329 else -
trunk/src/VBox/Main/src-server/MediumImpl.cpp
r44029 r44039 69 69 const Guid &aSnapshotId = Guid::Empty) 70 70 : machineId(aMachineId), 71 fInCurState(aSnapshotId.is Empty())72 { 73 if ( !aSnapshotId.isEmpty())71 fInCurState(aSnapshotId.isZero()) 72 { 73 if (aSnapshotId.isValid() && !aSnapshotId.isZero()) 74 74 llSnapshotIds.push_back(aSnapshotId); 75 75 } … … 942 942 unconst(m->pVirtualBox) = aVirtualBox; 943 943 944 if ( !uuidMachineRegistry.isEmpty())944 if (uuidMachineRegistry.isValid() && !uuidMachineRegistry.isZero()) 945 945 m->llRegistryIDs.push_back(uuidMachineRegistry); 946 946 … … 1087 1087 else 1088 1088 { 1089 AssertStmt(!m->id.is Empty(),1089 AssertStmt(!m->id.isZero(), 1090 1090 alock.release(); autoCaller.release(); uninit(); return E_FAIL); 1091 1091 … … 1142 1142 unconst(m->pVirtualBox) = aVirtualBox; 1143 1143 1144 if ( !uuidMachineRegistry.isEmpty())1144 if (uuidMachineRegistry.isValid() && !uuidMachineRegistry.isZero()) 1145 1145 m->llRegistryIDs.push_back(uuidMachineRegistry); 1146 1146 … … 2000 2000 { 2001 2001 imageId = Guid(aImageId); 2002 if ( imageId.isEmpty())2003 return setError(E_INVALIDARG, tr("Argument %s is empty"), "aImageId");2002 if (!imageId.isValid()) 2003 return setError(E_INVALIDARG, tr("Argument %s is invalid"), "aImageId"); 2004 2004 } 2005 2005 } … … 2061 2061 ComSafeArrayOut(BSTR, aSnapshotIds)) 2062 2062 { 2063 CheckComArgExpr(aMachineId, Guid(aMachineId).is Empty() == false);2063 CheckComArgExpr(aMachineId, Guid(aMachineId).isValid() == true); 2064 2064 CheckComArgOutSafeArrayPointerValid(aSnapshotIds); 2065 2065 … … 3401 3401 const Guid &aSnapshotId /*= Guid::Empty*/) 3402 3402 { 3403 AssertReturn( !aMachineId.isEmpty(), E_FAIL);3403 AssertReturn(aMachineId.isValid(), E_FAIL); 3404 3404 3405 3405 LogFlowThisFunc(("ENTER, aMachineId: {%RTuuid}, aSnapshotId: {%RTuuid}\n", aMachineId.raw(), aSnapshotId.raw())); … … 3443 3443 // to a machine a medium which represents the machine's current state, 3444 3444 // so set the flag 3445 if (aSnapshotId.isEmpty()) 3445 3446 if (aSnapshotId.isZero()) 3446 3447 { 3447 3448 /* sanity: no duplicate attachments */ … … 3499 3500 const Guid &aSnapshotId /*= Guid::Empty*/) 3500 3501 { 3501 AssertReturn( !aMachineId.isEmpty(), E_FAIL);3502 AssertReturn(aMachineId.isValid(), E_FAIL); 3502 3503 3503 3504 AutoCaller autoCaller(this); … … 3511 3512 AssertReturn(it != m->backRefs.end(), E_FAIL); 3512 3513 3513 if (aSnapshotId.is Empty())3514 if (aSnapshotId.isZero()) 3514 3515 { 3515 3516 /* remove the current state attachment */ … … 4589 4590 && ( !aMachineId 4590 4591 || m->backRefs.size() != 1 4591 || aMachineId->is Empty()4592 || aMachineId->isZero() 4592 4593 || *getFirstMachineBackrefId() != *aMachineId 4593 || ( (!aSnapshotId || !aSnapshotId->is Empty())4594 || ( (!aSnapshotId || !aSnapshotId->isZero()) 4594 4595 && *getFirstMachineBackrefSnapshotId() != *aSnapshotId))) 4595 4596 throw setError(VBOX_E_OBJECT_IN_USE, … … 5435 5436 /* are we dealing with a new medium constructed using the existing 5436 5437 * location? */ 5437 bool isImport = m->id.is Empty();5438 bool isImport = m->id.isZero(); 5438 5439 unsigned uOpenFlags = VD_OPEN_FLAGS_INFO; 5439 5440 … … 5560 5561 mediumId = uuid; 5561 5562 5562 if (mediumId.is Empty() && (m->hddOpenMode == OpenReadOnly))5563 if (mediumId.isZero() && (m->hddOpenMode == OpenReadOnly)) 5563 5564 // only when importing a VDMK that has no UUID, create one in memory 5564 5565 mediumId.create(); … … 5566 5567 else 5567 5568 { 5568 Assert(!mediumId.isEmpty());5569 Assert(!mediumId.isZero()); 5569 5570 5570 5571 if (mediumId != uuid) … … 6034 6035 || ( autoCaller.state() == InInit 6035 6036 && m->state != MediumState_NotCreated 6036 && m->id.is Empty()6037 && m->id.isZero() 6037 6038 && m->strFormat.isEmpty() 6038 6039 && m->formatObj.isNull()), … … 6593 6594 * the setLocation() argument). Otherwise we have to generate it */ 6594 6595 Guid id = m->id; 6595 fGenerateUuid = id.isEmpty(); 6596 6597 fGenerateUuid = id.isZero(); 6596 6598 if (fGenerateUuid) 6597 6599 { … … 6730 6732 * the setLocation() argument). Otherwise we have to generate it */ 6731 6733 Guid targetId = pTarget->m->id; 6732 fGenerateUuid = targetId.isEmpty(); 6734 6735 fGenerateUuid = targetId.isZero(); 6733 6736 if (fGenerateUuid) 6734 6737 { … … 7234 7237 * the setLocation() argument). Otherwise we have to generate it */ 7235 7238 Guid targetId = pTarget->m->id; 7236 fGenerateUuid = targetId.isEmpty(); 7239 7240 fGenerateUuid = targetId.isZero(); 7237 7241 if (fGenerateUuid) 7238 7242 { … … 8052 8056 * the setLocation() argument). Otherwise we have to generate it */ 8053 8057 Guid targetId = m->id; 8054 fGenerateUuid = targetId.isEmpty(); 8058 8059 fGenerateUuid = targetId.isZero(); 8055 8060 if (fGenerateUuid) 8056 8061 { -
trunk/src/VBox/Main/src-server/SnapshotImpl.cpp
r43915 r44039 115 115 LogFlowThisFunc(("uuid=%s aParent->uuid=%s\n", aId.toString().c_str(), (aParent) ? aParent->m->uuid.toString().c_str() : "")); 116 116 117 ComAssertRet(!aId.is Empty() && !aName.isEmpty() && aMachine, E_INVALIDARG);117 ComAssertRet(!aId.isZero() && aId.isValid() && !aName.isEmpty() && aMachine, E_INVALIDARG); 118 118 119 119 /* Enclose the state transition NotReady->InInit->Ready */ … … 329 329 // never be found by findMachine() 330 330 Guid test(aName); 331 if (test.isNotEmpty()) 331 332 if (!test.isZero() && test.isValid()) 332 333 return setError(E_INVALIDARG, tr("A machine cannot have a UUID as its name")); 333 334 … … 956 957 LogFlowThisFunc(("mName={%s}\n", aSessionMachine->mUserData->s.strName.c_str())); 957 958 958 AssertReturn(aSessionMachine && !Guid(aSnapshotId).isEmpty(), E_INVALIDARG); 959 Guid l_guid(aSnapshotId); 960 AssertReturn(aSessionMachine && (!l_guid.isZero() && l_guid.isValid()), E_INVALIDARG); 959 961 960 962 /* Enclose the state transition NotReady->InInit->Ready */ … … 1097 1099 LogFlowThisFunc(("mName={%s}\n", aMachine->mUserData->s.strName.c_str())); 1098 1100 1099 AssertReturn(aMachine && !Guid(aSnapshotId).isEmpty(), E_INVALIDARG); 1101 Guid l_guid(aSnapshotId); 1102 AssertReturn(aMachine && (!l_guid.isZero() && l_guid.isValid()), E_INVALIDARG); 1100 1103 1101 1104 /* Enclose the state transition NotReady->InInit->Ready */ … … 2062 2065 Guid startId(aStartId); 2063 2066 Guid endId(aEndId); 2064 AssertReturn(aInitiator && !startId.isEmpty() && !endId.isEmpty(), E_INVALIDARG); 2067 2068 AssertReturn(aInitiator && !startId.isZero() && !endId.isZero() && startId.isValid() && endId.isValid(), E_INVALIDARG); 2069 2065 2070 AssertReturn(aMachineState && aProgress, E_POINTER); 2066 2071 … … 2463 2468 replaceSnapshotId = *pSnapshotId; 2464 2469 2465 if ( !replaceMachineId.isEmpty())2470 if (replaceMachineId.isValid() && !replaceMachineId.isZero()) 2466 2471 { 2467 2472 // Adjust the backreferences, otherwise merging will assert. … … 3240 3245 } 3241 3246 3242 if ( !aMachineId.isEmpty())3247 if (aMachineId.isValid() && !aMachineId.isZero()) 3243 3248 { 3244 3249 // reattach the source media to the snapshot -
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r44029 r44039 1453 1453 } 1454 1454 } 1455 if (id.isEmpty()) 1455 1456 if (id.isZero()) 1456 1457 fDirectoryIncludesUUID = false; 1458 else if (!id.isValid()) 1459 { 1460 /* do something else */ 1461 return setError(E_INVALIDARG, 1462 tr("'%ls' is not a valid Guid"), 1463 id.toStringCurly().c_str()); 1464 } 1457 1465 1458 1466 Utf8Str strGroup(aGroup); … … 1649 1657 } 1650 1658 /* Create UUID if none was specified. */ 1651 if (id.is Empty())1659 if (id.isZero()) 1652 1660 id.create(); 1661 else if (!id.isValid()) 1662 { 1663 /* do something else */ 1664 return setError(E_INVALIDARG, 1665 tr("'%ls' is not a valid Guid"), 1666 id.toStringCurly().c_str()); 1667 } 1653 1668 1654 1669 /* NULL settings file means compose automatically */ … … 1780 1795 1781 1796 Guid id(aNameOrId); 1782 if (!id.isEmpty()) 1797 if (id.isValid() && !id.isZero()) 1798 1783 1799 rc = findMachine(id, 1784 1800 true /* fPermitInaccessible */, … … 1953 1969 { 1954 1970 case DeviceType_HardDisk: 1955 if ( !id.isEmpty())1971 if (id.isValid() && !id.isZero()) 1956 1972 rc = findHardDiskById(id, false /* setError */, &pMedium); 1957 1973 else … … 1963 1979 case DeviceType_Floppy: 1964 1980 case DeviceType_DVD: 1965 if ( !id.isEmpty())1981 if (id.isValid() && !id.isZero()) 1966 1982 rc = findDVDOrFloppyImage(deviceType, &id, Utf8Str::Empty, 1967 1983 false /* setError */, &pMedium); … … 3407 3423 ComObjPtr<Medium> *aHardDisk /*= NULL*/) 3408 3424 { 3409 AssertReturn(!id.is Empty(), E_INVALIDARG);3425 AssertReturn(!id.isZero(), E_INVALIDARG); 3410 3426 3411 3427 // we use the hard disks map, but it is protected by the … … 3614 3630 ComObjPtr<Medium> &pMedium) 3615 3631 { 3616 if (uuid.is Empty())3632 if (uuid.isZero()) 3617 3633 { 3618 3634 // that's easy 3619 3635 pMedium.setNull(); 3620 3636 return S_OK; 3637 } 3638 else if (!uuid.isValid()) 3639 { 3640 /* handling of case invalid GUID */ 3641 return setError(VBOX_E_OBJECT_NOT_FOUND, 3642 tr("Guid '%ls' is invalid"), 3643 uuid.toString().c_str()); 3621 3644 } 3622 3645 … … 3821 3844 ComObjPtr<Medium> *ppMedium) 3822 3845 { 3823 AssertReturn(!aId.is Empty() && !aLocation.isEmpty(), E_FAIL);3846 AssertReturn(!aId.isZero() && !aLocation.isEmpty(), E_FAIL); 3824 3847 AssertReturn(ppMedium, E_INVALIDARG); 3825 3848 … … 3834 3857 const char *pcszType = NULL; 3835 3858 3836 if ( !aId.isEmpty())3859 if (aId.isValid() && !aId.isZero()) 3837 3860 rc = findHardDiskById(aId, false /* aSetError */, &pMediumFound); 3838 3861 if (FAILED(rc) && !aLocation.isEmpty()) … … 4423 4446 HRESULT VirtualBox::unregisterMachineMedia(const Guid &uuidMachine) 4424 4447 { 4425 Assert(!uuidMachine.is Empty());4448 Assert(!uuidMachine.isZero() && uuidMachine.isValid()); 4426 4449 4427 4450 LogFlowFuncEnter();
Note:
See TracChangeset
for help on using the changeset viewer.