Skip to content

Commit

Permalink
fix gcc warnings in grass provider and plugin
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@8350 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Apr 14, 2008
1 parent f361879 commit b423edd
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 32 deletions.
4 changes: 2 additions & 2 deletions src/plugins/grass/qgsgrassnewmapset.cpp
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/grass/qgsgrassplugin.cpp
Expand Up @@ -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) );
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/grass/qgsgrassregion.cpp
Expand Up @@ -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) );
Expand Down Expand Up @@ -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") );
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/grass/qgsgrassshell.cpp
Expand Up @@ -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" )
{
Expand All @@ -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];
Expand Down
40 changes: 20 additions & 20 deletions src/providers/grass/qgsgrass.cpp
Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 = "";
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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 )
{
Expand Down
8 changes: 4 additions & 4 deletions src/providers/grass/qgsgrassprovider.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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 );

Expand Down Expand Up @@ -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 );

Expand Down Expand Up @@ -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 );
Expand Down

0 comments on commit b423edd

Please sign in to comment.