VirtualBox

Changeset 24497 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 9, 2009 12:31:12 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
54586
Message:

Main/Settings.cpp: Corrected the handling of the hardware version. Added a kludge for dealing with the output of the buggy code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/xml/Settings.cpp

    r24494 r24497  
    12471247 */
    12481248Hardware::Hardware()
    1249         : strVersion("2"),
     1249        : strVersion("1"),
    12501250          fHardwareVirt(true),
    12511251          fHardwareVirtExclusive(HWVIRTEXCLUSIVEDEFAULT),
     
    15201520                                     Storage &strg)
    15211521{
    1522     elmHardware.getAttributeValue("version", hw.strVersion);
    1523             // defaults to 2 and is only written if != 2
    1524 
     1522    if (!elmHardware.getAttributeValue("version", hw.strVersion))
     1523    {
     1524        /* KLUDGE ALERT!  For a while during the 3.1 development this was not
     1525           written because it was thought to have a default value of "2".  For
     1526           sv <= 1.3 it defaults to "1" because the attribute didn't exist,
     1527           while for 1.4+ it is sort of mandatory.  Now, the buggy XML writer
     1528           code only wrote 1.7 and later.  So, if it's a 1.7+ XML file and it's
     1529           missing the hardware version, then it probably should be "2" instead
     1530           of "1". */
     1531        if (m->sv < SettingsVersion_v1_7)
     1532            hw.strVersion = "1";
     1533        else
     1534            hw.strVersion = "2";
     1535    }
    15251536    Utf8Str strUUID;
    15261537    if (elmHardware.getAttributeValue("uuid", strUUID))
     
    24242435    xml::ElementNode *pelmHardware = elmParent.createChild("Hardware");
    24252436
    2426     if (hw.strVersion != "2")
     2437    if (m->sv >= SettingsVersion_v1_4)
    24272438        pelmHardware->setAttribute("version", hw.strVersion);
    24282439    if (    (m->sv >= SettingsVersion_v1_9)
     
    29522963void MachineConfigFile::bumpSettingsVersionIfNeeded()
    29532964{
     2965    // The hardware versions other than "1" requires settings version 1.4 (2.1+).
     2966    if (    m->sv < SettingsVersion_v1_4
     2967         && hardwareMachine.strVersion != "1")
     2968        m->sv < SettingsVersion_v1_4;
     2969
    29542970    // "accelerate 2d video" requires settings version 1.8
    29552971    if (    (m->sv < SettingsVersion_v1_8)
Note: See TracChangeset for help on using the changeset viewer.

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