Changeset 6168 in vbox for trunk/src/VBox/Main
- Timestamp:
- Dec 21, 2007 2:38:19 PM (17 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ParallelPortImpl.cpp
r6076 r6168 196 196 /* IRQ (required) */ 197 197 mData->mIRQ = aPortNode.value <ULONG> ("IRQ"); 198 /* device path (may be null) */ 199 /// @todo report an error if enabled is true and path is empty or null! 200 // The same applies to COMSETTER(Path). 201 mData->mPath = aPortNode.stringValue ("path"); 198 /* device path (optional, defaults to null) */ 199 Bstr path = aPortNode.stringValue ("path"); 200 201 HRESULT rc = checkSetPath (path); 202 CheckComRCReturnRC (rc); 203 mData->mPath = path; 202 204 203 205 return S_OK; … … 343 345 if (mData->mEnabled != aEnabled) 344 346 { 347 if (aEnabled && 348 mData->mPath.isEmpty()) 349 return setError (E_INVALIDARG, 350 tr ("Cannot enable the parallel port %d " 351 "because the port path is empty or null"), 352 mData->mSlot); 353 345 354 mData.backup(); 346 355 mData->mEnabled = aEnabled; … … 495 504 } 496 505 506 /** 507 * Validates COMSETTER(Path) arguments. 508 */ 509 HRESULT ParallelPort::checkSetPath (const BSTR aPath) 510 { 511 AssertReturn (isLockedOnCurrentThread(), E_FAIL); 512 513 if (mData->mEnabled && 514 (aPath == NULL || *aPath == '\0')) 515 return setError (E_INVALIDARG, 516 tr ("Path of the parallel port %d may not be empty or null " 517 "when the port is enabled"), 518 mData->mSlot); 519 520 return S_OK; 521 } 522 497 523 STDMETHODIMP ParallelPort::COMSETTER(Path) (INPTR BSTR aPath) 498 524 { 499 if (!aPath)500 return E_POINTER;501 502 if (!*aPath)503 return setError (E_INVALIDARG,504 tr ("Path of the parallel port %d may not be empty"),505 mData->mSlot);506 507 525 AutoCaller autoCaller (this); 508 526 CheckComRCReturnRC (autoCaller.rc()); … … 516 534 if (mData->mPath != aPath) 517 535 { 536 HRESULT rc = checkSetPath (aPath); 537 CheckComRCReturnRC (rc); 538 518 539 mData.backup(); 519 540 mData->mPath = aPath; -
trunk/src/VBox/Main/SerialPortImpl.cpp
r6076 r6168 621 621 STDMETHODIMP SerialPort::COMSETTER(Path) (INPTR BSTR aPath) 622 622 { 623 if (!aPath)624 return E_POINTER;625 626 623 AutoCaller autoCaller (this); 627 624 CheckComRCReturnRC (autoCaller.rc()); -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r6156 r6168 7774 7774 and all port read operations will return no data. 7775 7775 7776 <see>IMachine::getSerial </see>7776 <see>IMachine::getSerialPort</see> 7777 7777 </desc> 7778 7778 … … 7818 7818 is PortMode::HostDevicePort. In either of the above cases, setting a 7819 7819 @c null or an empty string as the attribute's value will result into 7820 an error. 7820 an error. Otherwise, the value of this property is ignored. 7821 7821 </desc> 7822 7822 </attribute> … … 7875 7875 <attribute name="path" type="wstring"> 7876 7876 <desc> 7877 Host parallel device name. Setting a null or an empty string as this 7878 attribute's value will result into an error. 7877 Host parallel device name. If this parallel port is enabled, setting a 7878 @c null or an empty string as this attribute's value will result into 7879 an error. 7879 7880 </desc> 7880 7881 </attribute> -
trunk/src/VBox/Main/include/ParallelPortImpl.h
r6076 r6168 36 36 Data() 37 37 : mSlot (0) 38 , mEnabled (FALSE)38 , mEnabled (FALSE) 39 39 , mIRQ (4) 40 40 , mIOBase (0x378) … … 112 112 private: 113 113 114 HRESULT checkSetPath (const BSTR aPath); 115 114 116 const ComObjPtr <Machine, ComWeakRef> mParent; 115 117 const ComObjPtr <ParallelPort> mPeer;
Note:
See TracChangeset
for help on using the changeset viewer.