[GRASS-SVN] r39136 - in grass/trunk: include include/vect lib/vector/diglib

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Sep 12 02:17:35 EDT 2009


Author: glynn
Date: 2009-09-12 02:17:35 -0400 (Sat, 12 Sep 2009)
New Revision: 39136

Modified:
   grass/trunk/include/gis.h
   grass/trunk/include/vect/dig_externs.h
   grass/trunk/lib/vector/diglib/angle.c
   grass/trunk/lib/vector/diglib/cindex_rw.c
   grass/trunk/lib/vector/diglib/head.c
   grass/trunk/lib/vector/diglib/plus_struct.c
Log:
Fix diglib warnings


Modified: grass/trunk/include/gis.h
===================================================================
--- grass/trunk/include/gis.h	2009-09-12 06:16:51 UTC (rev 39135)
+++ grass/trunk/include/gis.h	2009-09-12 06:17:35 UTC (rev 39136)
@@ -53,6 +53,12 @@
 #define FALSE 0
 #endif
 
+#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64
+#define PRI_OFF_T	"lld"
+#else
+#define PRI_OFF_T	"ld"
+#endif
+
 #define NEWLINE     '\n'
 
 #define METERS    1

Modified: grass/trunk/include/vect/dig_externs.h
===================================================================
--- grass/trunk/include/vect/dig_externs.h	2009-09-12 06:16:51 UTC (rev 39135)
+++ grass/trunk/include/vect/dig_externs.h	2009-09-12 06:17:35 UTC (rev 39136)
@@ -16,9 +16,9 @@
 
 char *color_name(int);		/* pass it an int, returns the name of the color */
 
-float dig_calc_begin_angle(struct line_pnts *, double);
-float dig_calc_end_angle(struct line_pnts *, double);
-int dig_line_degenerate(struct line_pnts *);
+float dig_calc_begin_angle(const struct line_pnts *, double);
+float dig_calc_end_angle(const struct line_pnts *, double);
+int dig_line_degenerate(const struct line_pnts *);
 char *dig_float_point(char *, int, double);
 
 /* double dig_point_in_area (struct Map_info *, double, double, struct P_area *); */
@@ -95,7 +95,7 @@
 int dig_isle_set_box(struct Plus_head *, plus_t, struct bound_box *);
 int dig_isle_get_box(struct Plus_head *, plus_t, struct bound_box *);
 
-int dig_is_line_degenerate(struct line_pnts *, double);
+int dig_is_line_degenerate(const struct line_pnts *, double);
 
 /* int dig_check_nodes (struct Map_info *, struct new_node *, struct line_pnts *);
    int dig_in_area_bbox (struct P_area *, double, double); */

Modified: grass/trunk/lib/vector/diglib/angle.c
===================================================================
--- grass/trunk/lib/vector/diglib/angle.c	2009-09-12 06:16:51 UTC (rev 39135)
+++ grass/trunk/lib/vector/diglib/angle.c	2009-09-12 06:17:35 UTC (rev 39136)
@@ -29,17 +29,17 @@
 
 static double d_atan2(double, double);
 
-float dig_calc_begin_angle(struct line_pnts *points, double thresh)
+float dig_calc_begin_angle(const struct line_pnts *points, double thresh)
 {
     double last_x;
     double last_y;
-    double *xptr;
-    double *yptr;
+    const double *xptr;
+    const double *yptr;
     int short_line;
     int i;
     int n_points;
-    double *xarray;
-    double *yarray;
+    const double *xarray;
+    const double *yarray;
 
     /* temporary way to set up use of struct line_pnts */
     n_points = points->n_points;
@@ -80,17 +80,17 @@
     return ((float)d_atan2(*yptr - last_y, *xptr - last_x));
 }				/*  calc_begin_angle()  */
 
-float dig_calc_end_angle(struct line_pnts *points, double thresh)
+float dig_calc_end_angle(const struct line_pnts *points, double thresh)
 {
     double last_x;
     double last_y;
-    double *xptr;
-    double *yptr;
+    const double *xptr;
+    const double *yptr;
     int short_line;
     int i;
     int n_points;
-    double *xarray;
-    double *yarray;
+    const double *xarray;
+    const double *yarray;
 
     short_line = 1;
 
@@ -133,17 +133,17 @@
     return ((float)d_atan2(*yptr - last_y, *xptr - last_x));
 }
 
-int dig_is_line_degenerate(struct line_pnts *points, double thresh)
+int dig_is_line_degenerate(const struct line_pnts *points, double thresh)
 {
     double last_x;
     double last_y;
-    double *xptr;
-    double *yptr;
+    const double *xptr;
+    const double *yptr;
     int short_line;
     int i;
     int n_points;
-    double *xarray;
-    double *yarray;
+    const double *xarray;
+    const double *yarray;
 
     /* temporary way to set up use of struct line_pnts */
     n_points = points->n_points;
@@ -178,7 +178,7 @@
  *           1 one point
  *           2 more identical points
  */
-int dig_line_degenerate(struct line_pnts *points)
+int dig_line_degenerate(const struct line_pnts *points)
 {
     int i, ident;
     int n_points;

Modified: grass/trunk/lib/vector/diglib/cindex_rw.c
===================================================================
--- grass/trunk/lib/vector/diglib/cindex_rw.c	2009-09-12 06:16:51 UTC (rev 39135)
+++ grass/trunk/lib/vector/diglib/cindex_rw.c	2009-09-12 06:17:35 UTC (rev 39136)
@@ -66,7 +66,7 @@
 
 	ci = &(plus->cidx[i]);
 
-	G_debug(3, "cidx %d head offset: %ld", i, dig_ftell(fp));
+	G_debug(3, "cidx %d head offset: %"PRI_OFF_T, i, dig_ftell(fp));
 
 	/* Field number */
 	if (0 >= dig__fwrite_port_I(&(ci->field), 1, fp))
@@ -102,10 +102,10 @@
 	/* Offset */
 	if (0 >= dig__fwrite_port_O(&(ci->offset), 1, fp, plus->off_t_size))
 	    return (0);
-	G_debug(3, "cidx %d offset: %ld", i, ci->offset);
+	G_debug(3, "cidx %d offset: %"PRI_OFF_T, i, ci->offset);
     }
 
-    G_debug(3, "cidx body offset %ld", dig_ftell(fp));
+    G_debug(3, "cidx body offset %"PRI_OFF_T, dig_ftell(fp));
 
     return (0);
 }

Modified: grass/trunk/lib/vector/diglib/head.c
===================================================================
--- grass/trunk/lib/vector/diglib/head.c	2009-09-12 06:16:51 UTC (rev 39135)
+++ grass/trunk/lib/vector/diglib/head.c	2009-09-12 06:17:35 UTC (rev 39136)
@@ -54,7 +54,7 @@
 	return (0);
 
     /* bytes 11 - 18 : size of coordinate file */
-    G_debug(1, "write coor size (%ld) to head", Map->head.size);
+    G_debug(1, "write coor size (%"PRI_OFF_T") to head", Map->head.size);
     if (Map->head.head_size >= GV_COOR_HEAD_SIZE + 4) {
 	if (Map->head.size > PORT_LONG_MAX) {
 	    /* can only happen when sizeof(off_t) == 8 */
@@ -76,7 +76,7 @@
 	    return (0);
     }
 
-    G_debug(2, "coor body offset %ld", dig_ftell(&(Map->dig_fp)));
+    G_debug(2, "coor body offset %"PRI_OFF_T, dig_ftell(&(Map->dig_fp)));
     return (1);
 }
 
@@ -150,7 +150,7 @@
 	if (0 >= dig__fread_port_O(&(Map->head.size), 1, &(Map->dig_fp), 4))
 	    return (0);
     }
-    G_debug(2, "  coor size %ld", Map->head.size);
+    G_debug(2, "  coor size %"PRI_OFF_T, Map->head.size);
 
     /* Go to end of header, file may be written by new version of GRASS with longer header */
 

Modified: grass/trunk/lib/vector/diglib/plus_struct.c
===================================================================
--- grass/trunk/lib/vector/diglib/plus_struct.c	2009-09-12 06:16:51 UTC (rev 39135)
+++ grass/trunk/lib/vector/diglib/plus_struct.c	2009-09-12 06:17:35 UTC (rev 39136)
@@ -713,7 +713,7 @@
     if (0 >= dig__fread_port_O(&(ptr->coor_size), 1, fp, ptr->off_t_size))
 	return (-1);
 
-    G_debug(2, "  coor size %ld", ptr->coor_size);
+    G_debug(2, "  coor size %"PRI_OFF_T, ptr->coor_size);
 
     dig_fseek(fp, ptr->head_size, SEEK_SET);
 
@@ -826,7 +826,7 @@
     if (0 >= dig__fwrite_port_O(&(ptr->coor_size), 1, fp, ptr->off_t_size))
 	return (-1);
 
-    G_debug(2, "topo body offset %ld", dig_ftell(fp));
+    G_debug(2, "topo body offset %"PRI_OFF_T, dig_ftell(fp));
 
     return (0);
 }



More information about the grass-commit mailing list