VirtualBox

Changeset 11251 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Aug 8, 2008 2:08:16 PM (16 years ago)
Author:
vboxsync
Message:

DevPit-i8254: Use CFGM*Def.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/DevPit-i8254.cpp

    r11250 r11251  
    939939     * Validate configuration.
    940940     */
    941     if (!CFGMR3AreValuesValid(pCfgHandle, "Irq\0Base\0Speaker\0GCEnabled\0R0Enabled\0"))
     941    if (!CFGMR3AreValuesValid(pCfgHandle, "Irq\0" "Base\0" "Speaker\0" "GCEnabled\0" "R0Enabled\0"))
    942942        return VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES;
    943943
     
    945945     * Init the data.
    946946     */
    947     rc = CFGMR3QueryU8(pCfgHandle, "Irq", &u8Irq);
    948     if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    949         u8Irq = 0;
    950     else if (VBOX_FAILURE(rc))
     947    rc = CFGMR3QueryU8Def(pCfgHandle, "Irq", &u8Irq, 0);
     948    if (VBOX_FAILURE(rc))
    951949        return PDMDEV_SET_ERROR(pDevIns, rc,
    952950                                N_("Configuration error: Querying \"Irq\" as a uint8_t failed"));
    953951
    954     rc = CFGMR3QueryU16(pCfgHandle, "Base", &u16Base);
    955     if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    956         u16Base = 0x40;
    957     else if (VBOX_FAILURE(rc))
     952    rc = CFGMR3QueryU16Def(pCfgHandle, "Base", &u16Base, 0x40);
     953    if (VBOX_FAILURE(rc))
    958954        return PDMDEV_SET_ERROR(pDevIns, rc,
    959955                                N_("Configuration error: Querying \"Base\" as a uint16_t failed"));
    960956
    961     rc = CFGMR3QueryBool(pCfgHandle, "SpeakerEnabled", &fSpeaker);
    962     if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    963         fSpeaker = true;
    964     else if (VBOX_FAILURE(rc))
     957    rc = CFGMR3QueryBoolDef(pCfgHandle, "SpeakerEnabled", &fSpeaker, true);
     958    if (VBOX_FAILURE(rc))
    965959        return PDMDEV_SET_ERROR(pDevIns, rc,
    966960                                N_("Configuration error: Querying \"SpeakerEnabled\" as a bool failed"));
    967961
    968     rc = CFGMR3QueryBool(pCfgHandle, "GCEnabled", &fGCEnabled);
    969     if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    970         fGCEnabled = true;
    971     else if (VBOX_FAILURE(rc))
     962    rc = CFGMR3QueryBoolDef(pCfgHandle, "GCEnabled", &fGCEnabled, true);
     963    if (VBOX_FAILURE(rc))
    972964        return PDMDEV_SET_ERROR(pDevIns, rc,
    973965                                N_("Configuration error: Querying \"GCEnabled\" as a bool failed"));
    974966
    975     rc = CFGMR3QueryBool(pCfgHandle, "R0Enabled", &fR0Enabled);
    976     if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    977         fR0Enabled = true;
    978     else if (VBOX_FAILURE(rc))
     967    rc = CFGMR3QueryBoolDef(pCfgHandle, "R0Enabled", &fR0Enabled, true);
     968    if (VBOX_FAILURE(rc))
    979969        return PDMDEV_SET_ERROR(pDevIns, rc,
    980970                                N_("Configuration error: failed to read R0Enabled as boolean"));
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