Kaydet (Commit) 92c8d74c authored tarafından Michaël Lefèvre's avatar Michaël Lefèvre Kaydeden (comit) Caolán McNamara

CppCheck : reduce variables scope

Change-Id: Ief402017b693a4337f330fb07bb7a6dc6e749f72
Reviewed-on: https://gerrit.libreoffice.org/18753Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 3e27df10
...@@ -629,9 +629,9 @@ void DataPointItemConverter::FillSpecialItem( ...@@ -629,9 +629,9 @@ void DataPointItemConverter::FillSpecialItem(
case SCHATTR_DATADESCR_WRAP_TEXT: case SCHATTR_DATADESCR_WRAP_TEXT:
{ {
bool bValue = false;
try try
{ {
bool bValue = false;
GetPropertySet()->getPropertyValue( "TextWordWrap" ) >>= bValue; GetPropertySet()->getPropertyValue( "TextWordWrap" ) >>= bValue;
rOutItemSet.Put( SfxBoolItem( nWhichId, bValue )); rOutItemSet.Put( SfxBoolItem( nWhichId, bValue ));
} }
......
...@@ -576,9 +576,9 @@ void TextLabelItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet& r ...@@ -576,9 +576,9 @@ void TextLabelItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet& r
break; break;
case SCHATTR_DATADESCR_WRAP_TEXT: case SCHATTR_DATADESCR_WRAP_TEXT:
{ {
bool bValue = false;
try try
{ {
bool bValue = false;
GetPropertySet()->getPropertyValue( "TextWordWrap" ) >>= bValue; GetPropertySet()->getPropertyValue( "TextWordWrap" ) >>= bValue;
rOutItemSet.Put( SfxBoolItem( nWhichId, bValue )); rOutItemSet.Put( SfxBoolItem( nWhichId, bValue ));
} }
......
...@@ -381,7 +381,6 @@ MacabHeader *MacabRecords::createHeaderForRecordType(const CFArrayRef _records, ...@@ -381,7 +381,6 @@ MacabHeader *MacabRecords::createHeaderForRecordType(const CFArrayRef _records,
/* While searching through the properties for required properties, these /* While searching through the properties for required properties, these
* sal_Bools will keep track of what we have found. * sal_Bools will keep track of what we have found.
*/ */
bool bFoundProperty;
bool bFoundRequiredProperties[numRequiredProperties]; bool bFoundRequiredProperties[numRequiredProperties];
...@@ -411,8 +410,8 @@ MacabHeader *MacabRecords::createHeaderForRecordType(const CFArrayRef _records, ...@@ -411,8 +410,8 @@ MacabHeader *MacabRecords::createHeaderForRecordType(const CFArrayRef _records,
/* Determine the non-required properties... */ /* Determine the non-required properties... */
for(i = 0; i < numProperties; i++) for(i = 0; i < numProperties; i++)
{ {
bool bFoundProperty = false;
property = static_cast<CFStringRef>(CFArrayGetValueAtIndex(allProperties, i)); property = static_cast<CFStringRef>(CFArrayGetValueAtIndex(allProperties, i));
bFoundProperty = false;
for(j = 0; j < numRequiredProperties; j++) for(j = 0; j < numRequiredProperties; j++)
{ {
if(CFEqual(property, requiredProperties[j])) if(CFEqual(property, requiredProperties[j]))
......
...@@ -563,7 +563,6 @@ static void doc_iniUnoCommands () ...@@ -563,7 +563,6 @@ static void doc_iniUnoCommands ()
}; };
util::URL aCommandURL; util::URL aCommandURL;
const SfxSlot* pSlot = NULL;
SfxViewShell* pViewShell = SfxViewShell::Current(); SfxViewShell* pViewShell = SfxViewShell::Current();
SfxViewFrame* pViewFrame = pViewShell? pViewShell->GetViewFrame(): NULL; SfxViewFrame* pViewFrame = pViewShell? pViewShell->GetViewFrame(): NULL;
...@@ -579,6 +578,8 @@ static void doc_iniUnoCommands () ...@@ -579,6 +578,8 @@ static void doc_iniUnoCommands ()
for (sal_uInt32 nIterator = 0; nIterator < SAL_N_ELEMENTS(sUnoCommands); nIterator++) for (sal_uInt32 nIterator = 0; nIterator < SAL_N_ELEMENTS(sUnoCommands); nIterator++)
{ {
const SfxSlot* pSlot = NULL;
aCommandURL.Complete = sUnoCommands[nIterator]; aCommandURL.Complete = sUnoCommands[nIterator];
xParser->parseStrict(aCommandURL); xParser->parseStrict(aCommandURL);
pSlot = rSlotPool.GetUnoSlot(aCommandURL.Path); pSlot = rSlotPool.GetUnoSlot(aCommandURL.Path);
......
...@@ -105,7 +105,6 @@ child_spawn ( Args *args, sal_Bool bAllArgs, sal_Bool bWithStatus ) ...@@ -105,7 +105,6 @@ child_spawn ( Args *args, sal_Bool bAllArgs, sal_Bool bWithStatus )
rtl_uString *pApp = NULL, *pTmp = NULL; rtl_uString *pApp = NULL, *pTmp = NULL;
rtl_uString **ppArgs; rtl_uString **ppArgs;
sal_uInt32 nArgs, i; sal_uInt32 nArgs, i;
char buffer[64];
ChildInfo *info; ChildInfo *info;
int status_pipe[2]; int status_pipe[2];
oslProcessError nError; oslProcessError nError;
...@@ -136,6 +135,8 @@ child_spawn ( Args *args, sal_Bool bAllArgs, sal_Bool bWithStatus ) ...@@ -136,6 +135,8 @@ child_spawn ( Args *args, sal_Bool bAllArgs, sal_Bool bWithStatus )
if( bWithStatus ) if( bWithStatus )
{ {
char buffer[64];
/* add the pipe arg */ /* add the pipe arg */
snprintf (buffer, 63, "--splash-pipe=%d", status_pipe[1]); snprintf (buffer, 63, "--splash-pipe=%d", status_pipe[1]);
rtl_uString_newFromAscii( &pTmp, buffer ); rtl_uString_newFromAscii( &pTmp, buffer );
...@@ -754,7 +755,6 @@ void sigterm_handler(int ignored) ...@@ -754,7 +755,6 @@ void sigterm_handler(int ignored)
SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv ) SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
{ {
int fd = 0;
sal_Bool bSentArgs = sal_False; sal_Bool bSentArgs = sal_False;
const char* pUsePlugin; const char* pUsePlugin;
rtl_uString *pPipePath = NULL; rtl_uString *pPipePath = NULL;
...@@ -794,6 +794,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv ) ...@@ -794,6 +794,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
if ( !args->bInhibitPipe ) if ( !args->bInhibitPipe )
{ {
int fd = 0;
pPipePath = get_pipe_path( args->pAppPath ); pPipePath = get_pipe_path( args->pAppPath );
if ( ( fd = connect_pipe( pPipePath ) ) >= 0 ) if ( ( fd = connect_pipe( pPipePath ) ) >= 0 )
......
...@@ -596,9 +596,6 @@ namespace drawinglayer ...@@ -596,9 +596,6 @@ namespace drawinglayer
// tetxture parameters // tetxture parameters
double fInvTexHeight(1.0); double fInvTexHeight(1.0);
double fTexHeightPos(0.0);
double fTexStart(0.0);
double fTexStop(1.0);
::std::vector<double> aTexHeightArray; ::std::vector<double> aTexHeightArray;
basegfx::B3DRange aTexRangeFront; basegfx::B3DRange aTexRangeFront;
basegfx::B3DRange aTexRangeBack; basegfx::B3DRange aTexRangeBack;
...@@ -640,6 +637,7 @@ namespace drawinglayer ...@@ -640,6 +637,7 @@ namespace drawinglayer
{ {
for(a = 0L; a < nLoopCount; a++) for(a = 0L; a < nLoopCount; a++)
{ {
double fTexHeightPos(0.0);
const Slice3D& rSliceA(rSliceVector[a]); const Slice3D& rSliceA(rSliceVector[a]);
const Slice3D& rSliceB(rSliceVector[(a + 1L) % nNumSlices]); const Slice3D& rSliceB(rSliceVector[(a + 1L) % nNumSlices]);
const bool bAcceptPair(SLICETYPE3D_REGULAR == rSliceA.getSliceType() && SLICETYPE3D_REGULAR == rSliceB.getSliceType()); const bool bAcceptPair(SLICETYPE3D_REGULAR == rSliceA.getSliceType() && SLICETYPE3D_REGULAR == rSliceB.getSliceType());
...@@ -648,6 +646,9 @@ namespace drawinglayer ...@@ -648,6 +646,9 @@ namespace drawinglayer
if(bAcceptPair) if(bAcceptPair)
{ {
double fTexStart(0.0);
double fTexStop(1.0);
if(bCreateNormals) if(bCreateNormals)
{ {
impCreateInBetweenNormals(aPolB, aPolA, bSmoothHorizontalNormals); impCreateInBetweenNormals(aPolB, aPolA, bSmoothHorizontalNormals);
......
...@@ -870,9 +870,9 @@ bool SvxNumRule::UnLinkGraphics() ...@@ -870,9 +870,9 @@ bool SvxNumRule::UnLinkGraphics()
{ {
SvxNumberFormat aFmt(GetLevel(i)); SvxNumberFormat aFmt(GetLevel(i));
const SvxBrushItem* pBrush = aFmt.GetBrush(); const SvxBrushItem* pBrush = aFmt.GetBrush();
const Graphic* pGraphic = NULL;
if(SVX_NUM_BITMAP == aFmt.GetNumberingType()) if(SVX_NUM_BITMAP == aFmt.GetNumberingType())
{ {
const Graphic* pGraphic = NULL;
if(pBrush && if(pBrush &&
!pBrush->GetGraphicLink().isEmpty() && !pBrush->GetGraphicLink().isEmpty() &&
0 != (pGraphic = pBrush->GetGraphic())) 0 != (pGraphic = pBrush->GetGraphic()))
......
...@@ -446,7 +446,6 @@ void SvxRTFParser::ReadColorTable() ...@@ -446,7 +446,6 @@ void SvxRTFParser::ReadColorTable()
void SvxRTFParser::ReadFontTable() void SvxRTFParser::ReadFontTable()
{ {
int nToken = 0;
int _nOpenBrakets = 1; // the first was already detected earlier!! int _nOpenBrakets = 1; // the first was already detected earlier!!
std::unique_ptr<vcl::Font> pFont(new vcl::Font); std::unique_ptr<vcl::Font> pFont(new vcl::Font);
short nFontNo(0), nInsFontNo (0); short nFontNo(0), nInsFontNo (0);
...@@ -459,6 +458,7 @@ void SvxRTFParser::ReadFontTable() ...@@ -459,6 +458,7 @@ void SvxRTFParser::ReadFontTable()
while( _nOpenBrakets && IsParserWorking() ) while( _nOpenBrakets && IsParserWorking() )
{ {
int nToken = 0;
bool bCheckNewFont = false; bool bCheckNewFont = false;
switch( ( nToken = GetNextToken() )) switch( ( nToken = GetNextToken() ))
{ {
...@@ -593,10 +593,11 @@ void SvxRTFParser::ReadOLEData() ...@@ -593,10 +593,11 @@ void SvxRTFParser::ReadOLEData()
OUString& SvxRTFParser::GetTextToEndGroup( OUString& rStr ) OUString& SvxRTFParser::GetTextToEndGroup( OUString& rStr )
{ {
rStr.clear(); rStr.clear();
int _nOpenBrakets = 1, nToken = 0; // the first was already detected earlier!! int _nOpenBrakets = 1; // the first was already detected earlier!!
while( _nOpenBrakets && IsParserWorking() ) while( _nOpenBrakets && IsParserWorking() )
{ {
int nToken = 0;
switch( nToken = GetNextToken() ) switch( nToken = GetNextToken() )
{ {
case '}': --_nOpenBrakets; break; case '}': --_nOpenBrakets; break;
...@@ -653,7 +654,7 @@ util::DateTime SvxRTFParser::GetDateTimeStamp( ) ...@@ -653,7 +654,7 @@ util::DateTime SvxRTFParser::GetDateTimeStamp( )
void SvxRTFParser::ReadInfo( const sal_Char* pChkForVerNo ) void SvxRTFParser::ReadInfo( const sal_Char* pChkForVerNo )
{ {
int _nOpenBrakets = 1, nToken = 0; // the first was already detected earlier!! int _nOpenBrakets = 1; // the first was already detected earlier!!
DBG_ASSERT(m_xDocProps.is(), DBG_ASSERT(m_xDocProps.is(),
"SvxRTFParser::ReadInfo: no DocumentProperties"); "SvxRTFParser::ReadInfo: no DocumentProperties");
OUString sStr, sComment; OUString sStr, sComment;
...@@ -661,6 +662,7 @@ void SvxRTFParser::ReadInfo( const sal_Char* pChkForVerNo ) ...@@ -661,6 +662,7 @@ void SvxRTFParser::ReadInfo( const sal_Char* pChkForVerNo )
while( _nOpenBrakets && IsParserWorking() ) while( _nOpenBrakets && IsParserWorking() )
{ {
int nToken = 0;
switch( nToken = GetNextToken() ) switch( nToken = GetNextToken() )
{ {
case '}': --_nOpenBrakets; break; case '}': --_nOpenBrakets; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment