summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Wildemann <gta04@metalstrolche.de>2019-10-31 14:33:17 +0100
committerStefan Wildemann <gta04@metalstrolche.de>2019-10-31 14:33:17 +0100
commit556057bcfb9c040d98e7f769fa7cffbb84014eb3 (patch)
tree7a01b1f7c43ef9e200dbe7b37cb552dfba5f4459
parenta24633b7ff62c4647be3de4d848721699d2d8236 (diff)
downloadnavit-556057bcfb9c040d98e7f769fa7cffbb84014eb3.tar.gz
fix:various remove compiler warnings.
-rw-r--r--navit/geom.c8
-rw-r--r--navit/geom.h25
-rw-r--r--navit/gui/internal/gui_internal_keyboard.c2
-rw-r--r--navit/map/binfile/binfile.c2
-rw-r--r--navit/map/shapefile/shapefile.c6
-rw-r--r--navit/map/textfile/textfile.c5
-rw-r--r--navit/maptool/osm.c9
7 files changed, 36 insertions, 21 deletions
diff --git a/navit/geom.c b/navit/geom.c
index e4b28fbd3..e118338dd 100644
--- a/navit/geom.c
+++ b/navit/geom.c
@@ -191,7 +191,8 @@ int geom_poly_point_inside(struct coord *cp, int count, struct coord *c) {
-GList *geom_poly_segments_insert(GList *list, struct geom_poly_segment *first, struct geom_poly_segment *second, struct geom_poly_segment *third) {
+GList *geom_poly_segments_insert(GList *list, struct geom_poly_segment *first, struct geom_poly_segment *second,
+ struct geom_poly_segment *third) {
int count;
struct geom_poly_segment *ret;
struct coord *pos;
@@ -226,7 +227,8 @@ GList *geom_poly_segments_insert(GList *list, struct geom_poly_segment *first, s
return list;
}
-void geom_poly_segment_destroy(struct geom_poly_segment *seg) {
+/* unused id for GFunc compatibiliy */
+void geom_poly_segment_destroy(struct geom_poly_segment *seg, void * unused) {
g_free(seg->first);
g_free(seg);
}
@@ -234,7 +236,7 @@ void geom_poly_segment_destroy(struct geom_poly_segment *seg) {
GList *geom_poly_segments_remove(GList *list, struct geom_poly_segment *seg) {
if (seg) {
list=g_list_remove(list, seg);
- geom_poly_segment_destroy(seg);
+ geom_poly_segment_destroy(seg, NULL);
}
return list;
}
diff --git a/navit/geom.h b/navit/geom.h
index 9de2e6d86..5969d86ef 100644
--- a/navit/geom.h
+++ b/navit/geom.h
@@ -32,21 +32,23 @@ extern "C" {
#define sq(x) ((double)(x)*(x))
-struct rect {struct coord l,h;};
+struct rect {
+ struct coord l,h;
+};
enum geom_poly_segment_type {
- geom_poly_segment_type_none,
- geom_poly_segment_type_way_inner,
- geom_poly_segment_type_way_outer,
- geom_poly_segment_type_way_left_side,
- geom_poly_segment_type_way_right_side,
- geom_poly_segment_type_way_unknown,
+ geom_poly_segment_type_none,
+ geom_poly_segment_type_way_inner,
+ geom_poly_segment_type_way_outer,
+ geom_poly_segment_type_way_left_side,
+ geom_poly_segment_type_way_right_side,
+ geom_poly_segment_type_way_unknown,
};
struct geom_poly_segment {
- enum geom_poly_segment_type type;
- struct coord *first,*last;
+ enum geom_poly_segment_type type;
+ struct coord *first,*last;
};
/* prototypes */
void geom_coord_copy(struct coord *from, struct coord *to, int count, int reverse);
@@ -56,8 +58,9 @@ long long geom_poly_area(struct coord *c, int count);
int geom_poly_centroid(struct coord *c, int count, struct coord *r);
int geom_poly_point_inside(struct coord *cp, int count, struct coord *c);
int geom_poly_closest_point(struct coord *pl, int count, struct coord *p, struct coord *c);
-GList *geom_poly_segments_insert(GList *list, struct geom_poly_segment *first, struct geom_poly_segment *second, struct geom_poly_segment *third);
-void geom_poly_segment_destroy(struct geom_poly_segment *seg);
+GList *geom_poly_segments_insert(GList *list, struct geom_poly_segment *first, struct geom_poly_segment *second,
+ struct geom_poly_segment *third);
+void geom_poly_segment_destroy(struct geom_poly_segment *seg, void * unused);
GList *geom_poly_segments_remove(GList *list, struct geom_poly_segment *seg);
int geom_poly_segment_compatible(struct geom_poly_segment *s1, struct geom_poly_segment *s2, int dir);
GList *geom_poly_segments_sort(GList *in, enum geom_poly_segment_type type);
diff --git a/navit/gui/internal/gui_internal_keyboard.c b/navit/gui/internal/gui_internal_keyboard.c
index 19e48c468..00cd8fa64 100644
--- a/navit/gui/internal/gui_internal_keyboard.c
+++ b/navit/gui/internal/gui_internal_keyboard.c
@@ -801,7 +801,7 @@ struct widget * gui_internal_keyboard_show_native(struct gui_priv *this, struct
switch(res) {
case -1:
dbg(lvl_error, "graphics has no show_native_keyboard method, cannot display keyboard");
- /* no break */
+ /* fall through */
case 0:
g_free(kbd);
return NULL;
diff --git a/navit/map/binfile/binfile.c b/navit/map/binfile/binfile.c
index 18a4166b1..865e3d72b 100644
--- a/navit/map/binfile/binfile.c
+++ b/navit/map/binfile/binfile.c
@@ -2326,7 +2326,7 @@ static void binmap_search_destroy(struct map_search_priv *ms) {
if (ms->mr)
map_rect_destroy_binfile(ms->mr);
while(ms->boundaries) {
- geom_poly_segment_destroy(ms->boundaries->data);
+ geom_poly_segment_destroy(ms->boundaries->data, NULL);
ms->boundaries=g_list_delete_link(ms->boundaries,ms->boundaries);
}
g_free(ms);
diff --git a/navit/map/shapefile/shapefile.c b/navit/map/shapefile/shapefile.c
index df4d64ea5..1031b6903 100644
--- a/navit/map/shapefile/shapefile.c
+++ b/navit/map/shapefile/shapefile.c
@@ -171,7 +171,8 @@ static void longest_match_add_match(struct longest_match *lm, struct longest_mat
lmi->match_idx[lmi->match_idx_count++]=idx;
}
-static void longest_match_item_destroy(struct longest_match_list_item *lmi, long flags) {
+static void longest_match_item_destroy(struct longest_match_list_item *lmi, gpointer p_flags) {
+ long flags = (long) p_flags;
if (!lmi)
return;
if (flags & 2) {
@@ -195,7 +196,8 @@ static struct longest_match_list *longest_match_list_new(struct longest_match *l
return ret;
}
-static void longest_match_list_destroy(struct longest_match_list *lml, long flags) {
+static void longest_match_list_destroy(struct longest_match_list *lml, gpointer p_flags) {
+ long flags = (long) p_flags;
if (!lml)
return;
if (flags & 1) {
diff --git a/navit/map/textfile/textfile.c b/navit/map/textfile/textfile.c
index a7310e224..12381d6c0 100644
--- a/navit/map/textfile/textfile.c
+++ b/navit/map/textfile/textfile.c
@@ -50,7 +50,10 @@ static void get_line(struct map_rect_priv *mr) {
mr->pos=ftell(mr->f);
else
mr->pos+=mr->lastlen;
- fgets(mr->line, TEXTFILE_LINE_SIZE, mr->f);
+ if(fgets(mr->line, TEXTFILE_LINE_SIZE, mr->f) == NULL) {
+ dbg(lvl_error, "Unable to get line (%s)", strerror(errno));
+ mr->line[0]=0;
+ }
dbg(lvl_debug,"read textfile line: %s", mr->line);
remove_comment_line(mr->line);
mr->lastlen=strlen(mr->line)+1;
diff --git a/navit/maptool/osm.c b/navit/maptool/osm.c
index c6308c2b4..ddf4e99a1 100644
--- a/navit/maptool/osm.c
+++ b/navit/maptool/osm.c
@@ -2592,6 +2592,11 @@ static void process_associated_streets_setup(FILE *in, struct relations *relatio
relations_add_relation_default_entry(relations, relations_func);
}
+/* to adapt g_free to GFunc */
+static void g_free_helper(void * data, void * user_data) {
+ g_free(data);
+}
+
void process_associated_streets(FILE *in, struct files_relation_processing *files_relproc) {
struct relations *relations=relations_new();
struct process_relation_member_func_priv fp= {NULL,NULL};
@@ -2618,7 +2623,7 @@ void process_associated_streets(FILE *in, struct files_relation_processing *file
}
relations_destroy(relations);
- g_list_foreach(fp.allocations, (GFunc)free, NULL);
+ g_list_foreach(fp.allocations, (GFunc)g_free_helper, NULL);
g_list_free(fp.allocations);
}
@@ -2674,7 +2679,7 @@ void process_house_number_interpolations(FILE *in, struct files_relation_process
}
relations_destroy(relations);
- g_list_foreach(fp.allocations, (GFunc)free, NULL);
+ g_list_foreach(fp.allocations, (GFunc)g_free_helper, NULL);
g_list_free(fp.allocations);
}