Changeset 24273 in vbox
- Timestamp:
- Nov 2, 2009 5:36:22 PM (15 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/MachineImpl.cpp
r24271 r24273 1501 1501 if (!mData->mCurrentSnapshot.isNull()) 1502 1502 return setError(E_FAIL, 1503 tr("The snapshot folder of a machine with snapshots cannot be changed (please d iscardall snapshots first)"));1503 tr("The snapshot folder of a machine with snapshots cannot be changed (please delete all snapshots first)")); 1504 1504 1505 1505 Utf8Str snapshotFolder = aSnapshotFolder; … … 2155 2155 AutoReadLock mediumLock(pMedium); 2156 2156 return setError(VBOX_E_OBJECT_IN_USE, 2157 tr("Medium '% ls' is already attached to device slot %d on port %d of controller '%ls' of this virtual machine"),2157 tr("Medium '%s' is already attached to device slot %d on port %d of controller '%ls' of this virtual machine"), 2158 2158 pMedium->locationFull().raw(), aDevice, aControllerPort, aControllerName); 2159 2159 } … … 2256 2256 { 2257 2257 return setError(VBOX_E_OBJECT_IN_USE, 2258 tr("Medium '% ls' is already attached to this virtual machine"),2258 tr("Medium '%s' is already attached to this virtual machine"), 2259 2259 medium->locationFull().raw()); 2260 2260 } … … 5655 5655 for (size_t i = 0; i < drivevec.size(); ++i) 5656 5656 { 5657 Bstr hostDriveSrc(dev.strHostDriveSrc);5658 5657 /// @todo eliminate this conversion 5659 5658 ComObjPtr<Medium> med = (Medium *)drivevec[i]; 5660 if ( hostDriveSrc == med->name()5661 || hostDriveSrc == med->location())5659 if ( dev.strHostDriveSrc == med->name() 5660 || dev.strHostDriveSrc == med->location()) 5662 5661 { 5663 5662 medium = med; … … 5708 5707 if (mType == IsSnapshotMachine) 5709 5708 return setError(E_FAIL, 5710 tr("Immutable hard disk '% ls' with UUID {%RTuuid} cannot be directly attached to snapshot with UUID {%RTuuid} "5709 tr("Immutable hard disk '%s' with UUID {%RTuuid} cannot be directly attached to snapshot with UUID {%RTuuid} " 5711 5710 "of the virtual machine '%ls' ('%s')"), 5712 5711 medium->locationFull().raw(), … … 5717 5716 5718 5717 return setError(E_FAIL, 5719 tr("Immutable hard disk '% ls' with UUID {%RTuuid} cannot be directly attached to the virtual machine '%ls' ('%s')"),5718 tr("Immutable hard disk '%s' with UUID {%RTuuid} cannot be directly attached to the virtual machine '%ls' ('%s')"), 5720 5719 medium->locationFull().raw(), 5721 5720 dev.uuid.raw(), … … 5728 5727 ) 5729 5728 return setError(E_FAIL, 5730 tr("Hard disk '% ls' with UUID {%RTuuid} cannot be directly attached to the virtual machine '%ls' ('%s') "5729 tr("Hard disk '%s' with UUID {%RTuuid} cannot be directly attached to the virtual machine '%ls' ('%s') " 5731 5730 "because it has %d differencing child hard disks"), 5732 5731 medium->locationFull().raw(), … … 5739 5738 medium)) 5740 5739 return setError(E_FAIL, 5741 tr("Hard disk '% ls' with UUID {%RTuuid} is already attached to the virtual machine '%ls' ('%s')"),5740 tr("Hard disk '%s' with UUID {%RTuuid} is already attached to the virtual machine '%ls' ('%s')"), 5742 5741 medium->locationFull().raw(), 5743 5742 dev.uuid.raw(), … … 5750 5749 default: 5751 5750 return setError(E_FAIL, 5752 tr("Device with unknown type is attached to the virtual machine '% ls' ('%s')"),5751 tr("Device with unknown type is attached to the virtual machine '%s' ('%s')"), 5753 5752 medium->locationFull().raw(), 5754 5753 mUserData->mName.raw(), … … 6533 6532 settings::StorageController &data) 6534 6533 { 6535 using namespace settings;6536 6537 6534 MediaData::AttachmentList atts; 6538 6535 … … 6547 6544 settings::AttachedDevice dev; 6548 6545 6549 dev.deviceType = (*it)->type(); 6550 dev.lPort = (*it)->port(); 6551 dev.lDevice = (*it)->device(); 6552 if (!(*it)->medium().isNull()) 6546 MediumAttachment *pAttach = *it; 6547 Medium *pMedium = pAttach->medium(); 6548 6549 dev.deviceType = pAttach->type(); 6550 dev.lPort = pAttach->port(); 6551 dev.lDevice = pAttach->device(); 6552 if (pMedium) 6553 6553 { 6554 6554 BOOL fHostDrive = false; 6555 rc = (*it)->medium()->COMGETTER(HostDrive)(&fHostDrive);6555 rc = pMedium->COMGETTER(HostDrive)(&fHostDrive); 6556 6556 if (FAILED(rc)) 6557 6557 return rc; 6558 6558 if (fHostDrive) 6559 dev.strHostDriveSrc = (*it)->medium()->location();6559 dev.strHostDriveSrc = pMedium->location(); 6560 6560 else 6561 dev.uuid = (*it)->medium()->id();6562 dev.fPassThrough = (*it)->passthrough();6561 dev.uuid = pMedium->id(); 6562 dev.fPassThrough = pAttach->passthrough(); 6563 6563 } 6564 6564 … … 8933 8933 // if we can't access the file here, then we'll be doomed later also, so fail right away 8934 8934 setError(E_FAIL, tr("Cannot access state file '%s', runtime error, %Rra"), pSnapshot->stateFilePath().c_str(), irc); 8935 if (ullSize == 0) 8936 ullSize = 1;8935 if (ullSize == 0) // avoid division by zero 8936 ullSize = _1M; 8937 8937 8938 8938 ulStateFileSizeMB = (ULONG)(ullSize / _1M); 8939 8939 LogFlowThisFunc(("op %d: saved state file '%s' has %RI64 bytes (%d MB)\n", 8940 ulOpCount, pSnapshot->stateFilePath().raw(), ullSize, ulStateFileSizeMB));8940 ulOpCount, pSnapshot->stateFilePath().raw(), ullSize, ulStateFileSizeMB)); 8941 8941 8942 8942 ulTotalWeight += ulStateFileSizeMB; … … 9623 9623 if (aSuccess) 9624 9624 { 9625 // new snapshot becomes the current one 9625 9626 mData->mCurrentSnapshot = mSnapshotData.mSnapshot; 9626 9627 -
trunk/src/VBox/Main/MediumImpl.cpp
r24258 r24273 109 109 110 110 const Guid id; 111 Bstr description;111 Utf8Str strDescription; 112 112 MediumState_T state; 113 Bstr location;114 Bstr locationFull;113 Utf8Str strLocation; 114 Utf8Str strLocationFull; 115 115 uint64_t size; 116 Bstr lastAccessError;116 Utf8Str strLastAccessError; 117 117 118 118 BackRefList backRefs; … … 124 124 bool queryInfoRunning : 1; 125 125 126 const Bstr format;126 const Utf8Str strFormat; 127 127 ComObjPtr<MediumFormat> formatObj; 128 128 … … 553 553 { 554 554 return setError(E_FAIL, 555 tr("Medium '% ls' involved in the merge operation has more than one child medium (%d)"),556 aMedium->m-> locationFull.raw(),555 tr("Medium '%s' involved in the merge operation has more than one child medium (%d)"), 556 aMedium->m->strLocationFull.raw(), 557 557 aMedium->children().size()); 558 558 } … … 563 563 if (aMedium->m->backRefs.size() != 0) 564 564 return setError(E_FAIL, 565 tr("Medium '% ls' is attached to %d virtual machines"),566 aMedium->m-> locationFull.raw(),565 tr("Medium '%s' is attached to %d virtual machines"), 566 aMedium->m->strLocationFull.raw(), 567 567 aMedium->m->backRefs.size()); 568 568 } … … 572 572 if (aMedium->m->type == MediumType_Immutable) 573 573 return setError(E_FAIL, 574 tr("Medium '% ls' is immutable"),575 aMedium->m-> locationFull.raw());574 tr("Medium '%s' is immutable"), 575 aMedium->m->strLocationFull.raw()); 576 576 } 577 577 … … 1030 1030 if (m->state == MediumState_Inaccessible) 1031 1031 { 1032 Assert(!m-> lastAccessError.isEmpty());1033 rc = setError(E_FAIL, Utf8Str(m->lastAccessError));1032 Assert(!m->strLastAccessError.isEmpty()); 1033 rc = setError(E_FAIL, m->strLastAccessError); 1034 1034 } 1035 1035 else … … 1038 1038 1039 1039 /* storage format must be detected by queryInfo() if the medium is accessible */ 1040 AssertReturn(!m-> format.isNull(), E_FAIL);1040 AssertReturn(!m->strFormat.isEmpty(), E_FAIL); 1041 1041 } 1042 1042 } … … 1094 1094 * as inaccessible for now */ 1095 1095 m->state = MediumState_Inaccessible; 1096 m-> lastAccessError = tr("Accessibility check was not yet performed");1096 m->strLastAccessError = tr("Accessibility check was not yet performed"); 1097 1097 1098 1098 /* required */ … … 1103 1103 1104 1104 /* optional */ 1105 m-> description = data.strDescription;1105 m->strDescription = data.strDescription; 1106 1106 1107 1107 /* required */ … … 1157 1157 m->devType = aDeviceType; 1158 1158 1159 LogFlowThisFunc(("m->locationFull='% ls', m->format=%ls, m->id={%RTuuid}\n",1160 m-> locationFull.raw(), m->format.raw(), m->id.raw()));1159 LogFlowThisFunc(("m->locationFull='%s', m->format=%s, m->id={%RTuuid}\n", 1160 m->strLocationFull.raw(), m->strFormat.raw(), m->id.raw())); 1161 1161 1162 1162 /* Don't call queryInfo() for registered media to prevent the calling … … 1247 1247 rc = setLocation(aLocation); 1248 1248 CheckComRCReturnRC(rc); 1249 m-> description = aDescription;1249 m->strDescription = aDescription; 1250 1250 1251 1251 /// @todo generate uuid (similarly to host network interface uuid) from location and device type … … 1340 1340 AutoReadLock alock(this); 1341 1341 1342 if (m-> description.isEmpty())1342 if (m->strDescription.isEmpty()) 1343 1343 Bstr("").cloneTo(aDescription); 1344 1344 else 1345 m-> description.cloneTo(aDescription);1345 m->strDescription.cloneTo(aDescription); 1346 1346 1347 1347 return S_OK; … … 1387 1387 AutoReadLock alock(this); 1388 1388 1389 m-> locationFull.cloneTo(aLocation);1389 m->strLocationFull.cloneTo(aLocation); 1390 1390 1391 1391 return S_OK; … … 1478 1478 1479 1479 /* no need to lock, m->format is const */ 1480 m-> format.cloneTo(aFormat);1480 m->strFormat.cloneTo(aFormat); 1481 1481 1482 1482 return S_OK; … … 1527 1527 if (!mParent.isNull()) 1528 1528 return setError(E_FAIL, 1529 tr("Hard disk '% ls' is a differencing hard disk"),1530 m->locationFull.raw());1529 tr("Hard disk '%s' is a differencing hard disk"), 1530 m->strLocationFull.raw()); 1531 1531 1532 1532 /* cannot change the type of a hard disk being in use */ 1533 1533 if (m->backRefs.size() != 0) 1534 1534 return setError(E_FAIL, 1535 tr("Hard disk '% ls' is attached to %d virtual machines"),1536 m-> locationFull.raw(), m->backRefs.size());1535 tr("Hard disk '%s' is attached to %d virtual machines"), 1536 m->strLocationFull.raw(), m->backRefs.size()); 1537 1537 1538 1538 switch (aType) … … 1683 1683 if (mParent.isNull()) 1684 1684 return setError(VBOX_E_NOT_SUPPORTED, 1685 tr("Hard disk '% ls' is not differencing"),1686 m-> locationFull.raw());1685 tr("Hard disk '%s' is not differencing"), 1686 m->strLocationFull.raw()); 1687 1687 1688 1688 if (m->autoReset != aAutoReset) … … 1704 1704 AutoReadLock alock(this); 1705 1705 1706 if (m-> lastAccessError.isEmpty())1706 if (m->strLastAccessError.isEmpty()) 1707 1707 Bstr("").cloneTo(aLastAccessError); 1708 1708 else 1709 m-> lastAccessError.cloneTo(aLastAccessError);1709 m->strLastAccessError.cloneTo(aLastAccessError); 1710 1710 1711 1711 return S_OK; … … 1908 1908 LogFlowThisFunc(("Failing - state=%d\n", m->state)); 1909 1909 rc = setError(VBOX_E_INVALID_OBJECT_STATE, 1910 tr ("Medium '% ls' is not locked for reading"),1911 m-> locationFull.raw());1910 tr ("Medium '%s' is not locked for reading"), 1911 m->strLocationFull.raw()); 1912 1912 break; 1913 1913 } … … 1993 1993 LogFlowThisFunc(("Failing - state=%d\n", m->state)); 1994 1994 rc = setError(VBOX_E_INVALID_OBJECT_STATE, 1995 tr ("Medium '% ls' is not locked for writing"),1996 m-> locationFull.raw());1995 tr ("Medium '%s' is not locked for writing"), 1996 m->strLocationFull.raw()); 1997 1997 break; 1998 1998 } … … 2039 2039 if (m->backRefs.size() != 0) 2040 2040 return setError(VBOX_E_OBJECT_IN_USE, 2041 tr("Medium '% ls' is attached to %d virtual machines"),2042 m-> locationFull.raw(), m->backRefs.size());2041 tr("Medium '%s' is attached to %d virtual machines"), 2042 m->strLocationFull.raw(), m->backRefs.size()); 2043 2043 2044 2044 /* perform extra media-dependent close checks */ … … 2215 2215 && !(m->formatObj->capabilities() & MediumFormatCapabilities_CreateDynamic)) 2216 2216 return setError(VBOX_E_NOT_SUPPORTED, 2217 tr("Hard disk format '% ls' does not support dynamic storage creation"),2218 m-> format.raw());2217 tr("Hard disk format '%s' does not support dynamic storage creation"), 2218 m->strFormat.raw()); 2219 2219 if ( (aVariant & MediumVariant_Fixed) 2220 2220 && !(m->formatObj->capabilities() & MediumFormatCapabilities_CreateDynamic)) 2221 2221 return setError(VBOX_E_NOT_SUPPORTED, 2222 tr("Hard disk format '% ls' does not support fixed storage creation"),2223 m-> format.raw());2222 tr("Hard disk format '%s' does not support fixed storage creation"), 2223 m->strFormat.raw()); 2224 2224 2225 2225 switch (m->state) … … 2236 2236 HRESULT rc = progress->init(mVirtualBox, static_cast<IMedium*>(this), 2237 2237 (aVariant & MediumVariant_Fixed) 2238 ? BstrFmt(tr("Creating fixed hard disk storage unit '% ls'"), m->locationFull.raw())2239 : BstrFmt(tr("Creating dynamic hard disk storage unit '% ls'"), m->locationFull.raw()),2238 ? BstrFmt(tr("Creating fixed hard disk storage unit '%s'"), m->strLocationFull.raw()) 2239 : BstrFmt(tr("Creating dynamic hard disk storage unit '%s'"), m->strLocationFull.raw()), 2240 2240 TRUE /* aCancelable */); 2241 2241 CheckComRCReturnRC(rc); … … 2302 2302 if (m->type == MediumType_Writethrough) 2303 2303 return setError(E_FAIL, 2304 tr("Hard disk '% ls' is Writethrough"),2305 m-> locationFull.raw());2304 tr("Hard disk '%s' is Writethrough"), 2305 m->strLocationFull.raw()); 2306 2306 2307 2307 /* We want to be locked for reading as long as our diff child is being … … 2413 2413 progress.createObject(); 2414 2414 rc = progress->init(mVirtualBox, static_cast <IMedium *>(this), 2415 BstrFmt(tr("Creating clone hard disk '% ls'"),2416 target->m-> locationFull.raw()),2415 BstrFmt(tr("Creating clone hard disk '%s'"), 2416 target->m->strLocationFull.raw()), 2417 2417 TRUE /* aCancelable */); 2418 2418 CheckComRCThrowRC(rc); … … 2488 2488 progress.createObject(); 2489 2489 rc = progress->init(mVirtualBox, static_cast <IMedium *>(this), 2490 BstrFmt(tr("Compacting hard disk '% ls'"), m->locationFull.raw()),2490 BstrFmt(tr("Compacting hard disk '%s'"), m->strLocationFull.raw()), 2491 2491 TRUE /* aCancelable */); 2492 2492 CheckComRCThrowRC(rc); … … 2543 2543 if (mParent.isNull()) 2544 2544 return setError(VBOX_E_NOT_SUPPORTED, 2545 tr ("Hard disk '% ls' is not differencing"),2546 m-> locationFull.raw());2545 tr ("Hard disk '%s' is not differencing"), 2546 m->strLocationFull.raw()); 2547 2547 2548 2548 HRESULT rc = canClose(); … … 2558 2558 progress.createObject(); 2559 2559 rc = progress->init(mVirtualBox, static_cast <IMedium *>(this), 2560 BstrFmt(tr("Resetting differencing hard disk '% ls'"),2561 m-> locationFull.raw()),2560 BstrFmt(tr("Resetting differencing hard disk '%s'"), 2561 m->strLocationFull.raw()), 2562 2562 FALSE /* aCancelable */); 2563 2563 CheckComRCThrowRC(rc); … … 2620 2620 AutoWriteLock alock(this); 2621 2621 2622 LogFlowThisFunc(("locationFull.before='%s'\n", m-> locationFull.raw()));2623 2624 Utf8Str path = m-> locationFull;2622 LogFlowThisFunc(("locationFull.before='%s'\n", m->strLocationFull.raw())); 2623 2624 Utf8Str path = m->strLocationFull; 2625 2625 2626 2626 if (RTPathStartsWith(path.c_str(), aOldPath)) … … 2632 2632 mVirtualBox->calculateRelativePath(path, path); 2633 2633 2634 unconst(m-> locationFull) = newPath;2635 unconst(m-> location) = path;2636 2637 LogFlowThisFunc(("locationFull.after='%s'\n", m-> locationFull.raw()));2634 unconst(m->strLocationFull) = newPath; 2635 unconst(m->strLocation) = path; 2636 2637 LogFlowThisFunc(("locationFull.after='%s'\n", m->strLocationFull.raw())); 2638 2638 } 2639 2639 … … 2672 2672 if (m->numCreateDiffTasks > 0) 2673 2673 return setError(E_FAIL, 2674 tr("One or more differencing child hard disks are being created for the hard disk '% ls' (%u)"),2675 m-> locationFull.raw(), m->numCreateDiffTasks);2674 tr("One or more differencing child hard disks are being created for the hard disk '%s' (%u)"), 2675 m->strLocationFull.raw(), m->numCreateDiffTasks); 2676 2676 2677 2677 BackRefList::iterator it = … … 2772 2772 * @return 2773 2773 */ 2774 const Bstr& Medium::location() const2775 { 2776 return m-> location;2774 const Utf8Str& Medium::location() const 2775 { 2776 return m->strLocation; 2777 2777 } 2778 2778 … … 2781 2781 * @return 2782 2782 */ 2783 const Bstr& Medium::locationFull() const2784 { 2785 return m-> locationFull;2783 const Utf8Str& Medium::locationFull() const 2784 { 2785 return m->strLocationFull; 2786 2786 } 2787 2787 … … 2973 2973 2974 2974 data.uuid = m->id; 2975 data.strLocation = m-> location;2976 data.strFormat = m-> format;2975 data.strLocation = m->strLocation; 2976 data.strFormat = m->strFormat; 2977 2977 2978 2978 /* optional, only for diffs, default is false */ … … 2983 2983 2984 2984 /* optional */ 2985 data.strDescription = m-> description;2985 data.strDescription = m->strDescription; 2986 2986 2987 2987 /* optional properties */ … … 3037 3037 AutoReadLock alock(this); 3038 3038 3039 Utf8Str locationFull(m-> locationFull);3039 Utf8Str locationFull(m->strLocationFull); 3040 3040 3041 3041 /// @todo NEWMEDIA delegate the comparison to the backend? … … 3131 3131 if (children().size() > 1) 3132 3132 return setError(E_FAIL, 3133 tr ("Hard disk '% ls' has more than one child hard disk (%d)"),3134 m-> locationFull.raw(), children().size());3133 tr ("Hard disk '%s' has more than one child hard disk (%d)"), 3134 m->strLocationFull.raw(), children().size()); 3135 3135 3136 3136 /* this is a read-only hard disk with children; it must be associated with … … 3329 3329 Bstr Medium::preferredDiffFormat() 3330 3330 { 3331 Bstr format;3331 Utf8Str strFormat; 3332 3332 3333 3333 AutoCaller autoCaller(this); 3334 AssertComRCReturn(autoCaller.rc(), format);3334 AssertComRCReturn(autoCaller.rc(), strFormat); 3335 3335 3336 3336 /* m->format is const, no need to lock */ 3337 format = m->format;3337 strFormat = m->strFormat; 3338 3338 3339 3339 /* check that our own format supports diffs */ … … 3342 3342 /* use the default format if not */ 3343 3343 AutoReadLock propsLock(mVirtualBox->systemProperties()); 3344 format = mVirtualBox->getDefaultHardDiskFormat();3345 } 3346 3347 return format;3344 strFormat = mVirtualBox->getDefaultHardDiskFormat(); 3345 } 3346 3347 return strFormat; 3348 3348 } 3349 3349 … … 3384 3384 Utf8Str Medium::name() 3385 3385 { 3386 Utf8Str location(m-> locationFull);3386 Utf8Str location(m->strLocationFull); 3387 3387 3388 3388 Utf8Str name = RTPathFilename(location.c_str()); … … 3391 3391 3392 3392 /** 3393 * Sets the value of m-> location and calculates the value of m->locationFull.3393 * Sets the value of m->strLocation and calculates the value of m->strLocationFull. 3394 3394 * 3395 3395 * Treats non-FS-path locations specially, and prepends the default hard disk … … 3420 3420 /* formatObj may be null only when initializing from an existing path and 3421 3421 * no format is known yet */ 3422 AssertReturn((!m->format.isNull() && !m->formatObj.isNull()) || 3423 (autoCaller.state() == InInit && 3424 m->state != MediumState_NotCreated && m->id.isEmpty() && 3425 m->format.isNull() && m->formatObj.isNull()), 3422 AssertReturn( (!m->strFormat.isEmpty() && !m->formatObj.isNull()) 3423 || ( autoCaller.state() == InInit 3424 && m->state != MediumState_NotCreated 3425 && m->id.isEmpty() 3426 && m->strFormat.isEmpty() 3427 && m->formatObj.isNull()), 3426 3428 E_FAIL); 3427 3429 3428 3430 /* are we dealing with a new medium constructed using the existing 3429 3431 * location? */ 3430 bool isImport = m-> format.isNull();3432 bool isImport = m->strFormat.isEmpty(); 3431 3433 3432 3434 if ( isImport … … 3537 3539 if (m->formatObj->capabilities() & MediumFormatCapabilities_File) 3538 3540 { 3539 m-> location = location;3540 m-> locationFull = locationFull;3541 m->strLocation = location; 3542 m->strLocationFull = locationFull; 3541 3543 3542 3544 if (m->state == MediumState_NotCreated) … … 3551 3553 else 3552 3554 { 3553 m-> location = locationFull;3554 m-> locationFull = locationFull;3555 m->strLocation = locationFull; 3556 m->strLocationFull = locationFull; 3555 3557 } 3556 3558 } 3557 3559 else 3558 3560 { 3559 m-> location = aLocation;3560 m-> locationFull = aLocation;3561 m->strLocation = aLocation; 3562 m->strLocationFull = aLocation; 3561 3563 } 3562 3564 … … 3637 3639 * you do with the contents of this medium object, as you will 3638 3640 * create races if there are concurrent changes. */ 3639 Utf8Str format(m-> format);3640 Utf8Str location(m-> locationFull);3641 Utf8Str format(m->strFormat); 3642 Utf8Str location(m->strLocationFull); 3641 3643 ComObjPtr<MediumFormat> formatObj = m->formatObj; 3642 3644 … … 3722 3724 { 3723 3725 lastAccessError = Utf8StrFmt( 3724 tr("UUID {%RTuuid} of the medium '%s' does not match the value {%RTuuid} stored in the media registry ('%ls')"), 3725 &uuid, location.c_str(), mediumId.raw(), 3726 mVirtualBox->settingsFilePath().raw()); 3726 tr("UUID {%RTuuid} of the medium '%s' does not match the value {%RTuuid} stored in the media registry ('%s')"), 3727 &uuid, 3728 location.c_str(), 3729 mediumId.raw(), 3730 mVirtualBox->settingsFilePath().c_str()); 3727 3731 throw S_OK; 3728 3732 } … … 3772 3776 { 3773 3777 lastAccessError = Utf8StrFmt( 3774 tr("Parent hard disk with UUID {%RTuuid} of the hard disk '%s' is not found in the media registry ('% ls')"),3778 tr("Parent hard disk with UUID {%RTuuid} of the hard disk '%s' is not found in the media registry ('%s')"), 3775 3779 &parentId, location.c_str(), 3776 mVirtualBox->settingsFilePath(). raw());3780 mVirtualBox->settingsFilePath().c_str()); 3777 3781 throw S_OK; 3778 3782 } … … 3801 3805 { 3802 3806 lastAccessError = Utf8StrFmt( 3803 tr("Hard disk '%s' is differencing but it is not associated with any parent hard disk in the media registry ('% ls')"),3807 tr("Hard disk '%s' is differencing but it is not associated with any parent hard disk in the media registry ('%s')"), 3804 3808 location.c_str(), 3805 mVirtualBox->settingsFilePath(). raw());3809 mVirtualBox->settingsFilePath().c_str()); 3806 3810 throw S_OK; 3807 3811 } … … 3812 3816 { 3813 3817 lastAccessError = Utf8StrFmt( 3814 tr ("Parent UUID {%RTuuid} of the hard disk '%s' does not match UUID {%RTuuid} of its parent hard disk stored in the media registry ('% ls')"),3818 tr ("Parent UUID {%RTuuid} of the hard disk '%s' does not match UUID {%RTuuid} of its parent hard disk stored in the media registry ('%s')"), 3815 3819 &parentId, location.c_str(), 3816 3820 mParent->id().raw(), 3817 mVirtualBox->settingsFilePath(). raw());3821 mVirtualBox->settingsFilePath().c_str()); 3818 3822 throw S_OK; 3819 3823 } … … 3852 3856 m->size = mediumSize; 3853 3857 m->logicalSize = mediumLogicalSize; 3854 m-> lastAccessError.setNull();3858 m->strLastAccessError.setNull(); 3855 3859 } 3856 3860 else 3857 3861 { 3858 m-> lastAccessError = lastAccessError;3859 LogWarningFunc(("'%s' is not accessible (error='% ls', rc=%Rhrc, vrc=%Rrc)\n",3860 location.c_str(), m-> lastAccessError.raw(),3862 m->strLastAccessError = lastAccessError; 3863 LogWarningFunc(("'%s' is not accessible (error='%s', rc=%Rhrc, vrc=%Rrc)\n", 3864 location.c_str(), m->strLastAccessError.c_str(), 3861 3865 rc, vrc)); 3862 3866 } … … 3895 3899 { 3896 3900 rc = setError(VBOX_E_INVALID_OBJECT_STATE, 3897 tr("Storage for the medium '% ls' is not created"),3898 m-> locationFull.raw());3901 tr("Storage for the medium '%s' is not created"), 3902 m->strLocationFull.raw()); 3899 3903 break; 3900 3904 } … … 3902 3906 { 3903 3907 rc = setError(VBOX_E_INVALID_OBJECT_STATE, 3904 tr("Storage for the medium '% ls' is already created"),3905 m-> locationFull.raw());3908 tr("Storage for the medium '%s' is already created"), 3909 m->strLocationFull.raw()); 3906 3910 break; 3907 3911 } … … 3909 3913 { 3910 3914 rc = setError(VBOX_E_INVALID_OBJECT_STATE, 3911 tr("Medium '% ls' is locked for reading by another task"),3912 m-> locationFull.raw());3915 tr("Medium '%s' is locked for reading by another task"), 3916 m->strLocationFull.raw()); 3913 3917 break; 3914 3918 } … … 3916 3920 { 3917 3921 rc = setError(VBOX_E_INVALID_OBJECT_STATE, 3918 tr("Medium '% ls' is locked for writing by another task"),3919 m-> locationFull.raw());3922 tr("Medium '%s' is locked for writing by another task"), 3923 m->strLocationFull.raw()); 3920 3924 break; 3921 3925 } 3922 3926 case MediumState_Inaccessible: 3923 3927 { 3924 AssertMsg(!m->lastAccessError.isEmpty(),3925 ("There must always be a reason for Inaccessible"));3926 3927 3928 /* be in sync with Console::powerUpThread() */ 3928 if (!m-> lastAccessError.isEmpty())3929 if (!m->strLastAccessError.isEmpty()) 3929 3930 rc = setError(VBOX_E_INVALID_OBJECT_STATE, 3930 tr("Medium '% ls' is not accessible. %ls"),3931 m-> locationFull.raw(), m->lastAccessError.raw());3931 tr("Medium '%s' is not accessible. %s"), 3932 m->strLocationFull.raw(), m->strLastAccessError.c_str()); 3932 3933 else 3933 3934 rc = setError(VBOX_E_INVALID_OBJECT_STATE, 3934 tr("Medium '% ls' is not accessible"),3935 m-> locationFull.raw());3935 tr("Medium '%s' is not accessible"), 3936 m->strLocationFull.raw()); 3936 3937 break; 3937 3938 } … … 3939 3940 { 3940 3941 rc = setError(VBOX_E_INVALID_OBJECT_STATE, 3941 tr("Storage for the medium '% ls' is being created"),3942 m-> locationFull.raw(), m->lastAccessError.raw());3942 tr("Storage for the medium '%s' is being created"), 3943 m->strLocationFull.raw()); 3943 3944 break; 3944 3945 } … … 3946 3947 { 3947 3948 rc = setError(VBOX_E_INVALID_OBJECT_STATE, 3948 tr("Storage for the medium '% ls' is being deleted"),3949 m-> locationFull.raw(), m->lastAccessError.raw());3949 tr("Storage for the medium '%s' is being deleted"), 3950 m->strLocationFull.raw()); 3950 3951 break; 3951 3952 } … … 3999 4000 | MediumFormatCapabilities_CreateFixed))) 4000 4001 return setError(VBOX_E_NOT_SUPPORTED, 4001 tr("Hard disk format '% ls' does not support storage deletion"),4002 m-> format.raw());4002 tr("Hard disk format '%s' does not support storage deletion"), 4003 m->strFormat.raw()); 4003 4004 4004 4005 /* Note that we are fine with Inaccessible state too: a) for symmetry with … … 4020 4021 if (m->backRefs.size() != 0) 4021 4022 return setError(VBOX_E_OBJECT_IN_USE, 4022 tr("Hard disk '% ls' is attached to %d virtual machines"),4023 m-> locationFull.raw(), m->backRefs.size());4023 tr("Hard disk '%s' is attached to %d virtual machines"), 4024 m->strLocationFull.raw(), m->backRefs.size()); 4024 4025 4025 4026 HRESULT rc = canClose(); … … 4059 4060 progress.createObject(); 4060 4061 rc = progress->init(mVirtualBox, static_cast<IMedium*>(this), 4061 BstrFmt(tr("Deleting hard disk storage unit '% ls'"),4062 m-> locationFull.raw()),4062 BstrFmt(tr("Deleting hard disk storage unit '%s'"), 4063 m->strLocationFull.raw()), 4063 4064 FALSE /* aCancelable */); 4064 4065 CheckComRCReturnRC(rc); … … 4177 4178 { 4178 4179 return setError(VBOX_E_INVALID_OBJECT_STATE, 4179 tr("Hard disk '% ls' is attached to a virtual machine with UUID {%RTuuid}. No differencing hard disks based on it may be created until it is detached"),4180 m-> locationFull.raw(), it->machineId.raw());4180 tr("Hard disk '%s' is attached to a virtual machine with UUID {%RTuuid}. No differencing hard disks based on it may be created until it is detached"), 4181 m->strLocationFull.raw(), it->machineId.raw()); 4181 4182 } 4182 4183 … … 4197 4198 progress.createObject(); 4198 4199 rc = progress->init(mVirtualBox, static_cast<IMedium*>(this), 4199 BstrFmt(tr("Creating differencing hard disk storage unit '% ls'"),4200 aTarget->m-> locationFull.raw()),4200 BstrFmt(tr("Creating differencing hard disk storage unit '%s'"), 4201 aTarget->m->strLocationFull.raw()), 4201 4202 TRUE /* aCancelable */); 4202 4203 CheckComRCReturnRC(rc); … … 4304 4305 else 4305 4306 { 4306 Bstr tgtLoc;4307 Utf8Str tgtLoc; 4307 4308 { 4308 4309 AutoReadLock alock(this); … … 4312 4313 AutoReadLock alock(this); 4313 4314 return setError(E_FAIL, 4314 tr("Hard disks '% ls' and '%ls' are unrelated"),4315 m-> locationFull.raw(), tgtLoc.raw());4315 tr("Hard disks '%s' and '%s' are unrelated"), 4316 m->strLocationFull.raw(), tgtLoc.raw()); 4316 4317 } 4317 4318 } … … 4545 4546 } 4546 4547 4547 unconst(m-> format) = aFormat;4548 unconst(m->strFormat) = aFormat; 4548 4549 4549 4550 return S_OK; … … 4846 4847 ComAssertRCThrow(vrc, E_FAIL); 4847 4848 4848 Utf8Str format(that->m-> format);4849 Utf8Str location(that->m-> locationFull);4849 Utf8Str format(that->m->strFormat); 4850 Utf8Str location(that->m->strLocationFull); 4850 4851 /* uint64_t capabilities = */ that->m->formatObj->capabilities(); 4851 4852 … … 4949 4950 4950 4951 Guid id = that->m->id; 4951 Utf8Str format(that->m-> format);4952 Utf8Str location(that->m-> locationFull);4953 4954 Utf8Str targetFormat(target->m-> format);4955 Utf8Str targetLocation(target->m-> locationFull);4952 Utf8Str format(that->m->strFormat); 4953 Utf8Str location(that->m->strLocationFull); 4954 4955 Utf8Str targetFormat(target->m->strFormat); 4956 Utf8Str targetLocation(target->m->strLocationFull); 4956 4957 4957 4958 Assert(target->m->state == MediumState_Creating); … … 5142 5143 /* open the first image with VDOPEN_FLAGS_INFO because 5143 5144 * it's not necessarily the base one */ 5144 vrc = VDOpen(hdd, Utf8Str((*it)->m->format).c_str(),5145 Utf8Str((*it)->m->locationFull).c_str(),5145 vrc = VDOpen(hdd, (*it)->m->strFormat.c_str(), 5146 (*it)->m->strLocationFull.c_str(), 5146 5147 it == chain->begin() ? 5147 5148 VD_OPEN_FLAGS_INFO : 0, … … 5150 5151 throw vrc; 5151 5152 #if 0 5152 LogFlow(("*** MERGE disk = % ls\n", (*it)->m->locationFull.raw()));5153 LogFlow(("*** MERGE disk = %s\n", (*it)->m->strLocationFull.raw())); 5153 5154 #endif 5154 5155 } … … 5193 5194 { 5194 5195 /* VD_OPEN_FLAGS_INFO since UUID is wrong yet */ 5195 vrc = VDOpen(hdd, Utf8Str((*it)->m->format).c_str(),5196 Utf8Str((*it)->m->locationFull).c_str(),5196 vrc = VDOpen(hdd, (*it)->m->strFormat.c_str(), 5197 (*it)->m->strLocationFull.c_str(), 5197 5198 VD_OPEN_FLAGS_INFO, 5198 5199 (*it)->m->vdDiskIfaces); … … 5216 5217 { 5217 5218 throw setError(E_FAIL, 5218 tr("Could not merge the hard disk '% ls' to '%ls'%s"),5219 chain->source()->m-> locationFull.raw(),5220 chain->target()->m-> locationFull.raw(),5219 tr("Could not merge the hard disk '%s' to '%s'%s"), 5220 chain->source()->m->strLocationFull.raw(), 5221 chain->target()->m->strLocationFull.raw(), 5221 5222 that->vdError(aVRC).raw()); 5222 5223 } … … 5433 5434 5434 5435 /** Open all images in read-only mode. */ 5435 vrc = VDOpen(hdd, Utf8Str((*it)->m->format).c_str(),5436 Utf8Str((*it)->m->locationFull).c_str(),5436 vrc = VDOpen(hdd, (*it)->m->strFormat.c_str(), 5437 (*it)->m->strLocationFull.c_str(), 5437 5438 VD_OPEN_FLAGS_READONLY, 5438 5439 (*it)->m->vdDiskIfaces); … … 5441 5442 throw setError(E_FAIL, 5442 5443 tr("Could not open the hard disk storage unit '%s'%s"), 5443 Utf8Str((*it)->m->locationFull).raw(),5444 (*it)->m->strLocationFull.raw(), 5444 5445 that->vdError(vrc).raw()); 5445 5446 } … … 5449 5450 thatLock.leave(); 5450 5451 5451 Utf8Str targetFormat(target->m-> format);5452 Utf8Str targetLocation(target->m-> locationFull);5452 Utf8Str targetFormat(target->m->strFormat); 5453 Utf8Str targetLocation(target->m->strLocationFull); 5453 5454 5454 5455 Assert( target->m->state == MediumState_Creating … … 5479 5480 5480 5481 /* Open all images in appropriate mode. */ 5481 vrc = VDOpen(targetHdd, Utf8Str((*it)->m->format).c_str(),5482 Utf8Str((*it)->m->locationFull).c_str(),5482 vrc = VDOpen(targetHdd, (*it)->m->strFormat.c_str(), 5483 (*it)->m->strLocationFull.c_str(), 5483 5484 ((*it)->m->state == MediumState_LockedWrite) ? VD_OPEN_FLAGS_NORMAL : VD_OPEN_FLAGS_READONLY, 5484 5485 (*it)->m->vdDiskIfaces); … … 5487 5488 throw setError(E_FAIL, 5488 5489 tr("Could not open the hard disk storage unit '%s'%s"), 5489 Utf8Str((*it)->m->locationFull).raw(),5490 (*it)->m->strLocationFull.raw(), 5490 5491 that->vdError(vrc).raw()); 5491 5492 } … … 5608 5609 ComAssertRCThrow(vrc, E_FAIL); 5609 5610 5610 Utf8Str format(that->m-> format);5611 Utf8Str location(that->m-> locationFull);5611 Utf8Str format(that->m->strFormat); 5612 Utf8Str location(that->m->strLocationFull); 5612 5613 5613 5614 /* unlock before the potentially lengthy operation */ … … 5670 5671 5671 5672 Guid id = that->m->id; 5672 Utf8Str format(that->m-> format);5673 Utf8Str location(that->m-> locationFull);5673 Utf8Str format(that->m->strFormat); 5674 Utf8Str location(that->m->strLocationFull); 5674 5675 5675 5676 Guid parentId = that->mParent->m->id; 5676 Utf8Str parentFormat(that->mParent->m-> format);5677 Utf8Str parentLocation(that->mParent->m-> locationFull);5677 Utf8Str parentFormat(that->mParent->m->strFormat); 5678 Utf8Str parentLocation(that->mParent->m->strLocationFull); 5678 5679 5679 5680 Assert(that->m->state == MediumState_LockedWrite); … … 5789 5790 5790 5791 /** Open all images but last in read-only mode. */ 5791 vrc = VDOpen(hdd, Utf8Str((*it)->m->format).c_str(),5792 Utf8Str((*it)->m->locationFull).c_str(),5792 vrc = VDOpen(hdd, (*it)->m->strFormat.c_str(), 5793 (*it)->m->strLocationFull.c_str(), 5793 5794 (it == last) ? VD_OPEN_FLAGS_NORMAL : VD_OPEN_FLAGS_READONLY, 5794 5795 (*it)->m->vdDiskIfaces); … … 5797 5798 throw setError(E_FAIL, 5798 5799 tr("Could not open the hard disk storage unit '%s'%s"), 5799 Utf8Str((*it)->m->locationFull).raw(),5800 (*it)->m->strLocationFull.raw(), 5800 5801 that->vdError(vrc).raw()); 5801 5802 } … … 5818 5819 if (vrc == VERR_NOT_SUPPORTED) 5819 5820 throw setError(VBOX_E_NOT_SUPPORTED, 5820 tr("Compacting is not supported yetfor hard disk '%s'"),5821 Utf8Str(that->m->locationFull).raw());5821 tr("Compacting is not yet supported for hard disk '%s'"), 5822 that->m->strLocationFull.raw()); 5822 5823 else if (vrc == VERR_NOT_IMPLEMENTED) 5823 5824 throw setError(E_NOTIMPL, 5824 5825 tr("Compacting is not implemented, hard disk '%s'"), 5825 Utf8Str(that->m->locationFull).raw());5826 that->m->strLocationFull.raw()); 5826 5827 else 5827 5828 throw setError(E_FAIL, 5828 5829 tr("Could not compact hard disk '%s'%s"), 5829 Utf8Str(that->m->locationFull).raw(),5830 that->m->strLocationFull.raw(), 5830 5831 that->vdError(vrc).raw()); 5831 5832 } -
trunk/src/VBox/Main/VirtualBoxImpl.cpp
r24079 r24273 2782 2782 (aLocation != NULL && 2783 2783 RTPathCompare(location.c_str(), 2784 Utf8Str((*it)->locationFull()).c_str()2784 (*it)->locationFull().c_str() 2785 2785 ) == 0); 2786 2786 if (found) … … 2858 2858 (aLocation != NULL && 2859 2859 RTPathCompare(location.c_str(), 2860 Utf8Str((*it)->locationFull()).c_str()2860 (*it)->locationFull().c_str() 2861 2861 ) == 0); 2862 2862 if (found) … … 3048 3048 */ 3049 3049 HRESULT VirtualBox::checkMediaForConflicts2 (const Guid &aId, 3050 const Bstr &aLocation,3050 const Utf8Str &aLocation, 3051 3051 Utf8Str &aConflict) 3052 3052 { … … 3059 3059 HRESULT rc = S_OK; 3060 3060 3061 Bstr bstrLocation(aLocation); 3062 3061 3063 { 3062 3064 ComObjPtr<Medium> hardDisk; 3063 rc = findHardDisk(&aId, aLocation, false /* aSetError */, &hardDisk);3065 rc = findHardDisk(&aId, bstrLocation, false /* aSetError */, &hardDisk); 3064 3066 if (SUCCEEDED(rc)) 3065 3067 { … … 3067 3069 AutoReadLock mediaLock (hardDisk); 3068 3070 aConflict = Utf8StrFmt ( 3069 tr ("hard disk '% ls' with UUID {%RTuuid}"),3071 tr ("hard disk '%s' with UUID {%RTuuid}"), 3070 3072 hardDisk->locationFull().raw(), hardDisk->id().raw()); 3071 3073 return S_OK; … … 3075 3077 { 3076 3078 ComObjPtr<Medium> image; 3077 rc = findDVDImage (&aId, aLocation, false /* aSetError */, &image);3079 rc = findDVDImage (&aId, bstrLocation, false /* aSetError */, &image); 3078 3080 if (SUCCEEDED(rc)) 3079 3081 { … … 3081 3083 AutoReadLock mediaLock (image); 3082 3084 aConflict = Utf8StrFmt ( 3083 tr ("CD/DVD image '% ls' with UUID {%RTuuid}"),3085 tr ("CD/DVD image '%s' with UUID {%RTuuid}"), 3084 3086 image->locationFull().raw(), image->id().raw()); 3085 3087 return S_OK; … … 3089 3091 { 3090 3092 ComObjPtr<Medium> image; 3091 rc = findFloppyImage(&aId, aLocation, false /* aSetError */, &image);3093 rc = findFloppyImage(&aId, bstrLocation, false /* aSetError */, &image); 3092 3094 if (SUCCEEDED(rc)) 3093 3095 { … … 3095 3097 AutoReadLock mediaLock (image); 3096 3098 aConflict = Utf8StrFmt ( 3097 tr ("floppy image '% ls' with UUID {%RTuuid}"),3099 tr ("floppy image '%s' with UUID {%RTuuid}"), 3098 3100 image->locationFull().raw(), image->id().raw()); 3099 3101 return S_OK; -
trunk/src/VBox/Main/include/MediumImpl.h
r24258 r24273 165 165 const Guid& id() const; 166 166 MediumState_T state() const; 167 const Bstr& location() const;168 const Bstr& locationFull() const;167 const Utf8Str& location() const; 168 const Utf8Str& locationFull() const; 169 169 170 170 const Guid* getFirstMachineBackrefId() const; -
trunk/src/VBox/Main/include/VirtualBoxImpl.h
r23327 r24273 277 277 private: 278 278 279 HRESULT checkMediaForConflicts2(const Guid &aId, const Bstr &aLocation,279 HRESULT checkMediaForConflicts2(const Guid &aId, const Utf8Str &aLocation, 280 280 Utf8Str &aConflictType); 281 281
Note:
See TracChangeset
for help on using the changeset viewer.