VirtualBox

Changeset 42667 in vbox for trunk/src/VBox/Main/webservice


Ignore:
Timestamp:
Aug 7, 2012 3:51:08 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
79865
Message:

Main/webservice: report invalid object reference if a NULL object should be converted to a struct. This is a bit ambiguous, but right now we have no better option. Additionally a bit of dead code removal and stop mislabeling structs as enums.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/webservice/websrv-cpp.xsl

    r42129 r42667  
    245245    <xsl:value-of select="concat('// COM interface ', $structname, ', which has wsmap=&quot;struct&quot;, to SOAP structures')" />
    246246    <xsl:call-template name="emitNewline" />
    247     <xsl:value-of select="concat('vbox__', $structname, '* ', $G_funcPrefixOutputEnumConverter, $structname, '(')" />
     247    <xsl:value-of select="concat('vbox__', $structname, '* ', $G_funcPrefixOutputStructConverter, $structname, '(')" />
    248248    <xsl:call-template name="emitNewline" />
    249249    <xsl:value-of select="'    struct soap *soap,'" />
     
    265265    <xsl:value-of select="concat('        resp = soap_new_vbox__', $structname, '(soap, -1);')" />
    266266    <xsl:call-template name="emitNewline" />
     267    <xsl:text>        if (!in)&#10;</xsl:text>
     268    <xsl:text>        {&#10;</xsl:text>
     269    <xsl:text>            // @todo ambiguous. Problem is the MOR for the object converted to struct&#10;</xsl:text>
     270    <xsl:text>            RaiseSoapInvalidObjectFault(soap, "");&#10;</xsl:text>
     271    <xsl:text>            break;&#10;</xsl:text>
     272    <xsl:text>        }&#10;</xsl:text>
    267273    <xsl:call-template name="emitNewline" />
    268274
     
    630636          <xsl:text>    break</xsl:text>
    631637        </xsl:when>
    632         <xsl:when test="(//interface[@name=$type]) or (//collection[@name=$type])">
     638        <xsl:when test="//interface[@name=$type]">
    633639          <!-- the type is one of our own interfaces: then it must have a wsmap attr -->
    634           <xsl:variable name="thatif" select="(//interface[@name=$type]) | (//collection[@name=$type])" />
     640          <xsl:variable name="thatif" select="//interface[@name=$type]" />
    635641          <xsl:variable name="wsmap" select="$thatif/@wsmap" />
    636642          <xsl:variable name="thatifname" select="$thatif/@name" />
     
    908914          <!-- <xsl:call-template name="fatalError"><xsl:with-param name="msg" select="concat('emitOutputArgBackConverter2: attempted infinite recursion for type &quot;', $type, '&quot; in arg &quot;', $name, '&quot; of method &quot;', $ifname, '::', $method)" /></xsl:call-template> -->
    909915          <xsl:if test="not($callerprefix)">
    910             <xsl:value-of select="concat('/* convert COM interface to struct */ ', $G_funcPrefixOutputEnumConverter, $type, '(soap, idThis, rc, ', $varname, ')')" />
     916            <xsl:value-of select="concat('/* convert COM interface to struct */ ', $G_funcPrefixOutputStructConverter, $type, '(soap, idThis, rc, ', $varname, ')')" />
    911917          </xsl:if>
    912918        </xsl:when>
     
    917923        </xsl:otherwise>
    918924      </xsl:choose>
    919     </xsl:when>
    920     <xsl:when test="//collection[@name=$type]">
    921       <!-- the type is a collection of our own types: then build an array from it -->
    922       <xsl:variable name="collectiontype" select="//collection[@name=$type]/@type" />
    923       <xsl:variable name="targetwsmap" select="//interface[@name=$collectiontype]/@wsmap" />
    924       <xsl:value-of select="concat('soap_new_vbox__ArrayOf', $collectiontype, '(soap, -1);')" />
    925       <xsl:call-template name="emitNewlineIndent8" />
    926       <xsl:variable name="enumerator" select="concat('comcall_', $callerprefix, $name, '_enum')" />
    927       <xsl:value-of select="concat('ComPtr&lt;', $collectiontype, 'Enumerator&gt; ', $enumerator, ';')" />
    928       <xsl:call-template name="emitNewlineIndent8" />
    929       <xsl:value-of select="concat('CHECK_ERROR_BREAK( comcall_', $callerprefix, $name, ', Enumerate(', $enumerator, '.asOutParam()) );')" />
    930       <xsl:call-template name="emitNewlineIndent8" />
    931       <xsl:value-of select="concat('BOOL comcall_', $callerprefix, $name, '_hasmore = FALSE;')" />
    932       <xsl:call-template name="emitNewlineIndent8" />
    933       <xsl:value-of select="'do {'" />
    934       <xsl:call-template name="emitNewlineIndent8" />
    935       <xsl:value-of select="concat('    CHECK_ERROR_BREAK( ', $enumerator, ', HasMore(&amp;comcall_', $callerprefix, $name, '_hasmore) );')" />
    936       <xsl:call-template name="emitNewlineIndent8" />
    937       <xsl:value-of select="concat('    if (!comcall_', $callerprefix, $name, '_hasmore) break;')" />
    938       <xsl:call-template name="emitNewlineIndent8" />
    939       <xsl:value-of select="concat('    ComPtr&lt;', $collectiontype, '&gt; arrayitem;')" />
    940       <xsl:call-template name="emitNewlineIndent8" />
    941       <xsl:value-of select="concat('    CHECK_ERROR_BREAK( ', $enumerator, ', GetNext(arrayitem.asOutParam()) );')" />
    942       <xsl:call-template name="emitNewlineIndent8" />
    943       <xsl:value-of select="concat('    // collection of &quot;', $collectiontype, '&quot;, target interface wsmap: &quot;', $targetwsmap, '&quot;')" />
    944       <xsl:call-template name="emitNewlineIndent8" />
    945       <xsl:value-of select="concat('    ', $G_responseElementVarName, '-&gt;', $G_result)" />
    946       <xsl:value-of select="'->array.push_back('" />
    947       <xsl:choose>
    948         <xsl:when test="($targetwsmap='managed')">
    949           <xsl:value-of select="concat('createOrFindRefFromComPtr(idThis, g_pcsz', $collectiontype, ', arrayitem));')" />
    950         </xsl:when>
    951         <xsl:when test="$targetwsmap='struct'">
    952           <xsl:value-of select="concat($G_funcPrefixOutputEnumConverter, $collectiontype, '(soap, idThis, rc, arrayitem));')" />
    953         </xsl:when>
    954         <xsl:otherwise>
    955           <xsl:call-template name="fatalError">
    956             <xsl:with-param name="msg" select="concat('emitOutputArgBackConverter2: Type &quot;', $collectiontype, '&quot; of collection &quot;', $type, '&quot;, used in method &quot;', $method, '&quot;, has unsupported wsmap &quot;', $targetwsmap, '&quot;.')" />
    957           </xsl:call-template>
    958         </xsl:otherwise>
    959       </xsl:choose>
    960       <xsl:call-template name="emitNewlineIndent8" />
    961       <xsl:value-of select="'} while (1)'" />
    962925    </xsl:when>
    963926    <xsl:otherwise>
  • trunk/src/VBox/Main/webservice/websrv-shared.inc.xsl

    r32728 r42667  
    151151              select='"_USCOREthis"' />
    152152
    153 <!-- type to represent enums with in C++ COM callers -->
     153<!-- type to represent enums within C++ COM callers -->
    154154<xsl:variable name="G_funcPrefixInputEnumConverter"
    155155              select='"EnumSoap2Com_"' />
    156156<xsl:variable name="G_funcPrefixOutputEnumConverter"
    157157              select='"EnumCom2Soap_"' />
     158
     159<!-- type to represent structs within C++ COM callers -->
     160<xsl:variable name="G_funcPrefixOutputStructConverter"
     161              select='"StructCom2Soap_"' />
    158162
    159163<xsl:variable name="G_aSharedTypes">
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