- Timestamp:
- May 5, 2008 3:23:23 PM (17 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/MachineImpl.cpp
r8602 r8603 1653 1653 Guid id = aId; 1654 1654 1655 if (id.isEmpty() || aBus == StorageBus_Null)1655 if (id.isEmpty()) 1656 1656 return E_INVALIDARG; 1657 1657 1658 /* The device property is not used for SATA yet. Thus it is always zero. */ 1659 if ((aBus == StorageBus_SATA) && (aDevice != 0)) 1660 AssertMsgFailed(("Invalid aDevice %d\n", aDevice)); /** @todo r=bird: You don't assert on bad input, you return E_FAIL or E_INVALIDARG via setError()! This is what is referred to in comments 9 and 5. */ 1658 if (aBus == StorageBus_SATA) 1659 { 1660 /* The device property is not used for SATA yet. Thus it is always zero. */ 1661 if (aDevice != 0) 1662 return setError (E_INVALIDARG, 1663 tr ("Invalid device number: %l (must be always 0)"), 1664 aDevice); 1665 1666 /* 1667 * We suport 30 ports. 1668 * @todo: r=aeichner make max port count a system property. 1669 */ 1670 if ((aChannel < 0) || (aChannel >= 30)) 1671 return setError (E_INVALIDARG, 1672 tr ("Invalid channel number: %l (must be in range [%lu, %lu])"), 1673 aChannel, 0, 29); 1674 } 1675 else if (aBus == StorageBus_IDE) 1676 { 1677 /* Validate input for IDE drives. */ 1678 if (aChannel == 0) 1679 { 1680 if ((aDevice < 0) || (aDevice > 1)) 1681 return setError (E_INVALIDARG, 1682 tr ("Invalid device number: %l (must be in range [%lu, %lu])"), 1683 aDevice, 0, 1); 1684 } 1685 else if (aChannel == 1) 1686 { 1687 /* The first device is assigned to the CD/DVD drive. */ 1688 if (aDevice != 1) 1689 return setError (E_INVALIDARG, 1690 tr ("Invalid device number: %l (must be %lu)"), 1691 aDevice, 1); 1692 } 1693 else 1694 return setError (E_INVALIDARG, 1695 tr ("Invalid channel number: %l (must be in range [%lu, %lu])"), 1696 aChannel, 0, 1); 1697 } 1698 else 1699 return E_INVALIDARG; 1661 1700 1662 1701 AutoCaller autoCaller (this); -
trunk/src/VBox/Main/SATAControllerImpl.cpp
r8155 r8603 235 235 { 236 236 LogFlowThisFunc (("aPortCount=%u\n", aPortCount)); 237 238 /* We support a maximum of 30 channels. */ 239 if ((aPortCount < 1) || (aPortCount > 30)) 240 return setError (E_INVALIDARG, 241 tr ("Invalid port count: %lu (must be in range [%lu, %lu])"), 242 aPortCount, 1, 30); 237 243 238 244 AutoCaller autoCaller (this);
Note:
See TracChangeset
for help on using the changeset viewer.