Changeset 49029 in vbox for trunk/src/VBox
- Timestamp:
- Oct 10, 2013 1:17:09 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 89795
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/ovfreader.h
r48955 r49029 38 38 * that one catch() for all xml::LogicError can handle all possible errors. 39 39 */ 40 41 40 class OVFLogicError : public xml::LogicError 42 41 { … … 44 43 OVFLogicError(const char *aFormat, ...); 45 44 }; 45 46 46 47 47 //////////////////////////////////////////////////////////////////////////////// … … 371 371 } 372 372 373 void checkConsistencyAndCompliance() throw(OVFLogicError)373 void checkConsistencyAndCompliance() RT_THROW(OVFLogicError) 374 374 { 375 375 _checkConsistencyAndCompliance(); … … 377 377 378 378 protected: 379 virtual void _checkConsistencyAndCompliance() throw(OVFLogicError);379 virtual void _checkConsistencyAndCompliance() RT_THROW(OVFLogicError); 380 380 virtual const RTCString& getItemName() 381 381 { … … 428 428 429 429 protected: 430 virtual void _checkConsistencyAndCompliance() throw(OVFLogicError);430 virtual void _checkConsistencyAndCompliance() RT_THROW(OVFLogicError); 431 431 private: 432 432 RTCString itemName; … … 474 474 475 475 protected: 476 virtual void _checkConsistencyAndCompliance() throw(OVFLogicError);476 virtual void _checkConsistencyAndCompliance() RT_THROW(OVFLogicError); 477 477 private: 478 478 RTCString itemName; … … 632 632 </code> 633 633 */ 634 635 634 class OVFReader 636 635 { -
trunk/src/VBox/Main/xml/ovfreader.cpp
r49028 r49029 133 133 { 134 134 const char *pcszElemName = pElem->getName(); 135 const char *pcszTypeAttr = ""; 136 const xml::AttributeNode *pTypeAttr; 137 if ( (pTypeAttr = pElem->findAttribute("type", "xsi")) != NULL 138 || (pTypeAttr = pElem->findAttribute("type")) != NULL 139 ) 140 pcszTypeAttr = pTypeAttr->getValue(); 141 142 if ( (!strcmp(pcszElemName, "DiskSection")) 143 || ( (!strcmp(pcszElemName, "Section")) 144 && (!strcmp(pcszTypeAttr, "ovf:DiskSection_Type")) 135 const xml::AttributeNode *pTypeAttr = pElem->findAttribute("type"); 136 const char *pcszTypeAttr = pTypeAttr ? pTypeAttr->getValue() : ""; 137 138 if ( !strcmp(pcszElemName, "DiskSection") 139 || ( !strcmp(pcszElemName, "Section") 140 && !strcmp(pcszTypeAttr, "ovf:DiskSection_Type") 145 141 ) 146 142 ) … … 148 144 HandleDiskSection(pReferencesElem, pElem); 149 145 } 150 else if ( (!strcmp(pcszElemName, "NetworkSection"))151 || ( (!strcmp(pcszElemName, "Section"))152 && (!strcmp(pcszTypeAttr, "ovf:NetworkSection_Type"))146 else if ( !strcmp(pcszElemName, "NetworkSection") 147 || ( !strcmp(pcszElemName, "Section") 148 && !strcmp(pcszTypeAttr, "ovf:NetworkSection_Type") 153 149 ) 154 150 ) … … 156 152 HandleNetworkSection(pElem); 157 153 } 158 else if ( (!strcmp(pcszElemName, "DeploymentOptionSection")))154 else if ( !strcmp(pcszElemName, "DeploymentOptionSection")) 159 155 { 160 156 // TODO 161 157 } 162 else if ( (!strcmp(pcszElemName, "Info")))158 else if ( !strcmp(pcszElemName, "Info")) 163 159 { 164 160 // child of VirtualSystemCollection -- TODO 165 161 } 166 else if ( (!strcmp(pcszElemName, "ResourceAllocationSection")))162 else if ( !strcmp(pcszElemName, "ResourceAllocationSection")) 167 163 { 168 164 // child of VirtualSystemCollection -- TODO 169 165 } 170 else if ( (!strcmp(pcszElemName, "StartupSection")))166 else if ( !strcmp(pcszElemName, "StartupSection")) 171 167 { 172 168 // child of VirtualSystemCollection -- TODO 173 169 } 174 else if ( (!strcmp(pcszElemName, "VirtualSystem"))175 || ( (!strcmp(pcszElemName, "Content"))176 && (!strcmp(pcszTypeAttr, "ovf:VirtualSystem_Type"))170 else if ( !strcmp(pcszElemName, "VirtualSystem") 171 || ( !strcmp(pcszElemName, "Content") 172 && !strcmp(pcszTypeAttr, "ovf:VirtualSystem_Type") 177 173 ) 178 174 ) … … 180 176 HandleVirtualSystemContent(pElem); 181 177 } 182 else if ( (!strcmp(pcszElemName, "VirtualSystemCollection"))183 || ( (!strcmp(pcszElemName, "Content"))184 && (!strcmp(pcszTypeAttr, "ovf:VirtualSystemCollection_Type"))178 else if ( !strcmp(pcszElemName, "VirtualSystemCollection") 179 || ( !strcmp(pcszElemName, "Content") 180 && !strcmp(pcszTypeAttr, "ovf:VirtualSystemCollection_Type") 185 181 ) 186 182 ) … … 215 211 const char *pcszDiskId; 216 212 const char *pcszFormat; 217 if (! (pelmDisk->getAttributeValue("diskId", pcszDiskId)))213 if (!pelmDisk->getAttributeValue("diskId", pcszDiskId)) 218 214 pcszBad = "diskId"; 219 else if (! (pelmDisk->getAttributeValue("format", pcszFormat)))215 else if (!pelmDisk->getAttributeValue("format", pcszFormat)) 220 216 pcszBad = "format"; 221 else if (! (pelmDisk->getAttributeValue("capacity", d.iCapacity)))217 else if (!pelmDisk->getAttributeValue("capacity", d.iCapacity)) 222 218 pcszBad = "capacity"; 223 219 else … … 226 222 d.strFormat = pcszFormat; 227 223 228 if (! (pelmDisk->getAttributeValue("populatedSize", d.iPopulatedSize)))224 if (!pelmDisk->getAttributeValue("populatedSize", d.iPopulatedSize)) 229 225 // optional 230 226 d.iPopulatedSize = -1; … … 239 235 const xml::ElementNode *pFileElem; 240 236 if ( pReferencesElem 241 && ( (pFileElem = pReferencesElem->findChildElementFromId(pcszFileRef)))237 && (pFileElem = pReferencesElem->findChildElementFromId(pcszFileRef)) != NULL 242 238 ) 243 239 { … … 246 242 const char *pcszBadInFile = NULL; 247 243 const char *pcszHref; 248 if (! (pFileElem->getAttributeValue("href", pcszHref)))244 if (!pFileElem->getAttributeValue("href", pcszHref)) 249 245 pcszBadInFile = "href"; 250 else if (! (pFileElem->getAttributeValue("size", d.iSize)))246 else if (!pFileElem->getAttributeValue("size", d.iSize)) 251 247 d.iSize = -1; // optional 252 248 … … 350 346 if (!strcmp(pcszElemName, "Section")) // OVF 0.9 used "Section" element always with a varying "type" attribute 351 347 { 352 const xml::AttributeNode *pTypeAttr; 353 if ( (pTypeAttr = pelmThis->findAttribute("type")) != NULL 354 || (pTypeAttr = pelmThis->findAttribute("type", "xsi")) != NULL 355 ) 348 const xml::AttributeNode *pTypeAttr = pelmThis->findAttribute("type"); 349 if (!pTypeAttr) 356 350 pcszTypeAttr = pTypeAttr->getValue(); 357 351 else … … 361 355 } 362 356 363 if ( (!strcmp(pcszElemName, "EulaSection"))364 || (!strcmp(pcszTypeAttr, "ovf:EulaSection_Type"))357 if ( !strcmp(pcszElemName, "EulaSection") 358 || !strcmp(pcszTypeAttr, "ovf:EulaSection_Type") 365 359 ) 366 360 { … … 374 368 vsys.strLicenseText = pelmLicense->getValue(); 375 369 } 376 if ( (!strcmp(pcszElemName, "ProductSection"))377 || (!strcmp(pcszTypeAttr, "ovf:ProductSection_Type"))370 if ( !strcmp(pcszElemName, "ProductSection") 371 || !strcmp(pcszTypeAttr, "ovf:ProductSection_Type") 378 372 ) 379 373 { … … 402 396 vsys.strVendorUrl = pelmVendorUrl->getValue(); 403 397 } 404 else if ( (!strcmp(pcszElemName, "VirtualHardwareSection"))405 || (!strcmp(pcszTypeAttr, "ovf:VirtualHardwareSection_Type"))398 else if ( !strcmp(pcszElemName, "VirtualHardwareSection") 399 || !strcmp(pcszTypeAttr, "ovf:VirtualHardwareSection_Type") 406 400 ) 407 401 { … … 526 520 527 521 case ResourceType_Memory: // 4 528 if ( (i.strAllocationUnits == "MegaBytes")// found in OVF created by OVF toolkit529 || (i.strAllocationUnits == "MB")// found in MS docs530 || (i.strAllocationUnits == "byte * 2^20")// suggested by OVF spec DSP0243 page 21522 if ( i.strAllocationUnits == "MegaBytes" // found in OVF created by OVF toolkit 523 || i.strAllocationUnits == "MB" // found in MS docs 524 || i.strAllocationUnits == "byte * 2^20" // suggested by OVF spec DSP0243 page 21 531 525 ) 532 526 vsys.ullMemorySize = i.ullVirtualQuantity * _1M; … … 797 791 } 798 792 } 799 else if ( (!strcmp(pcszElemName, "OperatingSystemSection"))800 || (!strcmp(pcszTypeAttr, "ovf:OperatingSystemSection_Type"))793 else if ( !strcmp(pcszElemName, "OperatingSystemSection") 794 || !strcmp(pcszTypeAttr, "ovf:OperatingSystemSection_Type") 801 795 ) 802 796 { … … 908 902 } 909 903 910 void VirtualHardwareItem::_checkConsistencyAndCompliance() throw(OVFLogicError)904 void VirtualHardwareItem::_checkConsistencyAndCompliance() RT_THROW(OVFLogicError) 911 905 { 912 906 RTCString name = getItemName(); … … 987 981 988 982 989 void StorageItem::_checkConsistencyAndCompliance() throw(OVFLogicError)983 void StorageItem::_checkConsistencyAndCompliance() RT_THROW(OVFLogicError) 990 984 { 991 985 VirtualHardwareItem::_checkConsistencyAndCompliance(); … … 1044 1038 } 1045 1039 1046 void EthernetPortItem::_checkConsistencyAndCompliance() throw(OVFLogicError)1040 void EthernetPortItem::_checkConsistencyAndCompliance() RT_THROW(OVFLogicError) 1047 1041 { 1048 1042 VirtualHardwareItem::_checkConsistencyAndCompliance();
Note:
See TracChangeset
for help on using the changeset viewer.