summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2011-09-30 13:29:30 +0000
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2011-09-30 13:29:30 +0000
commit4abb8fdadbf8bf85cce781c65c367f79e12c4712 (patch)
treefd5453dcb2fc7a5ae8800852fe6c3fb60edf1b65
parentf90e5004ea8ad014f77ae340476030da279efb5f (diff)
downloadnavit-4abb8fdadbf8bf85cce781c65c367f79e12c4712.tar.gz
Fix:Core:Move declarations to the begin to be c95 compatible
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@4817 ffa7fe5e-494d-0410-b361-a75ebd5db220
-rw-r--r--navit/command.c6
-rw-r--r--navit/graphics/null/graphics_null.c2
-rw-r--r--navit/gui/internal/gui_internal.c20
-rw-r--r--navit/map/csv/csv.c2
-rw-r--r--navit/navit.c3
-rwxr-xr-xnavit/obj_filter.c15
-rw-r--r--navit/osd/core/osd_core.c53
7 files changed, 53 insertions, 48 deletions
diff --git a/navit/command.c b/navit/command.c
index 1caca7904..c0c5aa194 100644
--- a/navit/command.c
+++ b/navit/command.c
@@ -258,6 +258,9 @@ static void
eval_value(struct context *ctx, struct result *res) {
const char *op;
int len,dots=0;
+ struct obj_filter_t out;
+ int parsed_chars;
+
op=ctx->expr;
res->varlen=0;
res->var=NULL;
@@ -268,8 +271,7 @@ eval_value(struct context *ctx, struct result *res) {
op++;
}
- struct obj_filter_t out;
- int parsed_chars = parse_obj_filter(op, &out);
+ parsed_chars = parse_obj_filter(op, &out);
if (parsed_chars) {
struct attr* res_attr = filter_object(ctx->attr, out.iterator_type, out.filter_expr, out.idx);
if (res_attr) {
diff --git a/navit/graphics/null/graphics_null.c b/navit/graphics/null/graphics_null.c
index 7fde6fcc8..1c3bbbd86 100644
--- a/navit/graphics/null/graphics_null.c
+++ b/navit/graphics/null/graphics_null.c
@@ -261,8 +261,8 @@ overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct poin
static struct graphics_priv *
graphics_null_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl)
{
- *meth=graphics_methods;
struct attr *event_loop_system = NULL;
+ *meth=graphics_methods;
event_loop_system = attr_search(attrs, NULL, attr_event_loop_system);
diff --git a/navit/gui/internal/gui_internal.c b/navit/gui/internal/gui_internal.c
index cc61b1a92..277066602 100644
--- a/navit/gui/internal/gui_internal.c
+++ b/navit/gui/internal/gui_internal.c
@@ -3496,6 +3496,14 @@ static void
gui_internal_cmd_formerdests(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid)
{
struct widget *wb,*w,*wbm;
+ struct map *formerdests;
+ struct map_rect *mr_formerdests;
+ struct item *item;
+ struct attr attr;
+ char *label_full;
+ enum projection projection;
+ int formerdests_available=0;
+
gui_internal_prune_menu_count(this, 1, 0);
wb=gui_internal_menu(this, _("Former Destinations"));
wb->background=this->background;
@@ -3505,14 +3513,11 @@ gui_internal_cmd_formerdests(struct gui_priv *this, char *function, struct attr
w->spy=this->spacing*2;
gui_internal_widget_append(wb, w);
- struct map* formerdests=read_former_destinations_from_file();
- struct map_rect *mr_formerdests=map_rect_new(formerdests, NULL);
- struct item* item;
- struct attr attr;
- char* label_full;
- enum projection projection = map_projection(formerdests);
- int formerdests_available=0;
+ formerdests=read_former_destinations_from_file();
+ mr_formerdests=map_rect_new(formerdests, NULL);
+ projection = map_projection(formerdests);
while ((item=map_rect_get_item(mr_formerdests))) {
+ struct coord c;
formerdests_available=1;
if (!item_attr_get(item, attr_label, &attr)) continue;
label_full=attr.u.str;
@@ -3521,7 +3526,6 @@ gui_internal_cmd_formerdests(struct gui_priv *this, char *function, struct attr
gravity_left_center|orientation_horizontal|flags_fill,
gui_internal_cmd_position, NULL);
gui_internal_widget_prepend(w, wbm);
- struct coord c;
if (item_coord_get(item, &c, 1)) {
wbm->c.x=c.x;
wbm->c.y=c.y;
diff --git a/navit/map/csv/csv.c b/navit/map/csv/csv.c
index e5ac1a0df..752d545bc 100644
--- a/navit/map/csv/csv.c
+++ b/navit/map/csv/csv.c
@@ -614,6 +614,7 @@ map_new_csv(struct map_methods *meth, struct attr **attrs, struct callback_list
if(data) {
struct file_wordexp *wexp;
char **wexp_data;
+ FILE *fp;
wexp=file_wordexp_new(data->u.str);
wexp_data=file_wordexp_get_array(wexp);
dbg(1,"map_new_csv %s\n", data->u.str);
@@ -622,7 +623,6 @@ map_new_csv(struct map_methods *meth, struct attr **attrs, struct callback_list
//load csv file into quadtree structure
//if column number is wrong skip
- FILE*fp;
if((fp=fopen(m->filename,"rt"))) {
const int max_line_len = 256;
char *line=g_alloca(sizeof(char)*max_line_len);
diff --git a/navit/navit.c b/navit/navit.c
index 64dffc8e3..2b7cb7ffd 100644
--- a/navit/navit.c
+++ b/navit/navit.c
@@ -1581,11 +1581,12 @@ navit_add_former_destinations_from_file(struct navit *this_)
int i,valid=0,count=0;
struct coord c[16];
struct pcoord pc[16];
+ struct map_rect *mr;
this_->former_destination=read_former_destinations_from_file();
if (!this_->route || !navit_former_destinations_active(this_))
return;
- struct map_rect *mr=map_rect_new(this_->former_destination, NULL);
+ mr=map_rect_new(this_->former_destination, NULL);
while ((item=map_rect_get_item(mr))) {
if ((item->type == type_former_destination || item->type == type_former_itinerary || item->type == type_former_itinerary_part) && (count=item_coord_get(item, c, 16)))
valid=1;
diff --git a/navit/obj_filter.c b/navit/obj_filter.c
index 7edfacc97..7166bcda8 100755
--- a/navit/obj_filter.c
+++ b/navit/obj_filter.c
@@ -317,9 +317,10 @@ static enum operator_t parse_bool_operator(struct ctx*the_ctx)
{
char* input = the_ctx->expr;
char *sym;
+ enum operator_t op;
sym = get_op(input,"&&","||","^",NULL);
- enum operator_t op = get_operator_by_symbol(sym);
+ op = get_operator_by_symbol(sym);
switch(op) {
case OP_LOGICAL_AND:
case OP_LOGICAL_OR:
@@ -336,9 +337,10 @@ static enum operator_t parse_cond_operator(struct ctx*the_ctx)
{
char* input = the_ctx->expr;
char *sym;
+ enum operator_t op;
sym = get_op(input, "==", "<", ">", "<=", ">=", "!=", NULL);
- enum operator_t op = get_operator_by_symbol(sym);
+ op = get_operator_by_symbol(sym);
switch(op) {
case OP_EQ:
case OP_GT:
@@ -358,9 +360,10 @@ static enum operator_t parse_numeric_multiplicative_operator(struct ctx*the_ctx)
{
char* input = the_ctx->expr;
char *sym;
+ enum operator_t op;
sym = get_op(input, "*", "/", "%", NULL);
- enum operator_t op = get_operator_by_symbol(sym);
+ op = get_operator_by_symbol(sym);
switch(op) {
case OP_MUL:
case OP_DIV:
@@ -377,9 +380,10 @@ static enum operator_t parse_numeric_additive_operator(struct ctx*the_ctx)
{
char* input = the_ctx->expr;
char *sym;
+ enum operator_t op;
sym = get_op(input, "+", "-", NULL);
- enum operator_t op = get_operator_by_symbol(sym);
+ op = get_operator_by_symbol(sym);
switch(op) {
case OP_ADD:
case OP_SUB:
@@ -669,9 +673,10 @@ static int parse_cond_expr(struct ctx*the_ctx)
//expect cond operand
if(parse_string_operand(&sub_ctx)) {
char* op1 = sub_ctx.res.res_str;
+ enum operator_t op;
+
//expect cond operand
sub_ctx.expr = next_sym_ptr;
- enum operator_t op;
if( (op=parse_cond_operator(&sub_ctx)) ) {
next_sym_ptr += whitespace_num(next_sym_ptr) + strlen(get_opstr_by_op(op));
sub_ctx.expr = next_sym_ptr;
diff --git a/navit/osd/core/osd_core.c b/navit/osd/core/osd_core.c
index 033923426..6a698dee6 100644
--- a/navit/osd/core/osd_core.c
+++ b/navit/osd/core/osd_core.c
@@ -293,6 +293,7 @@ static void osd_route_guard_draw(struct osd_priv_common *opc, struct navit *nav,
char* dist_str;
struct graphics_gc *curr_color;
int imperial=0;
+ double min_dist;
//do not execute for each gps update
gettimeofday(&tv,NULL);
@@ -319,7 +320,7 @@ static void osd_route_guard_draw(struct osd_priv_common *opc, struct navit *nav,
}
transform_from_geo(projection_mg, position_attr.u.coord_geo, &curr_coord);
- double min_dist = 1000000;
+ min_dist = 1000000;
//calculate min dist
if(this->coord_num > 1) {
double scale = transform_scale(curr_coord.y);
@@ -428,9 +429,9 @@ osd_route_guard_new(struct navit *nav, struct osd_methods *meth,
{
struct route_guard *this = g_new0(struct route_guard, 1);
struct osd_priv_common *opc = g_new0(struct osd_priv_common,1);
- opc->data = (void*)this;
-
struct attr *attr;
+
+ opc->data = (void*)this;
opc->osd_item.p.x = 120;
opc->osd_item.p.y = 20;
opc->osd_item.w = 60;
@@ -885,10 +886,10 @@ osd_odometer_new(struct navit *nav, struct osd_methods *meth,
struct odometer *this = g_new0(struct odometer, 1);
struct osd_priv_common *opc = g_new0(struct osd_priv_common,1);
- opc->data = (void*)this;
-
struct attr *attr;
struct color orange_color={0xffff,0xa5a5,0x0000,0xffff};
+
+ opc->data = (void*)this;
opc->osd_item.p.x = 120;
opc->osd_item.p.y = 20;
opc->osd_item.w = 60;
@@ -1108,10 +1109,9 @@ osd_cmd_interface_new(struct navit *nav, struct osd_methods *meth,
{
struct cmd_interface *this = g_new0(struct cmd_interface, 1);
struct osd_priv_common *opc = g_new0(struct osd_priv_common,1);
- opc->data = (void*)this;
-
struct attr *attr;
+ opc->data = (void*)this;
opc->osd_item.p.x = 120;
opc->osd_item.p.y = 20;
opc->osd_item.w = 60;
@@ -1269,11 +1269,10 @@ osd_stopwatch_new(struct navit *nav, struct osd_methods *meth,
{
struct stopwatch *this = g_new0(struct stopwatch, 1);
struct osd_priv_common *opc = g_new0(struct osd_priv_common,1);
- opc->data = (void*)this;
-
struct attr *attr;
struct color orange_color={0xffff,0xa5a5,0x0000,0xffff};
+ opc->data = (void*)this;
opc->osd_item.p.x = 120;
opc->osd_item.p.y = 20;
opc->osd_item.w = 60;
@@ -1383,9 +1382,9 @@ osd_compass_new(struct navit *nav, struct osd_methods *meth,
{
struct compass *this = g_new0(struct compass, 1);
struct osd_priv_common *opc = g_new0(struct osd_priv_common,1);
- opc->data = (void*)this;
-
struct attr *attr;
+
+ opc->data = (void*)this;
opc->osd_item.p.x = 20;
opc->osd_item.p.y = 20;
opc->osd_item.w = 60;
@@ -1511,10 +1510,9 @@ osd_button_new(struct navit *nav, struct osd_methods *meth,
{
struct osd_button *this = g_new0(struct osd_button, 1);
struct osd_priv_common *opc = g_new0(struct osd_priv_common,1);
- opc->data = (void*)this;
-
struct attr *attr;
+ opc->data = (void*)this;
opc->osd_item.navit = nav;
opc->osd_item.meth.draw = osd_draw_cast(osd_button_draw);
@@ -1611,10 +1609,9 @@ osd_image_new(struct navit *nav, struct osd_methods *meth,
{
struct osd_image *this = g_new0(struct osd_image, 1);
struct osd_priv_common *opc = g_new0(struct osd_priv_common,1);
- opc->data = (void*)this;
-
struct attr *attr;
+ opc->data = (void*)this;
opc->osd_item.navit = nav;
opc->osd_item.meth.draw = osd_draw_cast(osd_image_draw);
meth->set_attr = (void (*)(struct osd_priv *osd, struct attr* attr))set_std_osd_attr;
@@ -1748,10 +1745,9 @@ osd_nav_next_turn_new(struct navit *nav, struct osd_methods *meth,
{
struct nav_next_turn *this = g_new0(struct nav_next_turn, 1);
struct osd_priv_common *opc = g_new0(struct osd_priv_common,1);
- opc->data = (void*)this;
-
struct attr *attr;
+ opc->data = (void*)this;
opc->osd_item.p.x = 20;
opc->osd_item.p.y = -80;
opc->osd_item.w = 70;
@@ -1882,10 +1878,10 @@ osd_nav_toggle_announcer_new(struct navit *nav, struct osd_methods *meth, struct
{
struct nav_toggle_announcer *this = g_new0(struct nav_toggle_announcer, 1);
struct osd_priv_common *opc = g_new0(struct osd_priv_common,1);
- opc->data = (void*)this;
struct attr *attr;
char *command = "announcer_toggle()";
+ opc->data = (void*)this;
opc->osd_item.w = 48;
opc->osd_item.h = 48;
opc->osd_item.p.x = -64;
@@ -2176,9 +2172,9 @@ osd_speed_cam_new(struct navit *nav, struct osd_methods *meth, struct attr **att
struct osd_speed_cam *this = g_new0(struct osd_speed_cam, 1);
struct osd_priv_common *opc = g_new0(struct osd_priv_common,1);
- opc->data = (void*)this;
-
struct attr *attr;
+
+ opc->data = (void*)this;
opc->osd_item.p.x = 120;
opc->osd_item.p.y = 20;
opc->osd_item.w = 60;
@@ -2403,9 +2399,9 @@ osd_speed_warner_new(struct navit *nav, struct osd_methods *meth, struct attr **
{
struct osd_speed_warner *this=g_new0(struct osd_speed_warner, 1);
struct osd_priv_common *opc = g_new0(struct osd_priv_common,1);
- opc->data = (void*)this;
-
struct attr *attr;
+
+ opc->data = (void*)this;
opc->osd_item.p.x=-80;
opc->osd_item.p.y=20;
opc->osd_item.w=60;
@@ -3038,10 +3034,9 @@ osd_text_new(struct navit *nav, struct osd_methods *meth,
{
struct osd_text *this = g_new0(struct osd_text, 1);
struct osd_priv_common *opc = g_new0(struct osd_priv_common,1);
- opc->data = (void*)this;
-
struct attr *attr;
+ opc->data = (void*)this;
opc->osd_item.p.x = -80;
opc->osd_item.p.y = 20;
opc->osd_item.w = 60;
@@ -3149,10 +3144,9 @@ osd_gps_status_new(struct navit *nav, struct osd_methods *meth,
{
struct gps_status *this = g_new0(struct gps_status, 1);
struct osd_priv_common *opc = g_new0(struct osd_priv_common,1);
- opc->data = (void*)this;
-
struct attr *attr;
+ opc->data = (void*)this;
opc->osd_item.p.x = 20;
opc->osd_item.p.y = -80;
opc->osd_item.w = 60;
@@ -3261,10 +3255,9 @@ osd_volume_new(struct navit *nav, struct osd_methods *meth,
{
struct volume *this = g_new0(struct volume, 1);
struct osd_priv_common *opc = g_new0(struct osd_priv_common,1);
- opc->data = (void*)this;
-
struct attr *attr;
+ opc->data = (void*)this;
opc->osd_item.p.x = 20;
opc->osd_item.p.y = -80;
opc->osd_item.w = 60;
@@ -3425,10 +3418,10 @@ osd_scale_new(struct navit *nav, struct osd_methods *meth,
{
struct osd_scale *this = g_new0(struct osd_scale, 1);
struct osd_priv_common *opc = g_new0(struct osd_priv_common,1);
- opc->data = (void*)this;
-
struct attr *attr;
+ opc->data = (void*)this;
+
opc->osd_item.navit = nav;
opc->osd_item.meth.draw = osd_draw_cast(osd_scale_draw);
meth->set_attr = (void (*)(struct osd_priv *osd, struct attr* attr))set_std_osd_attr;