VirtualBox

Changeset 24274 in vbox


Ignore:
Timestamp:
Nov 2, 2009 6:51:09 PM (15 years ago)
Author:
vboxsync
Message:

Main: xml versioning fixes

File:
1 edited

Legend:

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

    r24250 r24274  
    14501450    if (elmHardware.getAttributeValue("uuid", strUUID))
    14511451        parseUUID(hw.uuid, strUUID);
    1452     else
    1453         hw.uuid.clear();
    14541452
    14551453    xml::NodesLoop nl1(elmHardware);
     
    18631861        }
    18641862
    1865         if (!pelmController->getAttributeValue("Instance", sctl.ulInstance))
    1866             sctl.ulInstance = 0;
     1863        pelmController->getAttributeValue("Instance", sctl.ulInstance);
     1864            // default from constructor is 0
    18671865
    18681866        Utf8Str strType;
     
    23402338    if (hw.strVersion != "2")
    23412339        pelmHardware->setAttribute("version", hw.strVersion);
    2342     if (!hw.uuid.isEmpty())
     2340    if (    (m->sv >= SettingsVersion_v1_9)
     2341         && (!hw.uuid.isEmpty())
     2342       )
    23432343        pelmHardware->setAttribute("uuid", makeString(hw.uuid));
    23442344
     
    27392739        pelmController->setAttribute("PortCount", sc.ulPortCount);
    27402740
    2741         pelmController->setAttribute("Instance", sc.ulInstance);
     2741        if (m->sv >= SettingsVersion_v1_9)
     2742            if (sc.ulInstance)
     2743                pelmController->setAttribute("Instance", sc.ulInstance);
    27422744
    27432745        if (sc.controllerType == StorageControllerType_IntelAhci)
     
    27552757            const AttachedDevice &att = *it2;
    27562758
    2757             /* DVD/Floppy is handled already for settings version before 1.8 */
     2759            // For settings version before 1.9, DVDs and floppies are in hardware, not storage controllers,
     2760            // so we shouldn't write them here; we only get here for DVDs though because we ruled out
     2761            // the floppy controller at the top of the loop
    27582762            if (    att.deviceType == DeviceType_DVD
    2759                 &&  m->sv <= SettingsVersion_v1_8)
     2763                 && m->sv < SettingsVersion_v1_9
     2764               )
    27602765                continue;
    27612766
     
    28632868            const StorageController &sctl = *it;
    28642869            for (AttachedDevicesList::const_iterator it2 = sctl.llAttachedDevices.begin();
    2865                     it2 != sctl.llAttachedDevices.end()
    2866                         && m->sv < SettingsVersion_v1_9;
    2867                     ++it2)
    2868             {
     2870                 it2 != sctl.llAttachedDevices.end();
     2871                 ++it2)
     2872            {
     2873                if (sctl.ulInstance != 0)       // we can only write the StorageController/@Instance attribute with v1.9
     2874                {
     2875                    m->sv = SettingsVersion_v1_9;
     2876                    break;
     2877                }
     2878
    28692879                const AttachedDevice &att = *it2;
    28702880                if (att.deviceType == DeviceType_DVD)
     
    28862896        }
    28872897
    2888         // VirtualBox before 3.1 had exactly one floppy and exactly one DVD,
     2898        // VirtualBox before 3.1 had zero or one floppy and exactly one DVD,
    28892899        // so any deviation from that will require settings version 1.9
    28902900        if (    (m->sv < SettingsVersion_v1_9)
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