Date: prev next · Thread: first prev next last
2014 Archives by date, by thread · List index


Hi Caolan,

I just happened to read your Libreoffice commits while browsing the
git repository.  For example:

             if ( pFmt->Which() == RES_FLYFRMFMT )
             {
-                GetDoc()->SetFlyFrmTitle( *(dynamic_cast<SwFlyFrmFmt*>(pFmt)),
+                GetDoc()->SetFlyFrmTitle( dynamic_cast<SwFlyFrmFmt&>(*pFmt),
                                           rTitle );

This, however, is still wrong.  It just hides the warning.

We know already at this point that pFmt is not NULL.  But what we
don't know is whether pFmt is a SwFlyFrmFmt instance.  dynamic_cast
can return NULL even if its parameter is not NULL.

So, you have checked that its type is RES_FLYFRMFMT, and thus it must
be a SwFlyFrmFmt instance.  Ok, but then you don't need the overhead
of dynamic_cast.  A static_cast will do the same, with less runtime
overhead.

In any case, your changes do not actually address the Coverity
warnings; they merely hide them.

Max

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.