[Libreoffice-commits] .: 3 commits - bridges/source dtrans/source filter/source fpicker/source rsc/source sc/source sw/source
Takeshi Abe
tabe at kemper.freedesktop.org
Tue Aug 16 08:05:24 PDT 2011
bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx | 1 -
dtrans/source/cnttype/wbench/testcnttype.cxx | 2 --
filter/source/config/cache/filtercache.cxx | 2 +-
fpicker/source/win32/filepicker/FilterContainer.cxx | 6 +++---
rsc/source/res/rsccont.cxx | 20 +++++++++-----------
sc/source/ui/view/viewfunc.cxx | 2 +-
sw/source/ui/utlui/uitool.cxx | 3 +--
7 files changed, 15 insertions(+), 21 deletions(-)
New commits:
commit 99862627d0f240b8209ca08c0cd0cd5cad4cca3c
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date: Tue Aug 16 23:58:50 2011 +0900
cppcheck: possibly efficient checking for emptiness
diff --git a/fpicker/source/win32/filepicker/FilterContainer.cxx b/fpicker/source/win32/filepicker/FilterContainer.cxx
index f61ad67..eb2bc36 100644
--- a/fpicker/source/win32/filepicker/FilterContainer.cxx
+++ b/fpicker/source/win32/filepicker/FilterContainer.cxx
@@ -96,7 +96,7 @@ sal_Bool SAL_CALL CFilterContainer::addFilter(
sal_Bool SAL_CALL CFilterContainer::delFilter( const OUString& aName )
{
- OSL_ASSERT( m_vFilters.size() > 0 );
+ OSL_ASSERT( !m_vFilters.empty() );
sal_Int32 pos = getFilterTagPos( aName );
if ( pos > -1 )
@@ -134,7 +134,7 @@ void SAL_CALL CFilterContainer::empty()
sal_Bool SAL_CALL CFilterContainer::getFilter( const OUString& aName, OUString& theFilter ) const
{
- OSL_PRECOND( m_vFilters.size() > 0, "Empty filter container" );
+ OSL_PRECOND( !m_vFilters.empty() , "Empty filter container" );
sal_Int32 pos = getFilterTagPos( aName );
@@ -188,7 +188,7 @@ sal_Int32 SAL_CALL CFilterContainer::getFilterPos( const OUString& aName ) const
sal_Int32 SAL_CALL CFilterContainer::getFilterTagPos( const OUString& aName ) const
{
- if ( m_vFilters.size( ) > 0 )
+ if ( !m_vFilters.empty() )
{
sal_Int32 i = 0;
FILTER_VECTOR_T::const_iterator iter;
commit 13021dae515db60405a255aab388318e54df99a6
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date: Tue Aug 16 23:55:45 2011 +0900
cppcheck: reduced scope of variable
diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx
index b3f5c91..37983d3 100644
--- a/filter/source/config/cache/filtercache.cxx
+++ b/filter/source/config/cache/filtercache.cxx
@@ -2018,10 +2018,10 @@ void FilterCache::impl_saveItem(const css::uno::Reference< css::container::XName
// to a list of names ...
// But note: because we work directly on a reference to the cache item,
// its not allowd to change the value here. We must work on a copy!
- sal_Int32 nFlags = 0;
pIt = aItem.find(PROPNAME_FLAGS);
if (pIt != aItem.end())
{
+ sal_Int32 nFlags = 0;
pIt->second >>= nFlags;
css::uno::Any aFlagNameList;
aFlagNameList <<= FilterCache::impl_convertFlagField2FlagNames(nFlags);
diff --git a/rsc/source/res/rsccont.cxx b/rsc/source/res/rsccont.cxx
index c39be82..a122ebf 100644
--- a/rsc/source/res/rsccont.cxx
+++ b/rsc/source/res/rsccont.cxx
@@ -100,10 +100,9 @@ RSCCLASS_TYPE RscBaseCont::GetClassType() const
*************************************************************************/
void RscBaseCont::DestroyElements( RscBaseContInst * pClassData )
{
- sal_uInt32 i = 0;
-
if( pClassData->nEntries ){
- for( i = 0; i < pClassData->nEntries; i++ ){
+ for (sal_uInt32 i = 0; i < pClassData->nEntries; i++ )
+ {
pClassData->pEntries[ i ].Destroy();
};
rtl_freeMemory( pClassData->pEntries );
@@ -120,7 +119,6 @@ void RscBaseCont::DestroyElements( RscBaseContInst * pClassData )
RSCINST RscBaseCont::Create( RSCINST * pInst, const RSCINST & rDflt,
sal_Bool bOwnClass )
{
- sal_uInt32 i = 0;
RSCINST aInst;
RscBaseContInst * pClassData;
@@ -151,7 +149,8 @@ RSCINST RscBaseCont::Create( RSCINST * pInst, const RSCINST & rDflt,
pClassData->pEntries =
(ENTRY_STRUCT *)rtl_allocateMemory( sizeof( ENTRY_STRUCT )
* pClassData->nEntries );
- for( i = 0; i < pClassData->nEntries; i++ ){
+ for (sal_uInt32 i = 0; i < pClassData->nEntries; i++ )
+ {
pClassData->pEntries[ i ].Create();
pClassData->pEntries[ i ].aName =
pDfltClassData->pEntries[ i ].aName;
@@ -187,7 +186,6 @@ void RscBaseCont::Destroy( const RSCINST & rInst ){
RSCINST RscBaseCont::SearchElePos( const RSCINST & rInst, const RscId & rEleName,
RscTop * pClass, sal_uInt32 nPos )
{
- sal_uInt32 i = 0;
RscBaseContInst * pClassData;
pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
@@ -195,7 +193,8 @@ RSCINST RscBaseCont::SearchElePos( const RSCINST & rInst, const RscId & rEleName
pClass = pTypeClass;
if( rEleName.IsId() ){
- for( i = nPos; i < pClassData->nEntries; i++ ){
+ for (sal_uInt32 i = nPos; i < pClassData->nEntries; i++ )
+ {
if( pClassData->pEntries[ i ].aName == rEleName
&& pClassData->pEntries[ i ].aInst.pClass == pClass )
{
@@ -727,7 +726,6 @@ void RscBaseCont::Delete( const RSCINST & rInst, RscTop * pClass,
*************************************************************************/
void RscBaseCont::DeletePos( const RSCINST & rInst, sal_uInt32 nPos ){
RscBaseContInst * pClassData;
- sal_uInt32 i = 0;
pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
@@ -737,7 +735,7 @@ void RscBaseCont::DeletePos( const RSCINST & rInst, sal_uInt32 nPos ){
else{
pClassData->pEntries[ nPos ].Destroy();
pClassData->nEntries--;
- for( i = nPos; i < pClassData->nEntries; i++ )
+ for (sal_uInt32 i = nPos; i < pClassData->nEntries; i++ )
pClassData->pEntries[ i ] = pClassData->pEntries[ i + 1 ];
};
};
@@ -777,7 +775,6 @@ void RscBaseCont::ContWriteSrc( const RSCINST & rInst, FILE * fOutput,
ERRTYPE RscBaseCont::ContWriteRc( const RSCINST & rInst, RscWriteRc & rMem,
RscTypCont * pTC, sal_uInt32 nDeep, sal_Bool bExtra )
{
- sal_uInt32 i = 0;
RscBaseContInst * pClassData;
ERRTYPE aError;
@@ -785,7 +782,8 @@ ERRTYPE RscBaseCont::ContWriteRc( const RSCINST & rInst, RscWriteRc & rMem,
{ // Nur Subresourcen schreiben, wenn bExtra == sal_True
pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
- for( i = 0; i < pClassData->nEntries && aError.IsOk(); i++ ){
+ for (sal_uInt32 i = 0; i < pClassData->nEntries && aError.IsOk(); i++ )
+ {
aError = pClassData->pEntries[ i ].aInst.pClass->
WriteRcHeader( pClassData->pEntries[ i ].aInst,
rMem, pTC,
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 2b934ee..34a34b9 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -693,10 +693,10 @@ void ScViewFunc::EnterValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& r
{
ScDocument* pDoc = GetViewData()->GetDocument();
ScDocShell* pDocSh = GetViewData()->GetDocShell();
- sal_Bool bUndo (pDoc->IsUndoEnabled());
if ( pDoc && pDocSh )
{
+ sal_Bool bUndo(pDoc->IsUndoEnabled());
ScDocShellModificator aModificator( *pDocSh );
ScEditableTester aTester( pDoc, nTab, nCol,nRow, nCol,nRow );
commit dca2588b6430e084eb708cfe69d36c3d46a5411e
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date: Tue Aug 16 23:48:20 2011 +0900
cppcheck: remove assigned but unused variable
diff --git a/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx
index ddaf1f3..2680ff4 100644
--- a/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx
@@ -516,7 +516,6 @@ void unoInterfaceProxyDispatch(
// is my surrogate
bridges::cpp_uno::shared::UnoInterfaceProxy * pThis
= static_cast< bridges::cpp_uno::shared::UnoInterfaceProxy *> (pUnoI);
- typelib_InterfaceTypeDescription * pTypeDescr = pThis->pTypeDescr;
switch (pMemberDescr->eTypeClass)
{
diff --git a/dtrans/source/cnttype/wbench/testcnttype.cxx b/dtrans/source/cnttype/wbench/testcnttype.cxx
index d6b1fe1..db98529 100644
--- a/dtrans/source/cnttype/wbench/testcnttype.cxx
+++ b/dtrans/source/cnttype/wbench/testcnttype.cxx
@@ -171,8 +171,6 @@ sal_Bool processCntTypesAndWriteResultIntoFile( char* fname, vector< string >& v
fseek( fstream, 0L, SEEK_SET );
vector< string >::iterator iter_end = vecData.end( );
- const char* pStr = NULL;
-
for ( vector< string >::iterator iter = vecData.begin( ); iter != iter_end; ++iter )
{
try
diff --git a/sw/source/ui/utlui/uitool.cxx b/sw/source/ui/utlui/uitool.cxx
index bef821d..9c47e85 100644
--- a/sw/source/ui/utlui/uitool.cxx
+++ b/sw/source/ui/utlui/uitool.cxx
@@ -677,8 +677,7 @@ SwTwips GetTableWidth( SwFrmFmt* pFmt, SwTabCols& rCols, sal_uInt16 *pPercent,
{
if(pSh)
{
- const SwFrmFmt *pFlyFmt;
- if ( 0 == (pFlyFmt = pSh->GetFlyFrmFmt()) )
+ if ( 0 == pSh->GetFlyFrmFmt() )
{
nWidth = pSh->GetAnyCurRect(RECT_PAGE_PRT).Width();
}
More information about the Libreoffice-commits
mailing list