[GRASS-SVN] r45541 - in grass/trunk: include lib/gis lib/vector/Vlib
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Mar 3 14:45:58 EST 2011
Author: martinl
Date: 2011-03-03 11:45:57 -0800 (Thu, 03 Mar 2011)
New Revision: 45541
Modified:
grass/trunk/include/gisdefs.h
grass/trunk/lib/gis/strings.c
grass/trunk/lib/vector/Vlib/field.c
Log:
vlib: field.c: normalize path for Windows
+G_str_replace(): input buffer as const
(merge r45538 from relbr64)
Modified: grass/trunk/include/gisdefs.h
===================================================================
--- grass/trunk/include/gisdefs.h 2011-03-03 19:45:04 UTC (rev 45540)
+++ grass/trunk/include/gisdefs.h 2011-03-03 19:45:57 UTC (rev 45541)
@@ -577,7 +577,7 @@
int G_strcasecmp(const char *, const char *);
char *G_store(const char *);
char *G_strchg(char *, char, char);
-char *G_str_replace(char *, const char *, const char *);
+char *G_str_replace(const char *, const char *, const char *);
void G_strip(char *);
char *G_chop(char *);
void G_str_to_upper(char *);
Modified: grass/trunk/lib/gis/strings.c
===================================================================
--- grass/trunk/lib/gis/strings.c 2011-03-03 19:45:04 UTC (rev 45540)
+++ grass/trunk/lib/gis/strings.c 2011-03-03 19:45:57 UTC (rev 45541)
@@ -127,15 +127,14 @@
* G_free (name);
* \endcode
*
- * \param[in,out] buffer main string
- * \param[in] old_str string to replace
- * \param[in] new_str new string
+ * \param buffer input string buffer
+ * \param old_str string to be replaced
+ * \param new_str new string
*
* \return the newly allocated string, input buffer is unchanged
*/
-char *G_str_replace(char *buffer, const char *old_str, const char *new_str)
+char *G_str_replace(const char *buffer, const char *old_str, const char *new_str)
{
-
char *B, *R;
const char *N;
char *replace;
Modified: grass/trunk/lib/vector/Vlib/field.c
===================================================================
--- grass/trunk/lib/vector/Vlib/field.c 2011-03-03 19:45:04 UTC (rev 45540)
+++ grass/trunk/lib/vector/Vlib/field.c 2011-03-03 19:45:57 UTC (rev 45541)
@@ -844,8 +844,15 @@
G_debug(3, "Vect_subst_var(): in = %s, map = %s, mapset = %s", in,
Map->name, Map->mapset);
+#ifdef __MINGW32__
+ char *cin;
+ cin = G_str_replace(in, "/", "\\");
+ strcpy(str, cin);
+ G_free(cin);
+#else
strcpy(str, in);
-
+#endif
+
strcpy(buf, str);
c = (char *)strstr(buf, "$GISDBASE");
if (c != NULL) {
More information about the grass-commit
mailing list