diff options
author | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2008-11-04 17:18:01 +0000 |
---|---|---|
committer | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2008-11-04 17:18:01 +0000 |
commit | 82a39c654c22844c16fc50612a7c02b7b382c902 (patch) | |
tree | ccd25a9c0901bcc29fe2c5c0e173d7351bf022e6 | |
parent | a7ac9f2c48f9cfe550abd3e9859f68da847271d3 (diff) | |
download | navit-82a39c654c22844c16fc50612a7c02b7b382c902.tar.gz |
Fix:Various:Fixed some warnings
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@1642 ffa7fe5e-494d-0410-b361-a75ebd5db220
-rw-r--r-- | navit/file.h | 1 | ||||
-rw-r--r-- | navit/graphics.h | 1 | ||||
-rw-r--r-- | navit/gui/gtk/gui_gtk_window.c | 4 | ||||
-rw-r--r-- | navit/gui/internal/gui_internal.c | 55 | ||||
-rw-r--r-- | navit/main.c | 7 | ||||
-rw-r--r-- | navit/main.h | 2 | ||||
-rw-r--r-- | navit/navit.c | 67 | ||||
-rw-r--r-- | navit/navit.h | 3 | ||||
-rw-r--r-- | navit/search.h | 2 | ||||
-rw-r--r-- | navit/start.c | 2 |
10 files changed, 55 insertions, 89 deletions
diff --git a/navit/file.h b/navit/file.h index 01c4c3fbd..5842b88a9 100644 --- a/navit/file.h +++ b/navit/file.h @@ -72,6 +72,7 @@ char **file_wordexp_get_array(struct file_wordexp *wexp); void file_wordexp_destroy(struct file_wordexp *wexp); int file_get_param(struct file *file, struct param_list *param, int count); int file_version(struct file *file, int byname); +void file_init(void); /* end of prototypes */ #endif diff --git a/navit/graphics.h b/navit/graphics.h index ea1d2c16c..816212c6d 100644 --- a/navit/graphics.h +++ b/navit/graphics.h @@ -147,6 +147,7 @@ void graphics_draw_text(struct graphics *this_, struct graphics_gc *gc1, struct void graphics_get_text_bbox(struct graphics *this_, struct graphics_font *font, char *text, int dx, int dy, struct point *ret); void graphics_overlay_disable(struct graphics *this_, int disable); void graphics_draw_image(struct graphics *this_, struct graphics_gc *gc, struct point *p, struct graphics_image *img); +int graphics_draw_drag(struct graphics *this_, struct point *p); void display_add(struct displaylist *displaylist, struct item *item, int count, struct point *pnt, char *label); int graphics_ready(struct graphics *this_); void graphics_displaylist_draw(struct graphics *gra, struct displaylist *displaylist, struct transformation *trans, struct layout *l, int callback); diff --git a/navit/gui/gtk/gui_gtk_window.c b/navit/gui/gtk/gui_gtk_window.c index 488c11a19..af995f391 100644 --- a/navit/gui/gtk/gui_gtk_window.c +++ b/navit/gui/gtk/gui_gtk_window.c @@ -472,7 +472,7 @@ gui_gtk_destinations_update(struct gui_priv *this) static void gui_gtk_destinations_init(struct gui_priv *this) { - navit_add_callback(this->nav, callback_new_attr_1(gui_gtk_destinations_update, attr_destination, this)); + navit_add_callback(this->nav, callback_new_attr_1(callback_cast(gui_gtk_destinations_update), attr_destination, this)); gui_gtk_destinations_update(this); } @@ -551,7 +551,7 @@ gui_gtk_bookmarks_update(struct gui_priv *this) static void gui_gtk_bookmarks_init(struct gui_priv *this) { - navit_add_callback(this->nav, callback_new_attr_1(gui_gtk_bookmarks_update, attr_bookmark_map, this)); + navit_add_callback(this->nav, callback_new_attr_1(callback_cast(gui_gtk_bookmarks_update), attr_bookmark_map, this)); gui_gtk_bookmarks_update(this); } diff --git a/navit/gui/internal/gui_internal.c b/navit/gui/internal/gui_internal.c index b230175fa..8afb06117 100644 --- a/navit/gui/internal/gui_internal.c +++ b/navit/gui/internal/gui_internal.c @@ -615,11 +615,11 @@ gui_internal_button_navit_attr_new(struct gui_priv *this, char *text, enum flags ret->on=*on; if (off) ret->off=*off; - ret->get_attr=navit_get_attr; - ret->set_attr=navit_set_attr; - ret->remove_cb=navit_remove_callback; + ret->get_attr=(int (*)(void *, enum attr_type, struct attr *, struct attr_iter *))navit_get_attr; + ret->set_attr=(int (*)(void *, struct attr *))navit_set_attr; + ret->remove_cb=(void (*)(void *, struct callback *))navit_remove_callback; ret->instance=this->nav; - ret->cb=callback_new_attr_2(gui_internal_button_attr_callback, on->type, this, ret); + ret->cb=callback_new_attr_2(callback_cast(gui_internal_button_attr_callback), on->type, this, ret); navit_add_callback(this->nav, ret->cb); gui_internal_button_attr_update(this, ret); return ret; @@ -636,12 +636,12 @@ gui_internal_button_map_attr_new(struct gui_priv *this, char *text, enum flags f if (off) ret->off=*off; ret->deflt=deflt; - ret->get_attr=map_get_attr; - ret->set_attr=map_set_attr; - ret->remove_cb=map_remove_callback; + ret->get_attr=(int (*)(void *, enum attr_type, struct attr *, struct attr_iter *))map_get_attr; + ret->set_attr=(int (*)(void *, struct attr *))map_set_attr; + ret->remove_cb=(void (*)(void *, struct callback *))map_remove_callback; ret->instance=map; ret->redraw=1; - ret->cb=callback_new_attr_2(gui_internal_button_attr_callback, on->type, this, ret); + ret->cb=callback_new_attr_2(callback_cast(gui_internal_button_attr_callback), on->type, this, ret); map_add_callback(map, ret->cb); gui_internal_button_attr_update(this, ret); return ret; @@ -1483,8 +1483,6 @@ gui_internal_cmd_pois_selector(struct gui_priv *this, struct pcoord *c) static struct widget * gui_internal_cmd_pois_item(struct gui_priv *this, struct coord *center, struct item *item, struct coord *c, int dist) { - char coordbuf[64]; - struct param_list param[5]; char distbuf[32]; char dirbuf[32]; char *type; @@ -1513,8 +1511,8 @@ gui_internal_cmd_pois_item(struct gui_priv *this, struct coord *center, struct i static gint gui_internal_cmd_pois_sort_num(gconstpointer a, gconstpointer b, gpointer user_data) { - struct widget *wa=a; - struct widget *wb=b; + const struct widget *wa=a; + const struct widget *wb=b; struct widget *wac=wa->children->data; struct widget *wbc=wb->children->data; int ia,ib; @@ -1640,7 +1638,6 @@ gui_internal_cmd_view_attributes(struct gui_priv *this, struct widget *wm) static void gui_internal_cmd_view_in_browser(struct gui_priv *this, struct widget *wm) { - struct widget *w,*wb; struct map_rect *mr; struct item *item; struct attr attr; @@ -1682,10 +1679,10 @@ gui_internal_cmd_position(struct gui_priv *this, struct widget *wm) struct coord_geo g; struct coord c; char *coord,*name; - int display_attributes=(wm->data == 2); - int display_view_on_map=(wm->data != 1); - int display_items=(wm->data == 1); - int display_streets=(wm->data == 3); + int display_attributes=(wm->data == (void *)2); + int display_view_on_map=(wm->data != (void *)1); + int display_items=(wm->data == (void *)1); + int display_streets=(wm->data == (void *)3); #if 0 switch ((int)wm->data) { @@ -1956,7 +1953,7 @@ gui_internal_search_changed(struct gui_priv *this, struct widget *wm) { GList *l; gui_internal_widget_children_destroy(this, this->list); - char *text, *name; + char *text=NULL, *name=NULL; dbg(0,"%s now '%s'\n", wm->name, wm->text); if (wm->text && g_utf8_strlen(wm->text, -1) >= 2) { struct attr search_attr; @@ -2540,6 +2537,7 @@ gui_internal_cmd_menu(struct gui_priv *this, struct point *p, int ignore) struct attr attr,attrp; this->ignore_button=ignore; + this->clickp_valid=this->vehicle_valid=0; navit_block(this->nav, 1); graphics_overlay_disable(gra, 1); @@ -2630,7 +2628,7 @@ static void gui_internal_resize(void *data, int w, int h) struct gui_priv *this=data; this->root.w=w; this->root.h=h; - dbg(0,"w=%d h=%d children=%p\n", w, h, this->root.children); + dbg(1,"w=%d h=%d children=%p\n", w, h, this->root.children); navit_resize(this->nav, w, h); if (this->root.children) { gui_internal_prune_menu(this, NULL); @@ -2773,6 +2771,9 @@ static void gui_internal_keypress(void *data, char *key) case NAVIT_KEY_ZOOM_OUT: navit_zoom_out(this->nav, 2, NULL); break; + case NAVIT_KEY_RETURN: + gui_internal_cmd_menu(this, NULL, 0); + break; } return; } @@ -2828,13 +2829,13 @@ static int gui_internal_set_graphics(struct gui_priv *this, struct graphics *gra this->gra=gra; this->win=win; transform_get_size(trans, &this->root.w, &this->root.h); - this->resize_cb=callback_new_attr_1(gui_internal_resize, attr_resize, this); + this->resize_cb=callback_new_attr_1(callback_cast(gui_internal_resize), attr_resize, this); graphics_add_callback(gra, this->resize_cb); - this->button_cb=callback_new_attr_1(gui_internal_button, attr_button, this); + this->button_cb=callback_new_attr_1(callback_cast(gui_internal_button), attr_button, this); graphics_add_callback(gra, this->button_cb); - this->motion_cb=callback_new_attr_1(gui_internal_motion, attr_motion, this); + this->motion_cb=callback_new_attr_1(callback_cast(gui_internal_motion), attr_motion, this); graphics_add_callback(gra, this->motion_cb); - this->keypress_cb=callback_new_attr_1(gui_internal_keypress, attr_keypress, this); + this->keypress_cb=callback_new_attr_1(callback_cast(gui_internal_keypress), attr_keypress, this); graphics_add_callback(gra, this->keypress_cb); this->background=graphics_gc_new(gra); graphics_gc_set_foreground(this->background, &cb); @@ -2878,8 +2879,8 @@ static struct gui_priv * gui_internal_new(struct navit *nav, struct gui_methods this->menu_on_map_click=attr->u.num; else this->menu_on_map_click=1; - navit_command_register(nav,"gui_internal_menu",callback_new_3(gui_internal_cmd_menu,this,NULL,1)); - navit_command_register(nav,"gui_internal_fullscreen",callback_new_2(gui_internal_cmd_fullscreen,this,NULL)); + navit_command_register(nav,"gui_internal_menu",callback_new_3(callback_cast(gui_internal_cmd_menu),this,NULL,(void *)1)); + navit_command_register(nav,"gui_internal_fullscreen",callback_new_2(callback_cast(gui_internal_cmd_fullscreen),this,NULL)); if( (attr=attr_search(attrs,NULL,attr_font_size))) { @@ -3011,7 +3012,7 @@ void gui_internal_widget_table_add_row(struct widget * table, struct widget * * @param flags Sizing flags for the row * @returns The new table_row widget. */ -struct widget * gui_internal_widget_table_row_new(struct gui_priv * this, enum flags flags) +static struct widget * gui_internal_widget_table_row_new(struct gui_priv * this, enum flags flags) { struct widget * widget = g_new0(struct widget,1); widget->type=widget_table_row; @@ -3109,7 +3110,6 @@ static GList * gui_internal_compute_table_dimensions(struct widget * w) void gui_internal_table_pack(struct gui_priv * this, struct widget * w) { - struct widget * row_widget=NULL; int height=0; int width=0; int count=0; @@ -3180,7 +3180,6 @@ void gui_internal_table_render(struct gui_priv * this, struct widget * w) GList * cur_row = NULL; GList * current_desc=NULL; struct table_data * table_data = (struct table_data*)w->data; - int idx=0; int is_skipped=0; struct table_column_desc * dim=NULL; diff --git a/navit/main.c b/navit/main.c index db8805c12..83953b046 100644 --- a/navit/main.c +++ b/navit/main.c @@ -57,7 +57,7 @@ static void sigchld(int sig) } -gchar *get_home_directory(void) +static gchar *get_home_directory(void) { static gchar *homedir = NULL; @@ -127,13 +127,8 @@ main_remove_navit(struct navit *nav) void main_init(char *program) { - GError *error = NULL; - char *config_file = NULL; char *s; int l; - int opt; - GList *list = NULL, *li; - #ifndef _WIN32 signal(SIGCHLD, sigchld); diff --git a/navit/main.h b/navit/main.h index 2cb27edd0..d51979c04 100644 --- a/navit/main.h +++ b/navit/main.h @@ -28,6 +28,8 @@ void main_iter_destroy(struct iter *iter); struct navit * main_get_navit(struct iter *iter); void main_add_navit(struct navit *nav); void main_remove_navit(struct navit *nav); +void main_init(char *program); +void main_init_nls(void); int main(int argc, char **argv); /* end of prototypes */ diff --git a/navit/navit.c b/navit/navit.c index 74ba7d477..2cbcbf339 100644 --- a/navit/navit.c +++ b/navit/navit.c @@ -53,6 +53,8 @@ #include "layout.h" #include "log.h" #include "attr.h" +#include "event.h" +#include "file.h" #include "navit_nls.h" /** @@ -116,7 +118,7 @@ struct navit { GHashTable *bookmarks_hash; struct point pressed, last, current; int button_pressed,moved,popped; - struct event_timer *button_timeout, *motion_timeout; + struct event_timeout *button_timeout, *motion_timeout; struct callback *motion_timeout_callback; int ignore_button; struct log *textfile_debug_log; @@ -231,7 +233,7 @@ navit_popup(void *data) } -int +void navit_ignore_button(struct navit *this_) { this_->ignore_button=1; @@ -242,7 +244,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_, pressed, button, p); + callback_list_call_attr_4(this_->attr_cbl, attr_button, this_, (void *)pressed, (void *)button, p); if (this_->ignore_button) { this_->ignore_button=0; return 0; @@ -300,7 +302,7 @@ navit_button(void *data, int pressed, int button, struct point *p) { struct navit *this=data; if (! this->popup_callback) - this->popup_callback=callback_new_1(navit_popup, this); + this->popup_callback=callback_new_1(callback_cast(navit_popup), this); navit_handle_button(this, pressed, button, p, this->popup_callback); } @@ -482,8 +484,8 @@ navit_new(struct attr *parent, struct attr **attrs) transform_setup(this_->trans, ¢er, zoom, 0); this_->displaylist=graphics_displaylist_new(); this_->commands=g_hash_table_new(g_str_hash, g_str_equal); - navit_command_register(this_, "zoom_in", callback_new_3(navit_zoom_in, this_, 2, NULL)); - navit_command_register(this_, "zoom_out", callback_new_3(navit_zoom_out, this_, 2, NULL)); + navit_command_register(this_, "zoom_in", callback_new_3(callback_cast(navit_zoom_in), this_, (void *)2, NULL)); + navit_command_register(this_, "zoom_out", callback_new_3(callback_cast(navit_zoom_out), this_, (void *)2, NULL)); return this_; } @@ -510,11 +512,11 @@ navit_set_graphics(struct navit *this_, struct graphics *gra) if (this_->gra) return 0; this_->gra=gra; - this_->resize_callback=callback_new_attr_1(navit_resize, attr_resize, this_); + this_->resize_callback=callback_new_attr_1(callback_cast(navit_resize), attr_resize, this_); graphics_add_callback(gra, this_->resize_callback); - this_->button_callback=callback_new_attr_1(navit_button, attr_button, this_); + this_->button_callback=callback_new_attr_1(callback_cast(navit_button), attr_button, this_); graphics_add_callback(gra, this_->button_callback); - this_->motion_callback=callback_new_attr_1(navit_motion, attr_motion, this_); + this_->motion_callback=callback_new_attr_1(callback_cast(navit_motion), attr_motion, this_); graphics_add_callback(gra, this_->motion_callback); return 1; } @@ -542,7 +544,7 @@ navit_projection_set(struct navit *this_, enum projection pro) * @param limit Limits the number of entries in the "backlog". Set to 0 for "infinite" */ static void -navit_append_coord(struct navit *this_, char *file, struct pcoord *c, char *type, char *description, GHashTable *h, int limit) +navit_append_coord(struct navit *this_, char *file, struct pcoord *c, const char *type, const char *description, GHashTable *h, int limit) { FILE *f; int offset=0; @@ -551,7 +553,6 @@ navit_append_coord(struct navit *this_, char *file, struct pcoord *c, char *type int numc,readc; int fd; const char *prostr; - struct callback *cb; f=fopen(file, "r"); if (!f) @@ -623,41 +624,6 @@ new_file: } } -static int -parse_line(FILE *f, char *buffer, char **name, struct pcoord *c) -{ - int pos; - char *s,*i; - struct coord co; - char *cp; - enum projection pro = projection_mg; - *name=NULL; - if (! fgets(buffer, 2048, f)) - return -3; - cp = buffer; - pos=coord_parse(cp, pro, &co); - if (!pos) - return -2; - if (!cp[pos] || cp[pos] == '\n') - return -1; - cp[strlen(cp)-1]='\0'; - s=cp+pos+1; - if (!strncmp(s,"type=", 5)) { - i=strchr(s, '"'); - if (i) { - s=i+1; - i=strchr(s, '"'); - if (i) - *i='\0'; - } - } - *name=s; - c->x = co.x; - c->y = co.y; - c->pro = pro; - return pos; -} - /* * navit_get_user_data_directory * @@ -673,8 +639,8 @@ navit_get_user_data_directory(gboolean create) { if (create && !file_exists(dir)) { dbg(0,"creating dir %s\n", dir); if (file_mkdir(dir,0)) { - perror(dir); - return; + dbg(0,"failed creating dir %s\n", dir); + return NULL; } } @@ -861,7 +827,7 @@ navit_former_destinations_active(struct navit *this_) char buffer[3]; f=fopen(destination_file,"r"); if (f) { - if(!fseek(f, -2, SEEK_END) && fread(buffer, 2, 1, f) == 1 && buffer[0]!='\n' || buffer[1]!='\n') + if(!fseek(f, -2, SEEK_END) && fread(buffer, 2, 1, f) == 1 && (buffer[0]!='\n' || buffer[1]!='\n')) active=1; fclose(f); } @@ -1833,7 +1799,7 @@ navit_block(struct navit *this_, int block) { if (block) { this_->blocked |= 1; - return; + return 0; } if (this_->blocked & 2) { this_->blocked=0; @@ -1872,6 +1838,7 @@ navit_command_call(struct navit *this_, char *command) if (! cb) return 1; callback_call_1(cb, command); + return 0; } void diff --git a/navit/navit.h b/navit/navit.h index f99a82e04..a03a64a37 100644 --- a/navit/navit.h +++ b/navit/navit.h @@ -54,7 +54,7 @@ void navit_resize(void *data, int w, int h); int navit_get_width(struct navit *this_); int navit_check_route(struct navit *this_); int navit_get_height(struct navit *this_); -int navit_ignore_button(struct navit *this_); +void navit_ignore_button(struct navit *this_); int navit_handle_button(struct navit *this_, int pressed, int button, struct point *p, struct callback *popup_callback); void navit_handle_motion(struct navit *this_, struct point *p); void navit_zoom_in(struct navit *this_, int factor, struct point *p); @@ -63,6 +63,7 @@ struct navit *navit_new(struct attr *parent, struct attr **attrs); struct graphics *navit_get_graphics(struct navit *this_); void navit_set_destination(struct navit *this_, struct pcoord *c, char *description); void navit_add_bookmark(struct navit *this_, struct pcoord *c, const char *description); +void navit_say(struct navit *this_, char *text); void navit_speak(struct navit *this_); void navit_window_roadbook_destroy(struct navit *this_); void navit_window_roadbook_new(struct navit *this_); diff --git a/navit/search.h b/navit/search.h index 5e53cced1..29cf4b394 100644 --- a/navit/search.h +++ b/navit/search.h @@ -72,8 +72,10 @@ struct search_list; struct search_list_result; struct search_list *search_list_new(struct mapset *ms); void search_list_search(struct search_list *this_, struct attr *search_attr, int partial); +int search_list_select(struct search_list *this_, enum attr_type attr_type, int id, int mode); struct search_list_result *search_list_get_result(struct search_list *this_); void search_list_destroy(struct search_list *this_); +void search_init(void); /* end of prototypes */ #ifdef __cplusplus } diff --git a/navit/start.c b/navit/start.c index 0a46edd09..f56754f7b 100644 --- a/navit/start.c +++ b/navit/start.c @@ -70,8 +70,6 @@ int main(int argc, char **argv) { GError *error = NULL; char *config_file = NULL; - char *s; - int l; int opt; GList *list = NULL, *li; |