summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Wildemann <gta04@metalstrolche.de>2019-10-31 00:56:20 +0100
committerStefan Wildemann <gta04@metalstrolche.de>2019-10-31 00:56:20 +0100
commit6f1cfe1edd43b3b2f0eef6be01a3d9f3b9ca967c (patch)
treeb357546b79245c22fae967f9800d81abb181b38e
parentd059ea68263b82892d91b28db0bcaaec26265ade (diff)
downloadnavit-6f1cfe1edd43b3b2f0eef6be01a3d9f3b9ca967c.tar.gz
fix:dbus:fix compiler warnings
-rw-r--r--navit/binding/dbus/binding_dbus.c13
-rw-r--r--navit/font/freetype/font_freetype.c8
-rw-r--r--navit/graphics/opengl/graphics_opengl.c2
-rw-r--r--navit/gui/gtk/destination.c11
-rw-r--r--navit/gui/gtk/gui_gtk_statusbar.c7
5 files changed, 27 insertions, 14 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..868b5a90a 100644
--- a/navit/font/freetype/font_freetype.c
+++ b/navit/font/freetype/font_freetype.c
@@ -233,8 +233,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
diff --git a/navit/graphics/opengl/graphics_opengl.c b/navit/graphics/opengl/graphics_opengl.c
index 2789061f1..be00d6eb2 100644
--- a/navit/graphics/opengl/graphics_opengl.c
+++ b/navit/graphics/opengl/graphics_opengl.c
@@ -350,7 +350,9 @@ 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) {
#ifdef HAVE_FREEIMAGE
diff --git a/navit/gui/gtk/destination.c b/navit/gui/gtk/destination.c
index 6a0fbb5b7..ff4c23baf 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..5e4ef9a66 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,7 +155,7 @@ 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",
+ 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,
@@ -164,6 +164,7 @@ static void statusbar_route_update(struct statusbar_priv *this, struct navit *na
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);
}