rfc: refactoring msxml3 to get rid of aggregation

Michael Karcher wine at mkarcher.dialup.fu-berlin.de
Thu Oct 30 19:12:54 CDT 2008


Hello developers,

the msxml3 code currently uses aggregation to implement IXMLDOMNode on
all of the different DOM tree elements. As the interfaces for these
elements are all derived from IXMLDOMNode, a lot of forwarding thunks
have to be implemented to get the calls into the inner object. The
attached patch series modifies the source code to derive the objects
instead, which seems like the more natural approach to get derived
interfaces implemented.

The attached patches still have to be cleaned up: They contain lines
ending with whitespace, incosistent spacing around function call
parenthesis, incosistent style of using a cast helper function or direct
casting and other small nits.

A more important problem with these patches that make me write this mail
is that they generate lots of compiler warnings like
| domdoc.c:1556: warning: initialization from incompatible pointer type
which is of no surprise, as the vtable for domdoc expects a function
taking an IXMLDOMDocument as "this" pointer while I provide a function
taking an interface pointer to an IXMLDOMNode as "this" pointer. Both of
these pointers point to the same address (as usual for derived objects),
so the conversion is safe, but the simple-minded C compiler can't know
that.

The question that arises is how to handle these warnings.
 a) ignore them (most probably not an option)
 b) add lots of casts (only way to make the idea of these patches fly)
 c) write lots of little forwarding functions that convert the this
     pointer.
 d) ditch the idea of using derivation instead of aggregation

Any oppions on that? I (obviously) think that b is the right solution,
but as a quick grep over the Wine source code revealed, this solution
seems to be used nowhere. Is that because this is the first place where
deriving makes sense or is that because I'm completely off-track?

Kind regards,
  Michael Karcher

PS: The munged "From " lines in the attached patches are intentional.
They keep my email program from choosing "application/mbox" as MIME
type.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-msxml3-declare-IXMLDOMNode-functions-non-static-for.diff
Type: text/x-patch
Size: 14213 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20081031/b8003f6c/attachment-0017.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-msxml3-Add-a-non-allocating-constructor-to-node.diff
Type: text/x-patch
Size: 2152 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20081031/b8003f6c/attachment-0018.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-msxml3-Derive-element-from-node-instead-of-aggregat.diff
Type: text/x-patch
Size: 18697 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20081031/b8003f6c/attachment-0019.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-msxml3-Derive-text-from-node-instead-of-aggregation.diff
Type: text/x-patch
Size: 19283 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20081031/b8003f6c/attachment-0020.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-msxml3-Derive-comment-from-node-instead-of-aggregat.diff
Type: text/x-patch
Size: 20004 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20081031/b8003f6c/attachment-0021.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0007-msxml3-Derive-docfrag-from-node-instead-of-aggregat.diff
Type: text/x-patch
Size: 16249 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20081031/b8003f6c/attachment-0022.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0008-msxml3-Derive-dom_pi-from-node-instead-of-aggregati.diff
Type: text/x-patch
Size: 18981 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20081031/b8003f6c/attachment-0023.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0009-msxml3-Derive-attribute-from-node-instead-of-aggreg.diff
Type: text/x-patch
Size: 16258 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20081031/b8003f6c/attachment-0024.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0010-msxml3-Derive-domcdata-from-node-instead-of-aggrega.diff
Type: text/x-patch
Size: 20393 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20081031/b8003f6c/attachment-0025.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0011-msxml3-Derive-entityref-from-node-instead-of-aggreg.diff
Type: text/x-patch
Size: 16553 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20081031/b8003f6c/attachment-0026.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0012-msxml3-Derive-domdoc-from-node-instead-of-aggregati.diff
Type: text/x-patch
Size: 19688 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20081031/b8003f6c/attachment-0027.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0013-msxml3-Remove-element-aggregation-support.diff
Type: text/x-patch
Size: 5515 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20081031/b8003f6c/attachment-0028.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0014-msxml3-Remove-node-aggregation-support.diff
Type: text/x-patch
Size: 10217 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20081031/b8003f6c/attachment-0029.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0015-msxml3-Derive-domcdata-from-domtext-to-avoid-code-d.diff
Type: text/x-patch
Size: 10251 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20081031/b8003f6c/attachment-0030.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0016-msxml3-domcdata-should-implement-IXMLDOMText.diff
Type: text/x-patch
Size: 2118 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20081031/b8003f6c/attachment-0031.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0017-msxml3-factor-out-implementation-of-IXMLDOMCharacte.diff
Type: text/x-patch
Size: 16158 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20081031/b8003f6c/attachment-0032.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0018-msxml3-Make-comment-use-the-generic-cdata-functions.diff
Type: text/x-patch
Size: 7940 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20081031/b8003f6c/attachment-0033.bin 


More information about the wine-devel mailing list