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@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
This commit is contained in:
committed by
Thorsten Behrens
parent
159bace378
commit
25accda781
@@ -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" )
|
||||
{
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 == '\\') {
|
||||
|
||||
Reference in New Issue
Block a user