diff options
| author | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2023-01-17 10:56:32 +0000 |
|---|---|---|
| committer | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2023-01-17 10:56:32 +0000 |
| commit | 2e2c4288dd17a6ac2313700183f6c25ad7666b78 (patch) | |
| tree | 38163f7235b25fea77ef400c93a427e2fca4691e /src/VBox/Main/src-server | |
| parent | 0b090003a306e77f0ac4e80a743705afb1585939 (diff) | |
| download | VirtualBox-svn-2e2c4288dd17a6ac2313700183f6c25ad7666b78.tar.gz | |
Main: Nits.
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@98100 cfe28804-0f27-0410-a406-dd0f0b0b656f
Diffstat (limited to 'src/VBox/Main/src-server')
| -rw-r--r-- | src/VBox/Main/src-server/MachineImpl.cpp | 19 | ||||
| -rw-r--r-- | src/VBox/Main/src-server/MediumLock.cpp | 4 |
2 files changed, 12 insertions, 11 deletions
diff --git a/src/VBox/Main/src-server/MachineImpl.cpp b/src/VBox/Main/src-server/MachineImpl.cpp index 69226079756..bf20c515679 100644 --- a/src/VBox/Main/src-server/MachineImpl.cpp +++ b/src/VBox/Main/src-server/MachineImpl.cpp @@ -3872,10 +3872,9 @@ HRESULT Machine::attachDevice(const com::Utf8Str &aName, aName.c_str()); bool fSilent = false; - Utf8Str strReconfig; /* Check whether the flag to allow silent storage attachment reconfiguration is set. */ - strReconfig = i_getExtraData(Utf8Str("VBoxInternal2/SilentReconfigureWhilePaused")); + Utf8Str const strReconfig = i_getExtraData(Utf8Str("VBoxInternal2/SilentReconfigureWhilePaused")); if ( mData->mMachineState == MachineState_Paused && strReconfig == "1") fSilent = true; @@ -3899,11 +3898,11 @@ HRESULT Machine::attachDevice(const com::Utf8Str &aName, if (FAILED(rc)) return rc; /* check if the device slot is already busy */ - MediumAttachment *pAttachTemp; - if ((pAttachTemp = i_findAttachment(*mMediumAttachments.data(), - aName, - aControllerPort, - aDevice))) + MediumAttachment *pAttachTemp = i_findAttachment(*mMediumAttachments.data(), + aName, + aControllerPort, + aDevice); + if (pAttachTemp) { Medium *pMedium = pAttachTemp->i_getMedium(); if (pMedium) @@ -3931,7 +3930,8 @@ HRESULT Machine::attachDevice(const com::Utf8Str &aName, AutoWriteLock mediumLock(medium COMMA_LOCKVAL_SRC_POS); - if ( (pAttachTemp = i_findAttachment(*mMediumAttachments.data(), medium)) + pAttachTemp = i_findAttachment(*mMediumAttachments.data(), medium); + if ( pAttachTemp && !medium.isNull() && ( medium->i_getType() != MediumType_Readonly || medium->i_getDeviceType() != DeviceType_DVD) @@ -3985,7 +3985,8 @@ HRESULT Machine::attachDevice(const com::Utf8Str &aName, /* check if the medium was attached to the VM before we started * changing attachments in which case the attachment just needs to * be restored */ - if ((pAttachTemp = i_findAttachment(oldAtts, medium))) + pAttachTemp = i_findAttachment(oldAtts, medium); + if (pAttachTemp) { AssertReturn(!fIndirect, E_FAIL); diff --git a/src/VBox/Main/src-server/MediumLock.cpp b/src/VBox/Main/src-server/MediumLock.cpp index 392fd7bd64d..880896e77e2 100644 --- a/src/VBox/Main/src-server/MediumLock.cpp +++ b/src/VBox/Main/src-server/MediumLock.cpp @@ -297,7 +297,7 @@ bool MediumLockListMap::IsEmpty() } HRESULT MediumLockListMap::Insert(const ComObjPtr<MediumAttachment> &aMediumAttachment, - MediumLockList *aMediumLockList) + MediumLockList *aMediumLockList) { if (mIsLocked) return VBOX_E_INVALID_OBJECT_STATE; @@ -306,7 +306,7 @@ HRESULT MediumLockListMap::Insert(const ComObjPtr<MediumAttachment> &aMediumAtta } HRESULT MediumLockListMap::ReplaceKey(const ComObjPtr<MediumAttachment> &aMediumAttachmentOld, - const ComObjPtr<MediumAttachment> &aMediumAttachmentNew) + const ComObjPtr<MediumAttachment> &aMediumAttachmentNew) { MediumLockListMap::Base::iterator it = mMediumLocks.find(aMediumAttachmentOld); if (it == mMediumLocks.end()) |
