Skip to content

Commit 8fffd53

Browse files
committed
fix size_t vs. int warnings
1 parent 029927f commit 8fffd53

File tree

6 files changed

+25
-26
lines changed

6 files changed

+25
-26
lines changed

src/analysis/openstreetmap/qgsosmdatabase.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ void QgsOSMDatabase::exportSpatiaLiteNodes( const QString& tableName, const QStr
421421
sqlite3_bind_null( stmtInsert, ++col );
422422
}
423423

424-
sqlite3_bind_blob( stmtInsert, ++col, geom->asWkb(), geom->wkbSize(), SQLITE_STATIC );
424+
sqlite3_bind_blob( stmtInsert, ++col, geom->asWkb(), (int) geom->wkbSize(), SQLITE_STATIC );
425425

426426
int insertRes = sqlite3_step( stmtInsert );
427427
if ( insertRes != SQLITE_DONE )
@@ -489,7 +489,7 @@ void QgsOSMDatabase::exportSpatiaLiteWays( bool closed, const QString& tableName
489489
sqlite3_bind_null( stmtInsert, ++col );
490490
}
491491

492-
sqlite3_bind_blob( stmtInsert, ++col, geom->asWkb(), geom->wkbSize(), SQLITE_STATIC );
492+
sqlite3_bind_blob( stmtInsert, ++col, geom->asWkb(), (int) geom->wkbSize(), SQLITE_STATIC );
493493

494494
int insertRes = sqlite3_step( stmtInsert );
495495
if ( insertRes != SQLITE_DONE )

src/core/qgsvectorfilewriter.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ OGRFeatureH QgsVectorFileWriter::createFeature( QgsFeature& feature )
669669
return 0;
670670
}
671671

672-
OGRErr err = OGR_G_ImportFromWkb( mGeom2, const_cast<unsigned char *>( geom->asWkb() ), geom->wkbSize() );
672+
OGRErr err = OGR_G_ImportFromWkb( mGeom2, const_cast<unsigned char *>( geom->asWkb() ), (int) geom->wkbSize() );
673673
if ( err != OGRERR_NONE )
674674
{
675675
mErrorMessage = QObject::tr( "Feature geometry not imported (OGR error: %1)" )
@@ -685,7 +685,7 @@ OGRFeatureH QgsVectorFileWriter::createFeature( QgsFeature& feature )
685685
}
686686
else if ( geom )
687687
{
688-
OGRErr err = OGR_G_ImportFromWkb( mGeom, const_cast<unsigned char *>( geom->asWkb() ), geom->wkbSize() );
688+
OGRErr err = OGR_G_ImportFromWkb( mGeom, const_cast<unsigned char *>( geom->asWkb() ), (int) geom->wkbSize() );
689689
if ( err != OGRERR_NONE )
690690
{
691691
mErrorMessage = QObject::tr( "Feature geometry not imported (OGR error: %1)" )

src/core/raster/qgsrasterblock.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ bool QgsRasterBlock::isNoData( size_t index )
324324
return false;
325325
}
326326
// TODO: optimize
327-
int row = index / mWidth;
327+
int row = (int) index / mWidth;
328328
int column = index % mWidth;
329329
size_t byte = ( size_t )row * mNoDataBitmapWidth + column / 8 ;
330330
int bit = column % 8;
@@ -406,7 +406,7 @@ bool QgsRasterBlock::setIsNoData( size_t index )
406406
}
407407
}
408408
// TODO: optimize
409-
int row = index / mWidth;
409+
int row = (int) index / mWidth;
410410
int column = index % mWidth;
411411
size_t byte = ( size_t )row * mNoDataBitmapWidth + column / 8;
412412
int bit = column % 8;

src/plugins/grass/qgsgrassedit.cpp

+4-5
Original file line numberDiff line numberDiff line change
@@ -572,12 +572,11 @@ void QgsGrassEdit::setAttributeTable( int field )
572572

573573
if ( !key->isEmpty() ) // Database link defined
574574
{
575-
std::vector<QgsField> *cols = mProvider->columns( field );
575+
QVector<QgsField> *cols = mProvider->columns( field );
576576

577577
mAttributeTable->setRowCount( cols->size() );
578578

579-
580-
for ( unsigned int c = 0; c < cols->size(); c++ )
579+
for ( int c = 0; c < cols->size(); c++ )
581580
{
582581
QgsField col = ( *cols )[c];
583582

@@ -1463,7 +1462,7 @@ void QgsGrassEdit::addAttributes( int field, int cat )
14631462

14641463
if ( !key->isEmpty() ) // Database link defined
14651464
{
1466-
std::vector<QgsField> *cols = mProvider->columns( field );
1465+
QVector<QgsField> *cols = mProvider->columns( field );
14671466

14681467
if ( cols->size() == 0 )
14691468
{
@@ -1481,7 +1480,7 @@ void QgsGrassEdit::addAttributes( int field, int cat )
14811480
}
14821481
else
14831482
{
1484-
for ( unsigned int j = 0; j < cols->size(); j++ )
1483+
for ( int j = 0; j < cols->size(); j++ )
14851484
{
14861485
QgsField col = ( *cols )[j];
14871486
QVariant att = ( *atts )[j];

src/providers/grass/qgsgrassprovider.cpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ extern "C"
6262
#endif
6363

6464

65-
std::vector<GLAYER> QgsGrassProvider::mLayers;
66-
std::vector<GMAP> QgsGrassProvider::mMaps;
65+
QVector<GLAYER> QgsGrassProvider::mLayers;
66+
QVector<GMAP> QgsGrassProvider::mMaps;
6767

6868

6969
static QString GRASS_KEY = "grass"; // XXX verify this
@@ -370,7 +370,7 @@ int QgsGrassProvider::openLayer( QString gisdbase, QString location, QString map
370370

371371
// Check if this layer is already opened
372372

373-
for ( unsigned int i = 0; i < mLayers.size(); i++ )
373+
for ( int i = 0; i < mLayers.size(); i++ )
374374
{
375375
if ( !( mLayers[i].valid ) )
376376
continue;
@@ -719,7 +719,7 @@ int QgsGrassProvider::openMap( QString gisdbase, QString location, QString mapse
719719
QString tmpPath = gisdbase + "/" + location + "/" + mapset + "/" + mapName;
720720

721721
// Check if this map is already opened
722-
for ( unsigned int i = 0; i < mMaps.size(); i++ )
722+
for ( int i = 0; i < mMaps.size(); i++ )
723723
{
724724
if ( mMaps[i].valid && mMaps[i].path == tmpPath )
725725
{
@@ -869,7 +869,7 @@ void QgsGrassProvider::updateMap( int mapId )
869869
QgsDebugMsg( QString( "Cannot reopen GRASS vector: %1" ).arg( e.what() ) );
870870

871871
// if reopen fails, mLayers should be also updated
872-
for ( unsigned int i = 0; i < mLayers.size(); i++ )
872+
for ( int i = 0; i < mLayers.size(); i++ )
873873
{
874874
if ( mLayers[i].mapId == mapId )
875875
{
@@ -881,7 +881,7 @@ void QgsGrassProvider::updateMap( int mapId )
881881

882882
QgsDebugMsg( "GRASS map successfully reopened for reading." );
883883

884-
for ( unsigned int i = 0; i < mLayers.size(); i++ )
884+
for ( int i = 0; i < mLayers.size(); i++ )
885885
{
886886
// if ( !(mLayers[i].valid) )
887887
// continue; // ?
@@ -1365,7 +1365,7 @@ bool QgsGrassProvider::reopenMap()
13651365
QgsDebugMsg( "GRASS map successfully reopened for reading." );
13661366

13671367
// Reload sources to layers
1368-
for ( unsigned int i = 0; i < mLayers.size(); i++ )
1368+
for ( int i = 0; i < mLayers.size(); i++ )
13691369
{
13701370
// if ( !(mLayers[i].valid) )
13711371
// continue; // ?
@@ -1609,19 +1609,19 @@ QString *QgsGrassProvider::key( int field )
16091609
return key;
16101610
}
16111611

1612-
std::vector<QgsField> *QgsGrassProvider::columns( int field )
1612+
QVector<QgsField> *QgsGrassProvider::columns( int field )
16131613
{
16141614
QgsDebugMsg( QString( "field = %1" ).arg( field ) );
16151615

1616-
std::vector<QgsField> *col = new std::vector<QgsField>;
1616+
QVector<QgsField> *col = new QVector<QgsField>;
16171617

16181618
struct field_info *fi = Vect_get_field( mMap, field ); // should work also with field = 0
16191619

16201620
// Read attributes
16211621
if ( !fi )
16221622
{
16231623
QgsDebugMsg( "No field info -> no attributes" );
1624-
return ( col );
1624+
return col;
16251625
}
16261626

16271627
QgsDebugMsg( "Field info found -> open database" );
@@ -1631,7 +1631,7 @@ std::vector<QgsField> *QgsGrassProvider::columns( int field )
16311631
if ( !driver )
16321632
{
16331633
QgsDebugMsg( QString( "Cannot open database %1 by driver %2" ).arg( fi->database ).arg( fi->driver ) );
1634-
return ( col );
1634+
return col;
16351635
}
16361636

16371637
QgsDebugMsg( "Database opened -> describe table" );
@@ -1644,7 +1644,7 @@ std::vector<QgsField> *QgsGrassProvider::columns( int field )
16441644
if ( db_describe_table( driver, &tableName, &table ) != DB_OK )
16451645
{
16461646
QgsDebugMsg( "Cannot describe table" );
1647-
return ( col );
1647+
return col;
16481648
}
16491649

16501650
int nCols = db_get_table_number_of_columns( table );

src/providers/grass/qgsgrassprovider.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ class GRASS_LIB_EXPORT QgsGrassProvider : public QgsVectorDataProvider
352352
* @param cat
353353
* @return vector of attributes
354354
*/
355-
std::vector<QgsField> *columns( int field );
355+
QVector<QgsField> *columns( int field );
356356

357357
/** Read attributes from DB
358358
* @param field
@@ -640,8 +640,8 @@ class GRASS_LIB_EXPORT QgsGrassProvider : public QgsVectorDataProvider
640640
void ensureUpdated();
641641

642642
/* Static arrays of opened layers and vectors */
643-
static std::vector<GLAYER> mLayers; // Map + field/attributes
644-
static std::vector<GMAP> mMaps; // Map
643+
static QVector<GLAYER> mLayers; // Map + field/attributes
644+
static QVector<GMAP> mMaps; // Map
645645

646646
friend class QgsGrassFeatureIterator;
647647
QSet< QgsGrassFeatureIterator *> mActiveIterators;

0 commit comments

Comments
 (0)