summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Wildemann <metalstrolch@users.noreply.github.com>2019-11-05 12:14:01 +0100
committerjkoan <jkoan@users.noreply.github.com>2019-11-05 12:14:01 +0100
commitfbe6d4cf832a9af1846a75834c8a392eee984cb7 (patch)
tree96164622a1847c3d4c02c450f0fd6c2cbf0ed534
parent39f745bc282c45443deef8e13b381f207207da58 (diff)
downloadnavit-fbe6d4cf832a9af1846a75834c8a392eee984cb7.tar.gz
fix:various:fix compiler warnings (#940)
* fix:core:build without warnings on my setup navit_core build without non avoidable warnings. * fix:dbus:fix compiler warnings * fix:gui/internal: remov compiler warnings * fix:various:remove compiler warnings * fix:various remove compiler warnings. * fix:various: fix android compiler warnings
-rw-r--r--navit/binding/dbus/binding_dbus.c13
-rw-r--r--navit/font/freetype/font_freetype.c20
-rw-r--r--navit/geom.c8
-rw-r--r--navit/geom.h25
-rw-r--r--navit/graphics/opengl/graphics_opengl.c23
-rw-r--r--navit/gui/gtk/destination.c11
-rw-r--r--navit/gui/gtk/gui_gtk_statusbar.c23
-rw-r--r--navit/gui/internal/gui_internal.c6
-rw-r--r--navit/gui/internal/gui_internal_command.c205
-rw-r--r--navit/gui/internal/gui_internal_command.h2
-rw-r--r--navit/gui/internal/gui_internal_html.c1
-rw-r--r--navit/gui/internal/gui_internal_keyboard.c2
-rw-r--r--navit/gui/internal/gui_internal_search.c3
-rw-r--r--navit/gui/internal/gui_internal_widget.c8
-rw-r--r--navit/gui/qml/navitProxy.h270
-rw-r--r--navit/map/binfile/binfile.c2
-rw-r--r--navit/map/filter/filter.c6
-rw-r--r--navit/map/shapefile/shapefile.c6
-rw-r--r--navit/map/textfile/textfile.c5
-rw-r--r--navit/maptool/osm.c9
-rw-r--r--navit/osd/core/osd_core.c29
-rw-r--r--navit/roadprofile.c2
-rw-r--r--navit/roadprofile.h10
-rw-r--r--navit/speech/qt5_espeak/Qt5EspeakAudioOut.cpp7
-rw-r--r--navit/traffic/traff_android/traffic_traff_android.c3
-rw-r--r--navit/vehicle.c2
-rw-r--r--navit/vehicle.h8
-rw-r--r--navit/vehicleprofile.c7
-rw-r--r--navit/vehicleprofile.h53
29 files changed, 419 insertions, 350 deletions
diff --git a/navit/binding/dbus/binding_dbus.c b/navit/binding/dbus/binding_dbus.c
index 84ed7fe00..3470bdd4e 100644
--- a/navit/binding/dbus/binding_dbus.c
+++ b/navit/binding/dbus/binding_dbus.c
@@ -626,13 +626,13 @@ static char *get_iter_name(char *type) {
}
static DBusHandlerResult request_attr_iter(DBusConnection *connection, DBusMessage *message, char *type,
- struct attr_iter *(*func)(void)) {
+ struct attr_iter *(*func)(void*)) {
DBusMessage *reply;
char *iter_name;
char *opath;
struct attr_iter *attr_iter;
- attr_iter=(*func)();
+ attr_iter=(*func)(NULL);
iter_name=get_iter_name(type);
opath=object_new(iter_name,attr_iter);
g_free(iter_name);
@@ -833,7 +833,7 @@ static DBusHandlerResult request_config_get_attr(DBusConnection *connection, DBu
}
static DBusHandlerResult request_config_attr_iter(DBusConnection *connection, DBusMessage *message) {
- return request_attr_iter(connection, message, "config", (struct attr_iter * (*)(void))config_attr_iter_new);
+ return request_attr_iter(connection, message, "config", (struct attr_iter * (*)(void*))config_attr_iter_new);
}
static DBusHandlerResult request_config_attr_iter_destroy(DBusConnection *connection, DBusMessage *message) {
@@ -941,7 +941,7 @@ static DBusHandlerResult request_map_dump(DBusConnection *connection, DBusMessag
/* mapset */
static DBusHandlerResult request_mapset_attr_iter(DBusConnection *connection, DBusMessage *message) {
- return request_attr_iter(connection, message, "mapset", (struct attr_iter * (*)(void))mapset_attr_iter_new);
+ return request_attr_iter(connection, message, "mapset", (struct attr_iter * (*)(void*))mapset_attr_iter_new);
}
static DBusHandlerResult request_mapset_attr_iter_destroy(DBusConnection *connection, DBusMessage *message) {
@@ -986,7 +986,7 @@ static DBusHandlerResult request_roadprofile_set_attr(DBusConnection *connection
}
static DBusHandlerResult request_roadprofile_attr_iter(DBusConnection *connection, DBusMessage *message) {
- return request_attr_iter(connection, message, "roadprofile", (struct attr_iter * (*)(void))roadprofile_attr_iter_new);
+ return request_attr_iter(connection, message, "roadprofile", (struct attr_iter * (*)(void*))roadprofile_attr_iter_new);
}
static DBusHandlerResult request_roadprofile_attr_iter_destroy(DBusConnection *connection, DBusMessage *message) {
@@ -1232,6 +1232,7 @@ static DBusHandlerResult request_navit_traffic_export_gpx(DBusConnection *connec
" xmlns='http://www.topografix.com/GPX/1/1'\n"
" xsi:schemaLocation='http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd'>\n";
char *trailer = "</gpx>\n";
+ memset(&c_last, 0, sizeof(c_last));
navit = object_get_from_message(message, "navit");
if (! navit)
@@ -1955,7 +1956,7 @@ static DBusHandlerResult request_vehicleprofile_set_attr(DBusConnection *connect
static DBusHandlerResult request_vehicleprofile_attr_iter(DBusConnection *connection, DBusMessage *message) {
return request_attr_iter(connection, message, "vehicleprofile",
- (struct attr_iter * (*)(void))vehicleprofile_attr_iter_new);
+ (struct attr_iter * (*)(void*))vehicleprofile_attr_iter_new);
}
static DBusHandlerResult request_vehicleprofile_attr_iter_destroy(DBusConnection *connection, DBusMessage *message) {
diff --git a/navit/font/freetype/font_freetype.c b/navit/font/freetype/font_freetype.c
index bb3a88d21..e96bdce48 100644
--- a/navit/font/freetype/font_freetype.c
+++ b/navit/font/freetype/font_freetype.c
@@ -86,7 +86,8 @@ static int library_init = 0;
static int library_deinit = 0;
-static void font_freetype_get_text_bbox(struct graphics_priv *gr, struct font_freetype_font *font, char *text, int dx, int dy, struct point *ret, int estimate) {
+static void font_freetype_get_text_bbox(struct graphics_priv *gr, struct font_freetype_font *font, char *text, int dx,
+ int dy, struct point *ret, int estimate) {
char *p = text;
FT_BBox bbox;
FT_UInt glyph_index;
@@ -233,8 +234,12 @@ static struct font_freetype_text *font_freetype_text_new(char *text, struct font
#else
fribidi_charset_to_unicode(FRIBIDI_CHAR_SET_UTF8, text, textlen, unicode_text);
#endif
- fribidi_log2vis(unicode_text, unicode_len, &base, visual_unicode_text, NULL, NULL, NULL);
- // TODO: check return value
+ /* fribidi_log2vis seems to be deprecated, but I don't know what to replace it with */
+ if(fribidi_log2vis(unicode_text, unicode_len, &base, visual_unicode_text, NULL, NULL, NULL) == 0) {
+ dbg(lvl_error,"fribidi_log2vis error condition detected. Try to recover");
+ /* error condition. Continue withthe original unicode text instead */
+ memcpy(visual_unicode_text, unicode_text, sizeof(unicode_text));
+ }
#ifdef FRIBIDIOLD
fribidi_unicode_to_utf8(visual_unicode_text, unicode_len, visual_text);
#else
@@ -362,7 +367,8 @@ static FT_Error face_requester( FTC_FaceID face_id, FT_Library library, FT_Point
#endif
/** Implementation of font_freetype_methods.font_new */
-static struct font_freetype_font *font_freetype_font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, char *fontfamily, int size, int flags) {
+static struct font_freetype_font *font_freetype_font_new(struct graphics_priv *gr, struct graphics_font_methods *meth,
+ char *fontfamily, int size, int flags) {
struct font_freetype_font *font =
g_new(struct font_freetype_font, 1);
int exact, found=0;
@@ -503,7 +509,8 @@ static struct font_freetype_font *font_freetype_font_new(struct graphics_priv *g
}
/** Implementation of font_freetype_methods.get_shadow. */
-static int font_freetype_glyph_get_shadow(struct font_freetype_glyph *g, unsigned char *data, int stride, struct color *foreground, struct color *background) {
+static int font_freetype_glyph_get_shadow(struct font_freetype_glyph *g, unsigned char *data, int stride,
+ struct color *foreground, struct color *background) {
int x, y, w = g->w, h = g->h;
unsigned int bg, fg;
unsigned char *pm, *psp,*ps,*psn;
@@ -555,7 +562,8 @@ static int font_freetype_glyph_get_shadow(struct font_freetype_glyph *g, unsigne
}
/** Implementation of font_freetype_methods.get_glyph. */
-static int font_freetype_glyph_get_glyph(struct font_freetype_glyph *g, unsigned char *data, int stride, struct color *fg, struct color *bg, struct color *transparent) {
+static int font_freetype_glyph_get_glyph(struct font_freetype_glyph *g, unsigned char *data, int stride,
+ struct color *fg, struct color *bg, struct color *transparent) {
int x, y, w = g->w, h = g->h;
unsigned int tr;
unsigned char v,vi,*pm, *ps;
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/graphics/opengl/graphics_opengl.c b/navit/graphics/opengl/graphics_opengl.c
index 2789061f1..09292b306 100644
--- a/navit/graphics/opengl/graphics_opengl.c
+++ b/navit/graphics/opengl/graphics_opengl.c
@@ -350,9 +350,12 @@ static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics
return gc;
}
+#ifdef HAVE_FREEIMAGE
static struct graphics_image_priv image_error;
+#endif
-static struct graphics_image_priv *image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *path, int *w, int *h, struct point *hot, int rotation) {
+static struct graphics_image_priv *image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *path,
+ int *w, int *h, struct point *hot, int rotation) {
#ifdef HAVE_FREEIMAGE
FIBITMAP *image;
RGBQUAD aPixel;
@@ -797,7 +800,8 @@ static void draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc
graphics_priv_root->dirty = 1;
}
-static void display_text_draw(struct font_freetype_text *text, struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, int color, struct point *p) {
+static void display_text_draw(struct font_freetype_text *text, struct graphics_priv *gr, struct graphics_gc_priv *fg,
+ struct graphics_gc_priv *bg, int color, struct point *p) {
int i, x, y, stride;
struct font_freetype_glyph *g, **gp;
unsigned char *shadow, *glyph;
@@ -927,7 +931,8 @@ static void display_text_draw(struct font_freetype_text *text, struct graphics_p
}
}
-static void draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy) {
+static void draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg,
+ struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy) {
if ((gr->parent && !gr->parent->overlay_enabled)
|| (gr->parent && gr->parent->overlay_enabled
&& !gr->overlay_enabled)) {
@@ -955,7 +960,8 @@ static void draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, str
}
-static void draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img) {
+static void draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p,
+ struct graphics_image_priv *img) {
#ifdef USE_OPENGLES
draw_image_es(gr, p, img->w, img->h, img->data);
#else
@@ -1159,7 +1165,8 @@ static void *get_data(struct graphics_priv *this, const char *type) {
this->platform=graphics_opengl_egl_new(this->window_system_methods->get_display(this->window_system),
this->window_system_methods->get_window(this->window_system),
&this->platform_methods);
- this->window_system_methods->set_callbacks(this->window_system, this, resize_callback_do, click_notify_do, motion_notify_do, NULL);
+ this->window_system_methods->set_callbacks(this->window_system, this, resize_callback_do, click_notify_do,
+ motion_notify_do, NULL);
resize_callback(this->width,this->height);
#if 0
glClearColor ( 0.4, 0.4, 0.4, 1);
@@ -1398,7 +1405,8 @@ static void motion_notify(int x, int y) {
static gboolean graphics_opengl_idle(void *data) {
static int opengl_init_ok = 0;
if (!opengl_init_ok) {
- callback_list_call_attr_2(graphics_priv_root->cbl, attr_resize, GINT_TO_POINTER (graphics_priv_root->width), GINT_TO_POINTER (graphics_priv_root->height));
+ callback_list_call_attr_2(graphics_priv_root->cbl, attr_resize, GINT_TO_POINTER (graphics_priv_root->width),
+ GINT_TO_POINTER (graphics_priv_root->height));
opengl_init_ok = 1;
} else {
@@ -1494,7 +1502,8 @@ static void glut_close(void) {
}
-static struct graphics_priv *graphics_opengl_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl) {
+static struct graphics_priv *graphics_opengl_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs,
+ struct callback_list *cbl) {
struct attr *attr;
if (!event_request_system("glib", "graphics_opengl_new"))
diff --git a/navit/gui/gtk/destination.c b/navit/gui/gtk/destination.c
index 6a0fbb5b7..34c840200 100644
--- a/navit/gui/gtk/destination.c
+++ b/navit/gui/gtk/destination.c
@@ -33,7 +33,9 @@
#include "projection.h"
#include "navit_nls.h"
#include "bookmarks.h"
-
+#ifndef _WIN32
+#include <errno.h>
+#endif
#define COL_COUNT 8
static struct search_param {
@@ -78,7 +80,6 @@ static void button_map(GtkWidget *widget, struct search_param *search) {
GtkTreeViewColumn *focus_column;
struct pcoord *point=NULL; /* A pointer on the geographical position of the selected map point */
GtkTreeIter iter;
- char *label;
GList* p;
gtk_tree_view_get_cursor(GTK_TREE_VIEW(search->treeview), &path, &focus_column);
@@ -368,6 +369,7 @@ static void parse_xkbd_args (const char *cmd, char **argv) {
bufp = buf;
break;
}
+ /* fall through */
default:
*bufp++ = *p;
break;
@@ -399,7 +401,10 @@ static int spawn_xkbd (char *xkbd_path, char *xkbd_str) {
int a = 0;
size_t n;
- pipe (fd);
+ if(pipe (fd) < 0) {
+ dbg(lvl_error,"Unable to create pipe (%s). Do not try to spawn keyboard.", strerror(errno));
+ return 0;
+ }
kbd_pid = fork ();
if (kbd_pid == 0) {
close (fd[0]);
diff --git a/navit/gui/gtk/gui_gtk_statusbar.c b/navit/gui/gtk/gui_gtk_statusbar.c
index f245312d1..e67201b56 100644
--- a/navit/gui/gtk/gui_gtk_statusbar.c
+++ b/navit/gui/gtk/gui_gtk_statusbar.c
@@ -38,7 +38,7 @@
struct statusbar_priv {
struct gui_priv *gui;
GtkWidget *hbox;
- char gps_text[128];
+ char gps_text[500];
GtkWidget *gps;
char route_text[128];
GtkWidget *route;
@@ -88,7 +88,7 @@ static void statusbar_route_update(struct statusbar_priv *this, struct navit *na
double route_len=0; /* Distance to destination. We get it in kilometers. */
time_t eta;
struct tm *eta_tm=NULL;
- char buffer[128];
+ char buffer[109];
double lng, lat, direction=0, height=0, speed=0, hdop=0;
int sats=0, qual=0;
int status=0;
@@ -155,15 +155,16 @@ static void statusbar_route_update(struct statusbar_priv *this, struct navit *na
qual=attr.u.num;
coord_format(lat,lng,DEGREES_MINUTES_SECONDS,buffer,sizeof(buffer));
- sprintf(this->gps_text,"GPS:%s %02d/%02d HD:%02.2f %s %4.0f%s %3.0f°%-2s %3.1f%s",
- status_fix2str(status),
- sats, qual, hdop, buffer,
- imperial ? height * FEET_PER_METER : height,
- imperial == TRUE ? "\'" : "m",
- direction, dir,
- imperial == TRUE ? speed * KILOMETERS_TO_MILES : speed,
- imperial == TRUE ? " mph" : "km/h"
- );
+ snprintf(this->gps_text,sizeof(this->gps_text),"GPS:%s %02d/%02d HD:%02.2f %s %4.0f%s %3.0f°%-2s %3.1f%s",
+ status_fix2str(status),
+ sats, qual, hdop, buffer,
+ imperial ? height * FEET_PER_METER : height,
+ imperial == TRUE ? "\'" : "m",
+ direction, dir,
+ imperial == TRUE ? speed * KILOMETERS_TO_MILES : speed,
+ imperial == TRUE ? " mph" : "km/h"
+ );
+ this->gps_text[sizeof(this->gps_text)-1] = 0;
gtk_label_set_text(GTK_LABEL(this->gps), this->gps_text);
}
diff --git a/navit/gui/internal/gui_internal.c b/navit/gui/internal/gui_internal.c
index 61756b485..d9fea2d28 100644
--- a/navit/gui/internal/gui_internal.c
+++ b/navit/gui/internal/gui_internal.c
@@ -1641,6 +1641,7 @@ char *gui_internal_cmd_match_expand(char *pattern, struct attr **in) {
break;
case '\\':
p=*pattern++;
+ /* fall through */
default:
*r++=p;
}
@@ -1662,6 +1663,7 @@ static int gui_internal_match(const char *pattern, const char *string) {
break;
case '\\':
p=*pattern++;
+ /* fall through */
default:
if (*string++ != p)
return 0;
@@ -1705,7 +1707,7 @@ int gui_internal_set(char *remove, char *add) {
static void gui_internal_window_closed(struct gui_priv *this) {
- gui_internal_cmd2_quit(this, NULL, NULL, NULL, NULL);
+ gui_internal_cmd2_quit(this, NULL, NULL, NULL);
}
@@ -1914,7 +1916,7 @@ static int gui_internal_is_active_vehicle(struct gui_priv *this, struct vehicle
static void save_vehicle_xml(struct vehicle *v) {
struct attr attr;
- struct attr_iter *iter=vehicle_attr_iter_new();
+ struct attr_iter *iter=vehicle_attr_iter_new(NULL);
int childs=0;
printf("<vehicle");
while (vehicle_get_attr(v, attr_any_xml, &attr, iter)) {
diff --git a/navit/gui/internal/gui_internal_command.c b/navit/gui/internal/gui_internal_command.c
index ffd795b7d..73def7b18 100644
--- a/navit/gui/internal/gui_internal_command.c
+++ b/navit/gui/internal/gui_internal_command.c
@@ -41,16 +41,15 @@
#include <arpa/inet.h>
#endif
-static void gui_internal_cmd_escape(struct gui_priv *this, char *function, struct attr **in, struct attr ***out,
- int *valid) {
+static int gui_internal_cmd_escape(struct gui_priv *this, char *function, struct attr **in, struct attr ***out) {
struct attr escaped;
if (!in || !in[0]) {
dbg(lvl_error,"first parameter missing or wrong type");
- return;
+ return 0;
}
if (!out) {
dbg(lvl_error,"output missing");
- return;
+ return 0;
}
if (ATTR_IS_STRING(in[0]->type)) {
escaped.type=in[0]->type;
@@ -60,15 +59,15 @@ static void gui_internal_cmd_escape(struct gui_priv *this, char *function, struc
escaped.u.str=g_strdup_printf("%ld",in[0]->u.num);
} else {
dbg(lvl_error,"first parameter wrong type");
- return;
+ return 0;
}
dbg(lvl_debug,"in %s result %s",in[0]->u.str,escaped.u.str);
*out=attr_generic_add_attr(*out, attr_dup(&escaped));
g_free(escaped.u.str);
+ return 0;
}
-static void gui_internal_cmd2_about(struct gui_priv *this, char *function, struct attr **in, struct attr ***out,
- int *valid) {
+static int gui_internal_cmd2_about(struct gui_priv *this, char *function, struct attr **in, struct attr ***out) {
struct widget *menu,*wb,*w;
char *text;
@@ -134,15 +133,15 @@ static void gui_internal_cmd2_about(struct gui_priv *this, char *function, struc
gui_internal_menu_render(this);
graphics_draw_mode(this->gra, draw_mode_end);
+ return 0;
}
-static void gui_internal_cmd2_waypoints(struct gui_priv *this, char *function, struct attr **in, struct attr ***out,
- int *valid) {
+static int gui_internal_cmd2_waypoints(struct gui_priv *this, char *function, struct attr **in, struct attr ***out) {
gui_internal_select_waypoint(this, _("Waypoints"), NULL, NULL, gui_internal_cmd_position, (void*)2);
+ return 0;
}
-static void gui_internal_cmd_enter_coord(struct gui_priv *this, char *function, struct attr **in, struct attr ***out,
- int *valid) {
+static int gui_internal_cmd_enter_coord(struct gui_priv *this, char *function, struct attr **in, struct attr ***out) {
struct widget *w, *wb, *wk, *wr, *we, *wnext, *row;
wb=gui_internal_menu(this, _("Enter Coordinates"));
w=gui_internal_box_new(this, gravity_center|orientation_vertical|flags_expand|flags_fill);
@@ -183,18 +182,18 @@ static void gui_internal_cmd_enter_coord(struct gui_priv *this, char *function,
else
gui_internal_keyboard_show_native(this, w, VKBD_DEGREE, NULL);
gui_internal_menu_render(this);
+ return 0;
}
-static void gui_internal_cmd2_town(struct gui_priv *this, char *function, struct attr **in, struct attr ***out,
- int *valid) {
+static int gui_internal_cmd2_town(struct gui_priv *this, char *function, struct attr **in, struct attr ***out) {
if (this->sl)
search_list_select(this->sl, attr_country_all, 0, 0);
gui_internal_search(this,_("Town"),"Town",1);
+ return 0;
}
-static void gui_internal_cmd2_setting_vehicle(struct gui_priv *this, char *function, struct attr **in,
- struct attr ***out,
- int *valid) {
+static int gui_internal_cmd2_setting_vehicle(struct gui_priv *this, char *function, struct attr **in,
+ struct attr ***out) {
struct attr attr,attr2,vattr;
struct widget *w,*wb,*wl;
struct attr_iter *iter;
@@ -205,7 +204,7 @@ static void gui_internal_cmd2_setting_vehicle(struct gui_priv *this, char *funct
vehicle_get_attr(attr.u.vehicle, attr_name, &vattr, NULL);
navit_attr_iter_destroy(iter);
gui_internal_menu_vehicle_settings(this, attr.u.vehicle, vattr.u.str);
- return;
+ return 0;
}
navit_attr_iter_destroy(iter);
@@ -227,10 +226,11 @@ static void gui_internal_cmd2_setting_vehicle(struct gui_priv *this, char *funct
}
navit_attr_iter_destroy(iter);
gui_internal_menu_render(this);
+ return 0;
}
-static void gui_internal_cmd2_setting_rules(struct gui_priv *this, char *function, struct attr **in, struct attr ***out,
- int *valid) {
+static int gui_internal_cmd2_setting_rules(struct gui_priv *this, char *function, struct attr **in,
+ struct attr ***out) {
struct widget *wb,*w;
struct attr on,off;
wb=gui_internal_menu(this, _("Rules"));
@@ -264,10 +264,10 @@ static void gui_internal_cmd2_setting_rules(struct gui_priv *this, char *functio
gravity_left_center|orientation_horizontal|flags_fill,
&on, &off));
gui_internal_menu_render(this);
+ return 0;
}
-static void gui_internal_cmd2_setting_maps(struct gui_priv *this, char *function, struct attr **in, struct attr ***out,
- int *valid) {
+static int gui_internal_cmd2_setting_maps(struct gui_priv *this, char *function, struct attr **in, struct attr ***out) {
struct attr attr, on, off, description, type, data, url, active;
struct widget *w,*wb,*row,*wma;
char *label;
@@ -309,12 +309,11 @@ static void gui_internal_cmd2_setting_maps(struct gui_priv *this, char *function
}
navit_attr_iter_destroy(iter);
gui_internal_menu_render(this);
-
+ return 0;
}
-static void gui_internal_cmd2_setting_layout(struct gui_priv *this, char *function, struct attr **in,
- struct attr ***out,
- int *valid) {
+static int gui_internal_cmd2_setting_layout(struct gui_priv *this, char *function, struct attr **in,
+ struct attr ***out) {
struct attr attr;
struct widget *w,*wb,*wl,*row;
struct attr_iter *iter;
@@ -333,6 +332,7 @@ static void gui_internal_cmd2_setting_layout(struct gui_priv *this, char *functi
}
navit_attr_iter_destroy(iter);
gui_internal_menu_render(this);
+ return 0;
}
/*
@@ -345,9 +345,8 @@ static void gui_internal_cmd2_setting_layout(struct gui_priv *this, char *functi
* comply with *.heightlines.bin
*
*/
-static void gui_internal_cmd2_route_height_profile(struct gui_priv *this, char *function, struct attr **in,
- struct attr ***out,
- int *valid) {
+static int gui_internal_cmd2_route_height_profile(struct gui_priv *this, char *function, struct attr **in,
+ struct attr ***out) {
struct widget * menu, *box;
struct map * map=NULL;
struct map_rect * mr=NULL;
@@ -431,7 +430,7 @@ static void gui_internal_cmd2_route_height_profile(struct gui_priv *this, char *
w->flags=gravity_bottom_center|orientation_horizontal|flags_fill;
g_free(text);
gui_internal_menu_render(this);
- return;
+ return 0;
}
}
}
@@ -497,7 +496,7 @@ static void gui_internal_cmd2_route_height_profile(struct gui_priv *this, char *
gui_internal_menu_render(this);
if(diagram_points)
g_free(diagram_points);
- return;
+ return 0;
}
gui_internal_menu_render(this);
@@ -559,11 +558,11 @@ static void gui_internal_cmd2_route_height_profile(struct gui_priv *this, char *
diagram_points=diagram_points->next;
g_free(diagram_point);
}
+ return 0;
}
-static void gui_internal_cmd2_route_description(struct gui_priv *this, char *function, struct attr **in,
- struct attr ***out,
- int *valid) {
+static int gui_internal_cmd2_route_description(struct gui_priv *this, char *function, struct attr **in,
+ struct attr ***out) {
struct widget * menu;
@@ -598,11 +597,10 @@ static void gui_internal_cmd2_route_description(struct gui_priv *this, char *fun
gui_internal_widget_append(menu,box);
gui_internal_populate_route_table(this,this->nav);
gui_internal_menu_render(this);
-
+ return 0;
}
-static void gui_internal_cmd2_pois(struct gui_priv *this, char *function, struct attr **in, struct attr ***out,
- int *valid) {
+static int gui_internal_cmd2_pois(struct gui_priv *this, char *function, struct attr **in, struct attr ***out) {
struct widget *w;
struct poi_param *param;
struct attr pro;
@@ -610,11 +608,11 @@ static void gui_internal_cmd2_pois(struct gui_priv *this, char *function, struct
dbg(lvl_debug,"enter");
if (!in || !in[0])
- return;
+ return 0;
if (!ATTR_IS_COORD_GEO(in[0]->type))
- return;
+ return 0;
if (!navit_get_attr(this->nav, attr_projection, &pro, NULL))
- return;
+ return 0;
w=g_new0(struct widget,1);
param=g_new0(struct poi_param,1);
if (in[1] && ATTR_IS_STRING(in[1]->type)) {
@@ -630,10 +628,10 @@ static void gui_internal_cmd2_pois(struct gui_priv *this, char *function, struct
gui_internal_cmd_pois(this, w, param);
g_free(w);
gui_internal_poi_param_free(param);
+ return 0;
}
-static void gui_internal_cmd2_locale(struct gui_priv *this, char *function, struct attr **in, struct attr ***out,
- int *valid) {
+static int gui_internal_cmd2_locale(struct gui_priv *this, char *function, struct attr **in, struct attr ***out) {
struct widget *menu,*wb,*w;
char *text;
@@ -676,6 +674,7 @@ static void gui_internal_cmd2_locale(struct gui_priv *this, char *function, stru
gui_internal_menu_render(this);
graphics_draw_mode(this->gra, draw_mode_end);
+ return 0;
}
/**
@@ -688,8 +687,7 @@ static void gui_internal_cmd2_locale(struct gui_priv *this, char *function, stru
* Currently only works on non Windows systems.
*
*/
-static void gui_internal_cmd2_network_info(struct gui_priv *this, char *function, struct attr **in, struct attr ***out,
- int *valid) {
+static int gui_internal_cmd2_network_info(struct gui_priv *this, char *function, struct attr **in, struct attr ***out) {
#if HAS_IFADDRS
struct widget *menu,*wb,*w;
char *text;
@@ -723,10 +721,10 @@ static void gui_internal_cmd2_network_info(struct gui_priv *this, char *function
#else
dbg(lvl_error, "Cannot show network info: ifaddr.h not found");
#endif
+ return 0;
}
-static void gui_internal_cmd_formerdests(struct gui_priv *this, char *function, struct attr **in, struct attr ***out,
- int *valid) {
+static int gui_internal_cmd_formerdests(struct gui_priv *this, char *function, struct attr **in, struct attr ***out) {
struct widget *wb,*w,*wbm,*tbl=NULL;
struct map *formerdests;
struct map_rect *mr_formerdests;
@@ -736,15 +734,15 @@ static void gui_internal_cmd_formerdests(struct gui_priv *this, char *function,
enum projection projection;
if(!navit_get_attr(this->nav, attr_former_destination_map, &attr, NULL))
- return;
+ return 0;
formerdests=attr.u.map;
if(!formerdests)
- return;
+ return 0;
mr_formerdests=map_rect_new(formerdests, NULL);
if(!mr_formerdests)
- return;
+ return 0;
projection = map_projection(formerdests);
@@ -790,46 +788,48 @@ static void gui_internal_cmd_formerdests(struct gui_priv *this, char *function,
}
gui_internal_menu_render(this);
map_rect_destroy(mr_formerdests);
+ return 0;
}
-static void gui_internal_cmd2_bookmarks(struct gui_priv *this, char *function, struct attr **in, struct attr ***out,
- int *valid) {
+static int gui_internal_cmd2_bookmarks(struct gui_priv *this, char *function, struct attr **in, struct attr ***out) {
char *str=NULL;
if (in && in[0] && ATTR_IS_STRING(in[0]->type)) {
str=in[0]->u.str;
}
gui_internal_cmd_bookmarks(this, NULL, str);
+ return 0;
}
-static void gui_internal_cmd2_abort_navigation(struct gui_priv *this, char *function, struct attr **in,
- struct attr ***out,
- int *valid) {
+static int gui_internal_cmd2_abort_navigation(struct gui_priv *this, char *function, struct attr **in,
+ struct attr ***out) {
navit_set_destination(this->nav, NULL, NULL, 0);
+ return 0;
}
-static void gui_internal_cmd2_back(struct gui_priv *this, char *function, struct attr **in, struct attr ***out,
- int *valid) {
+static int gui_internal_cmd2_back(struct gui_priv *this, char *function, struct attr **in, struct attr ***out) {
graphics_draw_mode(this->gra, draw_mode_begin);
gui_internal_back(this, NULL, NULL);
graphics_draw_mode(this->gra, draw_mode_end);
gui_internal_check_exit(this);
+ return 0;
}
-static void gui_internal_cmd2_back_to_map(struct gui_priv *this, char *function, struct attr **in, struct attr ***out,
- int *valid) {
+static int gui_internal_cmd2_back_to_map(struct gui_priv *this, char *function, struct attr **in, struct attr ***out) {
gui_internal_prune_menu(this, NULL);
gui_internal_check_exit(this);
+ return 0;
}
-static void gui_internal_get_data(struct gui_priv *priv, char *command, struct attr **in, struct attr ***out) {
+static int gui_internal_get_data(struct gui_priv *priv, char *command, struct attr **in, struct attr ***out) {
struct attr private_data = { attr_private_data, {(void *)&priv->data}};
if (out)
*out=attr_generic_add_attr(*out, &private_data);
+ return 0;
}
-static void gui_internal_cmd_log(struct gui_priv *this) {
+static int gui_internal_cmd_log(struct gui_priv *this, char *command, struct attr **in, struct attr ***out) {
struct widget *w,*wb,*wk,*wl,*we,*wnext;
gui_internal_enter(this, 1);
gui_internal_set_click_coord(this, NULL);
@@ -859,10 +859,10 @@ static void gui_internal_cmd_log(struct gui_priv *this) {
getenv("LANG"));
gui_internal_menu_render(this);
gui_internal_leave(this);
+ return 0;
}
-static void gui_internal_cmd_menu2(struct gui_priv *this, char *function, struct attr **in, struct attr ***out,
- int *valid) {
+static int gui_internal_cmd_menu2(struct gui_priv *this, char *function, struct attr **in, struct attr ***out) {
char *href=NULL;
int i=0, ignore=0, replace=0;
@@ -877,23 +877,23 @@ static void gui_internal_cmd_menu2(struct gui_priv *this, char *function, struct
if (this->root.children) {
if (!href)
- return;
+ return 0;
gui_internal_html_load_href(this, href, replace);
- return;
+ return 0;
}
gui_internal_cmd_menu(this, ignore, href);
+ return 0;
}
-static void gui_internal_cmd2_position(struct gui_priv *this, char *function, struct attr **in, struct attr ***out,
- int *valid) {
+static int gui_internal_cmd2_position(struct gui_priv *this, char *function, struct attr **in, struct attr ***out) {
const char *name=_("Position");
int flags=-1;
dbg(lvl_debug,"enter");
if (!in || !in[0])
- return;
+ return 0;
if (!ATTR_IS_COORD_GEO(in[0]->type))
- return;
+ return 0;
if (in[1] && ATTR_IS_STRING(in[1]->type)) {
name=in[1]->u.str;
if (in[2] && ATTR_IS_INT(in[2]->type))
@@ -901,26 +901,26 @@ static void gui_internal_cmd2_position(struct gui_priv *this, char *function, st
}
dbg(lvl_debug,"flags=0x%x",flags);
gui_internal_cmd_position_do(this, NULL, in[0]->u.coord_geo, NULL, name, flags);
+ return 0;
}
-static void gui_internal_cmd_redraw_map(struct gui_priv *this, char *function, struct attr **in, struct attr ***out,
- int *valid) {
+static int gui_internal_cmd_redraw_map(struct gui_priv *this, char *function, struct attr **in, struct attr ***out) {
this->redraw=1;
+ return 0;
}
-static void gui_internal_cmd2_refresh(struct gui_priv *this, char *function, struct attr **in, struct attr ***out,
- int *valid) {
+static int gui_internal_cmd2_refresh(struct gui_priv *this, char *function, struct attr **in, struct attr ***out) {
char *href=g_strdup(this->href);
gui_internal_html_load_href(this, href, 1);
g_free(href);
+ return 0;
}
-static void gui_internal_cmd2_set(struct gui_priv *this, char *function, struct attr **in, struct attr ***out,
- int *valid) {
+static int gui_internal_cmd2_set(struct gui_priv *this, char *function, struct attr **in, struct attr ***out) {
char *pattern,*command=NULL;
if (!in || !in[0] || !ATTR_IS_STRING(in[0]->type)) {
dbg(lvl_error,"first parameter missing or wrong type");
- return;
+ return 0;
}
pattern=in[0]->u.str;
dbg(lvl_debug,"pattern %s",pattern);
@@ -933,16 +933,17 @@ static void gui_internal_cmd2_set(struct gui_priv *this, char *function, struct
} else {
gui_internal_set(pattern, NULL);
}
-
+ return 0;
}
-void gui_internal_cmd2_quit(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid) {
+int gui_internal_cmd2_quit(struct gui_priv *this, char *function, struct attr **in, struct attr ***out) {
struct attr navit;
gui_internal_prune_menu(this, NULL);
navit.type=attr_navit;
navit.u.navit=this->nav;
config_remove_attr(config, &navit);
event_main_loop_quit();
+ return 0;
}
static char *gui_internal_append_attr(char *str, enum escape_mode mode, char *pre, struct attr *attr, char *post) {
@@ -962,12 +963,11 @@ static char *gui_internal_append_attr(char *str, enum escape_mode mode, char *pr
return str;
}
-static void gui_internal_cmd_write(struct gui_priv * this, char *function, struct attr **in, struct attr ***out,
- int *valid) {
+static int gui_internal_cmd_write(struct gui_priv * this, char *function, struct attr **in, struct attr ***out) {
char *str=NULL;
- dbg(lvl_debug,"enter %s %p %p %p",function,in,out,valid);
+ dbg(lvl_debug,"enter %s %p %p",function,in,out);
if (!in)
- return;
+ return 0;
while (*in) {
str=gui_internal_append_attr(str, escape_mode_none, "", *in, "");
in++;
@@ -980,6 +980,7 @@ static void gui_internal_cmd_write(struct gui_priv * this, char *function, struc
gui_internal_html_parse_text(this, str);
}
g_free(str);
+ return 0;
}
static void gui_internal_onclick(struct attr ***in, char **onclick, char *set) {
@@ -1060,8 +1061,7 @@ error:
return;
}
-static void gui_internal_cmd_img(struct gui_priv * this, char *function, struct attr **in, struct attr ***out,
- int *valid) {
+static int gui_internal_cmd_img(struct gui_priv * this, char *function, struct attr **in, struct attr ***out) {
char *str=g_strdup("<img"),*suffix=NULL,*onclick=g_strdup(""),*html;
if (ATTR_IS_STRING((*in)->type)) {
@@ -1108,11 +1108,10 @@ static void gui_internal_cmd_img(struct gui_priv * this, char *function, struct
error:
g_free(suffix);
g_free(str);
- return;
+ return 0;
}
-static void gui_internal_cmd_debug(struct gui_priv * this, char *function, struct attr **in, struct attr ***out,
- int *valid) {
+static int gui_internal_cmd_debug(struct gui_priv * this, char *function, struct attr **in, struct attr ***out) {
char *str;
dbg(lvl_debug,"begin");
if (in) {
@@ -1124,9 +1123,10 @@ static void gui_internal_cmd_debug(struct gui_priv * this, char *function, struc
}
}
dbg(lvl_debug,"done");
+ return 0;
}
-static void gui_internal_cmd2(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid) {
+static int gui_internal_cmd2(struct gui_priv *this, char *function, struct attr **in, struct attr ***out) {
int entering=0;
int ignore=1;
if (in && in[0] && ATTR_IS_INT(in[0]->type)) {
@@ -1142,40 +1142,41 @@ static void gui_internal_cmd2(struct gui_priv *this, char *function, struct attr
}
if(!strcmp(function, "bookmarks"))
- gui_internal_cmd2_bookmarks(this, function, in, out, valid);
+ gui_internal_cmd2_bookmarks(this, function, in, out);
else if(!strcmp(function, "formerdests"))
- gui_internal_cmd_formerdests(this, function, in, out, valid);
+ gui_internal_cmd_formerdests(this, function, in, out);
else if(!strcmp(function, "locale"))
- gui_internal_cmd2_locale(this, function, in, out, valid);
+ gui_internal_cmd2_locale(this, function, in, out);
else if(!strcmp(function, "network_info"))
- gui_internal_cmd2_network_info(this, function, in, out, valid);
+ gui_internal_cmd2_network_info(this, function, in, out);
else if(!strcmp(function, "position"))
- gui_internal_cmd2_position(this, function, in, out, valid);
+ gui_internal_cmd2_position(this, function, in, out);
else if(!strcmp(function, "pois"))
- gui_internal_cmd2_pois(this, function, in, out, valid);
+ gui_internal_cmd2_pois(this, function, in, out);
else if(!strcmp(function, "route_description"))
- gui_internal_cmd2_route_description(this, function, in, out, valid);
+ gui_internal_cmd2_route_description(this, function, in, out);
else if(!strcmp(function, "route_height_profile"))
- gui_internal_cmd2_route_height_profile(this, function, in, out, valid);
+ gui_internal_cmd2_route_height_profile(this, function, in, out);
else if(!strcmp(function, "setting_layout"))
- gui_internal_cmd2_setting_layout(this, function, in, out, valid);
+ gui_internal_cmd2_setting_layout(this, function, in, out);
else if(!strcmp(function, "setting_maps"))
- gui_internal_cmd2_setting_maps(this, function, in, out, valid);
+ gui_internal_cmd2_setting_maps(this, function, in, out);
else if(!strcmp(function, "setting_rules"))
- gui_internal_cmd2_setting_rules(this, function, in, out, valid);
+ gui_internal_cmd2_setting_rules(this, function, in, out);
else if(!strcmp(function, "setting_vehicle"))
- gui_internal_cmd2_setting_vehicle(this, function, in, out, valid);
+ gui_internal_cmd2_setting_vehicle(this, function, in, out);
else if(!strcmp(function, "town"))
- gui_internal_cmd2_town(this, function, in, out, valid);
+ gui_internal_cmd2_town(this, function, in, out);
else if(!strcmp(function, "enter_coord"))
- gui_internal_cmd_enter_coord(this, function, in, out, valid);
+ gui_internal_cmd_enter_coord(this, function, in, out);
else if(!strcmp(function, "waypoints"))
- gui_internal_cmd2_waypoints(this, function, in, out, valid);
+ gui_internal_cmd2_waypoints(this, function, in, out);
else if(!strcmp(function, "about"))
- gui_internal_cmd2_about(this, function, in, out, valid);
+ gui_internal_cmd2_about(this, function, in, out);
if(entering)
graphics_draw_mode(this->gra, draw_mode_end);
+ return 0;
}
static struct command_table commands[] = {
diff --git a/navit/gui/internal/gui_internal_command.h b/navit/gui/internal/gui_internal_command.h
index ff8a70f9c..206a5c2a0 100644
--- a/navit/gui/internal/gui_internal_command.h
+++ b/navit/gui/internal/gui_internal_command.h
@@ -3,6 +3,6 @@ struct attr;
struct gui_priv;
struct pcoord;
char *gui_internal_coordinates(struct pcoord *pc, char sep);
-void gui_internal_cmd2_quit(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid);
+int gui_internal_cmd2_quit(struct gui_priv *this, char *function, struct attr **in, struct attr ***out);
void gui_internal_command_init(struct gui_priv *this, struct attr **attrs);
/* end of prototypes */
diff --git a/navit/gui/internal/gui_internal_html.c b/navit/gui/internal/gui_internal_html.c
index 41dab9f50..48ad227e5 100644
--- a/navit/gui/internal/gui_internal_html.c
+++ b/navit/gui/internal/gui_internal_html.c
@@ -320,6 +320,7 @@ static void gui_internal_html_end(xml_context *dummy, const char *tag_name, void
switch (html->tag) {
case html_tag_div:
this->html_container=html->container;
+ /* fall through */
case html_tag_img:
case html_tag_input:
gui_internal_widget_append(this->html_container, html->w);
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/gui/internal/gui_internal_search.c b/navit/gui/internal/gui_internal_search.c
index 221c23fa4..66524e407 100644
--- a/navit/gui/internal/gui_internal_search.c
+++ b/navit/gui/internal/gui_internal_search.c
@@ -21,6 +21,9 @@
#include "gui_internal_menu.h"
#include "gui_internal_keyboard.h"
#include "gui_internal_search.h"
+#ifdef HAVE_API_ANDROID
+#include "util.h"
+#endif
static void gui_internal_search_country(struct gui_priv *this, struct widget *widget, void *data) {
gui_internal_prune_menu_count(this, 1, 0);
diff --git a/navit/gui/internal/gui_internal_widget.c b/navit/gui/internal/gui_internal_widget.c
index 3b979f011..92823fa4b 100644
--- a/navit/gui/internal/gui_internal_widget.c
+++ b/navit/gui/internal/gui_internal_widget.c
@@ -1187,6 +1187,10 @@ static GList *gui_internal_compute_table_dimensions(struct gui_priv * this,struc
return column_desc;
}
+/* to adapt g_free to GFunc */
+static void g_free_helper(void * data, void * user_data) {
+ g_free(data);
+}
/**
* @brief Computes the height and width for the table.
@@ -1248,7 +1252,7 @@ void gui_internal_table_pack(struct gui_priv * this, struct widget * w) {
/*
* Deallocate column descriptions.
*/
- g_list_foreach(column_data,(GFunc)g_free,NULL);
+ g_list_foreach(column_data,(GFunc)g_free_helper,NULL);
g_list_free(column_data);
}
@@ -1477,7 +1481,7 @@ void gui_internal_table_render(struct gui_priv * this, struct widget * w) {
/*
* Deallocate column descriptions.
*/
- g_list_foreach(column_desc,(GFunc)g_free,NULL);
+ g_list_foreach(column_desc,(GFunc)g_free_helper,NULL);
g_list_free(column_desc);
}
diff --git a/navit/gui/qml/navitProxy.h b/navit/gui/qml/navitProxy.h
index d3f8a0e86..0abc88cce 100644
--- a/navit/gui/qml/navitProxy.h
+++ b/navit/gui/qml/navitProxy.h
@@ -7,139 +7,149 @@ class NGQProxyNavit : public NGQProxy {
Q_OBJECT;
public:
- NGQProxyNavit(struct gui_priv* object, QObject* parent) : NGQProxy(object,parent) { };
+ NGQProxyNavit(struct gui_priv* object, QObject* parent) : NGQProxy(object,parent) { };
public slots:
- void quit() {
- struct attr navit;
- navit.type=attr_navit;
- navit.u.navit=this->object->nav;
- navit_destroy(navit.u.navit);
- event_main_loop_quit();
- }
- void setObjectByName(const QString& attr_name,const QString& attr_value) {
- if (attr_name=="layout") {
- navit_set_layout_by_name(this->object->nav,attr_value.toStdString().c_str());
- }
- if (attr_name=="vehicle") {
- navit_set_vehicle_by_name(this->object->nav,attr_value.toStdString().c_str());
- }
- return;
- }
- QString getAttrList(const QString &attr_name) {
- struct attr attr;
- struct attr_iter *iter;
- int counter=0;
- QString currentValue;
- QDomDocument retDoc;
- QDomElement entries;
-
- entries=retDoc.createElement("attributes");
- retDoc.appendChild(entries);
-
- //Find current value
- getAttrFunc(attr_from_name(attr_name.toStdString().c_str()), &attr, NULL) ;
- if (attr.type==attr_layout) {
- currentValue=attr.u.layout->name;
- }
-
- //Fill da list
- iter=getIterFunc();
- if (iter == NULL) {
- return QString();
- }
-
- while (getAttrFunc(attr_from_name(attr_name.toStdString().c_str()), &attr, iter) ) {
- QStandardItem* curItem=new QStandardItem();
- //Listed attributes are usualy have very complex structure
- if (attr.type==attr_layout) {
- curItem->setData(QVariant(counter),NGQStandardItemModel::ItemId);
- curItem->setData(QVariant(attr.u.layout->name),NGQStandardItemModel::ItemName);
- curItem->setData(QVariant(attr.u.layout->name),NGQStandardItemModel::ItemValue);
- if (currentValue==attr.u.layout->name) {
- this->_itemId=counter;
- }
- }
- if (attr.type==attr_vehicle) {
- QStandardItem* curItem=new QStandardItem();
- QDomElement entry=retDoc.createElement("vehicle");
- entries.appendChild(entry);
-
- this->object->currVehicle=attr.u.vehicle;
- curItem->setData(QVariant(this->object->vehicleProxy->getAttr("name")),NGQStandardItemModel::ItemName);
- entry.appendChild(this->_fieldValueHelper(retDoc,QString("id"), QString::number(counter)));
- entry.appendChild(this->_fieldValueHelper(retDoc,QString("name"), QString(this->object->vehicleProxy->getAttr("name"))));
-
- //Detecting current vehicle
- struct attr vehicle_attr;
- navit_get_attr(this->object->nav, attr_vehicle, &vehicle_attr, NULL);
- if (vehicle_attr.u.vehicle==attr.u.vehicle) {
- this->_itemId=counter;
- }
- }
- counter++;
- }
-
- dropIterFunc(iter);
-
- dbg(lvl_debug,QString::number(_itemId).toStdString().c_str());
-
- return retDoc.toString();
- }
- QString getDestination() {
- struct attr attr;
- struct coord c;
-
- if (getAttrFunc(attr_destination, &attr, NULL) ) {
- c.x=attr.u.pcoord->x;
- c.y=attr.u.pcoord->y;
- __setNewPoint(this->object,&c,Destination);
- return this->object->currentPoint->pointName();
- }
- return QString();
- }
- void setDestination() {
- navit_set_destination(this->object->nav,this->object->currentPoint->pc(),this->object->currentPoint->coordString().toStdString().c_str(),1);
- }
- void stopNavigation() {
- navit_set_destination(this->object->nav,NULL,NULL,0);
- }
- QString getPosition() {
- struct attr attr;
- struct pcoord pc;
- struct coord c;
- struct transformation *trans;
-
- trans=navit_get_trans(this->object->nav);
-
- getAttrFunc(attr_vehicle, &attr, NULL);
- this->object->currVehicle=attr.u.vehicle;
-
- if (vehicle_get_attr(this->object->currVehicle, attr_position_coord_geo, &attr, NULL)) {
- pc.pro=transform_get_projection(trans);
- transform_from_geo(pc.pro, attr.u.coord_geo, &c);
- __setNewPoint(this->object,&c,Position);
- return this->object->currentPoint->pointName();
- }
- return QString();
- }
- void setPosition() {
- navit_set_position(this->object->nav,this->object->currentPoint->pc());
- }
- void setCenter() {
- navit_set_center(this->object->nav,this->object->currentPoint->pc(),1);
- }
- void command(QString command) {
- struct attr navit;
- navit.type=attr_navit;
- navit.u.navit=this->object->nav;
- command_evaluate(&navit,command.toLocal8Bit().constData());
- }
+ void quit() {
+ struct attr navit;
+ navit.type=attr_navit;
+ navit.u.navit=this->object->nav;
+ navit_destroy(navit.u.navit);
+ event_main_loop_quit();
+ }
+ void setObjectByName(const QString& attr_name,const QString& attr_value) {
+ if (attr_name=="layout") {
+ navit_set_layout_by_name(this->object->nav,attr_value.toStdString().c_str());
+ }
+ if (attr_name=="vehicle") {
+ navit_set_vehicle_by_name(this->object->nav,attr_value.toStdString().c_str());
+ }
+ return;
+ }
+ QString getAttrList(const QString &attr_name) {
+ struct attr attr;
+ struct attr_iter *iter;
+ int counter=0;
+ QString currentValue;
+ QDomDocument retDoc;
+ QDomElement entries;
+
+ entries=retDoc.createElement("attributes");
+ retDoc.appendChild(entries);
+
+ //Find current value
+ getAttrFunc(attr_from_name(attr_name.toStdString().c_str()), &attr, NULL) ;
+ if (attr.type==attr_layout) {
+ currentValue=attr.u.layout->name;
+ }
+
+ //Fill da list
+ iter=getIterFunc();
+ if (iter == NULL) {
+ return QString();
+ }
+
+ while (getAttrFunc(attr_from_name(attr_name.toStdString().c_str()), &attr, iter) ) {
+ QStandardItem* curItem=new QStandardItem();
+ //Listed attributes are usualy have very complex structure
+ if (attr.type==attr_layout) {
+ curItem->setData(QVariant(counter),NGQStandardItemModel::ItemId);
+ curItem->setData(QVariant(attr.u.layout->name),NGQStandardItemModel::ItemName);
+ curItem->setData(QVariant(attr.u.layout->name),NGQStandardItemModel::ItemValue);
+ if (currentValue==attr.u.layout->name) {
+ this->_itemId=counter;
+ }
+ }
+ if (attr.type==attr_vehicle) {
+ QStandardItem* curItem=new QStandardItem();
+ QDomElement entry=retDoc.createElement("vehicle");
+ entries.appendChild(entry);
+
+ this->object->currVehicle=attr.u.vehicle;
+ curItem->setData(QVariant(this->object->vehicleProxy->getAttr("name")),NGQStandardItemModel::ItemName);
+ entry.appendChild(this->_fieldValueHelper(retDoc,QString("id"), QString::number(counter)));
+ entry.appendChild(this->_fieldValueHelper(retDoc,QString("name"),
+ QString(this->object->vehicleProxy->getAttr("name"))));
+
+ //Detecting current vehicle
+ struct attr vehicle_attr;
+ navit_get_attr(this->object->nav, attr_vehicle, &vehicle_attr, NULL);
+ if (vehicle_attr.u.vehicle==attr.u.vehicle) {
+ this->_itemId=counter;
+ }
+ }
+ counter++;
+ }
+
+ dropIterFunc(iter);
+
+ dbg(lvl_debug,QString::number(_itemId).toStdString().c_str());
+
+ return retDoc.toString();
+ }
+ QString getDestination() {
+ struct attr attr;
+ struct coord c;
+
+ if (getAttrFunc(attr_destination, &attr, NULL) ) {
+ c.x=attr.u.pcoord->x;
+ c.y=attr.u.pcoord->y;
+ __setNewPoint(this->object,&c,Destination);
+ return this->object->currentPoint->pointName();
+ }
+ return QString();
+ }
+ void setDestination() {
+ navit_set_destination(this->object->nav,this->object->currentPoint->pc(),
+ this->object->currentPoint->coordString().toStdString().c_str(),1);
+ }
+ void stopNavigation() {
+ navit_set_destination(this->object->nav,NULL,NULL,0);
+ }
+ QString getPosition() {
+ struct attr attr;
+ struct pcoord pc;
+ struct coord c;
+ struct transformation *trans;
+
+ trans=navit_get_trans(this->object->nav);
+
+ getAttrFunc(attr_vehicle, &attr, NULL);
+ this->object->currVehicle=attr.u.vehicle;
+
+ if (vehicle_get_attr(this->object->currVehicle, attr_position_coord_geo, &attr, NULL)) {
+ pc.pro=transform_get_projection(trans);
+ transform_from_geo(pc.pro, attr.u.coord_geo, &c);
+ __setNewPoint(this->object,&c,Position);
+ return this->object->currentPoint->pointName();
+ }
+ return QString();
+ }
+ void setPosition() {
+ navit_set_position(this->object->nav,this->object->currentPoint->pc());
+ }
+ void setCenter() {
+ navit_set_center(this->object->nav,this->object->currentPoint->pc(),1);
+ }
+ void command(QString command) {
+ struct attr navit;
+ navit.type=attr_navit;
+ navit.u.navit=this->object->nav;
+ command_evaluate(&navit,command.toLocal8Bit().constData());
+ }
protected:
- int getAttrFunc(enum attr_type type, struct attr* attr, struct attr_iter* iter) { return navit_get_attr(this->object->nav, type, attr, iter); }
- int setAttrFunc(struct attr* attr) {return navit_set_attr(this->object->nav,attr); }
- struct attr_iter* getIterFunc() { return navit_attr_iter_new(); };
- void dropIterFunc(struct attr_iter* iter) { navit_attr_iter_destroy(iter); };
+ int getAttrFunc(enum attr_type type, struct attr* attr, struct attr_iter* iter) {
+ return navit_get_attr(this->object->nav, type, attr, iter);
+ }
+ int setAttrFunc(struct attr* attr) {
+ return navit_set_attr(this->object->nav,attr);
+ }
+ struct attr_iter* getIterFunc() {
+ return navit_attr_iter_new(NULL);
+ };
+ void dropIterFunc(struct attr_iter* iter) {
+ navit_attr_iter_destroy(iter);
+ };
private:
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/filter/filter.c b/navit/map/filter/filter.c
index 8d46db564..c8f4f1029 100644
--- a/navit/map/filter/filter.c
+++ b/navit/map/filter/filter.c
@@ -124,12 +124,14 @@ static enum item_type filter_type(struct map_priv *m, struct item *item) {
return item->type;
}
-static void free_filter_entry(struct filter_entry *filter) {
+/* user_data is for compatibility with GFunc */
+static void free_filter_entry(struct filter_entry *filter, void * user_data) {
g_free(filter->cond_str);
g_free(filter);
}
-static void free_filter(struct filter *filter) {
+/* user_data is for compatibility with GFunc */
+static void free_filter(struct filter *filter, void * user_data) {
g_list_foreach(filter->old, (GFunc)free_filter_entry, NULL);
g_list_free(filter->old);
filter->old=NULL;
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);
}
diff --git a/navit/osd/core/osd_core.c b/navit/osd/core/osd_core.c
index fbf025cc3..d0b96a51e 100644
--- a/navit/osd/core/osd_core.c
+++ b/navit/osd/core/osd_core.c
@@ -82,8 +82,7 @@ struct odometer;
int set_std_osd_attr(struct osd_priv *priv, struct attr*the_attr);
static void osd_odometer_reset(struct osd_priv_common *opc, int flags);
-static void osd_cmd_odometer_reset(struct navit *this, char *function, struct attr **in, struct attr ***out,
- int *valid);
+static int osd_cmd_odometer_reset(struct navit *this, char *function, struct attr **in, struct attr ***out);
static void osd_odometer_draw(struct osd_priv_common *opc, struct navit *nav, struct vehicle *v);
static struct osd_text_item * oti_new(struct osd_text_item * parent);
int osd_button_set_attr(struct osd_priv_common *opc, struct attr* attr);
@@ -583,8 +582,7 @@ struct odometer {
double acceleration;
};
-static void osd_cmd_odometer_reset(struct navit *this, char *function, struct attr **in, struct attr ***out,
- int *valid) {
+static int osd_cmd_odometer_reset(struct navit *this, char *function, struct attr **in, struct attr ***out) {
if (in && in[0] && ATTR_IS_STRING(in[0]->type) && in[0]->u.str) {
GList* list = odometer_list;
while(list) {
@@ -595,6 +593,7 @@ static void osd_cmd_odometer_reset(struct navit *this, char *function, struct at
list = g_list_next(list);
}
}
+ return 0;
}
static char* str_replace(char*output, char*input, char*pattern, char*replacement) {
@@ -767,6 +766,7 @@ static void draw_aligned_osd_text(char *buffer, int align, struct osd_item *osd_
if (do_draw) {
osd_std_resize(osd_item);
}
+ /* fall through */
default:
p.y=(osd_item->h-lines*(height+yspacing)-yspacing)/2;
}
@@ -1595,7 +1595,7 @@ static void osd_button_adjust_sizes(struct osd_priv_common *opc, struct graphics
opc->osd_item.h=img->height;
}
-static void osd_button_draw(struct osd_priv_common *opc, struct navit *nav) {
+static void osd_button_draw(struct osd_priv_common *opc, struct navit *nav, struct vehicle * unused) {
struct osd_button *this = (struct osd_button *)opc->data;
// FIXME: Do we need this check?
@@ -1680,7 +1680,7 @@ static void osd_button_init(struct osd_priv_common *opc, struct navit *nav) {
}
navit_add_callback(nav, this->navit_init_cb = callback_new_attr_1(callback_cast (osd_std_click), attr_button,
&opc->osd_item));
- osd_button_draw(opc,nav);
+ osd_button_draw(opc,nav, NULL);
}
static char *osd_button_icon_path(struct osd_button *this_, char *src) {
@@ -1715,7 +1715,8 @@ int osd_button_set_attr(struct osd_priv_common *opc, struct attr* attr) {
if(navit_get_blocked(nav)&1)
return 1;
- osd_button_draw(opc,nav);
+ osd_button_draw(opc,nav,NULL);
+
navit_draw(opc->osd_item.navit);
return 1;
}
@@ -1806,7 +1807,7 @@ static void osd_image_init(struct osd_priv_common *opc, struct navit *nav) {
opc->osd_item.graphic_bg=graphics_gc_new(opc->osd_item.gr);
graphics_add_callback(gra, this->draw_cb=callback_new_attr_2(callback_cast(osd_button_draw), attr_postdraw, opc, nav));
}
- osd_button_draw(opc,nav);
+ osd_button_draw(opc,nav,NULL);
}
static struct osd_priv *osd_image_new(struct navit *nav, struct osd_methods *meth,
@@ -2974,6 +2975,7 @@ static char *osd_text_format_attr(struct attr *attr, char *format, int imperial)
g_free(tmp);
return ret;
}
+ break;
case attr_position_time_iso8601:
if ((!format) || (!strcmp(format,"iso8601"))) {
break;
@@ -3238,6 +3240,7 @@ static void osd_text_draw(struct osd_priv_common *opc, struct navit *navit, stru
if (do_draw) {
osd_std_resize(&opc->osd_item);
}
+ /* fall through */
default:
p.y=(opc->osd_item.h-lines*(height+yspacing)-yspacing)/2;
}
@@ -3594,7 +3597,7 @@ struct volume {
struct callback *click_cb;
};
-static void osd_volume_draw(struct osd_priv_common *opc, struct navit *navit) {
+static void osd_volume_draw(struct osd_priv_common *opc, struct navit *navit, struct vehicle * unused) {
struct volume *this = (struct volume *)opc->data;
struct point p;
@@ -3633,7 +3636,7 @@ static void osd_volume_click(struct osd_priv_common *opc, struct navit *nav, int
this->strength=0;
if (this->strength > 5)
this->strength=5;
- osd_volume_draw(opc, nav);
+ osd_volume_draw(opc, nav, NULL);
}
}
static void osd_volume_init(struct osd_priv_common *opc, struct navit *nav) {
@@ -3641,7 +3644,7 @@ static void osd_volume_init(struct osd_priv_common *opc, struct navit *nav) {
osd_set_std_graphic(nav, &opc->osd_item, (struct osd_priv *)opc);
navit_add_callback(nav, this->click_cb = callback_new_attr_1(callback_cast (osd_volume_click), attr_button, opc));
- osd_volume_draw(opc, nav);
+ osd_volume_draw(opc, nav, NULL);
}
static struct osd_priv *osd_volume_new(struct navit *nav, struct osd_methods *meth,
@@ -3709,7 +3712,7 @@ static int round_to_nice_value(double value) {
return mantissa*nearest_power_of10;
}
-static void osd_scale_draw(struct osd_priv_common *opc, struct navit *nav) {
+static void osd_scale_draw(struct osd_priv_common *opc, struct navit *nav, struct vehicle *unused) {
struct osd_scale *this = (struct osd_scale *)opc->data;
struct point item_pos,scale_line_start,scale_line_end;
@@ -3808,7 +3811,7 @@ static void osd_scale_init(struct osd_priv_common *opc, struct navit *nav) {
graphics_add_callback(gra, this->draw_cb=callback_new_attr_2(callback_cast(osd_scale_draw), attr_postdraw, opc, nav));
if (navit_get_ready(nav) == 3)
- osd_scale_draw(opc, nav);
+ osd_scale_draw(opc, nav, NULL);
}
static struct osd_priv *osd_scale_new(struct navit *nav, struct osd_methods *meth,
diff --git a/navit/roadprofile.c b/navit/roadprofile.c
index 81033d46d..96e8361c0 100644
--- a/navit/roadprofile.c
+++ b/navit/roadprofile.c
@@ -74,7 +74,7 @@ int roadprofile_remove_attr(struct roadprofile *this_, struct attr *attr) {
}
struct attr_iter *
-roadprofile_attr_iter_new(void) {
+roadprofile_attr_iter_new(void * unused) {
return (struct attr_iter *)g_new0(void *,1);
}
diff --git a/navit/roadprofile.h b/navit/roadprofile.h
index a4ff65076..69ca6f4bc 100644
--- a/navit/roadprofile.h
+++ b/navit/roadprofile.h
@@ -22,10 +22,10 @@
extern "C" {
#endif
struct roadprofile {
- NAVIT_OBJECT
- int speed;
- int route_weight;
- int maxspeed;
+ NAVIT_OBJECT
+ int speed;
+ int route_weight;
+ int maxspeed;
};
struct roadprofile * roadprofile_new(struct attr *parent, struct attr **attrs);
@@ -33,7 +33,7 @@ int roadprofile_get_attr(struct roadprofile *this_, enum attr_type type, struct
int roadprofile_set_attr(struct roadprofile *this_, struct attr *attr);
int roadprofile_add_attr(struct roadprofile *this_, struct attr *attr);
int roadprofile_remove_attr(struct roadprofile *this_, struct attr *attr);
-struct attr_iter *roadprofile_attr_iter_new(void);
+struct attr_iter *roadprofile_attr_iter_new(void* unused);
void roadprofile_attr_iter_destroy(struct attr_iter *iter);
#ifdef __cplusplus
}
diff --git a/navit/speech/qt5_espeak/Qt5EspeakAudioOut.cpp b/navit/speech/qt5_espeak/Qt5EspeakAudioOut.cpp
index f8f8339eb..09df647f5 100644
--- a/navit/speech/qt5_espeak/Qt5EspeakAudioOut.cpp
+++ b/navit/speech/qt5_espeak/Qt5EspeakAudioOut.cpp
@@ -81,15 +81,16 @@ void Qt5EspeakAudioOut::handleStateChanged(QAudio::State newState) {
break;
case QAudio::StoppedState:
break;
-// Sailfish's QT version doesn't have this. Doesn't do anything either.
-// case QAudio::InterruptedState:
-// break;
case QAudio::IdleState:
/*remove all data that was already read*/
data->remove(0, buffer->pos());
buffer->seek(0);
dbg(lvl_debug, "Size %d", data->size());
break;
+// Sailfish's QT version doesn't have this. Doesn't do anything either.
+// case QAudio::InterruptedState:
+ default:
+ break;
}
}
diff --git a/navit/traffic/traff_android/traffic_traff_android.c b/navit/traffic/traff_android/traffic_traff_android.c
index 1612b3a5f..266f51a0c 100644
--- a/navit/traffic/traff_android/traffic_traff_android.c
+++ b/navit/traffic/traff_android/traffic_traff_android.c
@@ -42,6 +42,7 @@
#include "plugin.h"
#include "callback.h"
#include "debug.h"
+#include "navit.h"
/**
* @brief Stores information about the plugin instance.
@@ -86,7 +87,7 @@ static void traffic_traff_android_on_feed_received(struct traffic_priv * this_,
dbg(lvl_debug, "enter");
attr = g_new0(struct attr, 1);
- a_iter = navit_attr_iter_new();
+ a_iter = navit_attr_iter_new(NULL);
if (navit_get_attr(this_->nav, attr_traffic, attr, a_iter))
traffic = (struct traffic *) attr->u.navit_object;
navit_attr_iter_destroy(a_iter);
diff --git a/navit/vehicle.c b/navit/vehicle.c
index f0094e804..fee989638 100644
--- a/navit/vehicle.c
+++ b/navit/vehicle.c
@@ -185,7 +185,7 @@ void vehicle_destroy(struct vehicle *this_) {
* Creates an attribute iterator to be used with vehicles
*/
struct attr_iter *
-vehicle_attr_iter_new(void) {
+vehicle_attr_iter_new(void * unused) {
return (struct attr_iter *)g_new0(void *,1);
}
diff --git a/navit/vehicle.h b/navit/vehicle.h
index 54cc15771..15cdf4e3c 100644
--- a/navit/vehicle.h
+++ b/navit/vehicle.h
@@ -28,9 +28,9 @@ struct point;
struct vehicle_priv;
struct vehicle_methods {
- void (*destroy)(struct vehicle_priv *priv);
- int (*position_attr_get)(struct vehicle_priv *priv, enum attr_type type, struct attr *attr);
- int (*set_attr)(struct vehicle_priv *priv, struct attr *attr);
+ void (*destroy)(struct vehicle_priv *priv);
+ int (*position_attr_get)(struct vehicle_priv *priv, enum attr_type type, struct attr *attr);
+ int (*set_attr)(struct vehicle_priv *priv, struct attr *attr);
};
/* prototypes */
@@ -43,7 +43,7 @@ struct point;
struct vehicle;
struct vehicle *vehicle_new(struct attr *parent, struct attr **attrs);
void vehicle_destroy(struct vehicle *this_);
-struct attr_iter *vehicle_attr_iter_new(void);
+struct attr_iter *vehicle_attr_iter_new(void * unused);
void vehicle_attr_iter_destroy(struct attr_iter *iter);
int vehicle_get_attr(struct vehicle *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter);
int vehicle_set_attr(struct vehicle *this_, struct attr *attr);
diff --git a/navit/vehicleprofile.c b/navit/vehicleprofile.c
index d20603d73..905d2defa 100644
--- a/navit/vehicleprofile.c
+++ b/navit/vehicleprofile.c
@@ -182,7 +182,7 @@ static void vehicleprofile_debug_roadprofile(gpointer key, gpointer value, gpoin
}
static void vehicleprofile_update(struct vehicleprofile *this_) {
- struct attr_iter *iter=vehicleprofile_attr_iter_new();
+ struct attr_iter *iter=vehicleprofile_attr_iter_new(NULL);
struct attr profile_option;
dbg(lvl_debug,"enter");
vehicleprofile_clear(this_);
@@ -227,7 +227,7 @@ vehicleprofile_new(struct attr *parent, struct attr **attrs) {
}
struct attr_iter *
-vehicleprofile_attr_iter_new(void) {
+vehicleprofile_attr_iter_new(void* unused) {
return (struct attr_iter *)g_new0(void *,1);
}
@@ -276,8 +276,9 @@ char *vehicleprofile_get_name(struct vehicleprofile *this_) {
return this_->name;
}
-static void vehicleprofile_init(struct vehicleprofile *this_) {
+static int vehicleprofile_init(struct vehicleprofile *this_) {
vehicleprofile_update(this_);
+ return 0;
}
struct object_func vehicleprofile_func = {
diff --git a/navit/vehicleprofile.h b/navit/vehicleprofile.h
index 4e1b6a340..58ffa1489 100644
--- a/navit/vehicleprofile.h
+++ b/navit/vehicleprofile.h
@@ -24,40 +24,41 @@ extern "C" {
enum maxspeed_handling {
- maxspeed_enforce = 0, /*!< Always enforce maxspeed of segment */
- maxspeed_restrict = 1, /*!< Enforce maxspeed of segment only if it restricts the speed */
- maxspeed_ignore = 2, /*!< Ignore maxspeed of segment, always use {@code route_weight} of road profile */
+ maxspeed_enforce = 0, /*!< Always enforce maxspeed of segment */
+ maxspeed_restrict = 1, /*!< Enforce maxspeed of segment only if it restricts the speed */
+ maxspeed_ignore = 2, /*!< Ignore maxspeed of segment, always use {@code route_weight} of road profile */
};
struct vehicleprofile {
- NAVIT_OBJECT
- int mode; /**< 0 = Auto, 1 = On-Road, 2 = Off-Road */
- int flags_forward_mask; /**< Flags mask for moving in positive direction */
- int flags_reverse_mask; /**< Flags mask for moving in reverse direction */
- int flags; /**< Required flags to move through a segment */
- int maxspeed_handling; /**< How to handle maxspeed of segment, see {@code enum maxspeed_handling} */
- int static_speed; /**< Maximum speed of vehicle to consider it stationary */
- int static_distance; /**< Maximum distance of previous position of vehicle to consider it stationary */
- char *name; /**< the vehicle profile name */
- char *route_depth; /**< the route depth attribute */
- int width; /**< Width of the vehicle in cm */
- int height; /**< Height of the vehicle in cm */
- int length; /**< Length of the vehicle in cm */
- int weight; /**< Weight of the vehicle in kg */
- int axle_weight; /**< Axle Weight of the vehicle in kg */
- int dangerous_goods; /**< Flags of dangerous goods present */
- int through_traffic_penalty; /**< Penalty when driving on a through traffic limited road */
- GHashTable *roadprofile_hash;
- struct attr active_callback;
- int turn_around_penalty; /**< Penalty when turning around */
- int turn_around_penalty2; /**< Penalty when turning around, for planned turn arounds */
+ NAVIT_OBJECT
+ int mode; /**< 0 = Auto, 1 = On-Road, 2 = Off-Road */
+ int flags_forward_mask; /**< Flags mask for moving in positive direction */
+ int flags_reverse_mask; /**< Flags mask for moving in reverse direction */
+ int flags; /**< Required flags to move through a segment */
+ int maxspeed_handling; /**< How to handle maxspeed of segment, see {@code enum maxspeed_handling} */
+ int static_speed; /**< Maximum speed of vehicle to consider it stationary */
+ int static_distance; /**< Maximum distance of previous position of vehicle to consider it stationary */
+ char *name; /**< the vehicle profile name */
+ char *route_depth; /**< the route depth attribute */
+ int width; /**< Width of the vehicle in cm */
+ int height; /**< Height of the vehicle in cm */
+ int length; /**< Length of the vehicle in cm */
+ int weight; /**< Weight of the vehicle in kg */
+ int axle_weight; /**< Axle Weight of the vehicle in kg */
+ int dangerous_goods; /**< Flags of dangerous goods present */
+ int through_traffic_penalty; /**< Penalty when driving on a through traffic limited road */
+ GHashTable *roadprofile_hash;
+ struct attr active_callback;
+ int turn_around_penalty; /**< Penalty when turning around */
+ int turn_around_penalty2; /**< Penalty when turning around, for planned turn arounds */
};
struct vehicleprofile * vehicleprofile_new(struct attr *parent, struct attr **attrs);
-struct attr_iter *vehicleprofile_attr_iter_new(void);
+struct attr_iter *vehicleprofile_attr_iter_new(void * unused);
void vehicleprofile_attr_iter_destroy(struct attr_iter *iter);
-int vehicleprofile_get_attr(struct vehicleprofile *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter);
+int vehicleprofile_get_attr(struct vehicleprofile *this_, enum attr_type type, struct attr *attr,
+ struct attr_iter *iter);
int vehicleprofile_set_attr(struct vehicleprofile *this_, struct attr *attr);
int vehicleprofile_add_attr(struct vehicleprofile *this_, struct attr *attr);
int vehicleprofile_remove_attr(struct vehicleprofile *this_, struct attr *attr);