diff options
author | Stefan Wildemann <gta04@metalstrolche.de> | 2019-10-31 14:09:52 +0100 |
---|---|---|
committer | Stefan Wildemann <gta04@metalstrolche.de> | 2019-10-31 14:09:52 +0100 |
commit | a24633b7ff62c4647be3de4d848721699d2d8236 (patch) | |
tree | e92df553ffb54e642f9813ac6e392b24571fe490 | |
parent | e3d131bb338976d65ff880c7965c494c6e7d6e64 (diff) | |
download | navit-a24633b7ff62c4647be3de4d848721699d2d8236.tar.gz |
fix:various:remove compiler warnings
-rw-r--r-- | navit/font/freetype/font_freetype.c | 18 | ||||
-rw-r--r-- | navit/graphics/opengl/graphics_opengl.c | 21 | ||||
-rw-r--r-- | navit/gui/gtk/destination.c | 6 | ||||
-rw-r--r-- | navit/gui/gtk/gui_gtk_statusbar.c | 16 | ||||
-rw-r--r-- | navit/gui/internal/gui_internal_html.c | 1 | ||||
-rw-r--r-- | navit/gui/internal/gui_internal_widget.c | 8 | ||||
-rw-r--r-- | navit/map/filter/filter.c | 6 | ||||
-rw-r--r-- | navit/osd/core/osd_core.c | 29 | ||||
-rw-r--r-- | navit/speech/qt5_espeak/Qt5EspeakAudioOut.cpp | 7 |
9 files changed, 67 insertions, 45 deletions
diff --git a/navit/font/freetype/font_freetype.c b/navit/font/freetype/font_freetype.c index 868b5a90a..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; @@ -235,9 +236,9 @@ static struct font_freetype_text *font_freetype_text_new(char *text, struct font #endif /* 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)); + 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); @@ -366,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; @@ -507,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; @@ -559,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/graphics/opengl/graphics_opengl.c b/navit/graphics/opengl/graphics_opengl.c index be00d6eb2..09292b306 100644 --- a/navit/graphics/opengl/graphics_opengl.c +++ b/navit/graphics/opengl/graphics_opengl.c @@ -354,7 +354,8 @@ static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics 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; @@ -799,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; @@ -929,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)) { @@ -957,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 @@ -1161,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); @@ -1400,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 { @@ -1496,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 ff4c23baf..34c840200 100644 --- a/navit/gui/gtk/destination.c +++ b/navit/gui/gtk/destination.c @@ -369,7 +369,7 @@ static void parse_xkbd_args (const char *cmd, char **argv) { bufp = buf; break; } - /* fall through */ + /* fall through */ default: *bufp++ = *p; break; @@ -402,8 +402,8 @@ static int spawn_xkbd (char *xkbd_path, char *xkbd_str) { size_t n; if(pipe (fd) < 0) { - dbg(lvl_error,"Unable to create pipe (%s). Do not try to spawn keyboard.", strerror(errno)); - return 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) { diff --git a/navit/gui/gtk/gui_gtk_statusbar.c b/navit/gui/gtk/gui_gtk_statusbar.c index 5e4ef9a66..e67201b56 100644 --- a/navit/gui/gtk/gui_gtk_statusbar.c +++ b/navit/gui/gtk/gui_gtk_statusbar.c @@ -156,14 +156,14 @@ static void statusbar_route_update(struct statusbar_priv *this, struct navit *na coord_format(lat,lng,DEGREES_MINUTES_SECONDS,buffer,sizeof(buffer)); 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" - ); + 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_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_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/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/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/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; } } |