Changeset 19519 in vbox for trunk/src/VBox
- Timestamp:
- May 8, 2009 12:38:07 PM (16 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ApplianceImpl.cpp
r19310 r19519 600 600 DiskImage d; 601 601 const char *pcszBad = NULL; 602 if (!(pelmDisk->getAttributeValue("diskId", d.strDiskId))) 602 const char *pcszDiskId; 603 const char *pcszFormat; 604 if (!(pelmDisk->getAttributeValue("diskId", pcszDiskId))) 603 605 pcszBad = "diskId"; 604 else if (!(pelmDisk->getAttributeValue("format", d.strFormat)))606 else if (!(pelmDisk->getAttributeValue("format", pcszFormat))) 605 607 pcszBad = "format"; 606 608 else if (!(pelmDisk->getAttributeValue("capacity", d.iCapacity))) … … 608 610 else 609 611 { 612 d.strDiskId = pcszDiskId; 613 d.strFormat = pcszFormat; 614 610 615 if (!(pelmDisk->getAttributeValue("populatedSize", d.iPopulatedSize))) 611 616 // optional 612 617 d.iPopulatedSize = -1; 613 618 614 Utf8Str strFileRef;615 if (pelmDisk->getAttributeValue("fileRef", strFileRef)) // optional619 const char *pcszFileRef; 620 if (pelmDisk->getAttributeValue("fileRef", pcszFileRef)) // optional 616 621 { 617 622 // look up corresponding /References/File nodes (list built above) 618 623 const xml::ElementNode *pFileElem; 619 624 if ( pReferencesElem 620 && ((pFileElem = pReferencesElem->findChildElementFromId( strFileRef.c_str())))625 && ((pFileElem = pReferencesElem->findChildElementFromId(pcszFileRef))) 621 626 ) 622 627 { 623 628 // copy remaining values from file node then 624 629 const char *pcszBadInFile = NULL; 625 if (!(pFileElem->getAttributeValue("href", d.strHref))) 630 const char *pcszHref; 631 if (!(pFileElem->getAttributeValue("href", pcszHref))) 626 632 pcszBadInFile = "href"; 627 633 else if (!(pFileElem->getAttributeValue("size", d.iSize))) 628 634 d.iSize = -1; // optional 635 636 d.strHref = pcszHref; 637 629 638 // if (!(pFileElem->getAttributeValue("size", d.iChunkSize))) TODO 630 639 d.iChunkSize = -1; // optional 631 pFileElem->getAttributeValue("compression", d.strCompression); 640 const char *pcszCompression; 641 if (pFileElem->getAttributeValue("compression", pcszCompression)) 642 d.strCompression = pcszCompression; 632 643 633 644 if (pcszBadInFile) … … 642 653 tr("Error reading \"%s\": cannot find References/File element for ID '%s' referenced by 'Disk' element, line %d"), 643 654 pcszPath, 644 strFileRef.c_str(),655 pcszFileRef, 645 656 pelmDisk->getLineNumber()); 646 657 } … … 2322 2333 rc = dstHdVBox->COMGETTER(Id)(hdId.asOutParam()); 2323 2334 if (FAILED(rc)) throw rc; 2324 2335 2325 2336 /* For now we assume we have one controller of every type only */ 2326 2337 HardDiskController hdc = (*vsysThis.mapControllers.find(vd.idController)).second; -
trunk/src/VBox/Main/xml/xml.cpp
r18515 r19519 721 721 * @return TRUE if attribute was found and str was thus updated. 722 722 */ 723 bool ElementNode::getAttributeValue(const char *pcszMatch, co m::Utf8Str &str) const723 bool ElementNode::getAttributeValue(const char *pcszMatch, const char *&ppcsz) const 724 724 { 725 725 const Node* pAttr; 726 726 if ((pAttr = findAttribute(pcszMatch))) 727 727 { 728 str= pAttr->getValue();728 ppcsz = pAttr->getValue(); 729 729 return true; 730 730 } … … 745 745 bool ElementNode::getAttributeValue(const char *pcszMatch, int64_t &i) const 746 746 { 747 co m::Utf8Str str;748 if ( (getAttributeValue(pcszMatch, str))749 && (VINF_SUCCESS == RTStrToInt64Ex( str.c_str(), NULL, 10, &i))747 const char *pcsz; 748 if ( (getAttributeValue(pcszMatch, pcsz)) 749 && (VINF_SUCCESS == RTStrToInt64Ex(pcsz, NULL, 10, &i)) 750 750 ) 751 751 return true; … … 766 766 bool ElementNode::getAttributeValue(const char *pcszMatch, uint64_t &i) const 767 767 { 768 co m::Utf8Str str;769 if ( (getAttributeValue(pcszMatch, str))770 && (VINF_SUCCESS == RTStrToUInt64Ex( str.c_str(), NULL, 10, &i))768 const char *pcsz; 769 if ( (getAttributeValue(pcszMatch, pcsz)) 770 && (VINF_SUCCESS == RTStrToUInt64Ex(pcsz, NULL, 10, &i)) 771 771 ) 772 772 return true;
Note:
See TracChangeset
for help on using the changeset viewer.