Changeset 13836 in vbox for trunk/src/VBox/Main/MachineImpl.cpp
- Timestamp:
- Nov 5, 2008 2:42:54 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/MachineImpl.cpp
r13835 r13836 202 202 mBootOrder [1] = DeviceType_DVD; 203 203 mBootOrder [2] = DeviceType_HardDisk; 204 for (size_t i = 3; i < ELEMENTS (mBootOrder); i++)204 for (size_t i = 3; i < RT_ELEMENTS (mBootOrder); i++) 205 205 mBootOrder [i] = DeviceType_Null; 206 206 … … 231 231 return false; 232 232 233 for (size_t i = 0; i < ELEMENTS (mBootOrder); ++ i)233 for (size_t i = 0; i < RT_ELEMENTS (mBootOrder); ++ i) 234 234 if (mBootOrder [i] != that.mBootOrder [i]) 235 235 return false; … … 2258 2258 if (!port) 2259 2259 return E_POINTER; 2260 if (slot >= ELEMENTS (mSerialPorts))2260 if (slot >= RT_ELEMENTS (mSerialPorts)) 2261 2261 return setError (E_INVALIDARG, tr ("Invalid slot number: %d"), slot); 2262 2262 … … 2275 2275 if (!port) 2276 2276 return E_POINTER; 2277 if (slot >= ELEMENTS (mParallelPorts))2277 if (slot >= RT_ELEMENTS (mParallelPorts)) 2278 2278 return setError (E_INVALIDARG, tr ("Invalid slot number: %d"), slot); 2279 2279 … … 2292 2292 if (!adapter) 2293 2293 return E_POINTER; 2294 if (slot >= ELEMENTS (mNetworkAdapters))2294 if (slot >= RT_ELEMENTS (mNetworkAdapters)) 2295 2295 return setError (E_INVALIDARG, tr ("Invalid slot number: %d"), slot); 2296 2296 … … 4349 4349 4350 4350 /* create associated serial port objects */ 4351 for (ULONG slot = 0; slot < ELEMENTS (mSerialPorts); slot ++)4351 for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); slot ++) 4352 4352 { 4353 4353 unconst (mSerialPorts [slot]).createObject(); … … 4356 4356 4357 4357 /* create associated parallel port objects */ 4358 for (ULONG slot = 0; slot < ELEMENTS (mParallelPorts); slot ++)4358 for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); slot ++) 4359 4359 { 4360 4360 unconst (mParallelPorts [slot]).createObject(); … … 4375 4375 4376 4376 /* create associated network adapter objects */ 4377 for (ULONG slot = 0; slot < ELEMENTS (mNetworkAdapters); slot ++)4377 for (ULONG slot = 0; slot < RT_ELEMENTS (mNetworkAdapters); slot ++) 4378 4378 { 4379 4379 unconst (mNetworkAdapters [slot]).createObject(); … … 4406 4406 /* tell all our other child objects we've been uninitialized */ 4407 4407 4408 for (ULONG slot = 0; slot < ELEMENTS (mNetworkAdapters); slot ++)4408 for (ULONG slot = 0; slot < RT_ELEMENTS (mNetworkAdapters); slot ++) 4409 4409 { 4410 4410 if (mNetworkAdapters [slot]) … … 4433 4433 } 4434 4434 4435 for (ULONG slot = 0; slot < ELEMENTS (mParallelPorts); slot ++)4435 for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); slot ++) 4436 4436 { 4437 4437 if (mParallelPorts [slot]) … … 4442 4442 } 4443 4443 4444 for (ULONG slot = 0; slot < ELEMENTS (mSerialPorts); slot ++)4444 for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); slot ++) 4445 4445 { 4446 4446 if (mSerialPorts [slot]) … … 5000 5000 { 5001 5001 /* reset all boot order positions to NoDevice */ 5002 for (size_t i = 0; i < ELEMENTS (mHWData->mBootOrder); i++)5002 for (size_t i = 0; i < RT_ELEMENTS (mHWData->mBootOrder); i++) 5003 5003 mHWData->mBootOrder [i] = DeviceType_Null; 5004 5004 … … 5013 5013 uint32_t position = (*it).value <uint32_t> ("position"); 5014 5014 -- position; 5015 Assert (position < ELEMENTS (mHWData->mBootOrder));5015 Assert (position < RT_ELEMENTS (mHWData->mBootOrder)); 5016 5016 5017 5017 /* device (required) */ … … 5082 5082 /* slot unicity is guaranteed by XML Schema */ 5083 5083 uint32_t slot = (*it).value <uint32_t> ("slot"); 5084 AssertBreak (slot < ELEMENTS (mNetworkAdapters));5084 AssertBreak (slot < RT_ELEMENTS (mNetworkAdapters)); 5085 5085 5086 5086 rc = mNetworkAdapters [slot]->loadSettings (*it); … … 5102 5102 /* slot unicity is guaranteed by XML Schema */ 5103 5103 uint32_t slot = (*it).value <uint32_t> ("slot"); 5104 AssertBreak (slot < ELEMENTS (mSerialPorts));5104 AssertBreak (slot < RT_ELEMENTS (mSerialPorts)); 5105 5105 5106 5106 rc = mSerialPorts [slot]->loadSettings (*it); … … 5122 5122 /* slot unicity is guaranteed by XML Schema */ 5123 5123 uint32_t slot = (*it).value <uint32_t> ("slot"); 5124 AssertBreak (slot < ELEMENTS (mSerialPorts));5124 AssertBreak (slot < RT_ELEMENTS (mSerialPorts)); 5125 5125 5126 5126 rc = mParallelPorts [slot]->loadSettings (*it); … … 6373 6373 Key bootNode = aNode.createKey ("Boot"); 6374 6374 6375 for (ULONG pos = 0; pos < ELEMENTS (mHWData->mBootOrder); ++ pos)6375 for (ULONG pos = 0; pos < RT_ELEMENTS (mHWData->mBootOrder); ++ pos) 6376 6376 { 6377 6377 const char *device = NULL; … … 6437 6437 Key nwNode = aNode.createKey ("Network"); 6438 6438 6439 for (ULONG slot = 0; slot < ELEMENTS (mNetworkAdapters); ++ slot)6439 for (ULONG slot = 0; slot < RT_ELEMENTS (mNetworkAdapters); ++ slot) 6440 6440 { 6441 6441 Key adapterNode = nwNode.appendKey ("Adapter"); … … 6452 6452 Key serialNode = aNode.createKey ("UART"); 6453 6453 6454 for (ULONG slot = 0; slot < ELEMENTS (mSerialPorts); ++ slot)6454 for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); ++ slot) 6455 6455 { 6456 6456 Key portNode = serialNode.appendKey ("Port"); … … 6467 6467 Key parallelNode = aNode.createKey ("LPT"); 6468 6468 6469 for (ULONG slot = 0; slot < ELEMENTS (mParallelPorts); ++ slot)6469 for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); ++ slot) 6470 6470 { 6471 6471 Key portNode = parallelNode.appendKey ("Port"); … … 7193 7193 AutoReadLock alock (this); 7194 7194 7195 for (ULONG slot = 0; slot < ELEMENTS (mNetworkAdapters); slot ++)7195 for (ULONG slot = 0; slot < RT_ELEMENTS (mNetworkAdapters); slot ++) 7196 7196 if (mNetworkAdapters [slot] && mNetworkAdapters [slot]->isModified()) 7197 7197 return true; 7198 7198 7199 for (ULONG slot = 0; slot < ELEMENTS (mSerialPorts); slot ++)7199 for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); slot ++) 7200 7200 if (mSerialPorts [slot] && mSerialPorts [slot]->isModified()) 7201 7201 return true; 7202 7202 7203 for (ULONG slot = 0; slot < ELEMENTS (mParallelPorts); slot ++)7203 for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); slot ++) 7204 7204 if (mParallelPorts [slot] && mParallelPorts [slot]->isModified()) 7205 7205 return true; … … 7235 7235 AutoReadLock alock (this); 7236 7236 7237 for (ULONG slot = 0; slot < ELEMENTS (mNetworkAdapters); slot ++)7237 for (ULONG slot = 0; slot < RT_ELEMENTS (mNetworkAdapters); slot ++) 7238 7238 if (mNetworkAdapters [slot] && mNetworkAdapters [slot]->isReallyModified()) 7239 7239 return true; 7240 7240 7241 for (ULONG slot = 0; slot < ELEMENTS (mSerialPorts); slot ++)7241 for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); slot ++) 7242 7242 if (mSerialPorts [slot] && mSerialPorts [slot]->isReallyModified()) 7243 7243 return true; 7244 7244 7245 for (ULONG slot = 0; slot < ELEMENTS (mParallelPorts); slot ++)7245 for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); slot ++) 7246 7246 if (mParallelPorts [slot] && mParallelPorts [slot]->isReallyModified()) 7247 7247 return true; … … 7320 7320 usbChanged = false, sataChanged = false; 7321 7321 7322 ComPtr <INetworkAdapter> networkAdapters [ ELEMENTS (mNetworkAdapters)];7323 ComPtr <ISerialPort> serialPorts [ ELEMENTS (mSerialPorts)];7324 ComPtr <IParallelPort> parallelPorts [ ELEMENTS (mParallelPorts)];7322 ComPtr <INetworkAdapter> networkAdapters [RT_ELEMENTS (mNetworkAdapters)]; 7323 ComPtr <ISerialPort> serialPorts [RT_ELEMENTS (mSerialPorts)]; 7324 ComPtr <IParallelPort> parallelPorts [RT_ELEMENTS (mParallelPorts)]; 7325 7325 7326 7326 if (mBIOSSettings) … … 7347 7347 sataChanged = mSATAController->rollback(); 7348 7348 7349 for (ULONG slot = 0; slot < ELEMENTS (mNetworkAdapters); slot ++)7349 for (ULONG slot = 0; slot < RT_ELEMENTS (mNetworkAdapters); slot ++) 7350 7350 if (mNetworkAdapters [slot]) 7351 7351 if (mNetworkAdapters [slot]->rollback()) 7352 7352 networkAdapters [slot] = mNetworkAdapters [slot]; 7353 7353 7354 for (ULONG slot = 0; slot < ELEMENTS (mSerialPorts); slot ++)7354 for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); slot ++) 7355 7355 if (mSerialPorts [slot]) 7356 7356 if (mSerialPorts [slot]->rollback()) 7357 7357 serialPorts [slot] = mSerialPorts [slot]; 7358 7358 7359 for (ULONG slot = 0; slot < ELEMENTS (mParallelPorts); slot ++)7359 for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); slot ++) 7360 7360 if (mParallelPorts [slot]) 7361 7361 if (mParallelPorts [slot]->rollback()) … … 7383 7383 that->onSATAControllerChange(); 7384 7384 7385 for (ULONG slot = 0; slot < ELEMENTS (networkAdapters); slot ++)7385 for (ULONG slot = 0; slot < RT_ELEMENTS (networkAdapters); slot ++) 7386 7386 if (networkAdapters [slot]) 7387 7387 that->onNetworkAdapterChange (networkAdapters [slot]); 7388 for (ULONG slot = 0; slot < ELEMENTS (serialPorts); slot ++)7388 for (ULONG slot = 0; slot < RT_ELEMENTS (serialPorts); slot ++) 7389 7389 if (serialPorts [slot]) 7390 7390 that->onSerialPortChange (serialPorts [slot]); 7391 for (ULONG slot = 0; slot < ELEMENTS (parallelPorts); slot ++)7391 for (ULONG slot = 0; slot < RT_ELEMENTS (parallelPorts); slot ++) 7392 7392 if (parallelPorts [slot]) 7393 7393 that->onParallelPortChange (parallelPorts [slot]); … … 7430 7430 mSATAController->commit(); 7431 7431 7432 for (ULONG slot = 0; slot < ELEMENTS (mNetworkAdapters); slot ++)7432 for (ULONG slot = 0; slot < RT_ELEMENTS (mNetworkAdapters); slot ++) 7433 7433 mNetworkAdapters [slot]->commit(); 7434 for (ULONG slot = 0; slot < ELEMENTS (mSerialPorts); slot ++)7434 for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); slot ++) 7435 7435 mSerialPorts [slot]->commit(); 7436 for (ULONG slot = 0; slot < ELEMENTS (mParallelPorts); slot ++)7436 for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); slot ++) 7437 7437 mParallelPorts [slot]->commit(); 7438 7438 … … 7487 7487 mSATAController->copyFrom (aThat->mSATAController); 7488 7488 7489 for (ULONG slot = 0; slot < ELEMENTS (mNetworkAdapters); slot ++)7489 for (ULONG slot = 0; slot < RT_ELEMENTS (mNetworkAdapters); slot ++) 7490 7490 mNetworkAdapters [slot]->copyFrom (aThat->mNetworkAdapters [slot]); 7491 for (ULONG slot = 0; slot < ELEMENTS (mSerialPorts); slot ++)7491 for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); slot ++) 7492 7492 mSerialPorts [slot]->copyFrom (aThat->mSerialPorts [slot]); 7493 for (ULONG slot = 0; slot < ELEMENTS (mParallelPorts); slot ++)7493 for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); slot ++) 7494 7494 mParallelPorts [slot]->copyFrom (aThat->mParallelPorts [slot]); 7495 7495 } … … 7738 7738 mAudioAdapter->init (this, aMachine->mAudioAdapter); 7739 7739 /* create a list of serial ports that will be mutable */ 7740 for (ULONG slot = 0; slot < ELEMENTS (mSerialPorts); slot ++)7740 for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); slot ++) 7741 7741 { 7742 7742 unconst (mSerialPorts [slot]).createObject(); … … 7744 7744 } 7745 7745 /* create a list of parallel ports that will be mutable */ 7746 for (ULONG slot = 0; slot < ELEMENTS (mParallelPorts); slot ++)7746 for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); slot ++) 7747 7747 { 7748 7748 unconst (mParallelPorts [slot]).createObject(); … … 7756 7756 mSATAController->init (this, aMachine->mSATAController); 7757 7757 /* create a list of network adapters that will be mutable */ 7758 for (ULONG slot = 0; slot < ELEMENTS (mNetworkAdapters); slot ++)7758 for (ULONG slot = 0; slot < RT_ELEMENTS (mNetworkAdapters); slot ++) 7759 7759 { 7760 7760 unconst (mNetworkAdapters [slot]).createObject(); … … 10578 10578 mSATAController->initCopy (this, mPeer->mSATAController); 10579 10579 10580 for (ULONG slot = 0; slot < ELEMENTS (mNetworkAdapters); slot ++)10580 for (ULONG slot = 0; slot < RT_ELEMENTS (mNetworkAdapters); slot ++) 10581 10581 { 10582 10582 unconst (mNetworkAdapters [slot]).createObject(); … … 10584 10584 } 10585 10585 10586 for (ULONG slot = 0; slot < ELEMENTS (mSerialPorts); slot ++)10586 for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); slot ++) 10587 10587 { 10588 10588 unconst (mSerialPorts [slot]).createObject(); … … 10590 10590 } 10591 10591 10592 for (ULONG slot = 0; slot < ELEMENTS (mParallelPorts); slot ++)10592 for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); slot ++) 10593 10593 { 10594 10594 unconst (mParallelPorts [slot]).createObject(); … … 10680 10680 mSATAController->init (this); 10681 10681 10682 for (ULONG slot = 0; slot < ELEMENTS (mNetworkAdapters); slot ++)10682 for (ULONG slot = 0; slot < RT_ELEMENTS (mNetworkAdapters); slot ++) 10683 10683 { 10684 10684 unconst (mNetworkAdapters [slot]).createObject(); … … 10686 10686 } 10687 10687 10688 for (ULONG slot = 0; slot < ELEMENTS (mSerialPorts); slot ++)10688 for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); slot ++) 10689 10689 { 10690 10690 unconst (mSerialPorts [slot]).createObject(); … … 10692 10692 } 10693 10693 10694 for (ULONG slot = 0; slot < ELEMENTS (mParallelPorts); slot ++)10694 for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); slot ++) 10695 10695 { 10696 10696 unconst (mParallelPorts [slot]).createObject();
Note:
See TracChangeset
for help on using the changeset viewer.