VirtualBox

Changeset 22171 in vbox


Ignore:
Timestamp:
Aug 11, 2009 3:10:12 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
50947
Message:

ConsoleImpl2.cpp: More cleanup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ConsoleImpl2.cpp

    r22166 r22171  
    667667         * intelppm driver refuses to register an idle state handler.
    668668         */
    669         if ((cCpus > 1) || fIOAPIC)
     669        if (cCpus > 1 || fIOAPIC)
    670670            fShowCpu = true;
    671671
     
    761761    hrc = pMachine->COMGETTER(VRAMSize)(&cVRamMBs);                                 H();
    762762    rc = CFGMR3InsertInteger(pCfg,  "VRamSize",             cVRamMBs * _1M);        RC_CHECK();
    763 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE /* not safe here yet. */
     763#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE /* not safe here yet. */ /** @todo this needs fixing !!! No wonder VGA is slooooooooow on 32-bit darwin! */
    764764    rc = CFGMR3InsertInteger(pCfg,  "R0Enabled",            fHWVirtExEnabled);      RC_CHECK();
    765765#endif
     
    784784     * Boot menu
    785785     */
    786     BIOSBootMenuMode_T bootMenuMode;
    787     int value;
    788     biosSettings->COMGETTER(BootMenuMode)(&bootMenuMode);
    789     switch (bootMenuMode)
    790     {
    791         case BIOSBootMenuMode_Disabled:
    792             value = 0;
    793             break;
    794         case BIOSBootMenuMode_MenuOnly:
    795             value = 1;
    796             break;
    797         default:
    798             value = 2;
    799     }
    800     rc = CFGMR3InsertInteger(pCfg, "ShowBootMenu", value);                          RC_CHECK();
     786    BIOSBootMenuMode_T eBootMenuMode;
     787    int iShowBootMenu;
     788    biosSettings->COMGETTER(BootMenuMode)(&eBootMenuMode);
     789    switch (eBootMenuMode)
     790    {
     791        case BIOSBootMenuMode_Disabled: iShowBootMenu = 0;  break;
     792        case BIOSBootMenuMode_MenuOnly: iShowBootMenu = 1;  break;
     793        default:                        iShowBootMenu = 2;  break;
     794    }
     795    rc = CFGMR3InsertInteger(pCfg, "ShowBootMenu", iShowBootMenu);                  RC_CHECK();
    801796
    802797    /* Custom VESA mode list */
     
    844839    for (size_t i = 0; i < ctrls.size(); ++ i)
    845840    {
    846         PCFGMNODE pCtlInst = NULL;     /* /Devices/<name>/0/ */
     841        PCFGMNODE               pCtlInst = NULL;    /* /Devices/<name>/0/ */
    847842        StorageControllerType_T enmCtrlType;
    848         StorageBus_T enmBus;
    849         bool fSCSI = false;
    850         BSTR controllerName;
     843        StorageBus_T            enmBus;
     844        bool                    fSCSI = false;
     845        BSTR                    controllerName;
    851846
    852847        rc = ctrls[i]->COMGETTER(ControllerType)(&enmCtrlType);                     H();
     
    877872                break;
    878873            }
     874
    879875            case StorageControllerType_BusLogic:
    880876            {
     
    898894                break;
    899895            }
     896
    900897            case StorageControllerType_IntelAhci:
    901898            {
     
    945942                break;
    946943            }
     944
    947945            case StorageControllerType_PIIX3:
    948946            case StorageControllerType_PIIX4:
     
    10171015                break;
    10181016            }
     1017
    10191018            default:
    1020                 AssertMsgFailed (("invalid storage controller type: "
    1021                                     "%d\n", enmCtrlType));
    1022                 return VERR_GENERAL_FAILURE;
     1019                AssertMsgFailedReturn(("invalid storage controller type: %d\n", enmCtrlType), VERR_GENERAL_FAILURE);
    10231020        }
    10241021
     
    10461043                case StorageBus_IDE:
    10471044                {
    1048                     if (lPort >= 2 || lPort < 0)
    1049                     {
    1050                         AssertMsgFailed (("invalid controller channel number: "
    1051                                             "%d\n", lPort));
    1052                         return VERR_GENERAL_FAILURE;
    1053                     }
    1054 
    1055                     if (lDev >= 2 || lDev < 0)
    1056                     {
    1057                         AssertMsgFailed (("invalid controller device number: "
    1058                                             "%d\n", lDev));
    1059                         return VERR_GENERAL_FAILURE;
    1060                     }
    1061 
     1045                    AssertMsgReturn(lPort < 2 && lPort >= 0, ("%d\n", lPort), VERR_GENERAL_FAILURE);
     1046                    AssertMsgReturn(lDev < 2  && lDev >= 0,  ("%d\n", lDev),  VERR_GENERAL_FAILURE);
    10621047                    iLUN = 2 * lPort + lDev;
    10631048                    break;
     
    10701055                }
    10711056                default:
    1072                 {
    1073                     AssertMsgFailed (("invalid storage bus type: "
    1074                                         "%d\n", enmBus));
    1075                     return VERR_GENERAL_FAILURE;
    1076                 }
     1057                    AssertMsgFailedReturn(("%d\n", enmBus), VERR_GENERAL_FAILURE);
    10771058            }
    10781059
     
    11151096                PCFGMNODE pVDC;
    11161097                rc = CFGMR3InsertNode(pCfg, "VDConfig", &pVDC);                 RC_CHECK();
    1117                 for (size_t ii = 0; ii < names.size(); ++ ii)
     1098                for (size_t ii = 0; ii < names.size(); ++ii)
    11181099                {
    11191100                    if (values[ii] && *values[ii])
     
    11221103                        Utf8Str value = values[ii];
    11231104                        rc = CFGMR3InsertString(pVDC, name, value);
    1124                         if (    !(name.compare("HostIPStack"))
    1125                             &&  !(value.compare("0")))
     1105                        if (    name.compare("HostIPStack") == 0
     1106                            &&  value.compare("0") == 0)
    11261107                            fHostIP = false;
    11271108                    }
     
    11641145                            Utf8Str name = names[ii];
    11651146                            Utf8Str value = values[ii];
    1166                             rc = CFGMR3InsertString (pVDC, name, value);
     1147                            rc = CFGMR3InsertString(pVDC, name, value);
    11671148                            if (    name.compare("HostIPStack") == 0
    11681149                                &&  value.compare("0") == 0)
     
    13451326         * Configure the network card now
    13461327         */
    1347 
    13481328        rc = configNetwork(pConsole, pszAdapterName, ulInstance, 0, networkAdapter,
    1349                            pCfg, pLunL0, pInst, false /*fAttachDetach*/);
    1350         RC_CHECK();
     1329                           pCfg, pLunL0, pInst, false /*fAttachDetach*/);           RC_CHECK();
    13511330    }
    13521331
     
    13681347        rc = CFGMR3InsertNode(pInst, "Config", &pCfg);                              RC_CHECK();
    13691348
    1370         ULONG ulIRQ, ulIOBase;
    1371         PortMode_T HostMode;
    1372         Bstr  path;
     1349        ULONG ulIRQ;
     1350        hrc = serialPort->COMGETTER(IRQ)(&ulIRQ);                                   H();
     1351        rc = CFGMR3InsertInteger(pCfg,   "IRQ", ulIRQ);                             RC_CHECK();
     1352        ULONG ulIOBase;
     1353        hrc = serialPort->COMGETTER(IOBase)(&ulIOBase);                             H();
     1354        rc = CFGMR3InsertInteger(pCfg,   "IOBase", ulIOBase);                       RC_CHECK();
    13731355        BOOL  fServer;
    1374         hrc = serialPort->COMGETTER(HostMode)(&HostMode);                           H();
    1375         hrc = serialPort->COMGETTER(IRQ)(&ulIRQ);                                   H();
    1376         hrc = serialPort->COMGETTER(IOBase)(&ulIOBase);                             H();
    1377         hrc = serialPort->COMGETTER(Path)(path.asOutParam());                       H();
    13781356        hrc = serialPort->COMGETTER(Server)(&fServer);                              H();
    1379         rc = CFGMR3InsertInteger(pCfg,   "IRQ", ulIRQ);                             RC_CHECK();
    1380         rc = CFGMR3InsertInteger(pCfg,   "IOBase", ulIOBase);                       RC_CHECK();
    1381         if (HostMode != PortMode_Disconnected)
     1357        hrc = serialPort->COMGETTER(Path)(&str);                                    H();
     1358        PortMode_T eHostMode;
     1359        hrc = serialPort->COMGETTER(HostMode)(&eHostMode);                          H();
     1360        if (eHostMode != PortMode_Disconnected)
    13821361        {
    13831362            rc = CFGMR3InsertNode(pInst,     "LUN#0", &pLunL0);                     RC_CHECK();
    1384             if (HostMode == PortMode_HostPipe)
     1363            if (eHostMode == PortMode_HostPipe)
    13851364            {
    13861365                rc = CFGMR3InsertString(pLunL0,  "Driver", "Char");                 RC_CHECK();
     
    13881367                rc = CFGMR3InsertString(pLunL1,  "Driver", "NamedPipe");            RC_CHECK();
    13891368                rc = CFGMR3InsertNode(pLunL1,    "Config", &pLunL2);                RC_CHECK();
    1390                 rc = CFGMR3InsertString(pLunL2,  "Location", Utf8Str(path));        RC_CHECK();
     1369                rc = CFGMR3InsertStringW(pLunL2, "Location", str);                  RC_CHECK();
    13911370                rc = CFGMR3InsertInteger(pLunL2, "IsServer", fServer);              RC_CHECK();
    13921371            }
    1393             else if (HostMode == PortMode_HostDevice)
     1372            else if (eHostMode == PortMode_HostDevice)
    13941373            {
    13951374                rc = CFGMR3InsertString(pLunL0,  "Driver", "Host Serial");          RC_CHECK();
    13961375                rc = CFGMR3InsertNode(pLunL0,    "Config", &pLunL1);                RC_CHECK();
    1397                 rc = CFGMR3InsertString(pLunL1,  "DevicePath", Utf8Str(path));      RC_CHECK();
    1398             }
    1399             else if (HostMode == PortMode_RawFile)
     1376                rc = CFGMR3InsertStringW(pLunL1, "DevicePath", str);                RC_CHECK();
     1377            }
     1378            else if (eHostMode == PortMode_RawFile)
    14001379            {
    14011380                rc = CFGMR3InsertString(pLunL0,  "Driver", "Char");                 RC_CHECK();
     
    14031382                rc = CFGMR3InsertString(pLunL1,  "Driver", "RawFile");              RC_CHECK();
    14041383                rc = CFGMR3InsertNode(pLunL1,    "Config", &pLunL2);                RC_CHECK();
    1405                 rc = CFGMR3InsertString(pLunL2,  "Location", Utf8Str(path));        RC_CHECK();
    1406             }
    1407         }
     1384                rc = CFGMR3InsertStringW(pLunL2, "Location", str);                  RC_CHECK();
     1385            }
     1386        }
     1387        STR_FREE();
    14081388    }
    14091389
     
    14151395    {
    14161396        ComPtr<IParallelPort> parallelPort;
    1417         hrc = pMachine->GetParallelPort (ulInstance, parallelPort.asOutParam());    H();
     1397        hrc = pMachine->GetParallelPort(ulInstance, parallelPort.asOutParam());     H();
    14181398        BOOL fEnabled = FALSE;
    14191399        if (parallelPort)
     1400        {
    14201401            hrc = parallelPort->COMGETTER(Enabled)(&fEnabled);                      H();
     1402        }
    14211403        if (!fEnabled)
    14221404            continue;
     
    14251407        rc = CFGMR3InsertNode(pInst, "Config", &pCfg);                              RC_CHECK();
    14261408
    1427         ULONG ulIRQ, ulIOBase;
    1428         Bstr  DevicePath;
     1409        ULONG ulIRQ;
    14291410        hrc = parallelPort->COMGETTER(IRQ)(&ulIRQ);                                 H();
     1411        rc = CFGMR3InsertInteger(pCfg,   "IRQ", ulIRQ);                             RC_CHECK();
     1412        ULONG ulIOBase;
    14301413        hrc = parallelPort->COMGETTER(IOBase)(&ulIOBase);                           H();
    1431         hrc = parallelPort->COMGETTER(Path)(DevicePath.asOutParam());               H();
    1432         rc = CFGMR3InsertInteger(pCfg,   "IRQ", ulIRQ);                             RC_CHECK();
    14331414        rc = CFGMR3InsertInteger(pCfg,   "IOBase", ulIOBase);                       RC_CHECK();
    14341415        rc = CFGMR3InsertNode(pInst,     "LUN#0", &pLunL0);                         RC_CHECK();
    14351416        rc = CFGMR3InsertString(pLunL0,  "Driver", "HostParallel");                 RC_CHECK();
    14361417        rc = CFGMR3InsertNode(pLunL0,    "AttachedDriver", &pLunL1);                RC_CHECK();
    1437         rc = CFGMR3InsertString(pLunL1,  "DevicePath", Utf8Str(DevicePath));        RC_CHECK();
     1418        hrc = parallelPort->COMGETTER(Path)(&str);                                  H();
     1419        rc = CFGMR3InsertStringW(pLunL1,  "DevicePath", str);                       RC_CHECK();
     1420        STR_FREE();
    14381421    }
    14391422
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette