[GRASS-SVN] r34539 - in grass/trunk: db/drivers/mysql
display/d.labels display/d.nviz general/g.copy
general/g.filename general/g.findfile general/g.gisenv
general/g.gui general/g.list general/g.mapset
general/g.mapsets general/g.mlist general/g.mremove
general/g.proj general/g.region general/g.remove
general/g.rename gui/wxpython/nviz imagery/i.atcorr
imagery/i.find imagery/i.gensig imagery/i.gensigset
imagery/i.group imagery/i.his.rgb imagery/i.pca
imagery/i.rgb.his imagery/i.smap/shapiro imagery/i.zc include
lib/form lib/g3d lib/gis lib/init lib/manage lib/proj
lib/rst/interp_float lib/sites lib/symbol lib/vector/Vlib
lib/vector/diglib ps/ps.map raster/r.buffer raster/r.carve
raster/r.category raster/r.coin raster/r.colors raster/r.cost
raster/r.cross raster/r.distance raster/r.fill.dir
raster/r.flow raster/r.in.arc raster/r.in.ascii
raster/r.in.bin raster/r.in.gridatb raster/r.in.mat
raster/r.info raster/r.kappa raster/r.li/r.li.cwed
raster/r.li/r.li.daemon raster/r.li/r.li.dominance
raster/r.li/r.li.edgedensity raster/r.li/r.li.mpa
raster/r.li/r.li.mps raster/r.li/r.li.padcv
raster/r.li/r.li.padrange raster/r.li/r.li.padsd
raster/r.li/r.li.patchdensity raster/r.li/r.li.patchnum
raster/r.li/r.li.richness raster/r.li/r.li.shannon
raster/r.li/r.li.shape raster/r.li/r.li.simpson raster/r.los
raster/r.mapcalc raster/r.null raster/r.out.gdal
raster/r.out.gridatb raster/r.out.mpeg raster/r.param.scale
raster/r.patch raster/r.reclass raster/r.region
raster/r.report raster/r.resamp.interp raster/r.resamp.stats
raster/r.slope.aspect raster/r.support raster/r.surf.contour
raster/r.surf.fractal raster/r.terraflow raster/r.to.vect
raster/r.topmodel raster/r.volume raster/r.water.outlet
raster/r.watershed/ram raster/r.watershed/seg
raster/wildfire/r.spreadpath raster3d/r3.cross.rast
raster3d/r3.mkdspf raster3d/r3.out.vtk
vector/lidar/v.lidar.correction vector/lidar/v.lidar.edgedetection
vector/lidar/v.lidar.growing vector/lidar/v.outlier
vector/lidar/v.surf.bspline vector/v.buffer2 vector/v.convert
vector/v.delaunay2 vector/v.digit vector/v.drape
vector/v.in.sites vector/v.info vector/v.lrs/v.lrs.create
vector/v.lrs/v.lrs.label vector/v.lrs/v.lrs.segment
vector/v.lrs/v.lrs.where vector/v.proj vector/v.vol.rst
visualization/nviz/src visualization/nviz2/cmd visualization/xganim
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Nov 27 11:39:39 EST 2008
Author: glynn
Date: 2008-11-27 11:39:38 -0500 (Thu, 27 Nov 2008)
New Revision: 34539
Removed:
grass/trunk/raster/r.water.outlet/legal.c
Modified:
grass/trunk/db/drivers/mysql/create_table.c
grass/trunk/db/drivers/mysql/db.c
grass/trunk/db/drivers/mysql/parse.c
grass/trunk/db/drivers/mysql/proto.h
grass/trunk/display/d.labels/main.c
grass/trunk/display/d.nviz/local.h
grass/trunk/display/d.nviz/main.c
grass/trunk/general/g.copy/copy.c
grass/trunk/general/g.filename/main.c
grass/trunk/general/g.findfile/main.c
grass/trunk/general/g.gisenv/main.c
grass/trunk/general/g.gui/main.c
grass/trunk/general/g.list/list.c
grass/trunk/general/g.mapset/main.c
grass/trunk/general/g.mapsets/dsply_path.c
grass/trunk/general/g.mapsets/main.c
grass/trunk/general/g.mlist/main.c
grass/trunk/general/g.mremove/main.c
grass/trunk/general/g.proj/output.c
grass/trunk/general/g.region/adjust.c
grass/trunk/general/g.region/local_proto.h
grass/trunk/general/g.region/main.c
grass/trunk/general/g.region/printwindow.c
grass/trunk/general/g.region/zoom.c
grass/trunk/general/g.remove/remove.c
grass/trunk/general/g.rename/rename.c
grass/trunk/gui/wxpython/nviz/load.cpp
grass/trunk/imagery/i.atcorr/main.cpp
grass/trunk/imagery/i.find/main.c
grass/trunk/imagery/i.gensig/files.h
grass/trunk/imagery/i.gensig/labels.c
grass/trunk/imagery/i.gensig/openfiles.c
grass/trunk/imagery/i.gensigset/labels.c
grass/trunk/imagery/i.gensigset/openfiles.c
grass/trunk/imagery/i.gensigset/parms.h
grass/trunk/imagery/i.group/main.c
grass/trunk/imagery/i.his.rgb/closefiles.c
grass/trunk/imagery/i.his.rgb/openfiles.c
grass/trunk/imagery/i.pca/main.c
grass/trunk/imagery/i.pca/support.c
grass/trunk/imagery/i.rgb.his/closefiles.c
grass/trunk/imagery/i.rgb.his/openfiles.c
grass/trunk/imagery/i.smap/shapiro/history.c
grass/trunk/imagery/i.smap/shapiro/local_proto.h
grass/trunk/imagery/i.smap/shapiro/opencell.c
grass/trunk/imagery/i.zc/main.c
grass/trunk/include/P_site.h
grass/trunk/include/gisdefs.h
grass/trunk/lib/form/generate.c
grass/trunk/lib/g3d/find_grid3.c
grass/trunk/lib/g3d/g3dkeys.c
grass/trunk/lib/gis/adj_cellhd.c
grass/trunk/lib/gis/align_window.c
grass/trunk/lib/gis/date.c
grass/trunk/lib/gis/datum.c
grass/trunk/lib/gis/env.c
grass/trunk/lib/gis/error.c
grass/trunk/lib/gis/find_cell.c
grass/trunk/lib/gis/find_file.c
grass/trunk/lib/gis/find_vect.c
grass/trunk/lib/gis/get_cellhd.c
grass/trunk/lib/gis/get_ellipse.c
grass/trunk/lib/gis/get_row.c
grass/trunk/lib/gis/gisbase.c
grass/trunk/lib/gis/gisdbase.c
grass/trunk/lib/gis/gisinit.c
grass/trunk/lib/gis/home.c
grass/trunk/lib/gis/key_value1.c
grass/trunk/lib/gis/key_value4.c
grass/trunk/lib/gis/legal_name.c
grass/trunk/lib/gis/ll_format.c
grass/trunk/lib/gis/location.c
grass/trunk/lib/gis/mach_name.c
grass/trunk/lib/gis/make_loc.c
grass/trunk/lib/gis/mapset.c
grass/trunk/lib/gis/mapset_nme.c
grass/trunk/lib/gis/opencell.c
grass/trunk/lib/gis/overwrite.c
grass/trunk/lib/gis/parser.c
grass/trunk/lib/gis/proj2.c
grass/trunk/lib/gis/put_title.c
grass/trunk/lib/gis/put_window.c
grass/trunk/lib/gis/rd_cellhd.c
grass/trunk/lib/gis/remove.c
grass/trunk/lib/gis/set_window.c
grass/trunk/lib/gis/whoami.c
grass/trunk/lib/init/clean_temp.c
grass/trunk/lib/manage/add_elem.c
grass/trunk/lib/manage/do_copy.c
grass/trunk/lib/manage/do_list.c
grass/trunk/lib/manage/do_remove.c
grass/trunk/lib/manage/do_rename.c
grass/trunk/lib/manage/find.c
grass/trunk/lib/manage/list.h
grass/trunk/lib/proj/convert.c
grass/trunk/lib/proj/ellipse.c
grass/trunk/lib/proj/get_proj.c
grass/trunk/lib/rst/interp_float/input2d.c
grass/trunk/lib/rst/interp_float/output2d.c
grass/trunk/lib/rst/interp_float/resout2d.c
grass/trunk/lib/sites/sites.c
grass/trunk/lib/symbol/read.c
grass/trunk/lib/vector/Vlib/open.c
grass/trunk/lib/vector/diglib/file.c
grass/trunk/ps/ps.map/colortable.h
grass/trunk/ps/ps.map/do_header.c
grass/trunk/ps/ps.map/error.c
grass/trunk/ps/ps.map/local_proto.h
grass/trunk/ps/ps.map/outl_io.c
grass/trunk/ps/ps.map/ps_info.h
grass/trunk/ps/ps.map/ps_map.c
grass/trunk/ps/ps.map/r_cell.c
grass/trunk/ps/ps.map/r_group.c
grass/trunk/ps/ps.map/r_rgb.c
grass/trunk/ps/ps.map/scan_gis.c
grass/trunk/raster/r.buffer/local_proto.h
grass/trunk/raster/r.buffer/main.c
grass/trunk/raster/r.carve/main.c
grass/trunk/raster/r.category/cats.c
grass/trunk/raster/r.category/local_proto.h
grass/trunk/raster/r.category/main.c
grass/trunk/raster/r.coin/print_hdr.c
grass/trunk/raster/r.colors/main.c
grass/trunk/raster/r.cost/main.c
grass/trunk/raster/r.cross/glob.h
grass/trunk/raster/r.cross/main.c
grass/trunk/raster/r.distance/defs.h
grass/trunk/raster/r.distance/distance.c
grass/trunk/raster/r.distance/parse.c
grass/trunk/raster/r.fill.dir/main.c
grass/trunk/raster/r.flow/io.c
grass/trunk/raster/r.in.arc/gethead.c
grass/trunk/raster/r.in.ascii/gethead.c
grass/trunk/raster/r.in.bin/main.c
grass/trunk/raster/r.in.gridatb/local_proto.h
grass/trunk/raster/r.in.gridatb/main.c
grass/trunk/raster/r.in.mat/main.c
grass/trunk/raster/r.info/main.c
grass/trunk/raster/r.kappa/kappa.h
grass/trunk/raster/r.kappa/main.c
grass/trunk/raster/r.kappa/prt_mat.c
grass/trunk/raster/r.kappa/stats.c
grass/trunk/raster/r.li/r.li.cwed/cwed.c
grass/trunk/raster/r.li/r.li.daemon/daemon.c
grass/trunk/raster/r.li/r.li.daemon/worker.c
grass/trunk/raster/r.li/r.li.dominance/dominance.c
grass/trunk/raster/r.li/r.li.edgedensity/edgedensity.c
grass/trunk/raster/r.li/r.li.mpa/mpa.c
grass/trunk/raster/r.li/r.li.mps/mps.c
grass/trunk/raster/r.li/r.li.padcv/padcv.c
grass/trunk/raster/r.li/r.li.padrange/padrange.c
grass/trunk/raster/r.li/r.li.padsd/padsd.c
grass/trunk/raster/r.li/r.li.patchdensity/main.c
grass/trunk/raster/r.li/r.li.patchnum/main.c
grass/trunk/raster/r.li/r.li.richness/richness.c
grass/trunk/raster/r.li/r.li.shannon/shannon.c
grass/trunk/raster/r.li/r.li.shape/main.c
grass/trunk/raster/r.li/r.li.simpson/simpson.c
grass/trunk/raster/r.los/main.c
grass/trunk/raster/r.mapcalc/map.c
grass/trunk/raster/r.null/local_proto.h
grass/trunk/raster/r.null/main.c
grass/trunk/raster/r.out.gdal/main.c
grass/trunk/raster/r.out.gridatb/check_ready.c
grass/trunk/raster/r.out.gridatb/file_io.c
grass/trunk/raster/r.out.gridatb/local_proto.h
grass/trunk/raster/r.out.gridatb/main.c
grass/trunk/raster/r.out.mpeg/main.c
grass/trunk/raster/r.param.scale/interface.c
grass/trunk/raster/r.param.scale/main.c
grass/trunk/raster/r.param.scale/open_files.c
grass/trunk/raster/r.param.scale/param.h
grass/trunk/raster/r.param.scale/write_cols.c
grass/trunk/raster/r.patch/support.c
grass/trunk/raster/r.reclass/main.c
grass/trunk/raster/r.reclass/parse.c
grass/trunk/raster/r.reclass/reclass.c
grass/trunk/raster/r.reclass/rule.h
grass/trunk/raster/r.reclass/stats.c
grass/trunk/raster/r.region/main.c
grass/trunk/raster/r.report/global.h
grass/trunk/raster/r.report/header.c
grass/trunk/raster/r.report/parse.c
grass/trunk/raster/r.resamp.interp/main.c
grass/trunk/raster/r.resamp.stats/main.c
grass/trunk/raster/r.slope.aspect/local_proto.h
grass/trunk/raster/r.slope.aspect/main.c
grass/trunk/raster/r.slope.aspect/opennew.c
grass/trunk/raster/r.support/main.c
grass/trunk/raster/r.surf.contour/bseg_read.c
grass/trunk/raster/r.surf.contour/bseg_write.c
grass/trunk/raster/r.surf.contour/cseg.h
grass/trunk/raster/r.surf.contour/cseg_read.c
grass/trunk/raster/r.surf.contour/cseg_write.c
grass/trunk/raster/r.surf.contour/main.c
grass/trunk/raster/r.surf.fractal/frac.h
grass/trunk/raster/r.surf.fractal/main.c
grass/trunk/raster/r.terraflow/grass2str.h
grass/trunk/raster/r.terraflow/main.cc
grass/trunk/raster/r.to.vect/main.c
grass/trunk/raster/r.topmodel/global.h
grass/trunk/raster/r.topmodel/main.c
grass/trunk/raster/r.volume/main.c
grass/trunk/raster/r.water.outlet/main.c
grass/trunk/raster/r.water.outlet/outletP.h
grass/trunk/raster/r.watershed/ram/Gwater.h
grass/trunk/raster/r.watershed/ram/init_vars.c
grass/trunk/raster/r.watershed/ram/main.c
grass/trunk/raster/r.watershed/seg/Gwater.h
grass/trunk/raster/r.watershed/seg/init_vars.c
grass/trunk/raster/r.watershed/seg/main.c
grass/trunk/raster/wildfire/r.spreadpath/main.c
grass/trunk/raster3d/r3.cross.rast/main.c
grass/trunk/raster3d/r3.mkdspf/local_proto.h
grass/trunk/raster3d/r3.mkdspf/main.c
grass/trunk/raster3d/r3.mkdspf/r3_find.c
grass/trunk/raster3d/r3.out.vtk/main.c
grass/trunk/vector/lidar/v.lidar.correction/main.c
grass/trunk/vector/lidar/v.lidar.edgedetection/main.c
grass/trunk/vector/lidar/v.lidar.growing/main.c
grass/trunk/vector/lidar/v.outlier/main.c
grass/trunk/vector/lidar/v.surf.bspline/main.c
grass/trunk/vector/v.buffer2/main.c
grass/trunk/vector/v.convert/att.c
grass/trunk/vector/v.convert/old2new.c
grass/trunk/vector/v.delaunay2/in_out.c
grass/trunk/vector/v.delaunay2/main.c
grass/trunk/vector/v.digit/generate.c
grass/trunk/vector/v.digit/main.c
grass/trunk/vector/v.digit/zoom.c
grass/trunk/vector/v.drape/main.c
grass/trunk/vector/v.drape/v.drape.html
grass/trunk/vector/v.in.sites/main.c
grass/trunk/vector/v.info/main.c
grass/trunk/vector/v.lrs/v.lrs.create/main.c
grass/trunk/vector/v.lrs/v.lrs.label/main.c
grass/trunk/vector/v.lrs/v.lrs.segment/main.c
grass/trunk/vector/v.lrs/v.lrs.where/main.c
grass/trunk/vector/v.proj/main.c
grass/trunk/vector/v.vol.rst/main.c
grass/trunk/vector/v.vol.rst/user1.c
grass/trunk/visualization/nviz/src/nviz_init.c
grass/trunk/visualization/nviz/src/pick_vect_commands.c
grass/trunk/visualization/nviz/src/query_vect.c
grass/trunk/visualization/nviz2/cmd/surface.c
grass/trunk/visualization/nviz2/cmd/vector.c
grass/trunk/visualization/xganim/Makefile
grass/trunk/visualization/xganim/main.cc
Log:
Add "const" where appropriate to libgis return types
Modified: grass/trunk/db/drivers/mysql/create_table.c
===================================================================
--- grass/trunk/db/drivers/mysql/create_table.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/db/drivers/mysql/create_table.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -20,7 +20,7 @@
{
int col, ncols;
dbColumn *column;
- char *colname;
+ const char *colname;
int sqltype;
char buf[500];
dbString sql;
Modified: grass/trunk/db/drivers/mysql/db.c
===================================================================
--- grass/trunk/db/drivers/mysql/db.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/db/drivers/mysql/db.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -21,7 +21,7 @@
int db__driver_open_database(dbHandle * handle)
{
- char *name;
+ const char *name;
dbConnection default_connection;
MYSQL *res;
@@ -38,7 +38,7 @@
{
/* Client version */
- char *user, *password;
+ const char *user, *password;
CONNPAR connpar;
if (parse_conn(name, &connpar) == DB_FAILED) {
@@ -57,9 +57,6 @@
res = mysql_real_connect(connection, connpar.host, user, password,
connpar.dbname, connpar.port, NULL, 0);
- G_free(user);
- G_free(password);
-
if (res == NULL) {
append_error(_("Cannot connect to MySQL: "));
append_error(mysql_error(connection));
Modified: grass/trunk/db/drivers/mysql/parse.c
===================================================================
--- grass/trunk/db/drivers/mysql/parse.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/db/drivers/mysql/parse.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -26,7 +26,7 @@
* \return DB_OK Success
* \return DB_FAILED Failed to parse database
*/
-int parse_conn(char *str, CONNPAR * conn)
+int parse_conn(const char *str, CONNPAR * conn)
{
int i;
char **tokens, delm[2];
Modified: grass/trunk/db/drivers/mysql/proto.h
===================================================================
--- grass/trunk/db/drivers/mysql/proto.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/db/drivers/mysql/proto.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -12,7 +12,7 @@
void field_info(MYSQL_FIELD *, int *, int *);
/* parse.c */
-int parse_conn(char *, CONNPAR *);
+int parse_conn(const char *, CONNPAR *);
/* replace.c */
int replace_variables(char *, char **, char **);
Modified: grass/trunk/display/d.labels/main.c
===================================================================
--- grass/trunk/display/d.labels/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/display/d.labels/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -28,7 +28,7 @@
{
struct Cell_head window;
char *label_name;
- char *mapset;
+ const char *mapset;
double minreg, maxreg, reg, dx, dy;
FILE *infile;
struct Option *opt1;
Modified: grass/trunk/display/d.nviz/local.h
===================================================================
--- grass/trunk/display/d.nviz/local.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/display/d.nviz/local.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -1,4 +1,4 @@
static double dist, e = 0, n = 0;
static double DIST, HT;
-int do_profile(double, double, double, double, char *, int, int);
+int do_profile(double, double, double, double, const char *, int, int);
int read_rast(double, double, double, int, int, RASTER_MAP_TYPE);
Modified: grass/trunk/display/d.nviz/main.c
===================================================================
--- grass/trunk/display/d.nviz/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/display/d.nviz/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -42,7 +42,7 @@
int main(int argc, char *argv[])
{
- char *name, *mapset;
+ const char *name, *mapset;
char outfile[GNAME_MAX];
int fd, projection;
char buf[512], buf1[1024], buf2[1024];
@@ -330,9 +330,8 @@
/* ************************************
* Claculate camera and eye coordinates
**************************************/
-int do_profile
- (double e1,
- double e2, double n1, double n2, char *name, int fd, int data_type)
+int do_profile(double e1, double e2, double n1, double n2,
+ const char *name, int fd, int data_type)
{
float rows, cols, LEN;
double Y, X, AZI;
Modified: grass/trunk/general/g.copy/copy.c
===================================================================
--- grass/trunk/general/g.copy/copy.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/general/g.copy/copy.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -26,7 +26,7 @@
int main(int argc, char *argv[])
{
int i, n;
- char *mapset;
+ const char *mapset;
struct GModule *module;
struct Option **parm, *p;
char *from, *to;
Modified: grass/trunk/general/g.filename/main.c
===================================================================
--- grass/trunk/general/g.filename/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/general/g.filename/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -25,9 +25,9 @@
int main(int argc, char *argv[])
{
char path[1024];
- char *element;
- char *mapset;
- char *name;
+ const char *element;
+ const char *mapset;
+ const char *name;
struct GModule *module;
struct Option *opt1;
struct Option *opt2;
Modified: grass/trunk/general/g.findfile/main.c
===================================================================
--- grass/trunk/general/g.findfile/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/general/g.findfile/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -23,8 +23,8 @@
int main(int argc, char *argv[])
{
- char file[GPATH_MAX], name[GNAME_MAX], *mapset;
- char *search_mapset;
+ char file[GPATH_MAX], name[GNAME_MAX];
+ const char *search_mapset, *mapset;
struct GModule *module;
struct Option *elem_opt;
struct Option *mapset_opt;
Modified: grass/trunk/general/g.gisenv/main.c
===================================================================
--- grass/trunk/general/g.gisenv/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/general/g.gisenv/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -25,7 +25,8 @@
int main(int argc, char *argv[])
{
int n, store;
- char *name, *value, *ptr;
+ const char *name, *value;
+ char *ptr;
struct Option *get, *set, *store_opt;
struct Flag *flag_s, *flag_n;
struct GModule *module;
Modified: grass/trunk/general/g.gui/main.c
===================================================================
--- grass/trunk/general/g.gui/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/general/g.gui/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -27,7 +27,7 @@
struct Option *type, *rc_file;
struct Flag *oneoff;
struct GModule *module;
- char *gui_type_env;
+ const char *gui_type_env;
char progname[GPATH_MAX];
G_gisinit(argv[0]);
Modified: grass/trunk/general/g.list/list.c
===================================================================
--- grass/trunk/general/g.list/list.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/general/g.list/list.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -31,8 +31,9 @@
{
int i, n, len;
struct GModule *module;
- struct Option *mapset;
+ struct Option *mapset_opt;
struct Flag *full;
+ const char *mapset;
char *str;
G_gisinit(argv[0]);
@@ -52,6 +53,7 @@
element->required = YES;
element->multiple = YES;
element->description = "Data type";
+
for (len = 0, n = 0; n < nlist; n++)
len += strlen(list[n].alias) + 1;
str = G_malloc(len);
@@ -66,12 +68,12 @@
}
element->options = str;
- mapset = G_define_option();
- mapset->key = "mapset";
- mapset->type = TYPE_STRING;
- mapset->required = NO;
- mapset->multiple = NO;
- mapset->description = _("Mapset to list (default: current search path)");
+ mapset_opt = G_define_option();
+ mapset_opt->key = "mapset";
+ mapset_opt->type = TYPE_STRING;
+ mapset_opt->required = NO;
+ mapset_opt->multiple = NO;
+ mapset_opt->description = _("Mapset to list (default: current search path)");
full = G_define_flag();
full->key = 'f';
@@ -80,11 +82,12 @@
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
- if (mapset->answer == NULL)
- mapset->answer = "";
+ mapset = mapset_opt->answer;
+ if (!mapset)
+ mapset = "";
- if (G_strcasecmp(mapset->answer, ".") == 0)
- mapset->answer = G_mapset();
+ if (G_strcasecmp(mapset, ".") == 0)
+ mapset = G_mapset();
i = 0;
while (element->answers[i]) {
@@ -97,12 +100,12 @@
list[n].element[0]);
G_debug(3, "lister CMD: %s", lister);
if (access(lister, 1) == 0) /* execute permission? */
- G_spawn(lister, lister, mapset->answer, NULL);
+ G_spawn(lister, lister, mapset, NULL);
else
- do_list(n, mapset->answer);
+ do_list(n, mapset);
}
else {
- do_list(n, mapset->answer);
+ do_list(n, mapset);
}
i++;
Modified: grass/trunk/general/g.mapset/main.c
===================================================================
--- grass/trunk/general/g.mapset/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/general/g.mapset/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -31,13 +31,13 @@
struct GModule *module;
struct Option *gisdbase_opt, *location_opt, *mapset_opt;
struct Flag *f_add, *f_list;
- char *gisdbase_old, *location_old, *mapset_old;
- char *gisdbase_new, *location_new, *mapset_new;
- char *gis_lock;
+ const char *gisdbase_old, *location_old, *mapset_old;
+ const char *gisdbase_new, *location_new, *mapset_new;
+ const char *gis_lock;
char *mapset_old_path, *mapset_new_path;
char *lock_prog;
+ const char *shell;
char path[GPATH_MAX];
- char *shell;
G_gisinit(argv[0]);
Modified: grass/trunk/general/g.mapsets/dsply_path.c
===================================================================
--- grass/trunk/general/g.mapsets/dsply_path.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/general/g.mapsets/dsply_path.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -7,7 +7,7 @@
int n;
int map; /* pointer into list of available mapsets */
int offset = 6; /* accounts for " <x>, " */
- char *name;
+ const char *name;
int len;
int nleft;
Modified: grass/trunk/general/g.mapsets/main.c
===================================================================
--- grass/trunk/general/g.mapsets/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/general/g.mapsets/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -40,7 +40,7 @@
int n;
int i;
int skip;
- char *cur_mapset;
+ const char *cur_mapset;
char **ptr;
char **tokens;
int no_tokens;
@@ -114,7 +114,7 @@
if (opt1->answer) {
for (ptr = opt1->answers; *ptr != NULL; ptr++) {
- char *mapset;
+ const char *mapset;
mapset = *ptr;
if (G__mapset_permissions(mapset) < 0)
@@ -127,7 +127,7 @@
/* add to existing search path */
if (opt2->answer) {
- char *oldname;
+ const char *oldname;
Path[0] = '\0';
@@ -156,7 +156,7 @@
/* remove from existing search path */
if (opt3->answer) {
- char *oldname;
+ const char *oldname;
Path[0] = '\0';
Modified: grass/trunk/general/g.mlist/main.c
===================================================================
--- grass/trunk/general/g.mlist/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/general/g.mlist/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -54,7 +54,9 @@
struct Flag *full;
} flag;
int i, n, all, num_types;
- char *pattern = NULL, *exclude = NULL, separator[2], *buf;
+ char *pattern = NULL, *exclude = NULL;
+ const char *mapset;
+ char separator[2], *buf;
regex_t regex, regex_ex;
G_gisinit(argv[0]);
@@ -186,12 +188,14 @@
separator[0] = opt.separator->answer[0];
separator[1] = 0;
- if (opt.mapset->answer == NULL)
- opt.mapset->answer = "";
+ mapset = opt.mapset->answer;
- if (G_strcasecmp(opt.mapset->answer, ".") == 0)
- opt.mapset->answer = G_mapset();
+ if (mapset == NULL)
+ mapset = "";
+ if (G_strcasecmp(mapset, ".") == 0)
+ mapset = G_mapset();
+
for (i = 0; opt.type->answers[i]; i++) {
if (strcmp(opt.type->answers[i], "all") == 0)
break;
@@ -217,12 +221,12 @@
G_debug(3, "lister CMD: %s", lister);
if (access(lister, 1) == 0) { /* execute permission? */
- G_spawn(lister, lister, opt.mapset->answer, NULL);
+ G_spawn(lister, lister, mapset, NULL);
continue;
}
}
else
- make_list(&list[n], opt.mapset->answer, separator,
+ make_list(&list[n], mapset, separator,
flag.pretty->answer, flag.type->answer,
flag.mapset->answer);
}
Modified: grass/trunk/general/g.mremove/main.c
===================================================================
--- grass/trunk/general/g.mremove/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/general/g.mremove/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -43,7 +43,8 @@
struct Flag *force;
struct Flag *basemap;
} flag;
- char *name, *mapset, *location_path, path[GPATH_MAX], **files;
+ const char *mapset, *location_path;
+ char *name, path[GPATH_MAX], **files;
char *buf, *buf2;
int num_files, rast, result = EXIT_SUCCESS;
int i, j, n;
Modified: grass/trunk/general/g.proj/output.c
===================================================================
--- grass/trunk/general/g.proj/output.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/general/g.proj/output.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -94,7 +94,8 @@
void print_proj4(int dontprettify)
{
struct pj_info pjinfo;
- char *proj4, *proj4mod, *i, *unfact;
+ char *proj4, *proj4mod, *i;
+ const char *unfact;
if (check_xy())
return;
@@ -168,7 +169,7 @@
/* Create flag given but no location specified; overwrite
* projection files for current location */
- char *mapset = G_mapset();
+ const char *mapset = G_mapset();
struct Key_Value *old_projinfo = NULL, *old_projunits = NULL;
struct Cell_head old_cellhd;
Modified: grass/trunk/general/g.region/adjust.c
===================================================================
--- grass/trunk/general/g.region/adjust.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/general/g.region/adjust.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -1,15 +1,11 @@
#include <grass/gis.h>
#include <grass/glocale.h>
+#include "local_proto.h"
-int
-adjust_window(struct Cell_head *window, int row_flag, int col_flag,
- int depth_flag)
+void adjust_window(struct Cell_head *window, int row_flag, int col_flag, int depth_flag)
{
- char *err = G_adjust_Cell_head3(window, row_flag, col_flag, depth_flag);
+ const char *err = G_adjust_Cell_head3(window, row_flag, col_flag, depth_flag);
- if (err) {
+ if (err)
G_fatal_error(_("Invalid region: %s"), err);
- }
-
- return 0;
}
Modified: grass/trunk/general/g.region/local_proto.h
===================================================================
--- grass/trunk/general/g.region/local_proto.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/general/g.region/local_proto.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -12,12 +12,12 @@
#define PRINT_NANGLE 0x100
/* adjust.c */
-int adjust_window(struct Cell_head *, int, int, int);
+void adjust_window(struct Cell_head *, int, int, int);
/* zoom.c */
-int zoom(struct Cell_head *, char *, char *);
+int zoom(struct Cell_head *, const char *, const char *);
/* printwindow.c */
-int print_window(struct Cell_head *, int);
+void print_window(struct Cell_head *, int);
#endif
Modified: grass/trunk/general/g.region/main.c
===================================================================
--- grass/trunk/general/g.region/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/general/g.region/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -21,7 +21,7 @@
#include <grass/glocale.h>
#include "local_proto.h"
-static int nsew(char *, char *, char *, char *);
+static int nsew(const char *, const char *, const char *, const char *);
static void die(struct Option *);
int main(int argc, char *argv[])
@@ -33,10 +33,10 @@
int ival;
int row_flag = 0, col_flag = 0;
struct Cell_head window, temp_window;
- char *value;
- char *name;
- char *mapset;
- char *err;
+ const char *value;
+ const char *name;
+ const char *mapset;
+ const char *err;
char **rast_ptr, **vect_ptr;
struct GModule *module;
@@ -381,7 +381,7 @@
/* region= */
if ((name = parm.region->answer)) {
- mapset = G_find_file("windows", name, "");
+ mapset = G_find_file2("windows", name, "");
if (!mapset)
G_fatal_error(_("Region <%s> not found"), name);
if (G__get_window(&window, "windows", name, mapset) != NULL)
@@ -821,7 +821,7 @@
G_fatal_error(_("Invalid input <%s=%s>"), parm->key, parm->answer);
}
-static int nsew(char *value, char *a, char *b, char *c)
+static int nsew(const char *value, const char *a, const char *b, const char *c)
{
if (strncmp(value, a, strlen(a)) == 0)
return 1;
Modified: grass/trunk/general/g.region/printwindow.c
===================================================================
--- grass/trunk/general/g.region/printwindow.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/general/g.region/printwindow.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -10,7 +10,7 @@
#define RAD2DEG(a) ((a) * 180.0 / M_PI)
-int print_window(struct Cell_head *window, int print_flag)
+void print_window(struct Cell_head *window, int print_flag)
{
const char *prj, *datum, *ellps;
int x, width = 11;
@@ -769,6 +769,4 @@
G_warning(_("Lat/Long calculations are not possible from a simple XY system"));
}
}
-
- return 0;
}
Modified: grass/trunk/general/g.region/zoom.c
===================================================================
--- grass/trunk/general/g.region/zoom.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/general/g.region/zoom.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -3,7 +3,7 @@
#include <grass/glocale.h>
#include "local_proto.h"
-int zoom(struct Cell_head *window, char *name, char *mapset)
+int zoom(struct Cell_head *window, const char *name, const char *mapset)
{
int fd;
void *raster, *rast_ptr;
Modified: grass/trunk/general/g.remove/remove.c
===================================================================
--- grass/trunk/general/g.remove/remove.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/general/g.remove/remove.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -86,8 +86,8 @@
struct GModule *module;
struct Option **parm, *p;
struct Flag *force_flag;
- char *name, *mapset;
- char *location_path;
+ const char *name, *mapset;
+ const char *location_path;
int result = EXIT_SUCCESS;
int force = 0;
Modified: grass/trunk/general/g.rename/rename.c
===================================================================
--- grass/trunk/general/g.rename/rename.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/general/g.rename/rename.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -30,7 +30,8 @@
struct Option **parm, *p;
char *old, *new;
int nrmaps;
- char *mapset, *location_path, **rmaps;
+ const char *mapset, *location_path;
+ char **rmaps;
int result = EXIT_SUCCESS;
G_gisinit(argv[0]);
Modified: grass/trunk/gui/wxpython/nviz/load.cpp
===================================================================
--- grass/trunk/gui/wxpython/nviz/load.cpp 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/gui/wxpython/nviz/load.cpp 2008-11-27 16:39:38 UTC (rev 34539)
@@ -35,7 +35,7 @@
*/
int Nviz::LoadSurface(const char* name, const char *color_name, const char *color_value)
{
- char *mapset;
+ const char *mapset;
int id;
mapset = G_find_cell2 (name, "");
@@ -121,7 +121,7 @@
int Nviz::LoadVector(const char *name, bool points)
{
int id;
- char *mapset;
+ const char *mapset;
if (GS_num_surfs() == 0) { /* load base surface if no loaded */
int *surf_list, nsurf;
Modified: grass/trunk/imagery/i.atcorr/main.cpp
===================================================================
--- grass/trunk/imagery/i.atcorr/main.cpp 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/imagery/i.atcorr/main.cpp 2008-11-27 16:39:38 UTC (rev 34539)
@@ -69,11 +69,11 @@
int mis = 0;
/* function prototypes */
-static void adjust_region (char *, char *);
+static void adjust_region (char *, const char *);
static CELL round_c (FCELL);
static void write_fp_to_cell (int, FCELL *);
static void process_raster (int, InputMask, ScaleRange, int, int, int, bool, ScaleRange, bool);
-static void copy_colors (char *, char *, char *);
+static void copy_colors (char *, const char *, char *);
static void define_module (void);
static struct Options define_options (void);
static void read_scale (Option *, ScaleRange &);
@@ -84,7 +84,7 @@
Atmospheric corrections should be done on the whole
satelite image, not just portions.
*/
-static void adjust_region (char *name, char *mapset)
+static void adjust_region (char *name, const char *mapset)
{
struct Cell_head iimg_head; /* the input image header file */
@@ -397,7 +397,7 @@
/* Copy the colors from map named iname to the map named oname */
-static void copy_colors (char *iname, char *imapset, char *oname)
+static void copy_colors (char *iname, const char *imapset, char *oname)
{
struct Colors colors;
@@ -551,7 +551,7 @@
int oimg_fd; /* output image's file descriptor */
int ialt_fd = -1; /* input elevation map's file descriptor */
int ivis_fd = -1; /* input visibility map's file descriptor */
- char *iimg_mapset, *ialt_mapset, *iviz_mapset;
+ const char *iimg_mapset, *ialt_mapset, *iviz_mapset;
/* Define module */
define_module();
Modified: grass/trunk/imagery/i.find/main.c
===================================================================
--- grass/trunk/imagery/i.find/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/imagery/i.find/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -104,7 +104,7 @@
static int find(FILE * fd, char *element)
{
int len1 = 0, len2 = 0;
- char *mapset;
+ const char *mapset;
int n;
fseek(fd, 0L, SEEK_SET);
Modified: grass/trunk/imagery/i.gensig/files.h
===================================================================
--- grass/trunk/imagery/i.gensig/files.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/imagery/i.gensig/files.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -17,6 +17,6 @@
int read_training_map(CELL *, int, int, struct files *);
#ifdef _l_parms_h
-int read_training_labels(struct parms *, struct files *);
+void read_training_labels(struct parms *, struct files *);
int openfiles(struct parms *, struct files *);
#endif
Modified: grass/trunk/imagery/i.gensig/labels.c
===================================================================
--- grass/trunk/imagery/i.gensig/labels.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/imagery/i.gensig/labels.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -2,15 +2,13 @@
#include "parms.h"
#include "files.h"
-int read_training_labels(struct parms *parms, struct files *files)
+void read_training_labels(struct parms *parms, struct files *files)
{
- char *mapset;
- char *map;
+ const char *mapset;
+ const char *map;
map = parms->training_map;
- mapset = G_find_cell(map, "");
+ mapset = G_find_cell2(map, "");
if (G_read_cats(map, mapset, &files->training_labels) < 0)
G_init_cats((CELL) 0, "", &files->training_labels);
-
- return 0;
}
Modified: grass/trunk/imagery/i.gensig/openfiles.c
===================================================================
--- grass/trunk/imagery/i.gensig/openfiles.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/imagery/i.gensig/openfiles.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -8,7 +8,7 @@
int openfiles(struct parms *parms, struct files *files)
{
struct Ref Ref; /* subgroup reference list */
- char *mapset;
+ const char *mapset;
int n;
Modified: grass/trunk/imagery/i.gensigset/labels.c
===================================================================
--- grass/trunk/imagery/i.gensigset/labels.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/imagery/i.gensigset/labels.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -2,15 +2,13 @@
#include "parms.h"
#include "files.h"
-int read_training_labels(struct parms *parms, struct files *files)
+void read_training_labels(struct parms *parms, struct files *files)
{
- char *mapset;
- char *map;
+ const char *mapset;
+ const char *map;
map = parms->training_map;
- mapset = G_find_cell(map, "");
+ mapset = G_find_cell2(map, "");
if (G_read_cats(map, mapset, &files->training_labels) < 0)
G_init_cats((CELL) 0, "", &files->training_labels);
-
- return 0;
}
Modified: grass/trunk/imagery/i.gensigset/openfiles.c
===================================================================
--- grass/trunk/imagery/i.gensigset/openfiles.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/imagery/i.gensigset/openfiles.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -7,7 +7,7 @@
int openfiles(struct parms *parms, struct files *files)
{
struct Ref Ref; /* subgroup reference list */
- char *mapset;
+ const char *mapset;
int n;
Modified: grass/trunk/imagery/i.gensigset/parms.h
===================================================================
--- grass/trunk/imagery/i.gensigset/parms.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/imagery/i.gensigset/parms.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -18,7 +18,7 @@
int get_training_classes(struct parms *, struct files *, struct SigSet *);
/* labels.c */
-int read_training_labels(struct parms *, struct files *);
+void read_training_labels(struct parms *, struct files *);
/* openfiles.c */
int openfiles(struct parms *, struct files *);
Modified: grass/trunk/imagery/i.group/main.c
===================================================================
--- grass/trunk/imagery/i.group/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/imagery/i.group/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -195,7 +195,7 @@
{
int m, n, skip;
struct Ref ref;
- char *mapset;
+ const char *mapset;
I_get_group_ref(group, &ref);
@@ -234,7 +234,7 @@
{
int m, n, skip;
struct Ref ref;
- char *mapset;
+ const char *mapset;
I_get_subgroup_ref(group, subgroup, &ref);
@@ -272,7 +272,7 @@
int m, n, skip;
struct Ref ref;
struct Ref ref_tmp;
- char *mapset;
+ const char *mapset;
char tmp_name[INAME_LEN];
char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
@@ -330,7 +330,7 @@
int m, n, skip;
struct Ref ref;
struct Ref ref_tmp;
- char *mapset;
+ const char *mapset;
char tmp_name[INAME_LEN];
char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
Modified: grass/trunk/imagery/i.his.rgb/closefiles.c
===================================================================
--- grass/trunk/imagery/i.his.rgb/closefiles.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/imagery/i.his.rgb/closefiles.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -13,7 +13,7 @@
struct Colors colors;
struct Range range;
CELL min, max;
- char *mapset;
+ const char *mapset;
for (i = 0; i < 3; i++) {
G_close_cell(fd_output[i]);
Modified: grass/trunk/imagery/i.his.rgb/openfiles.c
===================================================================
--- grass/trunk/imagery/i.his.rgb/openfiles.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/imagery/i.his.rgb/openfiles.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -8,8 +8,6 @@
char *r_name, char *g_name, char *b_name,
int fd_input[3], int fd_output[3], CELL * rowbuf[3])
{
- char *mapset;
-
/* open output files */
if ((fd_output[0] = G_open_cell_new(r_name)) < 0)
G_fatal_error(_("Unable to create raster map <%s>"), r_name);
@@ -27,20 +25,12 @@
G_fatal_error(_("Unable to allocate the input row buffer"));
/* open input files (maps can be in different mapsets) */
- if ((mapset = G_find_cell(h_name, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), h_name);
- if ((fd_input[0] = G_open_cell_old(h_name, mapset)) < 0)
+ if ((fd_input[0] = G_open_cell_old(h_name, "")) < 0)
G_fatal_error(_("Unable to open raster map <%s>"), h_name);
- if ((mapset = G_find_cell(i_name, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), i_name);
- if ((fd_input[1] = G_open_cell_old(i_name, mapset)) < 0)
+ if ((fd_input[1] = G_open_cell_old(i_name, "")) < 0)
G_fatal_error(_("Unable to open raster map <%s>"), i_name);
- if ((mapset = G_find_cell(s_name, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), s_name);
- if ((fd_input[2] = G_open_cell_old(s_name, mapset)) < 0)
+ if ((fd_input[2] = G_open_cell_old(s_name, "")) < 0)
G_fatal_error(_("Unable to open raster map <%s>"), s_name);
-
- return;
}
Modified: grass/trunk/imagery/i.pca/main.c
===================================================================
--- grass/trunk/imagery/i.pca/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/imagery/i.pca/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -114,15 +114,11 @@
/* open and check input/output files */
for (i = 0; i < bands; i++) {
char tmpbuf[128];
- char *mapset;
sprintf(tmpbuf, "%s.%d", opt_out->answer, i + 1);
G_check_input_output_name(opt_in->answers[i], tmpbuf, GR_FATAL_EXIT);
- if ((mapset = G_find_cell(opt_in->answers[i], "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), opt_in->answers[i]);
-
- if ((inp_fd[i] = G_open_cell_old(opt_in->answers[i], mapset)) < 0)
+ if ((inp_fd[i] = G_open_cell_old(opt_in->answers[i], "")) < 0)
G_fatal_error(_("Unable to open raster map <%s>"),
opt_in->answers[i]);
}
Modified: grass/trunk/imagery/i.pca/support.c
===================================================================
--- grass/trunk/imagery/i.pca/support.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/imagery/i.pca/support.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -9,7 +9,7 @@
int write_support(int bands, char *outname, double **eigmat)
{
- char *mapset = G_mapset();
+ const char *mapset = G_mapset();
struct Colors colors;
struct FPRange range;
DCELL min, max;
Modified: grass/trunk/imagery/i.rgb.his/closefiles.c
===================================================================
--- grass/trunk/imagery/i.rgb.his/closefiles.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/imagery/i.rgb.his/closefiles.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -13,7 +13,7 @@
struct Colors colors;
struct Range range;
CELL min, max;
- char *mapset;
+ const char *mapset;
for (i = 0; i < 3; i++) {
G_close_cell(fd_output[i]);
Modified: grass/trunk/imagery/i.rgb.his/openfiles.c
===================================================================
--- grass/trunk/imagery/i.rgb.his/openfiles.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/imagery/i.rgb.his/openfiles.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -8,20 +8,11 @@
char *h_name, char *i_name, char *s_name,
int fd_input[3], int fd_output[3], CELL * rowbuf[3])
{
- char *mapset;
-
- if ((mapset = G_find_cell(r_name, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), r_name);
- if ((mapset = G_find_cell(g_name, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), g_name);
- if ((mapset = G_find_cell(b_name, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), b_name);
-
- if ((fd_input[0] = G_open_cell_old(r_name, mapset)) < 0)
+ if ((fd_input[0] = G_open_cell_old(r_name, "")) < 0)
G_fatal_error(_("Unable to open raster map <%s>"), r_name);
- if ((fd_input[1] = G_open_cell_old(g_name, mapset)) < 0)
+ if ((fd_input[1] = G_open_cell_old(g_name, "")) < 0)
G_fatal_error(_("Unable to open raster map <%s>"), g_name);
- if ((fd_input[2] = G_open_cell_old(b_name, mapset)) < 0)
+ if ((fd_input[2] = G_open_cell_old(b_name, "")) < 0)
G_fatal_error(_("Unable to open raster map <%s>"), b_name);
/* open output files */
@@ -39,6 +30,4 @@
G_fatal_error(_("Unable to allocate the input row buffer"));
if ((rowbuf[2] = G_allocate_cell_buf()) == NULL)
G_fatal_error(_("Unable to allocate the input row buffer"));
-
- return;
}
Modified: grass/trunk/imagery/i.smap/shapiro/history.c
===================================================================
--- grass/trunk/imagery/i.smap/shapiro/history.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/imagery/i.smap/shapiro/history.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -1,6 +1,6 @@
#include <grass/gis.h>
-int make_history(char *name, char *group, char *subgroup, char *sigfile)
+void make_history(const char *name, const char *group, const char *subgroup, const char *sigfile)
{
struct History hist;
@@ -9,6 +9,4 @@
sprintf(hist.datsrc_2, "Sigset file: %s", sigfile);
G_write_history(name, &hist);
}
-
- return 0;
}
Modified: grass/trunk/imagery/i.smap/shapiro/local_proto.h
===================================================================
--- grass/trunk/imagery/i.smap/shapiro/local_proto.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/imagery/i.smap/shapiro/local_proto.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -1,6 +1,6 @@
/* history.c */
-int make_history(char *, char *, char *, char *);
+void make_history(const char *, const char *, const char *, const char *);
/* opencell.c */
-int open_cell_old(char *, char *);
-int open_cell_new(char *);
+int open_cell_old(const char *, const char *);
+int open_cell_new(const char *);
Modified: grass/trunk/imagery/i.smap/shapiro/opencell.c
===================================================================
--- grass/trunk/imagery/i.smap/shapiro/opencell.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/imagery/i.smap/shapiro/opencell.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -3,12 +3,12 @@
#include <grass/glocale.h>
-int open_cell_old(char *name, char *mapset)
+int open_cell_old(const char *name, const char *mapset)
{
int fd;
if (mapset == NULL)
- mapset = G_find_cell(name, "");
+ mapset = G_find_cell2(name, "");
fd = G_open_cell_old(name, mapset);
if (fd >= 0)
return fd;
@@ -19,7 +19,7 @@
return -1;
}
-int open_cell_new(char *name)
+int open_cell_new(const char *name)
{
int fd;
Modified: grass/trunk/imagery/i.zc/main.c
===================================================================
--- grass/trunk/imagery/i.zc/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/imagery/i.zc/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -32,7 +32,6 @@
double Thresh;
int NumOrients;
int inputfd, zcfd; /* the input and output file descriptors */
- char *inmapset; /* the input mapset name */
struct Cell_head window;
CELL *cell_row;
float Width;
@@ -100,10 +99,7 @@
exit(EXIT_FAILURE);
/* open input cell map */
- if ((inmapset = G_find_cell(input_map->answer, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), input_map->answer);
-
- inputfd = G_open_cell_old(input_map->answer, inmapset);
+ inputfd = G_open_cell_old(input_map->answer, "");
if (inputfd < 0)
exit(EXIT_FAILURE);
Modified: grass/trunk/include/P_site.h
===================================================================
--- grass/trunk/include/P_site.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/include/P_site.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -34,8 +34,8 @@
struct Map_info *G_sites_open_old(const char *name, const char *mapset);
struct Map_info *G_sites_open_new(const char *name);
void G_sites_close(struct Map_info *);
-char *G_find_sites(char *name, const char *mapset);
-char *G_find_sites2(const char *name, const char *mapset);
+const char *G_find_sites(char *name, const char *mapset);
+const char *G_find_sites2(const char *name, const char *mapset);
int G__site_put(struct Map_info *, Site *, int);
struct Map_info *G_fopen_sites_old(const char *, const char *);
Modified: grass/trunk/include/gisdefs.h
===================================================================
--- grass/trunk/include/gisdefs.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/include/gisdefs.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -45,11 +45,11 @@
#endif
/* adj_cellhd.c */
-char *G_adjust_Cell_head(struct Cell_head *, int, int);
-char *G_adjust_Cell_head3(struct Cell_head *, int, int, int);
+const char *G_adjust_Cell_head(struct Cell_head *, int, int);
+const char *G_adjust_Cell_head3(struct Cell_head *, int, int, int);
/* align_window.c */
-char *G_align_window(struct Cell_head *, const struct Cell_head *);
+const char *G_align_window(struct Cell_head *, const struct Cell_head *);
/* alloc.c */
void *G__malloc(const char *, int, size_t);
@@ -404,13 +404,13 @@
void G_free_fmatrix(float **);
/* date.c */
-char *G_date(void);
+const char *G_date(void);
/* datum.c */
int G_get_datum_by_name(const char *);
-char *G_datum_name(int);
-char *G_datum_description(int);
-char *G_datum_ellipsoid(int);
+const char *G_datum_name(int);
+const char *G_datum_description(int);
+const char *G_datum_ellipsoid(int);
int G_get_datumparams_from_projinfo(const struct Key_Value *, char *, char *);
void G_read_datum_table(void);
@@ -439,10 +439,10 @@
/* env.c */
void G_init_env(void);
-char *G_getenv(const char *);
-char *G_getenv2(const char *, int);
-char *G__getenv(const char *);
-char *G__getenv2(const char *, int);
+const char *G_getenv(const char *);
+const char *G_getenv2(const char *, int);
+const char *G__getenv(const char *);
+const char *G__getenv2(const char *, int);
void G_setenv(const char *, const char *);
void G_setenv2(const char *, const char *, int);
void G__setenv(const char *, const char *);
@@ -450,7 +450,7 @@
void G_unsetenv(const char *);
void G_unsetenv2(const char *, int);
void G__write_env(void);
-char *G__env_name(int);
+const char *G__env_name(int);
void G__read_env(void);
void G_set_gisrc_mode(int);
int G_get_gisrc_mode(void);
@@ -479,22 +479,22 @@
const char *);
/* find_cell.c */
-char *G_find_cell(char *, const char *);
-char *G_find_cell2(const char *, const char *);
+const char *G_find_cell(char *, const char *);
+const char *G_find_cell2(const char *, const char *);
/* find_file.c */
-char *G_find_file(const char *, char *, const char *);
-char *G_find_file2(const char *, const char *, const char *);
-char *G_find_file_misc(const char *, const char *, char *, const char *);
-char *G_find_file2_misc(const char *, const char *, const char *,
- const char *);
+const char *G_find_file(const char *, char *, const char *);
+const char *G_find_file2(const char *, const char *, const char *);
+const char *G_find_file_misc(const char *, const char *, char *, const char *);
+const char *G_find_file2_misc(const char *, const char *, const char *,
+ const char *);
/* find_etc.c */
char *G_find_etc(const char *);
/* find_vect.c */
-char *G_find_vector(char *, const char *);
-char *G_find_vector2(const char *, const char *);
+const char *G_find_vector(char *, const char *);
+const char *G_find_vector2(const char *, const char *);
/* flate.c */
int G_zlib_compress(const unsigned char *, int, unsigned char *, int);
@@ -569,8 +569,8 @@
int G_get_ellipsoid_parameters(double *, double *);
int G_get_spheroid_by_name(const char *, double *, double *, double *);
int G_get_ellipsoid_by_name(const char *, double *, double *);
-char *G_ellipsoid_name(int);
-char *G_ellipsoid_description(int);
+const char *G_ellipsoid_name(int);
+const char *G_ellipsoid_description(int);
int G_read_ellipsoid_table(int);
/* get_projinfo.c */
@@ -606,10 +606,10 @@
int G_getl2(char *, int, FILE *);
/* gisbase.c */
-char *G_gisbase(void);
+const char *G_gisbase(void);
/* gisdbase.c */
-char *G_gisdbase(void);
+const char *G_gisdbase(void);
/* gisinit.c */
void G__gisinit(const char *, const char *);
@@ -646,8 +646,8 @@
int G_command_history(struct History *);
/* home.c */
-char *G_home(void);
-char *G__home(void);
+const char *G_home(void);
+const char *G__home(void);
/* ialloc.c */
int *G_alloc_ivector(size_t);
@@ -681,7 +681,7 @@
/* key_value1.c */
struct Key_Value *G_create_key_value(void);
int G_set_key_value(const char *, const char *, struct Key_Value *);
-char *G_find_key_value(const char *, const struct Key_Value *);
+const char *G_find_key_value(const char *, const struct Key_Value *);
void G_free_key_value(struct Key_Value *);
/* key_value2.c */
@@ -713,11 +713,11 @@
/* ll_format.c */
void G_lat_format(double, char *);
-char *G_lat_format_string(void);
+const char *G_lat_format_string(void);
void G_lon_format(double, char *);
-char *G_lon_format_string(void);
+const char *G_lon_format_string(void);
void G_llres_format(double, char *);
-char *G_llres_format_string(void);
+const char *G_llres_format_string(void);
void G_lat_parts(double, int *, int *, double *, char *);
void G_lon_parts(double, int *, int *, double *, char *);
@@ -727,8 +727,8 @@
int G_llres_scan(const char *, double *);
/* location.c */
+const char *G_location(void);
char *G_location_path(void);
-char *G_location(void);
char *G__location_path(void);
/* ls.c */
@@ -743,7 +743,7 @@
void G_lubksb(double **, int, int *, double[]);
/* mach_name.c */
-char *G__machine_name(void);
+const char *G__machine_name(void);
/* make_loc.c */
int G__make_location(const char *, struct Cell_head *, struct Key_Value *,
@@ -764,8 +764,8 @@
char *G_toucase(char *);
/* mapset.c */
-char *G_mapset(void);
-char *G__mapset(void);
+const char *G_mapset(void);
+const char *G__mapset(void);
/* mapset_msc.c */
int G__make_mapset_element(const char *);
@@ -774,7 +774,7 @@
int G__mapset_permissions2(const char *, const char *, const char *);
/* mapset_nme.c */
-char *G__mapset_name(int);
+const char *G__mapset_name(int);
void G_get_list_of_mapsets(void);
void G__create_alt_search_path(void);
void G__switch_search_path(void);
@@ -917,8 +917,8 @@
/* proj2.c */
int G__projection_units(int);
-char *G__unit_name(int, int);
-char *G__projection_name(int);
+const char *G__unit_name(int, int);
+const char *G__projection_name(int);
/* proj3.c */
const char *G_database_unit_name(int);
@@ -945,7 +945,7 @@
/* put_window.c */
int G_put_window(const struct Cell_head *);
-int G__put_window(const struct Cell_head *, char *, char *);
+int G__put_window(const struct Cell_head *, const char *, const char *);
/* putenv.c */
void G_putenv(const char *, const char *);
@@ -1156,7 +1156,7 @@
int G_get_3dview(const char *, const char *, struct G_3dview *);
/* whoami.c */
-char *G_whoami(void);
+const char *G_whoami(void);
/* wind_2_box.c */
void G_adjust_window_to_box(const struct Cell_head *, struct Cell_head *, int,
Modified: grass/trunk/lib/form/generate.c
===================================================================
--- grass/trunk/lib/form/generate.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/form/generate.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -40,7 +40,7 @@
"euc-jp",
NULL
};
- char *enc_env;
+ const char *enc_env;
G__read_env();
enc_env = G__getenv("GRASS_DB_ENCODING");
Modified: grass/trunk/lib/g3d/find_grid3.c
===================================================================
--- grass/trunk/lib/g3d/find_grid3.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/g3d/find_grid3.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -18,7 +18,7 @@
* where cell file was found, or NULL if not found
*/
-char *G_find_grid3(const char *name, const char *mapset)
+const char *G_find_grid3(const char *name, const char *mapset)
{
return G_find_file2_misc("grid3", "cell", name, mapset);
}
Modified: grass/trunk/lib/g3d/g3dkeys.c
===================================================================
--- grass/trunk/lib/g3d/g3dkeys.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/g3d/g3dkeys.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -6,7 +6,7 @@
int G3d_keyGetInt(struct Key_Value *keys, const char *key, int *i)
{
- char *str;
+ const char *str;
if ((str = G_find_key_value(key, keys)) == NULL) {
G3d_error("G3d_keyGetInt: cannot find field %s in key structure",
@@ -25,7 +25,7 @@
int G3d_keyGetDouble(struct Key_Value *keys, const char *key, double *d)
{
- char *str;
+ const char *str;
if ((str = G_find_key_value(key, keys)) == NULL) {
G3d_error("G3d_keyGetDouble: cannot find field %s in key structure",
@@ -46,7 +46,7 @@
int
G3d_keyGetString(struct Key_Value *keys, const char *key, char **returnStr)
{
- char *str;
+ const char *str;
if ((str = G_find_key_value(key, keys)) == NULL) {
G3d_error("G3d_keyGetString: cannot find field %s in key structure",
@@ -54,7 +54,6 @@
return 0;
}
- G_strip(str);
*returnStr = G_store(str);
return 1;
}
@@ -65,7 +64,7 @@
G3d_keyGetValue(struct Key_Value *keys, const char *key, char *val1,
char *val2, int result1, int result2, int *resultVar)
{
- char *str;
+ const char *str;
if ((str = G_find_key_value(key, keys)) == NULL) {
G3d_error("G3d_keyGetValue: cannot find field %s in key structure",
@@ -73,7 +72,6 @@
return 0;
}
- G_strip(str);
if (strcmp(str, val1) == 0) {
*resultVar = result1;
return 1;
Modified: grass/trunk/lib/gis/adj_cellhd.c
===================================================================
--- grass/trunk/lib/gis/adj_cellhd.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/adj_cellhd.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -40,7 +40,7 @@
* \return Localized text string on error
*/
-char *G_adjust_Cell_head(struct Cell_head *cellhd, int row_flag, int col_flag)
+const char *G_adjust_Cell_head(struct Cell_head *cellhd, int row_flag, int col_flag)
{
if (!row_flag) {
if (cellhd->ns_res <= 0)
@@ -191,8 +191,8 @@
* \return Localized text string on error
*/
-char *G_adjust_Cell_head3(struct Cell_head *cellhd, int row_flag,
- int col_flag, int depth_flag)
+const char *G_adjust_Cell_head3(struct Cell_head *cellhd, int row_flag,
+ int col_flag, int depth_flag)
{
if (!row_flag) {
if (cellhd->ns_res <= 0)
Modified: grass/trunk/lib/gis/align_window.c
===================================================================
--- grass/trunk/lib/gis/align_window.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/align_window.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -38,7 +38,7 @@
* \return Pointer to an error string on failure
*/
-char *G_align_window(struct Cell_head *window, const struct Cell_head *ref)
+const char *G_align_window(struct Cell_head *window, const struct Cell_head *ref)
{
int preserve;
Modified: grass/trunk/lib/gis/date.c
===================================================================
--- grass/trunk/lib/gis/date.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/date.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -27,20 +27,29 @@
* \return Pointer to a string holding date/time
*/
-char *G_date(void)
+const char *G_date(void)
{
+ static int initialized;
+ static char *date;
time_t clock;
struct tm *local;
- char *date;
+ char *tdate;
char *d;
+ if (G_is_initialized(&initialized))
+ return date;
+
time(&clock);
local = localtime(&clock);
- date = asctime(local);
- for (d = date; *d; d++)
+ tdate = asctime(local);
+ for (d = tdate; *d; d++)
if (*d == '\n')
*d = 0;
+ date = G_store(tdate);
+
+ G_initialize_done(&initialized);
+
return date;
}
Modified: grass/trunk/lib/gis/datum.c
===================================================================
--- grass/trunk/lib/gis/datum.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/datum.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -55,7 +55,7 @@
return -1;
}
-char *G_datum_name(int n)
+const char *G_datum_name(int n)
{
G_read_datum_table();
@@ -65,7 +65,7 @@
return table.datums[n].name;
}
-char *G_datum_description(int n)
+const char *G_datum_description(int n)
{
G_read_datum_table();
@@ -75,7 +75,7 @@
return table.datums[n].descr;
}
-char *G_datum_ellipsoid(int n)
+const char *G_datum_ellipsoid(int n)
{
G_read_datum_table();
Modified: grass/trunk/lib/gis/env.c
===================================================================
--- grass/trunk/lib/gis/env.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/env.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -47,7 +47,7 @@
static int read_env(int);
static int set_env(const char *, const char *, int);
static int unset_env(const char *, int);
-static char *get_env(const char *, int);
+static const char *get_env(const char *, int);
static void write_env(int);
static FILE *open_env(const char *, int);
@@ -198,7 +198,7 @@
return 0;
}
-static char *get_env(const char *name, int loc)
+static const char *get_env(const char *name, int loc)
{
int n;
@@ -283,11 +283,11 @@
\return char pointer to value for name
*/
-char *G_getenv(const char *name)
+const char *G_getenv(const char *name)
{
- char *value;
+ const char *value = G__getenv(name);
- if ((value = G__getenv(name)))
+ if (value)
return value;
G_fatal_error(_("G_getenv(): Variable %s not set"), name);
@@ -309,11 +309,11 @@
\return variable value
\return NULL if not found
*/
-char *G_getenv2(const char *name, int loc)
+const char *G_getenv2(const char *name, int loc)
{
- char *value;
+ const char *value = G__getenv2(name, loc);
- if ((value = G__getenv2(name, loc)))
+ if (value)
return value;
G_fatal_error(_("%s not set"), name);
@@ -328,7 +328,7 @@
\return char pointer to value for name
\return NULL if name not set
*/
-char *G__getenv(const char *name)
+const char *G__getenv(const char *name)
{
if (strcmp(name, "GISBASE") == 0)
return getenv(name);
@@ -347,7 +347,7 @@
\return char pointer to value for name
\return NULL if name not set
*/
-char *G__getenv2(const char *name, int loc)
+const char *G__getenv2(const char *name, int loc)
{
if (strcmp(name, "GISBASE") == 0)
return getenv(name);
@@ -482,7 +482,7 @@
\return pointer to variable name
*/
-char *G__env_name(int n)
+const char *G__env_name(int n)
{
int i;
Modified: grass/trunk/lib/gis/error.c
===================================================================
--- grass/trunk/lib/gis/error.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/error.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -290,7 +290,7 @@
{
char cwd[GPATH_MAX];
time_t clock;
- char *gisbase;
+ const char *gisbase;
/* get time */
clock = time(NULL);
@@ -374,7 +374,7 @@
{
FILE *mail;
char command[64];
- char *user;
+ const char *user;
user = G_whoami();
if (user == 0 || *user == 0)
Modified: grass/trunk/lib/gis/find_cell.c
===================================================================
--- grass/trunk/lib/gis/find_cell.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/find_cell.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -60,7 +60,7 @@
* \return char *
*/
-char *G_find_cell(char *name, const char *mapset)
+const char *G_find_cell(char *name, const char *mapset)
{
return G_find_file("cell", name, mapset);
}
@@ -80,7 +80,7 @@
* \return char *
*/
-char *G_find_cell2(const char *name, const char *mapset)
+const char *G_find_cell2(const char *name, const char *mapset)
{
return G_find_file2("cell", name, mapset);
}
Modified: grass/trunk/lib/gis/find_file.c
===================================================================
--- grass/trunk/lib/gis/find_file.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/find_file.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -18,10 +18,10 @@
#include <grass/gis.h>
#include <grass/glocale.h>
-static char *find_file(int misc,
- const char *dir,
- const char *element,
- const char *name, const char *mapset)
+static const char *find_file(
+ int misc,
+ const char *dir,
+ const char *element, const char *name, const char *mapset)
{
char path[GPATH_MAX];
char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
@@ -82,7 +82,7 @@
G_warning(_("Using <%s@%s>"),
pname, pselmapset);
- return (char *)pselmapset;
+ return pselmapset;
}
}
/*
@@ -106,13 +106,14 @@
-static char *find_file1(int misc,
- const char *dir,
- const char *element, char *name, const char *mapset)
+static const char *find_file1(
+ int misc,
+ const char *dir,
+ const char *element, char *name, const char *mapset)
{
char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
const char *pname, *pmapset;
- char *mp;
+ const char *mp;
if (G__name_is_fully_qualified(name, xname, xmapset)) {
pname = xname;
@@ -156,12 +157,12 @@
* where file was found, or NULL if not found
*/
-char *G_find_file(const char *element, char *name, const char *mapset)
+const char *G_find_file(const char *element, char *name, const char *mapset)
{
return find_file1(0, NULL, element, name, mapset);
}
-char *G_find_file_misc(const char *dir,
+const char *G_find_file_misc(const char *dir,
const char *element, char *name, const char *mapset)
{
return find_file1(1, dir, element, name, mapset);
@@ -188,12 +189,12 @@
* \return char * pointer to a string with name of mapset
* where file was found, or NULL if not found
*/
-char *G_find_file2(const char *element, const char *name, const char *mapset)
+const char *G_find_file2(const char *element, const char *name, const char *mapset)
{
return find_file(0, NULL, element, name, mapset);
}
-char *G_find_file2_misc(const char *dir,
+const char *G_find_file2_misc(const char *dir,
const char *element,
const char *name, const char *mapset)
{
Modified: grass/trunk/lib/gis/find_vect.c
===================================================================
--- grass/trunk/lib/gis/find_vect.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/find_vect.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -52,7 +52,7 @@
* \return char *
*
*/
-char *G_find_vector(char *name, const char *mapset)
+const char *G_find_vector(char *name, const char *mapset)
{
return G_find_file(GRASS_VECT_DIRECTORY, name, mapset);
}
@@ -72,7 +72,7 @@
* \param mapset
* \return char *
*/
-char *G_find_vector2(const char *name, const char *mapset)
+const char *G_find_vector2(const char *name, const char *mapset)
{
return G_find_file2(GRASS_VECT_DIRECTORY, name, mapset);
}
Modified: grass/trunk/lib/gis/get_cellhd.c
===================================================================
--- grass/trunk/lib/gis/get_cellhd.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/get_cellhd.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -50,7 +50,6 @@
char real_name[GNAME_MAX], real_mapset[GMAPSET_MAX];
char buf[1024];
char *tail;
- char *err;
/*
is_reclass = G_is_reclass (name, mapset, real_name, real_mapset);
@@ -91,27 +90,8 @@
}
}
- err = G__read_Cell_head(fd, cellhd, 1);
+ G__read_Cell_head(fd, cellhd, 1);
fclose(fd);
- if (err == NULL)
- return 0;
-
- sprintf(buf, _("Unable to read header file for raster map <%s@%s>."),
- name, mapset);
- tail = buf + strlen(buf);
- if (is_reclass) {
- sprintf(tail,
- _(" It is a reclass of raster map <%s@%s> whose header file is invalid."),
- real_name, real_mapset);
- }
- else
- sprintf(tail, _(" Invalid format."));
- tail = buf + strlen(buf);
- strcpy(tail, err);
-
- G_free(err);
-
- G_warning(buf);
- return -1;
+ return 0;
}
Modified: grass/trunk/lib/gis/get_ellipse.c
===================================================================
--- grass/trunk/lib/gis/get_ellipse.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/get_ellipse.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -135,7 +135,7 @@
* \return char * ellipsoid name
* \return NULL if no ellipsoid found
*/
-char *G_ellipsoid_name(int n)
+const char *G_ellipsoid_name(int n)
{
G_read_ellipsoid_table(0);
return n >= 0 && n < table.count ? table.ellipses[n].name : NULL;
@@ -199,7 +199,7 @@
* \return NULL if no ellipsoid found
*/
-char *G_ellipsoid_description(int n)
+const char *G_ellipsoid_description(int n)
{
G_read_ellipsoid_table(0);
return n >= 0 && n < table.count ? table.ellipses[n].descr : NULL;
@@ -338,7 +338,7 @@
static int get_ellipsoid_parameters(struct Key_Value *proj_keys, double *a, double *e2)
{
- char *str, *str1;
+ const char *str, *str1;
if (!proj_keys) {
return -1;
Modified: grass/trunk/lib/gis/get_row.c
===================================================================
--- grass/trunk/lib/gis/get_row.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/get_row.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -1006,7 +1006,7 @@
static int open_null_read(int fd)
{
struct fileinfo *fcb = &G__.fileinfo[fd];
- char *name, *mapset, *dummy;
+ const char *name, *mapset, *dummy;
int null_fd;
if (fcb->null_file_exists == 0)
@@ -1021,7 +1021,7 @@
mapset = fcb->mapset;
}
- dummy = G_find_file_misc("cell_misc", NULL_FILE, name, mapset);
+ dummy = G_find_file2_misc("cell_misc", NULL_FILE, name, mapset);
if (!dummy) {
/* G_warning("unable to find [%s]",path); */
Modified: grass/trunk/lib/gis/gisbase.c
===================================================================
--- grass/trunk/lib/gis/gisbase.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/gisbase.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -39,7 +39,7 @@
* \return char *
*/
-char *G_gisbase(void)
+const char *G_gisbase(void)
{
return G_getenv("GISBASE");
}
Modified: grass/trunk/lib/gis/gisdbase.c
===================================================================
--- grass/trunk/lib/gis/gisdbase.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/gisdbase.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -26,7 +26,7 @@
* \return pointer to string containing the base directory
*/
-char *G_gisdbase(void)
+const char *G_gisdbase(void)
{
return G_getenv("GISDBASE");
}
Modified: grass/trunk/lib/gis/gisinit.c
===================================================================
--- grass/trunk/lib/gis/gisinit.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/gisinit.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -43,7 +43,7 @@
void G__gisinit(const char *version, const char *pgm)
{
- char *mapset;
+ const char *mapset;
if (initialized)
return;
@@ -55,7 +55,8 @@
/* Make sure location and mapset are set */
G_location_path();
- switch (G__mapset_permissions(mapset = G_mapset())) {
+ mapset = G_mapset();
+ switch (G__mapset_permissions(mapset)) {
case 1:
break;
case 0:
Modified: grass/trunk/lib/gis/home.c
===================================================================
--- grass/trunk/lib/gis/home.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/home.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -29,9 +29,9 @@
* \return char *
*/
-char *G_home(void)
+const char *G_home(void)
{
- char *home = G__home();
+ const char *home = G__home();
if (home)
return home;
@@ -40,10 +40,10 @@
return NULL;
}
-char *G__home(void)
+const char *G__home(void)
{
static int initialized;
- static char *home = 0;
+ static const char *home = 0;
if (G_is_initialized(&initialized))
return home;
Modified: grass/trunk/lib/gis/key_value1.c
===================================================================
--- grass/trunk/lib/gis/key_value1.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/key_value1.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -125,7 +125,7 @@
\return poiter to value of key
\return NULL if no key found
*/
-char *G_find_key_value(const char *key, const struct Key_Value *kv)
+const char *G_find_key_value(const char *key, const struct Key_Value *kv)
{
int n;
Modified: grass/trunk/lib/gis/key_value4.c
===================================================================
--- grass/trunk/lib/gis/key_value4.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/key_value4.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -66,7 +66,7 @@
{
struct Key_Value *kv;
int stat;
- char *v;
+ const char *v;
*value = 0;
kv = G_read_key_value_file(file, &stat);
Modified: grass/trunk/lib/gis/legal_name.c
===================================================================
--- grass/trunk/lib/gis/legal_name.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/legal_name.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -68,7 +68,7 @@
int G_check_input_output_name(const char *input, const char *output,
int error)
{
- char *mapset;
+ const char *mapset;
if (output == NULL)
return 0; /* don't die on undefined parameters */
Modified: grass/trunk/lib/gis/ll_format.c
===================================================================
--- grass/trunk/lib/gis/ll_format.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/ll_format.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -48,7 +48,7 @@
format(buf, d, m, s, h);
}
-char *G_lat_format_string(void)
+const char *G_lat_format_string(void)
{
return "dd:mm:ss{N|S}";
}
@@ -63,7 +63,7 @@
format(buf, d, m, s, h);
}
-char *G_lon_format_string(void)
+const char *G_lon_format_string(void)
{
return "ddd:mm:ss{E|W}";
}
@@ -79,7 +79,7 @@
format(buf, d, m, s, h);
}
-char *G_llres_format_string(void)
+const char *G_llres_format_string(void)
{
return "dd:mm:ss";
}
Modified: grass/trunk/lib/gis/location.c
===================================================================
--- grass/trunk/lib/gis/location.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/location.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -22,6 +22,22 @@
/*!
+ * \brief Get current location name
+ *
+ * Returns the name of the current database location. This routine
+ * should be used by modules that need to display the current location
+ * to the user. See Locations for an explanation of locations.
+ *
+ * \param
+ * \return char* tolocation name
+ */
+
+const char *G_location(void)
+{
+ return G_getenv("LOCATION_NAME");
+}
+
+/*!
* \brief Get current location directory
*
* Returns the full UNIX path name of the current database
@@ -39,7 +55,7 @@
char *location;
location = G__location_path();
- if (access(location, 0) != 0) {
+ if (access(location, F_OK) != 0) {
perror("access");
G_fatal_error(_("LOCATION << %s >> not available"), location);
}
@@ -49,21 +65,6 @@
/*!
- * \brief Get current location name
- *
- * Returns the name of the current database location. This routine
- * should be used by modules that need to display the current location
- * to the user. See Locations for an explanation of locations.
- *
- * \param
- * \return char* tolocation name
- */
-char *G_location(void)
-{
- return G_getenv("LOCATION_NAME");
-}
-
-/*!
* \brief Get current location path
*
* \param
@@ -71,14 +72,10 @@
*/
char *G__location_path(void)
{
- char *location = 0;
- char *base;
- char *name;
+ const char *name = G_location();
+ const char *base = G_gisdbase();
+ char *location = G_malloc(strlen(base) + strlen(name) + 2);
- name = G_location();
- base = G_gisdbase();
- location = G_malloc(strlen(base) + strlen(name) + 2);
-
sprintf(location, "%s/%s", base, name);
return location;
Modified: grass/trunk/lib/gis/mach_name.c
===================================================================
--- grass/trunk/lib/gis/mach_name.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/mach_name.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -14,7 +14,7 @@
*
*/
-char *G__machine_name(void)
+const char *G__machine_name(void)
{
static int initialized;
static char name[128];
Modified: grass/trunk/lib/gis/make_loc.c
===================================================================
--- grass/trunk/lib/gis/make_loc.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/make_loc.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -237,7 +237,7 @@
/* -------------------------------------------------------------------- */
{
- char *x_0_1 = NULL, *x_0_2 = NULL;
+ const char *x_0_1 = NULL, *x_0_2 = NULL;
x_0_1 = G_find_key_value("x_0", proj_info1);
x_0_2 = G_find_key_value("x_0", proj_info2);
@@ -251,7 +251,7 @@
/* -------------------------------------------------------------------- */
{
- char *y_0_1 = NULL, *y_0_2 = NULL;
+ const char *y_0_1 = NULL, *y_0_2 = NULL;
y_0_1 = G_find_key_value("y_0", proj_info1);
y_0_2 = G_find_key_value("y_0", proj_info2);
Modified: grass/trunk/lib/gis/mapset.c
===================================================================
--- grass/trunk/lib/gis/mapset.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/mapset.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -28,39 +28,17 @@
* \return char *
*/
-char *G_mapset(void)
+const char *G_mapset(void)
{
- static char mapset[GMAPSET_MAX];
- static int first = 1;
- char *m;
+ const char *m = G__mapset();
- m = G__mapset();
- if (m == NULL)
+ if (!m)
G_fatal_error(_("MAPSET is not set"));
- if (first)
- first = 0;
- else if (strcmp(mapset, m) == 0)
- return mapset;
- strcpy(mapset, m);
-
- switch (G__mapset_permissions(mapset)) {
- case 0:
- case 1:
- return mapset;
- /*
- case 0:
- G_fatal_error ("MAPSET %s - permission denied", mapset);
- break;
- */
- default:
- G_fatal_error(_("MAPSET %s not found"), mapset);
- break;
- }
- exit(EXIT_FAILURE);
+ return m;
}
-char *G__mapset(void)
+const char *G__mapset(void)
{
return G__getenv("MAPSET");
}
Modified: grass/trunk/lib/gis/mapset_nme.c
===================================================================
--- grass/trunk/lib/gis/mapset_nme.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/mapset_nme.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -39,7 +39,7 @@
\return mapset name
\return NULL if mapset not found
*/
-char *G__mapset_name(int n)
+const char *G__mapset_name(int n)
{
G_get_list_of_mapsets();
Modified: grass/trunk/lib/gis/opencell.c
===================================================================
--- grass/trunk/lib/gis/opencell.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/opencell.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -774,7 +774,7 @@
char path[GPATH_MAX];
struct Key_Value *format_keys;
int in_stat;
- char *str, *str1;
+ const char *str, *str1;
RASTER_MAP_TYPE map_type;
const char *xmapset;
@@ -795,7 +795,6 @@
return -1;
}
if ((str = G_find_key_value("type", format_keys)) != NULL) {
- G_strip(str);
if (strcmp(str, "double") == 0)
map_type = DCELL_TYPE;
else if (strcmp(str, "float") == 0)
@@ -813,7 +812,6 @@
}
if ((str1 = G_find_key_value("byte_order", format_keys)) != NULL) {
- G_strip(str1);
if (strcmp(str1, "xdr") != 0)
G_warning(_("Raster map <%s> is not xdr: byte_order: %s"),
name, str);
Modified: grass/trunk/lib/gis/overwrite.c
===================================================================
--- grass/trunk/lib/gis/overwrite.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/overwrite.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -36,7 +36,7 @@
int G_check_overwrite(int argc, char **argv)
{
- char *overstr;
+ const char *overstr;
int overwrite;
overwrite = 0;
Modified: grass/trunk/lib/gis/parser.c
===================================================================
--- grass/trunk/lib/gis/parser.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/parser.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -2013,7 +2013,7 @@
static void G_gui(void)
{
/* read environment variables first then internal GRASS variable */
- char *gui = getenv("GRASS_GUI");
+ const char *gui = getenv("GRASS_GUI");
if (!gui) {
gui = G_getenv("GRASS_GUI");
@@ -2510,7 +2510,7 @@
char element[KEYLENGTH];
char desc[KEYLENGTH];
int error = 0;
- char *overstr;
+ const char *overstr;
int over;
st->module_info.overwrite = 0;
Modified: grass/trunk/lib/gis/proj2.c
===================================================================
--- grass/trunk/lib/gis/proj2.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/proj2.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -17,7 +17,7 @@
}
}
-char *G__unit_name(int unit, int plural)
+const char *G__unit_name(int unit, int plural)
{
switch (unit) {
case 0:
@@ -33,7 +33,7 @@
}
}
-char *G__projection_name(int n)
+const char *G__projection_name(int n)
{
switch (n) {
case PROJECTION_XY:
Modified: grass/trunk/lib/gis/put_title.c
===================================================================
--- grass/trunk/lib/gis/put_title.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/put_title.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -15,7 +15,7 @@
int G_put_cell_title(const char *name, const char *title)
{
- char *mapset;
+ const char *mapset;
FILE *in, *out;
char *tempfile;
int line;
Modified: grass/trunk/lib/gis/put_window.c
===================================================================
--- grass/trunk/lib/gis/put_window.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/put_window.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -37,7 +37,7 @@
: G__put_window(window, "", "WIND");
}
-int G__put_window(const struct Cell_head *window, char *dir, char *name)
+int G__put_window(const struct Cell_head *window, const char *dir, const char *name)
{
FILE *fd;
Modified: grass/trunk/lib/gis/rd_cellhd.c
===================================================================
--- grass/trunk/lib/gis/rd_cellhd.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/rd_cellhd.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -85,8 +85,7 @@
char value[200];
int i, line;
int flags;
- char *G_adjust_Cell_head();
- char *err;
+ const char *err;
G_debug(2, "G__read_Cell_head_array");
Modified: grass/trunk/lib/gis/remove.c
===================================================================
--- grass/trunk/lib/gis/remove.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/remove.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -73,7 +73,7 @@
const char *name)
{
char path[GPATH_MAX];
- char *mapset;
+ const char *mapset;
char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
/* name in mapset legal only if mapset is current mapset */
Modified: grass/trunk/lib/gis/set_window.c
===================================================================
--- grass/trunk/lib/gis/set_window.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/set_window.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -48,7 +48,7 @@
{
int i;
int maskfd;
- char *err;
+ const char *err;
/* adjust window, check for valid window */
/* adjust the real one, not a copy
Modified: grass/trunk/lib/gis/whoami.c
===================================================================
--- grass/trunk/lib/gis/whoami.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/gis/whoami.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -37,10 +37,10 @@
* \retval char * Pointer to string
*/
-char *G_whoami(void)
+const char *G_whoami(void)
{
static int initialized;
- static char *name;
+ static const char *name;
if (G_is_initialized(&initialized))
return name;
Modified: grass/trunk/lib/init/clean_temp.c
===================================================================
--- grass/trunk/lib/init/clean_temp.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/init/clean_temp.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -119,7 +119,7 @@
int main(int argc, char *argv[])
{
- char *mapset;
+ const char *mapset;
char element[GNAME_MAX];
char tmppath[BUF_MAX];
pid_t ppid;
Modified: grass/trunk/lib/manage/add_elem.c
===================================================================
--- grass/trunk/lib/manage/add_elem.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/manage/add_elem.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -1,5 +1,5 @@
#include "list.h"
-int add_element(char *elem, char *desc)
+int add_element(const char *elem, const char *desc)
{
int n;
int nelem;
@@ -9,11 +9,9 @@
n = nlist - 1;
nelem = list[n].nelem++;
- list[n].element =
- (char **)G_realloc(list[n].element, (nelem + 1) * sizeof(char *));
+ list[n].element = G_realloc(list[n].element, (nelem + 1) * sizeof(const char *));
list[n].element[nelem] = G_store(elem);
- list[n].desc =
- (char **)G_realloc(list[n].desc, (nelem + 1) * sizeof(char *));
+ list[n].desc = G_realloc(list[n].desc, (nelem + 1) * sizeof(const char *));
list[n].desc[nelem] = G_store(desc);
return 0;
Modified: grass/trunk/lib/manage/do_copy.c
===================================================================
--- grass/trunk/lib/manage/do_copy.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/manage/do_copy.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -9,7 +9,7 @@
* returns 0 - success
* 1 - error
*/
-int do_copy(int n, char *old, char *mapset, char *new)
+int do_copy(int n, const char *old, const char *mapset, const char *new)
{
int i, ret, len;
char path[GPATH_MAX], path2[GPATH_MAX];
Modified: grass/trunk/lib/manage/do_list.c
===================================================================
--- grass/trunk/lib/manage/do_list.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/manage/do_list.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -1,7 +1,5 @@
#include "list.h"
-int do_list(int n, char *mapset)
+void do_list(int n, const char *mapset)
{
G_list_element(list[n].element[0], list[n].desc[0], mapset, (int (*)())0);
-
- return 0;
}
Modified: grass/trunk/lib/manage/do_remove.c
===================================================================
--- grass/trunk/lib/manage/do_remove.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/manage/do_remove.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -9,12 +9,12 @@
* returns 0 - success
* 1 - error
*/
-int do_remove(int n, char *old)
+int do_remove(int n, const char *old)
{
int i, ret;
/* int len; */
- char *mapset;
+ const char *mapset;
int result = 0;
int removed = 0;
char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
Modified: grass/trunk/lib/manage/do_rename.c
===================================================================
--- grass/trunk/lib/manage/do_rename.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/manage/do_rename.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -9,11 +9,11 @@
* returns 0 - success
* 1 - error
*/
-int do_rename(int n, char *old, char *new)
+int do_rename(int n, const char *old, const char *new)
{
int i, ret;
int len;
- char *mapset;
+ const char *mapset;
int result = 0;
int renamed = 0;
Modified: grass/trunk/lib/manage/find.c
===================================================================
--- grass/trunk/lib/manage/find.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/manage/find.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -1,11 +1,11 @@
#include <string.h>
#include "list.h"
-char *find(int n, char *name, char *mapsets)
+const char *find(int n, char *name, const char *mapsets)
{
- char *mapset;
+ const char *mapset;
- mapset = G_find_file(list[n].element[0], name, mapsets);
+ mapset = G_find_file2(list[n].element[0], name, mapsets);
if (mapset) {
char temp[GNAME_MAX];
Modified: grass/trunk/lib/manage/list.h
===================================================================
--- grass/trunk/lib/manage/list.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/manage/list.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -7,9 +7,9 @@
struct list
{
- char **element; /* list of related elements */
+ const char **element; /* list of related elements */
char *alias; /* element alias */
- char **desc; /* description of elements */
+ const char **desc; /* description of elements */
char *text; /* menu text */
int nelem; /* number of elements */
char status;
@@ -26,25 +26,25 @@
#define LIST 4
/* add_elem.c */
-int add_element(char *, char *);
+int add_element(const char *, const char *);
/* do_copy.c */
-int do_copy(int, char *, char *, char *);
+int do_copy(int, const char *, const char *, const char *);
/* do_list.c */
-int do_list(int, char *);
+void do_list(int, const char *);
/* do_remove.c */
-int do_remove(int, char *);
+int do_remove(int, const char *);
/* do_rename.c */
-int do_rename(int, char *, char *);
+int do_rename(int, const char *, const char *);
/* empty.c */
int empty(char *);
/* find.c */
-char *find(int, char *, char *);
+const char *find(int, char *, const char *);
/* get_len.c */
int get_description_len(int);
Modified: grass/trunk/lib/proj/convert.c
===================================================================
--- grass/trunk/lib/proj/convert.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/proj/convert.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -93,8 +93,9 @@
struct gpj_datum dstruct;
struct gpj_ellps estruct;
size_t len;
- char *ellps, *ellpslong, *datum, *params, *towgs84, *datumlongname,
- *start, *end, *unit, *unfact, *buff;
+ const char *ellps, *unit, *unfact;
+ char *ellpslong, *datum, *params, *towgs84, *datumlongname,
+ *start, *end, *buff;
const char *sysname, *osrunit, *osrunfact;
double a, es, rf;
int haveparams = 0;
@@ -138,9 +139,9 @@
haveparams = GPJ__get_datum_params(proj_info, &datum, ¶ms);
if ((datum == NULL) || (GPJ_get_datum_by_name(datum, &dstruct) < 0)) {
- G_asprintf(&datumlongname, "unknown");
+ datumlongname = "unknown";
if (ellps == NULL)
- G_asprintf(&ellps, "unnamed");
+ ellps = "unnamed";
}
else {
datumlongname = G_store(dstruct.longname);
@@ -204,7 +205,7 @@
lastpart[len] = '\0';
if (unit == NULL)
- G_asprintf(&unit, "unknown");
+ unit = "unknown";
G_asprintf(&end, ",UNIT[\"%s\",%.16g]]", unit, unfactf);
}
Modified: grass/trunk/lib/proj/ellipse.c
===================================================================
--- grass/trunk/lib/proj/ellipse.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/proj/ellipse.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -54,7 +54,8 @@
{
struct gpj_ellps estruct;
struct gpj_datum dstruct;
- char *str, *str1, *str3;
+ const char *str, *str3;
+ char *str1;
str = G_find_key_value("datum", proj_keys);
@@ -85,7 +86,8 @@
else {
str3 = G_find_key_value("a", proj_keys);
if (str3 != NULL) {
- G_asprintf(&str, "a=%s", str3);
+ char *str4;
+ G_asprintf(&str4, "a=%s", str3);
if ((str3 = G_find_key_value("es", proj_keys)) != NULL)
G_asprintf(&str1, "e=%s", str3);
else if ((str3 = G_find_key_value("f", proj_keys)) != NULL)
@@ -98,7 +100,7 @@
G_fatal_error(_("No secondary ellipsoid descriptor "
"(rf, es or b) in file"));
- if (get_a_e2_rf(str, str1, a, e2, rf) == 0)
+ if (get_a_e2_rf(str4, str1, a, e2, rf) == 0)
G_fatal_error(_("Invalid ellipsoid descriptors "
"(a, rf, es or b) in file"));
return 1;
Modified: grass/trunk/lib/proj/get_proj.c
===================================================================
--- grass/trunk/lib/proj/get_proj.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/proj/get_proj.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -59,7 +59,7 @@
int pj_get_kv(struct pj_info *info, struct Key_Value *in_proj_keys,
struct Key_Value *in_units_keys)
{
- char *str;
+ const char *str;
int i;
double a, es, rf;
int returnval = 1;
Modified: grass/trunk/lib/rst/interp_float/input2d.c
===================================================================
--- grass/trunk/lib/rst/interp_float/input2d.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/rst/interp_float/input2d.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -29,7 +29,7 @@
/** Creates a bitmap mask from given raster map **/
{
int i, j, cfmask = 0, irev, MASKfd;
- char *mapsetm;
+ const char *mapsetm;
CELL *cellmask, *MASK;
struct BM *bitmask;
Modified: grass/trunk/lib/rst/interp_float/output2d.c
===================================================================
--- grass/trunk/lib/rst/interp_float/output2d.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/rst/interp_float/output2d.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -46,7 +46,7 @@
struct Colors colors;
struct History hist, hist1, hist2, hist3, hist4, hist5;
char *type;
- char *mapset = NULL;
+ const char *mapset = NULL;
int cond1, cond2;
FCELL dat1, dat2;
Modified: grass/trunk/lib/rst/interp_float/resout2d.c
===================================================================
--- grass/trunk/lib/rst/interp_float/resout2d.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/rst/interp_float/resout2d.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -41,13 +41,13 @@
int cf1 = 0, cf2 = 0, cf3 = 0, cf4 = 0, cf5 = 0, cf6 = 0; /* cell file descriptors */
int nrows, ncols; /* current region rows and columns */
int i; /* loop counter */
- char *mapset;
+ const char *mapset;
float dat1, dat2;
struct Colors colors, colors2;
double value1, value2;
struct History hist, hist1, hist2, hist3, hist4, hist5;
struct _Color_Rule_ *rule;
- char *maps, *type;
+ const char *maps, *type;
int cond1, cond2;
cond2 = ((params->pcurv != NULL) ||
Modified: grass/trunk/lib/sites/sites.c
===================================================================
--- grass/trunk/lib/sites/sites.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/sites/sites.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -266,13 +266,13 @@
*
**********************************************************************/
-char *G_find_sites(char *name, const char *mapset)
+const char *G_find_sites(char *name, const char *mapset)
{
return G_find_vector(name, mapset);
}
-char *G_find_sites2(const char *name, const char *mapset)
+const char *G_find_sites2(const char *name, const char *mapset)
{
return G_find_vector2(name, mapset);
}
Modified: grass/trunk/lib/symbol/read.c
===================================================================
--- grass/trunk/lib/symbol/read.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/symbol/read.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -232,7 +232,8 @@
int i, j, k, l;
FILE *fp;
char group[500], name[500], buf[2001];
- char *ms, *c;
+ const char *ms;
+ char *c;
double x, y, x2, y2, rad, ang1, ang2;
int r, g, b;
double fr, fg, fb;
Modified: grass/trunk/lib/vector/Vlib/open.c
===================================================================
--- grass/trunk/lib/vector/Vlib/open.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/vector/Vlib/open.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -130,7 +130,7 @@
FILE *fp;
int level, level_request, ferror;
int format, ret;
- char *fmapset;
+ const char *fmapset;
G_debug(1, "Vect_open_old(): name = %s mapset= %s update = %d", name,
mapset, update);
Modified: grass/trunk/lib/vector/diglib/file.c
===================================================================
--- grass/trunk/lib/vector/diglib/file.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/lib/vector/diglib/file.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -154,7 +154,7 @@
int dig_file_load(GVFILE * file)
{
int ret, mode, load;
- char *cmode;
+ const char *cmode;
size_t size;
struct stat sbuf;
Modified: grass/trunk/ps/ps.map/colortable.h
===================================================================
--- grass/trunk/ps/ps.map/colortable.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/ps/ps.map/colortable.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -12,7 +12,7 @@
double height; /* fp legend height */
char *font;
char *name;
- char *mapset;
+ const char *mapset;
int fontsize;
int color;
int cols;
Modified: grass/trunk/ps/ps.map/do_header.c
===================================================================
--- grass/trunk/ps/ps.map/do_header.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/ps/ps.map/do_header.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -10,12 +10,12 @@
#include "local_proto.h"
static double x, y, dy, fontsize;
-static int append(char, char *);
-static int apply(char *, char *, char *);
+static void append(char, char *);
+static void apply(const char *, const char *, char *);
static char *get_format(char *, char *);
-static int output(char *, char *);
+static int output(char *, const char *);
-int do_map_header(char *date)
+int do_map_header(const char *date)
{
char temp[100];
@@ -59,7 +59,7 @@
}
-int read_header_file(char *date)
+int read_header_file(const char *date)
{
char buf[1024];
@@ -71,7 +71,7 @@
}
-static int output(char *line, char *date)
+static int output(char *line, const char *date)
{
char text[1024];
char fmt[30];
@@ -162,22 +162,18 @@
}
-static int append(char c, char *buf)
+static void append(char c, char *buf)
{
while (*buf)
buf++;
*buf++ = c;
*buf = 0;
-
- return 0;
}
-static int apply(char *buf, char *fmt, char *text)
+static void apply(const char *buf, const char *fmt, char *text)
{
char temp[300];
sprintf(temp, fmt, buf);
strcat(text, temp);
-
- return 0;
}
Modified: grass/trunk/ps/ps.map/error.c
===================================================================
--- grass/trunk/ps/ps.map/error.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/ps/ps.map/error.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -4,7 +4,7 @@
#include "local_proto.h"
extern FILE *tracefd;
-int error(char *a, char *b, char *c)
+int error(const char *a, const char *b, const char *c)
{
char msg[2000];
Modified: grass/trunk/ps/ps.map/local_proto.h
===================================================================
--- grass/trunk/ps/ps.map/local_proto.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/ps/ps.map/local_proto.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -30,8 +30,8 @@
int do_geogrid_numbers(void);
/* do_header.c */
-int do_map_header(char *);
-int read_header_file(char *);
+int do_map_header(const char *);
+int read_header_file(const char *);
/* do_labels.c */
int do_labels(int);
@@ -56,7 +56,7 @@
int do_vpoints(int);
/* error.c */
-int error(char *, char *, char *);
+int error(const char *, const char *, const char *);
/* fit_map.c */
int fit_map_to_box(void);
Modified: grass/trunk/ps/ps.map/outl_io.c
===================================================================
--- grass/trunk/ps/ps.map/outl_io.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/ps/ps.map/outl_io.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -61,16 +61,10 @@
RASTER_MAP_TYPE o_open_file(char *cell)
{
- char *mapset;
-
/* open raster map */
- if ((mapset = G_find_cell(cell, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), cell);
-
sscanf(cell, "%s", cell_name);
- if ((in_file_d = G_open_cell_old(cell_name, mapset)) < 0)
- G_fatal_error(_("Unable to open raster map <%s> in mapset <%s>"),
- cell_name, mapset);
+ if ((in_file_d = G_open_cell_old(cell_name, "")) < 0)
+ G_fatal_error(_("Unable to open raster map <%s>"), cell_name);
map_type = G_get_raster_map_type(in_file_d);
raster_size = G_raster_size(map_type);
Modified: grass/trunk/ps/ps.map/ps_info.h
===================================================================
--- grass/trunk/ps/ps.map/ps_info.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/ps/ps.map/ps_info.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -25,7 +25,7 @@
struct Colors colors;
struct Categories cats;
CELL min_color, max_color;
- char *cell_mapset;
+ const char *cell_mapset;
char *cell_name;
char *plfile;
char *commentfile;
Modified: grass/trunk/ps/ps.map/ps_map.c
===================================================================
--- grass/trunk/ps/ps.map/ps_map.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/ps/ps.map/ps_map.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -23,7 +23,7 @@
int ps_map(void)
{
long current_offset;
- char *date;
+ const char *date;
int urx, ury;
/* get date */
Modified: grass/trunk/ps/ps.map/r_cell.c
===================================================================
--- grass/trunk/ps/ps.map/r_cell.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/ps/ps.map/r_cell.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -16,7 +16,6 @@
if (PS.cell_fd >= 0) {
G_close_cell(PS.cell_fd);
G_free(PS.cell_name);
- G_free(PS.cell_mapset);
G_free_colors(&PS.colors);
PS.cell_fd = -1;
}
Modified: grass/trunk/ps/ps.map/r_group.c
===================================================================
--- grass/trunk/ps/ps.map/r_group.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/ps/ps.map/r_group.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -20,7 +20,6 @@
if (PS.cell_fd >= 0) {
G_close_cell(PS.cell_fd);
G_free(PS.cell_name);
- G_free(PS.cell_mapset);
G_free_colors(&PS.colors);
PS.cell_fd = -1;
}
Modified: grass/trunk/ps/ps.map/r_rgb.c
===================================================================
--- grass/trunk/ps/ps.map/r_rgb.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/ps/ps.map/r_rgb.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -25,7 +25,6 @@
if (PS.cell_fd >= 0) {
G_close_cell(PS.cell_fd);
G_free(PS.cell_name);
- G_free(PS.cell_mapset);
G_free_colors(&PS.colors);
PS.cell_fd = -1;
}
@@ -45,7 +44,8 @@
/* get file names for R, G, & B */
for (i = 0; i < 3; i++) {
- char *mapset, *name, *p;
+ const char *mapset, *name;
+ char *p;
name = names[i];
Modified: grass/trunk/ps/ps.map/scan_gis.c
===================================================================
--- grass/trunk/ps/ps.map/scan_gis.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/ps/ps.map/scan_gis.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -6,7 +6,7 @@
int scan_gis(char *element, char *desc, char *key, char *data,
char *name, char *mapset, int gobble)
{
- char *ms;
+ const char *ms;
*mapset = 0;
Modified: grass/trunk/raster/r.buffer/local_proto.h
===================================================================
--- grass/trunk/raster/r.buffer/local_proto.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.buffer/local_proto.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -50,12 +50,12 @@
int process_row(int, int);
/* read_map.c */
-int read_input_map(char *, char *, int);
+int read_input_map(const char *, const char *, int);
/* support.c */
-int make_support_files(char *, char *);
+int make_support_files(const char *, const char *);
/* write_map.c */
-int write_output_map(char *, int);
+int write_output_map(const char *, int);
#endif /* __LOCAL_PROTO_H__ */
Modified: grass/trunk/raster/r.buffer/main.c
===================================================================
--- grass/trunk/raster/r.buffer/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.buffer/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -42,10 +42,10 @@
int main(int argc, char *argv[])
{
struct Distance *pd;
- char *input, *output, *mapset;
+ const char *input, *output, *mapset;
char **zone_list;
double to_meters;
- char *units;
+ const char *units;
int offset;
int count;
int step, nsteps;
Modified: grass/trunk/raster/r.carve/main.c
===================================================================
--- grass/trunk/raster/r.carve/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.carve/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -60,7 +60,7 @@
struct Option *width, *depth;
struct Flag *noflat;
- char *vmapset, *rmapset;
+ const char *vmapset, *rmapset;
int infd, outfd;
struct Map_info Map;
struct Map_info outMap;
Modified: grass/trunk/raster/r.category/cats.c
===================================================================
--- grass/trunk/raster/r.category/cats.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.category/cats.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -19,11 +19,11 @@
#include <stdlib.h>
#include <grass/gis.h>
#include <grass/glocale.h>
+#include "local_proto.h"
static struct Cell_stats statf;
-
-int get_cats(char *name, char *mapset)
+int get_cats(const char *name, const char *mapset)
{
int fd;
int row, nrows, ncols;
Modified: grass/trunk/raster/r.category/local_proto.h
===================================================================
--- grass/trunk/raster/r.category/local_proto.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.category/local_proto.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -20,13 +20,13 @@
#define __LOCAL_PROTO_H__
/* cats.c */
-int get_cats(char *, char *);
+int get_cats(const char *, const char *);
int next_cat(long *);
/* main.c */
int print_label(long);
int print_d_label(double);
-int scan_cats(char *, long *, long *);
-int scan_vals(char *, double *);
+int scan_cats(const char *, long *, long *);
+int scan_vals(const char *, double *);
#endif /* __LOCAL_PROTO_H__ */
Modified: grass/trunk/raster/r.category/main.c
===================================================================
--- grass/trunk/raster/r.category/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.category/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -30,8 +30,8 @@
int main(int argc, char *argv[])
{
- char *name;
- char *mapset;
+ const char *name;
+ const char *mapset;
long x, y;
double dx;
RASTER_MAP_TYPE map_type;
@@ -139,7 +139,7 @@
/* use cats from another map */
if (parm.raster->answer) {
int fd;
- char *cmapset;
+ const char *cmapset;
cmapset = G_find_cell2(parm.raster->answer, "");
if (cmapset == NULL)
@@ -321,7 +321,7 @@
return 0;
}
-int scan_cats(char *s, long *x, long *y)
+int scan_cats(const char *s, long *x, long *y)
{
char dummy[2];
@@ -336,7 +336,7 @@
return 0;
}
-int scan_vals(char *s, double *x)
+int scan_vals(const char *s, double *x)
{
char dummy[10];
Modified: grass/trunk/raster/r.coin/print_hdr.c
===================================================================
--- grass/trunk/raster/r.coin/print_hdr.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.coin/print_hdr.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -22,7 +22,7 @@
int print_coin_hdr(int Conformat)
{
char unit_type[20];
- char *mapset, *location;
+ const char *mapset, *location;
char north[30], south[30], east[30], west[30];
mapset = G_mapset();
Modified: grass/trunk/raster/r.colors/main.c
===================================================================
--- grass/trunk/raster/r.colors/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.colors/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -143,9 +143,9 @@
int have_stats = 0;
struct FPRange range;
DCELL min, max;
- char *name, *mapset;
- char *style, *cmap, *cmapset;
- char *rules;
+ const char *name, *mapset;
+ const char *style, *cmap, *cmapset;
+ const char *rules;
int fp;
struct GModule *module;
struct
Modified: grass/trunk/raster/r.cost/main.c
===================================================================
--- grass/trunk/raster/r.cost/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.cost/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -87,9 +87,9 @@
{
void *cell, *cell2;
SEGMENT in_seg, out_seg;
- char *cost_mapset;
- char *in_file, *out_file;
- char *search_mapset;
+ const char *cost_mapset;
+ const char *in_file, *out_file;
+ const char *search_mapset;
double *value;
extern struct Cell_head window;
double NS_fac, EW_fac, DIAG_fac, H_DIAG_fac, V_DIAG_fac;
Modified: grass/trunk/raster/r.cross/glob.h
===================================================================
--- grass/trunk/raster/r.cross/glob.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.cross/glob.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -33,7 +33,7 @@
extern int nrows;
extern int ncols;
extern int NCATS;
-extern char *names[NFILES];
+extern const char *names[NFILES];
extern struct Categories labels[NFILES];
typedef struct
Modified: grass/trunk/raster/r.cross/main.c
===================================================================
--- grass/trunk/raster/r.cross/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.cross/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -27,7 +27,7 @@
int nrows;
int ncols;
int NCATS = 1 << SHIFT;
-char *names[NFILES];
+const char *names[NFILES];
struct Categories labels[NFILES];
NODE *tree; /* tree of values */
int tlen; /* allocate tree size */
@@ -43,9 +43,9 @@
int fd[NFILES];
int outfd;
int i;
- char *name;
- char *output;
- char *mapset;
+ const char *name;
+ const char *output;
+ const char *mapset;
int non_zero;
struct Range range;
CELL ncats, max_cats;
@@ -156,7 +156,7 @@
qsort(reclass, result + 1, sizeof(RECLASS), cmp);
table = (CELL *) G_calloc(result + 1, sizeof(CELL));
for (i = 0; i < nfiles; i++) {
- mapset = G_find_cell(names[i], "");
+ mapset = G_find_cell2(names[i], "");
G_read_cats(names[i], mapset, &labels[i]);
}
Modified: grass/trunk/raster/r.distance/defs.h
===================================================================
--- grass/trunk/raster/r.distance/defs.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.distance/defs.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -38,9 +38,9 @@
struct Map
{
- char *name; /* raster map name */
- char *mapset; /* raster map mapset */
- char *fullname; /* raster map fully qualified name */
+ const char *name; /* raster map name */
+ const char *mapset; /* raster map mapset */
+ const char *fullname; /* raster map fully qualified name */
struct Categories labels; /* category labels */
struct EdgeList edges; /* edge cells */
};
@@ -54,10 +54,10 @@
};
/* distance.c */
-void find_minimum_distance(struct CatEdgeList *, struct CatEdgeList *,
+void find_minimum_distance(const struct CatEdgeList *, const struct CatEdgeList *,
double *, double *, double *, double *, double *,
- struct Cell_head *, int, char *, char *);
-int null_distance(char *name1, char *name2, int *, int *);
+ const struct Cell_head *, int, const char *, const char *);
+int null_distance(const char *, const char *, int *, int *);
/* edges.c */
void print_edge_info(struct Map *);
Modified: grass/trunk/raster/r.distance/distance.c
===================================================================
--- grass/trunk/raster/r.distance/distance.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.distance/distance.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -25,11 +25,10 @@
/* this code assumes that list1 and list2 have at least one cell in each */
void
-find_minimum_distance(struct CatEdgeList *list1, struct CatEdgeList *list2,
- double *east1, double *north1, double *east2,
- double *north2, double *distance,
- struct Cell_head *region, int overlap, char *name1,
- char *name2)
+find_minimum_distance(const struct CatEdgeList *list1, const struct CatEdgeList *list2,
+ double *east1, double *north1, double *east2, double *north2,
+ double *distance, const struct Cell_head *region, int overlap,
+ const char *name1, const char *name2)
{
int i1, i2;
double dist;
@@ -76,10 +75,10 @@
}
}
-int null_distance(char *name1, char *name2, int *zerro_row, int *zerro_col)
+int null_distance(const char *name1, const char *name2, int *zerro_row, int *zerro_col)
{
RASTER_MAP_TYPE maptype1, maptype2;
- char *mapset;
+ const char *mapset;
int mapd1, mapd2;
void *inrast1, *inrast2;
int nrows, ncols, row, col;
Modified: grass/trunk/raster/r.distance/parse.c
===================================================================
--- grass/trunk/raster/r.distance/parse.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.distance/parse.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -26,7 +26,7 @@
{
struct Option *maps, *fs;
struct Flag *labels, *overlap;
- char *name, *mapset;
+ const char *name, *mapset;
maps = G_define_option();
@@ -59,14 +59,14 @@
exit(EXIT_FAILURE);
name = parms->map1.name = maps->answers[0];
- mapset = parms->map1.mapset = G_find_cell(name, "");
+ mapset = parms->map1.mapset = G_find_cell2(name, "");
if (mapset == NULL)
G_fatal_error(_("Raster map <%s> not found"), name);
parms->map1.fullname = G_fully_qualified_name(name, mapset);
name = parms->map2.name = maps->answers[1];
- mapset = parms->map2.mapset = G_find_cell(name, "");
+ mapset = parms->map2.mapset = G_find_cell2(name, "");
if (mapset == NULL)
G_fatal_error(_("Raster map <%s> not found"), name);
Modified: grass/trunk/raster/r.fill.dir/main.c
===================================================================
--- grass/trunk/raster/r.fill.dir/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.fill.dir/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -54,17 +54,18 @@
#include "tinf.h"
#include "local.h"
+static int dir_type(int type, int dir);
+
int main(int argc, char **argv)
{
-
int fe, fd, fm;
- int i, j, type, dir_type();
+ int i, j, type;
int new_id;
int nrows, ncols, nbasins;
- int cell_open(), cell_open_new();
int map_id, dir_id, bas_id;
- char map_name[GNAME_MAX], *map_mapset, new_map_name[GNAME_MAX];
- char *tempfile1, *tempfile2, *tempfile3;
+ char map_name[GNAME_MAX], new_map_name[GNAME_MAX];
+ const char *map_mapset;
+ const char *tempfile1, *tempfile2, *tempfile3;
char dir_name[GNAME_MAX];
char bas_name[GNAME_MAX];
@@ -295,7 +296,7 @@
exit(EXIT_SUCCESS);
}
-int dir_type(int type, int dir)
+static int dir_type(int type, int dir)
{
if (type == 1) { /* AGNPS aspect format */
if (dir == 128)
Modified: grass/trunk/raster/r.flow/io.c
===================================================================
--- grass/trunk/raster/r.flow/io.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.flow/io.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -38,12 +38,12 @@
/****************************** Annoyances ******************************/
-static char *tmp_name(char *fullname)
+static const char *tmp_name(const char *fullname)
{
- char *mapset = G_mapset();
- char *location = G_location_path();
char element[1024];
- char *el = element;
+ const char *mapset = G_mapset();
+ const char *location = G_location_path();
+ const char *el = element;
G__temp_element(element);
while (*fullname++ == *location++) ;
@@ -57,7 +57,7 @@
static int open_existing_cell_file(char *fname, struct Cell_head *chd)
{
- char *mapset = G_find_cell(fname, "");
+ const char *mapset = G_find_cell(fname, "");
if (mapset == NULL)
G_fatal_error(_("Raster map <%s> not found"), fname);
@@ -125,17 +125,17 @@
}
}
-static int open_segment_file(char *name, layer l, int new)
+static int open_segment_file(const char *name, layer l, int new)
{
int fd;
- char *mapset;
+ const char *mapset;
if (new == TEMP)
G__temp_element(string);
else
sprintf(string, "cell_misc/%s", parm.elevin);
- if (new || !(mapset = G_find_file(string, name, ""))) {
+ if (new || !(mapset = G_find_file2(string, name, ""))) {
if ((fd = G_open_new(string, name)) < 0)
G_fatal_error(_("Cannot create segment file %s"), name);
@@ -188,7 +188,7 @@
void write_density_file(void)
{
- char *mapset;
+ const char *mapset;
int dsfd, row, col;
double dsmax = 0.0;
struct Colors colors;
Modified: grass/trunk/raster/r.in.arc/gethead.c
===================================================================
--- grass/trunk/raster/r.in.arc/gethead.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.in.arc/gethead.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -19,7 +19,7 @@
int nodata, res, s, w, r, c;
char label[100], value[100];
char buf[1024];
- char *err;
+ const char *err;
s = nodata = res = w = r = c = 0;
Modified: grass/trunk/raster/r.in.ascii/gethead.c
===================================================================
--- grass/trunk/raster/r.in.ascii/gethead.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.in.ascii/gethead.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -86,7 +86,7 @@
int n, s, e, w, r, c;
char label[100], value[100];
char buf[1024];
- char *err;
+ const char *err;
int ret, len;
/* rsb fix */
Modified: grass/trunk/raster/r.in.bin/main.c
===================================================================
--- grass/trunk/raster/r.in.bin/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.in.bin/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -71,9 +71,9 @@
int main(int argc, char *argv[])
{
- char *input;
- char *output;
- char *title;
+ const char *input;
+ const char *output;
+ const char *title;
FILE *fd;
int cf;
struct Cell_head cellhd;
@@ -95,7 +95,7 @@
double *x_d;
struct stat fileinfo;
int FILE_SIZE;
- char *err;
+ const char *err;
char dummy[2];
struct GRD_HEADER header;
struct
@@ -231,8 +231,7 @@
input = parm.input->answer;
output = parm.output->answer;
- if (title = parm.title->answer)
- G_strip(title);
+ title = parm.title->answer;
if (flag.f->answer)
bytes = 4;
Modified: grass/trunk/raster/r.in.gridatb/local_proto.h
===================================================================
--- grass/trunk/raster/r.in.gridatb/local_proto.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.in.gridatb/local_proto.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -8,5 +8,5 @@
extern struct Cell_head cellhd;
extern FCELL *cell;
-extern char *file;
-extern char *mapset, *oname;
+extern const char *file;
+extern const char *mapset, *oname;
Modified: grass/trunk/raster/r.in.gridatb/main.c
===================================================================
--- grass/trunk/raster/r.in.gridatb/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.in.gridatb/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -23,8 +23,8 @@
struct Cell_head cellhd;
FCELL *cell;
-char *file;
-char *mapset, *oname;
+const char *file;
+const char *mapset, *oname;
int main(int argc, char **argv)
{
Modified: grass/trunk/raster/r.in.mat/main.c
===================================================================
--- grass/trunk/raster/r.in.mat/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.in.mat/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -65,7 +65,8 @@
int *pval_i; /* for misc use */
float *pval_f; /* for misc use */
double *pval_d; /* for misc use */
- char c, *buff; /* for misc use */
+ char c; /* for misc use */
+ const char *err;
char map_name[65], map_title[1024]; /* 65 = 64 + null-terminator */
double map_name_d[1024]; /* I'm not sure why you'd save char strings as double, but whatever */
@@ -387,9 +388,9 @@
region.proj = G_projection();
region.zone = G_zone();
- buff = G_adjust_Cell_head(®ion, 1, 1);
- if (buff)
- G_fatal_error(buff);
+ err = G_adjust_Cell_head(®ion, 1, 1);
+ if (err)
+ G_fatal_error(err);
G_set_window(®ion);
G_verbose_message("");
Modified: grass/trunk/raster/r.info/main.c
===================================================================
--- grass/trunk/raster/r.info/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.info/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -38,7 +38,7 @@
int main(int argc, char **argv)
{
- char *name, *mapset;
+ const char *name, *mapset;
char tmp1[100], tmp2[100], tmp3[100];
char timebuff[256];
char units[GNAME_MAX], vdatum[GNAME_MAX];
Modified: grass/trunk/raster/r.kappa/kappa.h
===================================================================
--- grass/trunk/raster/r.kappa/kappa.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.kappa/kappa.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -10,20 +10,20 @@
struct _layer_
{
- char *name;
- char *mapset;
+ const char *name;
+ const char *mapset;
struct Categories labels;
};
extern struct Cell_head window;
-extern char *maps[2];
-extern char *output;
-extern char *title;
+extern const char *maps[2];
+extern const char *output;
+extern const char *title;
extern long *matr;
extern long *rlst;
extern int ncat;
-extern char *stats_file;
+extern const char *stats_file;
#define LAYER struct _layer_
extern LAYER *layers;
Modified: grass/trunk/raster/r.kappa/main.c
===================================================================
--- grass/trunk/raster/r.kappa/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.kappa/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -30,13 +30,13 @@
struct Cell_head window;
-char *maps[2];
-char *output;
-char *title;
+const char *maps[2];
+const char *output;
+const char *title;
long *matr;
long *rlst;
int ncat;
-char *stats_file;
+const char *stats_file;
LAYER *layers;
int nlayers;
@@ -45,7 +45,7 @@
size_t nstats;
/* function prototypes */
-static void layer(char *s);
+static void layer(const char *s);
int main(int argc, char **argv)
{
@@ -131,9 +131,10 @@
}
-static void layer(char *s)
+static void layer(const char *s)
{
- char name[GNAME_MAX], *mapset;
+ char name[GNAME_MAX];
+ const char *mapset;
int n;
strcpy(name, s);
Modified: grass/trunk/raster/r.kappa/prt_mat.c
===================================================================
--- grass/trunk/raster/r.kappa/prt_mat.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.kappa/prt_mat.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -23,7 +23,7 @@
int thisone;
long t_row, t_col;
long t_rowcount, grand_count;
- char *mapone;
+ const char *mapone;
FILE *fd;
if (output != NULL) {
Modified: grass/trunk/raster/r.kappa/stats.c
===================================================================
--- grass/trunk/raster/r.kappa/stats.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.kappa/stats.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -18,7 +18,7 @@
{
char buf[1024];
char mname[GNAME_MAX], rname[GMAPSET_MAX];
- char *mmapset, *rmapset;
+ const char *mmapset, *rmapset;
int i, nl;
size_t ns;
FILE *fd;
@@ -41,8 +41,9 @@
strcat(buf, G_fully_qualified_name(maps[0], mmapset));
strcat(buf, ",");
strcat(buf, G_fully_qualified_name(maps[1], rmapset));
- strcat(buf, " > ");
+ strcat(buf, " > \"");
strcat(buf, stats_file);
+ strcat(buf, "\"");
if (system(buf)) {
unlink(stats_file);
Modified: grass/trunk/raster/r.li/r.li.cwed/cwed.c
===================================================================
--- grass/trunk/raster/r.li/r.li.cwed/cwed.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.li/r.li.cwed/cwed.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -94,7 +94,6 @@
int l; /*number of read byte */
int ris = 0;
- char *mapset;
char *file;
char *strFile;
@@ -160,9 +159,7 @@
return RLI_ERRORE;
}
- mapset = G_find_cell(ad->raster, "");
-
- if (G_get_cellhd(ad->raster, mapset, &hd) == -1) {
+ if (G_get_cellhd(ad->raster, "", &hd) == -1) {
G_fatal_error("can't read raster header");
return RLI_ERRORE;
}
Modified: grass/trunk/raster/r.li/r.li.daemon/daemon.c
===================================================================
--- grass/trunk/raster/r.li/r.li.daemon/daemon.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.li/r.li.daemon/daemon.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -285,7 +285,8 @@
{
struct stat s;
struct Cell_head cellhd;
- char *buf, *token, *mapset;
+ char *buf;
+ const char *token;
int setup;
int letti;
double rel_x, rel_y, rel_rl, rel_cl;
@@ -314,8 +315,7 @@
rel_cl = atof(strtok(NULL, "\n"));
/*finding raster map */
- mapset = G_find_cell(raster, "");
- if (G_get_cellhd(raster, mapset, &cellhd) == -1)
+ if (G_get_cellhd(raster, "", &cellhd) == -1)
G_fatal_error(_("Cannot read raster header file"));
/*calculating absolute sampling frame definition */
sf_x = (int)rint(cellhd.cols * rel_x);
Modified: grass/trunk/raster/r.li/r.li.daemon/worker.c
===================================================================
--- grass/trunk/raster/r.li/r.li.daemon/worker.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.li/r.li.daemon/worker.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -40,7 +40,6 @@
void worker(char *raster, int f(int, char **, area_des, double *),
char *server_channel, char *mychannel, char **parameters)
{
- char *mapset;
int fd, aid;
int rec_ch, send_ch, erease_mask = 0, data_type = 0;
int cache_rows, used = 0;
@@ -59,14 +58,13 @@
pid = getpid();
ad = malloc(sizeof(struct area_entry));
/* open raster map */
- mapset = G_find_cell(raster, "");
- fd = G_open_cell_old(raster, mapset);
- if (G_get_cellhd(raster, mapset, &hd) == -1) {
+ fd = G_open_cell_old(raster, "");
+ if (G_get_cellhd(raster, "", &hd) == -1) {
G_message(_("CHILD[pid = %i] cannot open raster map"), pid);
exit(EXIT_FAILURE);
}
/* read data type to allocate cache */
- data_type = G_raster_map_type(raster, mapset);
+ data_type = G_raster_map_type(raster, "");
/* calculate rows in cache */
switch (data_type) {
case CELL_TYPE:{
@@ -222,27 +220,26 @@
char *mask_preprocessing(char *mask, char *raster, int rl, int cl)
{
- char *mapset, *tmp_file;
+ const char *tmp_file;
struct Cell_head cell, oldcell;
int mask_fd, old_fd, *buf, i, j;
CELL *old;
double add_row, add_col;
buf = malloc(cl * sizeof(int));
- mapset = G_find_cell(raster, "");
/* open raster */
- if (G_get_cellhd(raster, mapset, &cell) == -1)
+ if (G_get_cellhd(raster, "", &cell) == -1)
return NULL;
- mapset = G_find_cell(mask, "");
+
/* open raster */
- if (G_get_cellhd(mask, mapset, &oldcell) == -1)
+ if (G_get_cellhd(mask, "", &oldcell) == -1)
return NULL;
add_row = 1.0 * oldcell.rows / rl;
add_col = 1.0 * oldcell.cols / cl;
tmp_file = G_tempfile();
mask_fd = open(tmp_file, O_RDWR | O_CREAT, 0755);
- old_fd = G_open_cell_old(mask, mapset);
+ old_fd = G_open_cell_old(mask, "");
old = G_allocate_cell_buf();
for (i = 0; i < rl; i++) {
int riga;
Modified: grass/trunk/raster/r.li/r.li.dominance/dominance.c
===================================================================
--- grass/trunk/raster/r.li/r.li.dominance/dominance.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.li/r.li.dominance/dominance.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -67,17 +67,12 @@
int dominance(int fd, char **par, area_des ad, double *result)
{
- char *mapset;
-
int ris = RLI_OK;
-
double indice = 0;
-
struct Cell_head hd;
- mapset = G_find_cell(ad->raster, "");
- if (G_get_cellhd(ad->raster, mapset, &hd) == -1)
+ if (G_get_cellhd(ad->raster, "", &hd) == -1)
return RLI_ERRORE;
Modified: grass/trunk/raster/r.li/r.li.edgedensity/edgedensity.c
===================================================================
--- grass/trunk/raster/r.li/r.li.edgedensity/edgedensity.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.li/r.li.edgedensity/edgedensity.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -78,16 +78,10 @@
int edgedensity(int fd, char **valore, area_des ad, double *result)
{
struct Cell_head hd;
-
int ris = -1;
-
- char *mapset;
-
double indice = 0;
- mapset = G_find_cell(ad->raster, "");
-
- if (G_get_cellhd(ad->raster, mapset, &hd) == -1)
+ if (G_get_cellhd(ad->raster, "", &hd) == -1)
return RLI_ERRORE;
Modified: grass/trunk/raster/r.li/r.li.mpa/mpa.c
===================================================================
--- grass/trunk/raster/r.li/r.li.mpa/mpa.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.li/r.li.mpa/mpa.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -64,16 +64,11 @@
int meanPixelAttribute(int fd, char **par, area_des ad, double *result)
{
- char *mapset;
-
int ris = 0;
-
double indice = 0;
-
struct Cell_head hd;
- mapset = G_find_cell(ad->raster, "");
- if (G_get_cellhd(ad->raster, mapset, &hd) == -1)
+ if (G_get_cellhd(ad->raster, "", &hd) == -1)
return RLI_ERRORE;
Modified: grass/trunk/raster/r.li/r.li.mps/mps.c
===================================================================
--- grass/trunk/raster/r.li/r.li.mps/mps.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.li/r.li.mps/mps.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -65,22 +65,13 @@
int meanPatchSize(int fd, char **par, area_des ad, double *result)
{
- char *mapset;
-
int ris = 0;
-
double indice = 0;
-
struct Cell_head hd;
-
-
- mapset = G_find_cell(ad->raster, "");
- if (G_get_cellhd(ad->raster, mapset, &hd) == -1)
+ if (G_get_cellhd(ad->raster, "", &hd) == -1)
return RLI_ERRORE;
-
-
switch (ad->data_type) {
case CELL_TYPE:
{
Modified: grass/trunk/raster/r.li/r.li.padcv/padcv.c
===================================================================
--- grass/trunk/raster/r.li/r.li.padcv/padcv.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.li/r.li.padcv/padcv.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -53,13 +53,11 @@
}
int patchAreaDistributionCV(int fd, char **par, area_des ad, double *result)
{
- char *mapset;
double indice = 0;
struct Cell_head hd;
int ris = RLI_OK;
- mapset = G_find_cell(ad->raster, "");
- if (G_get_cellhd(ad->raster, mapset, &hd) == -1)
+ if (G_get_cellhd(ad->raster, "", &hd) == -1)
return RLI_ERRORE;
switch (ad->data_type)
{
Modified: grass/trunk/raster/r.li/r.li.padrange/padrange.c
===================================================================
--- grass/trunk/raster/r.li/r.li.padrange/padrange.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.li/r.li.padrange/padrange.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -56,13 +56,11 @@
int patchAreaDistributionRANGE(int fd, char **par, area_des ad,
double *result)
{
- char *mapset;
double indice = 0;
struct Cell_head hd;
int ris = RLI_OK;
- mapset = G_find_cell(ad->raster, "");
- if (G_get_cellhd(ad->raster, mapset, &hd) == -1)
+ if (G_get_cellhd(ad->raster, "", &hd) == -1)
return RLI_ERRORE;
switch (ad->data_type)
{
Modified: grass/trunk/raster/r.li/r.li.padsd/padsd.c
===================================================================
--- grass/trunk/raster/r.li/r.li.padsd/padsd.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.li/r.li.padsd/padsd.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -53,13 +53,11 @@
}
int patchAreaDistributionSD(int fd, char **par, area_des ad, double *result)
{
- char *mapset;
double indice = 0;
struct Cell_head hd;
int ris = RLI_OK;
- mapset = G_find_cell(ad->raster, "");
- if (G_get_cellhd(ad->raster, mapset, &hd) == -1)
+ if (G_get_cellhd(ad->raster, "", &hd) == -1)
return RLI_ERRORE;
switch (ad->data_type)
{
Modified: grass/trunk/raster/r.li/r.li.patchdensity/main.c
===================================================================
--- grass/trunk/raster/r.li/r.li.patchdensity/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.li/r.li.patchdensity/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -61,15 +61,13 @@
CELL *buf, *sup;
int count = 0, i, j, connected = 0, complete_line = 1, other_above = 0;
double area;
- char *mapset;
struct Cell_head hd;
CELL complete_value;
double EW_DIST1, EW_DIST2, NS_DIST1, NS_DIST2;
int mask_fd = -1, *mask_buf, *mask_sup, null_count = 0;
G_set_c_null_value(&complete_value, 1);
- mapset = G_find_cell(ad->raster, "");
- if (G_get_cellhd(ad->raster, mapset, &hd) == -1)
+ if (G_get_cellhd(ad->raster, "", &hd) == -1)
return 0;
sup = G_allocate_cell_buf();
Modified: grass/trunk/raster/r.li/r.li.patchnum/main.c
===================================================================
--- grass/trunk/raster/r.li/r.li.patchnum/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.li/r.li.patchnum/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -59,14 +59,12 @@
{
CELL *buf, *sup;
int count = 0, i, j, connected = 0, complete_line = 1, other_above = 0;
- char *mapset;
struct Cell_head hd;
CELL complete_value;
int mask_fd = -1, *mask_buf, *mask_sup, null_count = 0;
G_set_c_null_value(&complete_value, 1);
- mapset = G_find_cell(ad->raster, "");
- if (G_get_cellhd(ad->raster, mapset, &hd) == -1)
+ if (G_get_cellhd(ad->raster, "", &hd) == -1)
return 0;
sup = G_allocate_cell_buf();
Modified: grass/trunk/raster/r.li/r.li.richness/richness.c
===================================================================
--- grass/trunk/raster/r.li/r.li.richness/richness.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.li/r.li.richness/richness.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -63,18 +63,11 @@
int dominance(int fd, char **par, area_des ad, double *result)
{
- char *mapset;
-
int ris = RLI_OK;
-
double indice = 0;
-
struct Cell_head hd;
-
-
- mapset = G_find_cell(ad->raster, "");
- if (G_get_cellhd(ad->raster, mapset, &hd) == -1)
+ if (G_get_cellhd(ad->raster, "", &hd) == -1)
return RLI_ERRORE;
switch (ad->data_type) {
Modified: grass/trunk/raster/r.li/r.li.shannon/shannon.c
===================================================================
--- grass/trunk/raster/r.li/r.li.shannon/shannon.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.li/r.li.shannon/shannon.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -64,17 +64,11 @@
int shannon(int fd, char **par, area_des ad, double *result)
{
- char *mapset;
-
int ris = RLI_OK;
-
double indice = 0;
-
struct Cell_head hd;
-
- mapset = G_find_cell(ad->raster, "");
- if (G_get_cellhd(ad->raster, mapset, &hd) == -1)
+ if (G_get_cellhd(ad->raster, "", &hd) == -1)
return RLI_ERRORE;
Modified: grass/trunk/raster/r.li/r.li.shape/main.c
===================================================================
--- grass/trunk/raster/r.li/r.li.shape/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.li/r.li.shape/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -61,7 +61,6 @@
double area;
- char *mapset;
struct Cell_head hd;
CELL complete_value;
double EW_DIST1, EW_DIST2, NS_DIST1, NS_DIST2;
@@ -70,8 +69,7 @@
int *mask_buf;
G_set_c_null_value(&complete_value, 1);
- mapset = G_find_cell(ad->raster, "");
- if (G_get_cellhd(ad->raster, mapset, &hd) == -1)
+ if (G_get_cellhd(ad->raster, "", &hd) == -1)
return 0;
Modified: grass/trunk/raster/r.li/r.li.simpson/simpson.c
===================================================================
--- grass/trunk/raster/r.li/r.li.simpson/simpson.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.li/r.li.simpson/simpson.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -63,18 +63,11 @@
int simpson(int fd, char **par, area_des ad, double *result)
{
- char *mapset;
-
int ris = RLI_OK;
-
double indice = 0;
-
struct Cell_head hd;
-
-
- mapset = G_find_cell(ad->raster, "");
- if (G_get_cellhd(ad->raster, mapset, &hd) == -1)
+ if (G_get_cellhd(ad->raster, "", &hd) == -1)
return RLI_ERRORE;
switch (ad->data_type) {
Modified: grass/trunk/raster/r.los/main.c
===================================================================
--- grass/trunk/raster/r.los/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.los/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -66,10 +66,10 @@
int patt = 0, in_fd, out_fd, patt_fd = 0;
int old, new;
double slope_1, slope_2, max_vert_angle = 0.0, color_factor;
- char *old_mapset, *patt_mapset = NULL;
+ const char *old_mapset, *patt_mapset = NULL;
FCELL *value;
- char *search_mapset, *current_mapset;
- char *in_name, *out_name, *patt_name = NULL;
+ const char *search_mapset, *current_mapset;
+ const char *in_name, *out_name, *patt_name = NULL;
struct Categories cats;
struct Cell_head cellhd_elev, cellhd_patt;
extern struct Cell_head window;
Modified: grass/trunk/raster/r.mapcalc/map.c
===================================================================
--- grass/trunk/raster/r.mapcalc/map.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.mapcalc/map.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -1,4 +1,6 @@
+#include <grass/config.h>
+
#include <stdlib.h>
#include <limits.h>
#include <string.h>
@@ -455,7 +457,8 @@
int map_type(const char *name, int mod)
{
- char *mapset, *tmpname;
+ const char *mapset;
+ char *tmpname;
int result;
switch (mod) {
@@ -483,7 +486,7 @@
int open_map(const char *name, int mod, int row, int col)
{
int i;
- char *mapset;
+ const char *mapset;
int use_cats = 0;
int use_colors = 0;
struct map *m;
Modified: grass/trunk/raster/r.null/local_proto.h
===================================================================
--- grass/trunk/raster/r.null/local_proto.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.null/local_proto.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -8,5 +8,5 @@
/* null.c */
int main(int, char *[]);
int parse_d_mask_rule(char *, d_Mask *, char *);
-int process(char *, char *, int, RASTER_MAP_TYPE);
-int doit(char *, char *, int, RASTER_MAP_TYPE);
+int process(const char *, const char *, int, RASTER_MAP_TYPE);
+int doit(const char *, const char *, int, RASTER_MAP_TYPE);
Modified: grass/trunk/raster/r.null/main.c
===================================================================
--- grass/trunk/raster/r.null/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.null/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -27,7 +27,7 @@
int main(int argc, char *argv[])
{
- char *name, *mapset;
+ const char *name, *mapset;
char rname[GNAME_MAX], rmapset[GMAPSET_MAX];
char path[GPATH_MAX];
int row, col, null_fd;
@@ -133,7 +133,7 @@
map_type = G_raster_map_type(name, mapset);
- if (only_null && G_find_file_misc("cell_misc", "null", name, mapset))
+ if (only_null && G_find_file2_misc("cell_misc", "null", name, mapset))
G_fatal_error(_("Raster map <%s> already has a null bitmap file"), name);
if (map_type == CELL_TYPE) {
@@ -263,8 +263,7 @@
return 0;
}
-int
-process(char *name, char *mapset, int change_null, RASTER_MAP_TYPE map_type)
+int process(const char *name, const char *mapset, int change_null, RASTER_MAP_TYPE map_type)
{
struct Colors colr;
struct History hist;
@@ -306,7 +305,7 @@
return 0;
}
-int doit(char *name, char *mapset, int change_null, RASTER_MAP_TYPE map_type)
+int doit(const char *name, const char *mapset, int change_null, RASTER_MAP_TYPE map_type)
{
int new, old, row;
void *rast;
Modified: grass/trunk/raster/r.out.gdal/main.c
===================================================================
--- grass/trunk/raster/r.out.gdal/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.out.gdal/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -34,7 +34,7 @@
#include "local_proto.h"
-void supported_formats(char **formats)
+void supported_formats(const char **formats)
{
/* Code taken from r.in.gdal */
@@ -111,7 +111,7 @@
struct Cell_head cellhead;
struct Ref ref;
- char *mapset, *gdal_formats = NULL;
+ const char *mapset, *gdal_formats = NULL;
RASTER_MAP_TYPE maptype;
int bHaveMinMax;
double dfCellMin;
Modified: grass/trunk/raster/r.out.gridatb/check_ready.c
===================================================================
--- grass/trunk/raster/r.out.gridatb/check_ready.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.out.gridatb/check_ready.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -7,10 +7,6 @@
{
FILE *fp;
- mapset = G_find_cell(iname, "");
- if (!mapset)
- G_fatal_error(_("Raster map <%s> not found"), iname);
-
fp = fopen(file, "r");
if (!fp)
return;
Modified: grass/trunk/raster/r.out.gridatb/file_io.c
===================================================================
--- grass/trunk/raster/r.out.gridatb/file_io.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.out.gridatb/file_io.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -13,7 +13,7 @@
FCELL *fcell;
RASTER_MAP_TYPE data_type;
- fd = G_open_cell_old(iname, mapset);
+ fd = G_open_cell_old(iname, "");
if (fd < 0)
G_fatal_error("%s - could not read", iname);
@@ -30,7 +30,7 @@
break;
}
- G_get_cellhd(iname, mapset, &cellhd);
+ G_get_cellhd(iname, "", &cellhd);
adjcellhdval = adjcellhd(&cellhd);
switch (adjcellhdval) {
@@ -47,7 +47,7 @@
fp = fopen(file, "w");
- fprintf(fp, "%s\n", G_get_cell_title(iname, mapset));
+ fprintf(fp, "%s\n", G_get_cell_title(iname, ""));
fprintf(fp, "%d %d %lf\n", cellhd.cols, cellhd.rows, cellhd.ns_res);
for (row = 0; row < cellhd.rows; row++) {
Modified: grass/trunk/raster/r.out.gridatb/local_proto.h
===================================================================
--- grass/trunk/raster/r.out.gridatb/local_proto.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.out.gridatb/local_proto.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -8,6 +8,6 @@
extern struct Cell_head cellhd;
extern FCELL *cell;
-extern char *file;
-extern char *mapset, *iname;
+extern const char *file;
+extern const char *iname;
extern char overwr;
Modified: grass/trunk/raster/r.out.gridatb/main.c
===================================================================
--- grass/trunk/raster/r.out.gridatb/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.out.gridatb/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -23,8 +23,8 @@
struct Cell_head cellhd;
FCELL *cell;
-char *file;
-char *mapset, *iname;
+const char *file;
+const char *iname;
char overwr;
int main(int argc, char **argv)
Modified: grass/trunk/raster/r.out.mpeg/main.c
===================================================================
--- grass/trunk/raster/r.out.mpeg/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.out.mpeg/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -378,7 +378,8 @@
static char **gee_wildfiles(char *wildarg, char *element, int *num)
{
int n, cnt = 0;
- char path[GPATH_MAX], *mapset, cmd[GPATH_MAX], buf[512];
+ char path[GPATH_MAX], cmd[GPATH_MAX], buf[512];
+ const char *mapset;
char *p, *tfile;
static char *newfiles[MAXIMAGES];
FILE *tf;
Modified: grass/trunk/raster/r.param.scale/interface.c
===================================================================
--- grass/trunk/raster/r.param.scale/interface.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.param.scale/interface.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -164,28 +164,9 @@
mparam = ELEV;
}
- /*--------------------------------------------------------------------------*/
- /* CHECK INPUT RASTER FILE EXISTS */
-
- /*--------------------------------------------------------------------------*/
- if ((mapset_in = G_find_cell2(rast_in_name, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), rast_in_name);
-
- /*--------------------------------------------------------------------------*/
- /* CHECK OUTPUT RASTER FILE DOES NOT EXIST */
-
- /*--------------------------------------------------------------------------*/
-
- mapset_out = G_mapset(); /* Set output to current mapset. */
-
/* make sure input and output names are valid */
G_check_input_output_name(rast_in_name, rast_out_name, GR_FATAL_EXIT);
- /*--------------------------------------------------------------------------*/
- /* CHECK WINDOW SIZE IS NOT EVEN OR TOO LARGE */
-
- /*--------------------------------------------------------------------------*/
-
if ((wsize / 2 != (wsize - 1) / 2) || (wsize > MAX_WSIZE))
G_fatal_error(_("Inappropriate window size (too big or even)"));
}
Modified: grass/trunk/raster/r.param.scale/main.c
===================================================================
--- grass/trunk/raster/r.param.scale/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.param.scale/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -15,16 +15,10 @@
#include <grass/glocale.h>
#include "param.h"
-char
- *rast_in_name, /* Name of the raster file to process. */
- *rast_out_name, /* Name of the raster output file. */
- *mapset_in, /* If no problems, these will be names */
- *mapset_out, /* of mapsets containing the files to */
- /* be processed. Otherwise, error code. */
- constrained; /* Flag that forces quadtratic through */
-
+const char *rast_in_name; /* Name of the raster file to process. */
+const char *rast_out_name; /* Name of the raster output file. */
+int constrained; /* Flag that forces quadtratic through */
/* the central cell of the window. */
-
int
fd_in, /* File descriptor for input and */
fd_out, /* output raster files. */
Modified: grass/trunk/raster/r.param.scale/open_files.c
===================================================================
--- grass/trunk/raster/r.param.scale/open_files.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.param.scale/open_files.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -22,7 +22,7 @@
{
/* Open existing file and set the input file descriptor. */
- if ((fd_in = G_open_cell_old(rast_in_name, mapset_in)) < 0)
+ if ((fd_in = G_open_cell_old(rast_in_name, "")) < 0)
G_fatal_error(_("Cannot open raster map <%s>"), rast_in_name);
/* Open new file and set the output file descriptor. */
Modified: grass/trunk/raster/r.param.scale/param.h
===================================================================
--- grass/trunk/raster/r.param.scale/param.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.param.scale/param.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -81,12 +81,10 @@
/* ------ Global variables ------ */
-extern char
+extern const char
*rast_in_name, /* Name of the raster file to process. */
- *rast_out_name, /* Name of the raster output file. */
- *mapset_in, /* If no problems, these will be names */
- *mapset_out, /* of mapsets containing the files to */
- /* be processed. Otherwise, error code. */
+ *rast_out_name; /* Name of the raster output file. */
+extern int
constrained; /* Flag that forces quadtratic through */
/* the central cell of the window. */
Modified: grass/trunk/raster/r.param.scale/write_cols.c
===================================================================
--- grass/trunk/raster/r.param.scale/write_cols.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.param.scale/write_cols.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -18,21 +18,10 @@
void write_cols(void)
{
-
- /*------------------------------------------------------------------------*/
- /* INITIALISE */
-
- /*------------------------------------------------------------------------*/
-
struct Colors colours;
G_init_colors(&colours);
- /*------------------------------------------------------------------------*/
- /* FILL OUT COLORS STRUCTURE */
-
- /*------------------------------------------------------------------------*/
-
G_add_color_rule(FLAT, 180, 180, 180, /* White */
PIT, 0, 0, 0, &colours); /* Black */
G_add_color_rule(CHANNEL, 0, 0, 255, /* Blue */
@@ -40,14 +29,8 @@
G_add_color_rule(RIDGE, 255, 255, 0, /* Yellow */
PEAK, 255, 0, 0, &colours); /* Red */
+ G_write_colors(rast_out_name, G_mapset(), &colours);
- /*------------------------------------------------------------------------*/
- /* WRITE OUT COLORS STRUCTURE */
-
- /*------------------------------------------------------------------------*/
-
- G_write_colors(rast_out_name, mapset_out, &colours);
-
G_free_colors(&colours);
}
Modified: grass/trunk/raster/r.patch/support.c
===================================================================
--- grass/trunk/raster/r.patch/support.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.patch/support.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -17,7 +17,6 @@
struct Colors *colr, int *colr_ok, RASTER_MAP_TYPE out_type)
{
int i;
- char *mapset;
struct Categories pcats;
struct Colors pcolr;
CELL n;
@@ -25,13 +24,12 @@
int red, grn, blu;
int do_cats, do_colr;
- mapset = G_find_cell(names[0], "");
*cats_ok = 1;
*colr_ok = 1;
- if (G_read_cats(names[0], mapset, cats) < 0)
+ if (G_read_cats(names[0], "", cats) < 0)
*cats_ok = 0;
G_suppress_warnings(1);
- if (G_read_colors(names[0], mapset, colr) < 0)
+ if (G_read_colors(names[0], "", colr) < 0)
*colr_ok = 0;
G_suppress_warnings(0);
@@ -39,10 +37,9 @@
return 0;
for (i = 1; i < nfiles; i++) {
- mapset = G_find_cell(names[i], "");
- do_cats = *cats_ok && (G_read_cats(names[i], mapset, &pcats) >= 0);
+ do_cats = *cats_ok && (G_read_cats(names[i], "", &pcats) >= 0);
G_suppress_warnings(1);
- do_colr = *colr_ok && (G_read_colors(names[i], mapset, &pcolr) >= 0);
+ do_colr = *colr_ok && (G_read_colors(names[i], "", &pcolr) >= 0);
G_suppress_warnings(0);
if (!do_cats && !do_colr)
continue;
Modified: grass/trunk/raster/r.reclass/main.c
===================================================================
--- grass/trunk/raster/r.reclass/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.reclass/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -31,7 +31,7 @@
char buf[1024];
RULE *rules, *tail;
int any;
- char *old_mapset;
+ const char *old_mapset;
FILE *srcfp;
int tty;
struct GModule *module;
Modified: grass/trunk/raster/r.reclass/parse.c
===================================================================
--- grass/trunk/raster/r.reclass/parse.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.reclass/parse.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -4,17 +4,17 @@
#include "rule.h"
static int scan_value(CELL *);
-static char *cur;
+static const char *cur;
static int state;
int default_rule = 0;
int default_to_itself = 0;
char *default_label;
CELL DEFAULT;
-int parse(char *line, RULE ** rules, RULE ** tail, struct Categories *cats)
+int parse(const char *line, RULE ** rules, RULE ** tail, struct Categories *cats)
{
- char *label;
- char *save;
+ const char *label;
+ const char *save;
CELL v;
CELL lo[100], hi[100], new = (CELL) 0;
int count;
Modified: grass/trunk/raster/r.reclass/reclass.c
===================================================================
--- grass/trunk/raster/r.reclass/reclass.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.reclass/reclass.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -185,7 +185,7 @@
static int re_reclass( /* const */ RULE * rules, struct Categories *cats,
/* const */ struct Reclass *old, struct Reclass *new,
- char *input_name, char *input_mapset)
+ const char *input_name, const char *input_mapset)
{
struct Reclass mid;
@@ -199,9 +199,9 @@
return 0;
}
-int reclass(char *old_name, char *old_mapset,
- char *new_name, RULE * rules, struct Categories *cats,
- char *title)
+int reclass(const char *old_name, const char *old_mapset,
+ const char *new_name, RULE *rules, struct Categories *cats,
+ const char *title)
{
struct Reclass old, new;
struct History hist;
@@ -228,8 +228,10 @@
if (G_put_reclass(new_name, &new) < 0)
G_fatal_error(_("Cannot create reclass file of <%s>"), new_name);
- if (title == NULL)
- sprintf(title = buf, "Reclass of %s in %s", new.name, new.mapset);
+ if (!title) {
+ sprintf(buf, "Reclass of %s in %s", new.name, new.mapset);
+ title = buf;
+ }
if ((fd = G_fopen_new("cell", new_name)) == NULL)
G_fatal_error(_("Cannot create raster map <%s>"), new_name);
Modified: grass/trunk/raster/r.reclass/rule.h
===================================================================
--- grass/trunk/raster/r.reclass/rule.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.reclass/rule.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -13,16 +13,16 @@
int add_rule(RULE **, CELL, CELL, CELL);
/* parse.c */
-int parse(char *, RULE **, RULE **, struct Categories *);
+int parse(const char *, RULE **, RULE **, struct Categories *);
/* reclass.c */
-int reclass(char *, char *, char *, RULE *, struct Categories *, char *);
+int reclass(const char *, const char *, const char *, RULE *, struct Categories *, const char *);
/* input.c */
-int input(FILE *, int, char *);
+int input(FILE *, int, const char *);
/* range.c */
-int new_range(char *, struct Reclass *);
+int new_range(const char *, struct Reclass *);
/* stats.c */
-void new_stats(char *, struct Reclass *);
+void new_stats(const char *, struct Reclass *);
Modified: grass/trunk/raster/r.reclass/stats.c
===================================================================
--- grass/trunk/raster/r.reclass/stats.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.reclass/stats.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -3,7 +3,7 @@
#define LIST struct Histogram_list
-void new_stats(char *name, struct Reclass *reclass)
+void new_stats(const char *name, struct Reclass *reclass)
{
struct Histogram histo, histo2;
struct Range range;
Modified: grass/trunk/raster/r.region/main.c
===================================================================
--- grass/trunk/raster/r.region/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.region/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -28,9 +28,9 @@
int i;
double x;
struct Cell_head cellhd, window;
- char *value;
- char *name;
- char *err;
+ const char *value;
+ const char *name;
+ const char *err;
struct GModule *module;
struct
Modified: grass/trunk/raster/r.report/global.h
===================================================================
--- grass/trunk/raster/r.report/global.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.report/global.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -12,8 +12,8 @@
struct _layer_
{
- char *name;
- char *mapset;
+ const char *name;
+ const char *mapset;
struct Categories labels;
int nlen; /* num chars of largest cat when printed */
int clen; /* num chars for cat label when printed */
@@ -85,7 +85,7 @@
int divider(char *);
int trailer(void);
int newline(void);
-int lcr(char *, char *, char *, char *, int);
+int lcr(const char *, const char *, const char *, char *, int);
/* label.c */
char *print_label(char *, int, int, int, int);
Modified: grass/trunk/raster/r.report/header.c
===================================================================
--- grass/trunk/raster/r.report/header.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.report/header.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -2,7 +2,7 @@
#include "global.h"
static int page = 0;
-static char *date = NULL;
+static const char *date = NULL;
static int max(int, int);
static int pbuf(char *buf)
@@ -24,8 +24,6 @@
int len1, len2;
char *label;
char *mask;
- char *maskinfo();
- char *print_label();
nlines = page_length;
if (date == NULL)
@@ -165,7 +163,7 @@
return 0;
}
-int lcr(char *left, char *center, char *right, char *buf, int n)
+int lcr(const char *left, const char *center, const char *right, char *buf, int n)
{
int ll, lc, lr;
Modified: grass/trunk/raster/r.report/parse.c
===================================================================
--- grass/trunk/raster/r.report/parse.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.report/parse.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -232,7 +232,7 @@
int parse_layer(char *s)
{
char name[GNAME_MAX];
- char *mapset;
+ const char *mapset;
struct FPRange fp_range;
int n;
Modified: grass/trunk/raster/r.resamp.interp/main.c
===================================================================
--- grass/trunk/raster/r.resamp.interp/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.resamp.interp/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -60,7 +60,6 @@
char title[64];
char buf_nsres[100], buf_ewres[100];
struct Colors colors;
- char *inmap;
int infile, outfile;
DCELL *outbuf;
int row, col;
@@ -98,12 +97,8 @@
G_get_set_window(&dst_w);
- inmap = G_find_cell2(rastin->answer, "");
- if (!inmap)
- G_fatal_error(_("Raster map <%s> not found"), rastin->answer);
-
/* set window to old map */
- G_get_cellhd(rastin->answer, inmap, &src_w);
+ G_get_cellhd(rastin->answer, "", &src_w);
/* enlarge source window */
{
@@ -133,7 +128,7 @@
cur_row = -100;
/* open old map */
- infile = G_open_cell_old(rastin->answer, inmap);
+ infile = G_open_cell_old(rastin->answer, "");
if (infile < 0)
G_fatal_error(_("Unable to open raster map <%s>"), rastin->answer);
@@ -316,7 +311,7 @@
G_write_history(rastout->answer, &history);
/* copy color table from source map */
- if (G_read_colors(rastin->answer, inmap, &colors) < 0)
+ if (G_read_colors(rastin->answer, "", &colors) < 0)
G_fatal_error(_("Unable to read color table for %s"), rastin->answer);
G_mark_colors_as_fp(&colors);
if (G_write_colors(rastout->answer, G_mapset(), &colors) < 0)
Modified: grass/trunk/raster/r.resamp.stats/main.c
===================================================================
--- grass/trunk/raster/r.resamp.stats/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.resamp.stats/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -250,7 +250,6 @@
char title[64];
char buf_nsres[100], buf_ewres[100];
struct Colors colors;
- char *inmap;
int row;
G_gisinit(argv[0]);
@@ -291,12 +290,8 @@
G_get_set_window(&dst_w);
- inmap = G_find_cell2(parm.rastin->answer, "");
- if (!inmap)
- G_fatal_error(_("Raster map <%s> not found"), parm.rastin->answer);
-
/* set window to old map */
- G_get_cellhd(parm.rastin->answer, inmap, &src_w);
+ G_get_cellhd(parm.rastin->answer, "", &src_w);
/* enlarge source window */
{
@@ -324,7 +319,7 @@
bufs[row] = G_allocate_d_raster_buf();
/* open old map */
- infile = G_open_cell_old(parm.rastin->answer, inmap);
+ infile = G_open_cell_old(parm.rastin->answer, "");
if (infile < 0)
G_fatal_error(_("Unable to open raster map <%s>"),
parm.rastin->answer);
@@ -370,7 +365,7 @@
/* copy color table from source map */
if (strcmp(parm.method->answer, "sum") != 0) {
- if (G_read_colors(parm.rastin->answer, inmap, &colors) < 0)
+ if (G_read_colors(parm.rastin->answer, "", &colors) < 0)
G_fatal_error(_("Unable to read color table for %s"),
parm.rastin->answer);
G_mark_colors_as_fp(&colors);
Modified: grass/trunk/raster/r.slope.aspect/local_proto.h
===================================================================
--- grass/trunk/raster/r.slope.aspect/local_proto.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.slope.aspect/local_proto.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -1,2 +1,2 @@
/* opennew.c */
-int opennew(char *, RASTER_MAP_TYPE);
+int opennew(const char *, RASTER_MAP_TYPE);
Modified: grass/trunk/raster/r.slope.aspect/main.c
===================================================================
--- grass/trunk/raster/r.slope.aspect/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.slope.aspect/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -90,18 +90,17 @@
struct History hist;
struct Colors colors;
- char *elev_name;
- char *aspect_name;
- char *slope_name;
- char *pcurv_name;
- char *tcurv_name;
- char *dx_name;
- char *dy_name;
- char *dxx_name;
- char *dyy_name;
- char *dxy_name;
+ const char *elev_name;
+ const char *aspect_name;
+ const char *slope_name;
+ const char *pcurv_name;
+ const char *tcurv_name;
+ const char *dx_name;
+ const char *dy_name;
+ const char *dxx_name;
+ const char *dyy_name;
+ const char *dxy_name;
char buf[300];
- char *mapset;
int nrows, row;
int ncols, col;
@@ -362,15 +361,10 @@
parm.dxx->key, parm.dyy->key, parm.dxy->key);
}
- /* check elevation file existence */
- mapset = G_find_cell2(elev_name, "");
- if (!mapset)
- G_fatal_error(_("Raster map <%s> not found"), elev_name);
-
/* set the window from the header for the elevation file */
if (!flag.a->answer) {
G_get_window(&window);
- if (G_get_cellhd(elev_name, mapset, &cellhd) >= 0) {
+ if (G_get_cellhd(elev_name, "", &cellhd) >= 0) {
G_align_window(&window, &cellhd);
G_set_window(&window);
}
@@ -444,7 +438,7 @@
*/
/* open the elevation file for reading */
- elevation_fd = G_open_cell_old(elev_name, mapset);
+ elevation_fd = G_open_cell_old(elev_name, "");
if (elevation_fd < 0)
exit(EXIT_FAILURE);
elev_cell[0] = (DCELL *) G_calloc(ncols + 1, sizeof(DCELL));
Modified: grass/trunk/raster/r.slope.aspect/opennew.c
===================================================================
--- grass/trunk/raster/r.slope.aspect/opennew.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.slope.aspect/opennew.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -3,7 +3,7 @@
#include <grass/glocale.h>
-int opennew(char *name, RASTER_MAP_TYPE wr_type)
+int opennew(const char *name, RASTER_MAP_TYPE wr_type)
{
int fd;
Modified: grass/trunk/raster/r.support/main.c
===================================================================
--- grass/trunk/raster/r.support/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.support/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -34,7 +34,7 @@
{
char rname[GNAME_MAX]; /* Reclassed map name */
char rmapset[GMAPSET_MAX]; /* Reclassed mapset */
- char *mapset; /* Raster mapset */
+ const char *mapset; /* Raster mapset */
struct Cell_head cellhd;
struct GModule *module;
struct Option *raster, *title_opt, *history_opt;
@@ -44,7 +44,7 @@
struct Flag *stats_flag, *null_flag, *del_flag;
int cellhd_ok; /* Is cell header OK? */
int is_reclass; /* Is raster reclass? */
- char *infile;
+ const char *infile;
char title[MAX_TITLE_LEN + 1], datasrc[RECORD_LEN + 1];
struct History hist;
Modified: grass/trunk/raster/r.surf.contour/bseg_read.c
===================================================================
--- grass/trunk/raster/r.surf.contour/bseg_read.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.surf.contour/bseg_read.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -4,7 +4,7 @@
static char *me = "bseg_read_cell";
-int bseg_read_cell(BSEG * bseg, char *map_name, char *mapset)
+int bseg_read_cell(BSEG * bseg, const char *map_name, const char *mapset)
{
int row, nrows;
int col, ncols;
Modified: grass/trunk/raster/r.surf.contour/bseg_write.c
===================================================================
--- grass/trunk/raster/r.surf.contour/bseg_write.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.surf.contour/bseg_write.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -3,7 +3,7 @@
static char *me = "bseg_write_cell";
-int bseg_write_cellfile(BSEG * bseg, char *map_name)
+int bseg_write_cellfile(BSEG * bseg, const char *map_name)
{
int map_fd;
int row, nrows;
Modified: grass/trunk/raster/r.surf.contour/cseg.h
===================================================================
--- grass/trunk/raster/r.surf.contour/cseg.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.surf.contour/cseg.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -40,10 +40,10 @@
int bseg_put(BSEG *, CELL *, int, int);
/* bseg_read.c */
-int bseg_read_cell(BSEG *, char *, char *);
+int bseg_read_cell(BSEG *, const char *, const char *);
/* bseg_write.c */
-int bseg_write_cellfile(BSEG *, char *);
+int bseg_write_cellfile(BSEG *, const char *);
/* cseg_close.c */
int cseg_close(CSEG *);
@@ -58,7 +58,7 @@
int cseg_put(CSEG *, int, int, CELL);
/* cseg_read.c */
-int cseg_read_cell(CSEG *, char *, char *);
+int cseg_read_cell(CSEG *, const char *, const char *);
/* cseg_write.c */
-int cseg_write_cellfile(CSEG *, char *);
+int cseg_write_cellfile(CSEG *, const char *);
Modified: grass/trunk/raster/r.surf.contour/cseg_read.c
===================================================================
--- grass/trunk/raster/r.surf.contour/cseg_read.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.surf.contour/cseg_read.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -4,7 +4,7 @@
static char *me = "cseg_read_cell";
-int cseg_read_cell(CSEG * cseg, char *map_name, char *mapset)
+int cseg_read_cell(CSEG * cseg, const char *map_name, const char *mapset)
{
int row, nrows;
int map_fd;
Modified: grass/trunk/raster/r.surf.contour/cseg_write.c
===================================================================
--- grass/trunk/raster/r.surf.contour/cseg_write.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.surf.contour/cseg_write.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -3,7 +3,7 @@
static char *me = "cseg_write_cell";
-int cseg_write_cellfile(CSEG * cseg, char *map_name)
+int cseg_write_cellfile(CSEG * cseg, const char *map_name)
{
int map_fd;
int row, nrows;
Modified: grass/trunk/raster/r.surf.contour/main.c
===================================================================
--- grass/trunk/raster/r.surf.contour/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.surf.contour/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -47,7 +47,7 @@
CELL con1, con2;
double d1, d2;
CELL *alt_row;
- char *con_name, *alt_name, *con_mapset;
+ const char *con_name, *alt_name, *con_mapset;
int file_fd;
int fast_mode;
CELL value;
Modified: grass/trunk/raster/r.surf.fractal/frac.h
===================================================================
--- grass/trunk/raster/r.surf.fractal/frac.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.surf.fractal/frac.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -23,7 +23,7 @@
/* ------ Global variables ------ */
-extern char
+extern const char
*rast_out_name, /* Name of the raster output file. */
*mapset_out;
Modified: grass/trunk/raster/r.surf.fractal/main.c
===================================================================
--- grass/trunk/raster/r.surf.fractal/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.surf.fractal/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -15,7 +15,7 @@
#include <grass/glocale.h>
#include "frac.h"
-char
+const char
*rast_out_name, /* Name of the raster output file. */
*mapset_out;
Modified: grass/trunk/raster/r.terraflow/grass2str.h
===================================================================
--- grass/trunk/raster/r.terraflow/grass2str.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.terraflow/grass2str.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -54,7 +54,7 @@
fprintf(stderr, "reading data from %s to stream %s: ", cellname, foo);
}
- char *mapset;
+ const char *mapset;
mapset = G_find_cell (cellname, "");
if (mapset == NULL)
G_fatal_error (_("Raster map <%s> not found"), cellname);
Modified: grass/trunk/raster/r.terraflow/main.cc
===================================================================
--- grass/trunk/raster/r.terraflow/main.cc 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.terraflow/main.cc 2008-11-27 16:39:38 UTC (rev 34539)
@@ -181,7 +181,7 @@
/* check compatibility of map header and region header */
void check_header(char* cellname) {
- char *mapset;
+ const char *mapset;
mapset = G_find_cell(cellname, "");
if (mapset == NULL) {
G_fatal_error(_("Raster map <%s> not found"), cellname);
@@ -327,8 +327,8 @@
/* ---------------------------------------------------------------------- */
void
setFlowAccuColorTable(char* cellname) {
- struct Colors colors;
- char *mapset;
+ struct Colors colors;
+ const char *mapset;
struct Range r;
mapset = G_find_cell(cellname, "");
@@ -368,7 +368,7 @@
void
setSinkWatershedColorTable(char* cellname) {
struct Colors colors;
- char *mapset;
+ const char *mapset;
struct Range r;
mapset = G_find_cell(cellname, "");
Modified: grass/trunk/raster/r.to.vect/main.c
===================================================================
--- grass/trunk/raster/r.to.vect/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.to.vect/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -61,7 +61,6 @@
struct GModule *module;
struct Option *in_opt, *out_opt, *feature_opt;
struct Flag *smooth_flg, *value_flg, *z_flg, *no_topol;
- char *mapset;
int feature;
@@ -115,10 +114,7 @@
G_fatal_error(_("z flag is supported only for points"));
/* Open files */
- if ((mapset = G_find_cell(in_opt->answer, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), in_opt->answer);
-
- if ((input_fd = G_open_cell_old(in_opt->answer, mapset)) < 0)
+ if ((input_fd = G_open_cell_old(in_opt->answer, "")) < 0)
G_fatal_error(_("Unable to open raster map <%s>"), in_opt->answer);
data_type = G_get_raster_map_type(input_fd);
@@ -141,7 +137,7 @@
/* Open category labels */
if (data_type == CELL_TYPE) {
- if (0 == G_read_cats(in_opt->answer, mapset, &RastCats))
+ if (0 == G_read_cats(in_opt->answer, "", &RastCats))
has_cats = 1;
}
else
Modified: grass/trunk/raster/r.topmodel/global.h
===================================================================
--- grass/trunk/raster/r.topmodel/global.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.topmodel/global.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -147,5 +147,5 @@
extern struct flg flg;
/* Miscellaneous variables */
-extern char *gisbase, *mapset;
+extern const char *mapset;
extern char buf[BUFSIZE];
Modified: grass/trunk/raster/r.topmodel/main.c
===================================================================
--- grass/trunk/raster/r.topmodel/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.topmodel/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -26,7 +26,7 @@
struct file file;
struct misc misc;
struct flg flg;
-char *mapset;
+const char *mapset;
int main(int argc, char **argv)
{
Modified: grass/trunk/raster/r.volume/main.c
===================================================================
--- grass/trunk/raster/r.volume/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.volume/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -39,8 +39,8 @@
int out_mode, use_MASK, *n, *e;
long int *count;
int fd_data, fd_clump;
- char *datamap, *clumpmap, *site_list;
- char *clump_mapset;
+ const char *datamap, *clumpmap, *site_list;
+ const char *clump_mapset;
double avg, vol, total_vol, east, north, *sum;
struct Cell_head window;
struct Map_info *fd_sites = NULL;
@@ -86,7 +86,6 @@
G_get_window(&window);
/* initialize */
- *site_list = 0;
out_mode = 1; /* assume full output text */
mysite = G_site_new_struct(CELL_TYPE, 2, 0, 4);
Deleted: grass/trunk/raster/r.water.outlet/legal.c
===================================================================
--- grass/trunk/raster/r.water.outlet/legal.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.water.outlet/legal.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -1,15 +0,0 @@
-#include <stdlib.h>
-#include <grass/gis.h>
-#include <grass/glocale.h>
-
-char *do_exist(char *file_name)
-{
- char *buf, *file_mapset;
-
- file_mapset = G_find_cell2(file_name, "");
- if (file_mapset == NULL) {
- G_asprintf(&buf, _("Raster map <%s> not found"), file_name);
- G_fatal_error(buf);
- }
- return (file_mapset);
-}
Modified: grass/trunk/raster/r.water.outlet/main.c
===================================================================
--- grass/trunk/raster/r.water.outlet/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.water.outlet/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -53,7 +53,7 @@
double N, E;
int row, col, basin_fd, drain_fd;
CELL *cell_buf;
- char drain_name[GNAME_MAX], *drain_mapset, E_f, dr_f, ba_f, N_f, errr;
+ char drain_name[GNAME_MAX], E_f, dr_f, ba_f, N_f, errr;
struct GModule *module;
struct Option *opt1, *opt2, *opt3, *opt4;
@@ -120,14 +120,12 @@
G_get_set_window(&window);
dr_f = ba_f = N_f = E_f = errr = 0;
- drain_mapset = do_exist(drain_name);
-
nrows = G_window_rows();
ncols = G_window_cols();
total = nrows * ncols;
nrows_less_one = nrows - 1;
ncols_less_one = ncols - 1;
- drain_fd = G_open_cell_old(drain_name, drain_mapset);
+ drain_fd = G_open_cell_old(drain_name, "");
if (drain_fd < 0)
G_fatal_error(_("Unable to open drainage pointer map"));
Modified: grass/trunk/raster/r.water.outlet/outletP.h
===================================================================
--- grass/trunk/raster/r.water.outlet/outletP.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.water.outlet/outletP.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -1,6 +1,3 @@
-/* legal.c */
-int do_legal(char *);
-char *do_exist(char *);
/* over_cells.c */
int overland_cells(int, int);
Modified: grass/trunk/raster/r.watershed/ram/Gwater.h
===================================================================
--- grass/trunk/raster/r.watershed/ram/Gwater.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.watershed/ram/Gwater.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -60,10 +60,10 @@
extern SHORT updrain[3][3];
extern SHORT nextdr[8];
extern SHORT nextdc[8];
-extern char ele_name[GNAME_MAX], *ele_mapset, pit_name[GNAME_MAX], *pit_mapset;
-extern char run_name[GNAME_MAX], *run_mapset, ob_name[GNAME_MAX], *ob_mapset;
-extern char ril_name[GNAME_MAX], *ril_mapset, dep_name[GNAME_MAX], *dep_mapset;
-extern char *this_mapset;
+extern char ele_name[GNAME_MAX], pit_name[GNAME_MAX];
+extern char run_name[GNAME_MAX], ob_name[GNAME_MAX];
+extern char ril_name[GNAME_MAX], dep_name[GNAME_MAX];
+extern const char *this_mapset;
extern char seg_name[GNAME_MAX], bas_name[GNAME_MAX], haf_name[GNAME_MAX], thr_name[8];
extern char ls_name[GNAME_MAX], st_name[GNAME_MAX], sl_name[GNAME_MAX], sg_name[GNAME_MAX];
extern char wat_name[GNAME_MAX], asp_name[GNAME_MAX], arm_name[GNAME_MAX], dis_name[GNAME_MAX];
@@ -99,7 +99,6 @@
/* init_vars.c */
int init_vars(int, char *[]);
-char *do_exist(char *);
/* no_stream.c */
int no_stream(int, int, CELL, double, CELL);
Modified: grass/trunk/raster/r.watershed/ram/init_vars.c
===================================================================
--- grass/trunk/raster/r.watershed/ram/init_vars.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.watershed/ram/init_vars.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -85,13 +85,6 @@
this_mapset = G_mapset();
if (sl_flag || sg_flag || ls_flag)
er_flag = 1;
- ele_mapset = do_exist(ele_name);
- if (pit_flag)
- pit_mapset = do_exist(pit_name);
- if (ob_flag)
- ob_mapset = do_exist(ob_name);
- if (ril_flag)
- ril_mapset = do_exist(ril_name);
/* for sd factor
if (dep_flag) {
if (sscanf (dep_name, "%lf", &dep_slope) != 1) {
@@ -120,7 +113,7 @@
r_h =
(CELL *) G_malloc(sizeof(CELL) * size_array(&r_h_seg, nrows, ncols));
- fd = G_open_cell_old(ele_name, ele_mapset);
+ fd = G_open_cell_old(ele_name, "");
if (fd < 0) {
G_fatal_error(_("unable to open elevation map layer"));
}
@@ -137,8 +130,7 @@
(CELL *) G_malloc(sizeof(CELL) * size_array(&wat_seg, nrows, ncols));
if (run_flag) {
- run_mapset = do_exist(run_name);
- fd = G_open_cell_old(run_name, run_mapset);
+ fd = G_open_cell_old(run_name, "");
if (fd < 0) {
G_fatal_error(_("unable to open runoff map layer"));
}
@@ -159,8 +151,7 @@
asp = (CELL *) G_calloc(size_array(&asp_seg, nrows, ncols), sizeof(CELL));
if (pit_flag) {
- pit_mapset = do_exist(pit_name);
- fd = G_open_cell_old(pit_name, pit_mapset);
+ fd = G_open_cell_old(pit_name, "");
if (fd < 0) {
G_fatal_error(_("unable to open depression map layer"));
}
@@ -174,7 +165,7 @@
}
swale = flag_create(nrows, ncols);
if (ob_flag) {
- fd = G_open_cell_old(ob_name, ob_mapset);
+ fd = G_open_cell_old(ob_name, "");
if (fd < 0) {
G_fatal_error(_("unable to open blocking map layer"));
}
@@ -188,7 +179,7 @@
G_close_cell(fd);
}
if (ril_flag) {
- ril_fd = G_open_cell_old(ril_name, ril_mapset);
+ ril_fd = G_open_cell_old(ril_name, "");
if (ril_fd < 0) {
G_fatal_error(_("unable to open rill map layer"));
}
@@ -367,13 +358,3 @@
return 0;
}
-
-char *do_exist(char *file_name)
-{
- char *file_mapset = G_find_cell2(file_name, "");
-
- if (file_mapset == NULL)
- G_fatal_error(_("Raster map <%s> not found"), file_name);
-
- return (file_mapset);
-}
Modified: grass/trunk/raster/r.watershed/ram/main.c
===================================================================
--- grass/trunk/raster/r.watershed/ram/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.watershed/ram/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -42,10 +42,10 @@
SHORT updrain[3][3] = {{ 3,2,1 },{ 4,0,8 },{ 5,6,7 }};
SHORT nextdr[8] = { 1,-1,0,0,-1,1,1,-1 };
SHORT nextdc[8] = { 0,0,-1,1,1,-1,1,-1 };
-char ele_name[GNAME_MAX], *ele_mapset, pit_name[GNAME_MAX], *pit_mapset;
-char run_name[GNAME_MAX], *run_mapset, ob_name[GNAME_MAX], *ob_mapset;
-char ril_name[GNAME_MAX], *ril_mapset, dep_name[GNAME_MAX], *dep_mapset;
-char *this_mapset;
+char ele_name[GNAME_MAX], pit_name[GNAME_MAX];
+char run_name[GNAME_MAX], ob_name[GNAME_MAX];
+char ril_name[GNAME_MAX], dep_name[GNAME_MAX];
+const char *this_mapset;
char seg_name[GNAME_MAX], bas_name[GNAME_MAX], haf_name[GNAME_MAX], thr_name[8];
char ls_name[GNAME_MAX], st_name[GNAME_MAX], sl_name[GNAME_MAX], sg_name[GNAME_MAX];
char wat_name[GNAME_MAX], asp_name[GNAME_MAX], arm_name[GNAME_MAX], dis_name[GNAME_MAX];
Modified: grass/trunk/raster/r.watershed/seg/Gwater.h
===================================================================
--- grass/trunk/raster/r.watershed/seg/Gwater.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.watershed/seg/Gwater.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -52,11 +52,11 @@
extern SHORT updrain[3][3];
extern SHORT nextdr[8];
extern SHORT nextdc[8];
-extern char ele_name[GNAME_MAX], *ele_mapset, pit_name[GNAME_MAX], *pit_mapset;
-extern char run_name[GNAME_MAX], *run_mapset, ob_name[GNAME_MAX], *ob_mapset;
-extern char ril_name[GNAME_MAX], *ril_mapset, dep_name[GNAME_MAX], *dep_mapset;
+extern char ele_name[GNAME_MAX], pit_name[GNAME_MAX];
+extern char run_name[GNAME_MAX], ob_name[GNAME_MAX];
+extern char ril_name[GNAME_MAX], dep_name[GNAME_MAX];
-extern char *this_mapset;
+extern const char *this_mapset;
extern char seg_name[GNAME_MAX], bas_name[GNAME_MAX], haf_name[GNAME_MAX], thr_name[8];
extern char ls_name[GNAME_MAX], st_name[GNAME_MAX], sl_name[GNAME_MAX], sg_name[GNAME_MAX];
extern char wat_name[GNAME_MAX], asp_name[GNAME_MAX], arm_name[GNAME_MAX], dis_name[GNAME_MAX];
Modified: grass/trunk/raster/r.watershed/seg/init_vars.c
===================================================================
--- grass/trunk/raster/r.watershed/seg/init_vars.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.watershed/seg/init_vars.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -90,11 +90,9 @@
this_mapset = G_mapset();
if (sl_flag || sg_flag || ls_flag)
er_flag = 1;
- ele_mapset = do_exist(ele_name);
/* for sd factor
if (dep_flag) {
if (sscanf (dep_name, "%lf", &dep_slope) != 1) {
- dep_mapset = do_exist (dep_name);
dep_flag = -1;
}
}
@@ -135,13 +133,12 @@
cseg_open(&alt, SROW, SCOL, num_cseg_bytes);
cseg_open(&r_h, SROW, SCOL, 4);
- cseg_read_cell(&alt, ele_name, ele_mapset);
- cseg_read_cell(&r_h, ele_name, ele_mapset);
+ cseg_read_cell(&alt, ele_name, "");
+ cseg_read_cell(&r_h, ele_name, "");
cseg_open(&wat, SROW, SCOL, num_cseg_bytes);
if (run_flag) {
- run_mapset = do_exist(run_name);
- cseg_read_cell(&wat, run_name, run_mapset);
+ cseg_read_cell(&wat, run_name, "");
}
else {
for (r = 0; r < nrows; r++) {
@@ -152,8 +149,7 @@
}
cseg_open(&asp, SROW, SCOL, num_cseg_bytes);
if (pit_flag) {
- pit_mapset = do_exist(pit_name);
- cseg_read_cell(&asp, pit_name, pit_mapset);
+ cseg_read_cell(&asp, pit_name, "");
}
else {
for (r = 0; r < nrows; r++) {
@@ -164,8 +160,7 @@
}
bseg_open(&swale, SROW, SCOL, num_cseg_bytes);
if (ob_flag) {
- ob_mapset = do_exist(ob_name);
- bseg_read_cell(&swale, ob_name, ob_mapset);
+ bseg_read_cell(&swale, ob_name, "");
}
else {
for (r = 0; r < nrows; r++) {
@@ -174,9 +169,8 @@
}
}
if (ril_flag) {
- ril_mapset = do_exist(ril_name);
dseg_open(&ril, 1, (int)PAGE_BLOCK / sizeof(double), 1);
- dseg_read_cell(&ril, ril_name, ril_mapset);
+ dseg_read_cell(&ril, ril_name, "");
}
bseg_open(&in_list, SROW, SCOL, num_cseg_bytes);
bseg_open(&worked, SROW, SCOL, num_cseg_bytes);
@@ -396,12 +390,3 @@
return 0;
}
-char *do_exist(char *file_name)
-{
- char *file_mapset = G_find_cell2(file_name, "");
-
- if (file_mapset == NULL)
- G_fatal_error(_("Raster map <%s> not found"), file_name);
-
- return (file_mapset);
-}
Modified: grass/trunk/raster/r.watershed/seg/main.c
===================================================================
--- grass/trunk/raster/r.watershed/seg/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/r.watershed/seg/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -39,13 +39,11 @@
SHORT updrain[3][3] = {{ 3,2,1 },{ 4,0,8 },{ 5,6,7 }};
SHORT nextdr[8] = { 1,-1,0,0,-1,1,1,-1 };
SHORT nextdc[8] = { 0,0,-1,1,1,-1,1,-1 };
-char ele_name[GNAME_MAX], *ele_mapset, pit_name[GNAME_MAX],
- *pit_mapset;
-char run_name[GNAME_MAX], *run_mapset, ob_name[GNAME_MAX], *ob_mapset;
-char ril_name[GNAME_MAX], *ril_mapset, dep_name[GNAME_MAX],
- *dep_mapset;
+char ele_name[GNAME_MAX], pit_name[GNAME_MAX];
+char run_name[GNAME_MAX], ob_name[GNAME_MAX];
+char ril_name[GNAME_MAX], dep_name[GNAME_MAX];
-char *this_mapset;
+const char *this_mapset;
char seg_name[GNAME_MAX], bas_name[GNAME_MAX], haf_name[GNAME_MAX],
thr_name[8];
char ls_name[GNAME_MAX], st_name[GNAME_MAX], sl_name[GNAME_MAX],
Modified: grass/trunk/raster/wildfire/r.spreadpath/main.c
===================================================================
--- grass/trunk/raster/wildfire/r.spreadpath/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster/wildfire/r.spreadpath/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -68,7 +68,7 @@
len, flag,
srows, scols,
backrow_fd, backcol_fd, path_fd, in_row_fd, in_col_fd, out_fd;
- char *current_mapset,
+ const char *current_mapset,
*search_mapset,
*path_mapset,
*backrow_mapset,
Modified: grass/trunk/raster3d/r3.cross.rast/main.c
===================================================================
--- grass/trunk/raster3d/r3.cross.rast/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster3d/r3.cross.rast/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -261,7 +261,6 @@
int changemask = 0;
int elevfd = -1, outfd = -1; /*file descriptors */
int output_type, cols, rows;
- char *mapset = NULL;
/* Initialize GRASS */
G_gisinit(argv[0]);
@@ -327,13 +326,8 @@
/*Open the elevation raster map */
/********************************/
- mapset = G_find_cell2(param.elevation->answer, "");
- if (mapset == NULL) {
- fatal_error(map, -1, -1, _("Elevation map not found"));
- }
-
- elevfd = G_open_cell_old(param.elevation->answer, mapset);
+ elevfd = G_open_cell_old(param.elevation->answer, "");
if (elevfd <= 0)
fatal_error(map, -1, -1, _("Unable to open elevation map"));
Modified: grass/trunk/raster3d/r3.mkdspf/local_proto.h
===================================================================
--- grass/trunk/raster3d/r3.mkdspf/local_proto.h 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster3d/r3.mkdspf/local_proto.h 2008-11-27 16:39:38 UTC (rev 34539)
@@ -17,7 +17,7 @@
int r3read_level(void *g3map, G3D_Region * g3reg, file_info * Headfax,
float *data, int n_lev);
/* r3_find.c */
-int g3_find_dsp_file(char *cell, char *file, char *mset);
-char *check_get_any_dspname(char *dspf, char *g3f, char *mset);
+int g3_find_dsp_file(const char *cell, const char *file, const char *mset);
+const char *check_get_any_dspname(const char *dspf, const char *g3f, const char *mset);
#endif
Modified: grass/trunk/raster3d/r3.mkdspf/main.c
===================================================================
--- grass/trunk/raster3d/r3.mkdspf/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster3d/r3.mkdspf/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -54,10 +54,11 @@
int main(int argc, char *argv[])
{
- char *dspout, element[160];
+ char element[GNAME_MAX+10];
+ const char *dspout;
void *g3map;
G3D_Region g3reg;
- char *mapset;
+ const char *mapset;
double dmin, dmax;
struct GModule *module;
Modified: grass/trunk/raster3d/r3.mkdspf/r3_find.c
===================================================================
--- grass/trunk/raster3d/r3.mkdspf/r3_find.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster3d/r3.mkdspf/r3_find.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -8,9 +8,9 @@
#include <grass/G3d.h>
-int g3_find_dsp_file(char *cell, char *file, char *mset)
+int g3_find_dsp_file(const char *cell, const char *file, const char *mset)
{
- char element[100], name[GNAME_MAX], mapset[GMAPSET_MAX],
+ char element[GNAME_MAX+10], name[GNAME_MAX], mapset[GMAPSET_MAX],
tofind[GNAME_MAX];
if (file == NULL || *file == 0)
@@ -28,7 +28,7 @@
/* return NULL on error: otherwise returns dspout */
-char *check_get_any_dspname(char *dspf, char *g3f, char *mset)
+const char *check_get_any_dspname(const char *dspf, const char *g3f, const char *mset)
{
if (!G_find_grid3(g3f, ""))
G_fatal_error("[%s] 3D raster map not found", g3f);
Modified: grass/trunk/raster3d/r3.out.vtk/main.c
===================================================================
--- grass/trunk/raster3d/r3.out.vtk/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/raster3d/r3.out.vtk/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -46,7 +46,7 @@
FILE * fp, int dp);
/*opens a raster input map */
-static int open_input_map(char *name, char *mapset);
+static int open_input_map(const char *name, const char *mapset);
/*Check if all maps are available */
static void check_input_maps(void);
@@ -89,7 +89,7 @@
/* ************************************************************************* */
/* Open the raster input map *********************************************** */
/* ************************************************************************* */
-int open_input_map(char *name, char *mapset)
+int open_input_map(const char *name, const char *mapset)
{
int fd;
@@ -113,7 +113,7 @@
void check_input_maps(void)
{
int i = 0;
- char *mapset, *name;
+ const char *mapset, *name;
/*Check top and bottom if surface is requested */
if (param.structgrid->answer) {
@@ -368,7 +368,7 @@
struct GModule *module;
int dp, i, changemask = 0;
int rows, cols;
- char *mapset, *name;
+ const char *mapset, *name;
double scale = 1.0, llscale = 1.0;
input_maps *in;
Modified: grass/trunk/vector/lidar/v.lidar.correction/main.c
===================================================================
--- grass/trunk/vector/lidar/v.lidar.correction/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/vector/lidar/v.lidar.correction/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -34,7 +34,8 @@
{
/* Declarations */
int dim_vect, nparameters, BW, npoints, nrows, ncols, nsply, nsplx;
- char *dvr, *db, *mapset, table_name[1024];
+ const char *dvr, *db, *mapset;
+ char table_name[1024];
double lambda, ew_resol, ns_resol, mean, passoN, passoE, HighThresh,
LowThresh;
Modified: grass/trunk/vector/lidar/v.lidar.edgedetection/main.c
===================================================================
--- grass/trunk/vector/lidar/v.lidar.edgedetection/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/vector/lidar/v.lidar.edgedetection/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -45,7 +45,8 @@
int dim_vect, nparameters, BW, npoints;
double lambda_B, lambda_F, grad_H, grad_L, alpha, ew_resol, ns_resol,
mean;
- char *dvr, *db, *mapset, table_interpolation[1024], table_name[1024];
+ const char *dvr, *db, *mapset;
+ char table_interpolation[1024], table_name[1024];
int last_row, last_column, flag_auxiliar = FALSE;
Modified: grass/trunk/vector/lidar/v.lidar.growing/main.c
===================================================================
--- grass/trunk/vector/lidar/v.lidar.growing/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/vector/lidar/v.lidar.growing/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -46,7 +46,8 @@
double Z_interp;
double Thres_j, Thres_d, ew_resol, ns_resol;
double minNS, minEW, maxNS, maxEW;
- char *mapset, buf[1024];
+ const char *mapset;
+ char buf[1024];
int colorBordo, ripieno, conta, lungPunti, lungHull, xi, c1, c2;
double altPiano;
Modified: grass/trunk/vector/lidar/v.outlier/main.c
===================================================================
--- grass/trunk/vector/lidar/v.outlier/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/vector/lidar/v.outlier/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -38,7 +38,8 @@
/* Variables' declarations */
int dim_vect, nparameters, BW, npoints;
double ew_resol, ns_resol, mean, lambda;
- char *dvr, *db, *mapset, table_name[1024];
+ const char *dvr, *db, *mapset;
+ char table_name[1024];
int last_row, last_column, flag_auxiliar = FALSE;
Modified: grass/trunk/vector/lidar/v.surf.bspline/main.c
===================================================================
--- grass/trunk/vector/lidar/v.surf.bspline/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/vector/lidar/v.surf.bspline/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -41,7 +41,8 @@
int last_row, last_column, grid, bilin, ext, flag_auxiliar, cross; /* booleans */
double passoN, passoE, lambda, mean;
- char *mapset, *dvr, *db, *vector, *map, table_name[1024], title[64];
+ const char *mapset, *dvr, *db, *vector, *map;
+ char table_name[1024], title[64];
int dim_vect, nparameters, BW;
int *lineVect; /* Vector restoring primitive's ID */
@@ -517,7 +518,7 @@
obsVect[i][1] = observ[i].coordY;
if (bspline_field > 0) {
- int cat, ival, ret, type;
+ int cat, ival, ret;
cat = observ[i].cat;
if (cat < 0)
Modified: grass/trunk/vector/v.buffer2/main.c
===================================================================
--- grass/trunk/vector/v.buffer2/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/vector/v.buffer2/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -109,7 +109,7 @@
struct Map_info In, Out;
struct line_pnts *Points;
struct line_cats *Cats, *BCats;
- char *mapset;
+ const char *mapset;
struct GModule *module;
struct Option *in_opt, *out_opt, *type_opt, *dista_opt, *distb_opt, *angle_opt;
struct Flag *straight_flag, *nocaps_flag;
Modified: grass/trunk/vector/v.convert/att.c
===================================================================
--- grass/trunk/vector/v.convert/att.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/vector/v.convert/att.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -13,7 +13,7 @@
int attributes(char *in, struct Map_info *Out)
{
int i, cat, count;
- char *mapset;
+ const char *mapset;
struct Categories Cats;
char buf[1024];
dbString sql, lab;
Modified: grass/trunk/vector/v.convert/old2new.c
===================================================================
--- grass/trunk/vector/v.convert/old2new.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/vector/v.convert/old2new.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -10,7 +10,7 @@
int old2new(char *in, char *out, int endian)
{
int i, j, nlines, ncats, sline, att;
- char *mapset;
+ const char *mapset;
FILE *Digin, *Attin;
struct Line *lines; /* array of points and lines */
struct Categ *cats; /* array of categories */
Modified: grass/trunk/vector/v.delaunay2/in_out.c
===================================================================
--- grass/trunk/vector/v.delaunay2/in_out.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/vector/v.delaunay2/in_out.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -192,12 +192,13 @@
sites[nsites].entry_pt = MY_NULL;
nsites += 1;
- /* number 100 was arbitrarily chosen /*
- /* if (nsites == allocated && line != nlines){
- allocated += 100;
- realloc_sites(allocated);
- }
- */
+ /* number 100 was arbitrarily chosen */
+#if 0
+ if (nsites == allocated && line != nlines){
+ allocated += 100;
+ realloc_sites(allocated);
+ }
+#endif
}
if (nsites != nlines)
realloc_sites(nsites);
Modified: grass/trunk/vector/v.delaunay2/main.c
===================================================================
--- grass/trunk/vector/v.delaunay2/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/vector/v.delaunay2/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -33,7 +33,7 @@
{
/* GRASS related variables */
- char *mapset;
+ const char *mapset;
struct Map_info map_in, map_out;
struct Cell_head Window;
BOUND_BOX Box;
Modified: grass/trunk/vector/v.digit/generate.c
===================================================================
--- grass/trunk/vector/v.digit/generate.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/vector/v.digit/generate.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -40,7 +40,7 @@
"euc-jp",
NULL
};
- char *enc_env;
+ const char *enc_env;
G__read_env();
enc_env = G__getenv("GRASS_DB_ENCODING");
Modified: grass/trunk/vector/v.digit/main.c
===================================================================
--- grass/trunk/vector/v.digit/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/vector/v.digit/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -136,7 +136,7 @@
struct GModule *module;
struct Option *map_opt, *bgcmd_opt;
struct Flag *new_f;
- char *mapset;
+ const char *mapset;
char **tokens;
char *fake_argv[4];
char toolbox[GPATH_MAX];
Modified: grass/trunk/vector/v.digit/zoom.c
===================================================================
--- grass/trunk/vector/v.digit/zoom.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/vector/v.digit/zoom.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -235,7 +235,7 @@
int zoom_region(void)
{
struct Cell_head win;
- char *mapset;
+ const char *mapset;
G_debug(2, "zoom_region()");
Modified: grass/trunk/vector/v.drape/main.c
===================================================================
--- grass/trunk/vector/v.drape/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/vector/v.drape/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -52,13 +52,8 @@
/* sample raster at this point, and update the z-coordinate
* (note that input vector should not be 3D!)
*/
- estimated_elevation = scale * G_get_raster_sample(fdrast,
- &window,
- NULL,
- Points->
- y[0],
- Points->
- x[0], 0, method);
+ estimated_elevation = scale * G_get_raster_sample(
+ fdrast, &window, NULL, Points->y[0], Points->x[0], 0, method);
/* Elevation value has to be meaningfull */
if (G_is_d_null_value(&estimated_elevation)) {
if (null_opt->answer) {
@@ -80,14 +75,8 @@
/* loop through each point in a line */
for (j = 0; j < Points->n_points; j++) {
/* sample raster at this point, and update the z-coordinate (note that input vector should not be 3D!) */
- estimated_elevation = scale * G_get_raster_sample(fdrast,
- &window,
- NULL,
- Points->
- y[j],
- Points->
- x[j], 0,
- method);
+ estimated_elevation = scale * G_get_raster_sample(
+ fdrast, &window, NULL, Points->y[j], Points->x[j], 0, method);
if (G_is_d_null_value(&estimated_elevation)) {
if (null_opt->answer) {
@@ -110,14 +99,8 @@
/* loop through each point in a line */
for (j = 0; j < Points->n_points; j++) {
/* sample raster at this point, and update the z-coordinate (note that input vector should not be 3D!) */
- estimated_elevation = scale * G_get_raster_sample(fdrast,
- &window,
- NULL,
- Points->
- y[j],
- Points->
- x[j], 0,
- method);
+ estimated_elevation = scale * G_get_raster_sample(
+ fdrast, &window, NULL, Points->y[j], Points->x[j], 0, method);
if (G_is_d_null_value(&estimated_elevation)) {
if (null_opt->answer) {
@@ -149,7 +132,6 @@
int line, nlines, otype, ltype, ncats =
0, layer, i, c, *cats, field_index, id, out_num = 0, *new_cats;
- char *mapset;
double scale, null_val;
INTERP_TYPE method = UNKNOWN;
int fdrast; /* file descriptor for raster map is int */
@@ -199,7 +181,7 @@
scale_opt->description = _("Scale sampled raster values");
scale_opt->answer = "1.0";
- where_opt = G_define_standard_option(G_OPT_WHERE);
+ where_opt = G_define_standard_option(G_OPT_DB_WHERE);
layer_opt = G_define_standard_option(G_OPT_V_FIELD);
layer_opt->answer = "1";
@@ -240,13 +222,8 @@
/* Check output type */
otype = Vect_option_to_types(type_opt);
- /* check for the elev raster, and check for error condition */
- if ((mapset = G_find_cell(rast_opt->answer, "")) == NULL) {
- G_fatal_error(_("Raster map <%s> not found"), rast_opt->answer);
- }
-
/* open the elev raster, and check for error condition */
- if ((fdrast = G_open_cell_old(rast_opt->answer, mapset)) < 0) {
+ if ((fdrast = G_open_cell_old(rast_opt->answer, "")) < 0) {
G_fatal_error(_("Unable to open raster map <%s>"), rast_opt->answer);
}
Modified: grass/trunk/vector/v.drape/v.drape.html
===================================================================
--- grass/trunk/vector/v.drape/v.drape.html 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/vector/v.drape/v.drape.html 2008-11-27 16:39:38 UTC (rev 34539)
@@ -28,7 +28,6 @@
v.drape in=roads rast=elevation.10m method=bilinear out=roads3d
v.info roads3d
</pre></div>
-</p>
<p>Create 3D vector roads map containing only "unimproved" roads.
Set road height to 1000 m for all parts without height information.
@@ -36,7 +35,6 @@
v.drape input=roads type=line rast=elevation.dem output=roads_3d \
method=nearest scale=1.0 where='cat=5' layer=1 null_value=1000
</pre></div>
-</p>
<h2>POVRAY EXAMPLE</h2>
Modified: grass/trunk/vector/v.in.sites/main.c
===================================================================
--- grass/trunk/vector/v.in.sites/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/vector/v.in.sites/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -32,7 +32,7 @@
int main(int argc, char *argv[])
{
int i, cat, *clen, len;
- char *sname, *mapset;
+ const char *sname, *mapset;
char buf[1024];
int count, withz;
int dims, dbls, strs;
Modified: grass/trunk/vector/v.info/main.c
===================================================================
--- grass/trunk/vector/v.info/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/vector/v.info/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -47,7 +47,8 @@
struct Map_info Map;
struct dig_head v_head;
BOUND_BOX box;
- char *mapset, line[200], buf[1001];
+ const char *mapset;
+ char line[200], buf[1001];
int i;
int with_z;
struct field_info *fi;
Modified: grass/trunk/vector/v.lrs/v.lrs.create/main.c
===================================================================
--- grass/trunk/vector/v.lrs/v.lrs.create/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/vector/v.lrs/v.lrs.create/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -99,7 +99,8 @@
struct Option *start_mp_opt, *start_off_opt, *end_mp_opt, *end_off_opt;
struct Option *driver_opt, *database_opt, *table_opt, *thresh_opt;
struct GModule *module;
- char *mapset, buf[2000];
+ const char *mapset;
+ char buf[2000];
const char *drv, *db;
struct Map_info In, Out, PMap, EMap;
struct line_cats *LCats, *PCats;
Modified: grass/trunk/vector/v.lrs/v.lrs.label/main.c
===================================================================
--- grass/trunk/vector/v.lrs/v.lrs.label/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/vector/v.lrs/v.lrs.label/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -78,7 +78,8 @@
struct Option *Opaque;
struct GModule *module;
- char *mapset, buf[2000];
+ const char *mapset;
+ char buf[2000];
const char *drv, *db;
struct Map_info In, Out;
struct line_cats *LCats, *SCats;
Modified: grass/trunk/vector/v.lrs/v.lrs.segment/main.c
===================================================================
--- grass/trunk/vector/v.lrs/v.lrs.segment/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/vector/v.lrs/v.lrs.segment/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -55,7 +55,8 @@
struct Option *lfield_opt, *file_opt;
struct Option *table_opt;
struct GModule *module;
- char *mapset, buf[2000];
+ const char *mapset;
+ char buf[2000];
const char *drv, *db;
struct Map_info In, Out;
struct line_cats *LCats, *SCats;
Modified: grass/trunk/vector/v.lrs/v.lrs.where/main.c
===================================================================
--- grass/trunk/vector/v.lrs/v.lrs.where/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/vector/v.lrs/v.lrs.where/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -43,7 +43,7 @@
struct Option *lfield_opt, *pfield_opt;
struct Option *driver_opt, *database_opt, *table_opt, *thresh_opt;
struct GModule *module;
- char *mapset;
+ const char *mapset;
const char *drv, *db;
struct Map_info LMap, PMap;
struct line_cats *LCats, *PCats;
Modified: grass/trunk/vector/v.proj/main.c
===================================================================
--- grass/trunk/vector/v.proj/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/vector/v.proj/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -37,11 +37,11 @@
int day, yr, Out_proj;
int out_zone = 0;
int overwrite; /* overwrite output map */
- char *mapset;
- char *omap_name, *map_name, *iset_name, *oset_name, *iloc_name;
+ const char *mapset;
+ const char *omap_name, *map_name, *iset_name, *oset_name, *iloc_name;
struct pj_info info_in;
struct pj_info info_out;
- char *gbase;
+ const char *gbase;
char date[40], mon[4];
struct GModule *module;
struct Option *omapopt, *mapopt, *isetopt, *ilocopt, *ibaseopt;
Modified: grass/trunk/vector/v.vol.rst/main.c
===================================================================
--- grass/trunk/vector/v.vol.rst/main.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/vector/v.vol.rst/main.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -149,43 +149,43 @@
04/01/2005 (jh) - variable smoothing and CV
*/
-char *input;
-char *cellinp = NULL;
-char *cellout = NULL;
-char *mapset = NULL;
+const char *input;
+const char *cellinp;
+const char *cellout;
+const char *mapset;
-char *scol = NULL;
-char *outz = NULL;
-char *gradient = NULL;
-char *aspect1 = NULL;
-char *aspect2 = NULL;
-char *ncurv = NULL;
-char *gcurv = NULL;
-char *mcurv = NULL;
+const char *scol;
+const char *outz;
+const char *gradient;
+const char *aspect1;
+const char *aspect2;
+const char *ncurv;
+const char *gcurv;
+const char *mcurv;
-char *maskmap = NULL;
-char *redinp = NULL;
-char *devi = NULL;
-char *cvdev = NULL;
+const char *maskmap;
+const char *redinp;
+const char *devi;
+const char *cvdev;
int sdisk, disk;
-FILE *Tmp_fd_z = NULL;
-char *Tmp_file_z = NULL;
+FILE *Tmp_fd_z;
+const char *Tmp_file_z;
-FILE *Tmp_fd_dx = NULL;
-char *Tmp_file_dx = NULL;
-FILE *Tmp_fd_dy = NULL;
-char *Tmp_file_dy = NULL;
-FILE *Tmp_fd_dz = NULL;
-char *Tmp_file_dz = NULL;
-FILE *Tmp_fd_xx = NULL;
-char *Tmp_file_xx = NULL;
-FILE *Tmp_fd_yy = NULL;
-char *Tmp_file_yy = NULL;
-FILE *Tmp_fd_xy = NULL;
-char *Tmp_file_xy = NULL;
-FILE *Tmp_fd_cell = NULL;
-char *Tmp_file_cell = NULL;
+FILE *Tmp_fd_dx;
+const char *Tmp_file_dx;
+FILE *Tmp_fd_dy;
+const char *Tmp_file_dy;
+FILE *Tmp_fd_dz;
+const char *Tmp_file_dz;
+FILE *Tmp_fd_xx;
+const char *Tmp_file_xx;
+FILE *Tmp_fd_yy;
+const char *Tmp_file_yy;
+FILE *Tmp_fd_xy;
+const char *Tmp_file_xy;
+FILE *Tmp_fd_cell;
+const char *Tmp_file_cell;
struct BM *bitmask;
struct Cell_head cellhd;
Modified: grass/trunk/vector/v.vol.rst/user1.c
===================================================================
--- grass/trunk/vector/v.vol.rst/user1.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/vector/v.vol.rst/user1.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -70,7 +70,7 @@
double deltx, delty, deltz;
int first_time = 1;
CELL *cellmask;
- char *mapsetm;
+ const char *mapsetm;
char buf[500];
int cat, intval;
struct field_info *Fi;
Modified: grass/trunk/visualization/nviz/src/nviz_init.c
===================================================================
--- grass/trunk/visualization/nviz/src/nviz_init.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/visualization/nviz/src/nviz_init.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -27,7 +27,8 @@
struct Option *panel_path, *script, *state;
struct Flag *no_args, *script_kill, *demo, *verbose;
struct GModule *module;
- char *arglist[3], *autoload;
+ char *arglist[3];
+ const char *autoload;
int i, aload = 1;
char *argv2[argc - 1];
int argc2, ii, jj;
Modified: grass/trunk/visualization/nviz/src/pick_vect_commands.c
===================================================================
--- grass/trunk/visualization/nviz/src/pick_vect_commands.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/visualization/nviz/src/pick_vect_commands.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -186,7 +186,7 @@
struct Map_info Map;
int line, area;
static struct line_cats *Cats = NULL;
- char *mapset;
+ const char *mapset;
if (!Cats)
Cats = Vect_new_cats_struct();
Modified: grass/trunk/visualization/nviz/src/query_vect.c
===================================================================
--- grass/trunk/visualization/nviz/src/query_vect.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/visualization/nviz/src/query_vect.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -14,7 +14,8 @@
double maxdist;
int line, area;
static struct line_cats *Cats = NULL;
- char *mapset, *form_buf;
+ const char *mapset;
+ char *form_buf;
dbString form;
struct field_info *Fi;
Modified: grass/trunk/visualization/nviz2/cmd/surface.c
===================================================================
--- grass/trunk/visualization/nviz2/cmd/surface.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/visualization/nviz2/cmd/surface.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -29,7 +29,7 @@
*/
int load_rasters(const struct GParams *params, nv_data * data)
{
- char *mapset;
+ const char *mapset;
int i;
int nelevs, nelev_map, nelev_const, ncolor_map, ncolor_const, nmask_map;
int ntransp_map, ntransp_const, nshine_map, nshine_const;
Modified: grass/trunk/visualization/nviz2/cmd/vector.c
===================================================================
--- grass/trunk/visualization/nviz2/cmd/vector.c 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/visualization/nviz2/cmd/vector.c 2008-11-27 16:39:38 UTC (rev 34539)
@@ -62,7 +62,7 @@
int i, id;
int nvects;
- char *mapset;
+ const char *mapset;
double x, y, z;
Modified: grass/trunk/visualization/xganim/Makefile
===================================================================
--- grass/trunk/visualization/xganim/Makefile 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/visualization/xganim/Makefile 2008-11-27 16:39:38 UTC (rev 34539)
@@ -9,6 +9,8 @@
include $(MODULE_TOPDIR)/include/Make/Module.make
+LINK = $(CXX)
+
ifneq ($(USE_WXWIDGETS),)
ifneq ($(strip $(CXX)),)
default: cmd
Modified: grass/trunk/visualization/xganim/main.cc
===================================================================
--- grass/trunk/visualization/xganim/main.cc 2008-11-27 16:32:38 UTC (rev 34538)
+++ grass/trunk/visualization/xganim/main.cc 2008-11-27 16:39:38 UTC (rev 34539)
@@ -360,7 +360,8 @@
char **gee_wildfiles(char *wildarg, char *element, int *num)
{
int n, cnt = 0;
- char path[GPATH_MAX], *mapset, cmd[GPATH_MAX], buf[512];
+ char path[GPATH_MAX], cmd[GPATH_MAX], buf[512];
+ const char *mapset;
char *p, *tfile;
static char *newfiles[MAXIMAGES];
FILE *tf;
More information about the grass-commit
mailing list