summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerge Krot <Serge.Krot@cib.de>2015-10-25 14:37:11 +0300
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2015-10-25 22:31:44 +0000
commit0b018d202dfcf4bb16b708e10085a4146243b0a0 (patch)
tree4a00a62a88666944f6e7178ab70c497a090becc2
parentce463679a5a362d5c3f7c146f70b6be838ddbb2d (diff)
tdf#39440: fix several warnings reported by cppcheck
Change-Id: I560d28b7cc67740c6479494d0e5aa62d2ac6ffae Reviewed-on: https://gerrit.libreoffice.org/19587 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_mips/cpp2uno.cxx2
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_sparc/cpp2uno.cxx2
-rw-r--r--bridges/test/testoffice.cxx2
-rw-r--r--comphelper/source/misc/configuration.cxx3
-rw-r--r--compilerplugins/clang/automem.cxx2
-rw-r--r--compilerplugins/clang/badvectorinit.cxx2
-rw-r--r--compilerplugins/clang/staticmethods.cxx2
-rw-r--r--cui/source/options/optlingu.cxx9
-rw-r--r--drawinglayer/source/processor2d/vclprocessor2d.cxx4
-rw-r--r--drawinglayer/source/texture/texture.cxx4
-rw-r--r--dtrans/source/win32/workbench/test_wincb.cxx2
-rw-r--r--dtrans/source/win32/workbench/testmarshal.cxx2
-rw-r--r--dtrans/test/win32/dnd/atlwindow.cxx1
-rw-r--r--jvmfwk/source/fwkutil.cxx4
-rw-r--r--sal/osl/w32/profile.cxx2
15 files changed, 21 insertions, 22 deletions
diff --git a/bridges/source/cpp_uno/gcc3_linux_mips/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_mips/cpp2uno.cxx
index 167b4ade539f..6e0a7dc72eb3 100644
--- a/bridges/source/cpp_uno/gcc3_linux_mips/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_mips/cpp2uno.cxx
@@ -385,7 +385,7 @@ namespace
#ifdef BRDEBUG
fprintf(stderr,"cpp_mediate1 gp=%p,fp=%p,ov=%p\n",gpreg,fpreg,ovrflw);
- fprintf(stderr,"gp=%x,%x,%x,%x\n",gpreg[0],gpreg[1],gpreg[2],gpreg[3]);
+ fprintf(stderr,"gp=%p,%p,%p,%p\n",gpreg[0],gpreg[1],gpreg[2],gpreg[3]);
#endif
// gpreg: [ret *], this, [other gpr params]
diff --git a/bridges/source/cpp_uno/gcc3_linux_sparc/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_sparc/cpp2uno.cxx
index 93b10de5f4a6..f0fa890496da 100644
--- a/bridges/source/cpp_uno/gcc3_linux_sparc/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_sparc/cpp2uno.cxx
@@ -377,7 +377,7 @@ void * pRegReturn = &nRegReturn;
// fprintf(stderr,"cpp_mediate nFunctionIndex=%x\n",nFunctionIndex);
// fflush(stderr);
- sal_Bool bComplex = nFunctionIndex & 0x80000000 ? sal_True : sal_False;
+ const sal_Bool bComplex = (nFunctionIndex & 0x80000000) ? sal_True : sal_False;
typelib_TypeClass aType =
cpp_mediate( nFunctionIndex, vTableOffset, pCallStack+17, (sal_Int64*)&nRegReturn );
diff --git a/bridges/test/testoffice.cxx b/bridges/test/testoffice.cxx
index 5d17a0045fa2..9e346022ad16 100644
--- a/bridges/test/testoffice.cxx
+++ b/bridges/test/testoffice.cxx
@@ -112,7 +112,7 @@ void testWriter( const Reference < XComponent > & rCmp )
printf( "pleast type any text\n" );
while( true )
{
- scanf( "%s" , pcText );
+ scanf( "%1023s" , pcText );
if( !strcmp( pcText , "end" ) )
{
diff --git a/comphelper/source/misc/configuration.cxx b/comphelper/source/misc/configuration.cxx
index ea01ceae43f0..bb0047506da1 100644
--- a/comphelper/source/misc/configuration.cxx
+++ b/comphelper/source/misc/configuration.cxx
@@ -220,8 +220,7 @@ void comphelper::ConfigurationListener::addListener(ConfigurationListenerPropert
void comphelper::ConfigurationListener::removeListener(ConfigurationListenerPropertyBase *pListener)
{
- auto it = maListeners.begin();
- it = std::find( maListeners.begin(), maListeners.end(), pListener );
+ auto it = std::find( maListeners.begin(), maListeners.end(), pListener );
if ( it != maListeners.end() )
{
maListeners.erase( it );
diff --git a/compilerplugins/clang/automem.cxx b/compilerplugins/clang/automem.cxx
index 7981c7aa4168..dfa35250895a 100644
--- a/compilerplugins/clang/automem.cxx
+++ b/compilerplugins/clang/automem.cxx
@@ -26,7 +26,7 @@ class AutoMem:
public RecursiveASTVisitor<AutoMem>, public loplugin::Plugin
{
public:
- explicit AutoMem(InstantiationData const & data): Plugin(data) {}
+ explicit AutoMem(InstantiationData const & data): Plugin(data), mbInsideDestructor(false) {}
virtual void run() override
{
diff --git a/compilerplugins/clang/badvectorinit.cxx b/compilerplugins/clang/badvectorinit.cxx
index 709a65d7b729..7f67ffc3a9b4 100644
--- a/compilerplugins/clang/badvectorinit.cxx
+++ b/compilerplugins/clang/badvectorinit.cxx
@@ -89,7 +89,7 @@ class BadVectorInit:
public RecursiveASTVisitor<BadVectorInit>, public loplugin::Plugin
{
public:
- explicit BadVectorInit(InstantiationData const & data): Plugin(data) {}
+ explicit BadVectorInit(InstantiationData const & data): Plugin(data), mbInsideFunction(false) {}
virtual void run() override
{
diff --git a/compilerplugins/clang/staticmethods.cxx b/compilerplugins/clang/staticmethods.cxx
index 42c958dc6b67..1d9313f7cbd0 100644
--- a/compilerplugins/clang/staticmethods.cxx
+++ b/compilerplugins/clang/staticmethods.cxx
@@ -21,7 +21,7 @@ class StaticMethods:
private:
bool bVisitedThis;
public:
- explicit StaticMethods(InstantiationData const & data): Plugin(data) {}
+ explicit StaticMethods(InstantiationData const & data): Plugin(data), bVisitedThis(false) {}
void run() override
{ TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); }
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index af8ce6356245..0348f2b9d7e7 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -616,17 +616,18 @@ Sequence< OUString > SvxLinguData_Impl::GetSortedImplNames( sal_Int16 nLang, sal
ServiceInfo_Impl * SvxLinguData_Impl::GetInfoByImplName( const OUString &rSvcImplName )
{
- ServiceInfo_Impl* pInfo = 0;
- for (sal_uLong i = 0; i < nDisplayServices && !pInfo; ++i)
+ for (sal_uLong i = 0; i < nDisplayServices; ++i)
{
ServiceInfo_Impl &rTmp = aDisplayServiceArr[ i ];
if (rTmp.sSpellImplName == rSvcImplName ||
rTmp.sHyphImplName == rSvcImplName ||
rTmp.sThesImplName == rSvcImplName ||
rTmp.sGrammarImplName == rSvcImplName)
- pInfo = &rTmp;
+ {
+ return &rTmp;
+ }
}
- return pInfo;
+ return 0;
}
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index a63e7e9e921e..b50c836a10e6 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -599,7 +599,7 @@ namespace drawinglayer
// offset in X, so iterate over Y first and draw lines
for(sal_Int32 nYPos(nBTop); nYPos < nOTop + nOHeight; nYPos += nBHeight, nPosY++)
{
- for(sal_Int32 nXPos(nPosY % 2 ? nBLeft - nBWidth + nOffsetX : nBLeft);
+ for(sal_Int32 nXPos((nPosY % 2) ? nBLeft - nBWidth + nOffsetX : nBLeft);
nXPos < nOLeft + nOWidth; nXPos += nBWidth)
{
const Rectangle aOutRectPixel(Point(nXPos, nYPos), aNeededBitmapSizePixel);
@@ -626,7 +626,7 @@ namespace drawinglayer
// possible offset in Y, so iterate over X first and draw columns
for(sal_Int32 nXPos(nBLeft); nXPos < nOLeft + nOWidth; nXPos += nBWidth, nPosX++)
{
- for(sal_Int32 nYPos(nPosX % 2 ? nBTop - nBHeight + nOffsetY : nBTop);
+ for(sal_Int32 nYPos((nPosX % 2) ? nBTop - nBHeight + nOffsetY : nBTop);
nYPos < nOTop + nOHeight; nYPos += nBHeight)
{
const Rectangle aOutRectPixel(Point(nXPos, nYPos), aNeededBitmapSizePixel);
diff --git a/drawinglayer/source/texture/texture.cxx b/drawinglayer/source/texture/texture.cxx
index 4ede3c19c1f4..9df695c2f6fa 100644
--- a/drawinglayer/source/texture/texture.cxx
+++ b/drawinglayer/source/texture/texture.cxx
@@ -780,7 +780,7 @@ namespace drawinglayer
{
for(double fPosX(fStartX); basegfx::fTools::less(fPosX, 1.0); fPosX += fWidth, nPosX++)
{
- for(double fPosY(nPosX % 2 ? fStartY - fHeight + (mfOffsetY * fHeight) : fStartY);
+ for(double fPosY((nPosX % 2) ? fStartY - fHeight + (mfOffsetY * fHeight) : fStartY);
basegfx::fTools::less(fPosY, 1.0); fPosY += fHeight)
{
rMatrices.push_back(
@@ -796,7 +796,7 @@ namespace drawinglayer
{
for(double fPosY(fStartY); basegfx::fTools::less(fPosY, 1.0); fPosY += fHeight, nPosY++)
{
- for(double fPosX(nPosY % 2 ? fStartX - fWidth + (mfOffsetX * fWidth) : fStartX);
+ for(double fPosX((nPosY % 2) ? fStartX - fWidth + (mfOffsetX * fWidth) : fStartX);
basegfx::fTools::less(fPosX, 1.0); fPosX += fWidth)
{
rMatrices.push_back(
diff --git a/dtrans/source/win32/workbench/test_wincb.cxx b/dtrans/source/win32/workbench/test_wincb.cxx
index 8eb355de6d7b..551b798590e5 100644
--- a/dtrans/source/win32/workbench/test_wincb.cxx
+++ b/dtrans/source/win32/workbench/test_wincb.cxx
@@ -206,7 +206,7 @@ int SAL_CALL main( int nArgc, char* Argv[] )
// threaded apartment we need a message loop to deliver
// messages to our XTDataObject
//HRESULT hr = CoInitializeEx( NULL, COINIT_MULTITHREADED );
- HRESULT hr = CoInitialize( NULL );
+ (void)CoInitialize( NULL );
char buff[6];
diff --git a/dtrans/source/win32/workbench/testmarshal.cxx b/dtrans/source/win32/workbench/testmarshal.cxx
index b3fd58f61bda..4a5de8fcad4f 100644
--- a/dtrans/source/win32/workbench/testmarshal.cxx
+++ b/dtrans/source/win32/workbench/testmarshal.cxx
@@ -68,7 +68,7 @@ unsigned int _stdcall ThreadProc(LPVOID pParam)
WaitForSingleObject( g_hEvtThreadWakeup, INFINITE );
- IDataObject* pIDo;
+ IDataObject* pIDo = NULL;
#ifdef RAW_MARSHALING
diff --git a/dtrans/test/win32/dnd/atlwindow.cxx b/dtrans/test/win32/dnd/atlwindow.cxx
index 35e2cb5b1aca..e7039e204d1d 100644
--- a/dtrans/test/win32/dnd/atlwindow.cxx
+++ b/dtrans/test/win32/dnd/atlwindow.cxx
@@ -139,7 +139,6 @@ LRESULT AWindow::OnMouseAction(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
LRESULT AWindow::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
- HRESULT hr;
USES_CONVERSION;
KillTimer( 1);
if(m_xDragSource.is())
diff --git a/jvmfwk/source/fwkutil.cxx b/jvmfwk/source/fwkutil.cxx
index a48f25faa977..53e74b2f363c 100644
--- a/jvmfwk/source/fwkutil.cxx
+++ b/jvmfwk/source/fwkutil.cxx
@@ -61,8 +61,8 @@ bool isAccessibilitySupportDesired()
sValue == "1" )
return false;
- bool retVal = false;
#ifdef WNT
+ bool retVal = false;
HKEY hKey = 0;
if (RegOpenKeyEx(HKEY_CURRENT_USER,
"Software\\LibreOffice\\Accessibility\\AtToolSupport",
@@ -104,7 +104,7 @@ bool isAccessibilitySupportDesired()
#elif defined UNX
// Java is no longer required for a11y - we use atk directly.
- retVal = ::rtl::Bootstrap::get( "JFW_PLUGIN_FORCE_ACCESSIBILITY", sValue) && sValue == "1";
+ bool retVal = ::rtl::Bootstrap::get( "JFW_PLUGIN_FORCE_ACCESSIBILITY", sValue) && sValue == "1";
#endif
return retVal;
diff --git a/sal/osl/w32/profile.cxx b/sal/osl/w32/profile.cxx
index ff7a02580d41..a3465cacabe0 100644
--- a/sal/osl/w32/profile.cxx
+++ b/sal/osl/w32/profile.cxx
@@ -392,7 +392,7 @@ static sal_Bool writeProfileImpl(osl_TFile* pFile)
bRet=WriteFile(pFile->m_Handle, pFile->m_pWriteBuf, pFile->m_nWriteBufLen - pFile->m_nWriteBufFree,&BytesWritten,NULL);
- if ( bRet == 0 || BytesWritten <= 0 )
+ if ( bRet == 0 || BytesWritten == 0 )
{
OSL_ENSURE(bRet,"WriteFile failed!!!");
OSL_TRACE("write failed '%s'",strerror(errno));