diff options
author | Henning Brinkmann <hbrinkm@openoffice.org> | 2011-01-19 18:03:50 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-06-17 14:55:20 +0200 |
commit | fd018e709f9fbb9b83307cc388fc50a77abf6cd5 (patch) | |
tree | 5d01d92aeac28da36f12ac17f471edef829a3fbc /writerfilter | |
parent | ec93d094ca821f3430c31f996003e94d748d3547 (diff) |
imported patch cppcheck [hg:d55fc25e48ab]
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/qa/cppunittests/xxml/testXXML.cxx | 42 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 11 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 2 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapperTableManager.cxx | 4 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 65 | ||||
-rw-r--r-- | writerfilter/source/dmapper/FormControlHelper.cxx | 1 | ||||
-rw-r--r-- | writerfilter/source/dmapper/GraphicImport.cxx | 4 | ||||
-rw-r--r-- | writerfilter/source/dmapper/ModelEventListener.cxx | 3 | ||||
-rw-r--r-- | writerfilter/source/dmapper/NumberingManager.cxx | 3 | ||||
-rw-r--r-- | writerfilter/source/dmapper/NumberingManager.hxx | 4 | ||||
-rw-r--r-- | writerfilter/source/dmapper/OLEHandler.cxx | 2 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.cxx | 6 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyMapHelper.cxx | 1 | ||||
-rw-r--r-- | writerfilter/source/dmapper/StyleSheetTable.cxx | 3 |
14 files changed, 99 insertions, 52 deletions
diff --git a/writerfilter/qa/cppunittests/xxml/testXXML.cxx b/writerfilter/qa/cppunittests/xxml/testXXML.cxx index 4e5ade4f8d7e..b5f780583fc5 100644 --- a/writerfilter/qa/cppunittests/xxml/testXXML.cxx +++ b/writerfilter/qa/cppunittests/xxml/testXXML.cxx @@ -126,25 +126,29 @@ public: } virtual void endElement(QName_t name) { - //printf("</{%s}:%s>\n", QName::serializer().getNamespaceUri(name), QName::serializer().getLocalName(name)); - events++; - switch(name) - { - case NS_table::LN_table: - case NS_ss11::LN_Table: - currentRow->append(*currentTable); - currentRow=NULL; - break; - case NS_table::LN_table_row: - case NS_ss11::LN_Row: - currentCell->append(*currentRow); - currentCell=NULL; - break; - case NS_table::LN_table_cell: - case NS_ss11::LN_Cell: - break; - - }; + //printf("</{%s}:%s>\n", QName::serializer().getNamespaceUri(name), QName::serializer().getLocalName(name)); + events++; + switch(name) + { + case NS_table::LN_table: + case NS_ss11::LN_Table: + if (currentTable != NULL) + { + currentRow->append(*currentTable); + } + currentRow=NULL; + break; + case NS_table::LN_table_row: + case NS_ss11::LN_Row: + if (currentRow != NULL) + currentCell->append(*currentRow); + currentCell=NULL; + break; + case NS_table::LN_table_cell: + case NS_ss11::LN_Cell: + break; + + }; } virtual void characters(const xxml::Value &value) { diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index fb36455fcd97..92b4e01c62db 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -2837,7 +2837,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType { //get value from style sheet and invert it sal_Int16 nStyleValue = 0; - double fDoubleValue; + double fDoubleValue = 0.0; uno::Any aStyleVal = m_pImpl->GetPropertyFromStyleSheet(ePropertyId); if( !aStyleVal.hasValue() ) { @@ -3846,8 +3846,9 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType xLineNumberingPropSet->setPropertyValue(rNameSupplier.GetName( PROP_DISTANCE ), uno::makeAny(aSettings.nDistance) ); xLineNumberingPropSet->setPropertyValue(rNameSupplier.GetName( PROP_RESTART_AT_EACH_PAGE ), uno::makeAny(aSettings.bRestartAtEachPage) ); } - catch( const uno::Exception& ) + catch( const uno::Exception& e) { + (void) e; } } @@ -4133,8 +4134,9 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType uno::makeAny( nNumType )); } } - catch( const uno::Exception& ) + catch( const uno::Exception& e) { + (void) e; } } break; @@ -4508,8 +4510,9 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len) } } - catch( const uno::RuntimeException& ) + catch( const uno::RuntimeException& e) { + (void) e; } } /*-- 09.06.2006 09:52:15--------------------------------------------------- diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index c6869aca5f2b..1c77191ea5ab 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -730,12 +730,14 @@ void DomainMapperTableHandler::endTable() } catch (lang::IllegalArgumentException e) { + (void) e; #ifdef DEBUG_DMAPPER_TABLE_HANDLER dmapper_logger->chars("failed to import table!"); #endif } catch ( uno::Exception e ) { + (void) e; #ifdef DEBUG_DMAPPER_TABLE_HANDLER dmapper_logger->startElement("exception"); dmapper_logger->chars(rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( )); diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index 8783421faaaf..89b82536feab 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -71,8 +71,8 @@ DomainMapperTableManager::DomainMapperTableManager(bool bOOXML) : -----------------------------------------------------------------------*/ DomainMapperTableManager::~DomainMapperTableManager() { - if ( m_pTablePropsHandler ) - delete m_pTablePropsHandler, m_pTablePropsHandler = NULL; + delete m_pTablePropsHandler; + m_pTablePropsHandler = NULL; } /*-- 23.04.2007 15:25:37--------------------------------------------------- diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 96ad59830ade..f0d6dd9cf055 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -221,8 +221,9 @@ void DomainMapper_Impl::SetDocumentSettingsProperty( const ::rtl::OUString& rPro { xSettings->setPropertyValue( rPropName, rValue ); } - catch( const uno::Exception& ) + catch( const uno::Exception& e) { + (void) e; } } } @@ -254,9 +255,22 @@ void DomainMapper_Impl::SetIsLastParagraphInSection( bool bIsLast ) void DomainMapper_Impl::PushProperties(ContextType eId) { SectionPropertyMap* pSectionContext = 0; - PropertyMapPtr pInsert(eId == CONTEXT_SECTION ? - (pSectionContext = new SectionPropertyMap( m_bIsFirstSection )) : - eId == CONTEXT_PARAGRAPH ? new ParagraphPropertyMap : new PropertyMap); + PropertyMapPtr pInsert; + + switch (eId) + { + case CONTEXT_SECTION: + pSectionContext = new SectionPropertyMap( m_bIsFirstSection ); + pInsert.reset(pSectionContext); + break; + case CONTEXT_PARAGRAPH: + pInsert.reset(new ParagraphPropertyMap); + break; + default: + pInsert.reset(new PropertyMap); + break; + } + if(eId == CONTEXT_SECTION) { if( m_bIsFirstSection ) @@ -849,9 +863,10 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap ) #endif xObj->attach( xTextRange ); } - catch ( uno::RuntimeException& ) + catch ( uno::RuntimeException& e) { // this is normal: the shape is already attached + (void) e; } m_aAnchoredStack.pop( ); } @@ -957,11 +972,13 @@ void DomainMapper_Impl::appendTextContent( { xTextAppendAndConvert->appendTextContent( xContent, xPropertyValues ); } - catch(const lang::IllegalArgumentException& ) + catch(const lang::IllegalArgumentException& e) { + (void) e; } - catch(const uno::Exception& ) + catch(const uno::Exception& e) { + (void) e; } } } @@ -1028,8 +1045,9 @@ uno::Reference< beans::XPropertySet > DomainMapper_Impl::appendTextSectionAfter( xSection->attach( uno::Reference< text::XTextRange >( xCursor, uno::UNO_QUERY_THROW) ); xRet = uno::Reference< beans::XPropertySet > (xSection, uno::UNO_QUERY ); } - catch(const uno::Exception& ) + catch(const uno::Exception& e) { + (void) e; } } @@ -1069,8 +1087,9 @@ void DomainMapper_Impl::PushPageHeader(SectionPropertyMap::PageType eType) xPageStyle->getPropertyValue(rPropNameSupplier.GetName( bLeft ? PROP_HEADER_TEXT_LEFT : PROP_HEADER_TEXT) ) >>= xHeaderText; m_aTextAppendStack.push( uno::Reference< text::XTextAppend >( xHeaderText, uno::UNO_QUERY_THROW)); } - catch( uno::Exception& ) + catch( uno::Exception& e) { + (void) e; } } } @@ -1106,8 +1125,9 @@ void DomainMapper_Impl::PushPageFooter(SectionPropertyMap::PageType eType) xPageStyle->getPropertyValue(rPropNameSupplier.GetName( bLeft ? PROP_FOOTER_TEXT_LEFT : PROP_FOOTER_TEXT) ) >>= xFooterText; m_aTextAppendStack.push(uno::Reference< text::XTextAppend >( xFooterText, uno::UNO_QUERY_THROW )); } - catch( uno::Exception& ) + catch( uno::Exception& e) { + (void) e; } } } @@ -1308,6 +1328,7 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape } catch ( const uno::Exception& e ) { + (void) e; #if DEBUG clog << "Exception when adding shape: "; clog << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( ); @@ -2230,8 +2251,9 @@ void DomainMapper_Impl::SetNumberFormat( const ::rtl::OUString& rCommand, PropertyNameSupplier::GetPropertyNameSupplier().GetName(PROP_NUMBER_FORMAT), uno::makeAny( nKey )); } - catch(const uno::Exception&) + catch(const uno::Exception& e) { + (void) e; } } @@ -3345,15 +3367,16 @@ void DomainMapper_Impl::SetFieldResult( ::rtl::OUString& rResult ) uno::makeAny( rResult )); } } - catch( const beans::UnknownPropertyException& ) + catch( const beans::UnknownPropertyException& e) { + (void) e; //some fields don't have a CurrentPresentation (DateTime) } } } - catch( uno::Exception& ) + catch( uno::Exception& e) { - + (void) e; } } } @@ -3493,8 +3516,9 @@ void DomainMapper_Impl::AddBookmark( const ::rtl::OUString& rBookmarkName, const m_aBookmarkMap.insert(BookmarkMap_t::value_type( rId, BookmarkInsertPosition( bIsStart, rBookmarkName, xCurrent ) )); } } - catch( const uno::Exception& ) + catch( const uno::Exception& e) { + (void) e; //TODO: What happens to bookmarks where start and end are at different XText objects? } } @@ -3562,10 +3586,10 @@ void DomainMapper_Impl::SetLineNumbering( sal_Int32 nLnnMod, sal_Int32 nLnc, sal xProperties->setPropertyValue( rPropNameSupplier.GetName( PROP_NUMBERING_TYPE ), uno::makeAny( style::NumberingType::ARABIC)); xProperties->setPropertyValue( rPropNameSupplier.GetName( PROP_RESTART_AT_EACH_PAGE ), uno::makeAny( nLnc == 0 )); } - catch( const uno::Exception& ) - {} - - + catch( const uno::Exception& e) + { + (void) e; + } /* { SW_PROP_NAME(UNO_NAME_CHAR_STYLE_NAME @@ -3751,8 +3775,9 @@ void DomainMapper_Impl::ApplySettingsTable() sal_Int32 nDefTab = m_pSettingsTable->GetDefaultTabStop(); xTextDefaults->setPropertyValue( PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_TAB_STOP_DISTANCE ), uno::makeAny(nDefTab) ); } - catch(const uno::Exception& ) + catch(const uno::Exception& e) { + (void) e; } } } diff --git a/writerfilter/source/dmapper/FormControlHelper.cxx b/writerfilter/source/dmapper/FormControlHelper.cxx index eebf921f4963..1d6c77214b3f 100644 --- a/writerfilter/source/dmapper/FormControlHelper.cxx +++ b/writerfilter/source/dmapper/FormControlHelper.cxx @@ -189,6 +189,7 @@ bool FormControlHelper::createCheckbox(uno::Reference<text::XTextRange> xTextRan } catch (beans::UnknownPropertyException & rException) { + (void) rException; } } diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index beae39a68a29..26213dba0343 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -1096,6 +1096,7 @@ void GraphicImport::lcl_attribute(Id nName, Value & val) } catch( const beans::UnknownPropertyException e ) { + (void) e; // It isn't a graphic image } @@ -1737,8 +1738,9 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const b xNamed->setName( m_pImpl->sName ); } } - catch( const uno::Exception& ) + catch( const uno::Exception& e) { + (void) e; } } } diff --git a/writerfilter/source/dmapper/ModelEventListener.cxx b/writerfilter/source/dmapper/ModelEventListener.cxx index 853b835d7d98..f1619ba9edd0 100644 --- a/writerfilter/source/dmapper/ModelEventListener.cxx +++ b/writerfilter/source/dmapper/ModelEventListener.cxx @@ -87,8 +87,9 @@ void ModelEventListener::disposing( const lang::EventObject& rEvent ) throw (uno uno::Reference<document::XEventBroadcaster>(rEvent.Source, uno::UNO_QUERY )->removeEventListener( uno::Reference<document::XEventListener>(this)); } - catch( const uno::Exception& ) + catch( const uno::Exception& e) { + (void) e; } } diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx index 9e66e1a467c3..b5420b88178e 100644 --- a/writerfilter/source/dmapper/NumberingManager.cxx +++ b/writerfilter/source/dmapper/NumberingManager.cxx @@ -507,8 +507,9 @@ uno::Reference< container::XNameContainer > lcl_getUnoNumberingStyles( oFamily >>= xStyles; } - catch ( const uno::Exception ) + catch ( const uno::Exception e) { + (void) e; } return xStyles; diff --git a/writerfilter/source/dmapper/NumberingManager.hxx b/writerfilter/source/dmapper/NumberingManager.hxx index 3285bc85f416..6a7e2be7bd4a 100644 --- a/writerfilter/source/dmapper/NumberingManager.hxx +++ b/writerfilter/source/dmapper/NumberingManager.hxx @@ -144,13 +144,13 @@ public: void AddRGISTD( rtl::OUString sValue ) { m_sRGISTD += sValue; }; // Accessors - sal_Int32 GetId( ) { return m_nId; }; + sal_Int32 GetId( ) const { return m_nId; }; sal_Int16 Size( ) { return sal_Int16( m_aLevels.size( ) ); }; ListLevel::Pointer GetLevel( sal_uInt16 nLvl ); void AddLevel( ); - ListLevel::Pointer GetCurrentLevel( ) { return m_pCurrentLevel; }; + ListLevel::Pointer GetCurrentLevel( ) const { return m_pCurrentLevel; }; virtual com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< diff --git a/writerfilter/source/dmapper/OLEHandler.cxx b/writerfilter/source/dmapper/OLEHandler.cxx index 89ee01ecb9a0..86742e76b3cb 100644 --- a/writerfilter/source/dmapper/OLEHandler.cxx +++ b/writerfilter/source/dmapper/OLEHandler.cxx @@ -129,6 +129,7 @@ void OLEHandler::lcl_attribute(Id rName, Value & rVal) } catch( const uno::Exception& e ) { + (void) e; #if DEBUG clog << "Exception in OLE Handler: "; clog << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( ) << endl; @@ -179,6 +180,7 @@ void OLEHandler::lcl_sprm(Sprm & rSprm) } catch( const uno::Exception& e ) { + (void) e; #if DEBUG clog << "Exception in OLE Handler: "; clog << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( ) << endl; diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index f8dcb0592cee..df1388470621 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -133,6 +133,7 @@ void lcl_AnyToTag(XMLTag::Pointer_t pTag, const uno::Any & rAny) pTag->addAttr("stringValue", aStr); } catch (...) { + pTag->addAttr("exception", "true"); } } @@ -199,6 +200,7 @@ XMLTag::Pointer_t PropertyMap::toTag() const pTag->addAttr("stringValue", aStr); } catch (...) { + pTag->addAttr("exception", "true"); } } break; @@ -426,8 +428,9 @@ uno::Reference< beans::XPropertySet > SectionPropertyMap::GetPageStyle( } } - catch( const uno::Exception& ) + catch( const uno::Exception& e) { + (void) e; } return xRet; @@ -733,6 +736,7 @@ void SectionPropertyMap::CopyLastHeaderFooter( bool bFirstPage, DomainMapper_Imp } catch ( const uno::Exception& e ) { + (void) e; #if DEBUG clog << "An exception occured in SectionPropertyMap::CopyLastHeaderFooter( ) - "; clog << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( ) << endl; diff --git a/writerfilter/source/dmapper/PropertyMapHelper.cxx b/writerfilter/source/dmapper/PropertyMapHelper.cxx index 3496c5e04f44..7add8e22364a 100644 --- a/writerfilter/source/dmapper/PropertyMapHelper.cxx +++ b/writerfilter/source/dmapper/PropertyMapHelper.cxx @@ -80,6 +80,7 @@ XMLTag::Pointer_t lcl_PropertyValuesToTag(beans::PropertyValues & rValues) } catch (...) { + pTag->addAttr("exception", "true"); } if (pValues[n].Name.equalsAscii("TableColumnSeparators")) diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index a0d5039a155b..6bb7e9d9257c 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -1283,8 +1283,9 @@ void StyleSheetTable::applyDefaults(bool bParaProperties) } } } - catch( const uno::Exception& ) + catch( const uno::Exception& e) { + (void) e; } } /*-- 05.02.2008 10:27:36--------------------------------------------------- |