summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseralph <seralph@ffa7fe5e-494d-0410-b361-a75ebd5db220>2009-10-06 19:02:35 +0000
committerseralph <seralph@ffa7fe5e-494d-0410-b361-a75ebd5db220>2009-10-06 19:02:35 +0000
commite4e158a79773e32fac0f81d7e7968ae63e990516 (patch)
treeb6351a618e70e40da7e6aad2da27e3784f8095cc
parent0bcd75e466d199c47d77c1bb9d3f9e9aa3b36e90 (diff)
downloadnavit-e4e158a79773e32fac0f81d7e7968ae63e990516.tar.gz
Fix:core:Fixed various compiler warnings
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@2640 ffa7fe5e-494d-0410-b361-a75ebd5db220
-rw-r--r--navit/Makefile.am2
-rw-r--r--navit/attr.c7
-rw-r--r--navit/attr.h11
-rw-r--r--navit/binding/dbus/binding_dbus.c6
-rw-r--r--navit/command.c4
-rw-r--r--navit/coord.c2
-rw-r--r--navit/cursor.h4
-rw-r--r--navit/debug.c10
-rw-r--r--navit/event_glib.c2
-rw-r--r--navit/file.c2
-rw-r--r--navit/file.h4
-rw-r--r--navit/graphics.c2
-rw-r--r--navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c12
-rw-r--r--navit/item.c2
-rw-r--r--navit/layout.h10
-rw-r--r--navit/navit.c9
-rw-r--r--navit/osd/core/osd_core.c4
-rw-r--r--navit/search.c2
-rw-r--r--navit/start.c2
-rw-r--r--navit/start_real.c2
-rw-r--r--navit/start_real.h25
-rw-r--r--navit/vehicle.c2
-rw-r--r--navit/vehicle.h7
-rw-r--r--navit/vehicleprofile.h16
24 files changed, 80 insertions, 69 deletions
diff --git a/navit/Makefile.am b/navit/Makefile.am
index 35e147b92..abb3dc7ad 100644
--- a/navit/Makefile.am
+++ b/navit/Makefile.am
@@ -37,7 +37,7 @@ libnavit_la_SOURCES = announcement.c atom.c attr.c cache.c callback.c command.c
cursor.h data.h data_window.h data_window_int.h debug.h destination.h draw_info.h endianess.h event.h \
file.h graphics.h gtkext.h gui.h item.h item_def.h keys.h log.h layer.h layout.h linguistics.h main.h map-share.h map.h\
map_data.h mapset.h maptype.h menu.h messages.h navigation.h navit.h osd.h \
- param.h phrase.h plugin.h point.h plugin_def.h projection.h popup.h route.h profile.h roadprofile.h search.h speech.h \
+ param.h phrase.h plugin.h point.h plugin_def.h projection.h popup.h route.h profile.h roadprofile.h search.h speech.h start_real.h \
transform.h track.h util.h vehicle.h vehicleprofile.h window.h xmlconfig.h zipfile.h \
navit_nls.h
diff --git a/navit/attr.c b/navit/attr.c
index 7495cb2fb..796adfd47 100644
--- a/navit/attr.c
+++ b/navit/attr.c
@@ -57,6 +57,11 @@ attr_from_name(const char *name)
return attr_none;
}
+
+static int attr_match(enum attr_type search, enum attr_type found);
+
+
+
char *
attr_to_name(enum attr_type attr)
{
@@ -272,7 +277,7 @@ attr_search(struct attr **attrs, struct attr *last, enum attr_type attr)
return NULL;
}
-int
+static int
attr_match(enum attr_type search, enum attr_type found)
{
switch (search) {
diff --git a/navit/attr.h b/navit/attr.h
index 65cfbe574..4858a481d 100644
--- a/navit/attr.h
+++ b/navit/attr.h
@@ -134,11 +134,14 @@ struct attr {
} u;
};
+struct attr_iter {
+ union {
+ GList *list;
+ struct mapset_handle *mapset_handle;
+ } u;
+};
+
/* prototypes */
-enum attr_type;
-struct attr;
-struct attr_iter;
-struct map;
enum attr_type attr_from_name(const char *name);
char *attr_to_name(enum attr_type attr);
struct attr *attr_new_from_text(const char *name, const char *value);
diff --git a/navit/binding/dbus/binding_dbus.c b/navit/binding/dbus/binding_dbus.c
index 0a45d2dbc..e41d0d95e 100644
--- a/navit/binding/dbus/binding_dbus.c
+++ b/navit/binding/dbus/binding_dbus.c
@@ -63,8 +63,8 @@ object_new(char *type, void *object)
int id;
char *ret;
dbg(0,"enter %s\n", type);
- id=(int)g_hash_table_lookup(object_count, type);
- g_hash_table_insert(object_count, type, (void *)(id+1));
+ id=GPOINTER_TO_INT(g_hash_table_lookup(object_count, type));
+ g_hash_table_insert(object_count, type, GINT_TO_POINTER((id+1)));
ret=g_strdup_printf("%s/%s/%d", object_path, type, id);
g_hash_table_insert(object_hash, ret, object);
dbg(0,"return %s\n", ret);
@@ -546,7 +546,7 @@ request_navit_get_attr(DBusConnection *connection, DBusMessage *message)
dbg(0, "string detected\n");
if(navit_get_attr(navit, attr.type, &attr, NULL)) {
dbg(0, "%s = %s\n", attr_type, &attr.u.layout);
- return reply_simple_as_variant(connection, message, &attr.u.layout, DBUS_TYPE_STRING);
+ return reply_simple_as_variant(connection, message, GPOINTER_TO_INT(&attr.u.layout), DBUS_TYPE_STRING);
}
}
diff --git a/navit/command.c b/navit/command.c
index ec5fb56e6..2a7fb85fd 100644
--- a/navit/command.c
+++ b/navit/command.c
@@ -102,11 +102,11 @@ get_op(struct context *ctx, int test, ...)
return ret;
}
-static int
+/*static int
is_int(struct result *res)
{
return 1;
-}
+}*/
static int
is_double(struct result *res)
diff --git a/navit/coord.c b/navit/coord.c
index b804fb313..4f77b891d 100644
--- a/navit/coord.c
+++ b/navit/coord.c
@@ -256,7 +256,7 @@ coord_parse(const char *c_str, enum projection pro, struct coord *c_ret)
ret+=str-c_str;
if (debug) {
printf("args=%d\n", args);
- printf("ret=%d delta=%d ret_str='%s'\n", ret, str-c_str, c_str+ret);
+ printf("ret=%d delta=%d ret_str='%s'\n", ret, GPOINTER_TO_INT(str-c_str), c_str+ret);
}
out:
if (proj)
diff --git a/navit/cursor.h b/navit/cursor.h
index e5868cc08..e618a003c 100644
--- a/navit/cursor.h
+++ b/navit/cursor.h
@@ -21,10 +21,6 @@
#define NAVIT_CURSOR_H
/* prototypes */
-struct color;
-struct cursor;
-struct graphics;
-struct point;
void cursor_draw(struct cursor *this_, struct graphics *gra, struct point *pnt, int lazy, int dir, int speed);
int cursor_add_attr(struct cursor *this_, struct attr *attr);
struct cursor *cursor_new(struct attr *parent, struct attr **attrs);
diff --git a/navit/debug.c b/navit/debug.c
index 3b3eb8a42..05fd753ff 100644
--- a/navit/debug.c
+++ b/navit/debug.c
@@ -82,12 +82,12 @@ debug_init(const char *program_name)
static void
debug_update_level(gpointer key, gpointer value, gpointer user_data)
{
- if (debug_level < (int) value)
- debug_level=(int) value;
+ if (debug_level < GPOINTER_TO_INT(value))
+ debug_level = GPOINTER_TO_INT(value);
}
void
-debug_level_set(const char *name, int level)
+debug_level_set(const char *name, gint level)
{
if (!strcmp(name, "segv")) {
segv_level=level;
@@ -99,7 +99,7 @@ debug_level_set(const char *name, int level)
timestamp_prefix=level;
} else {
debug_level=0;
- g_hash_table_insert(debug_hash, g_strdup(name), (gpointer) level);
+ g_hash_table_insert(debug_hash, g_strdup(name), GINT_TO_POINTER(level));
g_hash_table_foreach(debug_hash, debug_update_level, NULL);
}
}
@@ -122,7 +122,7 @@ debug_level_get(const char *name)
{
if (!debug_hash)
return 0;
- return (int)(g_hash_table_lookup(debug_hash, name));
+ return GPOINTER_TO_INT(g_hash_table_lookup(debug_hash, name));
}
static void debug_timestamp(FILE *fp)
diff --git a/navit/event_glib.c b/navit/event_glib.c
index 0a7b3d7de..83c0a26ce 100644
--- a/navit/event_glib.c
+++ b/navit/event_glib.c
@@ -59,7 +59,7 @@ event_glib_add_watch(void *fd, enum event_watch_cond cond, struct callback *cb)
{
struct event_watch *ret=g_new0(struct event_watch, 1);
int flags=0;
- ret->iochan = g_io_channel_unix_new((int)fd);
+ ret->iochan = g_io_channel_unix_new(GPOINTER_TO_INT(fd));
switch (cond) {
case event_watch_cond_read:
flags=G_IO_IN;
diff --git a/navit/file.c b/navit/file.c
index 29288c964..bee93b7b4 100644
--- a/navit/file.c
+++ b/navit/file.c
@@ -509,7 +509,7 @@ file_version(struct file *file, int mode)
void *
file_get_os_handle(struct file *file)
{
- return (void *)(file->fd);
+ return GINT_TO_POINTER(file->fd);
}
void
diff --git a/navit/file.h b/navit/file.h
index 67944bc8b..00533add8 100644
--- a/navit/file.h
+++ b/navit/file.h
@@ -57,10 +57,6 @@ enum file_flags {
};
/* prototypes */
-enum file_flags;
-struct file;
-struct file_wordexp;
-struct param_list;
struct file *file_create(char *name, enum file_flags flags);
int file_is_dir(char *name);
long long file_size(struct file *file);
diff --git a/navit/graphics.c b/navit/graphics.c
index 8377eeaeb..11d2d0da4 100644
--- a/navit/graphics.c
+++ b/navit/graphics.c
@@ -660,7 +660,7 @@ static guint
displayitem_hash(gconstpointer key)
{
const struct displayitem *di=key;
- return (di->item.id_hi^di->item.id_lo^((int) di->item.map));
+ return (di->item.id_hi^di->item.id_lo^(GPOINTER_TO_INT(di->item.map)));
}
static gboolean
diff --git a/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c b/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c
index 71af381ae..35d51450f 100644
--- a/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c
+++ b/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c
@@ -619,7 +619,7 @@ configure(GtkWidget * widget, GdkEventConfigure * event, gpointer user_data)
gra->width=widget->allocation.width;
gra->height=widget->allocation.height;
gra->drawable = gdk_pixmap_new(widget->window, gra->width, gra->height, -1);
- callback_list_call_attr_2(gra->cbl, attr_resize, (void *)gra->width, (void *)gra->height);
+ callback_list_call_attr_2(gra->cbl, attr_resize, GINT_TO_POINTER(gra->width), GINT_TO_POINTER(gra->height));
return TRUE;
}
@@ -687,7 +687,7 @@ button_press(GtkWidget * widget, GdkEventButton * event, gpointer user_data)
}
p.x=event->x;
p.y=event->y;
- callback_list_call_attr_3(this->cbl, attr_button, (void *)1, (void *)event->button, (void *)&p);
+ callback_list_call_attr_3(this->cbl, attr_button, GINT_TO_POINTER(1), GINT_TO_POINTER(event->button), (void *)&p);
return FALSE;
}
@@ -710,7 +710,7 @@ button_release(GtkWidget * widget, GdkEventButton * event, gpointer user_data)
}
p.x=event->x;
p.y=event->y;
- callback_list_call_attr_3(this->cbl, attr_button, (void *)0, (void *)event->button, (void *)&p);
+ callback_list_call_attr_3(this->cbl, attr_button, GINT_TO_POINTER(0), GINT_TO_POINTER(event->button), (void *)&p);
return FALSE;
}
@@ -737,8 +737,8 @@ scroll(GtkWidget * widget, GdkEventScroll * event, gpointer user_data)
break;
}
if (button != -1) {
- callback_list_call_attr_3(this->cbl, attr_button, (void *)1, (void *)button, (void *)&p);
- callback_list_call_attr_3(this->cbl, attr_button, (void *)0, (void *)button, (void *)&p);
+ callback_list_call_attr_3(this->cbl, attr_button, GINT_TO_POINTER(1), GINT_TO_POINTER(button), (void *)&p);
+ callback_list_call_attr_3(this->cbl, attr_button, GINT_TO_POINTER(0), GINT_TO_POINTER(button), (void *)&p);
}
return FALSE;
}
@@ -882,7 +882,7 @@ overlay_resize(struct graphics_priv *this, struct point *p, int w, int h, int al
this->overlay_autodisabled = 0;
}
- callback_list_call_attr_2(this->cbl, attr_resize, (void *)this->width, (void *)this->height);
+ callback_list_call_attr_2(this->cbl, attr_resize, GINT_TO_POINTER(this->width), GINT_TO_POINTER(this->height));
}
}
diff --git a/navit/item.c b/navit/item.c
index ec20514f9..7d39083c7 100644
--- a/navit/item.c
+++ b/navit/item.c
@@ -232,7 +232,7 @@ static guint
item_hash_hash(gconstpointer key)
{
const struct item *itm=key;
- gconstpointer hashkey=(gconstpointer)(itm->id_hi^itm->id_lo^((int) itm->map));
+ gconstpointer hashkey=(gconstpointer)GINT_TO_POINTER(itm->id_hi^itm->id_lo^(GPOINTER_TO_INT(itm->map)));
return g_direct_hash(hashkey);
}
diff --git a/navit/layout.h b/navit/layout.h
index a0254d4e8..887c7649b 100644
--- a/navit/layout.h
+++ b/navit/layout.h
@@ -23,9 +23,6 @@
#include "item.h"
#include "color.h"
-struct element_line;
-struct element_text;
-
struct element {
enum { element_point, element_polyline, element_polygon, element_circle, element_text, element_icon, element_image, element_arrows } type;
struct color color;
@@ -64,18 +61,11 @@ struct itemgra {
GList *elements;
};
-struct color;
-
struct layer { char *name; int details; GList *itemgras; };
struct layout { char *name; char *font; struct color color; GList *layers; int order_delta; };
/* prototypes */
-enum item_type;
-struct element;
-struct itemgra;
-struct layer;
-struct layout;
struct layout *layout_new(struct attr *parent, struct attr **attrs);
int layout_add_attr(struct layout *layout, struct attr *attr);
struct layer *layer_new(struct attr *parent, struct attr **attrs);
diff --git a/navit/navit.c b/navit/navit.c
index 9c0e805b8..58ff73e63 100644
--- a/navit/navit.c
+++ b/navit/navit.c
@@ -139,13 +139,6 @@ struct navit {
struct gui *main_loop_gui;
-struct attr_iter {
- union {
- GList *list;
- struct mapset_handle *mapset_handle;
- } u;
-};
-
static void navit_vehicle_update(struct navit *this_, struct navit_vehicle *nv);
static void navit_vehicle_draw(struct navit *this_, struct navit_vehicle *nv, struct point *pnt);
static int navit_add_vehicle(struct navit *this_, struct vehicle *v);
@@ -332,7 +325,7 @@ navit_handle_button(struct navit *this_, int pressed, int button, struct point *
{
int border=16;
- callback_list_call_attr_4(this_->attr_cbl, attr_button, this_, (void *)pressed, (void *)button, p);
+ callback_list_call_attr_4(this_->attr_cbl, attr_button, this_, GINT_TO_POINTER(pressed), GINT_TO_POINTER(button), p);
if (this_->ignore_button) {
this_->ignore_button=0;
return 0;
diff --git a/navit/osd/core/osd_core.c b/navit/osd/core/osd_core.c
index 4beb4801c..1693fa934 100644
--- a/navit/osd/core/osd_core.c
+++ b/navit/osd/core/osd_core.c
@@ -128,11 +128,11 @@ format_speed(double speed, char *sep)
return g_strdup_printf("%.0f%skm/h", speed, sep);
}
-static char *
+/*static char *
format_float(double num)
{
return g_strdup_printf("%f", num);
-}
+}*/
static char *
format_float_0(double num)
diff --git a/navit/search.c b/navit/search.c
index 7c8b7fd95..a7d000795 100644
--- a/navit/search.c
+++ b/navit/search.c
@@ -51,7 +51,7 @@ static guint
search_item_hash_hash(gconstpointer key)
{
const struct item *itm=key;
- gconstpointer hashkey=(gconstpointer)(itm->id_hi^itm->id_lo);
+ gconstpointer hashkey=(gconstpointer)GINT_TO_POINTER(itm->id_hi^itm->id_lo);
return g_direct_hash(hashkey);
}
diff --git a/navit/start.c b/navit/start.c
index 335dfdd9c..35bdce0a0 100644
--- a/navit/start.c
+++ b/navit/start.c
@@ -17,6 +17,8 @@
* Boston, MA 02110-1301, USA.
*/
+#include "start_real.h"
+
int
main(int argc, char **argv)
{
diff --git a/navit/start_real.c b/navit/start_real.c
index e16700aa7..c647850de 100644
--- a/navit/start_real.c
+++ b/navit/start_real.c
@@ -35,6 +35,8 @@
#include "xmlconfig.h"
#include "file.h"
#include "search.h"
+#include "start_real.h"
+#include "linguistics.h"
#include "navit_nls.h"
#include "atom.h"
#ifdef HAVE_API_WIN32_CE
diff --git a/navit/start_real.h b/navit/start_real.h
new file mode 100644
index 000000000..838b08da5
--- /dev/null
+++ b/navit/start_real.h
@@ -0,0 +1,25 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2009 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_MAIN_REAL_H
+#define NAVIT_MAIN_REAL_H
+
+int main_real(int argc, char **argv);
+
+#endif
diff --git a/navit/vehicle.c b/navit/vehicle.c
index db5babfef..89db36e0a 100644
--- a/navit/vehicle.c
+++ b/navit/vehicle.c
@@ -245,7 +245,7 @@ vehicle_new(struct attr *parent, struct attr **attrs)
struct attr_iter *
vehicle_attr_iter_new(void)
{
- return g_new0(void *,1);
+ return g_new0(struct attr_iter,1);
}
void
diff --git a/navit/vehicle.h b/navit/vehicle.h
index d4aaecf2b..f9d65b3d5 100644
--- a/navit/vehicle.h
+++ b/navit/vehicle.h
@@ -23,11 +23,8 @@
#ifdef __cplusplus
extern "C" {
#endif
-struct vehicle;
+
struct vehicle_priv;
-enum attr_type;
-struct attr;
-struct attr_iter;
struct vehicle_methods {
void (*destroy)(struct vehicle_priv *priv);
@@ -36,6 +33,7 @@ struct vehicle_methods {
};
+
/* prototypes */
struct vehicle *vehicle_new(struct attr *parent, struct attr **attrs);
struct attr_iter *vehicle_attr_iter_new(void);
@@ -46,6 +44,7 @@ int vehicle_remove_attr(struct vehicle *this_, struct attr *attr);
void vehicle_destroy(struct vehicle *this_);
void vehicle_attr_iter_destroy(struct attr_iter *iter);
/* end of prototypes */
+
#ifdef __cplusplus
}
#endif
diff --git a/navit/vehicleprofile.h b/navit/vehicleprofile.h
index 47ce832f3..209815ec8 100644
--- a/navit/vehicleprofile.h
+++ b/navit/vehicleprofile.h
@@ -18,14 +18,14 @@
*/
struct vehicleprofile {
- 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; /**< 0 = Always, 1 = Only if lower, 2 = Never */
- 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
+ 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; /**< 0 = Always, 1 = Only if lower, 2 = Never */
+ 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
struct attr **attrs;
GHashTable *roadprofile_hash;
};