bridges/source/cpp_uno/shared/bridge.cxx | 1 bridges/source/jni_uno/jni_bridge.cxx | 2 cui/source/customize/cfg.cxx | 3 external/cppunit/coverity.patch | 10 + hwpfilter/source/hcode.cxx | 8 reportdesign/source/filter/xml/xmlExport.cxx | 4 rsc/source/rscpp/cpp4.c | 3 rsc/source/rscpp/cpp5.c | 2 sc/source/filter/oox/addressconverter.cxx | 5 svtools/source/brwbox/datwin.cxx | 2 svx/source/table/tablecontroller.cxx | 3 sw/source/core/doc/SwStyleNameMapper.cxx | 8 sw/source/core/doc/htmltbl.cxx | 13 + sw/source/core/layout/findfrm.cxx | 4 sw/source/core/text/txtfrm.cxx | 2 tools/source/generic/fract.cxx | 2 unoxml/Library_unoxml.mk | 1 unoxml/source/events/testlistener.cxx | 132 --------------- unoxml/source/events/testlistener.hxx | 100 ----------- unoxml/source/service/services.cxx | 9 - unoxml/source/service/unoxml.component | 3 vcl/generic/fontmanager/fontmanager.cxx | 5 vcl/source/gdi/pdfwriter_impl.cxx | 12 - vcl/source/gdi/pdfwriter_impl.hxx | 2 vcl/source/outdev/map.cxx | 2 writerfilter/source/dmapper/DomainMapperTableManager.cxx | 2 xmloff/source/core/xmlictxt.cxx | 1 27 files changed, 65 insertions(+), 276 deletions(-)
New commits: commit d42c80e534c715f85a86c61f18fbccb465facd60 Author: Caolán McNamara <[email protected]> Date: Mon Nov 3 16:07:29 2014 +0000 coverity#735452 Logically dead code Change-Id: If50b62e63160c4a26fe97b6fc59494339a566188 diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx index 0bf3db9..fd84461 100644 --- a/reportdesign/source/filter/xml/xmlExport.cxx +++ b/reportdesign/source/filter/xml/xmlExport.cxx @@ -924,9 +924,7 @@ void ORptExport::exportContainer(const Reference< XSection>& _xSection) if ( xReportElement.is() ) exportReportElement(xReportElement); - if ( eToken == XML_GROUP && xSection.is() ) - exportContainer(xSection); - else if ( eToken == XML_SUB_DOCUMENT && xReportDefinition.is() ) + if (eToken == XML_SUB_DOCUMENT && xReportDefinition.is()) { SvXMLElementExport aOfficeElement( *this, XML_NAMESPACE_OFFICE, XML_BODY, true, true ); SvXMLElementExport aElem( *this, true, commit 7439af47d1dcc0925d57cc878c2714c8fb2cd67e Author: Caolán McNamara <[email protected]> Date: Mon Nov 3 16:06:51 2014 +0000 coverity#982297 EBCDIC-related cleanup Change-Id: I8da7911c342ffe114d7b25b996602aabed7aa1ed diff --git a/rsc/source/rscpp/cpp4.c b/rsc/source/rscpp/cpp4.c index 6240c1b..034c012 100644 --- a/rsc/source/rscpp/cpp4.c +++ b/rsc/source/rscpp/cpp4.c @@ -49,8 +49,7 @@ void InitCpp4() * the formal parameter name is encountered in the replacement * string, it is replaced by a character in the range 128 to * 128+NPARAM (this allows up to 32 parameters within the - * Dec Multinational range). If cpp is ported to an EBCDIC - * machine, you will have to make other arrangements. + * Dec Multinational range). * * There is some special case code to distinguish * #define foo bar diff --git a/rsc/source/rscpp/cpp5.c b/rsc/source/rscpp/cpp5.c index d7bd98c..a6b9e14 100644 --- a/rsc/source/rscpp/cpp5.c +++ b/rsc/source/rscpp/cpp5.c @@ -741,7 +741,7 @@ FILE_LOCAL int evalchar(int skip) (--count >= 0)) { value *= 16; - value += (c >= '0') ? (c - '0') : ((c & 0xF) + 9); + value += (c - '0'); } unget(); break; commit cb2d414fe910702002d7dc800db68e2bae935b23 Author: Caolán McNamara <[email protected]> Date: Mon Nov 3 15:43:53 2014 +0000 coverity#1209010 Unchecked return value Change-Id: I92c2472a34aca9f7f1a617666607040cadb0b643 diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 4280bb1..40e5b7b 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -3844,7 +3844,7 @@ void PDFWriterImpl::appendBuiltinFontsToDict( OStringBuffer& rDict ) const bool PDFWriterImpl::emitFonts() { - if( ! m_pReferenceDevice->AcquireGraphics() ) + if (!m_pReferenceDevice->AcquireGraphics()) return false; OStringBuffer aLine( 1024 ); @@ -7006,7 +7006,7 @@ sal_Int32 PDFWriterImpl::getSystemFont( const vcl::Font& i_rFont ) return nFontID; } -void PDFWriterImpl::registerGlyphs( int nGlyphs, +bool PDFWriterImpl::registerGlyphs( int nGlyphs, sal_GlyphId* pGlyphs, sal_Int32* pGlyphWidths, sal_Ucs* pUnicodes, @@ -7058,7 +7058,8 @@ void PDFWriterImpl::registerGlyphs( int nGlyphs, rNewGlyph.m_nFontID = pMappedFontObjects[i]; rNewGlyph.m_nSubsetGlyphID = nNewId; } - getReferenceDevice()->AcquireGraphics(); + if (!getReferenceDevice()->AcquireGraphics()) + return false; const bool bVertical = ((pGlyphs[i] & GF_ROTMASK) != 0); pGlyphWidths[i] = m_aFontCache.getGlyphWidth( pCurrentFont, nFontGlyphId, @@ -7081,7 +7082,8 @@ void PDFWriterImpl::registerGlyphs( int nGlyphs, const Ucs2SIntMap* pEncoding = NULL; const Ucs2OStrMap* pNonEncoded = NULL; - getReferenceDevice()->AcquireGraphics(); + if (!getReferenceDevice()->AcquireGraphics()) + return false; pEncoding = m_pReferenceDevice->mpGraphics->GetFontEncodingVector( pCurrentFont, &pNonEncoded ); Ucs2SIntMap::const_iterator enc_it; @@ -7154,6 +7156,7 @@ void PDFWriterImpl::registerGlyphs( int nGlyphs, m_pReferenceDevice->mpGraphics ); } } + return true; } void PDFWriterImpl::drawRelief( SalLayout& rLayout, const OUString& rText, bool bTextLines ) @@ -7804,7 +7807,6 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool writeBuffer( "Q\n", 2 ); pop(); } - } void PDFWriterImpl::drawEmphasisMark( long nX, long nY, diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index d453f11..7b294a4 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -836,7 +836,7 @@ i12626 void appendLiteralStringEncrypt( OStringBuffer& rInString, const sal_Int32 nInObjectNumber, OStringBuffer& rOutBuffer ); /* creates fonts and subsets that will be emitted later */ - void registerGlyphs( int nGlyphs, sal_GlyphId* pGlyphs, sal_Int32* pGlpyhWidths, sal_Ucs* pUnicodes, sal_Int32* pUnicodesPerGlyph, sal_uInt8* pMappedGlyphs, sal_Int32* pMappedFontObjects, const PhysicalFontFace* pFallbackFonts[] ); + bool registerGlyphs( int nGlyphs, sal_GlyphId* pGlyphs, sal_Int32* pGlpyhWidths, sal_Ucs* pUnicodes, sal_Int32* pUnicodesPerGlyph, sal_uInt8* pMappedGlyphs, sal_Int32* pMappedFontObjects, const PhysicalFontFace* pFallbackFonts[] ); /* emits a text object according to the passed layout */ /* TODO: remove rText as soon as SalLayout will change so that rText is not necessary anymore */ commit c71f6b57b93fb23d6f043990c38950ecae1b094e Author: Caolán McNamara <[email protected]> Date: Mon Nov 3 15:30:16 2014 +0000 coverity#735641 Division or modulo by zero Change-Id: I6055f85289ca7c701a70dc3aba8dc354c475e440 diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx index 63a877f..3cb6556 100644 --- a/sw/source/core/doc/htmltbl.cxx +++ b/sw/source/core/doc/htmltbl.cxx @@ -831,8 +831,17 @@ void SwHTMLTableLayout::AutoLayoutPass1() sal_uLong nColMax = pColumn->GetMax(); nMin -= nColMin; - sal_uLong nAdd = ic<nEndCol-1 ? (nColMin * nMinD) / nColsMin - : nDiff; + sal_uLong nAdd; + if (ic < nEndCol-1) + { + if (nColsMin == 0) + throw o3tl::divide_by_zero(); + nAdd = (nColMin * nMinD) / nColsMin; + } + else + { + nAdd = nDiff; + } nColMin += nAdd; nMin += nColMin; OSL_ENSURE( nDiff >= nAdd, "Ooops: nDiff is not correct anymore" ); commit 07f9a7dc833c00421d9d49bf1aa8bc79858b8ccf Author: Caolán McNamara <[email protected]> Date: Mon Nov 3 10:25:02 2014 +0000 some coverity false positive markup efforts Change-Id: Id17c3426cb4a5913881201a0bf2f569ca5002303 diff --git a/bridges/source/cpp_uno/shared/bridge.cxx b/bridges/source/cpp_uno/shared/bridge.cxx index 927e278..0d31167 100644 --- a/bridges/source/cpp_uno/shared/bridge.cxx +++ b/bridges/source/cpp_uno/shared/bridge.cxx @@ -146,6 +146,7 @@ uno_Mapping * Bridge::createMapping( bool bExportCpp2Uno) { Bridge * bridge = new Bridge(pCppEnv, pUnoEnv, bExportCpp2Uno); + //coverity[leaked_storage] return bExportCpp2Uno ? &bridge->aCpp2Uno : &bridge->aUno2Cpp; } diff --git a/bridges/source/jni_uno/jni_bridge.cxx b/bridges/source/jni_uno/jni_bridge.cxx index 9e5a55a..6409c2a 100644 --- a/bridges/source/jni_uno/jni_bridge.cxx +++ b/bridges/source/jni_uno/jni_bridge.cxx @@ -490,6 +490,7 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_ext_getMapping( uno_registerMapping( &mapping, Bridge_free, pFrom, (uno_Environment *)pTo->pExtEnv, 0 ); + //coverity[leaked_storage] } else if ( from_env_typename == UNO_LB_UNO && to_env_typename == UNO_LB_JAVA ) { @@ -499,6 +500,7 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_ext_getMapping( uno_registerMapping( &mapping, Bridge_free, (uno_Environment *)pFrom->pExtEnv, pTo, 0 ); + //coverity[leaked_storage] } } catch (const BridgeRuntimeError & err) commit 9148b1c6457bb7702af6b158bd4fefedc8f17236 Author: Caolán McNamara <[email protected]> Date: Mon Nov 3 10:23:31 2014 +0000 add some more kill paths to cppunit Change-Id: I8610e99aecc725e349976746af6c8bd560ba2ffa diff --git a/external/cppunit/coverity.patch b/external/cppunit/coverity.patch index 6fb3261..34c1c29 100644 --- a/external/cppunit/coverity.patch +++ b/external/cppunit/coverity.patch @@ -1,6 +1,14 @@ --- misc/cppunit-1.13.1/src/cppunit/Asserter.cpp +++ misc/build/cppunit-1.13.1/src/cppunit/Asserter.cpp -@@ -13,7 +13,7 @@ Asserter::fail( std::string message, +@@ -6,6 +6,7 @@ + CPPUNIT_NS_BEGIN + + ++// coverity[+kill] + void + Asserter::fail( std::string message, + const SourceLine &sourceLine ) +@@ -13,7 +14,7 @@ fail( Message( "assertion failed", message ), sourceLine ); } commit a3be1ce627053bc1d2b7a0a896c871ad44b206a1 Author: Caolán McNamara <[email protected]> Date: Mon Nov 3 10:07:34 2014 +0000 coverity#1250408 Division or modulo by float zero Change-Id: I64c0d1cb4c3182c03a7d7660c4736f665fc5f3dc diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx index b2fea46..f27af1c 100644 --- a/svtools/source/brwbox/datwin.cxx +++ b/svtools/source/brwbox/datwin.cxx @@ -110,9 +110,9 @@ BrowserColumn::BrowserColumn( sal_uInt16 nItemId, const class Image &rImage, { double n = (double)_nWidth; n *= (double)rCurrentZoom.GetDenominator(); - n /= (double)rCurrentZoom.GetNumerator(); if (!rCurrentZoom.GetNumerator()) throw o3tl::divide_by_zero(); + n /= (double)rCurrentZoom.GetNumerator(); _nOriginalWidth = n>0 ? (long)(n+0.5) : -(long)(-n+0.5); } commit 9ebd3c7aa61a07abe2bd522e5a6d45812eab127d Author: Caolán McNamara <[email protected]> Date: Mon Nov 3 10:03:55 2014 +0000 coverity#1209529 reorganize to silence Explicit null dereferenced Change-Id: Ia839bfb2243cd22135cabd5b4ce9c8222b232024 diff --git a/sw/source/core/doc/SwStyleNameMapper.cxx b/sw/source/core/doc/SwStyleNameMapper.cxx index b4a4af1..20df27f 100644 --- a/sw/source/core/doc/SwStyleNameMapper.cxx +++ b/sw/source/core/doc/SwStyleNameMapper.cxx @@ -430,6 +430,9 @@ const NameToIdHash & SwStyleNameMapper::getHashTable ( SwGetPoolIdFromName eFlag switch ( eFlags ) { + default: + assert(false && "unknown pool family"); + //fall-through case nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL: { pHashPointer = bProgName ? &pParaProgMap : &pParaUIMap; @@ -466,11 +469,6 @@ const NameToIdHash & SwStyleNameMapper::getHashTable ( SwGetPoolIdFromName eFlag vIndexes.push_back( boost::make_tuple(RES_POOLNUMRULE_BEGIN, RES_POOLNUMRULE_END, bProgName ? &GetNumRuleProgNameArray : &GetNumRuleUINameArray) ); } break; - default: - { - assert(false && "unknown pool family"); - } - break; } // Proceed if we have a pointer to a hash, and the hash hasn't already been populated commit f42e3678bb23fef111666bc8b4bf1a3c4d73d3de Author: Caolán McNamara <[email protected]> Date: Mon Nov 3 09:59:57 2014 +0000 coverity#1250409 Explicit null dereferenced Change-Id: Iab78e3ec447b8a32f43dff3e30c5be254f6d0a48 diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 8203914..5b09be9 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -2635,7 +2635,8 @@ SvxMainMenuOrganizerDialog::SvxMainMenuOrganizerDialog( pNewMenuEntry->SetUserData( pNewEntryData ); - mpEntries->push_back( pNewEntryData ); + if (mpEntries) + mpEntries->push_back(pNewEntryData); m_pMenuNameEdit->SetText( newname ); m_pMenuNameEdit->SetModifyHdl( commit 8be0bf735adc26f38212efd1dd6231a87e974f5b Author: Caolán McNamara <[email protected]> Date: Mon Nov 3 09:57:36 2014 +0000 coverity#735914 Dereference after null check Change-Id: Id7d50edca21f3a595ba31430cae7c62104d031d8 diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 720f888..49aa5ca 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -2232,6 +2232,7 @@ void SwTxtFrm::_CalcHeightOfLastLine( const bool _bUseFont ) aFont.SetFntChg( true ); aFont.ChgPhysFnt( pVsh, *pOut ); mnHeightOfLastLine = aFont.GetHeight( pVsh, *pOut ); + //coverity[var_deref_model] - pLastFont is set in SwSubFont::ChgFnt pLastFont->Unlock(); pLastFont = pOldFont; pLastFont->SetDevFont( pVsh, *pOut ); @@ -2242,6 +2243,7 @@ void SwTxtFrm::_CalcHeightOfLastLine( const bool _bUseFont ) aFont.SetFntChg( true ); aFont.ChgPhysFnt( pVsh, *pOut ); mnHeightOfLastLine = aFont.GetHeight( pVsh, *pOut ); + //coverity[var_deref_model] - pLastFont is set in SwSubFont::ChgFnt pLastFont->Unlock(); pLastFont = NULL; pOut->SetFont( aOldFont ); commit cb2a3687c3204a292a72fe76a659889118fc345e Author: Caolán McNamara <[email protected]> Date: Mon Nov 3 09:46:47 2014 +0000 coverity#1241199 Unchecked dynamic_cast Change-Id: Ib1ba5d63b258202a6a8c2113906ad22ff79a352c diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index f02ae22..d9f03b7 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -677,6 +677,9 @@ void SvxTableController::onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs ) { CellRef xSourceCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nPropSrcRow ).get() ) ); + if (!xSourceCell.is()) + continue; + // When we insert new ROWs, we want to copy COLUMN spans. if( nColSpan == 0 ) { commit a57db0bc7e57783c227e2ce34089afbcac1a3ecc Author: Caolán McNamara <[email protected]> Date: Mon Nov 3 09:44:34 2014 +0000 coverity#707956 Uninitialized scalar field Change-Id: I690de0eb0db28a25dc6c2e83a6dcba620d7c5922 diff --git a/sc/source/filter/oox/addressconverter.cxx b/sc/source/filter/oox/addressconverter.cxx index c3a8fb7..59154d2 100644 --- a/sc/source/filter/oox/addressconverter.cxx +++ b/sc/source/filter/oox/addressconverter.cxx @@ -147,7 +147,10 @@ AddressConverter::AddressConverter( const WorkbookHelper& rHelper ) : initializeMaxPos( BIFF8_MAXTAB, BIFF8_MAXCOL, BIFF8_MAXROW ); maLinkChars.set( '\x04', '\x01', 0xFFFF, '\x02', '\x00' ); break; - case BIFF_UNKNOWN: break; + case BIFF_UNKNOWN: + initializeMaxPos( 0, 0, 0 ); + maLinkChars.set( 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF ); + break; } break; case FILTER_UNKNOWN: commit 18995b5f7a34af5aff5fc5621747f0f3eefd9db0 Author: Caolán McNamara <[email protected]> Date: Mon Nov 3 09:42:34 2014 +0000 coverity#1250700 Uninitialized scalar field Change-Id: I5db51e7864017f0d0e474ed3e253657288245850 diff --git a/xmloff/source/core/xmlictxt.cxx b/xmloff/source/core/xmlictxt.cxx index 8340a07..ca897d0 100644 --- a/xmloff/source/core/xmlictxt.cxx +++ b/xmloff/source/core/xmlictxt.cxx @@ -41,6 +41,7 @@ SvXMLImportContext::SvXMLImportContext( SvXMLImport& rImp, sal_uInt16 nPrfx, SvXMLImportContext::SvXMLImportContext( SvXMLImport& rImp ) : mrImport( rImp ), + mnPrefix ( 0 ), mpRewindMap( 0 ) { } commit 48dad962fe23ddffb684d2338465c21cf83d849b Author: Caolán McNamara <[email protected]> Date: Mon Nov 3 09:27:48 2014 +0000 coverity#705527 drop testlistener that logs to c:\listener.out Change-Id: Id9eab9e44d4b0e705289fa45be0fc2343903de09 diff --git a/unoxml/Library_unoxml.mk b/unoxml/Library_unoxml.mk index e3800fc..275fdb3 100644 --- a/unoxml/Library_unoxml.mk +++ b/unoxml/Library_unoxml.mk @@ -71,7 +71,6 @@ $(eval $(call gb_Library_add_exception_objects,unoxml,\ unoxml/source/events/mutationevent \ unoxml/source/events/uievent \ unoxml/source/events/mouseevent \ - unoxml/source/events/testlistener \ unoxml/source/service/services \ )) diff --git a/unoxml/source/events/testlistener.cxx b/unoxml/source/events/testlistener.cxx deleted file mode 100644 index 191cb04..0000000 --- a/unoxml/source/events/testlistener.cxx +++ /dev/null @@ -1,132 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include <stdio.h> - -#include <com/sun/star/lang/IllegalArgumentException.hpp> -#include <cppuhelper/supportsservice.hxx> - -#include "testlistener.hxx" - -#define U2S(s) OUStringToOString(s, RTL_TEXTENCODING_UTF8).getStr() - -using namespace css::uno; -using namespace css::xml::dom::events; -using css::lang::XMultiServiceFactory; -using css::lang::IllegalArgumentException; - - -namespace DOM { namespace events -{ - - Reference< XInterface > CTestListener::_getInstance(const Reference< XMultiServiceFactory >& rSMgr) - { - // XXX - // return static_cast< XXPathAPI* >(new CTestListener()); - return Reference< XInterface >(static_cast<XEventListener*>(new CTestListener(rSMgr))); - } - - const char* CTestListener::aImplementationName = "com.sun.star.comp.xml.dom.events.TestListener"; - const char* CTestListener::aSupportedServiceNames[] = { - "com.sun.star.comp.xml.dom.events.TestListener", - NULL - }; - - OUString CTestListener::_getImplementationName() - { - return OUString::createFromAscii(aImplementationName); - } - Sequence<OUString> CTestListener::_getSupportedServiceNames() - { - Sequence<OUString> aSequence; - for (int i=0; aSupportedServiceNames[i]!=NULL; i++) { - aSequence.realloc(i+1); - aSequence[i]=(OUString::createFromAscii(aSupportedServiceNames[i])); - } - return aSequence; - } - - Sequence< OUString > SAL_CALL CTestListener::getSupportedServiceNames() - throw (RuntimeException, std::exception) - { - return CTestListener::_getSupportedServiceNames(); - } - - OUString SAL_CALL CTestListener::getImplementationName() - throw (RuntimeException, std::exception) - { - return CTestListener::_getImplementationName(); - } - - sal_Bool SAL_CALL CTestListener::supportsService(const OUString& aServiceName) - throw (RuntimeException, std::exception) - { - return cppu::supportsService(this, aServiceName); - } - - // --- XInitialize - - void SAL_CALL CTestListener::initialize(const Sequence< Any >& args) throw(RuntimeException, std::exception) - { - if (args.getLength() < 3) throw IllegalArgumentException( - "Wrong number of arguments", Reference< XInterface >(), 0); - - Reference <XEventTarget> aTarget; - if(! (args[0] >>= aTarget)) throw IllegalArgumentException( - "Illegal argument 1", Reference< XInterface >(), 1); - - OUString aType; - if (! (args[1] >>= aType)) - throw IllegalArgumentException("Illegal argument 2", Reference< XInterface >(), 2); - - bool bCapture = false; - if(! (args[2] >>= bCapture)) throw IllegalArgumentException( - "Illegal argument 3", Reference< XInterface >(), 3); - - if(! (args[3] >>= m_name)) m_name = "<unnamed listener>"; - - m_target = aTarget; - m_type = aType; - m_capture = bCapture; - - m_target->addEventListener(m_type, Reference< XEventListener >(this), m_capture); - - - } - - CTestListener::~CTestListener() - { - fprintf(stderr, "CTestListener::~CTestListener()\n"); - if( m_target.is()) - m_target->removeEventListener(m_type, Reference< XEventListener >(this), m_capture); - } - - // --- XEventListener - - void SAL_CALL CTestListener::handleEvent(const Reference< XEvent >& evt) throw (RuntimeException, std::exception) - { - FILE* f = fopen("C:\\listener.out", "a"); - fprintf(f, "CTestListener::handleEvent in %s\n", U2S(m_name)); - fprintf(f, " type: %s\n\n", OUStringToOString(evt->getType(), RTL_TEXTENCODING_ASCII_US).getStr()); - fclose(f); - - } - -}} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unoxml/source/events/testlistener.hxx b/unoxml/source/events/testlistener.hxx deleted file mode 100644 index 06126cb..0000000 --- a/unoxml/source/events/testlistener.hxx +++ /dev/null @@ -1,100 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_UNOXML_SOURCE_EVENTS_TESTLISTENER_HXX -#define INCLUDED_UNOXML_SOURCE_EVENTS_TESTLISTENER_HXX - -#include <sal/types.h> - -#include <com/sun/star/uno/Reference.h> -#include <com/sun/star/uno/Sequence.h> - -#include <com/sun/star/uno/XInterface.hpp> -#include <com/sun/star/uno/Exception.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/xml/dom/events/XEventTarget.hpp> -#include <com/sun/star/xml/dom/events/XEventListener.hpp> -#include <com/sun/star/xml/dom/events/XEvent.hpp> - -#include <cppuhelper/implbase3.hxx> - -namespace DOM { namespace events -{ - - typedef ::cppu::WeakImplHelper3 - < css::xml::dom::events::XEventListener - , css::lang::XInitialization - , css::lang::XServiceInfo - > CTestListener_Base; - - class CTestListener - : public CTestListener_Base - { - - private: - css::uno::Reference< css::lang::XMultiServiceFactory > m_factory; - css::uno::Reference <css::xml::dom::events::XEventTarget> m_target; - OUString m_type; - bool m_capture; - OUString m_name; - - public: - - // static helpers for service info and component management - static const char* aImplementationName; - static const char* aSupportedServiceNames[]; - static OUString _getImplementationName(); - static css::uno::Sequence< OUString > _getSupportedServiceNames(); - static css::uno::Reference< XInterface > _getInstance( - const css::uno::Reference< css::lang::XMultiServiceFactory >& - rSMgr); - - CTestListener( - const css::uno::Reference< css::lang::XMultiServiceFactory >& - rSMgr) - : m_factory(rSMgr) - , m_capture(false) - { - } - - virtual ~CTestListener(); - - // XServiceInfo - virtual OUString SAL_CALL getImplementationName() - throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; - virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) - throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames () - throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; - - - // XEventListener - virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any >& args) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; - - virtual void SAL_CALL handleEvent(const css::uno::Reference< css::xml::dom::events::XEvent >& evt) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; - - - }; -}} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unoxml/source/service/services.cxx b/unoxml/source/service/services.cxx index 8cb6385..d2bb285 100644 --- a/unoxml/source/service/services.cxx +++ b/unoxml/source/service/services.cxx @@ -32,10 +32,8 @@ #include "../dom/documentbuilder.hxx" #include "../dom/saxbuilder.hxx" #include "../xpath/xpathapi.hxx" -#include "../events/testlistener.hxx" using namespace ::DOM; -using namespace ::DOM::events; using namespace ::XPath; using namespace css::uno; using namespace css::lang; @@ -75,13 +73,6 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL unoxml_component_getFactory(const sal_Char * xServiceManager, CXPathAPI::_getImplementationName(), CXPathAPI::_getInstance, CXPathAPI::_getSupportedServiceNames())); } - else if (CTestListener::_getImplementationName().equalsAscii( pImplementationName ) ) - { - xFactory = Reference< XSingleServiceFactory >( - cppu::createSingleFactory( - xServiceManager, CTestListener::_getImplementationName(), - CTestListener::_getInstance, CTestListener::_getSupportedServiceNames())); - } // Factory is valid - service was found. if ( xFactory.is() ) diff --git a/unoxml/source/service/unoxml.component b/unoxml/source/service/unoxml.component index 260256b..17d9c52 100644 --- a/unoxml/source/service/unoxml.component +++ b/unoxml/source/service/unoxml.component @@ -25,9 +25,6 @@ <implementation name="com.sun.star.comp.xml.dom.SAXDocumentBuilder"> <service name="com.sun.star.xml.dom.SAXDocumentBuilder"/> </implementation> - <implementation name="com.sun.star.comp.xml.dom.events.TestListener"> - <service name="com.sun.star.comp.xml.dom.events.TestListener"/> - </implementation> <implementation name="com.sun.star.comp.xml.xpath.XPathAPI"> <service name="com.sun.star.xml.xpath.XPathAPI"/> </implementation> commit 2cfc6259971f53af45e57de1117f6a1f345a7b23 Author: Caolán McNamara <[email protected]> Date: Mon Nov 3 09:23:17 2014 +0000 coverity#1209713 Dereference null return value Change-Id: I8aba67ae5bf5ffb7530be8f6d5b2511b554717db diff --git a/hwpfilter/source/hcode.cxx b/hwpfilter/source/hcode.cxx index 93f5f0f..42b7205 100644 --- a/hwpfilter/source/hcode.cxx +++ b/hwpfilter/source/hcode.cxx @@ -1309,8 +1309,12 @@ char *hcolor2str(uchar color, uchar shade, char *buf, bool bIsChar) if( src[0] == 'C' && src[1] == ':' && src[2] == '\\' ) // Home Dir { ret.append("file://"); - ret.append(getenv("HOME")); - ret.push_back('/'); + const char *pHome = getenv("HOME"); + if (pHome) + { + ret.append(pHome); + ret.push_back('/'); + } i = 3; // skip first 3 } else if( src[0] == 'D' && src[1] == ':' && src[2] == '\\' ) // Root Dir commit 7db11e4a168e57c9f91dc2c5078adc7179e6fab8 Author: Caolán McNamara <[email protected]> Date: Mon Nov 3 09:21:33 2014 +0000 coverity#1250699 Dereference null return value Change-Id: Iaddc47087d796d96fa0ed054c254b3cf83c90b5e diff --git a/vcl/generic/fontmanager/fontmanager.cxx b/vcl/generic/fontmanager/fontmanager.cxx index 53448c6..33fb4ed 100644 --- a/vcl/generic/fontmanager/fontmanager.cxx +++ b/vcl/generic/fontmanager/fontmanager.cxx @@ -1987,6 +1987,11 @@ bool PrintFontManager::createFontSubset( #endif // create subset file at requested path FILE* pOutFile = fopen( aToFile.getStr(), "wb" ); + if (!pOutFile) + { + CloseTTFont( pTTFont ); + return false; + } // create font subset const char* pGlyphSetName = NULL; // TODO: better name? const bool bOK = rInfo.CreateFontSubset( commit 4088fff7c09ec0d66b4958190999fa1d371d5bbf Author: Caolán McNamara <[email protected]> Date: Mon Nov 3 08:59:07 2014 +0000 coverity#705921 Dereference before null check Change-Id: I7aea5663ed4a5d2f4990292d64eefd782119aded diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx index d11c826..5c72780 100644 --- a/sw/source/core/layout/findfrm.cxx +++ b/sw/source/core/layout/findfrm.cxx @@ -1435,10 +1435,8 @@ SwCellFrm* SwCellFrm::GetFollowCell() const // find most upper row frame const SwFrm* pRow = GetUpper(); - if (!pRow) - return NULL; - while (!pRow->IsRowFrm() || !pRow->GetUpper()->IsTabFrm()) + while (pRow && (!pRow->IsRowFrm() || !pRow->GetUpper()->IsTabFrm())) pRow = pRow->GetUpper(); if (!pRow) commit 7f3326f2aa37f16dbf12844895d269dec5ad8c45 Author: Caolán McNamara <[email protected]> Date: Mon Nov 3 08:53:46 2014 +0000 checker type doesn't work, try event type Change-Id: I8b92c583bf1d6167b713648f417ba5569b3593ba diff --git a/tools/source/generic/fract.cxx b/tools/source/generic/fract.cxx index f3f7d23..4d89b97 100644 --- a/tools/source/generic/fract.cxx +++ b/tools/source/generic/fract.cxx @@ -63,7 +63,7 @@ Fraction::Fraction( double dVal ) bool Fraction::HasOverflowValue() { - //coverity[constant_expression_result] + //coverity[result_independent_of_operands] return value.numerator() < std::numeric_limits<long>::min() || value.numerator() > std::numeric_limits<long>::max() || value.denominator() < std::numeric_limits<long>::min() || commit 2d5130ebab13fb94b07950a03b7051825b3d5b15 Author: Caolán McNamara <[email protected]> Date: Mon Nov 3 08:51:57 2014 +0000 be a little more consistent stylewise Change-Id: If1d822e0e6c87e792ff4a769a525e161505325c9 diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx index 8e95882..fa79b77 100644 --- a/vcl/source/outdev/map.cxx +++ b/vcl/source/outdev/map.cxx @@ -261,7 +261,7 @@ static void ImplCalcMapResolution( const MapMode& rMapMode, } else { - if (!aScaleX.GetNumerator() || ! aScaleY.GetNumerator()) + if (!aScaleX.GetNumerator() || !aScaleY.GetNumerator()) throw o3tl::divide_by_zero(); rMapRes.mfOffsetX *= aScaleX.GetDenominator(); diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index 06ed55e..cad79e9 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -745,7 +745,7 @@ void DomainMapperTableManager::endOfRowAction() if (nWidthsBound) { if (nFullWidthRelative == 0) - throw std::range_error("divide by zero"); + throw o3tl::divide_by_zero(); ::std::vector< sal_Int32 >::const_iterator aSpansIter = pCurrentSpans->begin( ); for( sal_uInt32 nBorder = 0; nBorder < nWidthsBound; ++nBorder )
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
