Skip to content
Permalink
Browse files
fix gcc warnings in grass provider and plugin
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8350 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Apr 14, 2008
1 parent 37cb859 commit 548e680
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 32 deletions.
@@ -1359,9 +1359,9 @@ void QgsGrassNewMapset::createMapset()
// database path
QgsGrass::activeMode(); // because it calls private gsGrass::init()
#if defined(WIN32)
G__setenv( "GISDBASE", (char *) getShortPath(mDatabaseLineEdit->text()).ascii() );
G__setenv( (char *)"GISDBASE", (char *) getShortPath(mDatabaseLineEdit->text()).ascii() );
#else
G__setenv( "GISDBASE", (char *) mDatabaseLineEdit->text().ascii() );
G__setenv( (char *)"GISDBASE", (char *) mDatabaseLineEdit->text().ascii() );
#endif

QgsGrass::resetError();
@@ -565,7 +565,7 @@ void QgsGrassPlugin::displayRegion()
QgsGrass::setLocation ( gisdbase, location );

struct Cell_head window;
char *err = G__get_window ( &window, "", "WIND", (char *) mapset.latin1() );
char *err = G__get_window ( &window, (char *)"", (char *)"WIND", (char *) mapset.latin1() );

if ( err ) {
QMessageBox::warning( 0, tr("Warning"), tr("Cannot read current region: ") + QString(err) );
@@ -195,7 +195,7 @@ QgsGrassRegion::QgsGrassRegion ( QgsGrassPlugin *plugin, QgisInterface *iface,
}

QgsGrass::setLocation ( gisdbase, location );
char *err = G__get_window ( &mWindow, "", "WIND", (char *) mapset.latin1() );
char *err = G__get_window ( &mWindow, (char *)"", (char *)"WIND", (char *) mapset.latin1() );

if ( err ) {
QMessageBox::warning( 0, tr("Warning"), tr("Cannot read current region: ") + QString(err) );
@@ -452,7 +452,7 @@ void QgsGrassRegion::accept()
}

QgsGrass::setLocation ( QgsGrass::getDefaultGisdbase(), QgsGrass::getDefaultLocation() );
G__setenv( "MAPSET", (char *) QgsGrass::getDefaultMapset().latin1() );
G__setenv( (char *)"MAPSET", (char *) QgsGrass::getDefaultMapset().latin1() );

if ( G_put_window(&mWindow) == -1 ) {
QMessageBox::warning( 0, tr("Warning"), tr("Cannot write region") );
@@ -216,7 +216,7 @@ QDialog(parent), QgsGrassShellBase(), mTools(tools)
shell = "/bin/bash";
}

char *norc = "";
const char *norc = "";
QFileInfo si(shell);
if ( si.fileName() == "bash" || si.fileName() == "sh" )
{
@@ -229,12 +229,12 @@ QDialog(parent), QgsGrassShellBase(), mTools(tools)

// Warning: execle + --norc will not inherit not given variables
// -> overwrite here
char *env = "GRASS_MESSAGE_FORMAT=gui";
const char *env = "GRASS_MESSAGE_FORMAT=gui";
char *envstr = new char[strlen(env)+1];
strcpy ( envstr, env );
putenv( envstr );

putenv ( "GISRC_MODE_MEMORY" ); // unset
putenv ( (char *) "GISRC_MODE_MEMORY" ); // unset

env = "PS1=GRASS > ";
envstr = new char[strlen(env)+1];
@@ -324,12 +324,12 @@ void QgsGrass::setLocation( QString gisdbase, QString location )

// Set principal GRASS variables (in memory)
#if defined(WIN32)
G__setenv( "GISDBASE", (char *) getShortPath(gisdbase).ascii() );
G__setenv( (char *)"GISDBASE", (char *) getShortPath(gisdbase).ascii() );
#else
G__setenv( "GISDBASE", (char *) gisdbase.ascii() );
G__setenv( (char *)"GISDBASE", (char *) gisdbase.ascii() );
#endif
G__setenv( "LOCATION_NAME", (char *) location.ascii() );
G__setenv( "MAPSET", "PERMANENT"); // PERMANENT must always exist
G__setenv( (char *)"LOCATION_NAME", (char *) location.ascii() );
G__setenv( (char *)"MAPSET", (char *)"PERMANENT"); // PERMANENT must always exist

// Add all available mapsets to search path
char **ms = G_available_mapsets();
@@ -346,12 +346,12 @@ void QgsGrass::setMapset( QString gisdbase, QString location, QString mapset )

// Set principal GRASS variables (in memory)
#if defined(WIN32)
G__setenv( "GISDBASE", (char *) getShortPath(gisdbase).ascii() );
G__setenv( (char *)"GISDBASE", (char *) getShortPath(gisdbase).ascii() );
#else
G__setenv( "GISDBASE", (char *) gisdbase.ascii() );
G__setenv( (char *)"GISDBASE", (char *) gisdbase.ascii() );
#endif
G__setenv( "LOCATION_NAME", (char *) location.ascii() );
G__setenv( "MAPSET", (char *) mapset.ascii() );
G__setenv( (char *)"LOCATION_NAME", (char *) location.ascii() );
G__setenv( (char *)"MAPSET", (char *) mapset.ascii() );

// Add all available mapsets to search path
char **ms = G_available_mapsets();
@@ -554,14 +554,14 @@ QString GRASS_EXPORT QgsGrass::openMapset ( QString gisdbase, QString location,
putenv( gisrcEnvChar );

// Reinitialize GRASS
G__setenv( "GISRC", const_cast<char *>(gisrcEnv.ascii()) );
G__setenv( (char *)"GISRC", const_cast<char *>(gisrcEnv.ascii()) );
#if defined(WIN32)
G__setenv( "GISDBASE", const_cast<char *>(getShortPath(gisdbase).ascii()) );
G__setenv( (char *)"GISDBASE", const_cast<char *>(getShortPath(gisdbase).ascii()) );
#else
G__setenv( "GISDBASE", const_cast<char *>(gisdbase.ascii()) );
G__setenv( (char *)"GISDBASE", const_cast<char *>(gisdbase.ascii()) );
#endif
G__setenv( "LOCATION_NAME", const_cast<char *>(location.ascii()) );
G__setenv( "MAPSET", const_cast<char *>(mapset.ascii()) );
G__setenv( (char *)"LOCATION_NAME", const_cast<char *>(location.ascii()) );
G__setenv( (char *)"MAPSET", const_cast<char *>(mapset.ascii()) );
defaultGisdbase = gisdbase;
defaultLocation = location;
defaultMapset = mapset;
@@ -595,13 +595,13 @@ QString QgsGrass::closeMapset ( )
}
mMapsetLock = "";

putenv( "GISRC" );
putenv( (char *)"GISRC" );

// Reinitialize GRASS
G__setenv( "GISRC", "" );
G__setenv( "GISDBASE", "" );
G__setenv( "LOCATION_NAME", "" );
G__setenv( "MAPSET", "" );
G__setenv( (char *)"GISRC", (char *)"" );
G__setenv( (char *)"GISDBASE", (char *)"" );
G__setenv( (char *)"LOCATION_NAME", (char *)"" );
G__setenv( (char *)"MAPSET", (char *)"" );
defaultGisdbase = "";
defaultLocation = "";
defaultMapset = "";
@@ -893,7 +893,7 @@ bool GRASS_EXPORT QgsGrass::region( QString gisbase,
{
QgsGrass::setLocation( gisbase, location );

if ( G__get_window ( window, "", "WIND", mapset.toLocal8Bit().data() ) )
if ( G__get_window ( window, (char *)"", (char *)"WIND", mapset.toLocal8Bit().data() ) )
{
return false;
}
@@ -1027,7 +1027,7 @@ bool GRASS_EXPORT QgsGrass::mapRegion( int type, QString gisbase,
}
else if ( type == Region )
{
if ( G__get_window (window, "windows",
if ( G__get_window (window, (char *)"windows",
map.toLocal8Bit().data(),
mapset.toLocal8Bit().data() ) != NULL )
{
@@ -733,7 +733,7 @@ void QgsGrassProvider::loadAttributes ( GLAYER &layer )
#endif
dbString dbstr;
db_init_string (&dbstr);
db_set_string (&dbstr, "select * from ");
db_set_string (&dbstr, (char *)"select * from ");
db_append_string (&dbstr, layer.fieldInfo->table);

#ifdef QGISDEBUG
@@ -1076,7 +1076,7 @@ void QgsGrassProvider::updateMap ( int mapId )

// TODO: Should be done better / in other place ?
// TODO: Is it necessary for close ?
G__setenv( "MAPSET", (char *) map->mapset.ascii() );
G__setenv( (char *)"MAPSET", (char *) map->mapset.ascii() );

if ( closeMap ) Vect_close ( map->map );

@@ -1402,7 +1402,7 @@ bool QgsGrassProvider::startEdit ( void )

// Set current mapset (mapset was previously checked by isGrassEditable() )
// TODO: Should be done better / in other place ?
G__setenv( "MAPSET", (char *) map->mapset.ascii() );
G__setenv( (char *)"MAPSET", (char *) map->mapset.ascii() );

Vect_close ( map->map );

@@ -1472,7 +1472,7 @@ bool QgsGrassProvider::closeEdit ( bool newMap )
// Set current mapset (mapset was previously checked by isGrassEditable() )
// TODO: Should be done better / in other place ?
// TODO: Is it necessary for build/close ?
G__setenv( "MAPSET", (char *) map->mapset.ascii() );
G__setenv( (char *)"MAPSET", (char *) map->mapset.ascii() );

Vect_build_partial ( map->map, GV_BUILD_NONE, NULL);
Vect_build ( map->map, stderr );

0 comments on commit 548e680

Please sign in to comment.