Changeset 49028 in vbox for trunk/src/VBox/Main
- Timestamp:
- Oct 10, 2013 12:55:06 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 89794
- Location:
- trunk/src/VBox/Main/xml
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/xml/Settings.cpp
r48983 r49028 493 493 // <ExtraDataItem name="GUI/LastWindowPostion" value="97,88,981,858"/> 494 494 Utf8Str strName, strValue; 495 if ( ((pelmExtraDataItem->getAttributeValue("name", strName))) 496 && ((pelmExtraDataItem->getAttributeValue("value", strValue))) 497 ) 495 if ( pelmExtraDataItem->getAttributeValue("name", strName) 496 && pelmExtraDataItem->getAttributeValue("value", strValue) ) 498 497 map[strName] = strValue; 499 498 else … … 521 520 flt.action = USBDeviceFilterAction_Ignore; 522 521 Utf8Str strAction; 523 if ( (pelmLevel4Child->getAttributeValue("name", flt.strName)) 524 && (pelmLevel4Child->getAttributeValue("active", flt.fActive)) 525 ) 522 if ( pelmLevel4Child->getAttributeValue("name", flt.strName) 523 && pelmLevel4Child->getAttributeValue("active", flt.fActive)) 526 524 { 527 525 if (!pelmLevel4Child->getAttributeValue("vendorId", flt.strVendorId)) … … 576 574 settings::Medium med; 577 575 Utf8Str strUUID; 578 if (! (elmMedium.getAttributeValue("uuid", strUUID)))576 if (!elmMedium.getAttributeValue("uuid", strUUID)) 579 577 throw ConfigFileError(this, &elmMedium, N_("Required %s/@uuid attribute is missing"), elmMedium.getName()); 580 578 … … 669 667 670 668 if (med.strFormat.isEmpty()) // not set with 1.4 format above, or 1.4 Custom format? 671 if (! (elmMedium.getAttributeValue("format", med.strFormat)))669 if (!elmMedium.getAttributeValue("format", med.strFormat)) 672 670 throw ConfigFileError(this, &elmMedium, N_("Required %s/@format attribute is missing"), elmMedium.getName()); 673 671 674 if (! (elmMedium.getAttributeValue("autoReset", med.fAutoReset)))672 if (!elmMedium.getAttributeValue("autoReset", med.fAutoReset)) 675 673 med.fAutoReset = false; 676 674 677 675 Utf8Str strType; 678 if ( (elmMedium.getAttributeValue("type", strType)))676 if (elmMedium.getAttributeValue("type", strType)) 679 677 { 680 678 // pre-1.4 used lower case, so make this case-insensitive … … 701 699 { 702 700 // DVD and floppy images before 1.4 had "src" attribute instead of "location" 703 if (! (elmMedium.getAttributeValue("src", med.strLocation)))701 if (!elmMedium.getAttributeValue("src", med.strLocation)) 704 702 throw ConfigFileError(this, &elmMedium, N_("Required %s/@src attribute is missing"), elmMedium.getName()); 705 703 … … 707 705 } 708 706 709 if (! (elmMedium.getAttributeValue("format", med.strFormat)))707 if (!elmMedium.getAttributeValue("format", med.strFormat)) 710 708 { 711 709 // DVD and floppy images before 1.11 had no format attribute. assign the default. … … 721 719 if (fNeedsLocation) 722 720 // current files and 1.4 CustomHardDisk elements must have a location attribute 723 if (! (elmMedium.getAttributeValue("location", med.strLocation)))721 if (!elmMedium.getAttributeValue("location", med.strLocation)) 724 722 throw ConfigFileError(this, &elmMedium, N_("Required %s/@location attribute is missing"), elmMedium.getName()); 725 723 … … 745 743 { 746 744 Utf8Str strPropName, strPropValue; 747 if ( (pelmHDChild->getAttributeValue("name", strPropName)) 748 && (pelmHDChild->getAttributeValue("value", strPropValue)) 749 ) 745 if ( pelmHDChild->getAttributeValue("name", strPropName) 746 && pelmHDChild->getAttributeValue("value", strPropValue) ) 750 747 med.properties[strPropName] = strPropValue; 751 748 else … … 1302 1299 MachineRegistryEntry mre; 1303 1300 Utf8Str strUUID; 1304 if ( ((pelmChild1->getAttributeValue("uuid", strUUID))) 1305 && ((pelmChild1->getAttributeValue("src", mre.strSettingsFile))) 1306 ) 1301 if ( pelmChild1->getAttributeValue("uuid", strUUID) 1302 && pelmChild1->getAttributeValue("src", mre.strSettingsFile) ) 1307 1303 { 1308 1304 parseUUID(mre.uuid, strUUID); … … 1328 1324 { 1329 1325 DHCPServer srv; 1330 if ( (pelmServer->getAttributeValue("networkName", srv.strNetworkName)) 1331 && (pelmServer->getAttributeValue("IPAddress", srv.strIPAddress)) 1332 && (pelmServer->getAttributeValue("networkMask", srv.GlobalDhcpOptions[DhcpOpt_SubnetMask])) 1333 && (pelmServer->getAttributeValue("lowerIP", srv.strIPLower)) 1334 && (pelmServer->getAttributeValue("upperIP", srv.strIPUpper)) 1335 && (pelmServer->getAttributeValue("enabled", srv.fEnabled)) 1336 ) 1326 if ( pelmServer->getAttributeValue("networkName", srv.strNetworkName) 1327 && pelmServer->getAttributeValue("IPAddress", srv.strIPAddress) 1328 && pelmServer->getAttributeValue("networkMask", srv.GlobalDhcpOptions[DhcpOpt_SubnetMask]) 1329 && pelmServer->getAttributeValue("lowerIP", srv.strIPLower) 1330 && pelmServer->getAttributeValue("upperIP", srv.strIPUpper) 1331 && pelmServer->getAttributeValue("enabled", srv.fEnabled) ) 1337 1332 { 1338 1333 xml::NodesLoop nlOptions(*pelmServer, "Options"); … … 1351 1346 uint32_t u32Slot; 1352 1347 cfg->getAttributeValue("vm-name", strVmName); 1353 cfg->getAttributeValue("slot", (uint32_t&)u32Slot); 1354 readDhcpOptions(srv.VmSlot2OptionsM[VmNameSlotKey(strVmName, u32Slot)], 1355 *cfg); 1348 cfg->getAttributeValue("slot", u32Slot); 1349 readDhcpOptions(srv.VmSlot2OptionsM[VmNameSlotKey(strVmName, u32Slot)], *cfg); 1356 1350 } 1357 1351 llDhcpServers.push_back(srv); … … 1368 1362 xml::NodesLoop nl2(options, "Option"); 1369 1363 const xml::ElementNode *opt; 1370 while ((opt = nl2.forAllNodes()))1364 while ((opt = nl2.forAllNodes())) 1371 1365 { 1372 1366 DhcpOpt_T OptName; … … 1379 1373 opt->getAttributeValue("value", OptValue); 1380 1374 1381 map.insert( 1382 std::map<DhcpOpt_T, Utf8Str>::value_type(OptName, OptValue)); 1375 map.insert(std::map<DhcpOpt_T, Utf8Str>::value_type(OptName, OptValue)); 1383 1376 } /* end of forall("Option") */ 1384 1377 … … 1398 1391 { 1399 1392 NATNetwork net; 1400 if ( (pelmNet->getAttributeValue("networkName", net.strNetworkName)) 1401 && (pelmNet->getAttributeValue("enabled", net.fEnabled)) 1402 && (pelmNet->getAttributeValue("network", net.strNetwork)) 1403 && (pelmNet->getAttributeValue("ipv6", net.fIPv6)) 1404 && (pelmNet->getAttributeValue("ipv6prefix", net.strIPv6Prefix)) 1405 && (pelmNet->getAttributeValue("advertiseDefaultIPv6Route", net.fAdvertiseDefaultIPv6Route)) 1406 && (pelmNet->getAttributeValue("needDhcp", net.fNeedDhcpServer)) 1407 ) 1393 if ( pelmNet->getAttributeValue("networkName", net.strNetworkName) 1394 && pelmNet->getAttributeValue("enabled", net.fEnabled) 1395 && pelmNet->getAttributeValue("network", net.strNetwork) 1396 && pelmNet->getAttributeValue("ipv6", net.fIPv6) 1397 && pelmNet->getAttributeValue("ipv6prefix", net.strIPv6Prefix) 1398 && pelmNet->getAttributeValue("advertiseDefaultIPv6Route", net.fAdvertiseDefaultIPv6Route) 1399 && pelmNet->getAttributeValue("needDhcp", net.fNeedDhcpServer) ) 1408 1400 { 1409 1401 pelmNet->getAttributeValue("loopback6", net.u32HostLoopback6Offset); … … 2379 2371 readNATForwardRuleList(elmMode, nic.nat.llRules); 2380 2372 } 2381 else if ( (elmMode.nameEquals("HostInterface"))2382 || (elmMode.nameEquals("BridgedInterface")))2373 else if ( elmMode.nameEquals("HostInterface") 2374 || elmMode.nameEquals("BridgedInterface")) 2383 2375 { 2384 2376 enmAttachmentType = NetworkAttachmentType_Bridged; … … 2414 2406 { 2415 2407 Utf8Str strPropName, strPropValue; 2416 if ( (pelmModeChild->getAttributeValue("name", strPropName)) 2417 && (pelmModeChild->getAttributeValue("value", strPropValue)) 2418 ) 2408 if ( pelmModeChild->getAttributeValue("name", strPropName) 2409 && pelmModeChild->getAttributeValue("value", strPropValue) ) 2419 2410 nic.genericProperties[strPropName] = strPropValue; 2420 2411 else … … 2958 2949 /* <Property name="TCP/Ports" value="3000-3002"/> */ 2959 2950 Utf8Str strName, strValue; 2960 if ( ((pelmProperty->getAttributeValue("name", strName))) 2961 && ((pelmProperty->getAttributeValue("value", strValue))) 2962 ) 2951 if ( pelmProperty->getAttributeValue("name", strName) 2952 && pelmProperty->getAttributeValue("value", strValue)) 2963 2953 hw.vrdeSettings.mapProperties[strName] = strValue; 2964 2954 else … … 3006 2996 // legacy BIOS/IDEController (pre 1.7) 3007 2997 if ( (m->sv < SettingsVersion_v1_7) 3008 && ( (pelmBIOSChild = pelmHwChild->findChildElement("IDEController")))2998 && (pelmBIOSChild = pelmHwChild->findChildElement("IDEController")) 3009 2999 ) 3010 3000 { … … 3092 3082 readUSBDeviceFilters(*pelmUSBChild, hw.usbSettings.llDeviceFilters); 3093 3083 } 3094 else if ( (m->sv < SettingsVersion_v1_7) 3095 && (pelmHwChild->nameEquals("SATAController")) 3096 ) 3084 else if ( m->sv < SettingsVersion_v1_7 3085 && pelmHwChild->nameEquals("SATAController")) 3097 3086 { 3098 3087 bool f; 3099 if ( (pelmHwChild->getAttributeValue("enabled", f)) 3100 && (f) 3101 ) 3088 if ( pelmHwChild->getAttributeValue("enabled", f) 3089 && f) 3102 3090 { 3103 3091 StorageController sctl; … … 3116 3104 { 3117 3105 Utf8Str strLocalOrUTC; 3118 machineUserData.fRTCUseUTC = 3119 3120 } 3121 else if ( (pelmHwChild->nameEquals("UART"))3122 || (pelmHwChild->nameEquals("Uart")) // used before 1.33106 machineUserData.fRTCUseUTC = pelmHwChild->getAttributeValue("localOrUTC", strLocalOrUTC) 3107 && strLocalOrUTC == "UTC"; 3108 } 3109 else if ( pelmHwChild->nameEquals("UART") 3110 || pelmHwChild->nameEquals("Uart") // used before 1.3 3123 3111 ) 3124 3112 readSerialPorts(*pelmHwChild, hw.llSerialPorts); 3125 else if ( (pelmHwChild->nameEquals("LPT"))3126 || (pelmHwChild->nameEquals("Lpt")) // used before 1.33113 else if ( pelmHwChild->nameEquals("LPT") 3114 || pelmHwChild->nameEquals("Lpt") // used before 1.3 3127 3115 ) 3128 3116 readParallelPorts(*pelmHwChild, hw.llParallelPorts); … … 3226 3214 } 3227 3215 } 3228 } else if (pelmHwChild->nameEquals("HostPci")) { 3216 } 3217 else if (pelmHwChild->nameEquals("HostPci")) 3218 { 3229 3219 const xml::ElementNode *pelmDevices; 3230 3220 … … 3537 3527 const xml::ElementNode *pDriveChild; 3538 3528 Utf8Str strTmp; 3539 if ( ((pDriveChild = pelmHwChild->findChildElement("Image"))) 3540 && (pDriveChild->getAttributeValue("uuid", strTmp)) 3541 ) 3529 if ( (pDriveChild = pelmHwChild->findChildElement("Image")) != NULL 3530 && pDriveChild->getAttributeValue("uuid", strTmp)) 3542 3531 parseUUID(att.uuid, strTmp); 3543 3532 else if ((pDriveChild = pelmHwChild->findChildElement("HostDrive"))) … … 3567 3556 { 3568 3557 bool fEnabled; 3569 if ( (pelmHwChild->getAttributeValue("enabled", fEnabled)) 3570 && (fEnabled) 3571 ) 3558 if ( pelmHwChild->getAttributeValue("enabled", fEnabled) 3559 && fEnabled) 3572 3560 { 3573 3561 // create a new floppy controller and attach a floppy "attached device" … … 3585 3573 const xml::ElementNode *pDriveChild; 3586 3574 Utf8Str strTmp; 3587 if ( ((pDriveChild = pelmHwChild->findChildElement("Image"))) 3588 && (pDriveChild->getAttributeValue("uuid", strTmp)) 3589 ) 3575 if ( (pDriveChild = pelmHwChild->findChildElement("Image")) 3576 && pDriveChild->getAttributeValue("uuid", strTmp) ) 3590 3577 parseUUID(att.uuid, strTmp); 3591 3578 else if ((pDriveChild = pelmHwChild->findChildElement("HostDrive"))) … … 3734 3721 if (pelmSnapshotChild->nameEquals("Description")) 3735 3722 snap.strDescription = pelmSnapshotChild->getValue(); 3736 else if ( (m->sv < SettingsVersion_v1_7) 3737 && (pelmSnapshotChild->nameEquals("HardDiskAttachments")) 3738 ) 3723 else if ( m->sv < SettingsVersion_v1_7 3724 && pelmSnapshotChild->nameEquals("HardDiskAttachments")) 3739 3725 readHardDiskAttachments_pre1_7(*pelmSnapshotChild, snap.storage); 3740 else if ( (m->sv >= SettingsVersion_v1_7) 3741 && (pelmSnapshotChild->nameEquals("StorageControllers")) 3742 ) 3726 else if ( m->sv >= SettingsVersion_v1_7 3727 && pelmSnapshotChild->nameEquals("StorageControllers")) 3743 3728 readStorageControllers(*pelmSnapshotChild, snap.storage); 3744 3729 else if (pelmSnapshotChild->nameEquals("Snapshots")) … … 3837 3822 { 3838 3823 Utf8Str strUUID; 3839 if ( (elmMachine.getAttributeValue("uuid", strUUID)) 3840 && (elmMachine.getAttributeValue("name", machineUserData.strName)) 3841 ) 3824 if ( elmMachine.getAttributeValue("uuid", strUUID) 3825 && elmMachine.getAttributeValue("name", machineUserData.strName)) 3842 3826 { 3843 3827 parseUUID(uuid, strUUID); -
trunk/src/VBox/Main/xml/ovfreader.cpp
r48009 r49028 91 91 } 92 92 93 if ((pTypeAttr = pRootElem->findAttribute(" xml:lang")))93 if ((pTypeAttr = pRootElem->findAttribute("lang", "xml"))) 94 94 { 95 95 pcszTypeAttr = pTypeAttr->getValue(); … … 135 135 const char *pcszTypeAttr = ""; 136 136 const xml::AttributeNode *pTypeAttr; 137 if ( ( (pTypeAttr = pElem->findAttribute("xsi:type")))138 || ( (pTypeAttr = pElem->findAttribute("type")))137 if ( (pTypeAttr = pElem->findAttribute("type", "xsi")) != NULL 138 || (pTypeAttr = pElem->findAttribute("type")) != NULL 139 139 ) 140 140 pcszTypeAttr = pTypeAttr->getValue(); … … 231 231 232 232 // optional vbox:uuid attribute (if OVF was exported by VirtualBox != 3.2) 233 pelmDisk->getAttributeValue(" vbox:uuid", d.uuidVbox);233 pelmDisk->getAttributeValue("uuid", d.uuidVbox, "vbox"); 234 234 235 235 const char *pcszFileRef; … … 335 335 // peek under the <VirtualSystem> node whether we have a <vbox:Machine> node; 336 336 // that case case, the caller can completely ignore the OVF but only load the VBox machine XML 337 vsys.pelmVboxMachine = pelmVirtualSystem->findChildElement ("vbox", "Machine");337 vsys.pelmVboxMachine = pelmVirtualSystem->findChildElementNS("vbox", "Machine"); 338 338 339 339 // now look for real OVF … … 351 351 { 352 352 const xml::AttributeNode *pTypeAttr; 353 if ( ( (pTypeAttr = pelmThis->findAttribute("type")))354 || ( (pTypeAttr = pelmThis->findAttribute("xsi:type")))353 if ( (pTypeAttr = pelmThis->findAttribute("type")) != NULL 354 || (pTypeAttr = pelmThis->findAttribute("type", "xsi")) != NULL 355 355 ) 356 356 pcszTypeAttr = pTypeAttr->getValue(); … … 813 813 814 814 const xml::ElementNode *pelmVBoxOSType; 815 if ((pelmVBoxOSType = pelmThis->findChildElement ("vbox", // namespace816 "OSType"))) // element name815 if ((pelmVBoxOSType = pelmThis->findChildElementNS("vbox", // namespace 816 "OSType"))) // element name 817 817 vsys.strTypeVbox = pelmVBoxOSType->getValue(); 818 818 }
Note:
See TracChangeset
for help on using the changeset viewer.