[Libreoffice-commits] core.git: 6 commits - bridges/source filter/source idlc/source javaunohelper/source oox/source sw/source

Caolán McNamara caolanm at redhat.com
Mon Dec 15 04:31:19 PST 2014


 bridges/source/cpp_uno/shared/vtablefactory.cxx |    1 
 filter/source/svg/svgexport.cxx                 |    1 
 idlc/source/idlccompile.cxx                     |    1 
 javaunohelper/source/preload.cxx                |   16 +++++--------
 oox/source/drawingml/table/tableproperties.cxx  |    6 ----
 sw/source/filter/ww8/ww8glsy.cxx                |    2 -
 sw/source/filter/ww8/ww8par.cxx                 |    6 ++--
 sw/source/filter/ww8/ww8par2.cxx                |    2 -
 sw/source/filter/ww8/ww8par5.cxx                |    2 -
 sw/source/filter/ww8/ww8scan.cxx                |   29 +++++++++++++++---------
 sw/source/filter/ww8/ww8scan.hxx                |    2 -
 11 files changed, 37 insertions(+), 31 deletions(-)

New commits:
commit c96e8a174f915e46b0f0814271e53938d8f07373
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Dec 15 12:17:06 2014 +0000

    Resolves: fdo#87248 assume 0 chse means use encoding that matches lid
    
    Change-Id: I813cc6bdc92b03bdfdd5202a85e958020a9c52c8

diff --git a/sw/source/filter/ww8/ww8glsy.cxx b/sw/source/filter/ww8/ww8glsy.cxx
index 2836518..cb60ebf 100644
--- a/sw/source/filter/ww8/ww8glsy.cxx
+++ b/sw/source/filter/ww8/ww8glsy.cxx
@@ -197,7 +197,7 @@ bool WW8Glossary::Load( SwTextBlocks &rBlocks, bool bSaveRelFile )
         std::vector<ww::bytes> aData;
 
         rtl_TextEncoding eStructCharSet =
-            WW8Fib::GetFIBCharset(pGlossary->chseTables);
+            WW8Fib::GetFIBCharset(pGlossary->chseTables, pGlossary->lid);
 
         WW8ReadSTTBF(true, *xTableStream, pGlossary->fcSttbfglsy,
             pGlossary->lcbSttbfglsy, 0, eStructCharSet, aStrings, &aData );
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 4d24c0a..94962bc 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -5001,8 +5001,8 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
     bVer67 = bVer6 || bVer7;
     bVer8  = (8 == pWwFib->nVersion);
 
-    eTextCharSet = WW8Fib::GetFIBCharset(pWwFib->chse);
-    eStructCharSet = WW8Fib::GetFIBCharset(pWwFib->chseTables);
+    eTextCharSet = WW8Fib::GetFIBCharset(pWwFib->chse, pWwFib->lid);
+    eStructCharSet = WW8Fib::GetFIBCharset(pWwFib->chseTables, pWwFib->lid);
 
     bWWBugNormal = pWwFib->nProduct == 0xc03d;
 
@@ -5568,7 +5568,7 @@ namespace
             OUString sUniPassword = QueryPasswordForMedium( rMedium );
 
             OString sPassword(OUStringToOString(sUniPassword,
-                WW8Fib::GetFIBCharset(pWwFib->chseTables)));
+                WW8Fib::GetFIBCharset(pWwFib->chseTables, pWwFib->lid)));
 
             sal_Int32 nLen = sPassword.getLength();
             if( nLen <= 15 )
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index bbea4c0..4929642 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -4216,7 +4216,7 @@ void WW8RStyle::ImportOldFormatStyles()
     }
 
     rtl_TextEncoding eStructChrSet = WW8Fib::GetFIBCharset(
-        pIo->pWwFib->chseTables);
+        pIo->pWwFib->chseTables, pIo->pWwFib->lid);
 
     sal_uInt16 cstcStd(0);
     rSt.ReadUInt16( cstcStd );
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index f5b71fb..dbc1de5 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -3984,7 +3984,7 @@ WW8PLCFx_Book::WW8PLCFx_Book(SvStream* pTblSt, const WW8Fib& rFib)
 
         pBook[1] = new WW8PLCFspecial(pTblSt,rFib.fcPlcfbkl,rFib.lcbPlcfbkl,0);
 
-        rtl_TextEncoding eStructChrSet = WW8Fib::GetFIBCharset(rFib.chseTables);
+        rtl_TextEncoding eStructChrSet = WW8Fib::GetFIBCharset(rFib.chseTables, rFib.lid);
 
         WW8ReadSTTBF( (7 < rFib.nVersion), *pTblSt, rFib.fcSttbfbkmk,
             rFib.lcbSttbfbkmk, 0, eStructChrSet, aBookNames );
@@ -5944,14 +5944,23 @@ bool WW8Fib::Write(SvStream& rStrm)
     return 0 == rStrm.GetError();
 }
 
-rtl_TextEncoding WW8Fib::GetFIBCharset(sal_uInt16 chs)
+rtl_TextEncoding WW8Fib::GetFIBCharset(sal_uInt16 chs, sal_uInt16 nLidLocale)
 {
     OSL_ENSURE(chs <= 0x100, "overflowed winword charset set");
-    rtl_TextEncoding eCharSet =
-        (0x0100 == chs)
-        ? RTL_TEXTENCODING_APPLE_ROMAN
-        : rtl_getTextEncodingFromWindowsCharset( static_cast<sal_uInt8>(chs) );
-    return eCharSet;
+    if (chs == 0x0100)
+        return RTL_TEXTENCODING_APPLE_ROMAN;
+    if (chs == 0 && nLidLocale != 0 && nLidLocale >= 999)
+    {
+        /*
+         nLidLocale:
+            language stamp -- localized version In pre-WinWord 2.0 files this
+            value was the nLocale. If value is < 999, then it is the nLocale,
+            otherwise it is the lid.
+        */
+        ::com::sun::star::lang::Locale aLocale(LanguageTag::convertToLocale(nLidLocale));
+        return msfilter::util::getBestTextEncodingFromLocale(aLocale);
+    }
+    return rtl_getTextEncodingFromWindowsCharset(static_cast<sal_uInt8>(chs));
 }
 
 WW8Style::WW8Style(SvStream& rStream, WW8Fib& rFibPara)
@@ -6334,7 +6343,7 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib& rFib )
                  the font, e.g load the doc in 97 and save to see the unicode
                  ver of the asian fontnames in that example to confirm.
                 */
-                rtl_TextEncoding eEnc = WW8Fib::GetFIBCharset(p->chs);
+                rtl_TextEncoding eEnc = WW8Fib::GetFIBCharset(p->chs, rFib.lid);
                 if ((eEnc == RTL_TEXTENCODING_SYMBOL) || (eEnc == RTL_TEXTENCODING_DONTKNOW))
                     eEnc = RTL_TEXTENCODING_MS_1252;
 
@@ -6364,7 +6373,7 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib& rFib )
                  the font, e.g load the doc in 97 and save to see the unicode
                  ver of the asian fontnames in that example to confirm.
                  */
-                rtl_TextEncoding eEnc = WW8Fib::GetFIBCharset(p->chs);
+                rtl_TextEncoding eEnc = WW8Fib::GetFIBCharset(p->chs, rFib.lid);
                 if ((eEnc == RTL_TEXTENCODING_SYMBOL) || (eEnc == RTL_TEXTENCODING_DONTKNOW))
                     eEnc = RTL_TEXTENCODING_MS_1252;
                 p->sFontname = OUString(pVer6->szFfn, rtl_str_getLength(pVer6->szFfn), eEnc);
@@ -6378,7 +6387,7 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib& rFib )
                 {
                     //#i18369# if it's a symbol font set Symbol as fallback
                     if (
-                         RTL_TEXTENCODING_SYMBOL == WW8Fib::GetFIBCharset(p->chs)
+                         RTL_TEXTENCODING_SYMBOL == WW8Fib::GetFIBCharset(p->chs, rFib.lid)
                          && p->sFontname!="Symbol"
                        )
                     {
diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx
index 2dec722..dd3638b 100644
--- a/sw/source/filter/ww8/ww8scan.hxx
+++ b/sw/source/filter/ww8/ww8scan.hxx
@@ -1433,7 +1433,7 @@ public:
     WW8Fib( sal_uInt8 nVersion = 6, bool bDot = false );
     bool WriteHeader(SvStream& rStrm);
     bool Write(SvStream& rStrm);
-    static rtl_TextEncoding GetFIBCharset(sal_uInt16 chs);
+    static rtl_TextEncoding GetFIBCharset(sal_uInt16 chs, sal_uInt16 nLidLocale);
     ww::WordVersion GetFIBVersion() const;
     WW8_CP GetBaseCp(ManTypes nType) const;
     sal_Unicode getNumDecimalSep() const { return nNumDecimalSep;}
commit dc46c9266afa239281fd4c624be6be5700582fb6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Dec 15 09:52:22 2014 +0000

    coverity#1078451 Unchecked return value
    
    Change-Id: I286df7dc70e7f8e6e911f02d2e8aa6ebb390ef61

diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index a94b503..2d85b8e 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -1417,7 +1417,7 @@ eF_ResT SwWW8ImplReader::Read_F_DocInfo( WW8FieldDesc* pF, OUString& rStr )
                     break;
                 case '*':
                     //Skip over MERGEFORMAT
-                    aReadParam.SkipToNextToken();
+                    (void)aReadParam.SkipToNextToken();
                     break;
             }
         }
commit 1ee1d0992439177f206faf0748ebf5d75fd582f5
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Dec 15 09:51:46 2014 +0000

    no point checking for null before delete
    
    Change-Id: I58cbb075a56518d71874137180ad92ae764ec4bf

diff --git a/oox/source/drawingml/table/tableproperties.cxx b/oox/source/drawingml/table/tableproperties.cxx
index 85d758a..4de51ee 100644
--- a/oox/source/drawingml/table/tableproperties.cxx
+++ b/oox/source/drawingml/table/tableproperties.cxx
@@ -296,11 +296,7 @@ void TableProperties::pushToPropSet( const ::oox::core::XmlFilterBase& rFilterBa
     if(mbOwnTblStyle)
     {
         TableStyle* pTableStyle = (TableStyle*)&rTableStyle;
-        if(pTableStyle != NULL)
-        {
-            delete pTableStyle;
-            pTableStyle = NULL;
-        }
+        delete pTableStyle;
         mbOwnTblStyle = false;
     }
 }
commit 3ec0a2f69e6fd5e870cdf7185e667deac67e036f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Dec 15 09:46:03 2014 +0000

    document coverity#735433 Logically dead code
    
    Change-Id: I4a6917c78b527245ff1ae78c180aaf3a4a198045

diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index f08f9a4..678aa44 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -2262,6 +2262,7 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo )
                                         sDate += SvxDateField::GetFormatted( aDate, eDateFormat, *pNumberFormatter, eLang );
                                     }
                                     break;
+                                // coverity[dead_error_begin] - following conditions exist to avoid compiler warning
                                 case SVXDATEFORMAT_STDSMALL:
                                 case SVXDATEFORMAT_A:       // 13.02.96
                                 case SVXDATEFORMAT_B:       // 13.02.1996
commit 35f75566501d4c2455b393e04d25da11c67495ee
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Dec 15 09:41:36 2014 +0000

    add link to mkstemp coverity warning wrt threading fiasco
    
    Change-Id: Ic8fea32a163ca5e85ac3e2a34d04e4fa1a1943f9

diff --git a/bridges/source/cpp_uno/shared/vtablefactory.cxx b/bridges/source/cpp_uno/shared/vtablefactory.cxx
index 865dd66..2e2d74c 100644
--- a/bridges/source/cpp_uno/shared/vtablefactory.cxx
+++ b/bridges/source/cpp_uno/shared/vtablefactory.cxx
@@ -247,6 +247,7 @@ bool VtableFactory::createBlock(Block &block, sal_Int32 slotCount) const
         OString aTmpName = OUStringToOString(strDirectory, osl_getThreadTextEncoding());
         char *tmpfname = new char[aTmpName.getLength()+1];
         strncpy(tmpfname, aTmpName.getStr(), aTmpName.getLength()+1);
+        // coverity[secure_temp] - https://communities.coverity.com/thread/3179
         if ((block.fd = mkstemp(tmpfname)) == -1)
             fprintf(stderr, "mkstemp(\"%s\") failed: %s\n", tmpfname, strerror(errno));
         if (block.fd == -1)
diff --git a/idlc/source/idlccompile.cxx b/idlc/source/idlccompile.cxx
index 695db41..45dbfbc 100644
--- a/idlc/source/idlccompile.cxx
+++ b/idlc/source/idlccompile.cxx
@@ -153,6 +153,7 @@ OString makeTempName(const OString& prefix)
     strncat(tmpFilePattern, "XXXXXX", sizeof(tmpFilePattern)-1-strlen(tmpFilePattern));
 
 #ifdef SAL_UNX
+    // coverity[secure_temp] - https://communities.coverity.com/thread/3179
     int nDescriptor = mkstemp(tmpFilePattern);
     if( -1 == nDescriptor )
     {
commit 78d35f281c33b9f62a5b7c8d20817ea822e1b0c8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Dec 15 09:38:32 2014 +0000

    silence coverity#705667 Resource leak
    
    still leaks on usual success case of course
    
    Change-Id: Ia6e0f61b5a08271c03690bbb1c0af59081bea663

diff --git a/javaunohelper/source/preload.cxx b/javaunohelper/source/preload.cxx
index 57c980a..a4e9c20 100644
--- a/javaunohelper/source/preload.cxx
+++ b/javaunohelper/source/preload.cxx
@@ -22,7 +22,7 @@
 #include "jni.h"
 
 #include "rtl/ustring.hxx"
-#include "osl/module.h"
+#include "osl/module.hxx"
 
 #include "juhx-export-types.hxx"
 
@@ -51,9 +51,8 @@ static bool inited_juhx( JNIEnv * jni_env )
     if (s_inited)
         return true;
     OUString lib_name = SAL_DLLPREFIX "juhx" SAL_DLLEXTENSION;
-    oslModule hModule =
-        osl_loadModuleRelative( &thisModule, lib_name.pData, SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL );
-    if (0 == hModule)
+    osl::Module aModule;
+    if (!aModule.loadRelative(&thisModule, lib_name, SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL))
     {
         jclass c = jni_env->FindClass( "java/lang/RuntimeException" );
         jni_env->ThrowNew(
@@ -64,16 +63,14 @@ static bool inited_juhx( JNIEnv * jni_env )
     {
         OUString symbol =
               "Java_com_sun_star_comp_helper_SharedLibraryLoader_component_1writeInfo";
-        s_writeInfo = (javaunohelper::detail::Func_writeInfo *)osl_getFunctionSymbol(
-            hModule, symbol.pData );
+        s_writeInfo = (javaunohelper::detail::Func_writeInfo *)aModule.getFunctionSymbol(symbol);
         symbol =
             "Java_com_sun_star_comp_helper_SharedLibraryLoader_component_1getFactory";
-        s_getFactory = (javaunohelper::detail::Func_getFactory *)osl_getFunctionSymbol(
-            hModule, symbol.pData );
+        s_getFactory = (javaunohelper::detail::Func_getFactory *)aModule.getFunctionSymbol(symbol);
         symbol =
             "Java_com_sun_star_comp_helper_Bootstrap_cppuhelper_1bootstrap";
         s_bootstrap =
-            (javaunohelper::detail::Func_bootstrap *)osl_getFunctionSymbol( hModule, symbol.pData );
+            (javaunohelper::detail::Func_bootstrap *)aModule.getFunctionSymbol(symbol);
 
         if (0 == s_writeInfo ||
             0 == s_getFactory ||
@@ -84,6 +81,7 @@ static bool inited_juhx( JNIEnv * jni_env )
                 c, "error resolving symbols of " SAL_DLLPREFIX "juhx" SAL_DLLEXTENSION "!" );
             return false;
         }
+        aModule.release();
     }
     s_inited = true;
     return true;


More information about the Libreoffice-commits mailing list