some notes on SwClient and SwModify

Miklos Vajna vmiklos at collabora.co.uk
Mon Mar 23 01:54:45 PDT 2015


Hi Bjoern,

First -- thanks for the summary, I got only part of this "big picture"
from your commit messages. :)

One part of your changes is that now SwModify::GetDepends() returns a
const sw::WriterListener*, while it returned a const SwClient* in the
past. We had code that casted away the const-ness using a C style cast:

while( 0 != ( pDep = (SwClient*)aCallMod.GetDepends()) )

(sw/source/core/doc/docfmt.cxx:657)

I'm not sure why loplugin:cstylecast did not catch these earlier, but
now it does:

/home/vmiklos/git/libreoffice/master-clang/sw/source/core/doc/docfmt.cxx:657:26: error: c-style cast, type=5, from='const sw::WriterListener *', to='SwClient *', recommendedFix=static_cast [loplugin:cstylecast]
    while( 0 != ( pDep = (SwClient*)aCallMod.GetDepends()) )
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Additional problem is that SwClient now inherits privately from
::sw::WriterListener, so not even a static_cast + const_cast will make
the compiler happy.

Could do const_cast + reinterpret_cast, but it doesn't sound like the
right fix. What is the correct fix here? ;-)

Thanks,

Miklos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20150323/01bb274e/attachment.sig>


More information about the LibreOffice mailing list