diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2015-01-17 01:36:45 +0100 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-01-19 06:48:42 +0000 |
commit | f5f7a69628ad316298febe7b51234428a7896ff9 (patch) | |
tree | 7a5fedc897db12840a3f560a8564bb05028c60a5 /vcl/unx | |
parent | 5f01eb5d7a3927d31b7dd268562a59e3dacdd8e8 (diff) |
fdo#39440 vcl: reduce scope of local variables
This addresses some cppcheck warnings.
Change-Id: Ia3910e7f1b33d16866b7e606fd648f152f9fe67a
Reviewed-on: https://gerrit.libreoffice.org/13971
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/generic/app/salinst.cxx | 3 | ||||
-rw-r--r-- | vcl/unx/generic/printer/ppdparser.cxx | 8 | ||||
-rw-r--r-- | vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx | 3 |
3 files changed, 5 insertions, 9 deletions
diff --git a/vcl/unx/generic/app/salinst.cxx b/vcl/unx/generic/app/salinst.cxx index 55c645e85aad..aced86b81ed8 100644 --- a/vcl/unx/generic/app/salinst.cxx +++ b/vcl/unx/generic/app/salinst.cxx @@ -202,13 +202,12 @@ static void getServerDirectories( std::list< OString >& o_rFontPaths ) if( pPipe ) { char line[1024]; - char* pSearch; while( fgets( line, sizeof(line), pPipe ) ) { int nLen = strlen( line ); if( line[nLen-1] == '\n' ) line[nLen-1] = 0; - pSearch = strstr( line, ": " ); + char* pSearch = strstr( line, ": " ); if( pSearch ) aLines.push_back( pSearch+2 ); } diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx index 4ee389592c6b..c2ec2a0db43f 100644 --- a/vcl/unx/generic/printer/ppdparser.cxx +++ b/vcl/unx/generic/printer/ppdparser.cxx @@ -929,12 +929,11 @@ void PPDParser::parse( ::std::list< OString >& rLines ) { //fdo#43049 very basic support for Custom entries, we ignore the //validation params and types - PPDKey* pKey = NULL; OUString aUniKey(OStringToOUString(aKey, RTL_TEXTENCODING_MS_1252)); keyit = m_aKeys.find( aUniKey ); if(keyit != m_aKeys.end()) { - pKey = keyit->second; + PPDKey* pKey = keyit->second; pKey->insertValue("Custom", eInvocation, true); } continue; @@ -1362,14 +1361,13 @@ OUString PPDParser::matchPaper( int nWidth, int nHeight ) const return OUString(); int nPDim = -1; - double PDWidth, PDHeight; double fSort = 2e36, fNewSort; for( int i = 0; i < m_pPaperDimensions->countValues(); i++ ) { OUString aArea = m_pPaperDimensions->getValue( i )->m_aValue; - PDWidth = StringToDouble( GetCommandLineToken( 0, aArea ) ); - PDHeight = StringToDouble( GetCommandLineToken( 1, aArea ) ); + double PDWidth = StringToDouble( GetCommandLineToken( 0, aArea ) ); + double PDHeight = StringToDouble( GetCommandLineToken( 1, aArea ) ); PDWidth /= (double)nWidth; PDHeight /= (double)nHeight; if( PDWidth >= 0.9 && PDWidth <= 1.1 && diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx index a9c42cf90576..7a613a760b6e 100644 --- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx +++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx @@ -232,12 +232,11 @@ SalGtkFilePicker::SalGtkFilePicker( const uno::Reference< uno::XComponentContext gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(m_pFilterView), false); gtk_tree_view_set_rules_hint (GTK_TREE_VIEW(m_pFilterView), true); - GtkTreeViewColumn *column; GtkCellRenderer *cell; for (i = 0; i < 2; ++i) { - column = gtk_tree_view_column_new (); + GtkTreeViewColumn *column = gtk_tree_view_column_new (); cell = gtk_cell_renderer_text_new (); gtk_tree_view_column_set_expand (column, true); gtk_tree_view_column_pack_start (column, cell, false); |