[GRASS-SVN] r55400 - grass/trunk/lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Mar 16 07:20:57 PDT 2013


Author: martinl
Date: 2013-03-16 07:20:57 -0700 (Sat, 16 Mar 2013)
New Revision: 55400

Modified:
   grass/trunk/lib/gis/file_name.c
   grass/trunk/lib/gis/mapset_msc.c
   grass/trunk/lib/gis/open.c
   grass/trunk/lib/gis/tempfile.c
Log:
gislib: add some extra debug messages


Modified: grass/trunk/lib/gis/file_name.c
===================================================================
--- grass/trunk/lib/gis/file_name.c	2013-03-16 11:40:01 UTC (rev 55399)
+++ grass/trunk/lib/gis/file_name.c	2013-03-16 14:20:57 UTC (rev 55400)
@@ -56,6 +56,9 @@
 
     G_free(location);
 
+    if (!element && !pname)
+        return path;
+    
     if (element && *element) {
 	strcat(path, "/");
 	strcat(path, element);
@@ -66,6 +69,8 @@
 	strcat(path, pname);
     }
 
+    G_debug(2, "G_file_name(): path = %s", path);
+    
     return path;
 }
 

Modified: grass/trunk/lib/gis/mapset_msc.c
===================================================================
--- grass/trunk/lib/gis/mapset_msc.c	2013-03-16 11:40:01 UTC (rev 55399)
+++ grass/trunk/lib/gis/mapset_msc.c	2013-03-16 14:20:57 UTC (rev 55400)
@@ -42,7 +42,7 @@
     if (*element == 0)
 	return 0;
 
-    G_file_name(p = path, "", "", G_mapset());
+    G_file_name(p = path, NULL, NULL, G_mapset());
     while (*p)
 	p++;
     /* add trailing slash if missing */

Modified: grass/trunk/lib/gis/open.c
===================================================================
--- grass/trunk/lib/gis/open.c	2013-03-16 11:40:01 UTC (rev 55399)
+++ grass/trunk/lib/gis/open.c	2013-03-16 14:20:57 UTC (rev 55400)
@@ -191,7 +191,7 @@
   \param name map file name
 
   \return open file descriptor (FILE *)
-  \return NULL could not open
+  \return NULL on error
  */
 
 FILE *G_fopen_new(const char *element, const char *name)
@@ -199,9 +199,13 @@
     int fd;
 
     fd = G__open(element, name, G_mapset(), 1);
-    if (fd < 0)
+    if (fd < 0) {
+        G_debug(1, "G_fopen_new(): element = %s, name = %s : NULL",
+                element, name);
 	return (FILE *) 0;
+    }
 
+    G_debug(2, "\tfile open: new (mode = w)");
     return fdopen(fd, "w");
 }
 
@@ -221,7 +225,7 @@
   \param mapset mapset name containing map <i>name</i>
 
   \return open file descriptor (FILE *)
-  \return NULL could not open
+  \return NULL on error
 */
 FILE *G_fopen_old(const char *element, const char *name, const char *mapset)
 {
@@ -231,6 +235,7 @@
     if (fd < 0)
 	return (FILE *) NULL;
 
+    G_debug(2, "\tfile open: read (mode = r)");
     return fdopen(fd, "r");
 }
 
@@ -247,7 +252,7 @@
   \param name map file name
 
   \return open file descriptor (FILE *)
-  \return NULL could not open
+  \return NULL on error
 */
 FILE *G_fopen_append(const char *element, const char *name)
 {
@@ -258,6 +263,7 @@
 	return (FILE *) 0;
     lseek(fd, 0L, SEEK_END);
 
+    G_debug(2, "\tfile open: append (mode = a)");
     return fdopen(fd, "a");
 }
 
@@ -274,7 +280,7 @@
   \param name map file name
 
   \return open file descriptor (FILE *)
-  \return NULL
+  \return NULL on error
 */
 FILE *G_fopen_modify(const char *element, const char *name)
 {
@@ -285,5 +291,6 @@
 	return (FILE *) 0;
     lseek(fd, 0L, SEEK_END);
 
+    G_debug(2, "\tfile open: modify (mode = r+)");
     return fdopen(fd, "r+");
 }

Modified: grass/trunk/lib/gis/tempfile.c
===================================================================
--- grass/trunk/lib/gis/tempfile.c	2013-03-16 11:40:01 UTC (rev 55399)
+++ grass/trunk/lib/gis/tempfile.c	2013-03-16 14:20:57 UTC (rev 55400)
@@ -1,5 +1,5 @@
 /*!
- * \file gis/tempfile.c
+ * \file lib/gis/tempfile.c
  *
  * \brief GIS Library - Temporary file functions.
  *



More information about the grass-commit mailing list