Skip to content

Commit 07ea41f

Browse files
committed
Grass plugin/provider fixes for Coverity
1 parent d3c8837 commit 07ea41f

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/plugins/grass/qgsgrassmodule.h

-3
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,6 @@ class QgsGrassModuleStandardOptions: QWidget, public QgsGrassModuleOptions
343343
//! List of all flags. Necessary for scripts.
344344
QStringList mFlagNames;
345345

346-
//! Use of region defined in qgm
347-
bool mUsesRegion;
348-
349346
// ! Advanced options switch button
350347
QPushButton mAdvancedPushButton;
351348

src/providers/grass/qgsgrassprovider.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ static QString GRASS_DESCRIPTION = "Grass provider"; // XXX verify this
7878

7979
QgsGrassProvider::QgsGrassProvider( QString uri )
8080
: QgsVectorDataProvider( uri )
81+
, mLayerField( -1 )
82+
, mLayerType( POINT )
83+
, mGrassType( 0 )
8184
, mQgisType( QGis::WKBUnknown )
8285
, mLayerId( -1 )
8386
, mMap()
@@ -119,7 +122,6 @@ QgsGrassProvider::QgsGrassProvider( QString uri )
119122
/* Parse Layer, supported layers <field>_point, <field>_line, <field>_area
120123
* Layer is opened even if it is empty (has no features)
121124
*/
122-
mLayerField = -1;
123125
if ( mLayer.compare( "boundary" ) == 0 ) // currently not used
124126
{
125127
mLayerType = BOUNDARY;

src/providers/grass/qgsgrassrasterprovider.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,11 @@ QgsGrassRasterProvider::QgsGrassRasterProvider( QString const & uri )
142142
// We have to decide some reasonable block size, not to big to occupate too much
143143
// memory, not too small to result in too many calls to readBlock -> qgis.d.rast
144144
// for statistics
145-
if ( mCols > 0 )
145+
int typeSize = dataTypeSize( dataType( 1 ) );
146+
if ( mCols > 0 && typeSize > 0 )
146147
{
147148
const int cache_size = 10000000; // ~ 10 MB
148-
mYBlockSize = cache_size / ( dataTypeSize( dataType( 1 ) ) ) / mCols;
149+
mYBlockSize = cache_size / typeSize / mCols;
149150
if ( mYBlockSize > mRows )
150151
{
151152
mYBlockSize = mRows;

0 commit comments

Comments
 (0)