[Libreoffice-commits] core.git: 2 commits - include/vcl sc/source vcl/unx

Caolán McNamara caolanm at redhat.com
Fri Mar 14 08:59:17 PDT 2014


 include/vcl/ppdparser.hxx             |    3 ++-
 sc/source/filter/html/htmlpars.cxx    |   12 ++++--------
 vcl/unx/generic/printer/ppdparser.cxx |    7 +++----
 3 files changed, 9 insertions(+), 13 deletions(-)

New commits:
commit 79fa84ccb9b45b149843ac88e4d662f2a09e94bf
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 14 15:46:05 2014 +0000

    coverity#705828 Dereference before null check
    
    Change-Id: Ie76ee86f6ae48012c92a3f06ad1372f126f1ea29

diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index e8f69e9..0260292 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -266,10 +266,8 @@ ScHTMLLayoutParser::~ScHTMLLayoutParser()
             delete pS->pLocalColOffset;
         delete pS;
     }
-    if ( pLocalColOffset )
-        delete pLocalColOffset;
-    if ( pColOffset )
-        delete pColOffset;
+    delete pLocalColOffset;
+    delete pColOffset;
     if ( pTables )
     {
         for( OuterMap::const_iterator it = pTables->begin(); it != pTables->end(); ++it)
@@ -1349,8 +1347,7 @@ void ScHTMLLayoutParser::TableOff( ImportInfo* pInfo )
             nColOffsetStart = pS->nColOffsetStart;
             bFirstRow = pS->bFirstRow;
             xLockedList = pS->xLockedList;
-            if ( pLocalColOffset )
-                delete pLocalColOffset;
+            delete pLocalColOffset;
             pLocalColOffset = pS->pLocalColOffset;
             delete pActEntry;
             // pActEntry is kept around if a table is started in the same row
@@ -1370,8 +1367,7 @@ void ScHTMLLayoutParser::TableOff( ImportInfo* pInfo )
         {
             ScHTMLTableStackEntry* pS = aTableStack.top();
             aTableStack.pop();
-            if ( pLocalColOffset )
-                delete pLocalColOffset;
+            delete pLocalColOffset;
             pLocalColOffset = pS->pLocalColOffset;
             delete pS;
         }
commit ab419e3df3f51991cc35b60144e57233bf7ac678
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 14 15:41:27 2014 +0000

    Resolves: coverity#1078567 help coverity out
    
    so it know that its the same rPPDCache in use to
    avoid various warnings
    
    Change-Id: I89cb7830f375f1907b2457bd05fd2df5d36c3696

diff --git a/include/vcl/ppdparser.hxx b/include/vcl/ppdparser.hxx
index 344b35c..a4df86d 100644
--- a/include/vcl/ppdparser.hxx
+++ b/include/vcl/ppdparser.hxx
@@ -34,6 +34,7 @@
 
 namespace psp {
 
+class PPDCache;
 class PPDParser;
 class PPDTranslator;
 
@@ -185,7 +186,7 @@ private:
     OUString handleTranslation(const OString& i_rString, bool i_bIsGlobalized);
 
     static void scanPPDDir( const OUString& rDir );
-    static void initPPDFiles();
+    static void initPPDFiles(PPDCache &rPPDCache);
     static OUString getPPDFile( const OUString& rFile );
 public:
     static const PPDParser* getParser( const OUString& rFile );
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index cbfe171..121fa8f 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -455,9 +455,8 @@ void PPDParser::scanPPDDir( const OUString& rDir )
     }
 }
 
-void PPDParser::initPPDFiles()
+void PPDParser::initPPDFiles(PPDCache &rPPDCache)
 {
-    PPDCache &rPPDCache = thePPDCache::get();
     if( rPPDCache.pAllPPDFiles )
         return;
 
@@ -499,7 +498,7 @@ void PPDParser::getKnownPPDDrivers( std::list< OUString >& o_rDrivers, bool bRef
         rPPDCache.pAllPPDFiles = NULL;
     }
 
-    initPPDFiles();
+    initPPDFiles(rPPDCache);
     o_rDrivers.clear();
 
     boost::unordered_map< OUString, OUString, OUStringHash >::const_iterator it;
@@ -520,7 +519,7 @@ OUString PPDParser::getPPDFile( const OUString& rFile )
         bool bRetry = true;
         do
         {
-            initPPDFiles();
+            initPPDFiles(rPPDCache);
             // some PPD files contain dots beside the extension, so try name first
             // and cut of points after that
             OUString aBase( rFile );


More information about the Libreoffice-commits mailing list