Skip to content
Permalink
Browse files

fix size_t vs. int warnings

  • Loading branch information
jef-n committed Sep 6, 2013
1 parent 029927f commit 8fffd535237f22175894c665caca2f202ad46b4a
@@ -421,7 +421,7 @@ void QgsOSMDatabase::exportSpatiaLiteNodes( const QString& tableName, const QStr
sqlite3_bind_null( stmtInsert, ++col );
}

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

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

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

int insertRes = sqlite3_step( stmtInsert );
if ( insertRes != SQLITE_DONE )
@@ -669,7 +669,7 @@ OGRFeatureH QgsVectorFileWriter::createFeature( QgsFeature& feature )
return 0;
}

OGRErr err = OGR_G_ImportFromWkb( mGeom2, const_cast<unsigned char *>( geom->asWkb() ), geom->wkbSize() );
OGRErr err = OGR_G_ImportFromWkb( mGeom2, const_cast<unsigned char *>( geom->asWkb() ), (int) geom->wkbSize() );
if ( err != OGRERR_NONE )
{
mErrorMessage = QObject::tr( "Feature geometry not imported (OGR error: %1)" )
@@ -685,7 +685,7 @@ OGRFeatureH QgsVectorFileWriter::createFeature( QgsFeature& feature )
}
else if ( geom )
{
OGRErr err = OGR_G_ImportFromWkb( mGeom, const_cast<unsigned char *>( geom->asWkb() ), geom->wkbSize() );
OGRErr err = OGR_G_ImportFromWkb( mGeom, const_cast<unsigned char *>( geom->asWkb() ), (int) geom->wkbSize() );
if ( err != OGRERR_NONE )
{
mErrorMessage = QObject::tr( "Feature geometry not imported (OGR error: %1)" )
@@ -324,7 +324,7 @@ bool QgsRasterBlock::isNoData( size_t index )
return false;
}
// TODO: optimize
int row = index / mWidth;
int row = (int) index / mWidth;
int column = index % mWidth;
size_t byte = ( size_t )row * mNoDataBitmapWidth + column / 8 ;
int bit = column % 8;
@@ -406,7 +406,7 @@ bool QgsRasterBlock::setIsNoData( size_t index )
}
}
// TODO: optimize
int row = index / mWidth;
int row = (int) index / mWidth;
int column = index % mWidth;
size_t byte = ( size_t )row * mNoDataBitmapWidth + column / 8;
int bit = column % 8;
@@ -572,12 +572,11 @@ void QgsGrassEdit::setAttributeTable( int field )

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

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


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

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

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

if ( cols->size() == 0 )
{
@@ -1481,7 +1480,7 @@ void QgsGrassEdit::addAttributes( int field, int cat )
}
else
{
for ( unsigned int j = 0; j < cols->size(); j++ )
for ( int j = 0; j < cols->size(); j++ )
{
QgsField col = ( *cols )[j];
QVariant att = ( *atts )[j];
@@ -62,8 +62,8 @@ extern "C"
#endif


std::vector<GLAYER> QgsGrassProvider::mLayers;
std::vector<GMAP> QgsGrassProvider::mMaps;
QVector<GLAYER> QgsGrassProvider::mLayers;
QVector<GMAP> QgsGrassProvider::mMaps;


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

// Check if this layer is already opened

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

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

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

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

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

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

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

std::vector<QgsField> *col = new std::vector<QgsField>;
QVector<QgsField> *col = new QVector<QgsField>;

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

// Read attributes
if ( !fi )
{
QgsDebugMsg( "No field info -> no attributes" );
return ( col );
return col;
}

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

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

int nCols = db_get_table_number_of_columns( table );
@@ -352,7 +352,7 @@ class GRASS_LIB_EXPORT QgsGrassProvider : public QgsVectorDataProvider
* @param cat
* @return vector of attributes
*/
std::vector<QgsField> *columns( int field );
QVector<QgsField> *columns( int field );

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

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

friend class QgsGrassFeatureIterator;
QSet< QgsGrassFeatureIterator *> mActiveIterators;

0 comments on commit 8fffd53

Please sign in to comment.
You can’t perform that action at this time.