فهرست منبع

Fix diglib warnings

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@39136 15284696-431f-4ddb-bdfa-cd5b030d7da7
Glynn Clements 15 سال پیش
والد
کامیت
c4b11e9e03
6فایلهای تغییر یافته به همراه34 افزوده شده و 28 حذف شده
  1. 6 0
      include/gis.h
  2. 4 4
      include/vect/dig_externs.h
  3. 16 16
      lib/vector/diglib/angle.c
  4. 3 3
      lib/vector/diglib/cindex_rw.c
  5. 3 3
      lib/vector/diglib/head.c
  6. 2 2
      lib/vector/diglib/plus_struct.c

+ 6 - 0
include/gis.h

@@ -53,6 +53,12 @@ static const char *GRASS_copyright __attribute__ ((unused))
 #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

+ 4 - 4
include/vect/dig_externs.h

@@ -16,9 +16,9 @@ int dig_list_add(struct ilist *, int);
 
 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_area_get_box(struct Plus_head *, plus_t, struct bound_box *);
 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); */

+ 16 - 16
lib/vector/diglib/angle.c

@@ -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 @@ float dig_calc_begin_angle(struct line_pnts *points, double thresh)
     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 @@ float dig_calc_end_angle(struct line_pnts *points, double thresh)
     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 @@ int dig_is_line_degenerate(struct line_pnts *points, double thresh)
  *           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;

+ 3 - 3
lib/vector/diglib/cindex_rw.c

@@ -66,7 +66,7 @@ int dig_write_cidx_head(struct gvfile * fp, struct Plus_head *plus)
 
 	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 @@ int dig_write_cidx_head(struct gvfile * fp, struct Plus_head *plus)
 	/* 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);
 }

+ 3 - 3
lib/vector/diglib/head.c

@@ -54,7 +54,7 @@ int dig__write_head(struct Map_info *Map)
 	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 @@ int dig__write_head(struct Map_info *Map)
 	    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 @@ int dig__read_head(struct Map_info *Map)
 	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 */
 

+ 2 - 2
lib/vector/diglib/plus_struct.c

@@ -713,7 +713,7 @@ int dig_Rd_Plus_head(struct gvfile * fp, struct Plus_head *ptr)
     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 @@ int dig_Wr_Plus_head(struct gvfile * fp, struct Plus_head *ptr)
     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);
 }