[GRASS-SVN] r31977 - in grass/branches/develbranch_6: db/base
db/drivers/dbf db/drivers/odbc db/drivers/ogr
db/drivers/postgres db/drivers/sqlite general/g.parser
general/manage/cmd include lib/cairodriver lib/db/dbmi_base
lib/db/dbmi_client lib/db/dbmi_driver lib/form lib/gis
lib/init lib/sites raster/r.colors raster/r.cross
raster/r.neighbors raster/r.out.gdal raster/r.transect
raster/r.univar2 raster/simwe/r.sim.sediment
raster/wildfire/r.ros vector/lidar/v.surf.bspline
vector/v.digit 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.out.svg
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jul 3 04:18:43 EDT 2008
Author: neteler
Date: 2008-07-03 04:18:42 -0400 (Thu, 03 Jul 2008)
New Revision: 31977
Modified:
grass/branches/develbranch_6/db/base/columns.c
grass/branches/develbranch_6/db/base/copy.c
grass/branches/develbranch_6/db/base/describe.c
grass/branches/develbranch_6/db/base/execute.c
grass/branches/develbranch_6/db/base/select.c
grass/branches/develbranch_6/db/base/tables.c
grass/branches/develbranch_6/db/drivers/dbf/db.c
grass/branches/develbranch_6/db/drivers/odbc/db.c
grass/branches/develbranch_6/db/drivers/ogr/db.c
grass/branches/develbranch_6/db/drivers/postgres/create_table.c
grass/branches/develbranch_6/db/drivers/postgres/cursor.c
grass/branches/develbranch_6/db/drivers/postgres/db.c
grass/branches/develbranch_6/db/drivers/postgres/error.c
grass/branches/develbranch_6/db/drivers/postgres/parse.c
grass/branches/develbranch_6/db/drivers/postgres/proto.h
grass/branches/develbranch_6/db/drivers/sqlite/create_table.c
grass/branches/develbranch_6/db/drivers/sqlite/db.c
grass/branches/develbranch_6/general/g.parser/main.c
grass/branches/develbranch_6/general/manage/cmd/copy.c
grass/branches/develbranch_6/general/manage/cmd/list.c
grass/branches/develbranch_6/general/manage/cmd/remove.c
grass/branches/develbranch_6/general/manage/cmd/rename.c
grass/branches/develbranch_6/include/proto_dbmi.h
grass/branches/develbranch_6/lib/cairodriver/read_bmp.c
grass/branches/develbranch_6/lib/cairodriver/write_bmp.c
grass/branches/develbranch_6/lib/db/dbmi_base/alloc.c
grass/branches/develbranch_6/lib/db/dbmi_base/case.c
grass/branches/develbranch_6/lib/db/dbmi_base/column.c
grass/branches/develbranch_6/lib/db/dbmi_base/columnfmt.c
grass/branches/develbranch_6/lib/db/dbmi_base/datetime.c
grass/branches/develbranch_6/lib/db/dbmi_base/dbmscap.c
grass/branches/develbranch_6/lib/db/dbmi_base/default_name.c
grass/branches/develbranch_6/lib/db/dbmi_base/dirent.c
grass/branches/develbranch_6/lib/db/dbmi_base/error.c
grass/branches/develbranch_6/lib/db/dbmi_base/handle.c
grass/branches/develbranch_6/lib/db/dbmi_base/index.c
grass/branches/develbranch_6/lib/db/dbmi_base/isdir.c
grass/branches/develbranch_6/lib/db/dbmi_base/legal_dbname.c
grass/branches/develbranch_6/lib/db/dbmi_base/login.c
grass/branches/develbranch_6/lib/db/dbmi_base/sqltype.c
grass/branches/develbranch_6/lib/db/dbmi_base/string.c
grass/branches/develbranch_6/lib/db/dbmi_base/table.c
grass/branches/develbranch_6/lib/db/dbmi_base/value.c
grass/branches/develbranch_6/lib/db/dbmi_base/valuefmt.c
grass/branches/develbranch_6/lib/db/dbmi_base/xdrstring.c
grass/branches/develbranch_6/lib/db/dbmi_client/c_create_idx.c
grass/branches/develbranch_6/lib/db/dbmi_client/c_list_drivers.c
grass/branches/develbranch_6/lib/db/dbmi_client/c_priv.c
grass/branches/develbranch_6/lib/db/dbmi_client/column.c
grass/branches/develbranch_6/lib/db/dbmi_client/copy_tab.c
grass/branches/develbranch_6/lib/db/dbmi_client/db.c
grass/branches/develbranch_6/lib/db/dbmi_client/delete_tab.c
grass/branches/develbranch_6/lib/db/dbmi_client/select.c
grass/branches/develbranch_6/lib/db/dbmi_client/start.c
grass/branches/develbranch_6/lib/db/dbmi_client/table.c
grass/branches/develbranch_6/lib/db/dbmi_driver/d_mkdir.c
grass/branches/develbranch_6/lib/db/dbmi_driver/driver_state.c
grass/branches/develbranch_6/lib/form/generate.c
grass/branches/develbranch_6/lib/gis/parser.c
grass/branches/develbranch_6/lib/init/local_proto.h
grass/branches/develbranch_6/lib/init/mke_loc.c
grass/branches/develbranch_6/lib/init/mke_mapset.c
grass/branches/develbranch_6/lib/init/other.c
grass/branches/develbranch_6/lib/init/set_data.c
grass/branches/develbranch_6/lib/sites/sites.c
grass/branches/develbranch_6/raster/r.colors/main.c
grass/branches/develbranch_6/raster/r.cross/main.c
grass/branches/develbranch_6/raster/r.neighbors/main.c
grass/branches/develbranch_6/raster/r.out.gdal/main.c
grass/branches/develbranch_6/raster/r.transect/local_proto.h
grass/branches/develbranch_6/raster/r.transect/parse_line.c
grass/branches/develbranch_6/raster/r.univar2/r.univar_main.c
grass/branches/develbranch_6/raster/simwe/r.sim.sediment/main.c
grass/branches/develbranch_6/raster/wildfire/r.ros/main.c
grass/branches/develbranch_6/vector/lidar/v.surf.bspline/main.c
grass/branches/develbranch_6/vector/v.digit/generate.c
grass/branches/develbranch_6/vector/v.lrs/v.lrs.create/main.c
grass/branches/develbranch_6/vector/v.lrs/v.lrs.label/main.c
grass/branches/develbranch_6/vector/v.lrs/v.lrs.segment/main.c
grass/branches/develbranch_6/vector/v.lrs/v.lrs.where/main.c
grass/branches/develbranch_6/vector/v.out.svg/main.c
Log:
glynn: Add const where appropriate to DBMI functions; Miscellaneous clean-up (merge from trunk)
Modified: grass/branches/develbranch_6/db/base/columns.c
===================================================================
--- grass/branches/develbranch_6/db/base/columns.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/db/base/columns.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -69,7 +69,7 @@
{
struct Option *driver, *database, *table;
struct GModule *module;
- char *drv, *db;
+ const char *drv, *db;
/* Initialize the GIS calls */
G_gisinit(argv[0]) ;
Modified: grass/branches/develbranch_6/db/base/copy.c
===================================================================
--- grass/branches/develbranch_6/db/base/copy.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/db/base/copy.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -27,7 +27,7 @@
struct Option *to_driver, *to_database, *to_table;
struct Option *where, *select;
struct GModule *module;
- char *drv, *db;
+ const char *drv, *db;
/* Set description */
module = G_define_module();
Modified: grass/branches/develbranch_6/db/base/describe.c
===================================================================
--- grass/branches/develbranch_6/db/base/describe.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/db/base/describe.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -95,7 +95,7 @@
struct Option *driver, *database, *table;
struct Flag *cols, *tdesc;
struct GModule *module;
- char *drv, *db;
+ const char *drv, *db;
/* Initialize the GIS calls */
G_gisinit(argv[0]) ;
Modified: grass/branches/develbranch_6/db/base/execute.c
===================================================================
--- grass/branches/develbranch_6/db/base/execute.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/db/base/execute.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -98,7 +98,7 @@
struct Option *driver, *database, *input;
struct Flag *i;
struct GModule *module;
- char *drv, *db;
+ const char *drv, *db;
/* Initialize the GIS calls */
G_gisinit(argv[0]) ;
Modified: grass/branches/develbranch_6/db/base/select.c
===================================================================
--- grass/branches/develbranch_6/db/base/select.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/db/base/select.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -174,7 +174,7 @@
struct Option *driver, *database, *table, *sql, *fs, *vs, *nv, *input;
struct Flag *c,*d,*v, *flag_test;
struct GModule *module;
- char *drv, *db;
+ const char *drv, *db;
/* Initialize the GIS calls */
G_gisinit(argv[0]) ;
Modified: grass/branches/develbranch_6/db/base/tables.c
===================================================================
--- grass/branches/develbranch_6/db/base/tables.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/db/base/tables.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -68,7 +68,7 @@
struct Option *driver, *database;
struct Flag *p, *s;
struct GModule *module;
- char *drv, *db;
+ const char *drv, *db;
/* Initialize the GIS calls */
G_gisinit(argv[0]) ;
Modified: grass/branches/develbranch_6/db/drivers/dbf/db.c
===================================================================
--- grass/branches/develbranch_6/db/drivers/dbf/db.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/db/drivers/dbf/db.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -27,7 +27,7 @@
int db__driver_open_database(dbHandle * handle)
{
- char *name;
+ const char *name;
int len;
dbConnection connection;
char buf[1024];
Modified: grass/branches/develbranch_6/db/drivers/odbc/db.c
===================================================================
--- grass/branches/develbranch_6/db/drivers/odbc/db.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/db/drivers/odbc/db.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -9,7 +9,8 @@
int
db__driver_open_database (dbHandle *handle)
{
- char *name, msg[OD_MSG];
+ char msg[OD_MSG];
+ const char *name;
char *emsg = NULL;
SQLRETURN ret;
SQLINTEGER err;
Modified: grass/branches/develbranch_6/db/drivers/ogr/db.c
===================================================================
--- grass/branches/develbranch_6/db/drivers/ogr/db.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/db/drivers/ogr/db.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -23,7 +23,7 @@
int db__driver_open_database( dbHandle *handle )
{
- char *name;
+ const char *name;
dbConnection connection;
init_error();
Modified: grass/branches/develbranch_6/db/drivers/postgres/create_table.c
===================================================================
--- grass/branches/develbranch_6/db/drivers/postgres/create_table.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/db/drivers/postgres/create_table.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -7,7 +7,7 @@
{
int col, ncols;
dbColumn *column;
- char *colname;
+ const char *colname;
int sqltype;
char buf[500];
PGresult *res;
Modified: grass/branches/develbranch_6/db/drivers/postgres/cursor.c
===================================================================
--- grass/branches/develbranch_6/db/drivers/postgres/cursor.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/db/drivers/postgres/cursor.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -24,7 +24,7 @@
}
-cursor * alloc_cursor()
+cursor * alloc_cursor(void)
{
cursor *c;
Modified: grass/branches/develbranch_6/db/drivers/postgres/db.c
===================================================================
--- grass/branches/develbranch_6/db/drivers/postgres/db.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/db/drivers/postgres/db.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -8,7 +8,8 @@
int db__driver_open_database (dbHandle *handle)
{
- char *name, *schema, *user, *password, buf[500];
+ char buf[500];
+ const char *name, *schema, *user, *password;
dbConnection connection;
PGCONN pgconn;
PGresult *res;
@@ -37,9 +38,6 @@
pg_conn = PQsetdbLogin( pgconn.host, pgconn.port, pgconn.options, pgconn.tty,
pgconn.dbname, user, password );
-
- G_free ( user );
- G_free ( password );
if (PQstatus(pg_conn) == CONNECTION_BAD) {
append_error ( "Cannot connect to Postgres: " );
Modified: grass/branches/develbranch_6/db/drivers/postgres/error.c
===================================================================
--- grass/branches/develbranch_6/db/drivers/postgres/error.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/db/drivers/postgres/error.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -17,7 +17,7 @@
/* append error message */
void
-append_error ( char *msg )
+append_error ( const char *msg )
{
db_append_string ( errMsg, msg);
}
Modified: grass/branches/develbranch_6/db/drivers/postgres/parse.c
===================================================================
--- grass/branches/develbranch_6/db/drivers/postgres/parse.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/db/drivers/postgres/parse.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -14,7 +14,7 @@
* returns: DB_OK - OK
* DB_FAILED - error
*/
-int parse_conn ( char *str, PGCONN *pgconn )
+int parse_conn ( const char *str, PGCONN *pgconn )
{
int i;
char **tokens, delm[2];
Modified: grass/branches/develbranch_6/db/drivers/postgres/proto.h
===================================================================
--- grass/branches/develbranch_6/db/drivers/postgres/proto.h 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/db/drivers/postgres/proto.h 2008-07-03 08:18:42 UTC (rev 31977)
@@ -1,10 +1,10 @@
/* error.c */
void init_error ( void );
-void append_error ( char * );
+void append_error ( const char * );
void report_error ( void );
/* cursor.c */
-cursor * alloc_cursor ();
+cursor * alloc_cursor (void);
void free_cursor ( cursor * );
/* describe.c*/
@@ -13,4 +13,4 @@
int get_gpg_type ( int );
/* parse.c */
-int parse_conn ( char *, PGCONN *);
+int parse_conn ( const char *, PGCONN *);
Modified: grass/branches/develbranch_6/db/drivers/sqlite/create_table.c
===================================================================
--- grass/branches/develbranch_6/db/drivers/sqlite/create_table.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/db/drivers/sqlite/create_table.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -30,7 +30,7 @@
{
int col, ncols;
dbColumn *column;
- char *colname;
+ const char *colname;
int sqltype;
sqlite3_stmt *statement;
dbString sql;
Modified: grass/branches/develbranch_6/db/drivers/sqlite/db.c
===================================================================
--- grass/branches/develbranch_6/db/drivers/sqlite/db.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/db/drivers/sqlite/db.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -31,7 +31,8 @@
int db__driver_open_database (dbHandle *handle)
{
- char *name, name2[2000];
+ char name2[2000];
+ const char *name;
G_debug(3, "\ndb_driver_open_database()" );
Modified: grass/branches/develbranch_6/general/g.parser/main.c
===================================================================
--- grass/branches/develbranch_6/general/g.parser/main.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/general/g.parser/main.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -392,12 +392,13 @@
for (option = ctx.first_option; option; option = option->next_opt)
{
- char buff[1024];
+ char buff[1024], upper[1024];
sprintf(buff, "GIS_OPT_%s=%s", option->key, option->answer ? option->answer : "");
putenv(G_store(buff));
- G_str_to_upper(option->key);
- sprintf(buff, "GIS_OPT_%s=%s", option->key, option->answer ? option->answer : "");
+ G_strcpy(upper, option->key);
+ G_str_to_upper(upper);
+ sprintf(buff, "GIS_OPT_%s=%s", upper, option->answer ? option->answer : "");
G_debug ( 2, "set %s", buff );
putenv(G_store(buff));
Modified: grass/branches/develbranch_6/general/manage/cmd/copy.c
===================================================================
--- grass/branches/develbranch_6/general/manage/cmd/copy.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/general/manage/cmd/copy.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -45,16 +45,17 @@
for (n = 0; n < nlist; n++)
{
+ char *str;
p = parm[n] = G_define_option();
p->key = list[n].alias;
p->key_desc="from,to";
p->type = TYPE_STRING;
p->required = NO;
p->multiple = NO;
- p->gisprompt = G_malloc (64);
- sprintf (p->gisprompt, "old,%s,%s", list[n].mainelem, list[n].maindesc);
- p->description = G_malloc (64);
- sprintf (p->description, _("%s file(s) to be copied"), list[n].alias);
+ G_asprintf (&str, "old,%s,%s", list[n].mainelem, list[n].maindesc);
+ p->gisprompt = str;
+ G_asprintf (&str, _("%s file(s) to be copied"), list[n].alias);
+ p->description = str;
}
if (G_parser(argc, argv))
Modified: grass/branches/develbranch_6/general/manage/cmd/list.c
===================================================================
--- grass/branches/develbranch_6/general/manage/cmd/list.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/general/manage/cmd/list.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -33,6 +33,7 @@
struct GModule *module;
struct Option *mapset;
struct Flag *full;
+ char *str;
init (argv[0]);
@@ -51,18 +52,19 @@
element->description = "Data type";
for (len=0,n=0 ; n < nlist; n++)
len += strlen (list[n].alias)+1;
- element->options = G_malloc(len);
+ str = G_malloc(len);
for (n=0; n < nlist; n++)
{
if (n)
{
- G_strcat (element->options, ",");
- G_strcat (element->options, list[n].alias);
+ G_strcat (str, ",");
+ G_strcat (str, list[n].alias);
}
else
- G_strcpy (element->options, list[n].alias);
+ G_strcpy (str, list[n].alias);
}
+ element->options = str;
mapset = G_define_option();
mapset->key = "mapset";
Modified: grass/branches/develbranch_6/general/manage/cmd/remove.c
===================================================================
--- grass/branches/develbranch_6/general/manage/cmd/remove.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/general/manage/cmd/remove.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -120,15 +120,16 @@
for (n = 0; n < nlist; n++)
{
+ char *str;
p = parm[n] = G_define_option();
p->key = list[n].alias;
p->type = TYPE_STRING;
p->required = NO;
p->multiple = YES;
- p->gisprompt = G_malloc (64);
- sprintf (p->gisprompt, "old,%s,%s", list[n].mainelem, list[n].maindesc);
- p->description = G_malloc (64);
- sprintf (p->description, _("%s file(s) to be removed"), list[n].alias);
+ G_asprintf (&str, "old,%s,%s", list[n].mainelem, list[n].maindesc);
+ p->gisprompt = str;
+ G_asprintf (&str, _("%s file(s) to be removed"), list[n].alias);
+ p->description = str;
}
if (G_parser(argc, argv))
Modified: grass/branches/develbranch_6/general/manage/cmd/rename.c
===================================================================
--- grass/branches/develbranch_6/general/manage/cmd/rename.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/general/manage/cmd/rename.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -45,16 +45,17 @@
for (n = 0; n < nlist; n++)
{
+ char *str;
p = parm[n] = G_define_option();
p->key = list[n].alias;
p->key_desc="old,new";
p->type = TYPE_STRING;
p->required = NO;
p->multiple = NO;
- p->gisprompt = G_malloc (64);
- sprintf (p->gisprompt, "old,%s,%s", list[n].mainelem, list[n].maindesc);
- p->description = G_malloc (64);
- sprintf (p->description, _("%s file(s) to be renamed"), list[n].alias);
+ G_asprintf (&str, "old,%s,%s", list[n].mainelem, list[n].maindesc);
+ p->gisprompt = str;
+ G_asprintf (&str, _("%s file(s) to be renamed"), list[n].alias);
+ p->description = str;
}
if (G_parser(argc, argv))
Modified: grass/branches/develbranch_6/include/proto_dbmi.h
===================================================================
--- grass/branches/develbranch_6/include/proto_dbmi.h 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/include/proto_dbmi.h 2008-07-03 08:18:42 UTC (rev 31977)
@@ -13,7 +13,7 @@
int db_alloc_index_columns (dbIndex *index , int ncols );
dbString * db_alloc_string_array (int count );
dbTable * db_alloc_table (int ncols );
-int db_append_string (dbString *x , char *s );
+int db_append_string (dbString *x , const char *s );
void db_auto_print_errors (int flag );
void db_auto_print_protocol_errors (int flag );
int db_bind_update (dbCursor *cursor );
@@ -34,12 +34,12 @@
int db_close_cursor (dbCursor *cursor );
int db_close_database (dbDriver *driver );
int db_close_database_shutdown_driver (dbDriver *driver );
-int db_column_sqltype (dbDriver *driver, char *tab, char *col );
-int db_column_Ctype (dbDriver *driver, char *tab, char *col );
-int db_convert_Cstring_to_column_default_value (char *Cstring , dbColumn *column );
-int db_convert_Cstring_to_column_value (char *Cstring , dbColumn *column );
-int db_convert_Cstring_to_value (char *Cstring , int sqltype , dbValue *value );
-int db_convert_Cstring_to_value_datetime (char *buf , int sqltype , dbValue *value );
+int db_column_sqltype (dbDriver *driver, const char *tab, const char *col );
+int db_column_Ctype (dbDriver *driver, const char *tab, const char *col );
+int db_convert_Cstring_to_column_default_value (const char *Cstring , dbColumn *column );
+int db_convert_Cstring_to_column_value (const char *Cstring , dbColumn *column );
+int db_convert_Cstring_to_value (const char *Cstring , int sqltype , dbValue *value );
+int db_convert_Cstring_to_value_datetime (const char *buf , int sqltype , dbValue *value );
int db_convert_column_default_value_to_string (dbColumn *column , dbString *string );
int db_convert_column_value_to_string (dbColumn *column , dbString *string );
int db_convert_value_datetime_into_string (dbValue *value , int sqltype , dbString *string );
@@ -47,18 +47,18 @@
void db_copy_dbmscap_entry (dbDbmscap *dst , dbDbmscap *src );
int db_copy_string (dbString *dst , dbString *src );
int db_table_to_sql ( dbTable *, dbString *);
-int db_copy_table ( char *, char *, char *, char *, char *, char *);
-int db_copy_table_where ( char *, char *, char *, char *, char *, char *, char *);
-int db_copy_table_select ( char *, char *, char *, char *, char *, char *, char *);
-int db_copy_table_by_ints ( char *, char *, char *, char *, char *, char *, char *, int *, int);
+int db_copy_table ( const char *, const char *, const char *, const char *, const char *, const char *);
+int db_copy_table_where ( const char *, const char *, const char *, const char *, const char *, const char *, const char *);
+int db_copy_table_select ( const char *, const char *, const char *, const char *, const char *, const char *, const char *);
+int db_copy_table_by_ints ( const char *, const char *, const char *, const char *, const char *, const char *, const char *, int *, int);
void db_copy_value (dbValue *dst , dbValue *src );
int db_create_database (dbDriver *driver , dbHandle *handle );
int db_create_index (dbDriver *driver , dbIndex *index );
-int db_create_index2 (dbDriver *driver, char *table_name, char *column_name );
+int db_create_index2 (dbDriver *driver, const char *table_name, const char *column_name );
int db_create_table (dbDriver *driver , dbTable *table );
int db_d_add_column (void );
int db_d_bind_update (void );
-char * db_dbmscap_filename (void );
+const char *db_dbmscap_filename (void );
int db_d_close_cursor (void );
int db_d_close_database (void );
int db_d_create_database (void );
@@ -70,12 +70,12 @@
int db_d_drop_column (void );
int db_d_drop_index (void );
int db_d_drop_table (void );
-void db_debug (char *s );
+void db_debug (const char *s );
void db_debug_off (void );
void db_debug_on (void );
int db_delete (dbCursor *cursor );
int db_delete_database (dbDriver *driver , dbHandle *handle );
-int db_delete_table ( char *, char *, char *);
+int db_delete_table (const char *, const char *, const char *);
int db_describe_table (dbDriver *driver , dbString *name , dbTable **table );
int db_d_execute_immediate (void );
int db_d_begin_transaction (void );
@@ -85,7 +85,7 @@
int db_d_get_num_rows (void );
int db_d_grant_on_table (void );
int db_d_insert (void );
-dbDirent * db_dirent (char *dirname , int *n );
+dbDirent * db_dirent (const char *dirname , int *n );
int db_d_list_databases (void );
int db_d_list_indexes (void );
int db_d_list_tables (void );
@@ -96,7 +96,7 @@
void db_double_quote_string ( dbString *src );
int db_driver (int argc , char *argv []);
-int db_driver_mkdir (char *path , int mode , int parentdirs );
+int db_driver_mkdir (const char *path , int mode , int parentdirs );
int db_drop_column (dbDriver *driver , dbString *tableName , dbString *columnName );
void db__drop_cursor_from_driver_state (dbCursor *cursor );
int db_drop_index (dbDriver *driver , dbString *name );
@@ -105,7 +105,7 @@
int db_d_update (void );
int db_d_version (void );
int db_enlarge_string (dbString *x , int len );
-void db_error (char *s );
+void db_error (const char *s );
int db_execute_immediate (dbDriver *driver , dbString *SQLstatement );
int db_begin_transaction (dbDriver *driver);
int db_commit_transaction (dbDriver *driver);
@@ -124,12 +124,12 @@
void db_free_string (dbString *x );
void db_free_string_array (dbString *a , int n );
void db_free_table (dbTable *table );
-int db_get_column ( dbDriver *Driver, char *tname, char *cname, dbColumn **Column );
+int db_get_column ( dbDriver *Driver, const char *tname, const char *cname, dbColumn **Column );
dbValue * db_get_column_default_value (dbColumn *column );
-char * db_get_column_description (dbColumn *column );
+const char *db_get_column_description (dbColumn *column );
int db_get_column_host_type (dbColumn *column );
int db_get_column_length (dbColumn *column );
-char * db_get_column_name (dbColumn *column );
+const char *db_get_column_name (dbColumn *column );
int db_get_column_precision (dbColumn *column );
int db_get_column_scale (dbColumn *column );
int db_get_column_select_priv (dbColumn *column );
@@ -140,27 +140,27 @@
int db_get_cursor_number_of_columns (dbCursor *cursor );
dbTable * db_get_cursor_table (dbCursor *cursor );
dbToken db_get_cursor_token (dbCursor *cursor );
-char * db_get_default_driver_name ( void );
-char * db_get_default_database_name ( void );
-char * db_get_default_schema_name ( void );
-char * db_get_default_group_name ( void );
+const char *db_get_default_driver_name ( void );
+const char *db_get_default_database_name ( void );
+const char *db_get_default_schema_name ( void );
+const char *db_get_default_group_name ( void );
dbDriverState * db__get_driver_state (void );
int db_get_error_code (void );
-char * db_get_error_msg (void );
-char * db_get_error_who (void );
-char * db_get_handle_dbname (dbHandle *handle );
-char * db_get_handle_dbschema (dbHandle *handle );
-char * db_get_index_column_name (dbIndex *index , int column_num );
-char * db_get_index_name (dbIndex *index );
+const char *db_get_error_msg (void );
+const char *db_get_error_who (void );
+const char *db_get_handle_dbname (dbHandle *handle );
+const char *db_get_handle_dbschema (dbHandle *handle );
+const char *db_get_index_column_name (dbIndex *index , int column_num );
+const char *db_get_index_name (dbIndex *index );
int db_get_index_number_of_columns (dbIndex *index );
-char * db_get_index_table_name (dbIndex *index );
+const char *db_get_index_table_name (dbIndex *index );
int db_get_num_rows (dbCursor *cursor );
char * db_get_string (dbString *x );
dbColumn * db_get_table_column (dbTable *table , int n );
int db_get_table_delete_priv (dbTable *table );
-char * db_get_table_description (dbTable *table );
+const char *db_get_table_description (dbTable *table );
int db_get_table_insert_priv (dbTable *table );
-char * db_get_table_name (dbTable *table );
+const char *db_get_table_name (dbTable *table );
int db_get_table_number_of_columns (dbTable *table );
int db_get_table_number_of_rows (dbDriver *driver, dbString *sql);
int db_get_table_select_priv (dbTable *table );
@@ -173,9 +173,9 @@
int db_get_value_minute (dbValue *value );
int db_get_value_month (dbValue *value );
double db_get_value_seconds (dbValue *value );
-char * db_get_value_string (dbValue *value );
+const char *db_get_value_string (dbValue *value );
int db_get_value_year (dbValue *value );
-int db_grant_on_table (dbDriver *driver , char *tableName, int priv, int to );
+int db_grant_on_table (dbDriver *driver , const char *tableName, int priv, int to );
int db_has_dbms (void );
void db_init_column (dbColumn *column );
void db_init_cursor (dbCursor *cursor );
@@ -186,18 +186,18 @@
void db_init_table (dbTable *table );
int db_insert (dbCursor *cursor );
void db_interval_range (int sqltype , int *from , int *to );
-int db_isdir (char *path );
-int db_legal_tablename (char *s );
+int db_isdir (const char *path );
+int db_legal_tablename (const char *s );
int db_list_databases (dbDriver *driver , dbString *path , int npaths , dbHandle **handles , int *count );
-char * db_list_drivers (void );
+const char *db_list_drivers (void );
int db_list_indexes (dbDriver *driver , dbString *table_name , dbIndex **list , int *count );
int db_list_tables (dbDriver *driver , dbString **names , int *count , int system );
void * db_malloc (int n );
void db__mark_database_closed (void );
-void db__mark_database_open (char *dbname , char *dbpath );
+void db__mark_database_open (const char *dbname , const char *dbpath );
void db_memory_error (void );
dbToken db_new_token (dbAddress address );
-int db_nocase_compare (char *a , char *b );
+int db_nocase_compare (const char *a , const char *b );
void db_noproc_error (int procnum );
int db_open_database (dbDriver *driver , dbHandle *handle );
int db_open_insert_cursor (dbDriver *driver , dbCursor *cursor );
@@ -207,7 +207,7 @@
void db_print_error (void );
void db_print_index (FILE *fd , dbIndex *index );
void db_print_table_definition (FILE *fd , dbTable *table );
-void db_procedure_not_implemented (char *name );
+void db_procedure_not_implemented (const char *name );
void db_protocol_error (void );
dbDbmscap * db_read_dbmscap (void );
void * db_realloc (void *s , int n );
@@ -235,7 +235,7 @@
int db__recv_table_definition (dbTable **table );
int db__recv_token (dbToken *token );
int db__recv_value (dbValue *value , int Ctype );
-int db__send_Cstring (char *s );
+int db__send_Cstring (const char *s );
int db__send_char (int d );
int db__send_column_default_value (dbColumn *column );
int db__send_column_definition (dbColumn *column );
@@ -262,16 +262,16 @@
int db__send_table_definition (dbTable *table );
int db__send_token (dbToken *token );
int db__send_value (dbValue *value , int Ctype );
-int db_select_CatValArray ( dbDriver *driver, char *tab, char *key, char *col, char *where,
+int db_select_CatValArray ( dbDriver *driver, const char *tab, const char *key, const char *col, const char *where,
dbCatValArray *Cvarr );
-int db_select_int (dbDriver *driver, char *table, char *column, char *where, int **pval);
-int db_select_value (dbDriver *driver, char *table, char *key, int id, char *column, dbValue *value);
-int db_set_column_description (dbColumn *column , char *description );
+int db_select_int (dbDriver *driver, const char *table, const char *column, const char *where, int **pval);
+int db_select_value (dbDriver *driver, const char *table, const char *key, int id, const char *column, dbValue *value);
+int db_set_column_description (dbColumn *column , const char *description );
void db_set_column_has_defined_default_value (dbColumn *column );
void db_set_column_has_undefined_default_value (dbColumn *column );
void db_set_column_host_type (dbColumn *column , int type );
void db_set_column_length (dbColumn *column , int length );
-int db_set_column_name (dbColumn *column , char *name );
+int db_set_column_name (dbColumn *column , const char *name );
void db_set_column_null_allowed (dbColumn *column );
void db_set_column_precision (dbColumn *column , int precision );
void db_set_column_scale (dbColumn *column , int scale );
@@ -293,22 +293,22 @@
void db_set_cursor_type_readonly (dbCursor *cursor );
void db_set_cursor_type_update (dbCursor *cursor );
int db_set_default_connection (void);
-void db_set_error_who (char *me );
-int db_set_handle (dbHandle *handle , char *dbName , char *dbPath );
-int db_set_index_column_name (dbIndex *index , int column_num , char *name );
-int db_set_index_name (dbIndex *index , char *name );
-int db_set_index_table_name (dbIndex *index , char *name );
+void db_set_error_who (const char *me );
+int db_set_handle (dbHandle *handle , const char *dbName , const char *dbPath );
+int db_set_index_column_name (dbIndex *index , int column_num , const char *name );
+int db_set_index_name (dbIndex *index , const char *name );
+int db_set_index_table_name (dbIndex *index , const char *name );
int db_set_index_type_non_unique (dbIndex *index );
int db_set_index_type_unique (dbIndex *index );
void db__set_protocol_fds (FILE *send , FILE *recv );
-int db_set_string (dbString *x , char *s );
+int db_set_string (dbString *x , const char *s );
int db_set_string_no_copy (dbString *x , char *s );
void db_set_table_delete_priv_granted (dbTable *table );
void db_set_table_delete_priv_not_granted (dbTable *table );
-int db_set_table_description (dbTable *table , char *description );
+int db_set_table_description (dbTable *table , const char *description );
void db_set_table_insert_priv_granted (dbTable *table );
void db_set_table_insert_priv_not_granted (dbTable *table );
-int db_set_table_name (dbTable *table , char *name );
+int db_set_table_name (dbTable *table , const char *name );
void db_set_table_select_priv_granted (dbTable *table );
void db_set_table_select_priv_not_granted (dbTable *table );
void db_set_table_update_priv_granted (dbTable *table );
@@ -324,18 +324,18 @@
void db_set_value_not_null (dbValue *value );
void db_set_value_null (dbValue *value );
void db_set_value_seconds (dbValue *value , double seconds );
-int db_set_value_string (dbValue *value , char *s );
+int db_set_value_string (dbValue *value , const char *s );
void db_set_value_year (dbValue *value , int year );
int db_shutdown_driver (dbDriver *driver );
-char * db_sqltype_name (int sqltype );
+const char *db_sqltype_name (int sqltype );
int db_sqltype_to_Ctype (int sqltype );
-dbDriver * db_start_driver (char *name );
-dbDriver * db_start_driver_open_database (char *drvname, char *dbname );
+dbDriver * db_start_driver (const char *name );
+dbDriver * db_start_driver_open_database (const char *drvname, const char *dbname );
int db__start_procedure_call (int procnum );
-char * db_store (char *s );
+char * db_store (const char *s );
void db_strip (char *buf );
-void db_syserror (char *s );
-int db_table_exists (char* drvname, char *dbname, char *tabname);
+void db_syserror (const char *s );
+int db_table_exists (const char * drvname, const char *dbname, const char *tabname);
int db_test_column_has_default_value (dbColumn *column );
int db_test_column_has_defined_default_value (dbColumn *column );
int db_test_column_has_undefined_default_value (dbColumn *column );
@@ -364,11 +364,11 @@
void db_unset_cursor_mode_scroll (dbCursor *cursor );
int db_update (dbCursor *cursor );
int db_gversion (dbDriver *driver , dbString *client_version , dbString *driver_version );
-char * db_whoami (void );
+const char *db_whoami (void );
void db_zero (void *s , int n );
void db_zero_string (dbString *x );
unsigned int db_sizeof_string (dbString *x );
-int db_set_login ( char *, char *, char *, char * );
-int db_get_login ( char *, char *, char **, char ** );
+int db_set_login ( const char *, const char *, const char *, const char * );
+int db_get_login ( const char *, const char *, const char **, const char ** );
#endif
Modified: grass/branches/develbranch_6/lib/cairodriver/read_bmp.c
===================================================================
--- grass/branches/develbranch_6/lib/cairodriver/read_bmp.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/cairodriver/read_bmp.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -66,7 +66,6 @@
{
char header[HEADER_SIZE];
FILE *input;
- int x, y;
input = fopen(file_name, "rb");
if (!input)
Modified: grass/branches/develbranch_6/lib/cairodriver/write_bmp.c
===================================================================
--- grass/branches/develbranch_6/lib/cairodriver/write_bmp.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/cairodriver/write_bmp.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -48,7 +48,6 @@
{
char header[HEADER_SIZE];
FILE *output;
- int x, y;
output = fopen(file_name, "wb");
if (!output)
Modified: grass/branches/develbranch_6/lib/db/dbmi_base/alloc.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_base/alloc.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_base/alloc.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -9,7 +9,7 @@
\param
*/
char *
-db_store (char *s)
+db_store (const char *s)
{
char *a;
Modified: grass/branches/develbranch_6/lib/db/dbmi_base/case.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_base/case.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_base/case.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -59,7 +59,7 @@
\param
*/
int
-db_nocase_compare (char *a, char *b)
+db_nocase_compare (const char *a, const char *b)
{
char s, t;
Modified: grass/branches/develbranch_6/lib/db/dbmi_base/column.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_base/column.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_base/column.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -387,7 +387,7 @@
\param
*/
int
-db_set_column_name (dbColumn *column, char *name)
+db_set_column_name (dbColumn *column, const char *name)
{
return db_set_string (&column->columnName, name);
@@ -398,7 +398,7 @@
\return
\param
*/
-char *
+const char *
db_get_column_name (dbColumn *column)
{
@@ -411,7 +411,7 @@
\param
*/
int
-db_set_column_description (dbColumn *column, char *description)
+db_set_column_description (dbColumn *column, const char *description)
{
return db_set_string (&column->description, description);
@@ -422,7 +422,7 @@
\return
\param
*/
-char *
+const char *
db_get_column_description (dbColumn *column)
{
Modified: grass/branches/develbranch_6/lib/db/dbmi_base/columnfmt.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_base/columnfmt.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_base/columnfmt.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -7,7 +7,7 @@
\param
*/
int
-db_convert_Cstring_to_column_value (char *Cstring, dbColumn *column)
+db_convert_Cstring_to_column_value (const char *Cstring, dbColumn *column)
{
dbValue *value;
@@ -25,7 +25,7 @@
\param
*/
int
-db_convert_Cstring_to_column_default_value (char *Cstring, dbColumn *column)
+db_convert_Cstring_to_column_default_value (const char *Cstring, dbColumn *column)
{
dbValue *value;
Modified: grass/branches/develbranch_6/lib/db/dbmi_base/datetime.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_base/datetime.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_base/datetime.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -184,7 +184,7 @@
* otherwise the to and from markings in sqltype are used.
* where "*" represents any non-whitespace character
*/
-int db_convert_Cstring_to_value_datetime (char *buf, int sqltype, dbValue *value)
+int db_convert_Cstring_to_value_datetime (const char *buf, int sqltype, dbValue *value)
{
int from, to;
int year, month, day, hour, minute;
Modified: grass/branches/develbranch_6/lib/db/dbmi_base/dbmscap.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_base/dbmscap.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_base/dbmscap.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -44,8 +44,8 @@
\return
\param
*/
-char *
-db_dbmscap_filename()
+const char *
+db_dbmscap_filename(void)
{
return dbmscap_filename(1);
}
@@ -57,7 +57,7 @@
\param
*/
int
-db_has_dbms()
+db_has_dbms(void)
{
return (dbmscap_filename(0) != NULL);
}
@@ -91,7 +91,7 @@
* for available dbmi drivers in $(GISBASE)/driver/db/ */
dbDbmscap *
-db_read_dbmscap()
+db_read_dbmscap(void)
{
/*
FILE *fd;
@@ -108,29 +108,30 @@
dbDbmscap *list = NULL;
/* START OF OLD CODE FOR dbmscap FILE - NOT USED, BUT KEEP IT FOR FUTURE */
+#if 0
/* get the full name of the dbmscap file */
- /*
+
file = db_dbmscap_filename();
if (file == NULL)
return (dbDbmscap *) NULL;
- */
+
/* open the dbmscap file */
- /*
+
fd = fopen (file, "r");
if (fd == NULL)
{
db_syserror (file);
return (dbDbmscap *) NULL;
}
- */
+
/* find all valid entries
* blank lines and lines with # as first non blank char are ignored
* format is:
* driver name:startup command:comment
*/
- /*
+
for (line = 1; fgets (buf, sizeof buf, fd); line++)
{
if (sscanf (buf, "%1s", comment) != 1 || *comment == '#')
@@ -148,7 +149,7 @@
break;
}
fclose (fd);
- */
+#endif
/* END OF OLD CODE FOR dbmscap FILE */
/* START OF NEW CODE FOR SEARCH IN $(GISBASE)/driver/db/ */
Modified: grass/branches/develbranch_6/lib/db/dbmi_base/default_name.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_base/default_name.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_base/default_name.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -4,14 +4,14 @@
#include <grass/dbmi.h>
/*!
- \fn char * db_get_default_driver_name ( void )
+ \fn const char * db_get_default_driver_name ( void )
\brief returns pointer to default driver name
\return returns pointer to default driver name or NULL if not set
*/
-char *
+const char *
db_get_default_driver_name ( void )
{
- char *drv;
+ const char *drv;
if ( (drv = G__getenv2("DB_DRIVER", G_VAR_MAPSET)) )
return G_store(drv);
@@ -20,14 +20,14 @@
}
/*!
- \fn char * db_get_default_database_name ( void )
+ \fn const char * db_get_default_database_name ( void )
\brief returns pointer to default database name
\return returns pointer to default database name or NULL if not set
*/
-char *
+const char *
db_get_default_database_name ( void )
{
- char *drv;
+ const char *drv;
if ( (drv = G__getenv2("DB_DATABASE", G_VAR_MAPSET)) )
return G_store(drv);
@@ -36,14 +36,14 @@
}
/*!
- \fn char * db_get_default_schema_name ( void )
+ \fn const char * db_get_default_schema_name ( void )
\brief returns pointer to default schema name
\return returns pointer to default schema name or NULL if not set
*/
-char *
+const char *
db_get_default_schema_name ( void )
{
- char *sch;
+ const char *sch;
if ( ( sch = G__getenv2("DB_SCHEMA", G_VAR_MAPSET) ) )
return G_store(sch);
@@ -52,14 +52,14 @@
}
/*!
- \fn char * db_get_default_group_name ( void )
+ \fn const char * db_get_default_group_name ( void )
\brief returns pointer to default group name
\return returns pointer to default group name or NULL if not set
*/
-char *
+const char *
db_get_default_group_name ( void )
{
- char *gr;
+ const char *gr;
if ( ( gr = G__getenv2("DB_GROUP", G_VAR_MAPSET) ) )
return G_store(gr);
@@ -70,7 +70,7 @@
/*!
- \fn char * db_set_default_connection(void)
+ \fn int db_set_default_connection(void)
\brief sets up database connection settings using GRASS default from dbmi.h
\return returns DB_OK (TODO: DB_OK on success, DB_* error code on fail)
*/
Modified: grass/branches/develbranch_6/lib/db/dbmi_base/dirent.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_base/dirent.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_base/dirent.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -32,7 +32,7 @@
/* read directory and build an array of dbDirent's */
/* append one entry with name = NULL to mark end of array */
dbDirent *
-db_dirent (char *dirname, int *n)
+db_dirent (const char *dirname, int *n)
{
DIR *dp;
Modified: grass/branches/develbranch_6/lib/db/dbmi_base/error.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_base/error.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_base/error.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -9,7 +9,7 @@
static char *err_msg = 0;
static int auto_print_errors = 1;
static int auto_print_protocol_errors = 1;
-static void (*user_print_function)();
+static void (*user_print_function)(const char *);
static char *who = NULL;
@@ -20,7 +20,7 @@
\param
*/
void
-db_on_error (void (*f)())
+db_on_error (void (*f)(const char *))
{
user_print_function = f;
@@ -33,7 +33,7 @@
\param
*/
void
-db_set_error_who (char *me)
+db_set_error_who (const char *me)
{
if (who) free(who);
@@ -46,8 +46,8 @@
\return
\param
*/
-char *
-db_get_error_who()
+const char *
+db_get_error_who(void)
{
return who?who:"";
}
@@ -59,7 +59,7 @@
\param
*/
void
-db_error (char *s)
+db_error (const char *s)
{
if (s == NULL)
@@ -80,7 +80,7 @@
\param
*/
void
-db_protocol_error()
+db_protocol_error(void)
{
int flag;
@@ -98,7 +98,7 @@
\param
*/
void
-db_syserror (char *s)
+db_syserror (const char *s)
{
char lead[1024];
@@ -125,7 +125,7 @@
\param
*/
int
-db_get_error_code()
+db_get_error_code(void)
{
return err_flag ? err_code : DB_OK;
}
@@ -137,7 +137,7 @@
\param
*/
void
-db_memory_error()
+db_memory_error(void)
{
db_error ("dbmi: Out of Memory");
err_code = DB_MEMORY_ERR;
@@ -150,7 +150,7 @@
\param
*/
void
-db_procedure_not_implemented (char *name)
+db_procedure_not_implemented (const char *name)
{
char msg[128];
@@ -183,7 +183,7 @@
\param
*/
void
-db_clear_error()
+db_clear_error(void)
{
err_flag = 0;
err_code = DB_OK;
@@ -197,7 +197,7 @@
\param
*/
void
-db_print_error()
+db_print_error(void)
{
char lead[1024];
@@ -226,7 +226,7 @@
\param
*/
void
-db_debug_on()
+db_debug_on(void)
{
debug_on = 1;
}
@@ -238,7 +238,7 @@
\param
*/
void
-db_debug_off()
+db_debug_off(void)
{
debug_on = 0;
}
@@ -250,7 +250,7 @@
\param
*/
void
-db_debug (char *s)
+db_debug (const char *s)
{
if (debug_on)
@@ -263,10 +263,10 @@
\return
\param
*/
-char *
-db_get_error_msg()
+const char *
+db_get_error_msg(void)
{
- return err_flag ? err_msg : (char *)NULL;
+ return err_flag ? err_msg : (const char *)NULL;
}
/*!
@@ -276,7 +276,7 @@
\param flag
*/
void
-db_auto_print_errors (flag)
+db_auto_print_errors (int flag)
{
auto_print_errors = flag;
auto_print_protocol_errors = flag;
@@ -289,7 +289,7 @@
\param
*/
void
-db_auto_print_protocol_errors (flag)
+db_auto_print_protocol_errors (int flag)
{
auto_print_protocol_errors = flag;
}
Modified: grass/branches/develbranch_6/lib/db/dbmi_base/handle.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_base/handle.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_base/handle.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -22,7 +22,7 @@
\param
*/
int
-db_set_handle (dbHandle *handle, char *dbName, char *dbSchema)
+db_set_handle (dbHandle *handle, const char *dbName, const char *dbSchema)
{
int stat;
@@ -40,7 +40,7 @@
\return
\param
*/
-char *
+const char *
db_get_handle_dbname (dbHandle *handle)
{
@@ -53,7 +53,7 @@
\return
\param
*/
-char *
+const char *
db_get_handle_dbschema (dbHandle *handle)
{
Modified: grass/branches/develbranch_6/lib/db/dbmi_base/index.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_base/index.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_base/index.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -103,7 +103,7 @@
\param
*/
int
-db_set_index_name (dbIndex *index, char *name)
+db_set_index_name (dbIndex *index, const char *name)
{
return db_set_string (&index->indexName, name);
@@ -115,7 +115,7 @@
\return
\param
*/
-char *
+const char *
db_get_index_name (dbIndex *index)
{
@@ -129,7 +129,7 @@
\param
*/
int
-db_set_index_table_name (dbIndex *index, char *name)
+db_set_index_table_name (dbIndex *index, const char *name)
{
return db_set_string (&index->tableName, name);
@@ -141,7 +141,7 @@
\return
\param
*/
-char *
+const char *
db_get_index_table_name (dbIndex *index)
{
@@ -168,7 +168,7 @@
\param
*/
int
-db_set_index_column_name (dbIndex *index, int column_num, char *name)
+db_set_index_column_name (dbIndex *index, int column_num, const char *name)
{
if (column_num < 0 || column_num >= index->numColumns)
@@ -185,14 +185,14 @@
\return
\param
*/
-char *
+const char *
db_get_index_column_name (dbIndex *index, int column_num)
{
if (column_num < 0 || column_num >= index->numColumns)
{
db_error ("db_get_index_column_name(): invalid column number");
- return ( (char *) NULL);
+ return ( (const char *) NULL);
}
return db_get_string (&index->columnNames[column_num]);
}
Modified: grass/branches/develbranch_6/lib/db/dbmi_base/isdir.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_base/isdir.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_base/isdir.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -10,7 +10,7 @@
\param
*/
int
-db_isdir (char *path)
+db_isdir (const char *path)
{
struct stat x;
Modified: grass/branches/develbranch_6/lib/db/dbmi_base/legal_dbname.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_base/legal_dbname.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_base/legal_dbname.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -14,7 +14,7 @@
\param name table name to be checked
*/
-int db_legal_tablename (char *s)
+int db_legal_tablename (const char *s)
{
char buf[GNAME_MAX];
Modified: grass/branches/develbranch_6/lib/db/dbmi_base/login.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_base/login.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_base/login.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -19,7 +19,7 @@
DATA *data;
} LOGIN;
-static char *
+static const char *
login_filename( void )
{
static char *file;
@@ -41,7 +41,7 @@
}
void
-add_login ( LOGIN *login, char *dr, char *db, char *usr, char *pwd )
+add_login ( LOGIN *login, const char *dr, const char *db, const char *usr, const char *pwd )
{
if ( login->n == login->a ) {
login->a += 10;
@@ -64,7 +64,7 @@
read_file ( LOGIN *login )
{
int ret;
- char *file;
+ const char *file;
struct stat info;
FILE *fd;
char buf[2001], dr[500], db[500], usr[500], pwd[500];
@@ -113,7 +113,7 @@
write_file ( LOGIN *login )
{
int i;
- char *file;
+ const char *file;
FILE *fd;
file = login_filename();
@@ -150,7 +150,7 @@
\return DB_FAILED
*/
int
-db_set_login ( char *driver, char *database, char *user, char *password )
+db_set_login ( const char *driver, const char *database, const char *user, const char *password )
{
int i, found;
LOGIN login;
@@ -196,7 +196,7 @@
\return DB_FAILED
*/
int
-db_get_login ( char *driver, char *database, char **user, char **password )
+db_get_login ( const char *driver, const char *database, const char **user, const char **password )
{
int i;
LOGIN login;
Modified: grass/branches/develbranch_6/lib/db/dbmi_base/sqltype.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_base/sqltype.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_base/sqltype.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -6,7 +6,7 @@
\return
\param
*/
-char *
+const char *
db_sqltype_name (int sqltype)
{
Modified: grass/branches/develbranch_6/lib/db/dbmi_base/string.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_base/string.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_base/string.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -30,13 +30,13 @@
* else 'x' is made to point to 's'
* returns DB_OK or DB_MEMORY_ERR
*/
-static int set_string();
+static int set_string(dbString *x, char *s, int copy);
int
-db_set_string (dbString *x, char *s)
+db_set_string (dbString *x, const char *s)
{
- return set_string (x, s, 1);
+ return set_string (x, (char *) s, 1);
}
/*!
@@ -217,7 +217,7 @@
\param
*/
int
-db_append_string (dbString *x, char *s)
+db_append_string (dbString *x, const char *s)
{
int len;
Modified: grass/branches/develbranch_6/lib/db/dbmi_base/table.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_base/table.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_base/table.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -76,7 +76,7 @@
\param
*/
int
-db_set_table_name (dbTable *table, char *name)
+db_set_table_name (dbTable *table, const char *name)
{
return db_set_string (&table->tableName, name);
@@ -88,7 +88,7 @@
\return
\param
*/
-char *
+const char *
db_get_table_name (dbTable *table)
{
@@ -102,7 +102,7 @@
\param
*/
int
-db_set_table_description (dbTable *table, char *description)
+db_set_table_description (dbTable *table, const char *description)
{
return db_set_string (&table->description, description);
@@ -114,7 +114,7 @@
\return
\param
*/
-char *
+const char *
db_get_table_description (dbTable *table)
{
@@ -345,7 +345,7 @@
{
int col, ncols;
dbColumn *column;
- char *colname;
+ const char *colname;
int sqltype, ctype;
char buf[500];
Modified: grass/branches/develbranch_6/lib/db/dbmi_base/value.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_base/value.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_base/value.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -76,7 +76,7 @@
\return
\param
*/
-char *
+const char *
db_get_value_string (dbValue *value)
{
@@ -222,7 +222,7 @@
\param
*/
int
-db_set_value_string (dbValue *value, char *s)
+db_set_value_string (dbValue *value, const char *s)
{
db_set_value_not_null(value);
Modified: grass/branches/develbranch_6/lib/db/dbmi_base/valuefmt.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_base/valuefmt.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_base/valuefmt.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -10,7 +10,7 @@
\param
*/
int
-db_convert_Cstring_to_value (char *Cstring, int sqltype, dbValue *value)
+db_convert_Cstring_to_value (const char *Cstring, int sqltype, dbValue *value)
{
int i;
@@ -50,9 +50,8 @@
{
char buf[64];
- char *bp;
+ const char *bp = buf;
- bp = buf;
if (db_test_value_isnull(value))
{
*buf = 0;
Modified: grass/branches/develbranch_6/lib/db/dbmi_base/xdrstring.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_base/xdrstring.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_base/xdrstring.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -112,12 +112,12 @@
}
int
-db__send_Cstring(char *s)
+db__send_Cstring(const char *s)
{
dbString x;
db_init_string (&x);
- db_set_string_no_copy (&x, s);
+ db_set_string_no_copy (&x, (char *) s);
return db__send_string (&x);
}
Modified: grass/branches/develbranch_6/lib/db/dbmi_client/c_create_idx.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_client/c_create_idx.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_client/c_create_idx.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -38,12 +38,12 @@
\param
*/
int
-db_create_index2 (dbDriver *driver, char *table_name, char *column_name)
+db_create_index2 (dbDriver *driver, const char *table_name, const char *column_name)
{
int ret;
dbIndex index;
char buf[1000];
- char *tbl;
+ const char *tbl;
db_init_index ( &index );
db_alloc_index_columns ( &index, 1 );
Modified: grass/branches/develbranch_6/lib/db/dbmi_client/c_list_drivers.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_client/c_list_drivers.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_client/c_list_drivers.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -6,7 +6,7 @@
\return return char
\param void
*/
-char *
+const char *
db_list_drivers(void)
{
dbDbmscap *list, *cur;
Modified: grass/branches/develbranch_6/lib/db/dbmi_client/c_priv.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_client/c_priv.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_client/c_priv.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -8,7 +8,7 @@
\param to grant to : DB_GROUP | DB_PUBLIC
*/
int
-db_grant_on_table ( dbDriver *driver, char *tableName, int priv, int to)
+db_grant_on_table ( dbDriver *driver, const char *tableName, int priv, int to)
{
int ret_code;
dbString name;
Modified: grass/branches/develbranch_6/lib/db/dbmi_client/column.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_client/column.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_client/column.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -22,7 +22,7 @@
#include <grass/glocale.h>
/*!
- \fn int db_column_sqltype (dbDriver *driver, char *tab, char *col)
+ \fn int db_column_sqltype (dbDriver *driver, const char *tab, const char *col)
\brief Get column sqltype
See db_sqltype_name ()
@@ -32,7 +32,7 @@
\param col column name
*/
int
-db_column_sqltype (dbDriver *driver, char *tab, char *col)
+db_column_sqltype (dbDriver *driver, const char *tab, const char *col)
{
dbTable *table;
dbString table_name;
@@ -59,7 +59,7 @@
}
/*!
- \fn int db_column_Ctype (dbDriver *driver, char *tab, char *col)
+ \fn int db_column_Ctype (dbDriver *driver, const char *tab, const char *col)
\brief Get column Ctype
See db_sqltype_to_Ctype()
@@ -69,7 +69,7 @@
\param col column name
*/
int
-db_column_Ctype (dbDriver *driver, char *tab, char *col)
+db_column_Ctype (dbDriver *driver, const char *tab, const char *col)
{
int type;
if ( ( type = db_column_sqltype ( driver, tab, col ) ) >= 0 ) {
@@ -81,7 +81,7 @@
}
/*!
- \fn int db_get_column ( dbDriver *Driver, char *tname, char *cname, dbColumn **Column )
+ \fn int db_get_column ( dbDriver *Driver, const char *tname, const char *cname, dbColumn **Column )
\brief Get column structure by table and column name.
Column is set to new dbColumn structure or NULL if column was not found
@@ -92,7 +92,7 @@
\param Column column structure to store within
*/
int
-db_get_column ( dbDriver *Driver, char *tname, char *cname, dbColumn **Column )
+db_get_column ( dbDriver *Driver, const char *tname, const char *cname, dbColumn **Column )
{
int i, ncols;
dbTable *Table;
Modified: grass/branches/develbranch_6/lib/db/dbmi_client/copy_tab.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_client/copy_tab.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_client/copy_tab.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -27,10 +27,10 @@
*/
/* Warning, driver opened as second must be closed as first, otherwise it hangs, not sure why */
int
-db__copy_table ( char *from_drvname, char *from_dbname, char *from_tblname,
- char *to_drvname, char *to_dbname, char *to_tblname,
- char *where, char *select,
- char *selcol, int *ivals, int nvals)
+db__copy_table ( const char *from_drvname, const char *from_dbname, const char *from_tblname,
+ const char *to_drvname, const char *to_dbname, const char *to_tblname,
+ const char *where, const char *select,
+ const char *selcol, int *ivals, int nvals)
{
int col, ncols, sqltype, ctype, more, selcol_found;
char buf[1000];
@@ -43,7 +43,7 @@
dbCursor cursor;
dbColumn *column;
dbValue *value;
- char *colname;
+ const char *colname;
dbDriver *from_driver, *to_driver;
int count, i;
@@ -121,7 +121,7 @@
}
for (i = 0; i < count; i++) {
- char *tblname = db_get_string(&tblnames[i]);
+ const char *tblname = db_get_string(&tblnames[i]);
if (strcmp(to_tblname, tblname) == 0) {
G_warning("Table '%s' already exists", to_dbname);
@@ -344,15 +344,15 @@
}
/*!
- \fn int db_copy_table (char *from_drvname, char *from_dbname, char *from_tblname,
- char *to_drvname, char *to_dbname, char *to_tblname )
+ \fn int db_copy_table (const char *from_drvname, const char *from_dbname, const char *from_tblname,
+ const char *to_drvname, const char *to_dbname, const char *to_tblname )
\brief Copy a table
\return
\param
*/
int
-db_copy_table ( char *from_drvname, char *from_dbname, char *from_tblname,
- char *to_drvname, char *to_dbname, char *to_tblname )
+db_copy_table ( const char *from_drvname, const char *from_dbname, const char *from_tblname,
+ const char *to_drvname, const char *to_dbname, const char *to_tblname )
{
return db__copy_table ( from_drvname, from_dbname, from_tblname,
to_drvname, to_dbname, to_tblname,
@@ -361,15 +361,15 @@
}
/*!
- \fn int db_copy_table_where (char *from_drvname, char *from_dbname, char *from_tblname,
- char *to_drvname, char *to_dbname, char *to_tblname, char *where )
+ \fn int db_copy_table_where (const char *from_drvname, const char *from_dbname, const char *from_tblname,
+ const char *to_drvname, const char *to_dbname, const char *to_tblname, const char *where )
\brief Copy a table
\return
\param where WHERE SQL condition (without where key word) or NULL
*/
int
-db_copy_table_where ( char *from_drvname, char *from_dbname, char *from_tblname,
- char *to_drvname, char *to_dbname, char *to_tblname, char *where )
+db_copy_table_where ( const char *from_drvname, const char *from_dbname, const char *from_tblname,
+ const char *to_drvname, const char *to_dbname, const char *to_tblname, const char *where )
{
return db__copy_table ( from_drvname, from_dbname, from_tblname,
to_drvname, to_dbname, to_tblname,
@@ -378,15 +378,15 @@
}
/*!
- \fn int db_copy_table_select ( char *from_drvname, char *from_dbname, char *from_tblname,
- char *to_drvname, char *to_dbname, char *to_tblname, char *select )
+ \fn int db_copy_table_select ( const char *from_drvname, const char *from_dbname, const char *from_tblname,
+ const char *to_drvname, const char *to_dbname, const char *to_tblname, const char *select )
\brief Copy a table
\return
\param select is full select statement or NULL
*/
int
-db_copy_table_select ( char *from_drvname, char *from_dbname, char *from_tblname,
- char *to_drvname, char *to_dbname, char *to_tblname, char *select )
+db_copy_table_select ( const char *from_drvname, const char *from_dbname, const char *from_tblname,
+ const char *to_drvname, const char *to_dbname, const char *to_tblname, const char *select )
{
return db__copy_table ( from_drvname, from_dbname, from_tblname,
to_drvname, to_dbname, to_tblname,
@@ -395,9 +395,9 @@
}
/*!
- \fn int db_copy_table_by_ints ( char *from_drvname, char *from_dbname, char *from_tblname,
- char *to_drvname, char *to_dbname, char *to_tblname,
- char *selcol, int *ivals, int nvals )
+ \fn int db_copy_table_by_ints ( const char *from_drvname, const char *from_dbname, const char *from_tblname,
+ const char *to_drvname, const char *to_dbname, const char *to_tblname,
+ const char *selcol, int *ivals, int nvals )
\brief Copy a table, but only records where value of column 'selcol'
is in 'ivals'
\return
@@ -406,9 +406,9 @@
\param nvals number of values in ivals
*/
int
-db_copy_table_by_ints ( char *from_drvname, char *from_dbname, char *from_tblname,
- char *to_drvname, char *to_dbname, char *to_tblname,
- char *selcol, int *ivals, int nvals )
+db_copy_table_by_ints ( const char *from_drvname, const char *from_dbname, const char *from_tblname,
+ const char *to_drvname, const char *to_dbname, const char *to_tblname,
+ const char *selcol, int *ivals, int nvals )
{
return db__copy_table ( from_drvname, from_dbname, from_tblname,
to_drvname, to_dbname, to_tblname,
Modified: grass/branches/develbranch_6/lib/db/dbmi_client/db.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_client/db.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_client/db.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -2,13 +2,13 @@
#include "macros.h"
/*!
- \fn dbDriver * db_start_driver_open_database ( char *drvname, char *dbname )
+ \fn dbDriver * db_start_driver_open_database ( const char *drvname, const char *dbname )
\brief
\return
\param
*/
dbDriver *
-db_start_driver_open_database ( char *drvname, char *dbname )
+db_start_driver_open_database ( const char *drvname, const char *dbname )
{
dbHandle handle;
dbDriver *driver;
Modified: grass/branches/develbranch_6/lib/db/dbmi_client/delete_tab.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_client/delete_tab.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_client/delete_tab.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -2,13 +2,13 @@
#include "macros.h"
/*!
- \fn int db_delete_table ( char *drvname, char *dbname, char *tblname )
+ \fn int db_delete_table ( const char *drvname, const char *dbname, const char *tblname )
\brief
\return
\param
*/
int
-db_delete_table ( char *drvname, char *dbname, char *tblname )
+db_delete_table ( const char *drvname, const char *dbname, const char *tblname )
{
dbDriver *driver;
dbHandle handle;
Modified: grass/branches/develbranch_6/lib/db/dbmi_client/select.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_client/select.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_client/select.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -60,11 +60,11 @@
dbCatVal * const *a = pa;
dbCatVal * const *b = pb;
- return strcmp( (char *) a, (char *) b );
+ return strcmp( (const char *) a, (const char *) b );
}
/*!
- \fn db_select_int (dbDriver *driver, char *tab, char *col, char *where, int **pval)
+ \fn db_select_int (dbDriver *driver, const char *tab, const char *col, const char *where, int **pval)
\brief Select array of ordered integers from table/column
\return number of selected values, -1 on error
\param driver DB driver
@@ -74,11 +74,12 @@
\param pval array of ordered integer values
*/
-int db_select_int (dbDriver *driver, char *tab, char *col, char *where, int **pval)
+int db_select_int (dbDriver *driver, const char *tab, const char *col, const char *where, int **pval)
{
int type, more, alloc, count;
int *val;
- char buf[1024], *sval;
+ char buf[1024];
+ const char *sval;
dbString stmt;
dbCursor cursor;
dbColumn *column;
@@ -154,7 +155,7 @@
}
/*!
- \fn db_select_value (dbDriver *driver, char *tab, char *key, int id, char *col, dbValue *val)
+ \fn db_select_value (dbDriver *driver, const char *tab, const char *key, int id, const char *col, dbValue *val)
\brief Select one (first) value from table/column for key/id
\return number of selected values, -1 on error
\param driver DB driver
@@ -164,7 +165,7 @@
\param col name of column to select the value from
\param val dbValue to store within
*/
-int db_select_value (dbDriver *driver, char *tab, char *key, int id, char *col, dbValue *val)
+int db_select_value (dbDriver *driver, const char *tab, const char *key, int id, const char *col, dbValue *val)
{
int more, count;
char buf[1024];
@@ -202,7 +203,7 @@
}
/*!
- \fn int db_select_CatValArray (dbDriver *driver, char *tab, char *key, char *col, char *where, dbCatValArray *cvarr)
+ \fn int db_select_CatValArray (dbDriver *driver, const char *tab, const char *key, const char *col, const char *where, dbCatValArray *cvarr)
\brief Select pairs key/value to array, values are sorted by key (must be integer)
\return number of selected values, -1 on error
\param driver DB driver
@@ -211,7 +212,7 @@
\param col value column name
\param cvarr dbCatValArray to store within
*/
-int db_select_CatValArray ( dbDriver *driver, char *tab, char *key, char *col, char *where,
+int db_select_CatValArray ( dbDriver *driver, const char *tab, const char *key, const char *col, const char *where,
dbCatValArray *cvarr )
{
int i, type, more, nrows;
Modified: grass/branches/develbranch_6/lib/db/dbmi_client/start.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_client/start.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_client/start.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -15,24 +15,24 @@
/**
- * \fn dbDriver *db_start_driver (char *name)
+ * \fn dbDriver *db_start_driver (const char *name)
*
* \brief Initialize a new dbDriver for db transaction.
*
* If <b>name</b> is NULL, the db name will be assigned
* connection.driverName.
*
- * \param[in] char * driver name
+ * \param[in] const char * driver name
* \return NULL on error
*/
dbDriver *
-db_start_driver (char *name)
+db_start_driver (const char *name)
{
dbDriver *driver;
dbDbmscap *list, *cur;
- char *startup;
+ const char *startup;
int p1[2], p2[2];
int pid;
int stat;
Modified: grass/branches/develbranch_6/lib/db/dbmi_client/table.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_client/table.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_client/table.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -4,7 +4,7 @@
#include <grass/dbmi.h>
/*!
- \fn int db_table_exists ( char *, char *, char *)
+ \fn int db_table_exists ( const char *, const char *, const char *)
\brief check if table exists
\param drvname: driver name
\param dbname: database name
@@ -13,7 +13,7 @@
\param
*/
int
-db_table_exists ( char *drvname, char *dbname, char *tabname)
+db_table_exists ( const char *drvname, const char *dbname, const char *tabname)
{
dbDriver *driver;
dbString *names;
Modified: grass/branches/develbranch_6/lib/db/dbmi_driver/d_mkdir.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_driver/d_mkdir.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_driver/d_mkdir.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -1,3 +1,4 @@
+#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
@@ -7,7 +8,7 @@
static char *rfind(char *string, char c);
static int make_parent_dir(char *path, int mode);
-static int make_dir(char *path, int mode);
+static int make_dir(const char *path, int mode);
/*!
@@ -17,11 +18,13 @@
\param
*/
int
-db_driver_mkdir (char *path, int mode, int parentdirs)
+db_driver_mkdir (const char *path, int mode, int parentdirs)
{
if (parentdirs)
{
- if (make_parent_dir (path, mode) != DB_OK)
+ char path2[GPATH_MAX];
+ strcpy(path2, path);
+ if (make_parent_dir (path2, mode) != DB_OK)
return DB_FAILED;
}
@@ -32,7 +35,7 @@
/* make a directory if it doesn't exist */
/* this routine could be made more intelligent as to why it failed */
static int
-make_dir (char *path, int mode)
+make_dir (const char *path, int mode)
{
if (db_isdir(path) == DB_OK)
return DB_OK;
Modified: grass/branches/develbranch_6/lib/db/dbmi_driver/driver_state.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_driver/driver_state.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/db/dbmi_driver/driver_state.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -28,10 +28,10 @@
void
-db__mark_database_open (char *dbname, char *dbschema)
+db__mark_database_open (const char *dbname, const char *dbschema)
{
- state.dbname = dbname;
- state.dbschema = dbschema;
+ state.dbname = db_store(dbname);
+ state.dbschema = db_store(dbschema);
state.open = 1;
}
Modified: grass/branches/develbranch_6/lib/form/generate.c
===================================================================
--- grass/branches/develbranch_6/lib/form/generate.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/form/generate.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -17,7 +17,8 @@
char **form)
{
int col, ncols, ctype, sqltype, more;
- char buf[5000], buf1[100], *colname;
+ char buf[5000], buf1[100];
+ const char *colname;
dbString sql, html, str;
dbDriver *driver;
dbHandle handle;
Modified: grass/branches/develbranch_6/lib/gis/parser.c
===================================================================
--- grass/branches/develbranch_6/lib/gis/parser.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/gis/parser.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -117,21 +117,21 @@
static struct Item first_item ;
static struct Item *current_item ;
static int n_items = 0 ;
-static int show_options(int ,char *);
+static int show_options(int ,const char *);
static int show(const char *,int);
static int set_flag (int);
-static int contains (char *,int);
+static int contains (const char *,int);
static int set_option( char *);
static int check_opts();
-static int check_an_opt( char *, int , char *,char *);
-static int check_int(char *, char *);
-static int check_double( char *, char *);
-static int check_string( char *, char *);
-static int check_required();
-static int split_opts();
-static int check_multiple_opts();
-static int check_overwrite();
-static int interactive( char *);
+static int check_an_opt(const char *, int , const char *,const char *);
+static int check_int(const char *, const char *);
+static int check_double(const char *, const char *);
+static int check_string(const char *, const char *);
+static int check_required(void);
+static int split_opts(void);
+static int check_multiple_opts(void);
+static int check_overwrite(void);
+static int interactive(const char *);
static int interactive_flag( struct Flag *);
static int interactive_option( struct Option *);
static int gis_prompt( struct Option *, char *);
@@ -762,7 +762,7 @@
i++;
}
- opt->opts = (char **)G_calloc( cnt+1, sizeof(char*) );
+ opt->opts = (const char **)G_calloc( cnt+1, sizeof(const char*) );
i = 0;
while ( tokens[i] ) {
@@ -774,7 +774,7 @@
if(opt->descriptions ) {
delm[0] = ';';
- opt->descs = (char **)G_calloc( cnt+1, sizeof(char*) );
+ opt->descs = (const char **)G_calloc( cnt+1, sizeof(const char*) );
tokens = G_tokenize ( opt->descriptions, delm );
i = 0;
@@ -1052,7 +1052,7 @@
struct Option *opt ;
struct Flag *flag ;
char item[256];
- char *key_desc;
+ const char *key_desc;
int maxlen;
int len, n;
int new_prompt = 0;
@@ -1227,7 +1227,7 @@
/**
- * \fn void print_escaped_for_xml (FILE * fp, char * str)
+ * \fn void print_escaped_for_xml (FILE * fp, const char * str)
*
* \brief Formats text for XML.
*
@@ -1235,7 +1235,7 @@
* \param[in] str string to write
*/
-static void print_escaped_for_xml (FILE * fp, char * str) {
+static void print_escaped_for_xml (FILE * fp, const char * str) {
for (;*str;str++) {
switch (*str) {
case '&':
@@ -1258,8 +1258,8 @@
* \brief Format text for HTML output
*/
#define do_escape(c,escaped) case c: fputs(escaped,f);break
-static void print_escaped_for_html( FILE *f, char *str ) {
- char *s;
+static void print_escaped_for_html( FILE *f, const char *str ) {
+ const char *s;
for(s=str;*s;s++) {
switch(*s) {
do_escape('&',"&");
@@ -1524,7 +1524,7 @@
{
struct Option *opt ;
struct Flag *flag ;
- char *type;
+ const char *type;
int new_prompt = 0;
new_prompt = uses_new_gisprompt();
@@ -1872,7 +1872,7 @@
static void generate_tcl(FILE *fp)
{
int new_prompt = uses_new_gisprompt();
- char *type;
+ const char *type;
int optn;
fprintf(fp, "begin_dialog {%s} {\n", pgm_name);
@@ -2059,7 +2059,7 @@
*
**************************************************************************/
-static int show_options(int maxlen,char *str)
+static int show_options(int maxlen, const char *str)
{
char *buff = G_store(str) ;
char *p1, *p2 ;
@@ -2138,7 +2138,7 @@
/* contents() is used to find things strings with characters like commas and
* dashes.
*/
-static int contains (char *s, int c)
+static int contains (const char *s, int c)
{
while(*s)
{
@@ -2250,7 +2250,7 @@
return(error) ;
}
-static int check_an_opt (char *key, int type, char *options, char *answer)
+static int check_an_opt (const char *key, int type, const char *options, const char *answer)
{
int error ;
@@ -2294,7 +2294,7 @@
return(error) ;
}
-static int check_int (char *ans, char *opts)
+static int check_int (const char *ans, const char *opts)
{
int d, lo, hi;
@@ -2362,7 +2362,7 @@
}
*/
-static int check_double (char *ans, char *opts)
+static int check_double (const char *ans, const char *opts)
{
double d, lo, hi;
@@ -2404,7 +2404,7 @@
}
}
-static int check_string (char *ans, char *opts)
+static int check_string (const char *ans, const char *opts)
{
if (*opts == '\0')
return(0) ;
@@ -2526,7 +2526,7 @@
static int check_multiple_opts (void)
{
struct Option *opt ;
- char *ptr ;
+ const char *ptr ;
int n_commas ;
int n ;
int error ;
@@ -2622,7 +2622,7 @@
return(error) ;
}
-static int interactive( char *command)
+static int interactive(const char *command)
{
struct Item *item ;
Modified: grass/branches/develbranch_6/lib/init/local_proto.h
===================================================================
--- grass/branches/develbranch_6/lib/init/local_proto.h 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/init/local_proto.h 2008-07-03 08:18:42 UTC (rev 31977)
@@ -3,18 +3,18 @@
/* clean_temp.c */
int find_process(int);
/* set_data.c */
-int list_locations(char *);
-int list_mapsets(char *, char *);
+int list_locations(const char *);
+int list_mapsets(const char *, const char *);
int first_word(char *);
int hit_return(void);
/* lock.c */
int find_process(int);
/* mke_loc.c */
-int make_location(char *, char *);
+int make_location(const char *, const char *);
/* mke_mapset.c */
-int make_mapset(char *, char *);
+int make_mapset(const char *, const char *);
/* other.c */
-int mapset_permissions(char *);
-int mapset_message(char *);
-int mapset_question(char *);
-int printfile(char *);
+int mapset_permissions(const char *);
+int mapset_message(const char *);
+int mapset_question(const char *);
+int printfile(const char *);
Modified: grass/branches/develbranch_6/lib/init/mke_loc.c
===================================================================
--- grass/branches/develbranch_6/lib/init/mke_loc.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/init/mke_loc.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -7,10 +7,10 @@
#include "local_proto.h"
int
-make_location (char *gisdbase, char *location_name)
+make_location (const char *gisdbase, const char *location_name)
{
struct Cell_head window;
- char buf[1024];
+ char buf[GPATH_MAX];
int i;
char myname[75];
char *mapset;
Modified: grass/branches/develbranch_6/lib/init/mke_mapset.c
===================================================================
--- grass/branches/develbranch_6/lib/init/mke_mapset.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/init/mke_mapset.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -10,9 +10,9 @@
#include <grass/gis.h>
-int make_mapset (char *location, char *mapset)
+int make_mapset (const char *location, const char *mapset)
{
- char buffer[2048] ;
+ char buffer[GPATH_MAX] ;
char *buffer2;
FILE *fd ;
struct Cell_head window;
Modified: grass/branches/develbranch_6/lib/init/other.c
===================================================================
--- grass/branches/develbranch_6/lib/init/other.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/init/other.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -6,14 +6,14 @@
#include <grass/gis.h>
#include "local_proto.h"
-static char *filename (char *name, char *mapset)
+static char *filename (const char *name, const char *mapset)
{
- static char path[1024];
+ static char path[GPATH_MAX];
G__file_name (path, "", name, mapset);
return path;
}
-int mapset_permissions (char *mapset)
+int mapset_permissions (const char *mapset)
{
int stat;
@@ -26,7 +26,7 @@
return stat;
}
-int mapset_message (char *mapset)
+int mapset_message (const char *mapset)
{
if(printfile(filename (".message", mapset)))
hit_return();
@@ -34,14 +34,14 @@
return 0;
}
-int mapset_question (char *mapset)
+int mapset_question (const char *mapset)
{
if(printfile(filename(".question", mapset)))
return G_yes("Select this mapset? ", -1);
return 1;
}
-int printfile (char *name)
+int printfile (const char *name)
{
int fd;
int n;
@@ -50,7 +50,7 @@
fd = open (name, 0);
if (fd < 0) return 0;
while ((n = read (fd, buf, sizeof buf)) > 0)
- write (1, buf, n);
+ write (STDOUT_FILENO, buf, n);
close (fd);
return 1;
}
Modified: grass/branches/develbranch_6/lib/init/set_data.c
===================================================================
--- grass/branches/develbranch_6/lib/init/set_data.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/init/set_data.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -272,7 +272,7 @@
}
int
-list_locations (char *gisdbase)
+list_locations (const char *gisdbase)
{
fprintf(stderr, "\nAvailable locations:\n") ;
fprintf(stderr, "----------------------\n") ;
@@ -282,9 +282,9 @@
}
int
-list_mapsets (char *location_name, char *location)
+list_mapsets (const char *location_name, const char *location)
{
- char **mapsets;
+ const char **mapsets;
int i, num_mapsets;
int any, ok, any_ok;
int len, tot_len;
@@ -328,7 +328,7 @@
int
first_word (char *buf)
{
- char temp[80];
+ char temp[GNAME_MAX];
*temp = 0;
sscanf (buf, "%s", temp);
Modified: grass/branches/develbranch_6/lib/sites/sites.c
===================================================================
--- grass/branches/develbranch_6/lib/sites/sites.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/lib/sites/sites.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -1236,7 +1236,7 @@
struct field_info *fi;
int nrows, row, ncols, col, ndbl, nstr, ctype;
- char * name;
+ const char * name;
dbDriver *driver;
dbString stmt;
dbCursor cursor;
Modified: grass/branches/develbranch_6/raster/r.colors/main.c
===================================================================
--- grass/branches/develbranch_6/raster/r.colors/main.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/raster/r.colors/main.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -29,7 +29,7 @@
#include <grass/glocale.h>
#include "local_proto.h"
-static char **rules;
+static const char **rules;
static int nrules;
static void scan_rules(void)
@@ -40,7 +40,7 @@
rules = G__ls(path, &nrules);
- rules = G_realloc(rules, (nrules + 4) * sizeof(char *));
+ rules = G_realloc(rules, (nrules + 4) * sizeof(const char *));
rules[nrules++] = G_store("random");
rules[nrules++] = G_store("grey.eq");
@@ -57,7 +57,7 @@
for (i = 0; i < nrules; i++)
{
- char *name = rules[i];
+ const char *name = rules[i];
int n = strlen(name);
if (size < len + n + 2)
Modified: grass/branches/develbranch_6/raster/r.cross/main.c
===================================================================
--- grass/branches/develbranch_6/raster/r.cross/main.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/raster/r.cross/main.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -43,7 +43,6 @@
struct Colors pcolr;
char buf[1024];
CELL result;
- CELL cross();
struct GModule *module;
struct
{
@@ -73,8 +72,8 @@
parm.input->required = YES;
parm.input->multiple = YES;
parm.input->gisprompt = "old,cell,raster" ;
- sprintf(parm.input->description= G_malloc(60),
- _("Names of 2-%d input raster maps"), NFILES);
+ sprintf(buf, _("Names of 2-%d input raster maps"), NFILES);
+ parm.input->description= G_store(buf);
parm.output = G_define_standard_option(G_OPT_R_OUTPUT);
Modified: grass/branches/develbranch_6/raster/r.neighbors/main.c
===================================================================
--- grass/branches/develbranch_6/raster/r.neighbors/main.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/raster/r.neighbors/main.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -116,7 +116,7 @@
parm.method->type = TYPE_STRING ;
parm.method->required = NO ;
parm.method->answer = "average";
- p = parm.method->options = G_malloc(1024);
+ p = G_malloc(1024);
for (n = 0; menu[n].name; n++)
{
if (n)
@@ -125,6 +125,7 @@
*p = 0;
strcat (p, menu[n].name);
}
+ parm.method->options = p;
parm.method->description= _("Neighborhood operation") ;
parm.size = G_define_option() ;
Modified: grass/branches/develbranch_6/raster/r.out.gdal/main.c
===================================================================
--- grass/branches/develbranch_6/raster/r.out.gdal/main.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/raster/r.out.gdal/main.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -79,9 +79,9 @@
return;
}
-int import_band(GDALDatasetH hMEMDS, int band, char *name, char *mapset,
+int import_band(GDALDatasetH hMEMDS, int band, const char *name, const char *mapset,
struct Cell_head *cellhead, RASTER_MAP_TYPE maptype,
- double nodataval, char *nodatakey)
+ double nodataval, const char *nodatakey)
{
struct Colors sGrassColors;
Modified: grass/branches/develbranch_6/raster/r.transect/local_proto.h
===================================================================
--- grass/branches/develbranch_6/raster/r.transect/local_proto.h 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/raster/r.transect/local_proto.h 2008-07-03 08:18:42 UTC (rev 31977)
@@ -1,2 +1,2 @@
/* parse_line.c */
-int parse_line(char *, char **, double *, double *, double *, double *, int);
+int parse_line(const char *, char **, double *, double *, double *, double *, int);
Modified: grass/branches/develbranch_6/raster/r.transect/parse_line.c
===================================================================
--- grass/branches/develbranch_6/raster/r.transect/parse_line.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/raster/r.transect/parse_line.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -1,6 +1,7 @@
#include <math.h>
+#include <string.h>
#include <grass/gis.h>
-#include <string.h>
+#include "local_proto.h"
#define PI M_PI
#define Radians(x) ((x) * PI/180.0)
@@ -8,10 +9,9 @@
int
-parse_line (char *key, char **s, double *e1, double *n1, double *e2, double *n2, int projection)
+parse_line (const char *key, char **s, double *e1, double *n1, double *e2, double *n2, int projection)
{
int err;
- double sin(), cos();
double distance, azimuth;
err = 0;
Modified: grass/branches/develbranch_6/raster/r.univar2/r.univar_main.c
===================================================================
--- grass/branches/develbranch_6/raster/r.univar2/r.univar_main.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/raster/r.univar2/r.univar_main.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -105,7 +105,7 @@
? create_univar_stat_struct (-1, cells, 0)
: 0);
- for (p = (const char **)param.inputfile->answers; *p; p++) {
+ for (p = param.inputfile->answers; *p; p++) {
int fd = open_raster (*p);
if (map_type != -1) {
@@ -187,9 +187,9 @@
const RASTER_MAP_TYPE map_type = G_get_raster_map_type (fd);
void *nextp
= ((! param.extended->answer) ? 0
- : (map_type == DCELL_TYPE) ? stats->dcell_array
- : (map_type == FCELL_TYPE) ? stats->fcell_array
- : stats->cell_array);
+ : (map_type == DCELL_TYPE) ? (void *) stats->dcell_array
+ : (map_type == FCELL_TYPE) ? (void *) stats->fcell_array
+ : (void *) stats->cell_array);
const size_t value_sz = G_raster_size (map_type);
unsigned int row;
void *raster_row;
Modified: grass/branches/develbranch_6/raster/simwe/r.sim.sediment/main.c
===================================================================
--- grass/branches/develbranch_6/raster/simwe/r.sim.sediment/main.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/raster/simwe/r.sim.sediment/main.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -135,7 +135,7 @@
ymax = ymin + stepy * (float) my;
hhc = hhmax = 0.;
-/*
+#if 0
bxmi=2093113. * conv;
bymi=731331. * conv;
bxma=2093461. * conv;
@@ -147,7 +147,7 @@
mx2o= (int)((bxma-bxmi)/bresx);
my2o= (int)((byma-bymi)/bresy);
- /* relative small box coordinates: leave 1 grid layer for overlap
+ /* relative small box coordinates: leave 1 grid layer for overlap */
bxmi = bxmi - mixx + stepx;
bymi = bymi - miyy + stepy;
@@ -155,7 +155,7 @@
byma = byma - miyy - stepy;
mx2 = mx2o - 2*((int) (stepx / bresx));
my2 = my2o - 2*((int) (stepy / bresy));
-*/
+#endif
parm.elevin = G_define_standard_option(G_OPT_R_INPUT);
parm.elevin->key = "elevin";
Modified: grass/branches/develbranch_6/raster/wildfire/r.ros/main.c
===================================================================
--- grass/branches/develbranch_6/raster/wildfire/r.ros/main.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/raster/wildfire/r.ros/main.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -76,21 +76,17 @@
/*measurements of the 13 fuel models, input of Rothermel equation (1972)*/
-float WO[4][14] = { 0, 0.034, 0.092, 0.138, 0.230, 0.046, 0.069, 0.052, 0.069, 0.134, 0.138, 0.069, 0.184, 0.322,
- 0, 0, 0.046, 0, 0.184, 0.023, 0.115, 0.086, 0.046, 0.019, 0.092, 0.207, 0.644, 1.058,
- 0, 0, 0.023, 0, 0.092, 0, 0.092, 0.069, 0.115, 0.007, 0.230, 0.253, 0.759, 1.288,
- 0, 0, 0.023, 0, 0.230, 0.092, 0, 0.017, 0, 0, 0.092, 0, 0, 0};
+float WO[4][14] = {{ 0, 0.034, 0.092, 0.138, 0.230, 0.046, 0.069, 0.052, 0.069, 0.134, 0.138, 0.069, 0.184, 0.322},
+ { 0, 0, 0.046, 0, 0.184, 0.023, 0.115, 0.086, 0.046, 0.019, 0.092, 0.207, 0.644, 1.058},
+ { 0, 0, 0.023, 0, 0.092, 0, 0.092, 0.069, 0.115, 0.007, 0.230, 0.253, 0.759, 1.288},
+ { 0, 0, 0.023, 0, 0.230, 0.092, 0, 0.017, 0, 0, 0.092, 0, 0}};
/*ovendry fuel loading, lb./ft.^2*/
float DELTA[] = { 0, 1.0, 1.0, 2.5, 6.0, 2.0, 2.5, 2.5,
0.2, 0.2, 1.0, 1.0, 2.3, 3.0}; /*fuel depth, ft.*/
-float SIGMA[4][14] = { 0, 3500, 3000, 1500, 2000, 2000, 1750, 1750,
- 2000, 2500, 2000, 1500, 1500, 1500,
- 0, 0, 109, 0, 109, 109, 109, 109,
- 109, 109, 109, 109, 109, 109,
- 0, 0, 30, 0, 30, 0, 30, 30,
- 30, 30, 30, 30, 30, 30,
- 0, 0, 1500, 0, 1500, 1500, 0, 1500,
- 0, 0, 1500, 0, 0, 0};
+float SIGMA[4][14] = {{ 0, 3500, 3000, 1500, 2000, 2000, 1750, 1750, 2000, 2500, 2000, 1500, 1500, 1500},
+ { 0, 0, 109, 0, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109},
+ { 0, 0, 30, 0, 30, 0, 30, 30, 30, 30, 30, 30, 30, 30},
+ { 0, 0, 1500, 0, 1500, 1500, 0, 1500, 0, 0, 1500, 0, 0, 0}};
/*fuel particale surface-area-to-volume ratio, 1/ft.*/
float MX[] = { 0, 0.12, 0.15, 0.25, 0.20, 0.20, 0.25, 0.40,
0.30, 0.25, 0.25, 0.15, 0.20, 0.25}; /*moisture content of extinction*/
Modified: grass/branches/develbranch_6/vector/lidar/v.surf.bspline/main.c
===================================================================
--- grass/branches/develbranch_6/vector/lidar/v.surf.bspline/main.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/vector/lidar/v.surf.bspline/main.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -191,7 +191,7 @@
sprintf (table_name, "%s_aux", out_opt->answer);
/* Open driver and database */
- if (db_table_exists (dvr, db, &table_name)){ /*Something went wrong in a
+ if (db_table_exists (dvr, db, table_name)){ /*Something went wrong in a
previous v.surf.bspline execution*/
dbString sql;
char buf[1024];
Modified: grass/branches/develbranch_6/vector/v.digit/generate.c
===================================================================
--- grass/branches/develbranch_6/vector/v.digit/generate.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/vector/v.digit/generate.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -17,7 +17,8 @@
char **form)
{
int col, ncols, ctype, sqltype, more;
- char buf[5000], buf1[100], *colname;
+ char buf[5000], buf1[100];
+ const char *colname;
dbString sql, html, str;
dbDriver *driver;
dbHandle handle;
Modified: grass/branches/develbranch_6/vector/v.lrs/v.lrs.create/main.c
===================================================================
--- grass/branches/develbranch_6/vector/v.lrs/v.lrs.create/main.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/vector/v.lrs/v.lrs.create/main.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -96,7 +96,7 @@
struct Option *driver_opt, *database_opt, *table_opt, *thresh_opt;
struct GModule *module;
char *mapset, buf[2000];
- char *drv, *db;
+ const char *drv, *db;
struct Map_info In, Out, PMap, EMap;
struct line_cats *LCats, *PCats;
struct line_pnts *LPoints, *L2Points, *PPoints;
Modified: grass/branches/develbranch_6/vector/v.lrs/v.lrs.label/main.c
===================================================================
--- grass/branches/develbranch_6/vector/v.lrs/v.lrs.label/main.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/vector/v.lrs/v.lrs.label/main.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -78,7 +78,7 @@
struct GModule *module;
char *mapset, buf[2000];
- char *drv, *db;
+ const char *drv, *db;
struct Map_info In, Out;
struct line_cats *LCats, *SCats;
struct line_pnts *LPoints, *SPoints;
Modified: grass/branches/develbranch_6/vector/v.lrs/v.lrs.segment/main.c
===================================================================
--- grass/branches/develbranch_6/vector/v.lrs/v.lrs.segment/main.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/vector/v.lrs/v.lrs.segment/main.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -55,7 +55,7 @@
struct Option *table_opt;
struct GModule *module;
char *mapset, buf[2000];
- char *drv, *db;
+ const char *drv, *db;
struct Map_info In, Out;
struct line_cats *LCats, *SCats;
struct line_pnts *LPoints, *SPoints, *PlPoints;
Modified: grass/branches/develbranch_6/vector/v.lrs/v.lrs.where/main.c
===================================================================
--- grass/branches/develbranch_6/vector/v.lrs/v.lrs.where/main.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/vector/v.lrs/v.lrs.where/main.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -42,7 +42,7 @@
struct Option *driver_opt, *database_opt, *table_opt, *thresh_opt;
struct GModule *module;
char *mapset;
- char *drv, *db;
+ const char *drv, *db;
struct Map_info LMap, PMap;
struct line_cats *LCats, *PCats;
struct line_pnts *LPoints, *PPoints;
Modified: grass/branches/develbranch_6/vector/v.out.svg/main.c
===================================================================
--- grass/branches/develbranch_6/vector/v.out.svg/main.c 2008-07-03 07:48:26 UTC (rev 31976)
+++ grass/branches/develbranch_6/vector/v.out.svg/main.c 2008-07-03 08:18:42 UTC (rev 31977)
@@ -156,8 +156,8 @@
Column = db_get_table_column (Table, i);
if (attr_opt->answer != NULL) {
for (j=0; attr_opt->answers[j] != NULL; j++) {
- if ( G_strcasecmp(G_tolcase(attr_opt->answers[j]),
- G_tolcase(db_get_column_name(Column))) == 0 ) {
+ if ( G_strcasecmp(attr_opt->answers[j],
+ db_get_column_name(Column)) == 0 ) {
attr_cols[attr_size] = i;
attr_size +=1;
break;
@@ -366,7 +366,8 @@
Column = db_get_table_column (Table, attr_cols[i]);
Value = db_get_column_value(Column);
db_convert_column_value_to_string (Column, &dbstring);
- fprintf(fpsvg,"gg:%s=\"", G_tolcase(db_get_column_name(Column)));
+ G_strcpy(buf, db_get_column_name(Column));
+ fprintf(fpsvg,"gg:%s=\"", G_tolcase(buf));
print_escaped_for_xml(db_get_string (&dbstring));
fprintf(fpsvg,"\" ");
}
More information about the grass-commit
mailing list