Fix:core:Fixed various compiler warnings
authorseralph <seralph@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Tue, 6 Oct 2009 19:02:35 +0000 (19:02 +0000)
committerseralph <seralph@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Tue, 6 Oct 2009 19:02:35 +0000 (19:02 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk/navit@2640 ffa7fe5e-494d-0410-b361-a75ebd5db220

24 files changed:
navit/Makefile.am
navit/attr.c
navit/attr.h
navit/binding/dbus/binding_dbus.c
navit/command.c
navit/coord.c
navit/cursor.h
navit/debug.c
navit/event_glib.c
navit/file.c
navit/file.h
navit/graphics.c
navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c
navit/item.c
navit/layout.h
navit/navit.c
navit/osd/core/osd_core.c
navit/search.c
navit/start.c
navit/start_real.c
navit/start_real.h [new file with mode: 0644]
navit/vehicle.c
navit/vehicle.h
navit/vehicleprofile.h

index 35e147b..abb3dc7 100644 (file)
@@ -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
 
index 7495cb2..796adfd 100644 (file)
@@ -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) {
index 65cfbe5..4858a48 100644 (file)
@@ -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);
index 0a45d2d..e41d0d9 100644 (file)
@@ -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);
         }
     }
 
index ec5fb56..2a7fb85 100644 (file)
@@ -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)
index b804fb3..4f77b89 100644 (file)
@@ -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)
index e5868cc..e618a00 100644 (file)
 #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);
index 3b3eb8a..05fd753 100644 (file)
@@ -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)
index 0a7b3d7..83c0a26 100644 (file)
@@ -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;
index 29288c9..bee93b7 100644 (file)
@@ -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
index 67944bc..00533ad 100644 (file)
@@ -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);
index 8377eea..11d2d0d 100644 (file)
@@ -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
index 71af381..35d5145 100644 (file)
@@ -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));
        }
 }
 
index ec20514..7d39083 100644 (file)
@@ -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);
 }
 
index a0254d4..887c764 100644 (file)
@@ -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);
index 9c0e805..58ff73e 100644 (file)
@@ -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;
index 4beb480..1693fa9 100644 (file)
@@ -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)
index 7c8b7fd..a7d0007 100644 (file)
@@ -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);
 }
 
index 335dfdd..35bdce0 100644 (file)
@@ -17,6 +17,8 @@
  * Boston, MA  02110-1301, USA.
  */
 
+#include "start_real.h"
+
 int
 main(int argc, char **argv)
 {
index e16700a..c647850 100644 (file)
@@ -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 (file)
index 0000000..838b08d
--- /dev/null
@@ -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
index db5babf..89db36e 100644 (file)
@@ -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
index d4aaecf..f9d65b3 100644 (file)
 #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
index 47ce832..209815e 100644 (file)
  */
 
 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;
 };