[GRASS-SVN] r32396 - in grass/branches/develbranch_6: include lib/g3d

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jul 31 01:57:23 EDT 2008


Author: martinl
Date: 2008-07-31 01:57:23 -0400 (Thu, 31 Jul 2008)
New Revision: 32396

Removed:
   grass/branches/develbranch_6/lib/g3d/g3dkeys.h
Modified:
   grass/branches/develbranch_6/include/G3d.h
   grass/branches/develbranch_6/lib/g3d/G3d_intern.h
   grass/branches/develbranch_6/lib/g3d/cache.c
   grass/branches/develbranch_6/lib/g3d/changeprecision.c
   grass/branches/develbranch_6/lib/g3d/changetype.c
   grass/branches/develbranch_6/lib/g3d/filecompare.c
   grass/branches/develbranch_6/lib/g3d/filename.c
   grass/branches/develbranch_6/lib/g3d/g3dalloc.c
   grass/branches/develbranch_6/lib/g3d/g3dcache.c
   grass/branches/develbranch_6/lib/g3d/g3dcats.c
   grass/branches/develbranch_6/lib/g3d/g3dclose.c
   grass/branches/develbranch_6/lib/g3d/g3dcolor.c
   grass/branches/develbranch_6/lib/g3d/g3ddefaults.c
   grass/branches/develbranch_6/lib/g3d/g3ddoubleio.c
   grass/branches/develbranch_6/lib/g3d/g3derror.c
   grass/branches/develbranch_6/lib/g3d/g3dfpxdr.c
   grass/branches/develbranch_6/lib/g3d/g3dhistory.c
   grass/branches/develbranch_6/lib/g3d/g3dintio.c
   grass/branches/develbranch_6/lib/g3d/g3dkeys.c
   grass/branches/develbranch_6/lib/g3d/g3dmapset.c
   grass/branches/develbranch_6/lib/g3d/g3dmask.c
   grass/branches/develbranch_6/lib/g3d/g3dmisc.c
   grass/branches/develbranch_6/lib/g3d/g3dnull.c
   grass/branches/develbranch_6/lib/g3d/g3dopen2.c
   grass/branches/develbranch_6/lib/g3d/g3dparam.c
   grass/branches/develbranch_6/lib/g3d/g3drange.c
   grass/branches/develbranch_6/lib/g3d/g3dregion.c
   grass/branches/develbranch_6/lib/g3d/g3dresample.c
   grass/branches/develbranch_6/lib/g3d/g3dvolume.c
   grass/branches/develbranch_6/lib/g3d/g3dwindow.c
   grass/branches/develbranch_6/lib/g3d/g3dwindowio.c
   grass/branches/develbranch_6/lib/g3d/getblock.c
   grass/branches/develbranch_6/lib/g3d/header.c
   grass/branches/develbranch_6/lib/g3d/retile.c
   grass/branches/develbranch_6/lib/g3d/tilealloc.c
   grass/branches/develbranch_6/lib/g3d/tileio.c
   grass/branches/develbranch_6/lib/g3d/tilenull.c
   grass/branches/develbranch_6/lib/g3d/tileread.c
   grass/branches/develbranch_6/lib/g3d/tilewrite.c
   grass/branches/develbranch_6/lib/g3d/writeascii.c
Log:
glynn: Use "const" where appropriate
 Use void* instead of char* for generic pointers
 Include parameter lists in callback function types
 Use memcpy/memcmp where appropriate instead of loops
 Use loop counters instead of end pointers
 Remove local copies of G3D_Map structure
 Use G{NAME,MAPSET,PATH}_MAX for buffer sizes
 Replace K&R function definitions with ANSI syntax
 Fix typo in function names: Alligned -> Aligned
 Change G3d_error() to accept printf-style format string and arguments
(merged from trunk, r32392)


Modified: grass/branches/develbranch_6/include/G3d.h
===================================================================
--- grass/branches/develbranch_6/include/G3d.h	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/include/G3d.h	2008-07-31 05:57:23 UTC (rev 32396)
@@ -62,9 +62,14 @@
 
 /*---------------------------------------------------------------------------*/
 
+struct G3D_Map;
 
-typedef struct {
+typedef void resample_fn(struct G3D_Map *, int, int, int, void *, int);
 
+/*---------------------------------------------------------------------------*/
+
+typedef struct G3D_Map {
+
   char *fileName;
   char *tempName;
   char *mapset;
@@ -79,7 +84,7 @@
      G3D_Region window;
 
   /* resmapling function used for map. default is nearest neighbor */
-     void (*resampleFun) ();
+     resample_fn *resampleFun;
 
   /* units */
      char *unit;
@@ -225,14 +230,18 @@
 
 /*---------------------------------------------------------------------------*/
 
+typedef int write_fn(int, const void *, void *);
+typedef int read_fn(int, void *, void *);
 
+/*---------------------------------------------------------------------------*/
+
 /* grass/src/libes/g3d/cache.c */
 void G3d_cache_reset(G3D_cache *);
 void G3d_cache_dispose(G3D_cache *);
-void *G3d_cache_new(int, int, int, int (*)(), void *, int (*)(), void *);
-void G3d_cache_set_removeFun(G3D_cache *, int (*)(), void *);
-void G3d_cache_set_loadFun(G3D_cache *, int (*)(), void *);
-void *G3d_cache_new_read(int, int, int, int (*)(), void *);
+void *G3d_cache_new(int, int, int, write_fn *, void *, read_fn *, void *);
+void G3d_cache_set_removeFun(G3D_cache *, write_fn *, void *);
+void G3d_cache_set_loadFun(G3D_cache *, read_fn *, void *);
+void *G3d_cache_new_read(int, int, int, read_fn *, void *);
 int G3d_cache_lock(G3D_cache *, int);
 void G3d_cache_lock_intern(G3D_cache *, int);
 int G3d_cache_unlock(G3D_cache *, int);
@@ -245,10 +254,10 @@
 int G3d_cache_flush(G3D_cache *, int);
 int G3d_cache_remove_all(G3D_cache *);
 int G3d_cache_flush_all(G3D_cache *);
-char *G3d_cache_elt_ptr(G3D_cache *, int);
+void *G3d_cache_elt_ptr(G3D_cache *, int);
 int G3d_cache_load(G3D_cache *, int);
-int G3d_cache_get_elt(G3D_cache *, int, char *);
-int G3d_cache_put_elt(G3D_cache *, int, char *);
+int G3d_cache_get_elt(G3D_cache *, int, void *);
+int G3d_cache_put_elt(G3D_cache *, int, const void *);
 /* grass/src/libes/g3d/cachehash.c */
 void G3d_cache_hash_reset(G3d_cache_hash *);
 void G3d_cache_hash_dispose(G3d_cache_hash *);
@@ -257,13 +266,13 @@
 void G3d_cache_hash_load_name(G3d_cache_hash *, int, int);
 int G3d_cache_hash_name2index(G3d_cache_hash *, int);
 /* grass/src/libes/g3d/changeprecision.c */
-void G3d_changePrecision(void *, int, char *);
+void G3d_changePrecision(void *, int, const char *);
 /* grass/src/libes/g3d/changetype.c */
-void G3d_changeType(void *, char *);
+void G3d_changeType(void *, const char *);
 /* grass/src/libes/g3d/filecompare.c */
-void G3d_compareFiles(char *, char *, char *, char *);
+void G3d_compareFiles(const char *, const char *, const char *, const char *);
 /* grass/src/libes/g3d/filename.c */
-void G3d_filename(char *, char *, char *, char *);
+void G3d_filename(char *, const char *, const char *, const char *);
 /* grass/src/libes/g3d/find_grid3.c */
 char *G_find_grid3(const char *, const char *);
 /* grass/src/libes/g3d/fpcompress.c */
@@ -284,8 +293,8 @@
 int G3d_disposeCache(G3D_Map *);
 int G3d_flushAllTiles(G3D_Map *);
 /* grass/src/libes/g3d/g3dcats.c */
-int G3d_writeCats(char *, struct Categories *);
-int G3d_readCats(char *, char *, struct Categories *);
+int G3d_writeCats(const char *, struct Categories *);
+int G3d_readCats(const char *, const char *, struct Categories *);
 /* grass/src/libes/g3d/g3dclose.c */
 int G3d_closeCell(G3D_Map *);
 /* grass/src/libes/g3d/g3dcolor.c */
@@ -304,49 +313,49 @@
 void G3d_setTileDimension(int, int, int);
 void G3d_getTileDimension(int *, int *, int *);
 void G3d_setErrorFun(void (*)(const char *));
-void G3d_setUnit(char *);
+void G3d_setUnit(const char *);
 void G3d_initDefaults(void);
 /* grass/src/libes/g3d/g3ddoubleio.c */
-int G3d_writeDoubles(int, int, double *, int);
+int G3d_writeDoubles(int, int, const double *, int);
 int G3d_readDoubles(int, int, double *, int);
 /* grass/src/libes/g3d/g3derror.c */
 void G3d_skipError(const char *);
 void G3d_printError(const char *);
 void G3d_fatalError(const char *, ...);
 void G3d_fatalError_noargs(const char *);
-void G3d_error(const char *);
+void G3d_error(const char *, ...);
 /* grass/src/libes/g3d/g3dfpxdr.c */
-int G3d_isXdrNullNum(unsigned char *, int);
-int G3d_isXdrNullFloat(float *);
-int G3d_isXdrNullDouble(double *);
-void G3d_setXdrNullNum(unsigned char *, int);
+int G3d_isXdrNullNum(const void *, int);
+int G3d_isXdrNullFloat(const float *);
+int G3d_isXdrNullDouble(const double *);
+void G3d_setXdrNullNum(void *, int);
 void G3d_setXdrNullDouble(double *);
 void G3d_setXdrNullFloat(float *);
 int G3d_initFpXdr(G3D_Map *, int);
 int G3d_initCopyToXdr(G3D_Map *, int);
-int G3d_copyToXdr(char *, int);
+int G3d_copyToXdr(const void *, int);
 int G3d_initCopyFromXdr(G3D_Map *, int);
-int G3d_copyFromXdr(int, char *);
+int G3d_copyFromXdr(int, void *);
 /* grass/src/libes/g3d/g3dhistory.c */
-int G3d_writeHistory(char *, struct History *);
-int G3d_readHistory(char *, char *, struct History *);
+int G3d_writeHistory(const char *, struct History *);
+int G3d_readHistory(const char *, const char *, struct History *);
 /* grass/src/libes/g3d/g3dintio.c */
-int G3d_writeInts(int, int, int *, int);
+int G3d_writeInts(int, int, const int *, int);
 int G3d_readInts(int, int, int *, int);
 /* grass/src/libes/g3d/g3dkeys.c */
-int G3d_keyGetInt(struct Key_Value *, char *, int *);
-int G3d_keyGetDouble(struct Key_Value *, char *, double *);
-int G3d_keyGetString(struct Key_Value *, char *, char **);
-int G3d_keyGetValue(struct Key_Value *, char *, char *, char *, int, int, int *);
-int G3d_keySetInt(struct Key_Value *, char *, int *);
-int G3d_keySetDouble(struct Key_Value *, char *, double *);
-int G3d_keySetString(struct Key_Value *, char *, char **);
-int G3d_keySetValue(struct Key_Value *, char *, char *, char *, int, int, int *);
+int G3d_keyGetInt (struct Key_Value *, const char *, int *);
+int G3d_keyGetDouble (struct Key_Value *, const char *, double *);
+int G3d_keyGetString (struct Key_Value *, const char *, char **);
+int G3d_keyGetValue (struct Key_Value *, const char *, char *, char *, int, int, int *);
+int G3d_keySetInt (struct Key_Value *, const char *, const int *);
+int G3d_keySetDouble (struct Key_Value *, const char *, const double *);
+int G3d_keySetString (struct Key_Value *, const char *, char * const *);
+int G3d_keySetValue (struct Key_Value *, const char *, const char *, const char *, int, int, const int *);
 /* grass/src/libes/g3d/g3dlong.c */
 int G3d_longEncode(long *, unsigned char *, int);
 void G3d_longDecode(unsigned char *, long *, int, int);
 /* grass/src/libes/g3d/g3dmapset.c */
-void G3d_makeMapsetMapDirectory(char *);
+void G3d_makeMapsetMapDirectory(const char *);
 /* grass/src/libes/g3d/g3dmask.c */
 int G3d_maskClose(void);
 int G3d_maskFileExists(void);
@@ -356,22 +365,22 @@
 void G3d_maskNum(G3D_Map *, int, int, int, void *, int);
 void G3d_maskFloat(G3D_Map *, int, int, int, float *);
 void G3d_maskDouble(G3D_Map *, int, int, int, double *);
-void G3d_maskTile(G3D_Map *, int, char *, int);
+void G3d_maskTile(G3D_Map *, int, void *, int);
 void G3d_maskOn(G3D_Map *);
 void G3d_maskOff(G3D_Map *);
 int G3d_maskIsOn(G3D_Map *);
 int G3d_maskIsOff(G3D_Map *);
-char *G3d_maskFile(void);
+const char *G3d_maskFile(void);
 int G3d_maskMapExists(void);
 /* grass/src/libes/g3d/g3dmisc.c */
 int G3d_g3dType2cellType(int);
-void G3d_copyFloat2Double(float *, int, double *, int, int);
-void G3d_copyDouble2Float(double *, int, float *, int, int);
-void G3d_copyValues(char *, int, int, char *, int, int, int);
+void G3d_copyFloat2Double(const float *, int, double *, int, int);
+void G3d_copyDouble2Float(const double *, int, float *, int, int);
+void G3d_copyValues(const void *, int, int, void *, int, int, int);
 int G3d_length(int);
 int G3d_externLength(int);
 /* grass/src/libes/g3d/g3dnull.c */
-int G3d_isNullValueNum(void *, int);
+int G3d_isNullValueNum(const void *, int);
 void G3d_setNullValue(void *, int, int);
 /* grass/src/libes/g3d/g3dopen2.c */
 /* grass/src/libes/g3d/g3dopen.c */
@@ -384,14 +393,14 @@
 void G3d_setWindowParams(void);
 char *G3d_getWindowParams(void);
 /* grass/src/libes/g3d/g3drange.c */
-void G3d_range_updateFromTile(G3D_Map *, char *, int, int, int, int, int, int, int, int);
+void G3d_range_updateFromTile(G3D_Map *, const void *, int, int, int, int, int, int, int, int);
 int G3d_readRange(const char *, const char *, struct FPRange *);
 int G3d_range_load(G3D_Map *);
 void G3d_range_min_max(G3D_Map *, double *, double *);
 int G3d_range_write(G3D_Map *);
 int G3d_range_init(G3D_Map *);
 /* grass/src/libes/g3d/g3dregion.c */
-void G3d_getRegionValue(G3D_Map *, double, double, double, char *, int);
+void G3d_getRegionValue(G3D_Map *, double, double, double, void *, int);
 void G3d_adjustRegion (G3D_Region *);
 void G3d_regionCopy (G3D_Region *,G3D_Region *);
 void G3d_incorporate2dRegion (struct Cell_head *, G3D_Region *);
@@ -399,18 +408,18 @@
 void G3d_adjustRegionRes (G3D_Region *);
 void G3d_extract2dRegion (G3D_Region *, struct Cell_head *);
 void G3d_regionToCellHead (G3D_Region *, struct Cell_head *);
-int G3d_readRegionMap (char *, char *,G3D_Region *);
+int G3d_readRegionMap (const char *, const char *,G3D_Region *);
 
 /* grass/src/libes/g3d/g3dresample.c */
-void G3d_nearestNeighbor(G3D_Map *, int, int, int, char *, int);
+void G3d_nearestNeighbor(G3D_Map *, int, int, int, void *, int);
 void G3d_setResamplingFun(G3D_Map *, void (*)());
 void G3d_getResamplingFun(G3D_Map *, void (**)());
 void G3d_getNearestNeighborFunPtr(void (**)());
 /* grass/src/libes/g3d/g3dvolume.c */
-void G3d_getVolumeA(void *, double [2][2][2][3], int, int, int, char *, int);
-void G3d_getVolume(void *, double, double, double, double, double, double, double, double, double, double, double, double, int, int, int, char *, int);
-void G3d_getAllignedVolume(void *, double, double, double, double, double, double, int, int, int, char *, int);
-void G3d_makeAllignedVolumeFile(void *, char *, double, double, double, double, double, double, int, int, int);
+void G3d_getVolumeA(void *, double [2][2][2][3], int, int, int, void *, int);
+void G3d_getVolume(void *, double, double, double, double, double, double, double, double, double, double, double, double, int, int, int, void *, int);
+void G3d_getAlignedVolume(void *, double, double, double, double, double, double, int, int, int, void *, int);
+void G3d_makeAlignedVolumeFile(void *, const char *, double, double, double, double, double, double, int, int, int);
 /* grass/src/libes/g3d/g3dwindow.c */
 void G3d_getValue(G3D_Map *, int, int, int, void *, int);
 float G3d_getFloat(G3D_Map *, int, int, int);
@@ -422,11 +431,11 @@
 
 /* grass/src/libes/g3d/g3dwindowio.c */
 void G3d_useWindowParams(void);
-int G3d_readWindow (G3D_Region *, char *);
+int G3d_readWindow (G3D_Region *, const char *);
 /* int G3d_writeWindow (G3D_Region *, char *); */
 /* grass/src/libes/g3d/getblock.c */
 void G3d_getBlockNocache(G3D_Map *, int, int, int, int, int, int, void *, int);
-void G3d_getBlock(G3D_Map *, int, int, int, int, int, int, char *, int);
+void G3d_getBlock(G3D_Map *, int, int, int, int, int, int, void *, int);
 /* grass/src/libes/g3d/header.c */
 int G3d_readHeader(G3D_Map *, int *, int *, double *, double *, double *, double *, double *, double *, int *, int *, int *, double *, double *, double *, int *, int *, int *, int *, int *, int *, int *, int *, int *, int *, int *, char **);
 int G3d_writeHeader(G3D_Map *, int, int, double, double, double, double, double, double, int, int, int, double, double, double, int, int, int, int, int, int, int, int, int, int, int, char *);
@@ -450,17 +459,17 @@
 int G3d_flushIndex(G3D_Map *);
 int G3d_initIndex(G3D_Map *, int);
 /* grass/src/libes/g3d/retile.c */
-void G3d_retile(void *, char *, int, int, int);
+void G3d_retile(void *, const char *, int, int, int);
 /* grass/src/libes/g3d/rle.c */
 int G_rle_count_only(char *, int, int);
 void G_rle_encode(char *, char *, int, int);
 void G_rle_decode(char *, char *, int, int, int *, int *);
 /* grass/src/libes/g3d/tilealloc.c */
-char *G3d_allocTilesType(G3D_Map *, int, int);
-char *G3d_allocTiles(G3D_Map *, int);
-void G3d_freeTiles(char *);
+void *G3d_allocTilesType(G3D_Map *, int, int);
+void *G3d_allocTiles(G3D_Map *, int);
+void G3d_freeTiles(void *);
 /* grass/src/libes/g3d/tileio.c */
-char *G3d_getTilePtr(G3D_Map *, int);
+void *G3d_getTilePtr(G3D_Map *, int);
 int G3d_tileLoad(G3D_Map *, int);
 int G3d__removeTile(G3D_Map *, int);
 float G3d_getFloatRegion(G3D_Map *, int, int, int);
@@ -480,12 +489,12 @@
 int G3d_isValidLocation(G3D_Map *, double, double, double);
 void G3d_location2coord(G3D_Map *, double, double, double, int *, int *, int *);
 /* grass/src/libes/g3d/tilenull.c */
-void G3d_setNullTileType(G3D_Map *, char *, int);
-void G3d_setNullTile(G3D_Map *, char *);
+void G3d_setNullTileType(G3D_Map *, void *, int);
+void G3d_setNullTile(G3D_Map *, void *);
 /* grass/src/libes/g3d/tileread.c */
-int G3d_readTile(G3D_Map *, int, char *, int);
-int G3d_readTileFloat(G3D_Map *, int, char *);
-int G3d_readTileDouble(G3D_Map *, int, char *);
+int G3d_readTile(G3D_Map *, int, void *, int);
+int G3d_readTileFloat(G3D_Map *, int, void *);
+int G3d_readTileDouble(G3D_Map *, int, void *);
 int G3d_lockTile(G3D_Map *, int);
 int G3d_unlockTile(G3D_Map *, int);
 int G3d_unlockAll(G3D_Map *);
@@ -495,16 +504,16 @@
 int G3d_beginCycle(G3D_Map *);
 int G3d_endCycle(G3D_Map *);
 /* grass/src/libes/g3d/tilewrite.c */
-int G3d_writeTile(G3D_Map *, int, char *, int);
-int G3d_writeTileFloat(G3D_Map *, int, char *);
-int G3d_writeTileDouble(G3D_Map *, int, char *);
+int G3d_writeTile(G3D_Map *, int, const void *, int);
+int G3d_writeTileFloat(G3D_Map *, int, const void *);
+int G3d_writeTileDouble(G3D_Map *, int, const void *);
 int G3d_flushTile(G3D_Map *, int);
 int G3d_flushTileCube(G3D_Map *, int, int, int, int, int, int);
 int G3d_flushTilesInCube(G3D_Map *, int, int, int, int, int, int);
 int G3d_putFloat(G3D_Map *, int, int, int, float);
 int G3d_putDouble(G3D_Map *, int, int, int, double);
-int G3d_putValue(G3D_Map *, int, int, int, char *, int);
+int G3d_putValue(G3D_Map *, int, int, int, const void *, int);
 /* grass/src/libes/g3d/writeascii.c */
-void G3d_writeAscii(void *, char *);
+void G3d_writeAscii(void *, const char *);
 
 #endif /* #ifndef GRASS_G3D_H */

Modified: grass/branches/develbranch_6/lib/g3d/G3d_intern.h
===================================================================
--- grass/branches/develbranch_6/lib/g3d/G3d_intern.h	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/G3d_intern.h	2008-07-31 05:57:23 UTC (rev 32396)
@@ -35,127 +35,11 @@
 
 /*---------------------------------------------------------------------------*/
 
-#ifndef GRASS_G3D_H 
-typedef struct {
-
-  char *fileName;
-  char *tempName;
-  char *mapset;
-
-  /* operation performed on map */
-     int operation; /* G3D_WRITE_DATA or G3D_READ_DATA */
-
-  /* region */
-     G3D_Region region;
-
-  /* window for map */
-     G3D_Region window;
-
-  /* resmapling function used for map. default is nearest neighbor */
-     void (*resampleFun) ();
-
-  /* units */
-     char *unit;
-
-  /* dimension of a single tile in "cells" */
-     int tileX, tileY, tileZ;
-
-  /* # of tiles in x, y, and z direction */
-     int nx, ny, nz;
-
-  /* data file specific information */
-
-     /* file descriptor */
-        int data_fd; /* file descriptor */
-
-     /* type in which data is stored on file */
-        int type; /* DCELL_TYPE or FCELL_TYPE */
-
-     /* data concering the compression */
-        int precision; /* G3D_MAX_PRECISION or, 0 .. 23 for float, 
-		                                0 .. 52 for double */
-        int compression; /* G3D_NO_COMPRESSION or G3D_USE_COMPRESSION */
-        int useLzw; /* G3D_USE_LZW or G3D_NO_LZW */
-        int useRle; /* G3D_USE_RLE or G3D_NO_RLE */
-        int useXdr; /* G3D_USE_XDR or G3D_NO_XDR */
-     
-     /* pointer to first tile in file */
-        int offset;
-
-     /* pointer to the first index entry in file */
-        long indexOffset;
-  
-     /* sizeof (long) of the system on which the file is/was written */
-        int indexLongNbytes;
-
-     /* max # bytes used in the representation of indices; this is equal to */
-     /* # bytes used in the representation of "indexOffset" */
-        int indexNbytesUsed;
-
-     /* pointer to the last entry in the file */
-        int fileEndPtr;
-      
-     /* indicates if index is stored in file; used for G3D_READ_DATA only */
-        int hasIndex; /* G3D_HAS_INDEX or G3D_NO_INDEX */
-
-  /* information concerning internal storage of data */
-
-     /* index specific information */
-        /* index[i] == the offset of tile "i" in the data file */
-           long *index;
-
-        /* tileLength[i] == # bytes used to store tile "i" */
-           int *tileLength;
-
-     /* tile specific information */
-
-        /* type in which data is stored in memory */
-           int typeIntern; /* DCELL_TYPE or FCELL_TYPE */
-
-     /* in non-cache mode the "data" array is used to store one tile */
-        char *data;
-     
-     /* index of tile currently stored in "data"; -1 if none */
-        int currentIndex;
-
-     /* cache related variables */
-
-        int useCache;   /* 1 if cache is used */
-        void *cache;    /* pointer to cache structure */
-        int cacheFD;    /* file discriptor of cache file -- write mode only */
-        char *cacheFileName; /* filename of cache file -- write mode only */
-        long cachePosLast; /* position of last entry in cache file -- write */
-                           /* mode only*/
-
-  /* range info */
-     struct FPRange range;
-
-  /* some constants stored for efficiency */
-        
-     /* number of bytes required to store a single value of "type" */
-        int numLengthExtern;
-  
-     /* number of bytes required to store a single value of "typeIntern" */
-        int numLengthIntern;
-
-     /* see header.c for details */
-        int clipX, clipY, clipZ;
-        int tileXY, tileSize;     
-        int nxy, nTiles;
-
-  /* mask related information */
-
-     int useMask; /* 1 if mask is used; 0 otherwise */
-
-} G3D_Map;
-#endif
-/*---------------------------------------------------------------------------*/
-
 /* global arrays */
 
-extern char *tmpCompress; /* compression support array */
+extern void *tmpCompress; /* compression support array */
 extern int tmpCompressLength; /* in bytes */
-extern char *xdr;/* xdr support array */
+extern void *xdr;/* xdr support array */
 extern int xdrLength; /* in bytes */
 
 /*---------------------------------------------------------------------------*/

Modified: grass/branches/develbranch_6/lib/g3d/cache.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/cache.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/cache.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/types.h>
 #include <unistd.h>
 #include <grass/G3d.h>
@@ -7,41 +8,7 @@
 #include "cachehash.h"
 
 /*---------------------------------------------------------------------------*/
-#ifndef GRASS_G3D_H
-typedef struct {
-  
-  char *elts;       /* ptr to array of elts */
-  int nofElts;      /* size of "elts" */
-  int eltSize;      /* size of elt in "elts" */
 
-  int *names;       /* name[i] is the name of elts[i] */
-
-  char *locks;      /* lock[i] == 1 iff elts[i] is locked
-                       lock[i] == 0 iff elts[i] is unlocked but active
-                       lock[i] == 2 iff elts[i] doesn't contain valid data */
-  int autoLock;     /* 1 if auto locking is turned on */
-  int nofUnlocked;  /* nof tiles which are unlocked */
-  int minUnlocked;  /* min nof elts which have to remain unlocked. min = 1 */
-
-  int *next, *prev; /* prev/next pointers for fifo */
-  int first, last;  /* index (into next) of first and last elt in fifo */
-                    /* first == -1 iff fifo is empty */
-
-  int (* eltRemoveFun) (); /* callback activated if the contents of an 
-			       elt needs to be removed */
-  void *eltRemoveFunData;   /* pointer to user data passed along with 
-			       eltRemoveFun */
-  int (* eltLoadFun) ();   /* callback activated to load contents of an elt */
-  void *eltLoadFunData;     /* pointer to user data passed along with 
-			       eltLoadFun */
-
-  void *hash;       /* ptr to hashTable used to relate external names to
-                       internal indices (elts) */
-
-} G3D_cache;
-#endif
-/*---------------------------------------------------------------------------*/
-
 #define IS_ACTIVE_ELT(elt) (c->locks[elt] != 2)
 #define IS_NOT_ACTIVE_ELT(elt) (c->locks[elt] == 2)
 #define IS_LOCKED_ELT(elt) (c->locks[elt] == 1)
@@ -91,7 +58,7 @@
 /*---------------------------------------------------------------------------*/
 
 static int
-cache_dummy_fun ()
+cache_dummy_fun(int tileIndex, const void *tileBuf, void *map)
 
 {
   return 1;
@@ -188,7 +155,7 @@
 /*---------------------------------------------------------------------------*/
 
 void *
-G3d_cache_new_read  (int nofElts, int sizeOfElts, int nofNames, int (*eltLoadFun)(), void *eltLoadFunData)
+G3d_cache_new_read  (int nofElts, int sizeOfElts, int nofNames, read_fn *eltLoadFun, void *eltLoadFunData)
 
 {
   return G3d_cache_new (nofElts, sizeOfElts, nofNames,
@@ -515,7 +482,7 @@
 
 /*---------------------------------------------------------------------------*/
 
-char *
+void *
 G3d_cache_elt_ptr  (G3D_cache *c, int name)
 
 {
@@ -539,7 +506,7 @@
     if (! c->eltRemoveFun (oldName, c->elts + c->eltSize * index, 
 			   c->eltRemoveFunData)) {
       G3d_error ("G3d_cache_elt_ptr: error in c->eltRemoveFun");
-      return (char *) NULL;
+      return NULL;
     }
   } 
 
@@ -554,13 +521,13 @@
   if (doUnlock) 
     if (! G3d_cache_unlock (c, name)) {
       G3d_error ("G3d_cache_elt_ptr: error in G3d_cache_unlock");
-      return (char *) NULL;
+      return NULL;
     }
 
   if (! c->eltLoadFun (name, c->elts + c->eltSize * index, 
 		       c->eltLoadFunData)) {
     G3d_error("G3d_cache_elt_ptr: error in c->eltLoadFun");
-    return (char *) NULL;
+    return NULL;
   }
 
   return c->elts + c->eltSize * index;
@@ -583,10 +550,10 @@
 /*---------------------------------------------------------------------------*/
 
 int
-G3d_cache_get_elt  (G3D_cache *c, int name, char *dst)
+G3d_cache_get_elt  (G3D_cache *c, int name, void *dst)
 
 {
-  char *elt, *eltStop;
+  const void *elt;
 
   elt = G3d_cache_elt_ptr (c, name);
   if (elt == NULL) {
@@ -594,8 +561,7 @@
     return 0;
   }
 
-  eltStop = elt + c->eltSize;
-  while (elt != eltStop) *dst++ = *elt++;
+  memcpy(dst, elt, c->eltSize);
 
   return 1;
 }
@@ -603,10 +569,10 @@
 /*---------------------------------------------------------------------------*/
 
 int
-G3d_cache_put_elt  (G3D_cache *c, int name, char *src)
+G3d_cache_put_elt  (G3D_cache *c, int name, const void *src)
 
 {
-  char *elt, *eltStop;
+  void *elt;
 
   elt = G3d_cache_elt_ptr (c, name);
   if (elt == NULL) {
@@ -614,8 +580,7 @@
     return 0;
   }
 
-  eltStop = elt + c->eltSize;
-  while (elt != eltStop) *elt++ = *src++;
+  memcpy(elt, src, c->eltSize);
 
   return 1;
 }
@@ -660,10 +625,10 @@
 /*---------------------------------------------------------------------------*/
 
 static int
-cache_test_flush_fun  (int name, int *eltPtr, void *data)
+cache_test_flush_fun  (int name, const void *eltPtr, void *data)
 
 {
-  printf ("flushing name %d value %d\n", name, eltPtr[17]);
+  printf ("flushing name %d value %d\n", name, ((const int *)eltPtr)[17]);
   return 0;
 }
 
@@ -677,17 +642,17 @@
 } cache_test_data_type;
 
 static int
-cache_test_load_fun  (int name, char *eltPtr, void *data)
+cache_test_load_fun  (int name, void *eltPtr, void *data)
 
 {
-  char *eltStop, *src;
+  const void *src;
 
   printf ("loading name %d value %d\n", name, 
 	  ((cache_test_data_type *) data)->value[17]);
 
-  src = (char *) ((cache_test_data_type *) data)->value;
-  eltStop = eltPtr + ((cache_test_data_type *) data)->size;
-  while (eltPtr != eltStop) *eltPtr++ = *src++;
+  src = ((cache_test_data_type *) data)->value;
+  memcpy(eltPtr, src, ((cache_test_data_type *) data)->size);
+
   return 0;
 }
 

Modified: grass/branches/develbranch_6/lib/g3d/changeprecision.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/changeprecision.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/changeprecision.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -21,7 +21,7 @@
  */
 
 void
-G3d_changePrecision  (void *map, int precision, char *nameOut)
+G3d_changePrecision  (void *map, int precision, const char *nameOut)
 
 {
   void *map2;

Modified: grass/branches/develbranch_6/lib/g3d/changetype.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/changetype.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/changetype.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -22,12 +22,12 @@
  */
 
 void
-G3d_changeType  (void *map, char *nameOut)
+G3d_changeType  (void *map, const char *nameOut)
 
 {
   void *map2;
   int x, y, z, saveType;
-  char *data, *data2;
+  void *data, *data2;
   G3D_Region region;
   int tileSize;
   int tileX, tileY, tileZ, typeIntern, typeIntern2;

Modified: grass/branches/develbranch_6/lib/g3d/filecompare.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/filecompare.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/filecompare.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -338,8 +338,8 @@
     for (y = 0; y < ny * tileY; y++) {
       for (x = 0; x < nx * tileX; x++) {
 
-	G3d_getBlock (map, x, y, z, 1, 1, 1, (char *)n1p, typeIntern);
-	G3d_getBlock (map2, x, y, z, 1, 1, 1, (char *)n2p, typeIntern2);
+	G3d_getBlock (map, x, y, z, 1, 1, 1, n1p, typeIntern);
+	G3d_getBlock (map2, x, y, z, 1, 1, 1, n2p, typeIntern2);
 
 	if (typeIntern == FCELL_TYPE)
 	{
@@ -395,7 +395,7 @@
  */
 
 void
-G3d_compareFiles  (char *f1, char *mapset1, char *f2, char *mapset2)
+G3d_compareFiles  (const char *f1, const char *mapset1, const char *f2, const char *mapset2)
 
 {
   void *map, *map2; 
@@ -472,8 +472,8 @@
     {
       for (x = 0; x < cols; x++) 
       {
-	G3d_getValueRegion (map, x, y, z, (char *)n1p, typeIntern);
-	G3d_getValueRegion (map2, x, y, z, (char *)n2p, typeIntern2);
+	G3d_getValueRegion (map, x, y, z, n1p, typeIntern);
+	G3d_getValueRegion (map2, x, y, z, n2p, typeIntern2);
 
 	G3d_isNullValueNum (n1p, typeIntern);
 	G3d_isNullValueNum (n2p, typeIntern2);

Modified: grass/branches/develbranch_6/lib/g3d/filename.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/filename.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/filename.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -7,11 +7,8 @@
 /*---------------------------------------------------------------------------*/
 
 void
-G3d_filename  (char *path, char *elementName, char *mapName, char *mapset)
+G3d_filename  (char *path, const char *elementName, const char *mapName, const char *mapset)
 
 {
-  char map[300];
-
-  sprintf(map, "%s/%s", G3D_DIRECTORY, mapName);
-  G__file_name (path, map, elementName, mapset);
+  G__file_name_misc(path, G3D_DIRECTORY, elementName, mapName, mapset);
 }

Modified: grass/branches/develbranch_6/lib/g3d/g3dalloc.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/g3dalloc.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/g3dalloc.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -25,7 +25,7 @@
 G3d_malloc  (int nBytes)
 
 {
-  char *buf;
+  void *buf;
 
   if (nBytes <= 0) nBytes = 1;
   if ((buf = malloc (nBytes)) != NULL) return buf;

Modified: grass/branches/develbranch_6/lib/g3d/g3dcache.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/g3dcache.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/g3dcache.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -8,9 +8,10 @@
 /*---------------------------------------------------------------------------*/
 
 static int
-cacheRead_readFun  (int tileIndex, char *tileBuf, G3D_Map *map)
+cacheRead_readFun  (int tileIndex, void *tileBuf, void *closure)
 
 {
+  G3D_Map *map = closure;
   if (! G3d_readTile (map, tileIndex, tileBuf, map->typeIntern)) {
     G3d_error ("cacheRead_readFun: error in G3d_readTile");
     return 0;
@@ -57,9 +58,10 @@
 /*---------------------------------------------------------------------------*/
 
 static int
-cacheWrite_readFun  (int tileIndex, char *tileBuf, G3D_Map *map)
+cacheWrite_readFun  (int tileIndex, void *tileBuf, void *closure)
 
 {
+  G3D_Map *map = closure;
   int index, nBytes;
   long pos, offs, offsLast;
 
@@ -137,9 +139,10 @@
 /*---------------------------------------------------------------------------*/
 
 static int
-cacheWrite_writeFun  (int tileIndex, char *tileBuf, G3D_Map *map)
+cacheWrite_writeFun  (int tileIndex, const void *tileBuf, void *closure)
 
 {
+  G3D_Map *map = closure;
   int nBytes;
   long offs;
 
@@ -276,9 +279,10 @@
 /*---------------------------------------------------------------------------*/
 
 static int
-cacheFlushFun  (int tileIndex, char *tileBuf, G3D_Map *map)
+cacheFlushFun  (int tileIndex, const void *tileBuf, void *closure)
 
 {
+  G3D_Map *map = closure;
   if (! G3d_writeTile (map, tileIndex, tileBuf, map->typeIntern)) {
     G3d_error ("cacheFlushFun: error in G3d_writeTile");
     return 0;

Modified: grass/branches/develbranch_6/lib/g3d/g3dcats.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/g3dcats.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/g3dcats.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -24,7 +24,7 @@
  */
 
 int
-G3d_writeCats  (char *name, struct Categories *cats)
+G3d_writeCats  (const char *name, struct Categories *cats)
  /* adapted from G_write_cats */
 
 
@@ -33,9 +33,9 @@
 {
   FILE *fd;
   int i;
-  char *descr;
+  const char *descr;
   DCELL val1, val2;
-  char str1[100], str2[100], buf[200], buf2[200], xname[512], xmapset[512];
+  char str1[100], str2[100], buf[200], buf2[200], xname[GNAME_MAX], xmapset[GMAPSET_MAX];
 
   if (G__name_is_fully_qualified (name, xname, xmapset)) {
     sprintf (buf, "%s/%s", G3D_DIRECTORY, xname);
@@ -82,7 +82,7 @@
 /*---------------------------------------------------------------------------*/
 
 static int
-read_cats  (char *name, char *mapset, struct Categories *pcats)
+read_cats  (const char *name, const char *mapset, struct Categories *pcats)
  /* adapted from G__read_cats */
 
 
@@ -183,7 +183,7 @@
  */
 
 int
-G3d_readCats  (char *name, char *mapset, struct Categories *pcats)
+G3d_readCats  (const char *name, const char *mapset, struct Categories *pcats)
  /* adapted from G_read_cats */
 
 
@@ -191,9 +191,7 @@
 
 
 {
-  char err[100];
-  char *type;
-  CELL G__read_cats();
+  const char *type;
 
   switch (read_cats (name, mapset, pcats)) {
   case -2:
@@ -206,8 +204,7 @@
     return 0;
   }
 
-  sprintf(err,"category support for [%s] in mapset [%s] %s",
+  G_warning ("category support for [%s] in mapset [%s] %s",
 	  name, mapset, type);
-  G_warning (err);
   return -1;
 }

Modified: grass/branches/develbranch_6/lib/g3d/g3dclose.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/g3dclose.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/g3dclose.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -13,14 +13,14 @@
 G3d_closeNew  (G3D_Map *map)
 
 {
-  char path[4096], buf[4096];
+  char path[GPATH_MAX];
   struct Categories cats;
   struct History hist;
 
   G3d_removeColor (map->fileName);
 
   /* create empty cats file */
-  G_init_raster_cats ((char *) NULL, &cats);
+  G_init_raster_cats (NULL, &cats);
   G3d_writeCats (map->fileName, &cats);
   G_free_cats (&cats);
 
@@ -30,8 +30,7 @@
   /*Use the G3d function to write the history file,
    * otherwise the path is wrong */
   if (!G3d_writeHistory(map->fileName, &hist)) {
-      sprintf(buf, "G3d_closeNew: can't write raster3d history");
-      G3d_error(buf);
+      G3d_error("G3d_closeNew: can't write raster3d history");
   }
 
 
@@ -47,10 +46,8 @@
   if (link (map->tempName, path) < 0) {
 #endif
     if(rename(map->tempName, path)) {
-      sprintf (buf,
-	   "G3d_closeNew: can't move temp raster map %s\nto 3d data file %s",
+      G3d_error ("G3d_closeNew: can't move temp raster map %s\nto 3d data file %s",
 	       map->tempName, path);
-      G3d_error (buf);
       return 0;
     }
   } else 

Modified: grass/branches/develbranch_6/lib/g3d/g3dcolor.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/g3dcolor.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/g3dcolor.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -53,8 +53,8 @@
 
 {
   char buf[512], buf2[200];
-  char *err;
-  char xname[512], xmapset[512];
+  const char *err;
+  char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
   struct FPRange drange;
   DCELL dmin, dmax;
 
@@ -97,8 +97,7 @@
     return 1;
   }
 
-  sprintf(buf,"color support for [%s] in mapset [%s] %s", name, mapset, err);
-  G_warning (buf);
+  G_warning ("color support for [%s] in mapset [%s] %s", name, mapset, err);
   return -1;
 }
 

Modified: grass/branches/develbranch_6/lib/g3d/g3ddefaults.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/g3ddefaults.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/g3ddefaults.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -61,7 +61,6 @@
 int g3d_tile_dimension[3] = {G3D_NO_DEFAULT, G3D_NO_DEFAULT, G3D_NO_DEFAULT};
 void (*g3d_error_fun)(const char *) = NULL;
 char *g3d_unit_default = NULL;
-extern char * G3d_getWindowParams(void);                                        
 
 /*---------------------------------------------------------------------------*/
 
@@ -335,7 +334,7 @@
  */
 
 void
-G3d_setUnit  (char *unit)
+G3d_setUnit  (const char *unit)
 
 {
   G3d_free (g3d_unit_default);
@@ -357,11 +356,11 @@
  */
 
 void
-G3d_initDefaults ()
+G3d_initDefaults (void)
 
 {
   static int firstTime = 1;
-  char *value, *windowName;
+  const char *value, *windowName;
   G3D_Region window;
 
   if (! firstTime) return;
@@ -614,7 +613,7 @@
   {
     value = getenv (G3D_DEFAULT_WINDOW3D);
     if (value != NULL) 
-      if (*value != 0) windowName = G_store (value);
+      if (*value != 0) windowName = value;
   }
 
   if (! G3d_readWindow (&window, windowName))

Modified: grass/branches/develbranch_6/lib/g3d/g3ddoubleio.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/g3ddoubleio.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/g3ddoubleio.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -9,7 +9,7 @@
 /*---------------------------------------------------------------------------*/
 
 int
-G3d_writeDoubles  (int fd, int useXdr, double *i, int nofNum)
+G3d_writeDoubles  (int fd, int useXdr, const double *i, int nofNum)
 
 {
    int firstTime = 1;

Modified: grass/branches/develbranch_6/lib/g3d/g3derror.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/g3derror.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/g3derror.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -81,8 +81,15 @@
 }
 
 void
-G3d_error  (const char *msg)
+G3d_error  (const char *msg, ...)
 
 {
-    (*g3d_error_fun) (msg);
+    char buffer[2000];  /* No novels to the error logs, OK? */
+    va_list ap;
+
+    va_start(ap,msg);
+    vsprintf(buffer,msg,ap);
+    va_end(ap);
+
+    (*g3d_error_fun) (buffer);
 }

Modified: grass/branches/develbranch_6/lib/g3d/g3dfpxdr.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/g3dfpxdr.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/g3dfpxdr.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/types.h>
 #include <unistd.h>
 #include <rpc/types.h>
@@ -8,67 +9,46 @@
 
 /*---------------------------------------------------------------------------*/
 
-#define XDR_NULL_BYTE_0 255
-#define XDR_NULL_BYTE_1 255
-#define XDR_NULL_BYTE_2 255
-#define XDR_NULL_BYTE_3 255
-#define XDR_NULL_BYTE_4 255
-#define XDR_NULL_BYTE_5 255
-#define XDR_NULL_BYTE_6 255
-#define XDR_NULL_BYTE_7 255
-
 int
-G3d_isXdrNullNum  (unsigned char *num, int isFloat)
+G3d_isXdrNullNum  (const void *num, int isFloat)
 
 {
-  if (*num++ != XDR_NULL_BYTE_0) return 0;
-  if (*num++ != XDR_NULL_BYTE_1) return 0;
-  if (*num++ != XDR_NULL_BYTE_2) return 0;
-  if (*num++ != XDR_NULL_BYTE_3) return 0;
+  static const char null_bytes[8] = {
+    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
+  };
 
-  if (isFloat) return 1;
-
-  if (*num++ != XDR_NULL_BYTE_4) return 0;
-  if (*num++ != XDR_NULL_BYTE_5) return 0;
-  if (*num++ != XDR_NULL_BYTE_6) return 0;
-  return (*num == XDR_NULL_BYTE_7);
+  return memcmp(num, null_bytes, isFloat ? 4 : 8) == 0;
 }
 
 /*---------------------------------------------------------------------------*/
 
 int
-G3d_isXdrNullFloat  (float *f)
+G3d_isXdrNullFloat  (const float *f)
 
 {
-  return G3d_isXdrNullNum ((unsigned char *) f, 1);
+  return G3d_isXdrNullNum (f, 1);
 }
 
 /*---------------------------------------------------------------------------*/
 
 int
-G3d_isXdrNullDouble  (double *d)
+G3d_isXdrNullDouble  (const double *d)
 
 {
-  return G3d_isXdrNullNum ((unsigned char *) d, 0);
+  return G3d_isXdrNullNum (d, 0);
 }
 
 /*---------------------------------------------------------------------------*/
 
 void
-G3d_setXdrNullNum  (unsigned char *num, int isFloat)
+G3d_setXdrNullNum  (void *num, int isFloat)
 
 {
-  *num++ = XDR_NULL_BYTE_0;
-  *num++ = XDR_NULL_BYTE_1;
-  *num++ = XDR_NULL_BYTE_2;
-  *num++ = XDR_NULL_BYTE_3;
+  static const char null_bytes[8] = {
+    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
+  };
 
-  if (isFloat) return;	
- 
-  *num++ = XDR_NULL_BYTE_4;
-  *num++ = XDR_NULL_BYTE_5;
-  *num++ = XDR_NULL_BYTE_6;
-  *num = XDR_NULL_BYTE_7;
+  memcpy(num, null_bytes, isFloat ? 4 : 8);
 }
   
 /*---------------------------------------------------------------------------*/
@@ -77,7 +57,7 @@
 G3d_setXdrNullDouble  (double *d)
 
 {
-  G3d_setXdrNullNum ((unsigned char *) d, 0);
+  G3d_setXdrNullNum (d, 0);
 }
 
 /*---------------------------------------------------------------------------*/
@@ -86,7 +66,7 @@
 G3d_setXdrNullFloat  (float *f)
 
 {
-  G3d_setXdrNullNum ((unsigned char *) f, 1);
+  G3d_setXdrNullNum (f, 1);
 }
 
 /*---------------------------------------------------------------------------*/
@@ -143,7 +123,7 @@
 
 /*---------------------------------------------------------------------------*/
 
-char *xdrTmp;
+static void *xdrTmp;
 static int dstType, srcType, type, externLength, eltLength, isFloat, useXdr;
 static int (* xdrFun) ();
 static XDR *xdrs;
@@ -178,23 +158,21 @@
 /*---------------------------------------------------------------------------*/
 
 int
-G3d_copyToXdr  (char *src, int nofNum)
+G3d_copyToXdr  (const void *src, int nofNum)
 
 {
-  char *srcLast;
+  int i;
 
   if (useXdr == G3D_NO_XDR) {
     G3d_copyValues (src, 0, srcType, xdrTmp, 0, type, nofNum);
-    xdrTmp += nofNum * G3d_externLength (type);
+    xdrTmp = G_incr_void_ptr(xdrTmp, nofNum * G3d_externLength (type));
     return 1;
   }
 
-  srcLast = src + nofNum * eltLength;
+  for (i = 0 ; i < nofNum ; i++, src = G_incr_void_ptr(src, eltLength)) {
 
-  for ( ; src != srcLast ; src += eltLength) {
-
     if (G3d_isNullValueNum (src, srcType)) {
-      G3d_setXdrNullNum ((unsigned char *) xdrTmp, isFloat);
+      G3d_setXdrNullNum (xdrTmp, isFloat);
       if (! xdr_setpos (xdrs, xdr_getpos (xdrs) + externLength)) {
 	G3d_error ("G3d_copyToXdr: positioning xdr failed");
       return 0;
@@ -217,7 +195,7 @@
       }
     }
 
-    xdrTmp += externLength;
+    xdrTmp = G_incr_void_ptr(xdrTmp, externLength);
   }
 
   return 1;
@@ -254,22 +232,20 @@
 /*---------------------------------------------------------------------------*/
 
 int
-G3d_copyFromXdr  (int nofNum, char *dst)
+G3d_copyFromXdr  (int nofNum, void *dst)
 
 {
-  char *dstLast;
+  int i;
 
   if (useXdr == G3D_NO_XDR) {
     G3d_copyValues (xdrTmp, 0, type, dst, 0, dstType, nofNum);
-    xdrTmp += nofNum * G3d_externLength (type);
+    xdrTmp = G_incr_void_ptr(xdrTmp, nofNum * G3d_externLength (type));
     return 1;
   }
 
-  dstLast = dst + nofNum * eltLength;
+  for (i = 0 ; i < nofNum; i++, dst = G_incr_void_ptr(dst, eltLength)) {
 
-  for ( ; dst != dstLast ; dst += eltLength) {
-
-    if (G3d_isXdrNullNum ((unsigned char *) xdrTmp, isFloat)) {
+    if (G3d_isXdrNullNum (xdrTmp, isFloat)) {
       G3d_setNullValue (dst, 1, dstType);
       if (! xdr_setpos (xdrs, xdr_getpos (xdrs) + externLength)) {
 	G3d_error ("G3d_copyFromXdr: positioning xdr failed");
@@ -293,7 +269,7 @@
       }
     }
 
-    xdrTmp += externLength;
+    xdrTmp = G_incr_void_ptr(xdrTmp, externLength);
   }
 
   return 1;

Modified: grass/branches/develbranch_6/lib/g3d/g3dhistory.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/g3dhistory.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/g3dhistory.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -33,12 +33,8 @@
 #include <grass/glocale.h>
 #include "G3d_intern.h"
 
-/*local prototype */
-void SimpleErrorMessage(FILE * fd, char *name, char *mapset);
-
-
 /*simple error message */
-void SimpleErrorMessage(FILE * fd, char *name, char *mapset)
+void SimpleErrorMessage(FILE * fd, const char *name, const char *mapset)
 {
     if (fd != NULL)
 	fclose(fd);
@@ -64,11 +60,11 @@
  *  \return int
  */
 
-int G3d_readHistory(char *name, char *mapset, struct History *hist)
+int G3d_readHistory(const char *name, const char *mapset, struct History *hist)
 /* This function is adapted from G_read_history */
 {
     FILE *fd;
-    char buff[1024], buf2[200], xname[512], xmapset[512];
+    char buff[1024], buf2[200], xname[GNAME_MAX], xmapset[GMAPSET_MAX];
 
     G_zero(hist, sizeof(struct History));
 
@@ -162,12 +158,12 @@
  *  \return int
  */
 
-int G3d_writeHistory(char *name, struct History *hist)
+int G3d_writeHistory(const char *name, struct History *hist)
 /* This function is adapted from G_write_history */
 {
     FILE *fd;
     int i;
-    char buf[200], buf2[200], xname[512], xmapset[512];
+    char buf[200], buf2[200], xname[GNAME_MAX], xmapset[GMAPSET_MAX];
 
     if (G__name_is_fully_qualified(name, xname, xmapset)) {
 	sprintf(buf, "%s/%s", G3D_DIRECTORY, xname);

Modified: grass/branches/develbranch_6/lib/g3d/g3dintio.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/g3dintio.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/g3dintio.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -9,7 +9,7 @@
 /*---------------------------------------------------------------------------*/
 
 int
-G3d_writeInts  (int fd, int useXdr, int *i, int nofNum)
+G3d_writeInts  (int fd, int useXdr, const int *i, int nofNum)
 
 {
   int firstTime = 1;

Modified: grass/branches/develbranch_6/lib/g3d/g3dkeys.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/g3dkeys.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/g3dkeys.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -1,71 +1,55 @@
 #include <stdio.h>
 #include <string.h>
 #include "G3d_intern.h"
-#include "g3dkeys.h"
 
 /*---------------------------------------------------------------------------*/
 
 int
-G3d_keyGetInt  (struct Key_Value *keys, char *key, int *i)
+G3d_keyGetInt  (struct Key_Value *keys, const char *key, int *i)
 
 {
-  char msg[1024];
   char *str;
 
   if ((str = G_find_key_value (key, keys)) == NULL) {
-    sprintf (msg, 
-	     "G3d_keyGetInt: cannot find field %s in key structure", key);
-    G3d_error (msg);
+    G3d_error ("G3d_keyGetInt: cannot find field %s in key structure", key);
     return 0;
   }
   
-  G_strip(str);
   if (sscanf (str, "%d", i) == 1) return 1;
 
-  sprintf (msg, 
-	   "G3d_keyGetInt: invalid value: field %s in key structure", key);
-  G3d_error (msg);
+  G3d_error ("G3d_keyGetInt: invalid value: field %s in key structure", key);
   return 0;
 }
 
 /*---------------------------------------------------------------------------*/
 
 int
-G3d_keyGetDouble  (struct Key_Value *keys, char *key, double *d)
+G3d_keyGetDouble  (struct Key_Value *keys, const char *key, double *d)
 
 {
-  char msg[1024];
   char *str;
 
   if ((str = G_find_key_value (key, keys)) == NULL) {
-    sprintf (msg, 
-	     "G3d_keyGetDouble: cannot find field %s in key structure", key);
-    G3d_error (msg);
+    G3d_error ("G3d_keyGetDouble: cannot find field %s in key structure", key);
     return 0;
   }
   
-  G_strip(str);
   if (sscanf (str, "%lf", d) == 1) return 1;
 
-  sprintf (msg, 
-	   "G3d_keyGetDouble: invalid value: field %s in key structure", key);
-  G3d_error (msg);
+  G3d_error ("G3d_keyGetDouble: invalid value: field %s in key structure", key);
   return 0;
 }
 
 /*---------------------------------------------------------------------------*/
 
 int
-G3d_keyGetString  (struct Key_Value *keys, char *key, char **returnStr)
+G3d_keyGetString  (struct Key_Value *keys, const char *key, char **returnStr)
 
 {
-  char msg[1024];
   char *str;
 
   if ((str = G_find_key_value (key, keys)) == NULL) {
-    sprintf (msg, 
-	     "G3d_keyGetString: cannot find field %s in key structure", key);
-    G3d_error (msg);
+    G3d_error ("G3d_keyGetString: cannot find field %s in key structure", key);
     return 0;
   }
 
@@ -77,16 +61,13 @@
 /*---------------------------------------------------------------------------*/
 
 int
-G3d_keyGetValue  (struct Key_Value *keys, char *key, char *val1, char *val2, int result1, int result2, int *resultVar)
+G3d_keyGetValue  (struct Key_Value *keys, const char *key, char *val1, char *val2, int result1, int result2, int *resultVar)
 
 {
-  char msg[1024];
   char *str;
 
   if ((str = G_find_key_value (key, keys)) == NULL) {
-    sprintf (msg, 
-	     "G3d_keyGetValue: cannot find field %s in key structure", key);
-    G3d_error (msg);
+    G3d_error ("G3d_keyGetValue: cannot find field %s in key structure", key);
     return 0;
   }
 
@@ -100,16 +81,14 @@
     return 1;
   }
 
-  sprintf (msg, 
-	   "G3d_keyGetValue: invalid type: field %s in key structure", key);
-  G3d_error (msg);
+  G3d_error ("G3d_keyGetValue: invalid type: field %s in key structure", key);
   return 0;
 }
 
 /*---------------------------------------------------------------------------*/
 
 int
-G3d_keySetInt  (struct Key_Value *keys, char *key, int *i)
+G3d_keySetInt  (struct Key_Value *keys, const char *key, const int *i)
 
 {
   char keyValStr[200];
@@ -121,7 +100,7 @@
 /*---------------------------------------------------------------------------*/
 
 int
-G3d_keySetDouble  (struct Key_Value *keys, char *key, double *d)
+G3d_keySetDouble  (struct Key_Value *keys, const char *key, const double *d)
 
 {
   char keyValStr[200];
@@ -133,7 +112,7 @@
 /*---------------------------------------------------------------------------*/
 
 int
-G3d_keySetString  (struct Key_Value *keys, char *key, char **keyValStr)
+G3d_keySetString  (struct Key_Value *keys, const char *key, char * const *keyValStr)
 
 {
   return (G_set_key_value (key, *keyValStr, keys) != 0);
@@ -142,7 +121,7 @@
 /*---------------------------------------------------------------------------*/
 
 int
-G3d_keySetValue  (struct Key_Value *keys, char *key, char *val1, char *val2, int keyval1, int keyval2, int *keyvalVar)
+G3d_keySetValue  (struct Key_Value *keys, const char *key, const char *val1, const char *val2, int keyval1, int keyval2, const int *keyvalVar)
 
 {
   if (*keyvalVar == keyval1) 

Deleted: grass/branches/develbranch_6/lib/g3d/g3dkeys.h
===================================================================
--- grass/branches/develbranch_6/lib/g3d/g3dkeys.h	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/g3dkeys.h	2008-07-31 05:57:23 UTC (rev 32396)
@@ -1,9 +0,0 @@
-int G3d_keyGetInt (/* keys, key, i */);
-int G3d_keyGetDouble (/* keys, key, d */);
-int G3d_keyGetString (/* keys, key, returnStr */);
-int G3d_keyGetValue (/* keys, key, val1, val2, result1, result2, resultVar */);
-
-int G3d_keySetInt (/* keys, key, i */);
-int G3d_keySetDouble (/* keys, key, d */);
-int G3d_keySetString (/* keys, key, keyValStr */);
-int G3d_keySetValue (/* keys, key, val1, val2, keyval1, keyval2, keyvalVar */);

Modified: grass/branches/develbranch_6/lib/g3d/g3dmapset.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/g3dmapset.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/g3dmapset.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -7,10 +7,10 @@
 /*---------------------------------------------------------------------------*/
 
 void
-G3d_makeMapsetMapDirectory  (char *mapName)
+G3d_makeMapsetMapDirectory  (const char *mapName)
 
 {
-  char buf[200];
+  char buf[GNAME_MAX + sizeof(G3D_DIRECTORY) + 2];
 
   sprintf(buf, "%s/%s", G3D_DIRECTORY, mapName);
   G__make_mapset_element (buf);

Modified: grass/branches/develbranch_6/lib/g3d/g3dmask.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/g3dmask.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/g3dmask.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -120,7 +120,7 @@
   top = ((double) z + 0.5) / (double) map->window.depths * 
           (map->window.top - map->window.bottom) + map->window.bottom;
 
-  G3d_getRegionValue (G3d_maskMap, north, east, top, (char *)&value, FCELL_TYPE);
+  G3d_getRegionValue (G3d_maskMap, north, east, top, &value, FCELL_TYPE);
   return value;
 }     
 
@@ -283,7 +283,7 @@
  */
 
 void
-G3d_maskTile  (G3D_Map *map, int tileIndex, char *tile, int type)
+G3d_maskTile  (G3D_Map *map, int tileIndex, void *tile, int type)
 
 {
   int nofNum, rows, cols, depths, xRedundant, yRedundant, zRedundant;
@@ -410,7 +410,7 @@
  *  \return char * 
  */
 
-char * 
+const char * 
 G3d_maskFile (void)
 {
  return G3D_MASK_MAP;

Modified: grass/branches/develbranch_6/lib/g3d/g3dmisc.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/g3dmisc.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/g3dmisc.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/types.h>
 #include <unistd.h>
 #include <rpc/types.h>
@@ -19,59 +20,57 @@
 /*---------------------------------------------------------------------------*/
 
 void
-G3d_copyFloat2Double  (float *src, int offsSrc, double *dst, int offsDst, int nElts)
+G3d_copyFloat2Double  (const float *src, int offsSrc, double *dst, int offsDst, int nElts)
 
 {
-  float *srcStop;
+  int i;
 
   src += offsSrc;
   dst += offsDst;
-  srcStop = src + nElts;
-  while (src != srcStop) *dst++ = *src++;
+
+  for (i = 0; i < nElts; i++)
+    dst[i] = (double) src[i];
 }
 
 /*---------------------------------------------------------------------------*/
 
 void
-G3d_copyDouble2Float  (double *src, int offsSrc, float *dst, int offsDst, int nElts)
+G3d_copyDouble2Float  (const double *src, int offsSrc, float *dst, int offsDst, int nElts)
 
 {
-  double *srcStop;
+  int i;
 
   src += offsSrc;
   dst += offsDst;
-  srcStop = src + nElts;
-  while (src != srcStop) *dst++ = *src++;
+
+  for (i = 0; i < nElts; i++)
+    dst[i] = (float) src[i];
 }
 
 /*---------------------------------------------------------------------------*/
 
 void
-G3d_copyValues  (char *src, int offsSrc, int typeSrc, char *dst, int offsDst, int typeDst, int nElts)
+G3d_copyValues  (const void *src, int offsSrc, int typeSrc, void *dst, int offsDst, int typeDst, int nElts)
 
 {
-  char *srcStop;
   int eltLength;
 
   if ((typeSrc == FCELL_TYPE) && (typeDst == DCELL_TYPE)) {
-    G3d_copyFloat2Double ((float *) src, offsSrc, (double *) dst,
-			  offsDst, nElts);
+    G3d_copyFloat2Double (src, offsSrc, dst, offsDst, nElts);
     return;
   }
   
   if ((typeSrc == DCELL_TYPE) && (typeDst == FCELL_TYPE)) {
-    G3d_copyDouble2Float ((double *) src, offsSrc, (float *) dst,
-			  offsDst, nElts);
+    G3d_copyDouble2Float (src, offsSrc, dst, offsDst, nElts);
     return;
   }
 
   eltLength = G3d_length (typeSrc);
 
-  src += eltLength * offsSrc;
-  dst += eltLength * offsDst;
+  src = G_incr_void_ptr(src, eltLength * offsSrc);
+  dst = G_incr_void_ptr(dst, eltLength * offsDst);
 
-  srcStop = src + nElts * eltLength;
-  while (src != srcStop) *dst++ = *src++;
+  memcpy(dst, src, nElts * eltLength);
 }
 
 /*---------------------------------------------------------------------------*/

Modified: grass/branches/develbranch_6/lib/g3d/g3dnull.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/g3dnull.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/g3dnull.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -7,7 +7,7 @@
 /*---------------------------------------------------------------------------*/
 
 int
-G3d_isNullValueNum  (void *n, int type)
+G3d_isNullValueNum  (const void *n, int type)
 
 {
   if (type == FCELL_TYPE) 

Modified: grass/branches/develbranch_6/lib/g3d/g3dopen2.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/g3dopen2.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/g3dopen2.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -4,7 +4,7 @@
 /*----------------------------------------------------------------------------*/
 
 void *
-G3d_openNewParam  (char *name, int typeIntern, int cache, G3D_Region *region, int type, int doLzw, int doRle, int precision, int tileX, int tileY, int tileZ)
+G3d_openNewParam  (const char *name, int typeIntern, int cache, G3D_Region *region, int type, int doLzw, int doRle, int precision, int tileX, int tileY, int tileZ)
 
 {
   void *map;

Modified: grass/branches/develbranch_6/lib/g3d/g3dparam.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/g3dparam.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/g3dparam.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -159,7 +159,7 @@
 static struct Option *windowParam = NULL;
 
 void
-G3d_setWindowParams()
+G3d_setWindowParams(void)
 
 {
   windowParam = G_define_option();
@@ -173,7 +173,7 @@
 
 /*----------------------------------------------------------------------------*/
 
-char * G3d_getWindowParams()
+char * G3d_getWindowParams(void)
 
 {
   if (windowParam == NULL) return NULL;

Modified: grass/branches/develbranch_6/lib/g3d/g3drange.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/g3drange.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/g3drange.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -10,7 +10,7 @@
 /*---------------------------------------------------------------------------*/
 
 void
-G3d_range_updateFromTile  (G3D_Map *map, char *tile, int rows, int cols, int depths, int xRedundant, int yRedundant, int zRedundant, int nofNum, int type)
+G3d_range_updateFromTile  (G3D_Map *map, const void *tile, int rows, int cols, int depths, int xRedundant, int yRedundant, int zRedundant, int nofNum, int type)
 {
   int y, z, cellType;
   struct FPRange *range;
@@ -27,9 +27,10 @@
     for (z = 0; z < depths; z++) {
       for (y = 0; y < rows; y++) {
 	G_row_update_fp_range (tile, cols, range, cellType);
-	tile += map->tileX * G3d_length (type);
+	tile = G_incr_void_ptr(tile, map->tileX * G3d_length (type));
       }
-      if (yRedundant) tile += map->tileX * yRedundant * G3d_length (type);
+      if (yRedundant)
+	tile = G_incr_void_ptr(tile, map->tileX * yRedundant * G3d_length (type));
     }
     return;
   }
@@ -37,7 +38,7 @@
   if (yRedundant) {
     for (z = 0; z < depths; z++) {
       G_row_update_fp_range (tile, map->tileX * rows, range, cellType);
-      tile += map->tileXY * G3d_length (type);
+      tile = G_incr_void_ptr(tile, map->tileXY * G3d_length (type));
     }
     return;
   }
@@ -52,7 +53,9 @@
  /* adapted from G_read_fp_range */
 {
   int fd;
-  char buf[200], xdr_buf[100], buf2[200], xname[512], xmapset[512];
+  char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
+  char buf[GNAME_MAX + sizeof(G3D_DIRECTORY) + 2], buf2[GMAPSET_MAX + sizeof(G3D_RANGE_ELEMENT) + 2];
+  char xdr_buf[100];
   DCELL dcell1, dcell2;
   XDR xdr_str;
 
@@ -90,8 +93,7 @@
 
 error:
   if (fd > 0) close(fd);
-  sprintf (buf, "can't read range file for [%s in %s]", name, mapset);
-  G_warning (buf);
+  G_warning ("can't read range file for [%s in %s]", name, mapset);
   return -1;
 }
 
@@ -144,11 +146,13 @@
 /*-------------------------------------------------------------------------*/
 
 static int
-writeRange  (char *name, struct FPRange *range)
+writeRange  (const char *name, struct FPRange *range)
  /* adapted from G_write_fp_range */
 {
+  char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
+  char buf[GNAME_MAX + sizeof(G3D_DIRECTORY) + 2], buf2[GMAPSET_MAX + sizeof(G3D_RANGE_ELEMENT) + 2];
+  char xdr_buf[100];
   int fd;
-  char buf[200], xdr_buf[100], buf2[200], xname[512], xmapset[512];
   XDR xdr_str;
 
   if (G__name_is_fully_qualified (name, xname, xmapset)) {

Modified: grass/branches/develbranch_6/lib/g3d/g3dregion.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/g3dregion.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/g3dregion.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -156,7 +156,7 @@
 
 {
   struct Cell_head region2d;
-  char *err;
+  const char *err;
 
   G3d_regionToCellHead (region, &region2d);
   if ( (err = G_adjust_Cell_head3 (&region2d, 1, 1, 1)) != NULL ) {
@@ -187,7 +187,7 @@
 
 {
   struct Cell_head region2d;
-  char *err;
+  const char *err;
 
   G3d_regionToCellHead (region, &region2d);
   if ( (err = G_adjust_Cell_head3 (&region2d, 1, 1, 1)) != NULL ) {
@@ -246,7 +246,7 @@
  */
 
 void
-G3d_getRegionValue  (G3D_Map *map, double north, double east, double top, char *value, int type)
+G3d_getRegionValue  (G3D_Map *map, double north, double east, double top, void *value, int type)
 
 {
   int row, col, depth;
@@ -276,14 +276,14 @@
 /*---------------------------------------------------------------------------*/
 
 int
-G3d_readRegionMap  (char *name, char *mapset, G3D_Region *region)
+G3d_readRegionMap  (const char *name, const char *mapset, G3D_Region *region)
 
 {
-  char fullName[1000];
-  char xname[512], xmapset[512];
+  char fullName[GPATH_MAX];
+  char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
 
   if (G__name_is_fully_qualified (name, xname, xmapset)) 
-    G3d_filename (fullName, G3D_HEADER_ELEMENT, xname, mapset);
+    G3d_filename (fullName, G3D_HEADER_ELEMENT, xname, xmapset);
   else
     G3d_filename (fullName, G3D_HEADER_ELEMENT, name, mapset);
   return G3d_readWindow (region, fullName);

Modified: grass/branches/develbranch_6/lib/g3d/g3dresample.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/g3dresample.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/g3dresample.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -21,7 +21,7 @@
  */
 
 void
-G3d_nearestNeighbor  (G3D_Map *map, int row, int col, int depth, char *value, int type)
+G3d_nearestNeighbor  (G3D_Map *map, int row, int col, int depth, void *value, int type)
 
 {
 

Modified: grass/branches/develbranch_6/lib/g3d/g3dvolume.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/g3dvolume.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/g3dvolume.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -50,14 +50,7 @@
 /*---------------------------------------------------------------------------*/
 
 void
-G3d_getVolumeA (map, u, nx, ny, nz, volumeBuf, type)
-
-     void *map;
-     double u[2][2][2][3];
-     int nx, ny, nz;
-     char *volumeBuf;
-     int type;
-
+G3d_getVolumeA (void *map, double u[2][2][2][3], int nx, int ny, int nz, void *volumeBuf, int type)
 {
   typedef double doubleArray[3];
 
@@ -140,23 +133,13 @@
 /*---------------------------------------------------------------------------*/
 
 void
-G3d_getVolume (map, 
-	       originNorth, originWest, originBottom,
-	       vxNorth, vxWest, vxBottom,
-	       vyNorth, vyWest, vyBottom,
-	       vzNorth, vzWest, vzBottom,
-	       nx, ny, nz,
-	       volumeBuf, type)
-
-     void *map;
-     double originNorth, originWest, originBottom;
-     double vxNorth, vxWest, vxBottom;
-     double vyNorth, vyWest, vyBottom;
-     double vzNorth, vzWest, vzBottom;
-     int nx, ny, nz;
-     char *volumeBuf;
-     int type;
-
+G3d_getVolume (void *map, 
+	       double originNorth, double originWest, double originBottom,
+	       double vxNorth, double vxWest, double vxBottom,
+	       double vyNorth, double vyWest, double vyBottom,
+	       double vzNorth, double vzWest, double vzBottom,
+	       int nx, int ny, int nz,
+	       void *volumeBuf, int type)
 {
   double u[2][2][2][3];
 
@@ -198,19 +181,11 @@
 /*---------------------------------------------------------------------------*/
 
 void
-G3d_getAllignedVolume (map, 
-		       originNorth, originWest, originBottom,
-		       lengthNorth, lengthWest, lengthBottom, 
-		       nx, ny, nz,
-		       volumeBuf, type)
-
-     void *map;
-     double originNorth, originWest, originBottom;
-     double lengthNorth, lengthWest, lengthBottom;
-     int nx, ny, nz;
-     char *volumeBuf;
-     int type;
-
+G3d_getAlignedVolume (void *map, 
+		      double originNorth, double originWest, double originBottom,
+		      double lengthNorth, double lengthWest, double lengthBottom, 
+		      int nx, int ny, int nz,
+		      void *volumeBuf, int type)
 {
   G3d_getVolume (map, 
 		 originNorth, originWest, originBottom, 
@@ -224,28 +199,21 @@
 /*---------------------------------------------------------------------------*/
 
 void
-G3d_makeAllignedVolumeFile (map, fileName,
-			    originNorth, originWest, originBottom,
-			    lengthNorth, lengthWest, lengthBottom, 
-			    nx, ny, nz)
-
-     void *map;
-     char *fileName;
-     double originNorth, originWest, originBottom;
-     double lengthNorth, lengthWest, lengthBottom;
-     int nx, ny, nz;
-    
+G3d_makeAlignedVolumeFile (void *map, const char *fileName,
+			   double originNorth, double originWest, double originBottom,
+			   double lengthNorth, double lengthWest, double lengthBottom, 
+			   int nx, int ny, int nz)
 {
-  char *volumeBuf;
+  void *volumeBuf;
   void *mapVolume;
   int x, y, z, eltLength;
   G3D_Region region;
 
-  volumeBuf = (char *) G3d_malloc (nx * ny * nz * sizeof (G3d_getFileType ()));
+  volumeBuf = G3d_malloc (nx * ny * nz * sizeof (G3d_getFileType ()));
   if (volumeBuf == NULL) 
-    G3d_fatalError ("G3d_makeAllignedVolumeFile: error in G3d_malloc");
+    G3d_fatalError ("G3d_makeAlignedVolumeFile: error in G3d_malloc");
 
-  G3d_getAllignedVolume (map, 
+  G3d_getAlignedVolume (map, 
 			 originNorth, originWest, originBottom,
 			 lengthNorth, lengthWest, lengthBottom, 
 			 nx, ny, nz,
@@ -266,7 +234,7 @@
   mapVolume = G3d_openCellNew (fileName, G3d_getFileType (), 
 			       G3D_USE_CACHE_DEFAULT, &region);
   if (mapVolume == NULL) 
-    G3d_fatalError ("G3d_makeAllignedVolumeFile: error in G3d_openCellNew");
+    G3d_fatalError ("G3d_makeAlignedVolumeFile: error in G3d_openCellNew");
 
   eltLength = G3d_length (G3d_getFileType ());
 
@@ -275,15 +243,15 @@
       for (x = 0; x < nx; x++) {
 /* G3d_putValueRegion? */
 	if (! G3d_putValue (mapVolume, x, y, z, 
-			    volumeBuf + (z * ny * nx + y * nx + x) * eltLength,
+			    G_incr_void_ptr(volumeBuf, (z * ny * nx + y * nx + x) * eltLength),
 			    G3d_fileTypeMap (mapVolume)))
-	  G3d_fatalError ("G3d_makeAllignedVolumeFile: error in G3d_putValue");
+	  G3d_fatalError ("G3d_makeAlignedVolumeFile: error in G3d_putValue");
       }
     }
   }
 
   if (! G3d_closeCell (mapVolume))
-    G3d_fatalError ("G3d_makeAllignedVolumeFile: error in G3d_closeCell");
+    G3d_fatalError ("G3d_makeAlignedVolumeFile: error in G3d_closeCell");
 
   G3d_free (volumeBuf);
 }

Modified: grass/branches/develbranch_6/lib/g3d/g3dwindow.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/g3dwindow.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/g3dwindow.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -193,7 +193,7 @@
 {
   float value;
 
-  G3d_getValue (map, x, y, z, (char *)&value, FCELL_TYPE);
+  G3d_getValue (map, x, y, z, &value, FCELL_TYPE);
   return value;
 }
 
@@ -219,6 +219,6 @@
 {
   double value;
 
-  G3d_getValue (map, x, y, z, (char *)&value, DCELL_TYPE);
+  G3d_getValue (map, x, y, z, &value, DCELL_TYPE);
   return value;
 }

Modified: grass/branches/develbranch_6/lib/g3d/g3dwindowio.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/g3dwindowio.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/g3dwindowio.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -6,7 +6,6 @@
 #include <string.h>
 #include <grass/gis.h>
 #include "G3d_intern.h"
-#include "g3dkeys.h"
 
 /*---------------------------------------------------------------------------*/
 
@@ -55,10 +54,10 @@
  * otherwise G3D_WINDOW_DATABASE ("$MAPSET/windows3d/$NAME")
  */
 static void
-G3d_getFullWindowPath  (char path[1024], char *windowName)
+G3d_getFullWindowPath  (char *path, const char *windowName)
 
 {
-  char xname[512], xmapset[512];
+  char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
 
   if (windowName == NULL) {
     G__file_name (path, "", G3D_WINDOW_ELEMENT, G_mapset ());
@@ -134,7 +133,7 @@
  */
 
 int
-G3d_readWindow  (G3D_Region *window, char *windowName)
+G3d_readWindow  (G3D_Region *window, const char *windowName)
 
 {
   struct Cell_head win;

Modified: grass/branches/develbranch_6/lib/g3d/getblock.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/getblock.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/getblock.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -10,7 +10,7 @@
 G3d_getBlockNocache  (G3D_Map *map, int x0, int y0, int z0, int nx, int ny, int nz, void *block, int type)
 
 {
-  char *tile;
+  void *tile;
   int tileX0, tileY0, tileZ0, tileOffsX0, tileOffsY0, tileOffsZ0;
   int tileX1, tileY1, tileZ1, tileOffsX1, tileOffsY1, tileOffsZ1;
   int tx, ty, tz, dx, dy, dz, x, y, z, rows, cols, depths;
@@ -95,7 +95,7 @@
  */
 
 void
-G3d_getBlock  (G3D_Map *map, int x0, int y0, int z0, int nx, int ny, int nz, char *block, int type)
+G3d_getBlock  (G3D_Map *map, int x0, int y0, int z0, int nx, int ny, int nz, void *block, int type)
 
 {
   int x, y, z, nNull, x1, y1, z1, length;
@@ -115,15 +115,15 @@
     for (y = y0; y < y1; y++) {
       for (x = x0; x < x1; x++) {
 	G3d_getValueRegion (map, x, y, z, block, type);
-	block += length;
+	block = G_incr_void_ptr(block, length);
       }
       nNull = x0 + nx - x;
       G3d_setNullValue (block, nNull, type);
-      block += length * nNull;
+      block = G_incr_void_ptr(block, length * nNull);
     }
     nNull = (y0 + ny - y) * nx;
     G3d_setNullValue (block, nNull, type);
-    block += length * nNull;
+    block = G_incr_void_ptr(block, length * nNull);
   }
   nNull = (z0 + nz - z) * ny * nx;
   G3d_setNullValue (block, nNull, type);

Modified: grass/branches/develbranch_6/lib/g3d/header.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/header.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/header.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -6,13 +6,12 @@
 #include <rpc/xdr.h>
 #include <grass/G3d.h>
 #include "G3d_intern.h"
-#include "g3dkeys.h"
 
 /*---------------------------------------------------------------------------*/
 
-char *tmpCompress = NULL;
+void *tmpCompress;
 int tmpCompressLength;
-char *xdr = NULL;
+void *xdr;
 int xdrLength;
 
 /*---------------------------------------------------------------------------*/
@@ -106,20 +105,18 @@
 
 {
   struct Key_Value *headerKeys;
-  char path[1024], msg[1024];
+  char path[GPATH_MAX];
   int status;
 
   G3d_filename (path, G3D_HEADER_ELEMENT, map->fileName, map->mapset);
   if (access(path, R_OK) != 0) {
-    sprintf (msg,"G3d_readHeader: unable to find [%s]", path);
-    G3d_error (msg);
+    G3d_error ("G3d_readHeader: unable to find [%s]", path);
     return 0;
   }
   
   headerKeys = G_read_key_value_file (path, &status);
   if (status != 0) {
-    sprintf (msg, "G3d_readHeader: Unable to open %s", path);
-    G3d_error (msg);
+    G3d_error ("G3d_readHeader: Unable to open %s", path);
     return 0;
   }
 
@@ -131,9 +128,8 @@
 			     tileX, tileY, tileZ,
 			     type, compression, useRle, useLzw, precision,
 			     dataOffset, useXdr, hasIndex, unit)) {
-    sprintf (msg, "G3d_readHeader: error extracting header key(s) of file %s",
+    G3d_error ("G3d_readHeader: error extracting header key(s) of file %s",
 	     path);
-    G3d_error (msg);
     return 0;
   }
 
@@ -148,7 +144,7 @@
 
 {
   struct Key_Value *headerKeys;
-  char path[1024], msg[1024];
+  char path[GPATH_MAX];
   int status;
 
   headerKeys = G_create_key_value();
@@ -162,9 +158,8 @@
 			     &type, &compression, &useRle, &useLzw, 
 			     &precision, &dataOffset, &useXdr, &hasIndex,
 			     &unit)) {
-    sprintf (msg, "G3d_writeHeader: error adding header key(s) for file %s", 
+    G3d_error ("G3d_writeHeader: error adding header key(s) for file %s", 
 	     path);
-    G3d_error (msg);
     return 0;
   }
 
@@ -176,8 +171,7 @@
 
   if (status == 0) return 1;
 
-  sprintf (msg, "G3d_writeHeader: error writing header file %s", path);
-  G3d_error (msg);
+  G3d_error ("G3d_writeHeader: error writing header file %s", path);
   return 0;
 }
   

Modified: grass/branches/develbranch_6/lib/g3d/retile.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/retile.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/retile.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -7,13 +7,13 @@
 /*---------------------------------------------------------------------------*/
 
 static void
-retileNocache  (void *map, char *nameOut, int tileX, int tileY, int tileZ)
+retileNocache  (void *map, const char *nameOut, int tileX, int tileY, int tileZ)
 
 {
   void *map2;
   int x, y, z, saveType, nx, ny, nz;
   int typeIntern;
-  char *data;
+  void *data;
   int tileXsave, tileYsave, tileZsave;
   G3D_Region region;
 
@@ -71,7 +71,7 @@
  */
 
 void
-G3d_retile  (void *map, char *nameOut, int tileX, int tileY, int tileZ)
+G3d_retile  (void *map, const char *nameOut, int tileX, int tileY, int tileZ)
 
 {
   void *map2;
@@ -124,8 +124,8 @@
     for (y = 0; y < rows; y++)
       for (x = 0; x < cols; x++) {
 
-	G3d_getValueRegion (map, x, y, z, (char *)&value, typeIntern);
-	if (! G3d_putValue(map2, x, y, z, (char *)&value, typeIntern))
+	G3d_getValueRegion (map, x, y, z, &value, typeIntern);
+	if (! G3d_putValue(map2, x, y, z, &value, typeIntern))
 	  G3d_fatalError ("G3d_retile: error in G3d_putValue");
       }
   }

Modified: grass/branches/develbranch_6/lib/g3d/tilealloc.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/tilealloc.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/tilealloc.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -19,20 +19,20 @@
  *  \param map
  *  \param nofTiles
  *  \param type
- *  \return char * : a pointer to the vector ... if successful,
+ *  \return void * : a pointer to the vector ... if successful,
  *                   NULL ... otherwise.
  */
 
-char *
+void *
 G3d_allocTilesType  (G3D_Map *map, int nofTiles, int type)
 
 {
-  char *tiles;
+  void *tiles;
 
   tiles = G3d_malloc (map->tileSize * G3d_length (type) * nofTiles);
   if (tiles == NULL) {
     G3d_error ("G3d_allocTilesType: error in G3d_malloc");
-    return (char *) NULL;
+    return NULL;
   }
 
   return tiles;
@@ -48,19 +48,19 @@
  *
  *  \param map
  *  \param nofTiles
- *  \return char * 
+ *  \return void * 
  */
 
-char *
+void *
 G3d_allocTiles  (G3D_Map *map, int nofTiles)
 
 {
-  char *tiles;
+  void *tiles;
 
   tiles = G3d_allocTilesType (map, nofTiles, map->typeIntern);
   if (tiles == NULL) {
     G3d_error ("G3d_allocTiles: error in G3d_allocTilesType");
-    return (char *) NULL;
+    return NULL;
   }
 
   return tiles;
@@ -79,7 +79,7 @@
  */
 
 void
-G3d_freeTiles  (char *tiles)
+G3d_freeTiles  (void *tiles)
 
 {
   G3d_free (tiles);

Modified: grass/branches/develbranch_6/lib/g3d/tileio.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/tileio.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/tileio.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -66,22 +66,22 @@
  *                 NULL ... otherwise.
  */
 
-char *
+void *
 G3d_getTilePtr  (G3D_Map *map, int tileIndex)
 
 {
-  char *ptr;
+  void *ptr;
 
   if ((tileIndex >= map->nTiles) || (tileIndex < 0)) {
     G3d_error ("G3d_getTilePtr: tileIndex out of range");
-    return (char *) NULL;
+    return NULL;
   } 
 
   if (map->useCache) {
     ptr = G3d_cache_elt_ptr (map->cache, tileIndex);
     if (ptr == NULL) {
       G3d_error ("G3d_getTilePtr: error in G3d_cache_elt_ptr");
-      return (char *) NULL;
+      return NULL;
     } 
     return ptr;
   }
@@ -91,7 +91,7 @@
   map->currentIndex = tileIndex;
   if (! G3d_readTile (map, map->currentIndex, map->data, map->typeIntern)) {
     G3d_error ("G3d_getTilePtr: error in G3d_readTile");
-    return (char *) NULL;
+    return NULL;
   } 
 
   return map->data;

Modified: grass/branches/develbranch_6/lib/g3d/tilenull.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/tilenull.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/tilenull.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -21,7 +21,7 @@
  */
 
 void
-G3d_setNullTileType  (G3D_Map *map, char *tile, int type)
+G3d_setNullTileType  (G3D_Map *map, void *tile, int type)
 
 {
   G3d_setNullValue (tile, map->tileSize, type);
@@ -41,7 +41,7 @@
  */
 
 void
-G3d_setNullTile  (G3D_Map *map, char *tile)
+G3d_setNullTile  (G3D_Map *map, void *tile)
 
 {
   G3d_setNullTileType (map, tile, map->typeIntern);

Modified: grass/branches/develbranch_6/lib/g3d/tileread.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/tileread.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/tileread.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -7,7 +7,7 @@
 #include "G3d_intern.h"
 
 static int
-G3d_xdrTile2tile  (G3D_Map *map, char *tile, int rows, int cols, int depths, int xRedundant, int yRedundant, int zRedundant, int nofNum, int type)
+G3d_xdrTile2tile  (G3D_Map *map, void *tile, int rows, int cols, int depths, int xRedundant, int yRedundant, int zRedundant, int nofNum, int type)
 
 {
   int y, z, xLength, yLength, length;
@@ -36,13 +36,13 @@
 	  G3d_error ("G3d_xdrTile2tile: error in G3d_copyFromXdr");
 	  return 0;
 	}
-	tile += cols * length;
+	tile = G_incr_void_ptr(tile, cols * length);
 	G3d_setNullValue (tile, xRedundant, type);
-	tile += xLength;
+	tile = G_incr_void_ptr(tile, xLength);
       }
       if (yRedundant) {
 	G3d_setNullValue (tile, map->tileX * yRedundant, type);
-	tile += yLength;
+	tile = G_incr_void_ptr(tile, yLength);
       }
     }
     if (! zRedundant) return 1;
@@ -57,9 +57,9 @@
 	G3d_error ("G3d_xdrTile2tile: error in G3d_copyFromXdr");
 	return 0;
       }
-      tile += map->tileX * rows * length;
+      tile = G_incr_void_ptr(tile, map->tileX * rows * length);
       G3d_setNullValue (tile, map->tileX * yRedundant, type);
-      tile += yLength;
+      tile = G_incr_void_ptr(tile, yLength);
     }
     if (! zRedundant) return 1;
 
@@ -74,7 +74,7 @@
 
   if (! zRedundant) return 1;
 
-  tile += map->tileXY * depths * length;
+  tile = G_incr_void_ptr(tile, map->tileXY * depths * length);
   G3d_setNullValue (tile, map->tileXY * zRedundant, type);
 
   return 1;
@@ -141,7 +141,7 @@
  */
 
  int
-G3d_readTile  (G3D_Map *map, int tileIndex, char *tile, int type)
+G3d_readTile  (G3D_Map *map, int tileIndex, void *tile, int type)
 
 {
   int nofNum, rows, cols, depths, xRedundant, yRedundant, zRedundant;
@@ -202,7 +202,7 @@
  */
 
 int
-G3d_readTileFloat  (G3D_Map *map, int tileIndex, char *tile)
+G3d_readTileFloat  (G3D_Map *map, int tileIndex, void *tile)
 
 {
   if (! G3d_readTile (map, tileIndex, tile, FCELL_TYPE)) {
@@ -228,7 +228,7 @@
  */
 
 int
-G3d_readTileDouble  (G3D_Map *map, int tileIndex, char *tile)
+G3d_readTileDouble  (G3D_Map *map, int tileIndex, void *tile)
 
 {
   if (! G3d_readTile (map, tileIndex, tile, DCELL_TYPE)) {

Modified: grass/branches/develbranch_6/lib/g3d/tilewrite.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/tilewrite.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/tilewrite.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -10,7 +10,7 @@
 /*---------------------------------------------------------------------------*/
 
 static int
-G3d_tile2xdrTile  (G3D_Map *map, char *tile, int rows, int cols, int depths, int xRedundant, int yRedundant, int zRedundant, int nofNum, int type)
+G3d_tile2xdrTile  (G3D_Map *map, const void *tile, int rows, int cols, int depths, int xRedundant, int yRedundant, int zRedundant, int nofNum, int type)
 
 {
   int y, z;
@@ -36,10 +36,10 @@
 	  G3d_error ("G3d_tile2xdrTile: error in G3d_copyToXdr");
 	  return 0;
 	}
-	tile += map->tileX * G3d_length (type);
+	tile = G_incr_void_ptr(tile, map->tileX * G3d_length (type));
       }
       if (yRedundant) 
-	tile += map->tileX * yRedundant * G3d_length (type);
+	tile = G_incr_void_ptr(tile, map->tileX * yRedundant * G3d_length (type));
     }
     return 1;
   }
@@ -50,7 +50,7 @@
 	G3d_error ("G3d_tile2xdrTile: error in G3d_copyToXdr");
 	return 0;
       }
-      tile += map->tileXY * G3d_length (type);
+      tile = G_incr_void_ptr(tile, map->tileXY * G3d_length (type));
     }
     return 1;
   }
@@ -124,7 +124,7 @@
  */
 
 int
-G3d_writeTile  (G3D_Map *map, int tileIndex, char *tile, int type)
+G3d_writeTile  (G3D_Map *map, int tileIndex, const void *tile, int type)
 
 {
   int rows, cols, depths, xRedundant, yRedundant, zRedundant, nofNum;
@@ -190,7 +190,7 @@
  */
 
 int
-G3d_writeTileFloat  (G3D_Map *map, int tileIndex, char *tile)
+G3d_writeTileFloat  (G3D_Map *map, int tileIndex, const void *tile)
 
 {
   int status;
@@ -216,7 +216,7 @@
  */
 
 int
-G3d_writeTileDouble  (G3D_Map *map, int tileIndex, char *tile)
+G3d_writeTileDouble  (G3D_Map *map, int tileIndex, const void *tile)
 
 {
   int status;
@@ -255,7 +255,7 @@
 G3d_flushTile  (G3D_Map *map, int tileIndex)
 
 {
-  char *tile;
+  const void *tile;
 
   tile = G3d_getTilePtr (map, tileIndex);
   if (tile == NULL) {
@@ -540,7 +540,7 @@
  */
 
 int
-G3d_putValue  (G3D_Map *map, int x, int y, int z, char *value, int type)
+G3d_putValue  (G3D_Map *map, int x, int y, int z, const void *value, int type)
 
 {
   if (type == FCELL_TYPE) {

Modified: grass/branches/develbranch_6/lib/g3d/writeascii.c
===================================================================
--- grass/branches/develbranch_6/lib/g3d/writeascii.c	2008-07-31 05:48:39 UTC (rev 32395)
+++ grass/branches/develbranch_6/lib/g3d/writeascii.c	2008-07-31 05:57:23 UTC (rev 32396)
@@ -16,7 +16,7 @@
  */
 
 void
-G3d_writeAscii  (void *map, char *fname)
+G3d_writeAscii  (void *map, const char *fname)
 
 {
   FILE *fp;
@@ -41,7 +41,7 @@
     for (y = 0; y < rows; y++) {
       fprintf (fp, "z y x %d %d (%d - %d)\n", z, y, 0, cols - 1);
       for (x = 0; x < cols; x++) {
-	G3d_getValueRegion (map, x, y, z, (char *)d1p, typeIntern);
+	G3d_getValueRegion (map, x, y, z, d1p, typeIntern);
 	
 	if (typeIntern == FCELL_TYPE)
 	  fprintf (fp, "%.18f ", *f1p);



More information about the grass-commit mailing list