VirtualBox

Changeset 85298 in vbox for trunk/src/VBox/Main/idl


Ignore:
Timestamp:
Jul 13, 2020 9:42:28 AM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
139276
Message:

Main/comimpl.xsl: Made the CreateXxxxEvent and ReuseXxxxEvent functions check results from set_Yyyy methods. Use RT_OVERRIDE on interface methods. bugref:9790

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/idl/comimpl.xsl

    r85295 r85298  
    388388          </xsl:call-template>
    389389        </xsl:variable>
    390         <xsl:value-of select="concat('            ',$obj, '->set_', @name, '(ComSafeArrayInArg(a_', @name, '));&#10;')"/>
     390        <xsl:text>        if (SUCCEEDED(hrc))&#10;</xsl:text>
     391        <xsl:value-of select="concat('            hrc = ',$obj, '->set_', @name, '(ComSafeArrayInArg(a_', @name, '));&#10;')"/>
    391392      </xsl:when>
    392       <xsl:when test="substring($aType, string-length($aType) - 1) = '_T'"> <!-- To avoid pedantic gcc warnings/errors. -->
    393         <xsl:value-of select="concat('            ',$obj, '->set_', @name, '(',$aName, ');&#10;')"/>
     393      <xsl:when test="(@type='wstring') or (@type = 'uuid')">
     394        <xsl:text>        if (SUCCEEDED(hrc))&#10;</xsl:text>
     395        <xsl:value-of select="concat('            hrc = ',$obj, '->set_', @name, '(',$aName, ');&#10;')"/>
    394396      </xsl:when>
    395397      <xsl:otherwise>
    396         <xsl:value-of select="concat('            ',$obj, '->set_', @name, '(',$aName, ');&#10;')"/>
     398        <xsl:value-of select="concat('        ',$obj, '->set_', @name, '(',$aName, ');&#10;')"/>
    397399      </xsl:otherwise>
    398400    </xsl:choose>
     
    488490    <xsl:value-of select="concat('    ', $mType, '    ', $mName,';&#10;')" />
    489491    <xsl:value-of select="       'public:&#10;'" />
    490     <xsl:value-of select="concat('    STDMETHOD(COMGETTER(', $capsName,'))(',$pTypeNameOut,')&#10;    {&#10;')" />
     492    <xsl:value-of select="concat('    STDMETHOD(COMGETTER(', $capsName,'))(',$pTypeNameOut,') RT_OVERRIDE&#10;    {&#10;')" />
    491493    <xsl:call-template name="genRetParam">
    492494      <xsl:with-param name="type" select="@type" />
     
    499501
    500502    <xsl:if test="not(@readonly='yes')">
    501       <xsl:value-of select="concat('    STDMETHOD(COMSETTER(', $capsName,'))(',$pTypeNameIn,')&#10;    {&#10;')" />
     503      <xsl:value-of select="concat('    STDMETHOD(COMSETTER(', $capsName,'))(',$pTypeNameIn,') RT_OVERRIDE&#10;    {&#10;')" />
    502504      <xsl:call-template name="genSetParam">
    503505        <xsl:with-param name="type" select="@type" />
     
    567569  </xsl:call-template>
    568570  <xsl:value-of select="       '    END_COM_MAP()&#10;'" />
    569   <xsl:value-of select="concat('    ',$implName,'() { /*printf(&quot;',$implName,'\n&quot;)*/;}&#10;')" />
    570   <xsl:value-of select="concat('    virtual ~',$implName,'() { /*printf(&quot;~',$implName,'\n&quot;)*/; uninit(); }&#10;')" />
     571  <xsl:value-of select="concat('    ',$implName,'() { /*Log((&quot;',$implName,'\n&quot;))*/;}&#10;')" />
     572  <xsl:value-of select="concat('    virtual ~',$implName,'() { /*Log((&quot;~',$implName,'\n&quot;))*/; uninit(); }&#10;')" />
    571573  <xsl:text><![CDATA[
    572574    HRESULT FinalConstruct()
     
    580582        BaseFinalRelease();
    581583    }
    582     STDMETHOD(COMGETTER(Type))(VBoxEventType_T *aType)
     584    STDMETHOD(COMGETTER(Type))(VBoxEventType_T *aType) RT_OVERRIDE
    583585    {
    584586        return mEvent->COMGETTER(Type)(aType);
    585587    }
    586     STDMETHOD(COMGETTER(Source))(IEventSource * *aSource)
     588    STDMETHOD(COMGETTER(Source))(IEventSource * *aSource) RT_OVERRIDE
    587589    {
    588590        return mEvent->COMGETTER(Source)(aSource);
    589591    }
    590     STDMETHOD(COMGETTER(Waitable))(BOOL *aWaitable)
     592    STDMETHOD(COMGETTER(Waitable))(BOOL *aWaitable) RT_OVERRIDE
    591593    {
    592594        return mEvent->COMGETTER(Waitable)(aWaitable);
    593595    }
    594     STDMETHOD(SetProcessed)()
     596    STDMETHOD(SetProcessed)() RT_OVERRIDE
    595597    {
    596598       return mEvent->SetProcessed();
    597599    }
    598     STDMETHOD(WaitProcessed)(LONG aTimeout, BOOL *aResult)
     600    STDMETHOD(WaitProcessed)(LONG aTimeout, BOOL *aResult) RT_OVERRIDE
    599601    {
    600602        return mEvent->WaitProcessed(aTimeout, aResult);
     
    617619        return mEvent->init(aSource, aType);
    618620    }
    619     STDMETHOD(AddVeto)(IN_BSTR aVeto)
     621    STDMETHOD(AddVeto)(IN_BSTR aVeto) RT_OVERRIDE
    620622    {
    621623        return mEvent->AddVeto(aVeto);
    622624    }
    623     STDMETHOD(IsVetoed)(BOOL *aResult)
     625    STDMETHOD(IsVetoed)(BOOL *aResult) RT_OVERRIDE
    624626    {
    625627       return mEvent->IsVetoed(aResult);
    626628    }
    627     STDMETHOD(GetVetos)(ComSafeArrayOut(BSTR, aVetos))
     629    STDMETHOD(GetVetos)(ComSafeArrayOut(BSTR, aVetos)) RT_OVERRIDE
    628630    {
    629631       return mEvent->GetVetos(ComSafeArrayOutArg(aVetos));
    630632    }
    631     STDMETHOD(AddApproval)(IN_BSTR aReason)
     633    STDMETHOD(AddApproval)(IN_BSTR aReason) RT_OVERRIDE
    632634    {
    633635        return mEvent->AddApproval(aReason);
    634636    }
    635     STDMETHOD(IsApproved)(BOOL *aResult)
     637    STDMETHOD(IsApproved)(BOOL *aResult) RT_OVERRIDE
    636638    {
    637639       return mEvent->IsApproved(aResult);
    638640    }
    639     STDMETHOD(GetApprovals)(ComSafeArrayOut(BSTR, aReasons))
     641    STDMETHOD(GetApprovals)(ComSafeArrayOut(BSTR, aReasons)) RT_OVERRIDE
    640642    {
    641643       return mEvent->GetApprovals(ComSafeArrayOutArg(aReasons));
     
    653655        return mEvent->init(aSource, aType, aWaitable);
    654656    }
    655     STDMETHOD(COMGETTER(Generation))(ULONG *aGeneration)
     657    STDMETHOD(COMGETTER(Generation))(ULONG *aGeneration) RT_OVERRIDE
    656658    {
    657659        *aGeneration = mGeneration;
    658660        return S_OK;
    659661    }
    660     STDMETHOD(Reuse)()
     662    STDMETHOD(Reuse)() RT_OVERRIDE
    661663    {
    662664        ASMAtomicIncU32((volatile uint32_t *)&mGeneration);
     
    734736    <xsl:text>    {&#10;</xsl:text>
    735737    <xsl:text>        pEvtImpl->Reuse();&#10;</xsl:text>
    736     <xsl:text>        {&#10;</xsl:text>
     738    <xsl:text>        HRESULT hrc = S_OK;&#10;</xsl:text>
    737739    <xsl:call-template name="genAttrInitCode">
    738740      <xsl:with-param name="name" select="@name" />
    739741      <xsl:with-param name="obj" select="'pEvtImpl'" />
    740742    </xsl:call-template>
    741     <xsl:text>        }&#10;</xsl:text>
    742     <xsl:text>        return S_OK;&#10;</xsl:text>
     743    <xsl:text>        return hrc;&#10;</xsl:text>
    743744    <xsl:text>    }&#10;</xsl:text>
    744745    <xsl:text>    return E_INVALIDARG;&#10;</xsl:text>
     
    760761  <xsl:text>        hrc = EvtObj-&gt;init(aSource, VBoxEventType_</xsl:text><xsl:value-of select="$evid"/>
    761762  <xsl:text>, </xsl:text><xsl:value-of select="$waitable" /><xsl:text> /*waitable*/);&#10;</xsl:text>
    762   <xsl:text>        if (SUCCEEDED(hrc))&#10;</xsl:text>
    763   <xsl:text>        {&#10;</xsl:text>
    764763  <xsl:call-template name="genAttrInitCode">
    765764    <xsl:with-param name="name" select="@name" />
    766765    <xsl:with-param name="obj" select="'EvtObj'" />
    767766  </xsl:call-template>
     767  <xsl:text>        if (SUCCEEDED(hrc))&#10;</xsl:text>
     768  <xsl:text>        {&#10;</xsl:text>
    768769  <xsl:text>            hrc = EvtObj.queryInterfaceTo(aEvent);&#10;</xsl:text>
     770  <xsl:text>            if (SUCCEEDED(hrc))&#10;</xsl:text>
     771  <xsl:text>                return hrc;&#10;</xsl:text>
    769772  <xsl:text>        }&#10;</xsl:text>
    770773  <xsl:text>    }&#10;</xsl:text>
     774  <xsl:text>    *aEvent = NULL;&#10;</xsl:text>
    771775  <xsl:text>    return hrc;&#10;</xsl:text>
    772776  <xsl:text>}&#10;</xsl:text>
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