diff --git a/navit/announcement.c b/navit/announcement.c index c823fe1e13..3a85f3d02f 100644 --- a/navit/announcement.c +++ b/navit/announcement.c @@ -30,7 +30,7 @@ struct announcement * announcement_new(struct attr *parent, struct attr **attrs) { struct announcement *this_; struct attr *type_attr; - if (! (type_attr=attr_search(attrs, NULL, attr_name))) { + if (! (type_attr=attr_search(attrs, attr_name))) { return NULL; } this_=g_new0(struct announcement, 1); diff --git a/navit/attr.c b/navit/attr.c index 7eff92fb8a..de2a508f06 100644 --- a/navit/attr.c +++ b/navit/attr.c @@ -498,13 +498,12 @@ char *attr_to_text(struct attr *attr, struct map *map, int pretty) { * attribute type and returns the first match. * * @param attrs Points to the array of attribute pointers to be searched - * @param last Not used * @param attr_type The attribute type to search for. Generic types (such as * attr_any or attr_any_xml) are NOT supported. * @return Pointer to the first matching attribute, or NULL if no match was found. */ struct attr * -attr_search(struct attr **attrs, struct attr *last, enum attr_type attr) { +attr_search(struct attr **attrs, enum attr_type attr) { dbg(lvl_info, "enter attrs=%p", attrs); while (*attrs) { dbg(lvl_debug,"*attrs=%p", *attrs); diff --git a/navit/attr.h b/navit/attr.h index d4cd07a1ec..a49f033fe8 100644 --- a/navit/attr.h +++ b/navit/attr.h @@ -223,7 +223,7 @@ char *attr_to_name(enum attr_type attr); struct attr *attr_new_from_text(const char *name, const char *value); char *attr_to_text_ext(struct attr *attr, char *sep, enum attr_format fmt, enum attr_format def_fmt, struct map *map); char *attr_to_text(struct attr *attr, struct map *map, int pretty); -struct attr *attr_search(struct attr **attrs, struct attr *last, enum attr_type attr); +struct attr *attr_search(struct attr **attrs, enum attr_type attr); int attr_generic_get_attr(struct attr **attrs, struct attr **def_attrs, enum attr_type type, struct attr *attr, struct attr_iter *iter); struct attr **attr_generic_set_attr(struct attr **attrs, struct attr *attr); diff --git a/navit/coord.c b/navit/coord.c index cc64044bd5..45d609d6c2 100644 --- a/navit/coord.c +++ b/navit/coord.c @@ -56,8 +56,8 @@ struct coord * coord_new(int x, int y) { struct coord * coord_new_from_attrs(struct attr *parent, struct attr **attrs) { struct attr *x,*y; - x=attr_search(attrs, NULL, attr_x); - y=attr_search(attrs, NULL, attr_y); + x=attr_search(attrs, attr_x); + y=attr_search(attrs, attr_y); if (!x || !y) return NULL; return coord_new(x->u.num, y->u.num); diff --git a/navit/debug.c b/navit/debug.c index 6321756b6a..e46637cb21 100644 --- a/navit/debug.c +++ b/navit/debug.c @@ -160,13 +160,13 @@ struct debug * debug_new(struct attr *parent, struct attr **attrs) { struct attr *name,*dbg_level_attr,*level_attr; dbg_level level; - name=attr_search(attrs, NULL, attr_name); - dbg_level_attr=attr_search(attrs, NULL, attr_dbg_level); - level_attr=attr_search(attrs, NULL, attr_level); + name=attr_search(attrs, attr_name); + dbg_level_attr=attr_search(attrs, attr_dbg_level); + level_attr=attr_search(attrs, attr_level); level = parse_dbg_level(dbg_level_attr,level_attr); #ifdef HAVE_SOCKET if (!name && level==lvl_unset) { - struct attr *socket_attr=attr_search(attrs, NULL, attr_socket); + struct attr *socket_attr=attr_search(attrs, attr_socket); char *p,*s; if (!socket_attr) return NULL; diff --git a/navit/file.c b/navit/file.c index 680b355b26..1622fd56df 100644 --- a/navit/file.c +++ b/navit/file.c @@ -110,7 +110,7 @@ static int file_request_do(struct file *file, struct attr **options, int connect if (!options) return 0; - attr=attr_search(options, NULL, attr_url); + attr=attr_search(options, attr_url); if (!attr) return 0; name=attr->u.str; @@ -125,11 +125,11 @@ static int file_request_do(struct file *file, struct attr **options, int connect char *method="GET"; char *header=NULL; int persistent=0; - if ((attr=attr_search(options, NULL, attr_http_method)) && attr->u.str) + if ((attr=attr_search(options, attr_http_method)) && attr->u.str) method=attr->u.str; - if ((attr=attr_search(options, NULL, attr_http_header)) && attr->u.str) + if ((attr=attr_search(options, attr_http_header)) && attr->u.str) header=attr->u.str; - if ((attr=attr_search(options, NULL, attr_persistent))) + if ((attr=attr_search(options, attr_persistent))) persistent=attr->u.num; if (path) host[path-name-7]='\0'; @@ -184,14 +184,14 @@ file_create(char *name, struct attr **options) { struct attr *attr; int open_flags=O_LARGEFILE|O_BINARY; - if (options && (attr=attr_search(options, NULL, attr_url))) { + if (options && (attr=attr_search(options, attr_url))) { #ifdef HAVE_SOCKET file_request_do(file, options, 1); #endif } else { - if (options && (attr=attr_search(options, NULL, attr_readwrite)) && attr->u.num) { + if (options && (attr=attr_search(options, attr_readwrite)) && attr->u.num) { open_flags |= O_RDWR; - if ((attr=attr_search(options, NULL, attr_create)) && attr->u.num) + if ((attr=attr_search(options, attr_create)) && attr->u.num) open_flags |= O_CREAT|O_TRUNC; } else open_flags |= O_RDONLY; @@ -210,7 +210,7 @@ file_create(char *name, struct attr **options) { file->name_id = (long)atom(name); } #ifdef CACHE_SIZE - if (!options || !(attr=attr_search(options, NULL, attr_cache)) || attr->u.num) + if (!options || !(attr=attr_search(options, attr_cache)) || attr->u.num) file->cache=1; #endif dbg_assert(file != NULL); diff --git a/navit/graphics.c b/navit/graphics.c index 1ed80defbc..2c7cd49fff 100644 --- a/navit/graphics.c +++ b/navit/graphics.c @@ -337,7 +337,7 @@ struct graphics * graphics_new(struct attr *parent, struct attr **attrs) { struct graphics_priv * (*graphicstype_new)(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl); - if (! (type_attr=attr_search(attrs, NULL, attr_type))) { + if (! (type_attr=attr_search(attrs, attr_type))) { dbg(lvl_error,"Graphics plugin type is not set."); return NULL; } @@ -364,8 +364,8 @@ struct graphics * graphics_new(struct attr *parent, struct attr **attrs) { this_->font_size=20; this_->image_cache_hash = g_hash_table_new_full(g_str_hash, g_str_equal,g_free,g_free); /*get dpi */ - virtual_dpi_attr=attr_search(attrs, NULL, attr_virtual_dpi); - real_dpi_attr=attr_search(attrs, NULL, attr_real_dpi); + virtual_dpi_attr=attr_search(attrs, attr_virtual_dpi); + real_dpi_attr=attr_search(attrs, attr_real_dpi); if(virtual_dpi_attr != NULL) { navit_float virtual_dpi, real_dpi=0; virtual_dpi=virtual_dpi_attr->u.num; diff --git a/navit/graphics/android/graphics_android.c b/navit/graphics/android/graphics_android.c index ccc9294327..2109fee7e4 100644 --- a/navit/graphics/android/graphics_android.c +++ b/navit/graphics/android/graphics_android.c @@ -931,7 +931,7 @@ static struct graphics_priv *graphics_android_new(struct navit *nav, struct grap ret->padding->right = 0; ret->padding->bottom = 0; /* attr_background_color is the background color for system bars (API 17+ only) */ - if ((attr=attr_search(attrs, NULL, attr_background_color))) { + if ((attr=attr_search(attrs, attr_background_color))) { ret->bgcolor = (attr->u.color->a / 0x101) << 24 | (attr->u.color->r / 0x101) << 16 | (attr->u.color->g / 0x101) << 8 @@ -942,10 +942,10 @@ static struct graphics_priv *graphics_android_new(struct navit *nav, struct grap /* default is the same as for OSD */ ret->bgcolor = 0xa0000000; } - if ((attr=attr_search(attrs, NULL, attr_use_camera))) { + if ((attr=attr_search(attrs, attr_use_camera))) { use_camera=attr->u.num; } - if ((attr=attr_search(attrs, NULL, attr_callback_list))) { + if ((attr=attr_search(attrs, attr_callback_list))) { command_add_table(attr->u.callback_list, commands, sizeof(commands)/sizeof(struct command_table), ret); } image_cache_hash = g_hash_table_new(g_str_hash, g_str_equal); diff --git a/navit/graphics/egl/graphics_egl.c b/navit/graphics/egl/graphics_egl.c index 2da56047c9..87291d7393 100644 --- a/navit/graphics/egl/graphics_egl.c +++ b/navit/graphics/egl/graphics_egl.c @@ -1254,16 +1254,16 @@ static struct graphics_priv *graphics_opengl_new(struct navit *nav, struct graph this->show_overlays = 1; this->width = SCREEN_WIDTH; - if ((attr = attr_search(attrs, NULL, attr_w))) + if ((attr = attr_search(attrs, attr_w))) this->width = attr->u.num; this->height = SCREEN_HEIGHT; - if ((attr = attr_search(attrs, NULL, attr_h))) + if ((attr = attr_search(attrs, attr_h))) this->height = attr->u.num; this->timeout = 100; - if ((attr = attr_search(attrs, NULL, attr_timeout))) + if ((attr = attr_search(attrs, attr_timeout))) this->timeout = attr->u.num; this->delay = 0; - if ((attr = attr_search(attrs, NULL, attr_delay))) + if ((attr = attr_search(attrs, attr_delay))) this->delay = attr->u.num; this->cbl = cbl; 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 0f57263ee5..e9d34dd826 100644 --- a/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c +++ b/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c @@ -1120,18 +1120,18 @@ static struct graphics_priv *graphics_gtk_drawing_area_new(struct navit *nav, st this->nav = nav; this->widget=draw; this->win_w=792; - if ((attr=attr_search(attrs, NULL, attr_w))) + if ((attr=attr_search(attrs, attr_w))) this->win_w=attr->u.num; this->win_h=547; - if ((attr=attr_search(attrs, NULL, attr_h))) + if ((attr=attr_search(attrs, attr_h))) this->win_h=attr->u.num; this->timeout=100; - if ((attr=attr_search(attrs, NULL, attr_timeout))) + if ((attr=attr_search(attrs, attr_timeout))) this->timeout=attr->u.num; this->delay=0; - if ((attr=attr_search(attrs, NULL, attr_delay))) + if ((attr=attr_search(attrs, attr_delay))) this->delay=attr->u.num; - if ((attr=attr_search(attrs, NULL, attr_window_title))) + if ((attr=attr_search(attrs, attr_window_title))) this->window_title=g_strdup(attr->u.str); else this->window_title=g_strdup("Navit"); diff --git a/navit/graphics/null/graphics_null.c b/navit/graphics/null/graphics_null.c index 552999d450..a04d12b6a9 100644 --- a/navit/graphics/null/graphics_null.c +++ b/navit/graphics/null/graphics_null.c @@ -211,7 +211,7 @@ static struct graphics_priv *graphics_null_new(struct navit *nav, struct graphic struct attr *event_loop_system = NULL; *meth=graphics_methods; - event_loop_system = attr_search(attrs, NULL, attr_event_loop_system); + event_loop_system = attr_search(attrs, attr_event_loop_system); if (event_loop_system && event_loop_system->u.str) { dbg(lvl_debug, "event_system is %s", event_loop_system->u.str); diff --git a/navit/graphics/opengl/graphics_opengl.c b/navit/graphics/opengl/graphics_opengl.c index 09292b3064..cc644e641e 100644 --- a/navit/graphics/opengl/graphics_opengl.c +++ b/navit/graphics/opengl/graphics_opengl.c @@ -1517,16 +1517,16 @@ static struct graphics_priv *graphics_opengl_new(struct navit *nav, struct graph this->overlay_enabled = 1; this->width = SCREEN_WIDTH; - if ((attr = attr_search(attrs, NULL, attr_w))) + if ((attr = attr_search(attrs, attr_w))) this->width = attr->u.num; this->height = SCREEN_HEIGHT; - if ((attr = attr_search(attrs, NULL, attr_h))) + if ((attr = attr_search(attrs, attr_h))) this->height = attr->u.num; this->timeout = 100; - if ((attr = attr_search(attrs, NULL, attr_timeout))) + if ((attr = attr_search(attrs, attr_timeout))) this->timeout = attr->u.num; this->delay = 0; - if ((attr = attr_search(attrs, NULL, attr_delay))) + if ((attr = attr_search(attrs, attr_delay))) this->delay = attr->u.num; this->cbl = cbl; diff --git a/navit/graphics/qt5/graphics_qt5.cpp b/navit/graphics/qt5/graphics_qt5.cpp index c874792196..11f480c0a0 100644 --- a/navit/graphics/qt5/graphics_qt5.cpp +++ b/navit/graphics/qt5/graphics_qt5.cpp @@ -954,7 +954,7 @@ static struct graphics_priv* graphics_qt5_new(struct navit* nav, struct graphics //dbg(lvl_debug,"enter"); /* get qt widget attr */ - if ((attr_widget = attr_search(attrs, NULL, attr_qt5_widget))) { + if ((attr_widget = attr_search(attrs, attr_qt5_widget))) { /* check if we shall use qml */ if (strcmp(attr_widget->u.str, "qwidget") == 0) { use_qml = false; @@ -973,7 +973,7 @@ static struct graphics_priv* graphics_qt5_new(struct navit* nav, struct graphics *meth = graphics_methods; /* get event loop from config and request event loop*/ - event_loop_system = attr_search(attrs, NULL, attr_event_loop_system); + event_loop_system = attr_search(attrs, attr_event_loop_system); if (event_loop_system && event_loop_system->u.str) { //dbg(lvl_debug, "event_system is %s", event_loop_system->u.str); if (!event_request_system(event_loop_system->u.str, "graphics_qt5")) @@ -1002,7 +1002,7 @@ static struct graphics_priv* graphics_qt5_new(struct navit* nav, struct graphics graphics_priv->argv[graphics_priv->argc] = g_strdup("navit"); graphics_priv->argc++; /* Get qt platform from config */ - if ((platform = attr_search(attrs, NULL, attr_qt5_platform))) { + if ((platform = attr_search(attrs, attr_qt5_platform))) { graphics_priv->argv[graphics_priv->argc] = g_strdup("-platform"); graphics_priv->argc++; graphics_priv->argv[graphics_priv->argc] = g_strdup(platform->u.str); @@ -1062,7 +1062,7 @@ static struct graphics_priv* graphics_qt5_new(struct navit* nav, struct graphics graphics_priv->widget = new QNavitWidget(graphics_priv, NULL, Qt::Window); } #endif - if ((fullscreen = attr_search(attrs, NULL, attr_fullscreen)) && (fullscreen->u.num)) { + if ((fullscreen = attr_search(attrs, attr_fullscreen)) && (fullscreen->u.num)) { /* show this maximized */ #if USE_QML if (graphics_priv->window != NULL) @@ -1086,10 +1086,10 @@ static struct graphics_priv* graphics_qt5_new(struct navit* nav, struct graphics geomet = primary->availableGeometry(); } /* check for height */ - if ((h = attr_search(attrs, NULL, attr_h)) && (h->u.num > 100)) + if ((h = attr_search(attrs, attr_h)) && (h->u.num > 100)) geomet.setHeight(h->u.num); /* check for width */ - if ((w = attr_search(attrs, NULL, attr_w)) && (w->u.num > 100)) + if ((w = attr_search(attrs, attr_w)) && (w->u.num > 100)) geomet.setWidth(w->u.num); #if USE_QML if (graphics_priv->window != NULL) { diff --git a/navit/graphics/sdl/graphics_sdl.c b/navit/graphics/sdl/graphics_sdl.c index d926993070..af033fed79 100644 --- a/navit/graphics/sdl/graphics_sdl.c +++ b/navit/graphics/sdl/graphics_sdl.c @@ -437,7 +437,7 @@ static void draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, st x_lw_adj = round((float)lw/2.0); y_lw_adj = 0; } else { - angle = (M_PI/2.0) - atan(abs(dx)/abs(dy)); + angle = (M_PI/2.0) - atan(abs((int)dx)/abs((int)dy)); x_lw_adj = round(sin(angle)*(float)lw/2.0); y_lw_adj = round(cos(angle)*(float)lw/2.0); if((x_lw_adj < 0) || (y_lw_adj < 0)) { @@ -1359,17 +1359,17 @@ static struct graphics_priv *graphics_sdl_new(struct navit *nav, struct graphics this->video_flags = SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_RESIZABLE; #endif - if ((attr=attr_search(attrs, NULL, attr_w))) + if ((attr=attr_search(attrs, attr_w))) w=attr->u.num; - if ((attr=attr_search(attrs, NULL, attr_h))) + if ((attr=attr_search(attrs, attr_h))) h=attr->u.num; - if ((attr=attr_search(attrs, NULL, attr_bpp))) + if ((attr=attr_search(attrs, attr_bpp))) this->video_bpp=attr->u.num; - if ((attr=attr_search(attrs, NULL, attr_flags))) { + if ((attr=attr_search(attrs, attr_flags))) { if (attr->u.num & 1) this->video_flags = SDL_SWSURFACE; } - if ((attr=attr_search(attrs, NULL, attr_frame))) { + if ((attr=attr_search(attrs, attr_frame))) { if(!attr->u.num) this->video_flags |= SDL_NOFRAME; } @@ -1428,7 +1428,7 @@ static struct graphics_priv *graphics_sdl_new(struct navit *nav, struct graphics this->overlay_enable = 1; this->aa = 1; - if((attr=attr_search(attrs, NULL, attr_antialias))) + if((attr=attr_search(attrs, attr_antialias))) this->aa = attr->u.num; this->resize_callback_initial=1; diff --git a/navit/graphics/win32/graphics_win32.c b/navit/graphics/win32/graphics_win32.c index 6346e59f74..f4eda15f40 100644 --- a/navit/graphics/win32/graphics_win32.c +++ b/navit/graphics/win32/graphics_win32.c @@ -1745,19 +1745,19 @@ static struct graphics_priv* graphics_win32_new( struct navit *nav, struct graph this_=graphics_win32_new_helper(meth); this_->nav=nav; this_->frame=1; - if ((attr=attr_search(attrs, NULL, attr_frame))) + if ((attr=attr_search(attrs, attr_frame))) this_->frame=attr->u.num; this_->x=0; - if ((attr=attr_search(attrs, NULL, attr_x))) + if ((attr=attr_search(attrs, attr_x))) this_->x=attr->u.num; this_->y=0; - if ((attr=attr_search(attrs, NULL, attr_y))) + if ((attr=attr_search(attrs, attr_y))) this_->y=attr->u.num; this_->width=792; - if ((attr=attr_search(attrs, NULL, attr_w))) + if ((attr=attr_search(attrs, attr_w))) this_->width=attr->u.num; this_->height=547; - if ((attr=attr_search(attrs, NULL, attr_h))) + if ((attr=attr_search(attrs, attr_h))) this_->height=attr->u.num; this_->overlays = NULL; this_->cbl=cbl; diff --git a/navit/gui.c b/navit/gui.c index f9de8496dc..817bac15ec 100644 --- a/navit/gui.c +++ b/navit/gui.c @@ -40,7 +40,7 @@ gui_new(struct attr *parent, struct attr **attrs) { struct attr *type_attr; struct gui_priv *(*guitype_new)(struct navit *nav, struct gui_methods *meth, struct attr **attrs, struct gui *gui); struct attr cbl; - if (! (type_attr=attr_search(attrs, NULL, attr_type))) { + if (! (type_attr=attr_search(attrs, attr_type))) { return NULL; } diff --git a/navit/gui/gtk/gui_gtk_window.c b/navit/gui/gtk/gui_gtk_window.c index aa510b3749..f0d13528a0 100644 --- a/navit/gui/gtk/gui_gtk_window.c +++ b/navit/gui/gtk/gui_gtk_window.c @@ -688,19 +688,19 @@ static struct gui_priv *gui_gtk_new(struct navit *nav, struct gui_methods *meth, this=g_new0(struct gui_priv, 1); this->nav=nav; - attr = attr_search(attrs, NULL, attr_menubar); + attr = attr_search(attrs, attr_menubar); if (attr) { this->menubar_enable=attr->u.num; } else { this->menubar_enable=1; } - attr=attr_search(attrs, NULL, attr_toolbar); + attr=attr_search(attrs, attr_toolbar); if (attr) { this->toolbar_enable=attr->u.num; } else { this->toolbar_enable=1; } - attr=attr_search(attrs, NULL, attr_statusbar); + attr=attr_search(attrs, attr_statusbar); if (attr) { this->statusbar_enable=attr->u.num; } else { @@ -747,7 +747,7 @@ static struct gui_priv *gui_gtk_new(struct navit *nav, struct gui_methods *meth, navit_add_callback(nav, callback_new_attr_1(callback_cast(gui_gtk_init), attr_navit, this)); - if ((attr=attr_search(attrs, NULL, attr_fullscreen))) + if ((attr=attr_search(attrs, attr_fullscreen))) fullscreen=attr->u.num; if (fullscreen) { diff --git a/navit/gui/internal/gui_internal.c b/navit/gui/internal/gui_internal.c index d9fea2d28b..e8759f3d3f 100644 --- a/navit/gui/internal/gui_internal.c +++ b/navit/gui/internal/gui_internal.c @@ -2007,7 +2007,7 @@ static void gui_internal_add_vehicle_profile(struct gui_priv *this, struct widge #endif // Figure out the profile name - attr = attr_search(profile->attrs, NULL, attr_name); + attr = attr_search(profile->attrs, attr_name); if (!attr) { dbg(lvl_error, "Adding vehicle profile failed. attr==NULL"); return; @@ -3183,101 +3183,101 @@ static struct gui_priv * gui_internal_new(struct navit *nav, struct gui_methods this->self.type=attr_gui; this->self.u.gui=gui; - if ((attr=attr_search(attrs, NULL, attr_menu_on_map_click))) + if ((attr=attr_search(attrs, attr_menu_on_map_click))) this->menu_on_map_click=attr->u.num; else this->menu_on_map_click=1; - if ((attr=attr_search(attrs, NULL, attr_on_map_click))) + if ((attr=attr_search(attrs, attr_on_map_click))) this->on_map_click=g_strdup(attr->u.str); - if ((attr=attr_search(attrs, NULL, attr_signal_on_map_click))) + if ((attr=attr_search(attrs, attr_signal_on_map_click))) this->signal_on_map_click=attr->u.num; gui_internal_command_init(this, attrs); - if( (attr=attr_search(attrs,NULL,attr_font_size))) { + if( (attr=attr_search(attrs,attr_font_size))) { this->config.font_size=attr->u.num; } else { this->config.font_size=-1; } - if( (attr=attr_search(attrs,NULL,attr_icon_xs))) { + if( (attr=attr_search(attrs,attr_icon_xs))) { this->config.icon_xs=attr->u.num; } else { this->config.icon_xs=-1; } - if( (attr=attr_search(attrs,NULL,attr_icon_l))) { + if( (attr=attr_search(attrs,attr_icon_l))) { this->config.icon_l=attr->u.num; } else { this->config.icon_l=-1; } - if( (attr=attr_search(attrs,NULL,attr_icon_s))) { + if( (attr=attr_search(attrs,attr_icon_s))) { this->config.icon_s=attr->u.num; } else { this->config.icon_s=-1; } - if( (attr=attr_search(attrs,NULL,attr_spacing))) { + if( (attr=attr_search(attrs,attr_spacing))) { this->config.spacing=attr->u.num; } else { this->config.spacing=-1; } - if( (attr=attr_search(attrs,NULL,attr_gui_speech))) { + if( (attr=attr_search(attrs,attr_gui_speech))) { this->speech=attr->u.num; } - if( (attr=attr_search(attrs,NULL,attr_keyboard))) + if( (attr=attr_search(attrs,attr_keyboard))) this->keyboard=attr->u.num; else this->keyboard=1; - if( (attr=attr_search(attrs,NULL,attr_fullscreen))) + if( (attr=attr_search(attrs,attr_fullscreen))) this->fullscreen=attr->u.num; - if( (attr=attr_search(attrs,NULL,attr_flags))) + if( (attr=attr_search(attrs,attr_flags))) this->flags=attr->u.num; - if( (attr=attr_search(attrs,NULL,attr_background_color))) + if( (attr=attr_search(attrs,attr_background_color))) this->background_color=*attr->u.color; else this->background_color=color_black; - if( (attr=attr_search(attrs,NULL,attr_background_color2))) + if( (attr=attr_search(attrs,attr_background_color2))) this->background2_color=*attr->u.color; else this->background2_color=back2_color; - if( (attr=attr_search(attrs,NULL,attr_text_color))) + if( (attr=attr_search(attrs,attr_text_color))) this->text_foreground_color=*attr->u.color; else this->text_foreground_color=color_white; - if( (attr=attr_search(attrs,NULL,attr_text_background))) + if( (attr=attr_search(attrs,attr_text_background))) this->text_background_color=*attr->u.color; else this->text_background_color=color_black; - if( (attr=attr_search(attrs,NULL,attr_columns))) + if( (attr=attr_search(attrs,attr_columns))) this->cols=attr->u.num; - if( (attr=attr_search(attrs,NULL,attr_osd_configuration))) + if( (attr=attr_search(attrs,attr_osd_configuration))) this->osd_configuration=*attr; - if( (attr=attr_search(attrs,NULL,attr_pitch))) + if( (attr=attr_search(attrs,attr_pitch))) this->pitch=attr->u.num; else this->pitch=20; - if( (attr=attr_search(attrs,NULL,attr_flags_town))) + if( (attr=attr_search(attrs,attr_flags_town))) this->flags_town=attr->u.num; else this->flags_town=-1; - if( (attr=attr_search(attrs,NULL,attr_flags_street))) + if( (attr=attr_search(attrs,attr_flags_street))) this->flags_street=attr->u.num; else this->flags_street=-1; - if( (attr=attr_search(attrs,NULL,attr_flags_house_number))) + if( (attr=attr_search(attrs,attr_flags_house_number))) this->flags_house_number=attr->u.num; else this->flags_house_number=-1; - if( (attr=attr_search(attrs,NULL,attr_radius))) + if( (attr=attr_search(attrs,attr_radius))) this->radius=attr->u.num; else this->radius=10; - if( (attr=attr_search(attrs,NULL,attr_font))) + if( (attr=attr_search(attrs,attr_font))) this->font_name=g_strdup(attr->u.str); - if((attr=attr_search(attrs, NULL, attr_hide_impossible_next_keys))) + if((attr=attr_search(attrs, attr_hide_impossible_next_keys))) this->hide_keys = attr->u.num; else this->hide_keys = 0; diff --git a/navit/gui/internal/gui_internal_command.c b/navit/gui/internal/gui_internal_command.c index 73def7b187..4c0abcdb5c 100644 --- a/navit/gui/internal/gui_internal_command.c +++ b/navit/gui/internal/gui_internal_command.c @@ -1216,7 +1216,7 @@ static struct command_table commands[] = { void gui_internal_command_init(struct gui_priv *this, struct attr **attrs) { struct attr *attr; - if ((attr=attr_search(attrs, NULL, attr_callback_list))) { + if ((attr=attr_search(attrs, attr_callback_list))) { command_add_table(attr->u.callback_list, commands, sizeof(commands)/sizeof(struct command_table), this); } } diff --git a/navit/gui/qml/gui_qml.cpp b/navit/gui/qml/gui_qml.cpp index 764319e78c..c8d20450ed 100644 --- a/navit/gui/qml/gui_qml.cpp +++ b/navit/gui/qml/gui_qml.cpp @@ -407,34 +407,34 @@ static struct gui_priv * gui_qml_new(struct navit *nav, struct gui_methods *meth navit_ignore_graphics_events(this_->nav, 1); this_->fullscreen = 0; //NO by default - if( (attr=attr_search(attrs,NULL,attr_fullscreen))) + if( (attr=attr_search(attrs,attr_fullscreen))) this_->fullscreen=attr->u.num; this_->menu_on_map_click = 1; //YES by default; - if( (attr=attr_search(attrs,NULL,attr_menu_on_map_click))) + if( (attr=attr_search(attrs,attr_menu_on_map_click))) this_->menu_on_map_click=attr->u.num; this_->signal_on_map_click = 0; //YES by default; - if( (attr=attr_search(attrs,NULL,attr_signal_on_map_click))) + if( (attr=attr_search(attrs,attr_signal_on_map_click))) this_->signal_on_map_click=attr->u.num; this_->radius = 10; //Default value - if( (attr=attr_search(attrs,NULL,attr_radius))) + if( (attr=attr_search(attrs,attr_radius))) this_->radius=attr->u.num; this_->pitch = 20; //Default value - if( (attr=attr_search(attrs,NULL,attr_pitch))) + if( (attr=attr_search(attrs,attr_pitch))) this_->pitch=attr->u.num; this_->lazy = 1; //YES by default - if( (attr=attr_search(attrs,NULL,attr_lazy))) + if( (attr=attr_search(attrs,attr_lazy))) this_->lazy=attr->u.num; this_->w=800; //Default value - if( (attr=attr_search(attrs,NULL,attr_width))) + if( (attr=attr_search(attrs,attr_width))) this_->w=attr->u.num; this_->h=600; //Default value - if( (attr=attr_search(attrs,NULL,attr_height))) + if( (attr=attr_search(attrs,attr_height))) this_->h=attr->u.num; - if( (attr=attr_search(attrs,NULL,attr_source))) + if( (attr=attr_search(attrs,attr_source))) this_->source=attr->u.str; - if( (attr=attr_search(attrs,NULL,attr_skin))) + if( (attr=attr_search(attrs,attr_skin))) this_->skin=attr->u.str; - if( (attr=attr_search(attrs,NULL,attr_icon_src))) + if( (attr=attr_search(attrs,attr_icon_src))) this_->icon_src=attr->u.str; if ( this_->source==NULL ) { @@ -447,7 +447,7 @@ static struct gui_priv * gui_qml_new(struct navit *nav, struct gui_methods *meth this_->icon_src=g_strjoin(NULL,getenv("NAVIT_SHAREDIR"),"/icons/",NULL); } - if ((attr=attr_search(attrs, NULL, attr_callback_list))) { + if ((attr=attr_search(attrs, attr_callback_list))) { command_add_table(attr->u.callback_list, commands, sizeof(commands)/sizeof(struct command_table), this_); } diff --git a/navit/gui/qt5_qml/gui_qt5_qml.cpp b/navit/gui/qt5_qml/gui_qt5_qml.cpp index dfdbf5d143..caab81709d 100644 --- a/navit/gui/qt5_qml/gui_qt5_qml.cpp +++ b/navit/gui/qt5_qml/gui_qt5_qml.cpp @@ -281,7 +281,7 @@ static struct gui_priv* gui_qt5_qml_new(struct navit* nav, struct gui_methods* m gui_priv->menu_on_map_click = 1; /* read config */ - if ((attr = attr_search(attrs, NULL, attr_menu_on_map_click))) + if ((attr = attr_search(attrs, attr_menu_on_map_click))) gui_priv->menu_on_map_click = attr->u.num; /* remember navit internal handle */ diff --git a/navit/layout.c b/navit/layout.c index deed09ef00..0889fb52b5 100644 --- a/navit/layout.c +++ b/navit/layout.c @@ -43,7 +43,7 @@ layout_new(struct attr *parent, struct attr **attrs) { struct attr *name_attr,*color_attr,*order_delta_attr,*font_attr,*day_attr,*night_attr,*active_attr, *underground_alpha_attr,*icon_attr; - if (! (name_attr=attr_search(attrs, NULL, attr_name))) + if (! (name_attr=attr_search(attrs, attr_name))) return NULL; navit = parent->u.navit; if (navit_get_layout_by_name(navit, name_attr->u.str)) { @@ -56,37 +56,37 @@ layout_new(struct attr *parent, struct attr **attrs) { l->func=&layout_func; navit_object_ref((struct navit_object *)l); l->name = g_strdup(name_attr->u.str); - if ((font_attr=attr_search(attrs, NULL, attr_font))) { + if ((font_attr=attr_search(attrs, attr_font))) { l->font = g_strdup(font_attr->u.str); } - if ((day_attr=attr_search(attrs, NULL, attr_daylayout))) { + if ((day_attr=attr_search(attrs, attr_daylayout))) { l->dayname = g_strdup(day_attr->u.str); } - if ((night_attr=attr_search(attrs, NULL, attr_nightlayout))) { + if ((night_attr=attr_search(attrs, attr_nightlayout))) { l->nightname = g_strdup(night_attr->u.str); } - if ((color_attr=attr_search(attrs, NULL, attr_color))) + if ((color_attr=attr_search(attrs, attr_color))) l->color = *color_attr->u.color; else l->color = def_color; - if ((underground_alpha_attr=attr_search(attrs, NULL, attr_underground_alpha))) { + if ((underground_alpha_attr=attr_search(attrs, attr_underground_alpha))) { int a = underground_alpha_attr->u.num; /* for convenience, the alpha value is just 8 bit as usual if using * corresponding attr. therefore we need to shift that up */ l->underground_alpha = (a << 8) | a; } else l->underground_alpha = def_underground_alpha; - if ((icon_attr=attr_search(attrs, NULL, attr_icon_w))) + if ((icon_attr=attr_search(attrs, attr_icon_w))) l->icon_w = icon_attr->u.num; else l->icon_w = -1; - if ((icon_attr=attr_search(attrs, NULL, attr_icon_h))) + if ((icon_attr=attr_search(attrs, attr_icon_h))) l->icon_h = icon_attr->u.num; else l->icon_h = -1; - if ((order_delta_attr=attr_search(attrs, NULL, attr_order_delta))) + if ((order_delta_attr=attr_search(attrs, attr_order_delta))) l->order_delta=order_delta_attr->u.num; - if ((active_attr=attr_search(attrs, NULL, attr_active))) + if ((active_attr=attr_search(attrs, attr_active))) l->active = active_attr->u.num; l->navit=navit; return l; @@ -199,23 +199,23 @@ cursor_new(struct attr *parent, struct attr **attrs) { struct attr *w, *h, *name, *interval, *sequence_range; struct cursor *this; - w=attr_search(attrs, NULL, attr_w); - h=attr_search(attrs, NULL, attr_h); + w=attr_search(attrs, attr_w); + h=attr_search(attrs, attr_h); if (! w || ! h) return NULL; this=g_new0(struct cursor,1); this->w=w->u.num; this->h=h->u.num; - name=attr_search(attrs, NULL, attr_name); + name=attr_search(attrs, attr_name); if (name) this->name=g_strdup(name->u.str); else this->name=g_strdup("default"); - interval=attr_search(attrs, NULL, attr_interval); + interval=attr_search(attrs, attr_interval); if (interval) this->interval=interval->u.num; - sequence_range=attr_search(attrs, NULL, attr_sequence_range); + sequence_range=attr_search(attrs, attr_sequence_range); if (sequence_range) { struct range *r=g_new0(struct range,1); r->min=sequence_range->u.range.min; @@ -358,11 +358,11 @@ struct itemgra * itemgra_new(struct attr *parent, struct attr **attrs) { struct range defrange; itm = g_new0(struct itemgra, 1); - order=attr_search(attrs, NULL, attr_order); - item_types=attr_search(attrs, NULL, attr_item_types); - speed_range=attr_search(attrs, NULL, attr_speed_range); - angle_range=attr_search(attrs, NULL, attr_angle_range); - sequence_range=attr_search(attrs, NULL, attr_sequence_range); + order=attr_search(attrs, attr_order); + item_types=attr_search(attrs, attr_item_types); + speed_range=attr_search(attrs, attr_speed_range); + angle_range=attr_search(attrs, attr_angle_range); + sequence_range=attr_search(attrs, attr_sequence_range); defrange.min=0; defrange.max=32767; if (order) @@ -409,14 +409,14 @@ int itemgra_add_attr(struct itemgra *itemgra, struct attr *attr) { static void element_set_oneway(struct element *e, struct attr **attrs) { struct attr *oneway; - oneway=attr_search(attrs, NULL, attr_oneway); + oneway=attr_search(attrs, attr_oneway); if (oneway) e->oneway=oneway->u.num; } static void element_set_color(struct element *e, struct attr **attrs) { struct attr *color; - color=attr_search(attrs, NULL, attr_color); + color=attr_search(attrs, attr_color); if (color) e->color=*color->u.color; } @@ -424,7 +424,7 @@ static void element_set_color(struct element *e, struct attr **attrs) { static void element_set_background_color(struct color *c, struct attr **attrs) { struct attr *color; - color=attr_search(attrs, NULL, attr_background_color); + color=attr_search(attrs, attr_background_color); if (color) *c=*color->u.color; } @@ -432,14 +432,14 @@ static void element_set_background_color(struct color *c, struct attr **attrs) { static void element_set_text_size(struct element *e, struct attr **attrs) { struct attr *text_size; - text_size=attr_search(attrs, NULL, attr_text_size); + text_size=attr_search(attrs, attr_text_size); if (text_size) e->text_size=text_size->u.num; } static void element_set_arrows_width(struct element *e, struct attr **attrs) { struct attr *width; - width=attr_search(attrs, NULL, attr_width); + width=attr_search(attrs, attr_width); if (width) e->u.arrows.width=width->u.num; else @@ -448,14 +448,14 @@ static void element_set_arrows_width(struct element *e, struct attr **attrs) { static void element_set_polyline_width(struct element *e, struct attr **attrs) { struct attr *width; - width=attr_search(attrs, NULL, attr_width); + width=attr_search(attrs, attr_width); if (width) e->u.polyline.width=width->u.num; } static void element_set_polyline_directed(struct element *e, struct attr **attrs) { struct attr *directed; - directed=attr_search(attrs, NULL, attr_directed); + directed=attr_search(attrs, attr_directed); if (directed) e->u.polyline.directed=directed->u.num; } @@ -464,7 +464,7 @@ static void element_set_polyline_dash(struct element *e, struct attr **attrs) { struct attr *dash; int i; - dash=attr_search(attrs, NULL, attr_dash); + dash=attr_search(attrs, attr_dash); if (dash) { for (i=0; i<4; i++) { if (!dash->u.dash[i]) @@ -477,21 +477,21 @@ static void element_set_polyline_dash(struct element *e, struct attr **attrs) { static void element_set_polyline_offset(struct element *e, struct attr **attrs) { struct attr *offset; - offset=attr_search(attrs, NULL, attr_offset); + offset=attr_search(attrs, attr_offset); if (offset) e->u.polyline.offset=offset->u.num; } static void element_set_circle_width(struct element *e, struct attr **attrs) { struct attr *width; - width=attr_search(attrs, NULL, attr_width); + width=attr_search(attrs, attr_width); if (width) e->u.circle.width=width->u.num; } static void element_set_circle_radius(struct element *e, struct attr **attrs) { struct attr *radius; - radius=attr_search(attrs, NULL, attr_radius); + radius=attr_search(attrs, attr_radius); if (radius) e->u.circle.radius=radius->u.num; } @@ -502,7 +502,7 @@ polygon_new(struct attr *parent, struct attr **attrs) { int add_size_to_e=0; struct attr *src,*w,*h,*rotation,*x,*y; /* search fot icon src first as this increases the required memory for e*/ - src=attr_search(attrs, NULL, attr_src); + src=attr_search(attrs, attr_src); if (src != NULL) { add_size_to_e += strlen(src->u.str)+1; } @@ -517,27 +517,27 @@ polygon_new(struct attr *parent, struct attr **attrs) { if (src != NULL) { e->u.polygon.src=(char *)(e+1); strcpy(e->u.polygon.src,src->u.str); - if ((w=attr_search(attrs, NULL, attr_w))) + if ((w=attr_search(attrs, attr_w))) e->u.polygon.width=w->u.num; else e->u.polygon.width=-1; - if ((h=attr_search(attrs, NULL, attr_h))) + if ((h=attr_search(attrs, attr_h))) e->u.polygon.height=h->u.num; else e->u.polygon.height=-1; - if ((x=attr_search(attrs, NULL, attr_x))) + if ((x=attr_search(attrs, attr_x))) e->u.polygon.x=x->u.num; else e->u.polygon.x=-1; - if ((y=attr_search(attrs, NULL, attr_y))) + if ((y=attr_search(attrs, attr_y))) e->u.polygon.y=y->u.num; else e->u.polygon.y=-1; - if ((rotation=attr_search(attrs, NULL, attr_rotation))) + if ((rotation=attr_search(attrs, attr_rotation))) e->u.polygon.rotation=rotation->u.num; } @@ -601,29 +601,29 @@ struct icon * icon_new(struct attr *parent, struct attr **attrs) { struct element *e; struct attr *src,*w,*h,*rotation,*x,*y; - src=attr_search(attrs, NULL, attr_src); + src=attr_search(attrs, attr_src); if (! src) return NULL; e = g_malloc0(sizeof(*e)+strlen(src->u.str)+1); e->type=element_icon; e->u.icon.src=(char *)(e+1); - if ((w=attr_search(attrs, NULL, attr_w))) + if ((w=attr_search(attrs, attr_w))) e->u.icon.width=w->u.num; else e->u.icon.width=-1; - if ((h=attr_search(attrs, NULL, attr_h))) + if ((h=attr_search(attrs, attr_h))) e->u.icon.height=h->u.num; else e->u.icon.height=-1; - if ((x=attr_search(attrs, NULL, attr_x))) + if ((x=attr_search(attrs, attr_x))) e->u.icon.x=x->u.num; else e->u.icon.x=-1; - if ((y=attr_search(attrs, NULL, attr_y))) + if ((y=attr_search(attrs, attr_y))) e->u.icon.y=y->u.num; else e->u.icon.y=-1; - if ((rotation=attr_search(attrs, NULL, attr_rotation))) + if ((rotation=attr_search(attrs, attr_rotation))) e->u.icon.rotation=rotation->u.num; strcpy(e->u.icon.src,src->u.str); diff --git a/navit/log.c b/navit/log.c index d68312938a..490414c037 100644 --- a/navit/log.c +++ b/navit/log.c @@ -369,7 +369,7 @@ log_new(struct attr * parent,struct attr **attrs) { dbg(lvl_debug,"enter"); ret->func=&log_func; navit_object_ref((struct navit_object *)ret); - data=attr_search(attrs, NULL, attr_data); + data=attr_search(attrs, attr_data); if (! data) return NULL; filename=data->u.str; @@ -382,19 +382,19 @@ log_new(struct attr * parent,struct attr **attrs) { ret->filename=g_strdup(filename); if (wexp) file_wordexp_destroy(wexp); - overwrite=attr_search(attrs, NULL, attr_overwrite); + overwrite=attr_search(attrs, attr_overwrite); if (overwrite) ret->overwrite=overwrite->u.num; - lazy=attr_search(attrs, NULL, attr_lazy); + lazy=attr_search(attrs, attr_lazy); if (lazy) ret->lazy=lazy->u.num; - mkdir=attr_search(attrs, NULL, attr_mkdir); + mkdir=attr_search(attrs, attr_mkdir); if (mkdir) ret->mkdir=mkdir->u.num; - flush_size=attr_search(attrs, NULL, attr_flush_size); + flush_size=attr_search(attrs, attr_flush_size); if (flush_size) ret->flush_size=flush_size->u.num; - flush_time=attr_search(attrs, NULL, attr_flush_time); + flush_time=attr_search(attrs, attr_flush_time); if (flush_time) ret->flush_time=flush_time->u.num; if (ret->flush_time) { diff --git a/navit/map.c b/navit/map.c index 66b1cd303e..c8cddbcc23 100644 --- a/navit/map.c +++ b/navit/map.c @@ -92,7 +92,7 @@ struct map * map_new(struct attr *parent, struct attr **attrs) { struct map *m; struct map_priv *(*maptype_new)(struct map_methods *meth, struct attr **attrs, struct callback_list *cbl); - struct attr *type=attr_search(attrs, NULL, attr_type); + struct attr *type=attr_search(attrs, attr_type); if (! type) { dbg(lvl_error,"missing type"); diff --git a/navit/map/binfile/binfile.c b/navit/map/binfile/binfile.c index 865e3d72b5..6108154b6e 100644 --- a/navit/map/binfile/binfile.c +++ b/navit/map/binfile/binfile.c @@ -2647,7 +2647,7 @@ static void binfile_check_version(struct map_priv *m) { static struct map_priv *map_new_binfile(struct map_methods *meth, struct attr **attrs, struct callback_list *cbl) { struct map_priv *m; - struct attr *data=attr_search(attrs, NULL, attr_data); + struct attr *data=attr_search(attrs, attr_data); struct attr *check_version,*flags,*url,*download_enabled; struct file_wordexp *wexp; char **wexp_data; @@ -2664,16 +2664,16 @@ static struct map_priv *map_new_binfile(struct map_methods *meth, struct attr ** m->id=++map_id; m->filename=g_strdup(wexp_data[0]); file_wordexp_destroy(wexp); - check_version=attr_search(attrs, NULL, attr_check_version); + check_version=attr_search(attrs, attr_check_version); if (check_version) m->check_version=check_version->u.num; - flags=attr_search(attrs, NULL, attr_flags); + flags=attr_search(attrs, attr_flags); if (flags) m->flags=flags->u.num; - url=attr_search(attrs, NULL, attr_url); + url=attr_search(attrs, attr_url); if (url) m->url=g_strdup(url->u.str); - download_enabled = attr_search(attrs, NULL, attr_update); + download_enabled = attr_search(attrs, attr_update); if (download_enabled) m->download_enabled=download_enabled->u.num; diff --git a/navit/map/csv/csv.c b/navit/map/csv/csv.c index e463985b0e..e54a840d49 100644 --- a/navit/map/csv/csv.c +++ b/navit/map/csv/csv.c @@ -661,7 +661,7 @@ static struct map_priv *map_new_csv(struct map_methods *meth, struct attr **attr m->qitem_hash = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, quadtree_item_free_do); m->tree_root = tree_root; - attr_types = attr_search(attrs, NULL, attr_attr_types); + attr_types = attr_search(attrs, attr_attr_types); if(attr_types) { enum attr_type* at = attr_types->u.attr_types; while(*at != attr_none) { @@ -682,7 +682,7 @@ static struct map_priv *map_new_csv(struct map_methods *meth, struct attr **attr return NULL; } - charset = attr_search(attrs, NULL, attr_charset); + charset = attr_search(attrs, attr_charset); if(charset) { dbg(lvl_debug,"charset:%s",charset->u.str); m->charset=g_strdup(charset->u.str); @@ -694,7 +694,7 @@ static struct map_priv *map_new_csv(struct map_methods *meth, struct attr **attr return NULL; } - item_type_attr=attr_search(attrs, NULL, attr_item_type); + item_type_attr=attr_search(attrs, attr_item_type); if( !item_type_attr || item_type_attr->u.item_type==type_none) { return NULL; @@ -702,13 +702,13 @@ static struct map_priv *map_new_csv(struct map_methods *meth, struct attr **attr m->item_type = item_type_attr->u.item_type; - flags=attr_search(attrs, NULL, attr_flags); + flags=attr_search(attrs, attr_flags); if (flags) m->flags=flags->u.num; *meth = map_methods_csv; - data=attr_search(attrs, NULL, attr_data); + data=attr_search(attrs, attr_data); if(data) { struct file_wordexp *wexp; diff --git a/navit/map/filter/filter.c b/navit/map/filter/filter.c index c8f4f10294..1925b9e802 100644 --- a/navit/map/filter/filter.c +++ b/navit/map/filter/filter.c @@ -354,7 +354,7 @@ static struct map_methods map_methods_filter = { static struct map_priv *map_filter_new(struct map_methods *meth, struct attr **attrs, struct callback_list *cbl) { struct map_priv *m=NULL; - struct attr **parent_attrs,type,*subtype=attr_search(attrs, NULL, attr_subtype),*filter=attr_search(attrs, NULL, + struct attr **parent_attrs,type,*subtype=attr_search(attrs, attr_subtype),*filter=attr_search(attrs, attr_filter); struct map *map; int i,j; diff --git a/navit/map/garmin/garmin.c b/navit/map/garmin/garmin.c index 00a6fa1152..2f4808b3bf 100644 --- a/navit/map/garmin/garmin.c +++ b/navit/map/garmin/garmin.c @@ -873,16 +873,16 @@ static struct map_priv *gmap_new(struct map_methods *meth, struct attr **attrs, struct gar_config cfg; int debugmask = 0; - data=attr_search(attrs, NULL, attr_data); + data=attr_search(attrs, attr_data); if (! data) return NULL; - debug=attr_search(attrs, NULL, attr_debug); + debug=attr_search(attrs, attr_debug); if (debug) { dl = atoi(debug->u.str); if (!dl) dl = 1; } - flags=attr_search(attrs, NULL, attr_flags); + flags=attr_search(attrs, attr_flags); if (flags) { debugmask = flags->u.num; } diff --git a/navit/map/garmin_img/garmin_img.c b/navit/map/garmin_img/garmin_img.c index 73a7dc92b5..79219cf069 100644 --- a/navit/map/garmin_img/garmin_img.c +++ b/navit/map/garmin_img/garmin_img.c @@ -1411,7 +1411,7 @@ static struct map_methods map_methods_garmin_img = { static struct map_priv *map_new_garmin_img(struct map_methods *meth, struct attr **attrs) { struct map_priv *m; - struct attr *data=attr_search(attrs, NULL, attr_data); + struct attr *data=attr_search(attrs, attr_data); if (! data) return NULL; diff --git a/navit/map/mg/map.c b/navit/map/mg/map.c index 50860e1933..071ba131e9 100644 --- a/navit/map/mg/map.c +++ b/navit/map/mg/map.c @@ -549,7 +549,7 @@ struct map_priv * map_new_mg(struct map_methods *meth, struct attr **attrs, struct callback_list *cbl) { struct map_priv *m; int i,maybe_missing; - struct attr *data=attr_search(attrs, NULL, attr_data); + struct attr *data=attr_search(attrs, attr_data); char *filename; struct file_wordexp *wexp; char **wexp_data; @@ -561,7 +561,7 @@ map_new_mg(struct map_methods *meth, struct attr **attrs, struct callback_list * wexp_data=file_wordexp_get_array(wexp); *meth=map_methods_mg; - data=attr_search(attrs, NULL, attr_data); + data=attr_search(attrs, attr_data); m=g_new(struct map_priv, 1); m->id=++map_id; diff --git a/navit/map/shapefile/shapefile.c b/navit/map/shapefile/shapefile.c index 1031b6903a..66e7cb380e 100644 --- a/navit/map/shapefile/shapefile.c +++ b/navit/map/shapefile/shapefile.c @@ -590,10 +590,10 @@ static struct map_methods map_methods_shapefile = { static struct map_priv *map_new_shapefile(struct map_methods *meth, struct attr **attrs, struct callback_list *cbl) { struct map_priv *m; - struct attr *data=attr_search(attrs, NULL, attr_data); - struct attr *charset=attr_search(attrs, NULL, attr_charset); - struct attr *projectionname=attr_search(attrs, NULL, attr_projectionname); - struct attr *flags=attr_search(attrs, NULL, attr_flags); + struct attr *data=attr_search(attrs, attr_data); + struct attr *charset=attr_search(attrs, attr_charset); + struct attr *projectionname=attr_search(attrs, attr_projectionname); + struct attr *flags=attr_search(attrs, attr_flags); struct file_wordexp *wexp; char *wdata; char **wexp_data; diff --git a/navit/map/textfile/textfile.c b/navit/map/textfile/textfile.c index 12381d6c03..0211a45268 100644 --- a/navit/map/textfile/textfile.c +++ b/navit/map/textfile/textfile.c @@ -328,10 +328,10 @@ static struct map_methods map_methods_textfile = { static struct map_priv *map_new_textfile(struct map_methods *meth, struct attr **attrs, struct callback_list *cbl) { struct map_priv *m; - struct attr *data=attr_search(attrs, NULL, attr_data); - struct attr *charset=attr_search(attrs, NULL, attr_charset); - struct attr *flags=attr_search(attrs, NULL, attr_flags); - struct attr *no_warn=attr_search(attrs, NULL, attr_no_warning_if_map_file_missing); + struct attr *data=attr_search(attrs, attr_data); + struct attr *charset=attr_search(attrs, attr_charset); + struct attr *flags=attr_search(attrs, attr_flags); + struct attr *no_warn=attr_search(attrs, attr_no_warning_if_map_file_missing); struct file_wordexp *wexp; int len,is_pipe=0; char *wdata; diff --git a/navit/maps.c b/navit/maps.c index 4caf6dcf89..a92041ec09 100644 --- a/navit/maps.c +++ b/navit/maps.c @@ -40,13 +40,13 @@ maps_new(struct attr *parent, struct attr **attrs) { } dbg(lvl_debug,"enter"); attrs_dup=attr_list_dup(attrs); - data=attr_search(attrs_dup, NULL, attr_data); + data=attr_search(attrs_dup, attr_data); if (data) { struct file_wordexp *wexp=file_wordexp_new(data->u.str); int i,count=file_wordexp_get_count(wexp); char **array=file_wordexp_get_array(wexp); struct attr *name; - struct attr *name_provided = attr_search(attrs_dup, NULL, attr_name); + struct attr *name_provided = attr_search(attrs_dup, attr_name); // if no name was provided, fill the name with the location if (!name_provided) { @@ -54,7 +54,7 @@ maps_new(struct attr *parent, struct attr **attrs) { name_tmp.type = attr_name; name_tmp.u.str="NULL"; attrs_dup=attr_generic_add_attr(attrs_dup, &name_tmp); - name = attr_search(attrs_dup, NULL, attr_name); + name = attr_search(attrs_dup, attr_name); } for (i = 0 ; i < count ; i++) { diff --git a/navit/navigation.c b/navit/navigation.c index 1ddec7d33d..dd7c9fbf58 100644 --- a/navit/navigation.c +++ b/navit/navigation.c @@ -793,13 +793,13 @@ navigation_new(struct attr *parent, struct attr **attrs) { } } - if ((attr=attr_search(attrs, NULL, attr_tell_street_name))) { + if ((attr=attr_search(attrs, attr_tell_street_name))) { ret->tell_street_name = attr->u.num; } - if ((attr=attr_search(attrs, NULL, attr_delay))) { + if ((attr=attr_search(attrs, attr_delay))) { ret->delay = attr->u.num; } - if ((attr=attr_search(attrs, NULL, attr_flags))) { + if ((attr=attr_search(attrs, attr_flags))) { ret->flags = attr->u.num; } return ret; @@ -4294,7 +4294,7 @@ static struct map_priv *navigation_map_new(struct map_methods *meth, struct attr struct map_priv *ret; struct attr *navigation_attr; - navigation_attr=attr_search(attrs, NULL, attr_navigation); + navigation_attr=attr_search(attrs, attr_navigation); if (! navigation_attr) return NULL; ret=g_new0(struct map_priv, 1); diff --git a/navit/navit.c b/navit/navit.c index 50d639896f..0886778f09 100644 --- a/navit/navit.c +++ b/navit/navit.c @@ -767,7 +767,7 @@ static void navit_autozoom(struct navit *this_, struct coord *center, int speed, new_scale = (double)distance / w * 16; } - if (abs(new_scale - scale) < 2) { + if (abs((int)new_scale - (int)scale) < 2) { return; // Smoothing } if (new_scale > this_->autozoom_max) diff --git a/navit/osd.c b/navit/osd.c index 8b548b0444..218a4a51d7 100644 --- a/navit/osd.c +++ b/navit/osd.c @@ -45,7 +45,7 @@ struct osd * osd_new(struct attr *parent, struct attr **attrs) { struct osd *o; struct osd_priv *(*new)(struct navit *nav, struct osd_methods *meth, struct attr **attrs); - struct attr *type=attr_search(attrs, NULL, attr_type),cbl; + struct attr *type=attr_search(attrs, attr_type),cbl; if (! type) return NULL; @@ -301,55 +301,55 @@ void osd_set_std_attr(struct attr **attrs, struct osd_item *item, int flags) { item->color_bg.a = 0x9fff; } - attr=attr_search(attrs, NULL, attr_osd_configuration); + attr=attr_search(attrs, attr_osd_configuration); if (attr) item->osd_configuration = attr->u.num; - attr=attr_search(attrs, NULL, attr_enable_expression); + attr=attr_search(attrs, attr_enable_expression); if (attr) { item->enable_cs = command_saved_new(attr->u.str, item->navit, NULL, 0); } - attr = attr_search(attrs, NULL, attr_w); + attr = attr_search(attrs, attr_w); if (attr) { item->rel_w = attr->u.num; } - attr = attr_search(attrs, NULL, attr_h); + attr = attr_search(attrs, attr_h); if (attr) { item->rel_h = attr->u.num; } - attr = attr_search(attrs, NULL, attr_x); + attr = attr_search(attrs, attr_x); if (attr) { item->rel_x = attr->u.num; } - attr = attr_search(attrs, NULL, attr_y); + attr = attr_search(attrs, attr_y); if (attr) { item->rel_y = attr->u.num; } - attr = attr_search(attrs, NULL, attr_font_size); + attr = attr_search(attrs, attr_font_size); if (attr) item->font_size = attr->u.num; - attr=attr_search(attrs, NULL, attr_background_color); + attr=attr_search(attrs, attr_background_color); if (attr) item->color_bg=*attr->u.color; - attr = attr_search(attrs, NULL, attr_command); + attr = attr_search(attrs, attr_command); if (attr) item->command = g_strdup(attr->u.str); - attr=attr_search(attrs, NULL, attr_text_color); + attr=attr_search(attrs, attr_text_color); if (attr) item->text_color=*attr->u.color; - attr=attr_search(attrs, NULL, attr_foreground_color); + attr=attr_search(attrs, attr_foreground_color); if (attr) item->color_fg=*attr->u.color; - attr=attr_search(attrs, NULL, attr_accesskey); + attr=attr_search(attrs, attr_accesskey); if (attr) item->accesskey = g_strdup(attr->u.str); - attr=attr_search(attrs, NULL, attr_font); + attr=attr_search(attrs, attr_font); if (attr) item->font_name = g_strdup(attr->u.str); diff --git a/navit/osd/core/osd_core.c b/navit/osd/core/osd_core.c index d0b96a51eb..cfbb0655c8 100644 --- a/navit/osd/core/osd_core.c +++ b/navit/osd/core/osd_core.c @@ -514,34 +514,34 @@ static struct osd_priv *osd_route_guard_new(struct navit *nav, struct osd_method osd_set_std_attr(attrs, &opc->osd_item, ITEM_HAS_TEXT); - attr = attr_search(attrs, NULL, attr_min_dist); + attr = attr_search(attrs, attr_min_dist); if (attr) { this->min_dist = attr->u.num; } else this->min_dist = 30; //default tolerance is 30m - attr = attr_search(attrs, NULL, attr_max_dist); + attr = attr_search(attrs, attr_max_dist); if (attr) { this->max_dist = attr->u.num; } else this->max_dist = 500; //default - attr = attr_search(attrs, NULL, attr_item_name); + attr = attr_search(attrs, attr_item_name); if (attr) { this->item_name = g_strdup(attr->u.str); } else this->item_name = NULL; - attr = attr_search(attrs, NULL, attr_map_name); + attr = attr_search(attrs, attr_map_name); if (attr) { this->map_name = g_strdup(attr->u.str); } else this->map_name = NULL; - attr = attr_search(attrs, NULL, attr_update_period); + attr = attr_search(attrs, attr_update_period); this->update_period=attr ? attr->u.num : 10; - attr = attr_search(attrs, NULL, attr_width); + attr = attr_search(attrs, attr_width); this->width=attr ? attr->u.num : 2; navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_route_guard_init), attr_graphics_ready, opc)); @@ -1069,45 +1069,45 @@ static struct osd_priv *osd_odometer_new(struct navit *nav, struct osd_methods * this->last_coord.x = -1; this->last_coord.y = -1; - attr = attr_search(attrs, NULL, attr_label); + attr = attr_search(attrs, attr_label); //FIXME find some way to free text!!!! if (attr) { this->text = g_strdup(attr->u.str); } else this->text = NULL; - attr = attr_search(attrs, NULL, attr_name); + attr = attr_search(attrs, attr_name); //FIXME find some way to free text!!!! if (attr) { this->name = g_strdup(attr->u.str); } else this->name = NULL; - attr = attr_search(attrs, NULL, attr_disable_reset); + attr = attr_search(attrs, attr_disable_reset); if (attr) this->bDisableReset = attr->u.num; else this->bDisableReset = 0; - attr = attr_search(attrs, NULL, attr_autostart); + attr = attr_search(attrs, attr_autostart); if (attr) this->bAutoStart = attr->u.num; else this->bAutoStart = 0; - attr = attr_search(attrs, NULL, attr_autosave_period); + attr = attr_search(attrs, attr_autosave_period); if (attr) this->autosave_period = attr->u.num; else this->autosave_period = -1; //disabled by default - attr = attr_search(attrs, NULL, attr_align); + attr = attr_search(attrs, attr_align); if (attr) this->align=attr->u.num; osd_set_std_attr(attrs, &opc->osd_item, ITEM_HAS_TEXT); - attr = attr_search(attrs, NULL, attr_width); + attr = attr_search(attrs, attr_width); this->width=attr ? attr->u.num : 2; - attr = attr_search(attrs, NULL, attr_idle_color); + attr = attr_search(attrs, attr_idle_color); this->idle_color=attr ? *attr->u.color : orange_color; // text idle_color defaults to orange this->last_coord.x = -1; @@ -1278,13 +1278,13 @@ static struct osd_priv *osd_cmd_interface_new(struct navit *nav, struct osd_meth osd_set_std_attr(attrs, &opc->osd_item, ITEM_HAS_TEXT); - attr = attr_search(attrs, NULL, attr_width); + attr = attr_search(attrs, attr_width); this->width=attr ? attr->u.num : 2; - attr = attr_search(attrs, NULL, attr_update_period); + attr = attr_search(attrs, attr_update_period); this->update_period=attr ? attr->u.num : 5; //default update period is 5 seconds - attr = attr_search(attrs, NULL, attr_command); + attr = attr_search(attrs, attr_command); this->command = attr ? g_strdup(attr->u.str) : g_strdup(""); if(b_commandtable_added == 0) { @@ -1436,11 +1436,11 @@ static struct osd_priv *osd_stopwatch_new(struct navit *nav, struct osd_methods this->last_click_time = 0; osd_set_std_attr(attrs, &opc->osd_item, ITEM_HAS_TEXT); - attr = attr_search(attrs, NULL, attr_width); + attr = attr_search(attrs, attr_width); this->width=attr ? attr->u.num : 2; - attr = attr_search(attrs, NULL, attr_idle_color); + attr = attr_search(attrs, attr_idle_color); this->idle_color=attr ? *attr->u.color : orange_color; // text idle_color defaults to orange - attr = attr_search(attrs, NULL, attr_disable_reset); + attr = attr_search(attrs, attr_disable_reset); if (attr) this->bDisableReset = attr->u.num; else @@ -1550,12 +1550,12 @@ static struct osd_priv *osd_compass_new(struct navit *nav, struct osd_methods *m opc->osd_item.meth.draw = osd_draw_cast(osd_compass_draw); meth->set_attr = set_std_osd_attr; osd_set_std_attr(attrs, &opc->osd_item, ITEM_HAS_TEXT); - attr = attr_search(attrs, NULL, attr_width); + attr = attr_search(attrs, attr_width); this->width=attr ? attr->u.num : 2; - attr = attr_search(attrs, NULL, attr_destination_dir_color); + attr = attr_search(attrs, attr_destination_dir_color); this->destination_dir_color=attr ? *attr->u.color : green_color; /* Pick destination color from configuration, default to green if unspecified */ - attr = attr_search(attrs, NULL, attr_north_color); + attr = attr_search(attrs, attr_north_color); this->north_color=attr ? *attr->u.color : red_color; /* Pick north handle color from configuration, default to red if unspecified */ @@ -1741,7 +1741,7 @@ static struct osd_priv *osd_button_new(struct navit *nav, struct osd_methods *me meth->set_attr = set_std_osd_attr; opc->spec_set_attr_func = osd_button_set_attr; - attr=attr_search(attrs, NULL, attr_use_overlay); + attr=attr_search(attrs, attr_use_overlay); if (attr) this->use_overlay=attr->u.num; @@ -1751,12 +1751,12 @@ static struct osd_priv *osd_button_new(struct navit *nav, struct osd_methods *me dbg(lvl_error, "no command"); goto error; } - attr = attr_search(attrs, NULL, attr_src_dir); + attr = attr_search(attrs, attr_src_dir); if (attr) this->src_dir=graphics_icon_path(attr->u.str); else this->src_dir=NULL; - attr = attr_search(attrs, NULL, attr_src); + attr = attr_search(attrs, attr_src); if (!attr) { dbg(lvl_error, "no src"); goto error; @@ -1825,14 +1825,14 @@ static struct osd_priv *osd_image_new(struct navit *nav, struct osd_methods *met meth->set_attr = set_std_osd_attr; opc->spec_set_attr_func = osd_button_set_attr; - attr=attr_search(attrs, NULL, attr_use_overlay); + attr=attr_search(attrs, attr_use_overlay); if (attr) this->use_overlay=attr->u.num; osd_set_std_attr(attrs, &opc->osd_item, this->use_overlay ? TRANSPARENT_BG:(TRANSPARENT_BG|DISABLE_OVERLAY)); - attr = attr_search(attrs, NULL, attr_src); + attr = attr_search(attrs, attr_src); if (!attr) { dbg(lvl_error, "no src"); goto error; @@ -2019,15 +2019,15 @@ static struct osd_priv *osd_navigation_status_new(struct navit *nav, struct osd_ this->icon_h = -1; this->last_status = status_invalid; - attr = attr_search(attrs, NULL, attr_icon_w); + attr = attr_search(attrs, attr_icon_w); if (attr) this->icon_w = attr->u.num; - attr = attr_search(attrs, NULL, attr_icon_h); + attr = attr_search(attrs, attr_icon_h); if (attr) this->icon_h = attr->u.num; - attr = attr_search(attrs, NULL, attr_icon_src); + attr = attr_search(attrs, attr_icon_src); if (attr) { struct file_wordexp *we; char **array; @@ -2165,15 +2165,15 @@ static struct osd_priv *osd_nav_next_turn_new(struct navit *nav, struct osd_meth this->active = -1; this->level = 0; - attr = attr_search(attrs, NULL, attr_icon_w); + attr = attr_search(attrs, attr_icon_w); if (attr) this->icon_w = attr->u.num; - attr = attr_search(attrs, NULL, attr_icon_h); + attr = attr_search(attrs, attr_icon_h); if (attr) this->icon_h = attr->u.num; - attr = attr_search(attrs, NULL, attr_icon_src); + attr = attr_search(attrs, attr_icon_src); if (attr) { struct file_wordexp *we; char **array; @@ -2185,7 +2185,7 @@ static struct osd_priv *osd_nav_next_turn_new(struct navit *nav, struct osd_meth this->icon_src = graphics_icon_path("%s_wh.svg"); } - attr = attr_search(attrs, NULL, attr_level); + attr = attr_search(attrs, attr_level); if (attr) this->level=attr->u.num; @@ -2287,7 +2287,7 @@ static struct osd_priv *osd_nav_toggle_announcer_new(struct navit *nav, struct o this->last_state = -1; - attr = attr_search(attrs, NULL, attr_icon_src); + attr = attr_search(attrs, attr_icon_src); if (attr) { struct file_wordexp *we; char **array; @@ -2562,25 +2562,25 @@ static struct osd_priv *osd_speed_cam_new(struct navit *nav, struct osd_methods meth->set_attr = set_std_osd_attr; osd_set_std_attr(attrs, &opc->osd_item, ITEM_HAS_TEXT); - attr = attr_search(attrs, NULL, attr_width); + attr = attr_search(attrs, attr_width); this->width=attr ? attr->u.num : 2; - attr = attr_search(attrs, NULL, attr_idle_color); + attr = attr_search(attrs, attr_idle_color); this->idle_color=attr ? *attr->u.color : default_color; // text idle_color defaults to orange - attr = attr_search(attrs, NULL, attr_label); + attr = attr_search(attrs, attr_label); if (attr) { this->text = g_strdup(attr->u.str); } else this->text = NULL; - attr = attr_search(attrs, NULL, attr_announce_on); + attr = attr_search(attrs, attr_announce_on); if (attr) { this->announce_on = attr->u.num; } else { this->announce_on = 1; //announce by default } - attr = attr_search(attrs, NULL, attr_flags); + attr = attr_search(attrs, attr_flags); if (attr) { this->flags = attr->u.num; } else { @@ -2820,33 +2820,33 @@ static struct osd_priv *osd_speed_warner_new(struct navit *nav, struct osd_metho opc->osd_item.meth.draw = osd_draw_cast(osd_speed_warner_draw); meth->set_attr = set_std_osd_attr; - attr = attr_search(attrs, NULL, attr_speed_exceed_limit_offset); + attr = attr_search(attrs, attr_speed_exceed_limit_offset); if (attr) { this->speed_exceed_limit_offset = attr->u.num; } else this->speed_exceed_limit_offset = 15; //by default 15 km/h - attr = attr_search(attrs, NULL, attr_speed_exceed_limit_percent); + attr = attr_search(attrs, attr_speed_exceed_limit_percent); if (attr) { this->speed_exceed_limit_percent = attr->u.num; } else this->speed_exceed_limit_percent = 10; //by default factor of 1.1 this->bTextOnly = 0; //by default display graphics also - attr = attr_search(attrs, NULL, attr_label); + attr = attr_search(attrs, attr_label); if (attr) { this->label_str = g_strdup(attr->u.str); if (!strcmp("text_only",attr->u.str)) { this->bTextOnly = 1; } } - attr = attr_search(attrs, NULL, attr_timeout); + attr = attr_search(attrs, attr_timeout); if (attr) this->timeout = attr->u.num; else this->timeout = 10; // 10s timeout by default - attr = attr_search(attrs, NULL, attr_announce_on); + attr = attr_search(attrs, attr_announce_on); if (attr) this->announce_on = attr->u.num; else @@ -3456,12 +3456,12 @@ static struct osd_priv *osd_text_new(struct navit *nav, struct osd_methods *meth this->active = -1; this->last = NULL; - attr = attr_search(attrs, NULL, attr_label); + attr = attr_search(attrs, attr_label); if (attr) this->text = g_strdup(attr->u.str); else this->text = NULL; - attr = attr_search(attrs, NULL, attr_align); + attr = attr_search(attrs, attr_align); if (attr) this->align=attr->u.num; @@ -3566,15 +3566,15 @@ static struct osd_priv *osd_gps_status_new(struct navit *nav, struct osd_methods this->active = -1; this->strength = -2; - attr = attr_search(attrs, NULL, attr_icon_w); + attr = attr_search(attrs, attr_icon_w); if (attr) this->icon_w = attr->u.num; - attr = attr_search(attrs, NULL, attr_icon_h); + attr = attr_search(attrs, attr_icon_h); if (attr) this->icon_h = attr->u.num; - attr = attr_search(attrs, NULL, attr_icon_src); + attr = attr_search(attrs, attr_icon_src); if (attr) { struct file_wordexp *we; char **array; @@ -3670,15 +3670,15 @@ static struct osd_priv *osd_volume_new(struct navit *nav, struct osd_methods *me this->active = -1; this->strength = -1; - attr = attr_search(attrs, NULL, attr_icon_w); + attr = attr_search(attrs, attr_icon_w); if (attr) this->icon_w = attr->u.num; - attr = attr_search(attrs, NULL, attr_icon_h); + attr = attr_search(attrs, attr_icon_h); if (attr) this->icon_h = attr->u.num; - attr = attr_search(attrs, NULL, attr_icon_src); + attr = attr_search(attrs, attr_icon_src); if (attr) { struct file_wordexp *we; char **array; diff --git a/navit/plugin.c b/navit/plugin.c index 259d8e7e66..499f7d124c 100644 --- a/navit/plugin.c +++ b/navit/plugin.c @@ -243,17 +243,17 @@ plugin_new(struct attr *parent, struct attr **attrs) { if (parent) pls=parent->u.plugins; - if (! (path_attr=attr_search(attrs, NULL, attr_path))) { + if (! (path_attr=attr_search(attrs, attr_path))) { dbg(lvl_error,"missing path"); return NULL; } - if ( (attr=attr_search(attrs, NULL, attr_active))) { + if ( (attr=attr_search(attrs, attr_active))) { active=attr->u.num; } - if ( (attr=attr_search(attrs, NULL, attr_lazy))) { + if ( (attr=attr_search(attrs, attr_lazy))) { lazy=attr->u.num; } - if ( (attr=attr_search(attrs, NULL, attr_ondemand))) { + if ( (attr=attr_search(attrs, attr_ondemand))) { ondemand=attr->u.num; } dbg(lvl_debug, "path=\"%s\", active=%d, lazy=%d, ondemand=%d",path_attr->u.str, active, lazy, ondemand); diff --git a/navit/plugin/j1850/j1850.c b/navit/plugin/j1850/j1850.c index 08b9c3ff0c..69a9b8fa57 100644 --- a/navit/plugin/j1850/j1850.c +++ b/navit/plugin/j1850/j1850.c @@ -461,7 +461,7 @@ static struct osd_priv *osd_j1850_new(struct navit *nav, struct osd_methods *met this->osd_item.meth.draw = osd_draw_cast(osd_j1850_draw); osd_set_std_attr(attrs, &this->osd_item, 2); - attr = attr_search(attrs, NULL, attr_width); + attr = attr_search(attrs, attr_width); this->width=attr ? attr->u.num : 2; navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_j1850_init), attr_graphics_ready, this)); return (struct osd_priv *) this; diff --git a/navit/plugin/pedestrian/pedestrian.c b/navit/plugin/pedestrian/pedestrian.c index 08ff1076a1..ec17680eb3 100644 --- a/navit/plugin/pedestrian/pedestrian.c +++ b/navit/plugin/pedestrian/pedestrian.c @@ -940,7 +940,7 @@ static struct map_priv *map_route_occluded_new(struct map_methods *meth, struct struct map_priv *ret; struct attr *navit; dbg(lvl_debug, "enter\n"); - navit = attr_search(attrs, NULL, attr_navit); + navit = attr_search(attrs, attr_navit); if (!navit) { return NULL; } diff --git a/navit/route.c b/navit/route.c index 652ae6d541..858e51406c 100644 --- a/navit/route.c +++ b/navit/route.c @@ -4037,7 +4037,7 @@ static struct map_priv *route_map_new_helper(struct map_methods *meth, struct at struct map_priv *ret; struct attr *route_attr; - route_attr=attr_search(attrs, NULL, attr_route); + route_attr=attr_search(attrs, attr_route); if (! route_attr) return NULL; ret=g_new0(struct map_priv, 1); diff --git a/navit/script.c b/navit/script.c index dfc071caa5..1af8b6239a 100644 --- a/navit/script.c +++ b/navit/script.c @@ -34,7 +34,7 @@ struct script { }; static void script_run(struct script *scr) { - struct attr *xml_text=attr_search(scr->attrs, NULL, attr_xml_text); + struct attr *xml_text=attr_search(scr->attrs, attr_xml_text); int error; if (!xml_text || !xml_text->u.str) { dbg(lvl_error,"no text"); diff --git a/navit/speech.c b/navit/speech.c index fa560635c6..2f219d4696 100644 --- a/navit/speech.c +++ b/navit/speech.c @@ -38,7 +38,7 @@ speech_new(struct attr *parent, struct attr **attrs) { struct speech_priv *(*speech_new)(struct speech_methods *meth, struct attr **attrs, struct attr *parent); struct attr *attr; - attr=attr_search(attrs, NULL, attr_type); + attr=attr_search(attrs, attr_type); if (! attr) { dbg(lvl_error,"type missing"); return NULL; diff --git a/navit/speech/android/speech_android.c b/navit/speech/android/speech_android.c index a2aa24bfdb..d7be8e975e 100644 --- a/navit/speech/android/speech_android.c +++ b/navit/speech/android/speech_android.c @@ -99,7 +99,7 @@ static struct speech_priv *speech_android_new(struct speech_methods *meth, struc g_free(this); this=NULL; } - if ((flags = attr_search(attrs, NULL, attr_flags))) + if ((flags = attr_search(attrs, attr_flags))) this->flags=flags->u.num; return this; diff --git a/navit/speech/cmdline/speech_cmdline.c b/navit/speech/cmdline/speech_cmdline.c index 11537e5702..b4a3ede0dc 100644 --- a/navit/speech/cmdline/speech_cmdline.c +++ b/navit/speech/cmdline/speech_cmdline.c @@ -207,16 +207,16 @@ static struct speech_methods speechd_meth = { static struct speech_priv *speechd_new(struct speech_methods *meth, struct attr **attrs, struct attr *parent) { struct speech_priv *this; struct attr *attr; - attr=attr_search(attrs, NULL, attr_data); + attr=attr_search(attrs, attr_data); if (! attr) return NULL; this=g_new0(struct speech_priv,1); this->cmdline=g_strdup(attr->u.str); - if ((attr=attr_search(attrs, NULL, attr_sample_dir))) + if ((attr=attr_search(attrs, attr_sample_dir))) this->sample_dir=g_strdup(attr->u.str); - if ((attr=attr_search(attrs, NULL, attr_sample_suffix))) + if ((attr=attr_search(attrs, attr_sample_suffix))) this->sample_suffix=g_strdup(attr->u.str); - if ((attr=attr_search(attrs, NULL, attr_flags))) + if ((attr=attr_search(attrs, attr_flags))) this->flags=attr->u.num; if (this->sample_dir && this->sample_suffix) { void *handle=file_opendir(this->sample_dir); diff --git a/navit/speech/espeak/speak.c b/navit/speech/espeak/speak.c index 593e1677ba..7668547667 100644 --- a/navit/speech/espeak/speak.c +++ b/navit/speech/espeak/speak.c @@ -385,7 +385,7 @@ static struct speech_priv *espeak_new(struct speech_methods *meth, struct attr * struct attr *language; char *lang_str=NULL; - path=attr_search(attrs, NULL, attr_path); + path=attr_search(attrs, attr_path); if (path) strcpy(path_home,path->u.str); else @@ -396,7 +396,7 @@ static struct speech_priv *espeak_new(struct speech_methods *meth, struct attr * return NULL; } - language=attr_search(attrs, NULL, attr_language); + language=attr_search(attrs, attr_language); if ( language ) { lang_str=g_strdup(language->u.str); } else { diff --git a/navit/speech/qt5_espeak/qt5_espeak.cpp b/navit/speech/qt5_espeak/qt5_espeak.cpp index a0372ff391..f56aeac336 100755 --- a/navit/speech/qt5_espeak/qt5_espeak.cpp +++ b/navit/speech/qt5_espeak/qt5_espeak.cpp @@ -75,7 +75,7 @@ static bool qt5_espeak_init_espeak(struct speech_priv* sr, struct attr** attrs) struct attr* path; /* prepare espeak library path home */ - path = attr_search(attrs, NULL, attr_path); + path = attr_search(attrs, attr_path); if (path) { sr->path_home = g_strdup(path->u.str); } else { @@ -114,7 +114,7 @@ static bool qt5_espeak_init_language(struct speech_priv* pr, struct attr** attrs espeak_ERROR error; espeak_VOICE voice_spec; - language = attr_search(attrs, NULL, attr_language); + language = attr_search(attrs, attr_language); if (language) { lang_str = g_strdup(language->u.str); } else { diff --git a/navit/track.c b/navit/track.c index 37a7d70a43..0bc702b7eb 100644 --- a/navit/track.c +++ b/navit/track.c @@ -1143,7 +1143,7 @@ static struct map_priv *tracking_map_new(struct map_methods *meth, struct attr * struct map_priv *ret; struct attr *tracking_attr; - tracking_attr=attr_search(attrs, NULL, attr_trackingo); + tracking_attr=attr_search(attrs, attr_trackingo); if (! tracking_attr) return NULL; ret=g_new0(struct map_priv, 1); diff --git a/navit/traffic.c b/navit/traffic.c index 9705abbdd6..f195608294 100644 --- a/navit/traffic.c +++ b/navit/traffic.c @@ -426,12 +426,12 @@ static int seg_data_equals(struct seg_data * l, struct seg_data * r) { return 0; /* FIXME this will break if multiple attributes of the same type are present and have different values */ for (attrs = l->attrs; attrs; attrs++) { - attr = attr_search(r->attrs, NULL, (*attrs)->type); + attr = attr_search(r->attrs, (*attrs)->type); if (!attr || (attr->u.data != (*attrs)->u.data)) return 0; } for (attrs = r->attrs; attrs; attrs++) { - attr = attr_search(l->attrs, NULL, (*attrs)->type); + attr = attr_search(l->attrs, (*attrs)->type); if (!attr || (attr->u.data != (*attrs)->u.data)) return 0; } @@ -633,7 +633,7 @@ static void tm_item_update_attrs(struct item * item, struct route * route) { * resulting in a cost of 90 s for the segment. */ if (speed < INT_MAX) { - attr = attr_search(priv_data->attrs, NULL, attr_maxspeed); + attr = attr_search(priv_data->attrs, attr_maxspeed); if (!attr) { attr = g_new0(struct attr, 1); attr->type = attr_maxspeed; @@ -650,12 +650,12 @@ static void tm_item_update_attrs(struct item * item, struct route * route) { attr->u.num = speed; } } else { - while ((attr = attr_search(priv_data->attrs, NULL, attr_maxspeed))) + while ((attr = attr_search(priv_data->attrs, attr_maxspeed))) priv_data->attrs = attr_generic_remove_attr(priv_data->attrs, attr); } if (delay) { - attr = attr_search(priv_data->attrs, NULL, attr_delay); + attr = attr_search(priv_data->attrs, attr_delay); if (!attr) { attr = g_new0(struct attr, 1); attr->type = attr_delay; @@ -673,7 +673,7 @@ static void tm_item_update_attrs(struct item * item, struct route * route) { } } else { while (1) { - attr = attr_search(priv_data->attrs, NULL, attr_delay); + attr = attr_search(priv_data->attrs, attr_delay); if (!attr) break; priv_data->attrs = attr_generic_remove_attr(priv_data->attrs, attr); @@ -4597,7 +4597,7 @@ static struct traffic * traffic_new(struct attr *parent, struct attr **attrs) { struct attr **attrs, struct callback_list *cbl); struct attr *attr; - attr = attr_search(attrs, NULL, attr_type); + attr = attr_search(attrs, attr_type); if (!attr) { dbg(lvl_error, "type missing"); return NULL; @@ -5757,7 +5757,7 @@ static struct map_priv * traffic_map_new(struct map_methods *meth, struct attr * struct map_priv *ret; struct attr *traffic_attr; - traffic_attr = attr_search(attrs, NULL, attr_traffic); + traffic_attr = attr_search(attrs, attr_traffic); if (!traffic_attr) { dbg(lvl_error, "attr_traffic not found!"); return NULL; diff --git a/navit/vehicle.c b/navit/vehicle.c index fee9896380..78fadfd46c 100644 --- a/navit/vehicle.c +++ b/navit/vehicle.c @@ -116,7 +116,7 @@ vehicle_new(struct attr *parent, struct attr **attrs) { struct pcoord center; dbg(lvl_debug, "enter"); - source = attr_search(attrs, NULL, attr_source); + source = attr_search(attrs, attr_source); if (!source) { dbg(lvl_error, "incomplete vehicle definition: missing attribute 'source'"); return NULL; @@ -420,7 +420,7 @@ int vehicle_get_cursor_data(struct vehicle *this, struct point *pnt, int *angle, static void vehicle_set_default_name(struct vehicle *this_) { struct attr default_name; - if (!attr_search(this_->attrs, NULL, attr_name)) { + if (!attr_search(this_->attrs, attr_name)) { default_name.type=attr_name; // Safe cast: attr_generic_set_attr does not modify its parameter. default_name.u.str=(char*)_("Unnamed vehicle"); @@ -600,7 +600,7 @@ static void vehicle_log_gpx(struct vehicle *this_, struct log *log) { && this_->meth.position_attr_get(this_->priv, attr_position_speed, &attr)) logstr=g_strconcat_printf(logstr,"\t%.2f\n",(*attr.u.numd / 3.6)); if (attr_types_contains_default(attr_types, attr_profilename, 0) - && (attrp=attr_search(this_->attrs, NULL, attr_profilename))) { + && (attrp=attr_search(this_->attrs, attr_profilename))) { logstr=g_strconcat_printf(logstr,"%s\t\t%s\n",extensions,attrp->u.str); extensions=""; } diff --git a/navit/vehicle/file/vehicle_file.c b/navit/vehicle/file/vehicle_file.c index 1502b9860d..666fd59c62 100644 --- a/navit/vehicle/file/vehicle_file.c +++ b/navit/vehicle/file/vehicle_file.c @@ -951,7 +951,7 @@ static struct vehicle_priv *vehicle_file_new_file(struct vehicle_methods dbg(lvl_debug, "enter"); - source = attr_search(attrs, NULL, attr_source); + source = attr_search(attrs, attr_source); if(source == NULL) { dbg(lvl_error,"Missing source attribute"); return NULL; @@ -965,13 +965,13 @@ static struct vehicle_priv *vehicle_file_new_file(struct vehicle_methods ret->baudrate=B4800; ret->fixtime[0] = '\0'; ret->ev_fix_timeout = NULL; - state_file=attr_search(attrs, NULL, attr_state_file); + state_file=attr_search(attrs, attr_state_file); if (state_file) ret->statefile=g_strdup(state_file->u.str); - time = attr_search(attrs, NULL, attr_time); + time = attr_search(attrs, attr_time); if (time) ret->time=time->u.num; - baudrate = attr_search(attrs, NULL, attr_baudrate); + baudrate = attr_search(attrs, attr_baudrate); if (baudrate) { switch (baudrate->u.num) { case 4800: @@ -1000,11 +1000,11 @@ static struct vehicle_priv *vehicle_file_new_file(struct vehicle_methods #endif } } - checksum_ignore = attr_search(attrs, NULL, attr_checksum_ignore); + checksum_ignore = attr_search(attrs, attr_checksum_ignore); if (checksum_ignore) ret->checksum_ignore=checksum_ignore->u.num; ret->attrs = attrs; - on_eof = attr_search(attrs, NULL, attr_on_eof); + on_eof = attr_search(attrs, attr_on_eof); if (on_eof && !g_ascii_strcasecmp(on_eof->u.str, "stop")) ret->on_eof=1; if (on_eof && !g_ascii_strcasecmp(on_eof->u.str, "exit")) diff --git a/navit/vehicle/gpsd/vehicle_gpsd.c b/navit/vehicle/gpsd/vehicle_gpsd.c index 564d41695d..ea3aaf1f8f 100644 --- a/navit/vehicle/gpsd/vehicle_gpsd.c +++ b/navit/vehicle/gpsd/vehicle_gpsd.c @@ -414,7 +414,7 @@ static int vehicle_gpsd_position_attr_get(struct vehicle_priv *priv, } break; case attr_active: - active = attr_search(priv->attrs,NULL,attr_active); + active = attr_search(priv->attrs,attr_active); if(active != NULL) { attr->u.num=active->u.num; return 1; @@ -440,20 +440,20 @@ static struct vehicle_priv *vehicle_gpsd_new_gpsd(struct vehicle_methods struct attr *source, *query, *retry_int; dbg(lvl_debug, "enter"); - source = attr_search(attrs, NULL, attr_source); + source = attr_search(attrs, attr_source); ret = g_new0(struct vehicle_priv, 1); #if GPSD_API_MAJOR_VERSION >= 5 ret->gps = g_new0(struct gps_data_t, 1); #endif ret->source = g_strdup(source->u.str); - query = attr_search(attrs, NULL, attr_gpsd_query); + query = attr_search(attrs, attr_gpsd_query); if (query) { ret->gpsd_query = g_strconcat(query->u.str, "\n", NULL); } else { ret->gpsd_query = g_strdup("w+x\n"); } dbg(lvl_debug,"Format string for gpsd_query: %s",ret->gpsd_query); - retry_int = attr_search(attrs, NULL, attr_retry_interval); + retry_int = attr_search(attrs, attr_retry_interval); if (retry_int) { ret->retry_interval = retry_int->u.num; if (ret->retry_interval < MIN_RETRY_INTERVAL) { diff --git a/navit/vehicle/gypsy/vehicle_gypsy.c b/navit/vehicle/gypsy/vehicle_gypsy.c index 077f219a19..33dde34c2d 100644 --- a/navit/vehicle/gypsy/vehicle_gypsy.c +++ b/navit/vehicle/gypsy/vehicle_gypsy.c @@ -384,7 +384,7 @@ static int vehicle_gypsy_position_attr_get(struct vehicle_priv *priv, return 0; } case attr_active: - active = attr_search(priv->attrs,NULL,attr_active); + active = attr_search(priv->attrs,attr_active); if(active != NULL && active->u.num == 1) return 1; else @@ -423,10 +423,10 @@ static struct vehicle_priv *vehicle_gypsy_new_gypsy(struct vehicle_methods *meth dbus_uint32_t serial,pid=getpid(); struct attr *destination,*path,*interface,*method; - destination=attr_search(attrs, NULL, attr_dbus_destination); - path=attr_search(attrs, NULL, attr_dbus_path); - interface=attr_search(attrs, NULL, attr_dbus_interface); - method=attr_search(attrs, NULL, attr_dbus_method); + destination=attr_search(attrs, attr_dbus_destination); + path=attr_search(attrs, attr_dbus_path); + interface=attr_search(attrs, attr_dbus_interface); + method=attr_search(attrs, attr_dbus_method); if (destination && path && interface && method) { conn=dbus_bus_get(DBUS_BUS_SESSION, NULL); if (conn) { @@ -441,12 +441,12 @@ static struct vehicle_priv *vehicle_gypsy_new_gypsy(struct vehicle_methods *meth } #endif dbg(lvl_debug, "enter"); - source = attr_search(attrs, NULL, attr_source); + source = attr_search(attrs, attr_source); ret = g_new0(struct vehicle_priv, 1); ret->have_cords = 0; ret->source = g_strdup(source->u.str); ret->attrs = attrs; - retry_int = attr_search(attrs, NULL, attr_retry_interval); + retry_int = attr_search(attrs, attr_retry_interval); if (retry_int) { ret->retry_interval = retry_int->u.num; if (ret->retry_interval < MIN_RETRY_INTERVAL) { diff --git a/navit/vehicle/iphone/vehicle_iphone.c b/navit/vehicle/iphone/vehicle_iphone.c index 7901662382..26b778a6e3 100644 --- a/navit/vehicle/iphone/vehicle_iphone.c +++ b/navit/vehicle/iphone/vehicle_iphone.c @@ -137,12 +137,12 @@ static struct vehicle_priv *vehicle_iphone_new(struct vehicle_methods ret->cbl = cbl; ret->interval=1000; ret->config_speed=40; - if ((speed=attr_search(attrs, NULL, attr_speed))) { + if ((speed=attr_search(attrs, attr_speed))) { ret->config_speed=speed->u.num; } - if ((interval=attr_search(attrs, NULL, attr_interval))) + if ((interval=attr_search(attrs, attr_interval))) ret->interval=interval->u.num; - if ((position_coord_geo=attr_search(attrs, NULL, attr_position_coord_geo))) { + if ((position_coord_geo=attr_search(attrs, attr_position_coord_geo))) { ret->geo=*(position_coord_geo->u.coord_geo); ret->position_set=1; dbg(lvl_debug,"position_set %f %f", ret->geo.lat, ret->geo.lng); diff --git a/navit/vehicle/maemo/vehicle_maemo.c b/navit/vehicle/maemo/vehicle_maemo.c index 4717deb04b..34514ad0e7 100644 --- a/navit/vehicle/maemo/vehicle_maemo.c +++ b/navit/vehicle/maemo/vehicle_maemo.c @@ -269,7 +269,7 @@ static int vehicle_maemo_position_attr_get(struct vehicle_priv *priv, break; case attr_active: dbg(lvl_debug,"Attr requested: position_active"); - active = attr_search(priv->attrs,NULL,attr_active); + active = attr_search(priv->attrs,attr_active); if(active != NULL) { attr->u.num=active->u.num; return 1; @@ -295,10 +295,10 @@ static struct vehicle_priv *vehicle_maemo_new_maemo(struct vehicle_methods struct attr *source, *retry_int; dbg(lvl_debug, "enter"); - source = attr_search(attrs, NULL, attr_source); + source = attr_search(attrs, attr_source); ret = g_new0(struct vehicle_priv, 1); ret->source = g_strdup(source->u.str); - retry_int = attr_search(attrs, NULL, attr_retry_interval); + retry_int = attr_search(attrs, attr_retry_interval); if (retry_int) { ret->retry_interval = retry_int->u.num; if (ret->retry_interval !=1 && ret->retry_interval !=2 && ret->retry_interval !=5 && ret->retry_interval !=10 diff --git a/navit/vehicle/qt5/vehicle_qt5.cpp b/navit/vehicle/qt5/vehicle_qt5.cpp index 9daa2ecb9d..ac475bd610 100644 --- a/navit/vehicle/qt5/vehicle_qt5.cpp +++ b/navit/vehicle/qt5/vehicle_qt5.cpp @@ -212,7 +212,7 @@ static int vehicle_qt5_position_attr_get(struct vehicle_priv* priv, break; case attr_active: - active = attr_search(priv->attrs, NULL, attr_active); + active = attr_search(priv->attrs, attr_active); if (active != NULL) { attr->u.num = active->u.num; return 1; diff --git a/navit/vehicle/wince/vehicle_wince.c b/navit/vehicle/wince/vehicle_wince.c index 4d2afa0e99..afb39a959c 100644 --- a/navit/vehicle/wince/vehicle_wince.c +++ b/navit/vehicle/wince/vehicle_wince.c @@ -913,7 +913,7 @@ static struct vehicle_priv *vehicle_wince_new(struct vehicle_methods char *cp; dbg(lvl_debug, "enter"); - source = attr_search(attrs, NULL, attr_source); + source = attr_search(attrs, attr_source); ret = g_new0(struct vehicle_priv, 1); ret->fd = -1; ret->cbl = cbl; @@ -933,18 +933,18 @@ static struct vehicle_priv *vehicle_wince_new(struct vehicle_methods ret->fixtime[0] = '\0'; ret->ev_fix_timeout = NULL; - time = attr_search(attrs, NULL, attr_time); + time = attr_search(attrs, attr_time); if (time) ret->time=time->u.num; - baudrate = attr_search(attrs, NULL, attr_baudrate); + baudrate = attr_search(attrs, attr_baudrate); if (baudrate) { ret->baudrate = baudrate->u.num; } - checksum_ignore = attr_search(attrs, NULL, attr_checksum_ignore); + checksum_ignore = attr_search(attrs, attr_checksum_ignore); if (checksum_ignore) ret->checksum_ignore=checksum_ignore->u.num; ret->attrs = attrs; - on_eof = attr_search(attrs, NULL, attr_on_eof); + on_eof = attr_search(attrs, attr_on_eof); if (on_eof && !g_strcasecmp(on_eof->u.str, "stop")) ret->on_eof=1; if (on_eof && !g_strcasecmp(on_eof->u.str, "exit")) @@ -961,7 +961,7 @@ static struct vehicle_priv *vehicle_wince_new(struct vehicle_methods ret->read_buffer = g_malloc(buffer_size); - handle_bluetooth = attr_search(attrs, NULL, attr_bluetooth); + handle_bluetooth = attr_search(attrs, attr_bluetooth); if ( handle_bluetooth && handle_bluetooth->u.num == 1 ) initBth(ret); diff --git a/navit/vehicleprofile.c b/navit/vehicleprofile.c index 905d2defaf..493646f94a 100644 --- a/navit/vehicleprofile.c +++ b/navit/vehicleprofile.c @@ -211,7 +211,7 @@ struct vehicleprofile * vehicleprofile_new(struct attr *parent, struct attr **attrs) { struct vehicleprofile *this_; struct attr **attr, *type_attr; - if (! (type_attr=attr_search(attrs, NULL, attr_name))) { + if (! (type_attr=attr_search(attrs, attr_name))) { return NULL; } this_=g_new0(struct vehicleprofile, 1);