[Libreoffice-commits] core.git: filter/source framework/source hwpfilter/source idlc/source jvmfwk/plugins l10ntools/source onlineupdate/source
Michael Weghorn
m.weghorn at posteo.de
Sat Aug 22 06:02:34 PDT 2015
filter/source/msfilter/escherex.cxx | 19 ++++++++--------
filter/source/svg/svgexport.cxx | 9 ++++---
framework/source/classes/menumanager.cxx | 3 --
hwpfilter/source/grammar.cxx | 5 +---
hwpfilter/source/hwpeq.cxx | 2 -
idlc/source/astscope.cxx | 6 +----
jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx | 2 -
jvmfwk/plugins/sunmajor/pluginlib/util.cxx | 2 -
l10ntools/source/xmlparse.cxx | 3 --
onlineupdate/source/update/updater/archivereader.cxx | 4 +--
onlineupdate/source/update/updater/nsWindowsRestart.cxx | 2 -
11 files changed, 27 insertions(+), 30 deletions(-)
New commits:
commit 25accda781bc0bc79ca2e887c54ca981068bf407
Author: Michael Weghorn <m.weghorn at posteo.de>
Date: Sat Aug 22 11:58:11 2015 +0200
tdf#39440 reduce scope of local variables
This addresses some cppcheck warnings.
Change-Id: I6ab170c4426494ab9fc53017f88e47fbfdbd9aad
Reviewed-on: https://gerrit.libreoffice.org/17920
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index c18ee94..fa693fc 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -1423,25 +1423,26 @@ bool EscherPropertyContainer::CreateGraphicProperties(
bool bRetValue = false;
bool bCreateFillStyles = false;
- bool bMirrored = false;
- bool bRotate = true;
boost::scoped_ptr<GraphicAttr> pGraphicAttr;
GraphicObject aGraphicObject;
OUString aGraphicUrl;
OString aUniqueId;
- bool bIsGraphicMtf(false);
- // #121074#
- sal_Int16 nTransparency(0);
- sal_Int16 nRed(0);
- sal_Int16 nGreen(0);
- sal_Int16 nBlue(0);
- double fGamma(1.0);
::com::sun::star::drawing::BitmapMode eBitmapMode( ::com::sun::star::drawing::BitmapMode_NO_REPEAT );
::com::sun::star::uno::Any aAny;
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, rSource ) )
{
+ bool bMirrored = false;
+ bool bRotate = true;
+ bool bIsGraphicMtf = false;
+ // #121074#
+ sal_Int16 nTransparency(0);
+ sal_Int16 nRed(0);
+ sal_Int16 nGreen(0);
+ sal_Int16 nBlue(0);
+ double fGamma(1.0);
+
sal_uInt16 nAngle = 0;
if ( rSource == "MetaFile" )
{
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index b0ddc8c..d600fb9 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -1005,10 +1005,6 @@ bool SVGFilter::implGenerateMetaData()
{
bool bBackgroundVisibility = true; // default: visible
bool bBackgroundObjectsVisibility = true; // default: visible
- bool bPageNumberVisibility = false; // default: hidden
- bool bDateTimeVisibility = true; // default: visible
- bool bFooterVisibility = true; // default: visible
- bool bDateTimeFixed = true; // default: fixed
FixedDateTimeField aFixedDateTimeField;
VariableDateTimeField aVariableDateTimeField;
@@ -1024,6 +1020,11 @@ bool SVGFilter::implGenerateMetaData()
xPropSet->getPropertyValue( "IsBackgroundObjectsVisible" ) >>= bBackgroundObjectsVisibility;
if( bBackgroundObjectsVisibility ) // visibility default value: 'visible'
{
+ bool bPageNumberVisibility = false; // default: hidden
+ bool bDateTimeVisibility = true; // default: visible
+ bool bFooterVisibility = true; // default: visible
+ bool bDateTimeFixed = true; // default: fixed
+
/*
* Page Number Field
*/
diff --git a/framework/source/classes/menumanager.cxx b/framework/source/classes/menumanager.cxx
index 6e95b4c..039871d 100644
--- a/framework/source/classes/menumanager.cxx
+++ b/framework/source/classes/menumanager.cxx
@@ -539,8 +539,6 @@ void MenuManager::UpdateSpecialFileMenu( Menu* pMenu )
const sal_uInt32 nCount = aNewPickVector.size();
for ( sal_uInt32 i = 0; i < nCount; i++ )
{
- char menuShortCut[5] = "~n: ";
-
OUString aMenuShortCut;
if ( i <= 9 )
{
@@ -548,6 +546,7 @@ void MenuManager::UpdateSpecialFileMenu( Menu* pMenu )
aMenuShortCut = "1~0: ";
else
{
+ char menuShortCut[5] = "~n: ";
menuShortCut[1] = (char)( '1' + i );
aMenuShortCut = OUString::createFromAscii( menuShortCut );
}
diff --git a/hwpfilter/source/grammar.cxx b/hwpfilter/source/grammar.cxx
index 77984b9..4218546 100644
--- a/hwpfilter/source/grammar.cxx
+++ b/hwpfilter/source/grammar.cxx
@@ -1238,11 +1238,10 @@ void yyerror(const char * /*err*/)
{
// printf("REALKING ERR[%s]\n",err);
// if error, delete all nodes.
- Node *pNode = 0L;
int ncount = nodelist.size();
for( int i = 0 ; i < ncount ; i++){
- pNode = nodelist.front();
- nodelist.pop_front();
+ Node *pNode = nodelist.front();
+ nodelist.pop_front();
delete pNode;
}
top = 0L;
diff --git a/hwpfilter/source/hwpeq.cxx b/hwpfilter/source/hwpeq.cxx
index 393a6db..732b229 100644
--- a/hwpfilter/source/hwpeq.cxx
+++ b/hwpfilter/source/hwpeq.cxx
@@ -674,12 +674,12 @@ static char eq2ltxconv(MzString& sstr, istream *strm, const char *sentinel)
MzString white, token;
char key[256];
int ch, result;
- const hwpeq *eq = 0;
while( 0 != (result = next_token(white, token, strm)) ) {
if( sentinel && (result == 1) && strchr(sentinel, token[0]) )
break;
make_keyword(key, token);
+ const hwpeq *eq = 0;
if( (eq = lookup_eqn(key)) != 0 ) {
if( eq->latex )
strcpy(key, eq->latex);
diff --git a/idlc/source/astscope.cxx b/idlc/source/astscope.cxx
index c4a84c4..cd8a483 100644
--- a/idlc/source/astscope.cxx
+++ b/idlc/source/astscope.cxx
@@ -87,12 +87,11 @@ sal_uInt16 AstScope::getNodeCount(NodeType nodeType)
{
DeclList::const_iterator iter = getIteratorBegin();
DeclList::const_iterator end = getIteratorEnd();
- AstDeclaration* pDecl = NULL;
sal_uInt16 count = 0;
while ( iter != end )
{
- pDecl = *iter;
+ AstDeclaration* pDecl = *iter;
if ( pDecl->getNodeType() == nodeType )
count++;
++iter;
@@ -199,11 +198,10 @@ AstDeclaration* AstScope::lookupByNameLocal(const OString& name) const
{
DeclList::const_iterator iter(m_declarations.begin());
DeclList::const_iterator end(m_declarations.end());
- AstDeclaration* pDecl = NULL;
while ( iter != end )
{
- pDecl = *iter;
+ AstDeclaration* pDecl = *iter;
if ( pDecl->getLocalName() == name )
return pDecl;
++iter;
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index 44a9020..634f65b 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@ -117,7 +117,6 @@ OString getPluginJarPath(
}
else
{
- char sep[] = {SAL_PATHSEPARATOR, 0};
OUString sName(sLocation + "/lib/" + sName1);
OUString sPath1;
OUString sPath2;
@@ -128,6 +127,7 @@ OString getPluginJarPath(
if (osl_getSystemPathFromFileURL(sName.pData, & sPath2.pData)
== osl_File_E_None)
{
+ char sep[] = {SAL_PATHSEPARATOR, 0};
sPath = sPath1 + OUString::createFromAscii(sep) + sPath2;
}
}
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
index 9a60c3a..b378dbf 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
@@ -647,11 +647,11 @@ bool getJavaInfoFromRegistry(const wchar_t* szRegKey,
OUString usHome((sal_Unicode*) szTmpPath);
// check if there is already an entry with the same JavaHomeruntime lib
// if so, we use the one with the more accurate version
- bool bAppend= true;
OUString usHomeUrl;
if (osl_getFileURLFromSystemPath(usHome.pData, & usHomeUrl.pData) ==
osl_File_E_None)
{
+ bool bAppend= true;
//iterate over the vector with java home strings
typedef vector<OUString>::iterator ItHome;
for(ItHome itHome= vecJavaHome.begin();
diff --git a/l10ntools/source/xmlparse.cxx b/l10ntools/source/xmlparse.cxx
index 0d1d906..701848f 100644
--- a/l10ntools/source/xmlparse.cxx
+++ b/l10ntools/source/xmlparse.cxx
@@ -441,12 +441,11 @@ void XMLFile::SearchL10NElements( XMLChildNode *pCur, int nPos )
{
case XML_NODE_TYPE_FILE:
{
- XMLChildNode* pElement;
if( GetChildList())
{
for ( size_t i = 0; i < GetChildList()->size(); i++ )
{
- pElement = (*GetChildList())[ i ];
+ XMLChildNode* pElement = (*GetChildList())[ i ];
if( pElement->GetNodeType() == XML_NODE_TYPE_ELEMENT )
SearchL10NElements( pElement , i);
}
diff --git a/onlineupdate/source/update/updater/archivereader.cxx b/onlineupdate/source/update/updater/archivereader.cxx
index 4629d33..a7884df 100644
--- a/onlineupdate/source/update/updater/archivereader.cxx
+++ b/onlineupdate/source/update/updater/archivereader.cxx
@@ -273,7 +273,7 @@ ArchiveReader::ExtractItemToStream(const MarItem *item, FILE *fp)
/* decompress the data chunk by chunk */
bz_stream strm;
- int offset, inlen, outlen, ret = OK;
+ int offset, inlen, ret = OK;
memset(&strm, 0, sizeof(strm));
if (BZ2_bzDecompressInit(&strm, 0, 0) != BZ_OK)
@@ -304,7 +304,7 @@ ArchiveReader::ExtractItemToStream(const MarItem *item, FILE *fp)
break;
}
- outlen = outbuf_size - strm.avail_out;
+ int outlen = outbuf_size - strm.avail_out;
if (outlen) {
if (fwrite(outbuf, outlen, 1, fp) != 1) {
ret = WRITE_ERROR_EXTRACT;
diff --git a/onlineupdate/source/update/updater/nsWindowsRestart.cxx b/onlineupdate/source/update/updater/nsWindowsRestart.cxx
index 5ecf70e..fbc9b86 100644
--- a/onlineupdate/source/update/updater/nsWindowsRestart.cxx
+++ b/onlineupdate/source/update/updater/nsWindowsRestart.cxx
@@ -345,7 +345,6 @@ static int ArgStrLen(const wchar_t *s)
*/
static wchar_t* ArgToString(wchar_t *d, const wchar_t *s)
{
- int backslashes = 0;
BOOL hasDoubleQuote = wcschr(s, L'"') != nullptr;
// Only add doublequotes if the string contains a space or a tab
BOOL addDoubleQuotes = wcspbrk(s, L" \t") != nullptr;
@@ -356,6 +355,7 @@ static wchar_t* ArgToString(wchar_t *d, const wchar_t *s)
}
if (hasDoubleQuote) {
+ int backslashes = 0;
int i;
while (*s) {
if (*s == '\\') {
More information about the Libreoffice-commits
mailing list