[Libreoffice-commits] .: sw/source

Stephan Bergmann sbergmann at kemper.freedesktop.org
Thu Mar 1 00:33:37 PST 2012


 sw/source/filter/ww8/rtfattributeoutput.cxx |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 2744ad999be969cbcf81eb631a8414ed6584e955
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Mar 1 09:33:21 2012 +0100

    Compare char* with string literal via strcmp
    
    ...as found by Clang and reported by DenverCoder9 on IRC.

diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 875edfb..0dd4f10 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -27,6 +27,10 @@
  *
  ************************************************************************/
 
+#include "sal/config.h"
+
+#include <cstring>
+
 #include "rtfattributeoutput.hxx"
 #include "rtfsdrexport.hxx"
 #include "writerwordglue.hxx"
@@ -3211,7 +3215,7 @@ static OString ExportPICT( const SwFlyFrmFmt* pFlyFrmFmt, const Size &rOrig, con
     unsigned long nSize, const RtfExport& rExport )
 {
     OStringBuffer aRet;
-    bool bIsWMF = (const char *)pBLIPType == (const char *)OOO_STRING_SVTOOLS_RTF_WMETAFILE ? true : false;
+    bool bIsWMF = std::strcmp(pBLIPType, OOO_STRING_SVTOOLS_RTF_WMETAFILE) == 0;
     if (pBLIPType && nSize && pGraphicAry)
     {
         aRet.append("{" OOO_STRING_SVTOOLS_RTF_PICT);
@@ -3431,7 +3435,7 @@ void RtfAttributeOutput::FlyFrameGraphic( const SwFlyFrmFmt* pFlyFrmFmt, const S
        the wmf format wrapped in nonshppict, so as to keep wordpad happy. If its
        a wmf already then we don't need any such wrapping
        */
-    bool bIsWMF = (const sal_Char*)pBLIPType == (const sal_Char*)OOO_STRING_SVTOOLS_RTF_WMETAFILE ? true : false;
+    bool bIsWMF = std::strcmp(pBLIPType, OOO_STRING_SVTOOLS_RTF_WMETAFILE) == 0;
     if (!bIsWMF)
         m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPPICT);
 


More information about the Libreoffice-commits mailing list