[GRASS-SVN] r31990 - in grass/trunk: include lib/gis lib/init
lib/sites lib/vector/Vlib raster/r.colors raster/r.volume
raster/simwe/simlib visualization/nviz/src
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jul 3 21:15:39 EDT 2008
Author: glynn
Date: 2008-07-03 21:15:39 -0400 (Thu, 03 Jul 2008)
New Revision: 31990
Modified:
grass/trunk/include/Vect.h
grass/trunk/include/gisdefs.h
grass/trunk/include/site.h
grass/trunk/lib/gis/list.c
grass/trunk/lib/gis/ls.c
grass/trunk/lib/gis/timestamp.c
grass/trunk/lib/init/set_data.c
grass/trunk/lib/sites/sites.c
grass/trunk/lib/vector/Vlib/array.c
grass/trunk/lib/vector/Vlib/cats.c
grass/trunk/lib/vector/Vlib/dbcolumns.c
grass/trunk/lib/vector/Vlib/field.c
grass/trunk/lib/vector/Vlib/header.c
grass/trunk/lib/vector/Vlib/hist.c
grass/trunk/lib/vector/Vlib/legal_vname.c
grass/trunk/lib/vector/Vlib/map.c
grass/trunk/lib/vector/Vlib/net.c
grass/trunk/lib/vector/Vlib/open.c
grass/trunk/lib/vector/Vlib/open_nat.c
grass/trunk/lib/vector/Vlib/overlay.c
grass/trunk/raster/r.colors/main.c
grass/trunk/raster/r.volume/main.c
grass/trunk/raster/simwe/simlib/output.c
grass/trunk/visualization/nviz/src/glwrappers.c
grass/trunk/visualization/nviz/src/interface.h
grass/trunk/visualization/nviz/src/site_attr_commands.c
grass/trunk/visualization/nviz/src/site_highlight_commands.c
Log:
Add "const" to vector functions
Remove "const" from G__ls() etc
Miscellaneous clean-up
Modified: grass/trunk/include/Vect.h
===================================================================
--- grass/trunk/include/Vect.h 2008-07-03 20:32:09 UTC (rev 31989)
+++ grass/trunk/include/Vect.h 2008-07-04 01:15:39 UTC (rev 31990)
@@ -45,37 +45,37 @@
/* List of categories */
struct cat_list *Vect_new_cat_list (void);
-int Vect_str_to_cat_list (char *, struct cat_list *);
+int Vect_str_to_cat_list (const char *, struct cat_list *);
int Vect_array_to_cat_list (int *, int, struct cat_list *);
int Vect_cat_in_cat_list (int, struct cat_list *);
int Vect_destroy_cat_list (struct cat_list *);
/* Vector array */
VARRAY *Vect_new_varray (int size);
-int Vect_set_varray_from_cat_string ( struct Map_info *, int, char *, int, int, VARRAY *);
+int Vect_set_varray_from_cat_string ( struct Map_info *, int, const char *, int, int, VARRAY *);
int Vect_set_varray_from_cat_list ( struct Map_info *, int, struct cat_list *, int, int, VARRAY *);
-int Vect_set_varray_from_db ( struct Map_info *, int, char *, int, int, VARRAY *);
+int Vect_set_varray_from_db ( struct Map_info *, int, const char *, int, int, VARRAY *);
/* DB connection - field info */
struct dblinks *Vect_new_dblinks_struct ( void );
void Vect_reset_dblinks ( struct dblinks *p );
-int Vect_add_dblink ( struct dblinks *p, int number, char *name, char *table, char *key,
- char *db, char *driver );
+int Vect_add_dblink ( struct dblinks *p, int number, const char *name, const char *table, const char *key,
+ const char *db, const char *driver );
int Vect_check_dblink ( struct dblinks *p, int field );
-int Vect_map_add_dblink ( struct Map_info *, int number, char *name, char *table, char *key,
- char *db, char *driver );
+int Vect_map_add_dblink ( struct Map_info *, int number, const char *name, const char *table, const char *key,
+ const char *db, const char *driver );
int Vect_map_del_dblink ( struct Map_info *, int number );
int Vect_map_check_dblink ( struct Map_info *, int field);
int Vect_read_dblinks ( struct Map_info * );
int Vect_write_dblinks ( struct Map_info * );
struct field_info *Vect_default_field_info ( struct Map_info *Map, int field,
- char *field_name, int type );
+ const char *field_name, int type );
struct field_info *Vect_get_dblink ( struct Map_info *Map, int link );
struct field_info *Vect_get_field ( struct Map_info *Map, int field );
void Vect_set_db_updated ( struct Map_info *Map );
-char *Vect_get_column_names (struct Map_info *Map, int field);
-char *Vect_get_column_types (struct Map_info *Map, int field);
-char *Vect_get_column_names_types (struct Map_info *Map, int field);
+const char *Vect_get_column_names (struct Map_info *Map, int field);
+const char *Vect_get_column_types (struct Map_info *Map, int field);
+const char *Vect_get_column_names_types (struct Map_info *Map, int field);
/* List of FID (feature ID) (integers) */
struct ilist *Vect_new_list (void);
@@ -122,28 +122,28 @@
/* Set/get Map header info */
int Vect_read_header (struct Map_info *);
int Vect_write_header (struct Map_info *);
-char *Vect_get_name (struct Map_info *);
-char *Vect_get_mapset (struct Map_info *);
-char *Vect_get_full_name (struct Map_info *);
+const char *Vect_get_name (struct Map_info *);
+const char *Vect_get_mapset (struct Map_info *);
+const char *Vect_get_full_name (struct Map_info *);
int Vect_is_3d (struct Map_info *);
-int Vect_set_organization (struct Map_info *, char *);
-char *Vect_get_organization (struct Map_info *);
-int Vect_set_date (struct Map_info *, char *);
-char *Vect_get_date (struct Map_info *);
-int Vect_set_person (struct Map_info *, char *);
-char *Vect_get_person (struct Map_info *);
-int Vect_set_map_name (struct Map_info *, char *);
-char *Vect_get_map_name (struct Map_info *);
-int Vect_set_map_date (struct Map_info *, char *);
-char *Vect_get_map_date (struct Map_info *);
-int Vect_set_comment (struct Map_info *, char *);
-char *Vect_get_comment (struct Map_info *);
+int Vect_set_organization (struct Map_info *, const char *);
+const char *Vect_get_organization (struct Map_info *);
+int Vect_set_date (struct Map_info *, const char *);
+const char *Vect_get_date (struct Map_info *);
+int Vect_set_person (struct Map_info *, const char *);
+const char *Vect_get_person (struct Map_info *);
+int Vect_set_map_name (struct Map_info *, const char *);
+const char *Vect_get_map_name (struct Map_info *);
+int Vect_set_map_date (struct Map_info *, const char *);
+const char *Vect_get_map_date (struct Map_info *);
+int Vect_set_comment (struct Map_info *, const char *);
+const char *Vect_get_comment (struct Map_info *);
int Vect_set_scale (struct Map_info *, int );
int Vect_get_scale (struct Map_info *);
int Vect_set_zone (struct Map_info *, int );
int Vect_get_zone (struct Map_info *);
int Vect_get_proj (struct Map_info *);
-char *Vect_get_proj_name (struct Map_info *);
+const char *Vect_get_proj_name (struct Map_info *);
int Vect_set_thresh (struct Map_info *, double );
double Vect_get_thresh (struct Map_info *);
int Vect_get_constraint_box ( struct Map_info *, BOUND_BOX *);
@@ -171,14 +171,14 @@
int Vect_get_fatal_error ();
/* Open/close/rewind/set_constraints for map */
-int Vect_check_input_output_name(char *, char *, int);
-int Vect_legal_filename(char *);
+int Vect_check_input_output_name(const char *, const char *, int);
+int Vect_legal_filename(const char *);
int Vect_set_open_level (int);
-int Vect_open_old (struct Map_info *, char *, char *);
-int Vect_open_old_head (struct Map_info *, char *, char *);
-int Vect_open_new (struct Map_info *, char *, int);
-int Vect_open_update (struct Map_info *, char *, char *);
-int Vect_open_update_head ( struct Map_info *, char *, char *);
+int Vect_open_old (struct Map_info *, const char *, const char *);
+int Vect_open_old_head (struct Map_info *, const char *, const char *);
+int Vect_open_new (struct Map_info *, const char *, int);
+int Vect_open_update (struct Map_info *, const char *, const char *);
+int Vect_open_update_head ( struct Map_info *, const char *, const char *);
int Vect_copy_head_data (struct Map_info *, struct Map_info *);
int Vect_build ( struct Map_info *, FILE *);
int Vect_get_built ( struct Map_info *Map );
@@ -234,7 +234,7 @@
/* History */
int Vect_hist_command ( struct Map_info *Map );
-int Vect_hist_write ( struct Map_info *Map, char *str );
+int Vect_hist_write ( struct Map_info *Map, const char *str );
int Vect_hist_copy ( struct Map_info *In, struct Map_info *Out );
void Vect_hist_rewind ( struct Map_info *Map );
char *Vect_hist_read ( char *s, int size, struct Map_info *Map );
@@ -287,7 +287,7 @@
FILE *msgout);
/* Overlay */
-int Vect_overlay_str_to_operator ( char * );
+int Vect_overlay_str_to_operator ( const char * );
int Vect_overlay ( struct Map_info *, int, struct ilist *, struct ilist *,
struct Map_info *, int, struct ilist *, struct ilist *,
int, struct Map_info *);
@@ -300,7 +300,7 @@
int Vect_graph_shortest_path ( GRAPH *, int, int, struct ilist *, double * );
/* Network (graph) */
-int Vect_net_build_graph ( struct Map_info *, int, int, int, char *, char *, char *, int, int);
+int Vect_net_build_graph ( struct Map_info *, int, int, int, const char *, const char *, const char *, int, int);
int Vect_net_shortest_path ( struct Map_info *, int, int, struct ilist *, double *);
int Vect_net_get_line_cost ( struct Map_info *, int, int, double *);
int Vect_net_get_node_cost ( struct Map_info *, int, double *);
@@ -316,12 +316,12 @@
double Vect_points_distance ( double, double, double, double, double, double, int);
int Vect_option_to_types (struct Option *);
int Vect_copy_map_lines ( struct Map_info *, struct Map_info * );
-int Vect_copy ( char *, char *, char *, FILE * );
-int Vect_rename ( char *, char *, FILE * );
-int Vect_copy_table ( struct Map_info *, struct Map_info *, int, int, char *, int );
-int Vect_copy_table_by_cats ( struct Map_info *, struct Map_info *, int, int, char *, int, int*, int );
+int Vect_copy ( const char *, const char *, const char *, FILE * );
+int Vect_rename ( const char *, const char *, FILE * );
+int Vect_copy_table ( struct Map_info *, struct Map_info *, int, int, const char *, int );
+int Vect_copy_table_by_cats ( struct Map_info *, struct Map_info *, int, int, const char *, int, int*, int );
int Vect_copy_tables ( struct Map_info *, struct Map_info *, int );
-int Vect_delete ( char *map );
+int Vect_delete ( const char *map );
int Vect_segment_intersection ( double, double, double, double, double, double,
double, double, double, double, double, double,
double *, double *, double *, double *, double *, double *,
@@ -330,7 +330,7 @@
struct line_pnts ***, struct line_pnts ***,
int *, int *, int );
int Vect_line_check_intersection ( struct line_pnts *, struct line_pnts *, int );
-char *Vect_subst_var ( char *str, struct Map_info *Map);
+char *Vect_subst_var ( const char *str, struct Map_info *Map);
/* Internal functions, MUST NOT be used in modules */
int Vect_print_header (struct Map_info *);
@@ -338,7 +338,7 @@
/* Open/close/rewind map */
int Vect_coor_info ( struct Map_info *, struct Coor_info *);
-char *Vect_maptype_info ( struct Map_info *);
+const char *Vect_maptype_info ( struct Map_info *);
int Vect_open_topo (struct Map_info *, int);
int Vect_save_topo ( struct Map_info *);
int Vect_open_spatial_index (struct Map_info *);
@@ -352,7 +352,7 @@
int V1_open_old_nat (struct Map_info *, int);
int V1_open_old_ogr (struct Map_info *, int);
int V2_open_old_ogr (struct Map_info *);
-int V1_open_new_nat (struct Map_info *, char *, int);
+int V1_open_new_nat (struct Map_info *, const char *, int);
int V1_rewind_nat (struct Map_info *);
int V1_rewind_ogr (struct Map_info *);
int V2_rewind_nat (struct Map_info *);
Modified: grass/trunk/include/gisdefs.h
===================================================================
--- grass/trunk/include/gisdefs.h 2008-07-03 20:32:09 UTC (rev 31989)
+++ grass/trunk/include/gisdefs.h 2008-07-04 01:15:39 UTC (rev 31990)
@@ -711,9 +711,9 @@
char *G__location_path(void);
/* ls.c */
-const char **G__ls(const char *, int *);
+char **G__ls(const char *, int *);
void G_ls(const char *, FILE *);
-void G_ls_format(const char **, int, int, FILE *);
+void G_ls_format(char **, int, int, FILE *);
/* lu.c */
int G_ludcmp(double **, int, int *, double *);
@@ -1124,7 +1124,7 @@
int G_write_raster_timestamp(const char *, const struct TimeStamp *);
int G_write_vector_timestamp(const char *, const struct TimeStamp *);
int G_format_timestamp ( const struct TimeStamp *, char *);
-int G_scan_timestamp ( struct TimeStamp *, char *);
+int G_scan_timestamp ( struct TimeStamp *, const char *);
int G_remove_raster_timestamp (const char *);
int G_remove_vector_timestamp (const char *);
int G_read_grid3_timestamp (const char *,const char *, struct TimeStamp *);
Modified: grass/trunk/include/site.h
===================================================================
--- grass/trunk/include/site.h 2008-07-03 20:32:09 UTC (rev 31989)
+++ grass/trunk/include/site.h 2008-07-04 01:15:39 UTC (rev 31990)
@@ -100,7 +100,7 @@
typedef struct
{
- char *name, *desc, *form, *labels, *stime;
+ const char *name, *desc, *form, *labels, *stime;
struct TimeStamp *time;
} Site_head;
Modified: grass/trunk/lib/gis/list.c
===================================================================
--- grass/trunk/lib/gis/list.c 2008-07-03 20:32:09 UTC (rev 31989)
+++ grass/trunk/lib/gis/list.c 2008-07-04 01:15:39 UTC (rev 31990)
@@ -149,7 +149,7 @@
{
char path[GPATH_MAX];
int count = 0;
- const char **list;
+ char **list;
int i;
/*
Modified: grass/trunk/lib/gis/ls.c
===================================================================
--- grass/trunk/lib/gis/ls.c 2008-07-03 20:32:09 UTC (rev 31989)
+++ grass/trunk/lib/gis/ls.c 2008-07-04 01:15:39 UTC (rev 31990)
@@ -52,11 +52,11 @@
* \return Pointer to array of strings containing the listing
**/
-const char **G__ls(const char *dir, int *num_files)
+char **G__ls(const char *dir, int *num_files)
{
struct dirent *dp;
DIR *dfd;
- const char **dir_listing = NULL;
+ char **dir_listing = NULL;
int n = 0;
if ((dfd = opendir(dir)) == NULL)
@@ -66,7 +66,7 @@
{
if(dp->d_name[0] != '.') /* Don't list hidden files */
{
- dir_listing = (const char **)G_realloc(dir_listing,
+ dir_listing = (char **)G_realloc(dir_listing,
(1 + n) * sizeof(char *));
dir_listing[n] = G_store(dp->d_name);
n++;
@@ -95,12 +95,12 @@
void G_ls(const char *dir, FILE *stream)
{
int i, n;
- const char **dir_listing = G__ls(dir, &n);
+ char **dir_listing = G__ls(dir, &n);
G_ls_format(dir_listing, n, 0, stream);
for (i = 0; i < n; i++)
- G_free((char *)dir_listing[i]);
+ G_free(dir_listing[i]);
G_free(dir_listing);
@@ -122,7 +122,7 @@
* \param stream Stream to print listing to
**/
-void G_ls_format(const char **list, int num_items, int perline, FILE *stream)
+void G_ls_format(char **list, int num_items, int perline, FILE *stream)
{
int i;
@@ -166,10 +166,10 @@
{
const int max
= num_items + column_height - (num_items % column_height);
- const char **next;
+ char **next;
for (i = 1, next = list; i <= num_items; i++) {
- const char **cur = next;
+ char **cur = next;
next += column_height;
if (next >= list + num_items) {
Modified: grass/trunk/lib/gis/timestamp.c
===================================================================
--- grass/trunk/lib/gis/timestamp.c 2008-07-03 20:32:09 UTC (rev 31989)
+++ grass/trunk/lib/gis/timestamp.c 2008-07-04 01:15:39 UTC (rev 31990)
@@ -211,7 +211,7 @@
*/
int G_scan_timestamp (
struct TimeStamp *ts,
- char *buf)
+ const char *buf)
{
char temp[1024], *t;
const char *slash;
Modified: grass/trunk/lib/init/set_data.c
===================================================================
--- grass/trunk/lib/init/set_data.c 2008-07-03 20:32:09 UTC (rev 31989)
+++ grass/trunk/lib/init/set_data.c 2008-07-04 01:15:39 UTC (rev 31990)
@@ -284,7 +284,7 @@
int
list_mapsets (const char *location_name, const char *location)
{
- const char **mapsets;
+ char **mapsets;
int i, num_mapsets;
int any, ok, any_ok;
int len, tot_len;
Modified: grass/trunk/lib/sites/sites.c
===================================================================
--- grass/trunk/lib/sites/sites.c 2008-07-03 20:32:09 UTC (rev 31989)
+++ grass/trunk/lib/sites/sites.c 2008-07-04 01:15:39 UTC (rev 31990)
@@ -205,7 +205,8 @@
return -1; /* added to prevent crash 5/2000 MN*/
}
}
- G_format_timestamp (head->time, head->stime);
+ G_format_timestamp (head->time, buf);
+ head->stime = G_store(buf);
Vect_set_date (Map, head->stime);
}
}
Modified: grass/trunk/lib/vector/Vlib/array.c
===================================================================
--- grass/trunk/lib/vector/Vlib/array.c 2008-07-03 20:32:09 UTC (rev 31989)
+++ grass/trunk/lib/vector/Vlib/array.c 2008-07-04 01:15:39 UTC (rev 31990)
@@ -81,7 +81,7 @@
\return -1 on error
*/
int
-Vect_set_varray_from_cat_string ( struct Map_info *Map, int field, char *cstring,
+Vect_set_varray_from_cat_string ( struct Map_info *Map, int field, const char *cstring,
int type, int value, VARRAY *varray )
{
int ret;
@@ -235,7 +235,7 @@
\return -1 on error
*/
int
-Vect_set_varray_from_db ( struct Map_info *Map, int field, char *where,
+Vect_set_varray_from_db ( struct Map_info *Map, int field, const char *where,
int type, int value, VARRAY *varray )
{
int i, n, c, centr, cat, *cats;
Modified: grass/trunk/lib/vector/Vlib/cats.c
===================================================================
--- grass/trunk/lib/vector/Vlib/cats.c 2008-07-03 20:32:09 UTC (rev 31989)
+++ grass/trunk/lib/vector/Vlib/cats.c 2008-07-04 01:15:39 UTC (rev 31990)
@@ -338,10 +338,11 @@
\return number of errors in ranges
*/
int
-Vect_str_to_cat_list (char *str, struct cat_list *list)
+Vect_str_to_cat_list (const char *str, struct cat_list *list)
{
int i, nr, l, err = 0;
- char *s, *e, buf[100];
+ const char *s, *e;
+ char buf[100];
int min, max;
G_debug (3, "Vect_str_to_cat_list(): str = %s", str);
Modified: grass/trunk/lib/vector/Vlib/dbcolumns.c
===================================================================
--- grass/trunk/lib/vector/Vlib/dbcolumns.c 2008-07-03 20:32:09 UTC (rev 31989)
+++ grass/trunk/lib/vector/Vlib/dbcolumns.c 2008-07-04 01:15:39 UTC (rev 31990)
@@ -37,7 +37,7 @@
\return list of column(s) names on success
\return NULL on error
*/
-char *Vect_get_column_names(struct Map_info *Map, int field)
+const char *Vect_get_column_names(struct Map_info *Map, int field)
{
int num_dblinks, ncols, col;
struct field_info *fi;
@@ -46,14 +46,11 @@
dbString table_name;
dbTable *table;
char buf[2000];
- char *ptr;
num_dblinks = Vect_get_num_dblinks(Map);
- if (num_dblinks <= 0) {
+ if (num_dblinks <= 0)
return (NULL);
- }
- else { /* num_dblinks > 0 */
G_debug(3,
"Displaying column names for database connection of layer %d:",
@@ -85,10 +82,7 @@
db_close_database(driver);
db_shutdown_driver(driver);
- ptr = G_malloc ( strlen(G_chop(buf)) );
- sprintf (ptr, "%s", buf);
- return (ptr);
- }
+ return G_store(G_chop(buf));
}
/*!
@@ -100,7 +94,7 @@
\return list of column(s) types on success
\return NULL on error
*/
-char *Vect_get_column_types(struct Map_info *Map, int field)
+const char *Vect_get_column_types(struct Map_info *Map, int field)
{
int num_dblinks, ncols, col;
struct field_info *fi;
@@ -109,14 +103,11 @@
dbString table_name;
dbTable *table;
char buf[2000];
- char *ptr;
num_dblinks = Vect_get_num_dblinks(Map);
- if (num_dblinks <= 0) {
+ if (num_dblinks <= 0)
return (NULL);
- }
- else { /* num_dblinks > 0 */
G_debug(3,
"Displaying column types for database connection of layer %d:",
@@ -148,10 +139,7 @@
db_close_database(driver);
db_shutdown_driver(driver);
- ptr = G_malloc ( strlen(G_chop(buf)) );
- sprintf (ptr, "%s", buf);
- return (ptr);
- }
+ return G_store(G_chop(buf));
}
@@ -164,7 +152,7 @@
\return list of column(s) types on success
\retutn NULL on error
*/
-char *Vect_get_column_names_types(struct Map_info *Map, int field)
+const char *Vect_get_column_names_types(struct Map_info *Map, int field)
{
int num_dblinks, ncols, col;
struct field_info *fi;
@@ -173,14 +161,11 @@
dbString table_name;
dbTable *table;
char buf[2000];
- char *ptr;
num_dblinks = Vect_get_num_dblinks(Map);
- if (num_dblinks <= 0) {
+ if (num_dblinks <= 0)
return (NULL);
- }
- else { /* num_dblinks > 0 */
G_debug(3,
"Displaying column types for database connection of layer %d:",
@@ -214,8 +199,5 @@
db_close_database(driver);
db_shutdown_driver(driver);
- ptr = G_malloc ( strlen(G_chop(buf)) );
- sprintf (ptr, "%s", buf);
- return (ptr);
- }
+ return G_store(G_chop(buf));
}
Modified: grass/trunk/lib/vector/Vlib/field.c
===================================================================
--- grass/trunk/lib/vector/Vlib/field.c 2008-07-03 20:32:09 UTC (rev 31989)
+++ grass/trunk/lib/vector/Vlib/field.c 2008-07-04 01:15:39 UTC (rev 31990)
@@ -81,8 +81,8 @@
\return -1 error
*/
int
-Vect_map_add_dblink ( struct Map_info *Map, int number, char *name, char *table, char *key,
- char *db, char *driver )
+Vect_map_add_dblink ( struct Map_info *Map, int number, const char *name, const char *table, const char *key,
+ const char *db, const char *driver )
{
int ret;
@@ -211,7 +211,7 @@
\return -1 error
*/
int
-Vect_add_dblink ( struct dblinks *p, int number, char *name, char *table, char *key, char *db, char *driver )
+Vect_add_dblink ( struct dblinks *p, int number, const char *name, const char *table, const char *key, const char *db, const char *driver )
{
int ret;
@@ -264,13 +264,13 @@
*Vect_default_field_info (
struct Map_info *Map,
int field,
- char *field_name,
+ const char *field_name,
int type )
{
struct field_info *fi;
char buf[1000], buf2[1000];
- char *schema;
- char *drv, *db;
+ const char *schema;
+ const char *drv, *db;
dbConnection connection;
G_debug (1, "Vect_default_field_info(): map = %s field = %d", Map->name, field);
@@ -666,7 +666,7 @@
\return pointer to new string
*/
char *
-Vect_subst_var ( char *in, struct Map_info *Map )
+Vect_subst_var ( const char *in, struct Map_info *Map )
{
char *c;
char buf[1000], str[1000];
Modified: grass/trunk/lib/vector/Vlib/header.c
===================================================================
--- grass/trunk/lib/vector/Vlib/header.c 2008-07-03 20:32:09 UTC (rev 31989)
+++ grass/trunk/lib/vector/Vlib/header.c 2008-07-04 01:15:39 UTC (rev 31990)
@@ -24,7 +24,7 @@
#include <grass/Vect.h>
#include <grass/glocale.h>
-static int lookup(char *file, char *key, char *value, size_t len);
+static int lookup(const char *file, const char *key, char *value, size_t len);
/*!
@@ -198,7 +198,7 @@
\return poiter to map name
*/
-char *
+const char *
Vect_get_name (struct Map_info *Map)
{
return (Map->name);
@@ -211,7 +211,7 @@
\return poiter to mapset name
*/
-char *
+const char *
Vect_get_mapset (struct Map_info *Map)
{
return (Map->mapset);
@@ -224,7 +224,7 @@
\return poiter to map name (name at mapset)
*/
-char *
+const char *
Vect_get_full_name (struct Map_info *Map)
{
char *ptr;
@@ -257,7 +257,7 @@
\return 0
*/
int
-Vect_set_organization (struct Map_info *Map, char *str )
+Vect_set_organization (struct Map_info *Map, const char *str )
{
G_free ( Map->head.organization );
Map->head.organization = G_store ( str );
@@ -272,7 +272,7 @@
\return organization string
*/
-char *
+const char *
Vect_get_organization (struct Map_info *Map)
{
return (Map->head.organization);
@@ -290,7 +290,7 @@
\return 0 on success
*/
int
-Vect_set_date (struct Map_info *Map, char *str )
+Vect_set_date (struct Map_info *Map, const char *str )
{
G_free ( Map->head.date );
Map->head.date = G_store ( str );
@@ -307,7 +307,7 @@
\return date of digitization string
*/
-char *
+const char *
Vect_get_date (struct Map_info *Map)
{
return (Map->head.date);
@@ -322,7 +322,7 @@
\return 0 on success
*/
int
-Vect_set_person (struct Map_info *Map, char *str )
+Vect_set_person (struct Map_info *Map, const char *str )
{
G_free ( Map->head.your_name );
Map->head.your_name = G_store ( str );
@@ -336,7 +336,7 @@
\return user name string
*/
-char *
+const char *
Vect_get_person (struct Map_info *Map)
{
return (Map->head.your_name);
@@ -351,7 +351,7 @@
\return 0 on success
*/
int
-Vect_set_map_name (struct Map_info *Map, char *str )
+Vect_set_map_name (struct Map_info *Map, const char *str )
{
G_free ( Map->head.map_name );
Map->head.map_name = G_store ( str );
@@ -365,7 +365,7 @@
\return map name string
*/
-char *
+const char *
Vect_get_map_name (struct Map_info *Map)
{
return (Map->head.map_name);
@@ -380,7 +380,7 @@
\return 0 on success
*/
int
-Vect_set_map_date (struct Map_info *Map, char *str )
+Vect_set_map_date (struct Map_info *Map, const char *str )
{
G_free ( Map->head.source_date );
Map->head.source_date = G_store ( str );
@@ -394,7 +394,7 @@
\return date when the source map was originally produced string
*/
-char *
+const char *
Vect_get_map_date (struct Map_info *Map)
{
return (Map->head.source_date);
@@ -437,7 +437,7 @@
\return 0 on success
*/
int
-Vect_set_comment (struct Map_info *Map, char *str )
+Vect_set_comment (struct Map_info *Map, const char *str )
{
G_free ( Map->head.line_3 );
Map->head.line_3 = G_store ( str );
@@ -451,7 +451,7 @@
\return comment or other info string
*/
-char *
+const char *
Vect_get_comment (struct Map_info *Map)
{
return (Map->head.line_3);
@@ -515,11 +515,10 @@
\return poiter to projection name
*/
-char *Vect_get_proj_name (struct Map_info *Map)
+const char *Vect_get_proj_name (struct Map_info *Map)
{
+ char name[256];
int n;
- static char name[256];
- char *G__projection_name();
switch(n=Vect_get_proj(Map))
{
@@ -531,7 +530,7 @@
}
if(!lookup (PROJECTION_FILE, "name", name, sizeof(name)))
strcpy (name, _("Unknown projection"));
- return name;
+ return G_store(name);
}
/*!
@@ -566,7 +565,7 @@
/* from lib/gis/proj3.c */
-static int lookup(char *file, char *key, char *value, size_t len)
+static int lookup(const char *file, const char *key, char *value, size_t len)
{
char path[GPATH_MAX];
Modified: grass/trunk/lib/vector/Vlib/hist.c
===================================================================
--- grass/trunk/lib/vector/Vlib/hist.c 2008-07-03 20:32:09 UTC (rev 31989)
+++ grass/trunk/lib/vector/Vlib/hist.c 2008-07-04 01:15:39 UTC (rev 31990)
@@ -62,7 +62,7 @@
\return the number of characters printed
*/
int
-Vect_hist_write ( struct Map_info *Map, char *str )
+Vect_hist_write ( struct Map_info *Map, const char *str )
{
int ret ;
Modified: grass/trunk/lib/vector/Vlib/legal_vname.c
===================================================================
--- grass/trunk/lib/vector/Vlib/legal_vname.c 2008-07-03 20:32:09 UTC (rev 31989)
+++ grass/trunk/lib/vector/Vlib/legal_vname.c 2008-07-04 01:15:39 UTC (rev 31990)
@@ -33,9 +33,14 @@
\return -1 if name does not start with letter A..Za..z or if name does not continue with A..Za..z0..9_@
*/
-int Vect_legal_filename (char *s)
+int Vect_legal_filename (const char *s)
{
+ /* full list of SQL keywords available at
+ http://www.postgresql.org/docs/8.2/static/sql-keywords-appendix.html
+ */
+ static const char *keywords[] = {"and", "or", "not", NULL};
char buf[GNAME_MAX];
+ int i;
sprintf(buf, "%s", s);
@@ -57,15 +62,11 @@
return -1;
}
- /* full list of SQL keywords available at
- http://www.postgresql.org/docs/8.2/static/sql-keywords-appendix.html
- */
- if (G_strcasecmp(buf, "and") == 0 ||
- G_strcasecmp(buf, "or") == 0 ||
- G_strcasecmp(buf, "not") == 0) {
- G_warning (_("Illegal vector map name <%s>. SQL keyword cannot be used as vector map name."), buf);
- return -1;
- }
+ for (i = 0; keywords[i]; i++)
+ if (G_strcasecmp(buf, keywords[i]) == 0) {
+ G_warning (_("Illegal vector map name <%s>. SQL keyword cannot be used as vector map name."), buf);
+ return -1;
+ }
return 1;
}
@@ -86,9 +87,9 @@
\return 1 error
*/
-int Vect_check_input_output_name ( char * input, char * output, int error )
+int Vect_check_input_output_name ( const char * input, const char * output, int error )
{
- char *mapset;
+ const char *mapset;
if ( Vect_legal_filename(output) == -1 ) {
if ( error == GV_FATAL_EXIT ) {
@@ -115,7 +116,8 @@
}
if ( strcmp(mapset,G_mapset()) == 0 ) {
- char *in, nm[1000], ms[1000];
+ const char *in;
+ char nm[GNAME_MAX], ms[GMAPSET_MAX];
if ( G__name_is_fully_qualified(input,nm,ms) ) {
in = nm;
Modified: grass/trunk/lib/vector/Vlib/map.c
===================================================================
--- grass/trunk/lib/vector/Vlib/map.c 2008-07-03 20:32:09 UTC (rev 31989)
+++ grass/trunk/lib/vector/Vlib/map.c 2008-07-04 01:15:39 UTC (rev 31990)
@@ -149,14 +149,14 @@
\return 0 success
*/
int
-Vect_copy ( char *in, char *mapset, char *out, FILE *msgout )
+Vect_copy ( const char *in, const char *mapset, const char *out, FILE *msgout )
{
int i, n, ret, type;
struct Map_info In, Out;
struct field_info *Fi, *Fin;
char old_path[GPATH_MAX], new_path[GPATH_MAX], buf[GPATH_MAX];
struct stat info;
- char *files[] = { GRASS_VECT_FRMT_ELEMENT, GRASS_VECT_COOR_ELEMENT,
+ const char *files[] = { GRASS_VECT_FRMT_ELEMENT, GRASS_VECT_COOR_ELEMENT,
GRASS_VECT_HEAD_ELEMENT, GRASS_VECT_HIST_ELEMENT,
GV_TOPO_ELEMENT, GV_SIDX_ELEMENT, GV_CIDX_ELEMENT,
NULL };
@@ -279,7 +279,7 @@
\return 0 success
*/
int
-Vect_rename ( char *in, char *out, FILE *msgout )
+Vect_rename ( const char *in, const char *out, FILE *msgout )
{
int i, n, ret, type;
struct Map_info Map;
@@ -399,7 +399,7 @@
\return 0 success
*/
int
-Vect_delete ( char *map )
+Vect_delete ( const char *map )
{
int i, n, ret;
struct Map_info Map;
@@ -407,12 +407,10 @@
char buf[GPATH_MAX];
DIR *dir;
struct dirent *ent;
- char *tmp;
+ const char *tmp;
G_debug (3, "Delete vector '%s'", map );
- G_chop ( map );
-
if ( map == NULL || strlen ( map ) == 0 ) {
G_warning (_("Invalid vector map name <%s>"), map ? map : "null");
return -1;
@@ -604,7 +602,7 @@
*/
int
Vect_copy_table ( struct Map_info *In, struct Map_info *Out, int field_in,
- int field_out, char *field_name, int type )
+ int field_out, const char *field_name, int type )
{
return Vect_copy_table_by_cats ( In, Out, field_in, field_out, field_name, type, NULL, 0);
}
@@ -626,11 +624,11 @@
*/
int
Vect_copy_table_by_cats ( struct Map_info *In, struct Map_info *Out, int field_in,
- int field_out, char *field_name, int type, int *cats, int ncats )
+ int field_out, const char *field_name, int type, int *cats, int ncats )
{
int ret;
struct field_info *Fi, *Fin;
- char *name, *key;
+ const char *name, *key;
G_debug (2, "Vect_copy_table(): field_in = %d field_out = %d", field_in, field_out);
Modified: grass/trunk/lib/vector/Vlib/net.c
===================================================================
--- grass/trunk/lib/vector/Vlib/net.c 2008-07-03 20:32:09 UTC (rev 31989)
+++ grass/trunk/lib/vector/Vlib/net.c 2008-07-04 01:15:39 UTC (rev 31990)
@@ -90,9 +90,9 @@
int ltype,
int afield,
int nfield,
- char *afcol,
- char *abcol,
- char *ncol,
+ const char *afcol,
+ const char *abcol,
+ const char *ncol,
int geo,
int algorithm )
{
Modified: grass/trunk/lib/vector/Vlib/open.c
===================================================================
--- grass/trunk/lib/vector/Vlib/open.c 2008-07-03 20:32:09 UTC (rev 31989)
+++ grass/trunk/lib/vector/Vlib/open.c 2008-07-04 01:15:39 UTC (rev 31990)
@@ -114,9 +114,9 @@
* \return -1 in error
*/
int
-Vect__open_old ( struct Map_info *Map, char *name, char *mapset, int update, int head_only )
+Vect__open_old ( struct Map_info *Map, const char *name, const char *mapset, int update, int head_only )
{
- char buf[200], buf2[200], xname[512], xmapset[512], errmsg[2000];
+ char buf[GNAME_MAX+10], buf2[GMAPSET_MAX+10], xname[GNAME_MAX], xmapset[GMAPSET_MAX], errmsg[2000];
FILE *fp;
int level, level_request, ferror;
int format, ret;
@@ -373,10 +373,7 @@
* \return -1 on error
*/
int
-Vect_open_old (
- struct Map_info *Map,
- char *name,
- char *mapset)
+Vect_open_old (struct Map_info *Map, const char *name, const char *mapset)
{
return ( Vect__open_old (Map, name, mapset, 0, 0) );
}
@@ -394,7 +391,7 @@
* \return -1 on error
*/
int
-Vect_open_update (struct Map_info *Map, char *name, char *mapset)
+Vect_open_update (struct Map_info *Map, const char *name, const char *mapset)
{
int ret;
@@ -431,7 +428,7 @@
* \return -1 on error
*/
int
-Vect_open_old_head (struct Map_info *Map, char *name, char *mapset)
+Vect_open_old_head (struct Map_info *Map, const char *name, const char *mapset)
{
return ( Vect__open_old (Map, name, mapset, 0, 1) );
}
@@ -449,7 +446,7 @@
* \return -1 on error
*/
int
-Vect_open_update_head ( struct Map_info *Map, char *name, char *mapset)
+Vect_open_update_head ( struct Map_info *Map, const char *name, const char *mapset)
{
int ret;
@@ -480,7 +477,7 @@
* \return -1 on error
*/
int
-Vect_open_new (struct Map_info *Map, char *name, int with_z)
+Vect_open_new (struct Map_info *Map, const char *name, int with_z)
{
int ret, ferror;
char errmsg[2000], buf[200];
@@ -499,7 +496,7 @@
}
/* Check if map already exists */
- if ( G_find_file(GRASS_VECT_DIRECTORY, name, G_mapset()) != NULL ) {
+ if ( G_find_file2(GRASS_VECT_DIRECTORY, name, G_mapset()) != NULL ) {
G_warning (_("Vector map <%s> already exists and will be overwritten"), name);
ret = Vect_delete ( name );
@@ -608,12 +605,11 @@
* \return maptype string on success
* \return error message on error
*/
-char *
+const char *
Vect_maptype_info ( struct Map_info *Map )
{
- char *maptype;
+ char maptype[1000];
- maptype = G_malloc(sizeof(char) * 200);
switch ( Map->format ) {
case GV_FORMAT_NATIVE :
sprintf (maptype, "native");
@@ -625,7 +621,7 @@
sprintf (maptype, "unknown %d (update Vect_maptype_info)", Map->format);
}
- return maptype;
+ return G_store(maptype);
}
Modified: grass/trunk/lib/vector/Vlib/open_nat.c
===================================================================
--- grass/trunk/lib/vector/Vlib/open_nat.c 2008-07-03 20:32:09 UTC (rev 31989)
+++ grass/trunk/lib/vector/Vlib/open_nat.c 2008-07-04 01:15:39 UTC (rev 31990)
@@ -83,7 +83,7 @@
int
V1_open_new_nat (
struct Map_info *Map,
- char *name,
+ const char *name,
int with_z)
{
char buf[1000];
Modified: grass/trunk/lib/vector/Vlib/overlay.c
===================================================================
--- grass/trunk/lib/vector/Vlib/overlay.c 2008-07-03 20:32:09 UTC (rev 31989)
+++ grass/trunk/lib/vector/Vlib/overlay.c 2008-07-04 01:15:39 UTC (rev 31990)
@@ -37,7 +37,7 @@
\return -1 on error
*/
int
-Vect_overlay_str_to_operator ( char *str )
+Vect_overlay_str_to_operator ( const char *str )
{
if ( strcmp ( str, GV_ON_AND ) == 0 )
Modified: grass/trunk/raster/r.colors/main.c
===================================================================
--- grass/trunk/raster/r.colors/main.c 2008-07-03 20:32:09 UTC (rev 31989)
+++ grass/trunk/raster/r.colors/main.c 2008-07-04 01:15:39 UTC (rev 31990)
@@ -29,7 +29,7 @@
#include <grass/glocale.h>
#include "local_proto.h"
-static const char **rules;
+static char **rules;
static int nrules;
static void scan_rules(void)
Modified: grass/trunk/raster/r.volume/main.c
===================================================================
--- grass/trunk/raster/r.volume/main.c 2008-07-03 20:32:09 UTC (rev 31989)
+++ grass/trunk/raster/r.volume/main.c 2008-07-04 01:15:39 UTC (rev 31990)
@@ -203,19 +203,15 @@
/* got everything, now do output */
if (*site_list) {
+ char desc[GNAME_MAX*2+40];
site_info.form = NULL;
site_info.time = NULL;
site_info.stime = NULL;
- site_info.labels = (char *)G_malloc(80 * sizeof(char));
- site_info.name = (char *)G_malloc(80 * sizeof(char));
- site_info.desc = (char *)G_malloc(80 * sizeof(char));
- if (site_info.desc == NULL || site_info.name == NULL ||
- site_info.labels == NULL)
- G_fatal_error(_("Memory allocation error"));
- sprintf(site_info.desc, "from %s on map %s using clumps from %s",
+ sprintf(desc, "from %s on map %s using clumps from %s",
argv[0], datamap, clumpmap);
- sprintf(site_info.name, "%s", site_list);
- sprintf(site_info.labels,
+ site_info.desc = G_store(desc);
+ site_info.name = G_store(site_list);
+ site_info.labels = G_store(
"centroid east|centroid north|#cat vol avg t n");
G_site_put_head(fd_sites, &site_info);
}
Modified: grass/trunk/raster/simwe/simlib/output.c
===================================================================
--- grass/trunk/raster/simwe/simlib/output.c 2008-07-03 20:32:09 UTC (rev 31989)
+++ grass/trunk/raster/simwe/simlib/output.c 2008-07-04 01:15:39 UTC (rev 31990)
@@ -56,6 +56,7 @@
G_fatal_error ("Cannot open %s", outwalk);
else
{
+ char buf[GNAME_MAX+40];
if(NULL == (sd = G_site_new_struct(-1,2,0,1)))
G_fatal_error("memory allocation failed for site");
@@ -64,10 +65,8 @@
else
walkershead.name = outwalk;
- walkershead.desc = G_strdup ("output walkers");
- walkershead.desc = (char *) G_malloc (128 * sizeof (char));
- sprintf (walkershead.desc, "output walkers of %s [raster]",
- depth);
+ sprintf (buf, "output walkers of %s [raster]", depth);
+ walkershead.desc = G_store(buf);
walkershead.time = NULL;
walkershead.stime = NULL;
walkershead.labels = NULL;
Modified: grass/trunk/visualization/nviz/src/glwrappers.c
===================================================================
--- grass/trunk/visualization/nviz/src/glwrappers.c 2008-07-03 20:32:09 UTC (rev 31989)
+++ grass/trunk/visualization/nviz/src/glwrappers.c 2008-07-04 01:15:39 UTC (rev 31990)
@@ -52,7 +52,7 @@
}
-int tcl_color_to_int(char *clr)
+int tcl_color_to_int(const char *clr)
{
int r, g, b;
int c;
Modified: grass/trunk/visualization/nviz/src/interface.h
===================================================================
--- grass/trunk/visualization/nviz/src/interface.h 2008-07-03 20:32:09 UTC (rev 31989)
+++ grass/trunk/visualization/nviz/src/interface.h 2008-07-04 01:15:39 UTC (rev 31990)
@@ -192,7 +192,7 @@
int Nget_first_exag_cmd(Nv_data *, Tcl_Interp *, int, char **);
int Nget_height_cmd(Nv_data *, Tcl_Interp *, int, char **);
/* glwrappers.c */
-int tcl_color_to_int(char *);
+int tcl_color_to_int(const char *);
int Nresize_cmd(Nv_data *, Tcl_Interp *, int, char **);
int Nfinish_cmd(ClientData, Tcl_Interp *, int, char **);
int Nset_background_cmd(Nv_data *, Tcl_Interp *, int, char **);
@@ -365,31 +365,25 @@
/* site_attr_commands.c */
int site_attr_open_map(geosite *, int, struct Map_info **, int *, char ***, int **, int **);
-int site_attr_set_color(geosite *, int, int, int, char**, char**);
-int site_attr_set_size(geosite *, int, int, int, char**, char**);
+int site_attr_set_color(geosite *, int, int, int, const char**, const char**);
+int site_attr_set_size(geosite *, int, int, int, const char**, const char**);
int site_attr_set_fixed_color(geosite *, int, unsigned int);
int site_attr_set_fixed_size(geosite *, int, float);
int site_attr_set_fixed_marker(geosite *, int, int);
int site_attr_set(Tcl_Interp *, geosite *, int, char *, int, char *, char *);
int site_attr_unset(Tcl_Interp *, geosite *, int, char *);
int site_attr_get(Tcl_Interp *, geosite *, int);
-int site_attr_set_color(geosite *, int, int, int, char**, char**);
-int site_attr_set_size(geosite *, int, int, int, char**, char**);
-int site_attr_set_fixed_color(geosite *, int, unsigned int);
-int site_attr_set_fixed_size(geosite *, int, float);
-int site_attr_set_fixed_marker(geosite *, int, int);
void site_attr_init_tcl(Tcl_Interp *, Nv_data *);
void site_attr_init(int);
-int attr_interp_entries(int , char** , char** , float **, float **, float **);
-int attr_interp_colors(int , char** , char** , float **, float **, float **, float **, float **, float **, float **);
-int attr_get_int_BBGGRR(char* );
-int attr_interp_entries(int , char** , char** , float **, float **, float **);
-int attr_interp_entries_string(int , char** , float **);
-int attr_interp_colors(int , char** , char** , float **,float **, float **, float **, float **, float **, float **);
-int attr_interp_colors_string(int , char** , float **, float **, float **);
+int attr_interp_entries(int , const char** , const char** , float **, float **, float **);
+int attr_interp_colors(int , const char** , const char** , float **, float **, float **, float **, float **, float **, float **);
+int attr_get_int_BBGGRR(const char* );
+float attr_get_RRGGBB(const char*, float *, float *, float *);
+int attr_interp_entries_string(int , const char** , float **);
+int attr_interp_colors_string(int , const char** , float **, float **, float **);
int attr_eval_color(float , int , float *, float *, float *, float *, float *, float *, float *);
-int attr_eval_color_string(char* , int , char** , float *, float *, float *);
-float attr_eval_entry_string(char* , int , char** , float*);
+int attr_eval_color_string(const char* , int , const char** , float *, float *, float *);
+float attr_eval_entry_string(const char* , int , const char** , float*);
/* pick_vect_commands.c */
void pick_init_tcl(Tcl_Interp *, Nv_data *);
Modified: grass/trunk/visualization/nviz/src/site_attr_commands.c
===================================================================
--- grass/trunk/visualization/nviz/src/site_attr_commands.c 2008-07-03 20:32:09 UTC (rev 31989)
+++ grass/trunk/visualization/nviz/src/site_attr_commands.c 2008-07-04 01:15:39 UTC (rev 31990)
@@ -277,8 +277,8 @@
These following functions will better stay in appropriate .h files if
these functions will be put in separate files
*/
-int attr_interp_entries(int n, char** argvX, char** argvY, float **x, float **y, float **m);
-int attr_interp_colors(int n, char** argvX, char** argvY, float **x,
+int attr_interp_entries(int n, const char** argvX, const char** argvY, float **x, float **y, float **m);
+int attr_interp_colors(int n, const char** argvX, const char** argvY, float **x,
float **yr, float **yg, float **yb,
float **mr, float **mg, float **mb);
@@ -627,8 +627,8 @@
/* declarations of following functions */
-int site_attr_set_color(geosite * gp, int nattr, int index, int n, char** argvX, char** argvY);
-int site_attr_set_size(geosite * gp, int nattr, int index, int n, char** argvX, char** argvY);
+int site_attr_set_color(geosite * gp, int nattr, int index, int n, const char** argvX, const char** argvY);
+int site_attr_set_size(geosite * gp, int nattr, int index, int n, const char** argvX, const char** argvY);
int site_attr_set_fixed_color(geosite * gp, int nattr, unsigned int color);
int site_attr_set_fixed_size(geosite * gp, int nattr, float size);
int site_attr_set_fixed_marker(geosite * gp, int nattr, int marker);
@@ -728,7 +728,7 @@
-int site_attr_set_color(geosite * gp, int nattr, int index, int n, char** argvX, char** argvY)
+int site_attr_set_color(geosite * gp, int nattr, int index, int n, const char** argvX, const char** argvY)
{
struct Map_info *Map; geopoint *gpt; SITE_ATT *sa;
int *ctypes; char **cnames; int *ndx;
@@ -763,7 +763,7 @@
return(0);
}
-int site_attr_set_size(geosite * gp, int nattr, int index, int n, char** argvX, char** argvY)
+int site_attr_set_size(geosite * gp, int nattr, int index, int n, const char** argvX, const char** argvY)
{
struct Map_info *Map; geopoint *gpt; SITE_ATT *sa;
int *ctypes; char **cnames; int *ndx;
@@ -834,7 +834,7 @@
/* Color conversion functions **************************************************/
/*******************************************************************************/
-int attr_get_int_BBGGRR(char* rrggbb)
+int attr_get_int_BBGGRR(const char* rrggbb)
{
/* rrggbb is in the form of #RRGGBB (first char is skipped) */
char strbuf[16];
@@ -846,7 +846,7 @@
}
-float attr_get_RRGGBB(char* rrggbb, float *r, float *g, float *b)
+float attr_get_RRGGBB(const char* rrggbb, float *r, float *g, float *b)
{
/* rrggbb is in the form of #RRGGBB (first char is skipped) */
char strbuf[16];
@@ -979,7 +979,7 @@
- string do not: values are kept constant and change when there is a new one
********************************************************************************/
-int attr_interp_entries(int n, char** argvX, char** argvY, float **x, float **y, float **m)
+int attr_interp_entries(int n, const char** argvX, const char** argvY, float **x, float **y, float **m)
{
const char *function_name="attr_interp_entries";
@@ -1005,7 +1005,7 @@
return(0);
}
-int attr_interp_entries_string(int n, char** argvY, float **y)
+int attr_interp_entries_string(int n, const char** argvY, float **y)
{
int i;
*y = (float*) malloc(n*sizeof(float));
@@ -1013,9 +1013,9 @@
return(0);
}
-int attr_interp_colors(int n, char** argvX, char** argvY, float **x,
- float **yr, float **yg, float **yb,
- float **mr, float **mg, float **mb)
+int attr_interp_colors(int n, const char** argvX, const char** argvY, float **x,
+ float **yr, float **yg, float **yb,
+ float **mr, float **mg, float **mb)
{
const char *function_name="attr_interp_colors";
@@ -1054,8 +1054,8 @@
}
-int attr_interp_colors_string(int n, char** argvY,
- float **yr, float **yg, float **yb)
+int attr_interp_colors_string(int n, const char** argvY,
+ float **yr, float **yg, float **yb)
{
int i;
@@ -1084,7 +1084,7 @@
}
}
-float attr_eval_entry_string(char* xvalue, int n, char** x, float* y)
+float attr_eval_entry_string(const char* xvalue, int n, const char** x, float* y)
{
int i;
if (strcmp(xvalue, x[0]) <= 0) return(y[0]);
@@ -1097,8 +1097,8 @@
}
int attr_eval_color(float xvalue, int n, float *x,
- float *yr, float *yg, float *yb,
- float *mr, float *mg, float *mb)
+ float *yr, float *yg, float *yb,
+ float *mr, float *mg, float *mb)
{
int i;
float r, g, b, dx;
@@ -1118,8 +1118,8 @@
}
}
-int attr_eval_color_string(char* xvalue, int n, char** x,
- float *yr, float *yg, float *yb)
+int attr_eval_color_string(const char* xvalue, int n, const char** x,
+ float *yr, float *yg, float *yb)
{
int i;
Modified: grass/trunk/visualization/nviz/src/site_highlight_commands.c
===================================================================
--- grass/trunk/visualization/nviz/src/site_highlight_commands.c 2008-07-03 20:32:09 UTC (rev 31989)
+++ grass/trunk/visualization/nviz/src/site_highlight_commands.c 2008-07-04 01:15:39 UTC (rev 31990)
@@ -277,7 +277,7 @@
}
-int site_highlight_loop(geosite * gp, char ** argvPtr, int argcPtr, int what, int flag, float value)
+int site_highlight_loop(geosite * gp, const char ** argvPtr, int argcPtr, int what, int flag, float value)
{
geopoint * gpt;
int i;
More information about the grass-commit
mailing list