[QGIS Commit] r8350 - in trunk/qgis/src: plugins/grass providers/grass

svn_qgis at osgeo.org svn_qgis at osgeo.org
Mon Apr 14 17:02:23 EDT 2008


Author: jef
Date: 2008-04-14 17:02:22 -0400 (Mon, 14 Apr 2008)
New Revision: 8350

Modified:
   trunk/qgis/src/plugins/grass/qgsgrassnewmapset.cpp
   trunk/qgis/src/plugins/grass/qgsgrassplugin.cpp
   trunk/qgis/src/plugins/grass/qgsgrassregion.cpp
   trunk/qgis/src/plugins/grass/qgsgrassshell.cpp
   trunk/qgis/src/providers/grass/qgsgrass.cpp
   trunk/qgis/src/providers/grass/qgsgrassprovider.cpp
Log:
fix gcc warnings in grass provider and plugin

Modified: trunk/qgis/src/plugins/grass/qgsgrassnewmapset.cpp
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrassnewmapset.cpp	2008-04-14 11:13:53 UTC (rev 8349)
+++ trunk/qgis/src/plugins/grass/qgsgrassnewmapset.cpp	2008-04-14 21:02:22 UTC (rev 8350)
@@ -1359,9 +1359,9 @@
     //       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();

Modified: trunk/qgis/src/plugins/grass/qgsgrassplugin.cpp
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrassplugin.cpp	2008-04-14 11:13:53 UTC (rev 8349)
+++ trunk/qgis/src/plugins/grass/qgsgrassplugin.cpp	2008-04-14 21:02:22 UTC (rev 8350)
@@ -565,7 +565,7 @@
   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) );

Modified: trunk/qgis/src/plugins/grass/qgsgrassregion.cpp
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrassregion.cpp	2008-04-14 11:13:53 UTC (rev 8349)
+++ trunk/qgis/src/plugins/grass/qgsgrassregion.cpp	2008-04-14 21:02:22 UTC (rev 8350)
@@ -195,7 +195,7 @@
   }
 
   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 @@
   }
 
   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") );

Modified: trunk/qgis/src/plugins/grass/qgsgrassshell.cpp
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrassshell.cpp	2008-04-14 11:13:53 UTC (rev 8349)
+++ trunk/qgis/src/plugins/grass/qgsgrassshell.cpp	2008-04-14 21:02:22 UTC (rev 8350)
@@ -216,7 +216,7 @@
       shell = "/bin/bash";
     }
 
-    char *norc = "";
+    const char *norc = "";
     QFileInfo si(shell);
     if ( si.fileName() ==  "bash" || si.fileName() ==  "sh" )
     { 
@@ -229,12 +229,12 @@
 
     // 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];

Modified: trunk/qgis/src/providers/grass/qgsgrass.cpp
===================================================================
--- trunk/qgis/src/providers/grass/qgsgrass.cpp	2008-04-14 11:13:53 UTC (rev 8349)
+++ trunk/qgis/src/providers/grass/qgsgrass.cpp	2008-04-14 21:02:22 UTC (rev 8350)
@@ -324,12 +324,12 @@
 
   // 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 @@
 
   // 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 @@
   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 @@
     }
     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 @@
 {
   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 @@
   } 
   else if ( type == Region )
   {
-    if (  G__get_window (window, "windows", 
+    if (  G__get_window (window, (char *)"windows", 
       map.toLocal8Bit().data(), 
       mapset.toLocal8Bit().data() ) != NULL )
     {

Modified: trunk/qgis/src/providers/grass/qgsgrassprovider.cpp
===================================================================
--- trunk/qgis/src/providers/grass/qgsgrassprovider.cpp	2008-04-14 11:13:53 UTC (rev 8349)
+++ trunk/qgis/src/providers/grass/qgsgrassprovider.cpp	2008-04-14 21:02:22 UTC (rev 8350)
@@ -733,7 +733,7 @@
 #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 @@
 
   // 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 @@
 
   // 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 @@
   // 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 );



More information about the QGIS-commit mailing list