With the patch it's better...
Le 13 décembre 2010 21:41, Joachim Trémouroux
<joachim.tremouroux@gmail.com>a écrit :
Hi,
Here are some various cppcheck cleanup in vcl.
Incidentally, while checking for one ccpcheck warning I have found a
duplicate definition and implementation of two classes:
PspSalInfoPrinter and PspSalPrinter are defined both in
vcl/unx/inc/salprn.h and vcl/unx/headless/svpprn.hxx
The implementation looks the same in vcl/unx/headless/svpprn.cxx and
vcl/unx/source/gdi/salprnpsp.cxx
Regards,
Joachim.
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 56bc569..e93c39d 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -2277,7 +2277,6 @@ void RadioButton::ImplInvalidateOrDrawRadioButtonState()
void RadioButton::ImplDrawRadioButtonState()
{
- USHORT nButtonStyle = 0;
BOOL bNativeOK = FALSE;
// no native drawing for image radio buttons
@@ -2325,12 +2324,12 @@ if ( bNativeOK == FALSE )
Rectangle aImageRect = maStateRect;
Size aImageSize = maImage.GetSizePixel();
BOOL bEnabled = IsEnabled();
-
+ USHORT nButtonStyle = FRAME_DRAW_DOUBLEIN;
+
aImageSize.Width() = CalcZoom( aImageSize.Width() );
aImageSize.Height() = CalcZoom( aImageSize.Height() );
// Border und Selektionsstatus ausgeben
- nButtonStyle = FRAME_DRAW_DOUBLEIN;
aImageRect = aDecoView.DrawFrame( aImageRect, nButtonStyle );
if ( (ImplGetButtonState() & BUTTON_DRAW_PRESSED) || !bEnabled )
SetFillColor( rStyleSettings.GetFaceColor() );
diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx
index da28c07..f3a7836 100644
--- a/vcl/source/control/fixed.cxx
+++ b/vcl/source/control/fixed.cxx
@@ -506,17 +506,14 @@ void FixedLine::ImplDraw( bool bLayout )
{
if( !pVector )
{
- long nX = 0;
- long nY = 0;
-
if ( nWinStyle & WB_VERT )
{
- nX = (aOutSize.Width()-1)/2;
+ long nX = (aOutSize.Width()-1)/2;
aDecoView.DrawSeparator( Point( nX, 0 ), Point( nX, aOutSize.Height()-1 ) );
}
else
{
- nY = (aOutSize.Height()-1)/2;
+ long nY = (aOutSize.Height()-1)/2;
aDecoView.DrawSeparator( Point( 0, nY ), Point( aOutSize.Width()-1, nY ), false );
}
}
diff --git a/vcl/source/gdi/bitmap2.cxx b/vcl/source/gdi/bitmap2.cxx
index b595070..f1e4a9a 100644
--- a/vcl/source/gdi/bitmap2.cxx
+++ b/vcl/source/gdi/bitmap2.cxx
@@ -308,7 +308,6 @@ BOOL Bitmap::ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal
// BITMAPCOREHEADER
sal_Int16 nTmp16 = 0;
- sal_uInt8 nTmp8 = 0;
if ( rHeader.nSize == DIBCOREHEADERSIZE )
{
@@ -319,6 +318,7 @@ BOOL Bitmap::ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal
}
else if ( bIsMSOFormat && ( rHeader.nSize == BITMAPINFOHEADER ) )
{
+ sal_uInt8 nTmp8 = 0;
rIStm >> nTmp16; rHeader.nWidth = nTmp16;
rIStm >> nTmp16; rHeader.nHeight = nTmp16;
rIStm >> nTmp8; rHeader.nPlanes = nTmp8;
diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index fcd60f2..2b3aa2f 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -966,10 +966,11 @@ BOOL Bitmap::ImplScaleFast( const double& rScaleX, const double& rScaleY )
const long nHeight1 = pReadAcc->Height() - 1L;
long* pLutX = new long[ nNewWidth ];
long* pLutY = new long[ nNewHeight ];
- long nX, nY, nMapY, nActY = 0L;
if( nNewWidth1 && nNewHeight1 )
{
+ long nX, nY, nMapY, nActY = 0L;
+
for( nX = 0L; nX < nNewWidth; nX++ )
pLutX[ nX ] = nX * nWidth1 / nNewWidth1;
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index 96bfab5..ecb29ff 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -607,10 +607,10 @@ Font OutputDevice::GetDefaultFont( USHORT nType, LanguageType eLang,
// No Name, than set all names
if ( !aFont.GetName().Len() )
{
- xub_StrLen nIndex = 0;
if ( nFlags & DEFAULTFONT_FLAGS_ONLYONE )
{
- //aFont.SetName( aSearch.GetToken( 0, ';', nIndex ) );
+ xub_StrLen nIndex = 0;
+
if( !pOutDev )
pOutDev = (const OutputDevice *)ImplGetSVData()->mpDefaultWin;
if( !pOutDev )
diff --git a/vcl/source/gdi/pngwrite.cxx b/vcl/source/gdi/pngwrite.cxx
index 4b394ae..9e5ad0a 100644
--- a/vcl/source/gdi/pngwrite.cxx
+++ b/vcl/source/gdi/pngwrite.cxx
@@ -120,7 +120,7 @@ private:
void ImplWriteChunk( BYTE nNumb );
void ImplWriteChunk( sal_uInt32 nNumb );
void ImplWriteChunk( unsigned char* pSource, sal_uInt32 nDatSize
);
- void ImplCloseChunk( void );
+ void ImplCloseChunk( void ) const;
};
// ------------------------------------------------------------------------
@@ -699,7 +699,7 @@ void PNGWriterImpl::ImplWriteChunk ( unsigned char* pSource, sal_uInt32 nDatSize
// ------------------------------------------------------------------------
// nothing to do
-void PNGWriterImpl::ImplCloseChunk ( void )
+void PNGWriterImpl::ImplCloseChunk ( void ) const
{
}
diff --git a/vcl/source/gdi/salmisc.cxx b/vcl/source/gdi/salmisc.cxx
index 9cbe0fd..9ba888f 100644
--- a/vcl/source/gdi/salmisc.cxx
+++ b/vcl/source/gdi/salmisc.cxx
@@ -213,7 +213,7 @@ static void ImplTCToTC( const BitmapBuffer& rSrcBuffer, BitmapBuffer& rDstBuffer
if( BMP_SCANLINE_FORMAT( rSrcBuffer.mnFormat ) == BMP_FORMAT_24BIT_TC_BGR )
{
BitmapColor aCol;
- BYTE* pPixel;
+ BYTE* pPixel = NULL;
for( long nActY = 0, nMapY; nActY < nHeight; nActY++ )
{
diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
index dd8dcca..67ba338 100644
--- a/vcl/source/window/dlgctrl.cxx
+++ b/vcl/source/window/dlgctrl.cxx
@@ -896,10 +896,8 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput )
BOOL Window::ImplHasDlgCtrl()
{
Window* pDlgCtrlParent;
- Window* pDlgCtrl;
// lookup window for dialog control
- pDlgCtrl = this;
pDlgCtrlParent = ImplGetParent();
while ( pDlgCtrlParent &&
!pDlgCtrlParent->ImplIsOverlapWindow() &&
diff --git a/vcl/unx/source/app/i18n_ic.cxx b/vcl/unx/source/app/i18n_ic.cxx
index 5a50b6a..22f7b1e 100644
--- a/vcl/unx/source/app/i18n_ic.cxx
+++ b/vcl/unx/source/app/i18n_ic.cxx
@@ -559,14 +559,14 @@ SalI18N_InputContext::IsSupportedIMStyle( XIMStyle nStyle ) const
Bool
SalI18N_InputContext::SupportInputMethodStyle( XIMStyles *pIMStyles )
{
- int nBestScore = 0;
- int nActualScore = 0;
-
mnPreeditStyle = 0;
mnStatusStyle = 0;
if ( pIMStyles != NULL )
{
+ int nBestScore = 0;
+ int nActualScore = 0;
+
// check whether the XIM supports one of the desired styles
// only a single preedit and a single status style must occure
// in a inpuut method style. Hideki said so, so i trust him
diff --git a/vcl/unx/source/dtrans/X11_selection.cxx b/vcl/unx/source/dtrans/X11_selection.cxx
index ba76524..8e155e3 100644
--- a/vcl/unx/source/dtrans/X11_selection.cxx
+++ b/vcl/unx/source/dtrans/X11_selection.cxx
@@ -1039,7 +1039,6 @@ bool SelectionManager::getPasteData( Atom selection, Atom type, Sequence<
sal_In
bool SelectionManager::getPasteData( Atom selection, const ::rtl::OUString& rType, Sequence<
sal_Int8 >& rData )
{
- int nFormat;
bool bSuccess = false;
::std::hash_map< Atom, Selection* >::iterator it;
@@ -1223,6 +1222,7 @@ bool SelectionManager::getPasteData( Atom selection, const ::rtl::OUString&
rTyp
if( ! bSuccess )
{
+ int nFormat;
::std::list< Atom > aTypes;
convertTypeToNative( rType, selection, nFormat, aTypes );
::std::list< Atom >::const_iterator type_it;
diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index 724b630..65a416c 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -2231,12 +2231,6 @@ void UniscribeLayout::DrawText( SalGraphics& ) const
else
nBaseGlyphPos = nMinGlyphPos;
- const int* pGlyphWidths;
- if( mpJustifications )
- pGlyphWidths = mpJustifications;
- else
- pGlyphWidths = mpGlyphAdvances;
-
int i = mnMinCharPos;
while( (--i >= rVisualItem.mnMinCharPos)
&& (nBaseGlyphPos == mpLogClusters[i]) )
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.