summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cursor.c15
-rw-r--r--data.h2
-rw-r--r--destination.c1
-rw-r--r--graphics.h2
-rw-r--r--graphics/gtk_drawing_area/graphics_gtk_drawing_area.c39
-rw-r--r--map_data.c13
-rw-r--r--plugin.c3
-rw-r--r--popup.c31
-rw-r--r--route.c54
-rw-r--r--route.h2
-rw-r--r--town.c25
-rw-r--r--town.h6
-rw-r--r--tree.c12
-rw-r--r--util.c5
-rw-r--r--util.h4
-rw-r--r--vehicle.c16
-rw-r--r--vehicle.h3
17 files changed, 119 insertions, 114 deletions
diff --git a/cursor.c b/cursor.c
index 1e63249d..9d3aaddb 100644
--- a/cursor.c
+++ b/cursor.c
@@ -13,6 +13,8 @@
#include "menu.h"
#include "vehicle.h"
#include "container.h"
+#include "cursor.h"
+#include "compass.h"
#include "route.h"
@@ -24,9 +26,8 @@ struct cursor {
};
struct coord *
-cursor_pos_get(void *t)
+cursor_pos_get(struct cursor *this)
{
- struct cursor *this=t;
return vehicle_pos_get(this->co->vehicle);
}
@@ -109,9 +110,6 @@ cursor_map_reposition_screen(struct cursor *this, struct coord *c, double *dir,
static void
cursor_map_reposition(struct cursor *this, struct coord *c, double *dir)
{
- unsigned long scale;
- long x,y;
-
if (this->co->flags->orient_north) {
graphics_set_view(this->co, &c->x, &c->y, NULL);
} else {
@@ -126,6 +124,7 @@ cursor_map_reposition_boundary(struct cursor *this, struct coord *c, double *dir
struct transformation *t=this->co->trans;
pnt_new.x=-1;
+ pnt_new.y=-1;
if (pnt->x < 0.1*t->width) {
pnt_new.x=0.8*t->width;
pnt_new.y=t->height/2;
@@ -153,9 +152,10 @@ cursor_map_reposition_boundary(struct cursor *this, struct coord *c, double *dir
return 0;
}
-void
-cursor_update(struct cursor *this)
+static void
+cursor_update(void *t)
{
+ struct cursor *this=t;
struct point pnt;
struct coord *pos;
struct vehicle *v=this->co->vehicle;
@@ -177,7 +177,6 @@ cursor_update(struct cursor *this)
transform(this->co->trans, pos, &pnt);
cursor_draw(this, &pnt, vehicle_speed_get(v), vehicle_dir_get(v));
}
-extern void compass_draw();
compass_draw(this->co->compass, this->co);
}
diff --git a/data.h b/data.h
index 1f054333..075eaa6e 100644
--- a/data.h
+++ b/data.h
@@ -32,7 +32,7 @@ get_long(unsigned char **p) {
static inline char *
get_string(unsigned char **p)
{
- char *ret=*p;
+ char *ret=(char *)(*p);
while (**p) (*p)++;
(*p)++;
return ret;
diff --git a/destination.c b/destination.c
index 2a9ccbf0..26207d73 100644
--- a/destination.c
+++ b/destination.c
@@ -1,3 +1,4 @@
+#include <string.h>
#include <gtk/gtk.h>
#include "coord.h"
#include "transform.h"
diff --git a/graphics.h b/graphics.h
index 43d583dd..d7298749 100644
--- a/graphics.h
+++ b/graphics.h
@@ -34,7 +34,7 @@ struct graphics
void (*draw_polygon)(struct graphics *gr, struct graphics_gc *gc, struct point *p, int count);
void (*draw_rectangle)(struct graphics *gr, struct graphics_gc *gc, struct point *p, int w, int h);
void (*draw_circle)(struct graphics *gr, struct graphics_gc *gc, struct point *p, int r);
- void (*draw_text)(struct graphics *gr, struct graphics_gc *fg, struct graphics_gc *bg, struct graphics_font *font, unsigned char *text, struct point *p, int dx, int dy);
+ void (*draw_text)(struct graphics *gr, struct graphics_gc *fg, struct graphics_gc *bg, struct graphics_font *font, char *text, struct point *p, int dx, int dy);
void (*draw_image)(struct graphics *gr, struct graphics_gc *fg, struct point *p, struct graphics_image *img);
void (*draw_restore)(struct graphics *gr, struct point *p, int w, int h);
diff --git a/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c b/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c
index 81e6777a..5c38140b 100644
--- a/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c
+++ b/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c
@@ -43,21 +43,31 @@ struct graphics_image_gra {
};
+char *fontlist[]={
+ "/usr/X11R6/lib/X11/fonts/msttcorefonts/arial.ttf",
+ "/usr/X11R6/lib/X11/fonts/truetype/arial.ttf",
+ "/usr/share/fonts/truetype/msttcorefonts/arial.ttf",
+ NULL,
+};
+
static struct graphics_font *font_new(struct graphics *gr, int size)
{
- char *filename="/usr/X11R6/lib/X11/fonts/msttcorefonts/arial.ttf";
- char *filename2="/usr/share/fonts/truetype/msttcorefonts/arial.ttf";
+ char **filename=fontlist;
struct graphics_font *font=g_new(struct graphics_font, 1);
if (!gr->gra->library_init) {
FT_Init_FreeType( &gr->gra->library );
gr->gra->library_init=1;
}
- if (FT_New_Face( gr->gra->library, filename, 0, &font->face )) {
- if (FT_New_Face( gr->gra->library, filename2, 0, &font->face )) {
- g_warning("Failed to load '%s', no labelling", filename);
- g_free(font);
- return NULL;
- }
+
+ while (*filename) {
+ if (!FT_New_Face( gr->gra->library, *filename, 0, &font->face ))
+ break;
+ filename++;
+ }
+ if (! *filename) {
+ g_warning("Failed to load font, no labelling");
+ g_free(font);
+ return NULL;
}
FT_Set_Char_Size(font->face, 0, size, 300, 300);
return font;
@@ -105,7 +115,7 @@ gc_set_background(struct graphics_gc *gc, int r, int g, int b)
gc_set_color(gc, r, g, b, 0);
}
-struct graphics_image *
+static struct graphics_image *
image_new(struct graphics *gr, char *name)
{
GdkPixbuf *pixbuf;
@@ -218,7 +228,7 @@ display_text_render_shadow(struct text_glyph *g)
}
static struct text_render *
-display_text_render(unsigned char *text, struct graphics_font *font, int dx, int dy, int x, int y)
+display_text_render(char *text, struct graphics_font *font, int dx, int dy, int x, int y)
{
FT_GlyphSlot slot = font->face->glyph; // a small shortcut
FT_Matrix matrix;
@@ -318,7 +328,7 @@ display_text_free(struct text_render *text)
}
static void
-draw_text(struct graphics *gr, struct graphics_gc *fg, struct graphics_gc *bg, struct graphics_font *font, unsigned char *text, struct point *p, int dx, int dy)
+draw_text(struct graphics *gr, struct graphics_gc *fg, struct graphics_gc *bg, struct graphics_font *font, char *text, struct point *p, int dx, int dy)
{
struct text_render *t;
@@ -356,6 +366,10 @@ overlay_draw(struct graphics_gra *parent, struct graphics_gra *overlay, int wind
int x,y;
int rowstride1,rowstride2;
int n_channels1,n_channels2;
+
+ if (! parent->drawable)
+ return;
+
pixbuf=gdk_pixbuf_get_from_drawable(NULL, overlay->drawable, NULL, 0, 0, 0, 0, overlay->width, overlay->height);
pixbuf2=gdk_pixbuf_new(gdk_pixbuf_get_colorspace(pixbuf), TRUE, gdk_pixbuf_get_bits_per_sample(pixbuf),
gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf));
@@ -492,7 +506,8 @@ button_press(GtkWidget * widget, GdkEventButton * event, gpointer user_data)
int y=event->y;
int button=event->button;
int border=16;
- long map_x,map_y,scale,x_new,y_new;
+ long map_x,map_y,x_new,y_new;
+ unsigned long scale;
if (button == 3)
popup(co, x, y, button);
diff --git a/map_data.c b/map_data.c
index cc384f03..1770bbd2 100644
--- a/map_data.c
+++ b/map_data.c
@@ -7,9 +7,9 @@
#include "map_data.h"
#include "log.h"
-static struct map_data *load_map(char *dirname)
+static struct map_data *load_map(char *dirname, int submap)
{
- int i,len=strlen(dirname);
+ int i,len=strlen(dirname),maybe_missing;
char *filename[file_end];
char file[len+16];
struct map_data *data=g_new0(struct map_data,1);
@@ -37,7 +37,9 @@ static struct map_data *load_map(char *dirname)
strcpy(file+len+1, filename[i]);
data->file[i]=file_create_caseinsensitive(file);
if (! data->file[i]) {
- g_warning("Failed to load %s", file);
+ maybe_missing=(i == file_border_ply || i == file_height_ply || i == file_sea_ply);
+ if (! (submap && maybe_missing))
+ g_warning("Failed to load %s", file);
}
}
}
@@ -49,14 +51,13 @@ struct map_data *load_maps(char *map)
char *name;
void *hnd;
struct map_data *last,*ret;
- int i;
if (! map)
map=getenv("MAP_DATA");
if (! map)
map="/opt/reiseplaner/travel/DE.map";
- ret=load_map(map);
+ ret=load_map(map, 0);
last=ret;
hnd=file_opendir(map);
if (hnd) {
@@ -66,7 +67,7 @@ struct map_data *load_maps(char *map)
strcpy(next_name, map);
strcat(next_name, "/");
strcat(next_name, name);
- last->next=load_map(next_name);
+ last->next=load_map(next_name, 1);
last=last->next;
}
}
diff --git a/plugin.c b/plugin.c
index d5c182b5..1ad87e68 100644
--- a/plugin.c
+++ b/plugin.c
@@ -7,6 +7,7 @@
void
plugin_load(void)
{
+#if 0
char *plugin="plugins/poi_geodownload/plugin_poi_geodownload.so";
void *h=dlopen(plugin,RTLD_LAZY);
void (*init)(void);
@@ -17,5 +18,5 @@ plugin_load(void)
init=dlsym(h,"plugin_init");
(*init)();
}
-
+#endif
}
diff --git a/popup.c b/popup.c
index f0fc5883..c61c5d34 100644
--- a/popup.c
+++ b/popup.c
@@ -4,7 +4,7 @@
#include <assert.h>
#include <gtk/gtk.h>
#include "coord.h"
-#include "param.h"
+#include "file.h"
#include "map_data.h"
#include "block.h"
#include "display.h"
@@ -19,8 +19,9 @@
#include "cursor.h"
#include "statusbar.h"
#include "container.h"
+#include "graphics.h"
-void
+static void
popup_item_destroy_text(struct popup_item *item)
{
g_free(item->text);
@@ -43,7 +44,7 @@ popup_item_new_text(struct popup_item **last, char *text, int priority)
return curr;
}
-struct popup_item *
+static struct popup_item *
popup_item_new_func(struct popup_item **last, char *text, int priority, void (*func)(struct popup_item *, void *), void *param)
{
struct popup_item *curr=popup_item_new_text(last, text, priority);
@@ -52,7 +53,7 @@ popup_item_new_func(struct popup_item **last, char *text, int priority, void (*f
return curr;
}
-struct popup_item *
+static struct popup_item *
param_to_menu_new(char *name,struct param_list *plist, int c, int iso)
{
struct popup_item *last, *curr, *ret;
@@ -79,7 +80,7 @@ param_to_menu_new(char *name,struct param_list *plist, int c, int iso)
return ret;
}
-void
+static void
popup_set_no_passing(struct popup_item *item, void *param)
{
struct display_list *l=param;
@@ -95,7 +96,7 @@ popup_set_no_passing(struct popup_item *item, void *param)
log_write(log, seg->blk_inf.file, str, sizeof(*str));
}
-void
+static void
popup_set_destination(struct popup_item *item, void *param)
{
struct popup_item *ref=param;
@@ -111,7 +112,7 @@ popup_set_destination(struct popup_item *item, void *param)
extern void *vehicle;
-void
+static void
popup_set_position(struct popup_item *item, void *param)
{
struct popup_item *ref=param;
@@ -120,7 +121,8 @@ popup_set_position(struct popup_item *item, void *param)
vehicle_set_position(popup->co->vehicle, &popup->c);
}
-void
+#if 0
+static void
popup_break_crossing(struct display_list *l)
{
struct segment *seg=(struct segment *)(l->data);
@@ -134,15 +136,16 @@ popup_break_crossing(struct display_list *l)
str->limit=0x33;
log_write(log, seg->blk_inf.file, str, sizeof(*str));
}
+#endif
-void
+static void
popup_call_func(GtkObject *obj, void *parm)
{
struct popup_item *curr=parm;
curr->func(curr, curr->param);
}
-GtkWidget *
+static GtkWidget *
popup_menu(struct popup_item *list)
{
int min_prio,curr_prio;
@@ -175,7 +178,7 @@ popup_menu(struct popup_item *list)
return menu;
}
-void
+static void
popup_display_list_default(struct display_list *d, struct popup_item **popup_list)
{
struct segment *seg;
@@ -224,7 +227,7 @@ popup_display_list_default(struct display_list *d, struct popup_item **popup_lis
}
}
-void
+static void
popup_display_list(struct container *co, struct popup *popup, struct popup_item **popup_list)
{
GtkWidget *menu, *item;
@@ -243,7 +246,7 @@ popup_display_list(struct container *co, struct popup *popup, struct popup_item
}
}
-void
+static void
popup_destroy_items(struct popup_item *item)
{
struct popup_item *next;
@@ -259,7 +262,7 @@ popup_destroy_items(struct popup_item *item)
}
}
-void
+static void
popup_destroy(GtkObject *obj, void *parm)
{
struct popup *popup=parm;
diff --git a/route.c b/route.c
index 75de703a..966251ae 100644
--- a/route.c
+++ b/route.c
@@ -1,4 +1,5 @@
#include <stdio.h>
+#include <string.h>
#include <math.h>
#include <assert.h>
#include <unistd.h>
@@ -124,7 +125,7 @@ route_new(void)
return this;
}
-void
+static void
route_path_free(struct route *this)
{
struct route_path_segment *curr, *next;
@@ -229,7 +230,7 @@ route_get_destination(struct route *this)
return &this->dst->click.xy;
}
-void
+static void
route_street_foreach(struct block_info *blk_inf, unsigned char *p, unsigned char *end, void *data,
void(*func)(struct block_info *, struct street_info *, unsigned char **, unsigned char *, void *))
{
@@ -283,7 +284,7 @@ route_get_point(struct route *this, struct coord3d *c)
}
-struct route_point *
+static struct route_point *
route_point_add(struct route *this, struct coord3d *f, int conn)
{
int hashval;
@@ -331,7 +332,7 @@ route_points_free(struct route *this)
memset(this->hash, 0, sizeof(this->hash));
}
-void
+static void
route_segment_add(struct route *this, struct route_point *start, struct route_point *end, int len, struct street_str *str, int offset, int limit)
{
struct route_segment *s;
@@ -353,7 +354,7 @@ route_segment_add(struct route *this, struct route_point *start, struct route_po
}
-void
+static void
route_segments_free(struct route *this)
{
struct route_segment *curr,*next;
@@ -391,19 +392,19 @@ route_display_points(struct route *this, struct container *co)
#endif
}
-int
+static int
route_time(int type, int len)
{
return len*36/speed_list[type & 0x3f];
}
-int
+static int
route_value(int type, int len)
{
return route_time(type, len);
}
-int
+static int
route_get_height(int segid, struct coord *c)
{
if (c->x == 0x141b53 && c->y == 0x5f2065 && (segid == 0x4fad2fa || segid == 0x4fad155))
@@ -415,7 +416,7 @@ route_get_height(int segid, struct coord *c)
return 0;
}
-void
+static void
route_process_street_graph(struct block_info *blk_inf, struct street_info *str_inf, unsigned char **p, unsigned char *end, void *data)
{
struct route *this=data;
@@ -625,7 +626,7 @@ struct block_list {
struct block_list *next;
};
-void
+static void
route_process_street_block_graph(struct block_info *blk_inf, unsigned char *p, unsigned char *end, void *data)
{
struct route *this=data;
@@ -647,7 +648,7 @@ route_process_street_block_graph(struct block_info *blk_inf, unsigned char *p, u
#endif
}
-void
+static void
route_blocklist_free(struct route *this)
{
struct block_list *curr,*next;
@@ -659,7 +660,7 @@ route_blocklist_free(struct route *this)
}
}
-void
+static void
route_build_graph(struct route *this, struct map_data *mdata, struct coord *c, int coord_count)
{
struct coord rect[2];
@@ -718,7 +719,7 @@ route_build_graph(struct route *this, struct map_data *mdata, struct coord *c, i
}
}
-void
+static void
route_process_street3(struct block_info *blk_inf, struct street_info *str_inf, unsigned char **p, unsigned char *end, void *data)
{
int flags=0;
@@ -791,7 +792,7 @@ route_process_street3(struct block_info *blk_inf, struct street_info *str_inf, u
}
-void
+static void
route_process_street_block(struct block_info *blk_inf, unsigned char *p, unsigned char *end, void *data)
{
route_street_foreach(blk_inf, p, end, data, route_process_street3);
@@ -846,29 +847,6 @@ route_find_point_on_street(struct route_info *rt_inf)
struct route_info *start,*end;
int count;
-/* XPM */
-static char * flag_xpm[] = {
-"16 16 3 1",
-" c None",
-"+ c #000000",
-"@ c #FFFF00",
-"+++ ",
-"+@@++ ",
-"+@@@@+++ ",
-"+@@@@@@@++ ",
-"+@@@@@@@@@++ ",
-"+@@@@@@@@@@@++ ",
-"+@@@@@@@@@++ ",
-"+@@@@@@@++ ",
-"+@@@@+++ ",
-"+@@++ ",
-"+++ ",
-"+ ",
-"+ ",
-"+ ",
-"+ ",
-"+ "};
-
void
route_click(struct route *this, struct container *co, int x, int y)
{
@@ -948,7 +926,7 @@ route_trace(struct container *co)
trace=1-trace;
}
-void
+static void
route_data_free(void *t)
{
route_blocklist_free(t);
diff --git a/route.h b/route.h
index 0b249129..7149cff4 100644
--- a/route.h
+++ b/route.h
@@ -24,7 +24,7 @@ struct container;
struct route_info;
struct route *route_new(void);
-int route_destroy();
+int route_destroy(void *t);
void route_mapdata_set(struct route *this, struct map_data *mdata);
struct map_data* route_mapdata_get(struct route *this);
void route_display_points(struct route *this, struct container *co);
diff --git a/town.c b/town.c
index 2d08427b..c619ef5f 100644
--- a/town.c
+++ b/town.c
@@ -14,7 +14,7 @@
#include "container.h"
#include "util.h"
-void
+static void
town_get(struct town *town, unsigned char **p)
{
town->id=get_long(p);
@@ -81,7 +81,8 @@ town_tree_process(int version, int leaf, unsigned char **s2, struct map_data *md
struct file *f=mdat->file[file_town_twn];
struct block_offset *blk_off;
struct town town;
- unsigned char *p,*name;
+ unsigned char *p;
+ char *name;
int ret,i,debug=0;
country=get_short(s2);
@@ -133,7 +134,7 @@ town_tree_process(int version, int leaf, unsigned char **s2, struct map_data *md
return 0;
}
-int
+static int
town_search_by(struct map_data *mdat, char *ext, int country, const char *search, int partial, int (*func)(struct town *, void *data), void *data)
{
struct town_search_priv priv_data;
@@ -151,9 +152,9 @@ town_search_by(struct map_data *mdat, char *ext, int country, const char *search
}
int
-town_search_by_postal_code(struct map_data *mdat, int country, unsigned char *name, int partial, int (*func)(struct town *, void *data), void *data)
+town_search_by_postal_code(struct map_data *mdat, int country, const char *name, int partial, int (*func)(struct town *, void *data), void *data)
{
- unsigned char uname[strlen(name)+1];
+ char uname[strlen(name)+1];
strtoupper(uname, name);
return town_search_by(mdat, "b1", country, uname, partial, func, data);
@@ -163,34 +164,34 @@ town_search_by_postal_code(struct map_data *mdat, int country, unsigned char *na
int
town_search_by_name(struct map_data *mdat, int country, const char *name, int partial, int (*func)(struct town *, void *data), void *data)
{
- unsigned char uname[strlen(name)+1];
+ char uname[strlen(name)+1];
strtolower(uname, (char *)name);
return town_search_by(mdat, "b2", country, uname, partial, func, data);
}
int
-town_search_by_district(struct map_data *mdat, int country, unsigned char *name, int partial, int (*func)(struct town *, void *data), void *data)
+town_search_by_district(struct map_data *mdat, int country, const char *name, int partial, int (*func)(struct town *, void *data), void *data)
{
- unsigned char uname[strlen(name)+1];
+ char uname[strlen(name)+1];
strtoupper(uname, name);
return town_search_by(mdat, "b3", country, uname, partial, func, data);
}
int
-town_search_by_name_phon(struct map_data *mdat, int country, unsigned char *name, int partial, int (*func)(struct town *, void *data), void *data)
+town_search_by_name_phon(struct map_data *mdat, int country, const char *name, int partial, int (*func)(struct town *, void *data), void *data)
{
- unsigned char uname[strlen(name)+1];
+ char uname[strlen(name)+1];
strtoupper(uname, name);
return town_search_by(mdat, "b4", country, uname, partial, func, data);
}
int
-town_search_by_district_phon(struct map_data *mdat, int country, unsigned char *name, int partial, int (*func)(struct town *, void *data), void *data)
+town_search_by_district_phon(struct map_data *mdat, int country, const char *name, int partial, int (*func)(struct town *, void *data), void *data)
{
- unsigned char uname[strlen(name)+1];
+ char uname[strlen(name)+1];
strtoupper(uname, name);
return town_search_by(mdat, "b5", country, uname, partial, func, data);
diff --git a/town.h b/town.h
index fce4b6b5..fd48b5e3 100644
--- a/town.h
+++ b/town.h
@@ -23,5 +23,9 @@ struct map_data;
void town_draw_block(struct block_info *blk_inf, unsigned char *start, unsigned char *end, void *data);
int town_get_param(struct segment *seg, struct param_list *param, int count);
-int town_search_by_name(struct map_data *mdat, int country, const char *name, int partial, int (*func)(struct town *t, void *data), void *data);
+int town_search_by_postal_code(struct map_data *mdat, int country, const char *name, int partial, int (*func)(struct town *, void *data), void *data);
+int town_search_by_name(struct map_data *mdat, int country, const char *name, int partial, int (*func)(struct town *, void *data), void *data);
+int town_search_by_district(struct map_data *mdat, int country, const char *name, int partial, int (*func)(struct town *, void *data), void *data);
+int town_search_by_name_phon(struct map_data *mdat, int country, const char *name, int partial, int (*func)(struct town *, void *data), void *data);
+int town_search_by_district_phon(struct map_data *mdat, int country, const char *name, int partial, int (*func)(struct town *, void *data), void *data);
void town_get_by_id(struct town *town, struct map_data *mdat, int country, int id);
diff --git a/tree.c b/tree.c
index 9aacfacc..6e55b7f2 100644
--- a/tree.c
+++ b/tree.c
@@ -39,7 +39,7 @@ tree_compare_string(unsigned char *s1, unsigned char **s2_ptr)
{
unsigned char *s2=*s2_ptr;
char s1_exp, s2_exp;
- *s2_ptr+=strlen(s2)+1;
+ *s2_ptr+=strlen((char *)s2)+1;
for (;;) {
s1_exp=*s1++;
s2_exp=*s2++;
@@ -63,7 +63,7 @@ tree_compare_string_partial(unsigned char *s1, unsigned char **s2_ptr)
{
unsigned char *s2=*s2_ptr;
char s1_exp, s2_exp;
- *s2_ptr+=strlen(s2)+1;
+ *s2_ptr+=strlen((char *)s2)+1;
for (;;) {
s1_exp=*s1++;
s2_exp=*s2++;
@@ -85,7 +85,7 @@ tree_compare_string_partial(unsigned char *s1, unsigned char **s2_ptr)
}
-int
+static int
tree_search_h(struct file *file, unsigned int search)
{
unsigned char *p=file->begin,*end;
@@ -126,7 +126,7 @@ tree_search_h(struct file *file, unsigned int search)
return 0;
}
-int
+static int
tree_search_v(struct file *file, int offset, int search)
{
unsigned char *p=file->begin+offset;
@@ -159,7 +159,7 @@ tree_search_v(struct file *file, int offset, int search)
/* 1=Abort */
/* 2=Too high */
-int
+static int
tree_search(int version, struct file *file, unsigned char *p, int (*tree_func)(int version, int leaf, unsigned char **, struct map_data *mdat, void *), struct map_data *mdat, void *data, int higher)
{
unsigned char *end,*psav;
@@ -260,7 +260,7 @@ tree_search_map(struct map_data *mdat, int map, char *ext,
f_idx=file_create(filename);
version=1;
p=f_idx->begin;
- if (!strncmp(p+4,"RootBlock",9)) {
+ if (!strncmp((char *)(p+4),"RootBlock",9)) {
p+=0x1000;
version=2;
}
diff --git a/util.c b/util.c
index b99dfcbd..7f77ca28 100644
--- a/util.c
+++ b/util.c
@@ -1,7 +1,8 @@
#include <ctype.h>
+#include "util.h"
void
-strtoupper(unsigned char *dest, unsigned char *src)
+strtoupper(char *dest, const char *src)
{
while (*src)
*dest++=toupper(*src++);
@@ -9,7 +10,7 @@ strtoupper(unsigned char *dest, unsigned char *src)
}
void
-strtolower(unsigned char *dest, unsigned char *src)
+strtolower(char *dest, const char *src)
{
while (*src)
*dest++=tolower(*src++);
diff --git a/util.h b/util.h
index 5f89adb9..7a2da623 100644
--- a/util.h
+++ b/util.h
@@ -1,4 +1,4 @@
#include <ctype.h>
-void strtoupper(unsigned char *dest, unsigned char *src);
-void strtolower(unsigned char *dest, unsigned char *src);
+void strtoupper(char *dest, const char *src);
+void strtolower(char *dest, const char *src);
diff --git a/vehicle.c b/vehicle.c
index 62507179..1cc494fa 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -30,13 +30,14 @@ struct vehicle {
#ifdef HAVE_LIBGPS
struct gps_data_t *gps;
#endif
- void (*callback_func)();
+ void (*callback_func)(void *data);
void *callback_data;
};
struct vehicle *vehicle_last;
-int
+#if 0
+static int
vehicle_timer(gpointer t)
{
struct vehicle *this=t;
@@ -50,6 +51,7 @@ vehicle_timer(gpointer t)
}
return TRUE;
}
+#endif
struct coord *
vehicle_pos_get(struct vehicle *this)
@@ -81,7 +83,7 @@ vehicle_set_position(struct vehicle *this, struct coord *pos)
(*this->callback_func)(this->callback_data);
}
-void
+static void
vehicle_parse_gps(struct vehicle *this, char *buffer)
{
char *p,*item[16];
@@ -233,7 +235,7 @@ vehicle_new(const char *url)
{
struct vehicle *this;
GError *error=NULL;
- int fd;
+ int fd=-1;
char *url_,*colon;
#ifdef HAVE_LIBGPS
struct gps_data_t *gps=NULL;
@@ -284,13 +286,13 @@ vehicle_new(const char *url)
}
void
-vehicle_callback(struct vehicle *this, void (*func)(), void *data)
+vehicle_callback(struct vehicle *this, void (*func)(void *data), void *data)
{
this->callback_func=func;
this->callback_data=data;
}
-int
+void
vehicle_destroy(struct vehicle *this)
{
GError *error=NULL;
@@ -302,6 +304,4 @@ vehicle_destroy(struct vehicle *this)
gps_close(this->gps);
#endif
g_free(this);
-
- return 0;
}
diff --git a/vehicle.h b/vehicle.h
index 8787e38e..98f18ec2 100644
--- a/vehicle.h
+++ b/vehicle.h
@@ -3,6 +3,7 @@ struct vehicle;
struct coord *vehicle_pos_get(struct vehicle *);
double *vehicle_dir_get(struct vehicle *);
double *vehicle_speed_get(struct vehicle *);
-void vehicle_callback(struct vehicle *, void (*func)(),void *data);
+void vehicle_callback(struct vehicle *, void (*func)(void *data),void *data);
void vehicle_set_position(struct vehicle *, struct coord *);
struct vehicle *vehicle_new(const char *url);
+void vehicle_destroy(struct vehicle *);