VirtualBox

Changeset 85222 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Jul 11, 2020 4:16:39 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
139199
Message:

Main/ovfreader: Clang 11 complains about a bunch of unused members, so I've #if'ed them out. Also a signedness issue with line numbers. Cleaned up some modernistic/random continuation indentation. bugref:9790

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/ovfreader.h

    r84532 r85222  
    335335    bool fResourceRequired;
    336336
    337     RTCString strHostResource;   // "Abstractly specifies how a device shall connect to a resource on the deployment platform.
    338                                         // Not all devices need a backing." Used with disk items, for which this references a virtual
    339                                         // disk from the Disks section.
     337    RTCString strHostResource;   ///< "Abstractly specifies how a device shall connect to a resource on the deployment platform.
     338                                 /// Not all devices need a backing." Used with disk items, for which this
     339                                 /// references a virtual disk from the Disks section.
    340340    bool fAutomaticAllocation;
    341341    bool fAutomaticDeallocation;
    342     RTCString strConnection;     // "All Ethernet adapters that specify the same abstract network connection name within an OVF
    343                                         // package shall be deployed on the same network. The abstract network connection name shall be
    344                                         // listed in the NetworkSection at the outermost envelope level." We ignore this and only set up
    345                                         // a network adapter depending on the network name.
    346     RTCString strAddress;        // "Device-specific. For an Ethernet adapter, this specifies the MAC address."
    347     int32_t lAddress;                   // strAddress as an integer, if applicable.
    348     RTCString strAddressOnParent;         // "For a device, this specifies its location on the controller."
    349     RTCString strAllocationUnits;         // "Specifies the units of allocation used. For example, “byte * 2^20”."
    350     uint64_t ullVirtualQuantity;        // "Specifies the quantity of resources presented. For example, “256”."
    351     uint64_t ullReservation;            // "Specifies the minimum quantity of resources guaranteed to be available."
    352     uint64_t ullLimit;                  // "Specifies the maximum quantity of resources that will be granted."
    353     uint64_t ullWeight;                 // "Specifies a relative priority for this allocation in relation to other allocations."
     342    RTCString strConnection;     ///< "All Ethernet adapters that specify the same abstract network connection name within an OVF
     343                                 /// package shall be deployed on the same network. The abstract network connection name shall be
     344                                 /// listed in the NetworkSection at the outermost envelope level." We ignore this and only set up
     345                                 /// a network adapter depending on the network name.
     346    RTCString strAddress;        ///< "Device-specific. For an Ethernet adapter, this specifies the MAC address."
     347    int32_t lAddress;            ///< strAddress as an integer, if applicable.
     348    RTCString strAddressOnParent;///< "For a device, this specifies its location on the controller."
     349    RTCString strAllocationUnits;///< "Specifies the units of allocation used. For example, “byte * 2^20”."
     350    uint64_t ullVirtualQuantity; ///< "Specifies the quantity of resources presented. For example, “256”."
     351    uint64_t ullReservation;     ///< "Specifies the minimum quantity of resources guaranteed to be available."
     352    uint64_t ullLimit;           ///< "Specifies the maximum quantity of resources that will be granted."
     353    uint64_t ullWeight;          ///< "Specifies a relative priority for this allocation in relation to other allocations."
    354354
    355355    RTCString strConsumerVisibility;
    356356    RTCString strMappingBehavior;
    357357    RTCString strPoolID;
    358     uint32_t ulBusNumber;               // seen with IDE controllers, but not listed in OVF spec
    359 
    360     uint32_t ulLineNumber;              // line number of <Item> element in XML source; cached for error messages
     358    uint32_t ulBusNumber;        ///< seen with IDE controllers, but not listed in OVF spec
     359
     360    int m_iLineNumber;           ///< line number of \<Item\> element in XML source; cached for error messages
    361361
    362362    VirtualHardwareItem()
    363         : ulInstanceID(0),
    364           fResourceRequired(false),
    365           fAutomaticAllocation(false),
    366           fAutomaticDeallocation(false),
    367           ullVirtualQuantity(0),
    368           ullReservation(0),
    369           ullLimit(0),
    370           ullWeight(0),
    371           ulBusNumber(0),
    372           ulLineNumber(0),
    373           fDefault(false)
     363        : ulInstanceID(0)
     364        , fResourceRequired(false)
     365        , fAutomaticAllocation(false)
     366        , fAutomaticDeallocation(false)
     367        , ullVirtualQuantity(0)
     368        , ullReservation(0)
     369        , ullLimit(0)
     370        , ullWeight(0)
     371        , ulBusNumber(0)
     372        , m_iLineNumber(0)
     373        , fDefault(false)
    374374    {
    375375        itemName = "Item";
    376     };
     376    }
    377377
    378378    virtual ~VirtualHardwareItem() { /* Makes MSC happy. */ }
     
    417417    StorageAccessType_T accessType;
    418418    RTCString strHostExtentName;
     419#if 0 /* unused */
    419420    int16_t hostExtentNameFormat;
    420421    int16_t hostExtentNameNamespace;
    421422    int64_t hostExtentStartingAddress;
     423#endif
    422424    int64_t hostResourceBlockSize;
    423425    int64_t limit;
     
    430432
    431433public:
    432     StorageItem(): VirtualHardwareItem(),
    433         accessType(StorageAccessType_Unknown),
    434         hostExtentNameFormat(-1),
    435         hostExtentNameNamespace(-1),
    436         hostExtentStartingAddress(-1),
    437         hostResourceBlockSize(-1),
    438         limit(-1),
    439         reservation(-1),
    440         virtualQuantity(-1),
    441         virtualResourceBlockSize(-1)
     434    StorageItem()
     435        : VirtualHardwareItem()
     436        , accessType(StorageAccessType_Unknown)
     437#if 0 /* unused */
     438        , hostExtentNameFormat(-1)
     439        , hostExtentNameNamespace(-1)
     440        , hostExtentStartingAddress(-1)
     441#endif
     442        , hostResourceBlockSize(-1)
     443        , limit(-1)
     444        , reservation(-1)
     445        , virtualQuantity(-1)
     446        , virtualResourceBlockSize(-1)
    442447    {
    443448        itemName = "StorageItem";
     
    461466{
    462467    //see DMTF Schema Documentation http://schemas.dmtf.org/wbem/cim-html/2/
     468#if 0 /* unused */
    463469    uint16_t DefaultPortVID;
    464470    uint16_t DefaultPriority;
     
    466472    uint32_t GroupID;
    467473    uint32_t ManagerID;
     474    uint16_t NetworkPortProfileIDType;
     475#endif
    468476    RTCString strNetworkPortProfileID;
    469     uint16_t NetworkPortProfileIDType;
    470477    RTCString strOtherEndpointMode;
    471478    RTCString strOtherNetworkPortProfileIDTypeInfo;
    472479    RTCString strPortCorrelationID;
     480#if 0 /* unused */
    473481    uint16_t PortVID;
    474482    bool Promiscuous;
     
    479487    uint8_t VSITypeIDVersion;
    480488    uint16_t AllowedPriorities[256];
     489    uint16_t AllowedToReceiveVLANs[256];
     490    uint16_t AllowedToTransmitVLANs[256];
     491#endif
    481492    RTCString strAllowedToReceiveMACAddresses;
    482     uint16_t AllowedToReceiveVLANs[256];
    483493    RTCString strAllowedToTransmitMACAddresses;
    484     uint16_t AllowedToTransmitVLANs[256];
    485494
    486495public:
    487     EthernetPortItem(): VirtualHardwareItem()
     496    EthernetPortItem() : VirtualHardwareItem()
    488497    {
    489498        itemName = "EthernetPortItem";
  • trunk/src/VBox/Main/xml/ovfreader.cpp

    r84532 r85222  
    447447                        continue;
    448448                    vsys.vecHardwareItems.push_back(pItem);
    449                     pItem->ulLineNumber = pelmItem->getLineNumber();
     449                    pItem->m_iLineNumber = pelmItem->getLineNumber();
    450450                    pItem->fillItem(pelmItem);
    451451
     
    469469                        else
    470470#if 1
    471                             LogRel(("OVFREADER: Warning reading '%s'! Duplicate ulInstanceID %u on line %u, previous at %u!\n",
    472                                     m_strPath.c_str(), pItem->ulInstanceID, pItem->ulLineNumber, itDup->second->ulLineNumber));
     471                            LogRel(("OVFREADER: Warning reading '%s'! Duplicate ulInstanceID %u on line %d, previous at %d!\n",
     472                                    m_strPath.c_str(), pItem->ulInstanceID, pItem->m_iLineNumber, itDup->second->m_iLineNumber));
    473473#else
    474                             throw OVFLogicError(N_("Error reading '%s': Duplicate ulInstanceID %u on line %u, previous at %u"),
     474                            throw OVFLogicError(N_("Error reading '%s': Duplicate ulInstanceID %u on line %d, previous at %d"),
    475475                                                m_strPath.c_str(), pItem->ulInstanceID,
    476                                                 pItem->ulLineNumber, itDup->second->ulLineNumber);
     476                                                pItem->m_iLineNumber, itDup->second->m_iLineNumber);
    477477#endif
    478478                    }
     
    507507                                                i.ullVirtualQuantity,
    508508                                                UINT16_MAX,
    509                                                 i.ulLineNumber);
     509                                                i.m_iLineNumber);
    510510                        break;
    511511
     
    520520                                                m_strPath.c_str(),
    521521                                                i.strAllocationUnits.c_str(),
    522                                                 i.ulLineNumber);
     522                                                i.m_iLineNumber);
    523523                        break;
    524524
     
    675675                                                m_strPath.c_str(),
    676676                                                ResourceType_OtherStorageDevice,
    677                                                 i.ulLineNumber, i.strResourceSubType.c_str() );
     677                                                i.m_iLineNumber, i.strResourceSubType.c_str() );
    678678                        break;
    679679                    }
     
    712712                                                m_strPath.c_str(),
    713713                                                i.resourceType,
    714                                                 i.ulLineNumber);
     714                                                i.m_iLineNumber);
    715715                        }
    716716                    }
     
    757757                                                i.ulInstanceID,
    758758                                                i.ulParent,
    759                                                 i.ulLineNumber);
     759                                                i.m_iLineNumber);
    760760
    761761                        VirtualDisk vd;
     
    778778                                              i.ulInstanceID,
    779779                                              i.strHostResource.c_str(),
    780                                               i.ulLineNumber);
     780                                              i.m_iLineNumber);
    781781
    782782                        vsys.mapVirtualDisks[vd.strDiskId] = vd;
     
    891891//          throw OVFLogicError(N_("Unknown element \"%s\" under Item element, line %d"),
    892892//                              pcszItemChildName,
    893 //                              ulLineNumber);
     893//                              m_iLineNumber);
    894894    }
    895895}
     
    900900    if (resourceType == 0)
    901901        throw OVFLogicError(N_("Empty element ResourceType under %s element, line %d. see DMTF Schema Documentation %s"),
    902                             name.c_str(), ulLineNumber, DTMF_SPECS_URI);
     902                            name.c_str(), m_iLineNumber, DTMF_SPECS_URI);
    903903
    904904    /* Don't be too uptight about the ulInstanceID value.  There are OVAs out
     
    913913            || resourceType == ResourceType_IBHCA )  //??
    914914            throw OVFLogicError(N_("Element InstanceID is absent under %s element, line %d. see DMTF Schema Documentation %s"),
    915                                 name.c_str(), ulLineNumber, DTMF_SPECS_URI);
     915                                name.c_str(), m_iLineNumber, DTMF_SPECS_URI);
    916916        else
    917917            LogRel(("OVFREADER: Warning: Ignoring missing or invalid ulInstanceID under element %s, line %u\n",
    918                     name.c_str(), ulLineNumber));
     918                    name.c_str(), m_iLineNumber));
    919919    }
    920920}
     
    995995    {
    996996        //throw OVFLogicError(N_("Access type is unknown under %s element, line %d"),
    997         //        name.c_str(), ulLineNumber);
     997        //                    name.c_str(), m_iLineNumber);
    998998    }
    999999
     
    10021002        throw OVFLogicError(N_("Element HostResourceBlockSize is absent under %s element, line %d. "
    10031003                               "see DMTF Schema Documentation %s"),
    1004                 name.c_str(), ulLineNumber, DTMF_SPECS_URI);
     1004                            name.c_str(), m_iLineNumber, DTMF_SPECS_URI);
    10051005    }
    10061006
     
    10091009        throw OVFLogicError(N_("Element VirtualResourceBlockSize is absent under %s element, line %d. "
    10101010                               "see DMTF Schema Documentation %s"),
    1011                 name.c_str(), ulLineNumber, DTMF_SPECS_URI);
     1011                            name.c_str(), m_iLineNumber, DTMF_SPECS_URI);
    10121012    }
    10131013
     
    10161016        throw OVFLogicError(N_("Element VirtualQuantityUnits is absent under %s element, line %d. "
    10171017                               "see DMTF Schema Documentation %s"),
    1018                 name.c_str(), ulLineNumber, DTMF_SPECS_URI);
     1018                            name.c_str(), m_iLineNumber, DTMF_SPECS_URI);
    10191019    }
    10201020
     
    10281028                               "It's needed to change on \"byte\". "
    10291029                               "see DMTF Schema Documentation %s"),
    1030                                 name.c_str(), ulLineNumber, DTMF_SPECS_URI);
     1030                            name.c_str(), m_iLineNumber, DTMF_SPECS_URI);
    10311031    }
    10321032}
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