From 132c4e392f226c2493b21ae0d8a9b76ee277cb96 Mon Sep 17 00:00:00 2001 From: martin-s Date: Mon, 24 Jan 2011 16:28:55 +0000 Subject: [PATCH] Fix:maptool:MSVC fixes|Thanks chollya git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@3994 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- navit/navit/maptool/boundaries.c | 2 +- navit/navit/maptool/ch.c | 17 ++++++++++------- navit/navit/maptool/coastline.c | 15 ++++++++------- navit/navit/maptool/geom.c | 6 +++--- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/navit/navit/maptool/boundaries.c b/navit/navit/maptool/boundaries.c index af6f310..439e02b 100644 --- a/navit/navit/maptool/boundaries.c +++ b/navit/navit/maptool/boundaries.c @@ -115,7 +115,7 @@ test(GList *boundaries_list) static void dump_hierarchy(GList *l, char *prefix) { - char newprefix[strlen(prefix)+2]; + char *newprefix=g_alloca(sizeof(char)*(strlen(prefix)+2)); strcpy(newprefix, prefix); strcat(newprefix," "); while (l) { diff --git a/navit/navit/maptool/ch.c b/navit/navit/maptool/ch.c index abd11a4..42a0010 100644 --- a/navit/navit/maptool/ch.c +++ b/navit/navit/maptool/ch.c @@ -229,10 +229,11 @@ ch_process_node(FILE *out, int node, int resolve) int edge_id; struct ch_edge ch_edge; struct item_bin *item_bin; - memset(&ch_edge, 0, sizeof(ch_edge)); struct edge_hash_item fwd,rev; + int oldnode; + memset(&ch_edge, 0, sizeof(ch_edge)); item_bin=init_item(type_ch_node); - int oldnode=GPOINTER_TO_INT(g_hash_table_lookup(newnode_hash, GINT_TO_POINTER(node))); + oldnode=GPOINTER_TO_INT(g_hash_table_lookup(newnode_hash, GINT_TO_POINTER(node))); #if 0 dbg(0,"0x%x,0x%x\n",node_index[oldnode].x,node_index[oldnode].y); #endif @@ -426,12 +427,13 @@ ch_generate_tiles(char *map_suffix, char *suffix, FILE *tilesdir_out, struct zip { struct tile_info info; FILE *in,*ref,*ddsg_coords,*ddsg; + FILE **graphfiles; info.write=0; info.maxlen=0; info.suffix=suffix; info.tiles_list=NULL; info.tilesdir_out=tilesdir_out; - FILE *graphfiles[ch_levels+1]; + graphfiles=g_alloca(sizeof(FILE*)*(ch_levels+1)); ch_create_tempfiles(suffix, graphfiles, ch_levels, 1); in=tempfile(map_suffix,"ways_split",0); @@ -460,16 +462,17 @@ ch_assemble_map(char *map_suffix, char *suffix, struct zip_info *zip_info) { struct tile_info info; struct tile_head *th; - FILE *graphfiles[ch_levels+1]; + FILE **graphfiles=g_alloca(sizeof(FILE*)*(ch_levels+1)); + FILE *ref; + struct item_id id; + int nodeid=0; info.write=1; info.maxlen=zip_info->maxnamelen; info.suffix=suffix; info.tiles_list=NULL; info.tilesdir_out=NULL; - FILE *ref=tempfile(suffix,"sgr_ref",1); - struct item_id id; - int nodeid=0; + ref=tempfile(suffix,"sgr_ref",1); create_tile_hash(); diff --git a/navit/navit/maptool/coastline.c b/navit/navit/maptool/coastline.c index a441585..c6a1de7 100644 --- a/navit/navit/maptool/coastline.c +++ b/navit/navit/maptool/coastline.c @@ -320,7 +320,7 @@ static void ocean_tile(GHashTable *hash, char *tile, char c, struct item_bin_sink *out) { int len=strlen(tile); - char tile2[len+1]; + char *tile2=g_alloca(sizeof(char)*(len+1)); struct rect bbox; struct item_bin *ib; struct coord co; @@ -391,7 +391,7 @@ tile_sibling_edges(GHashTable *hash, char *tile, char c) { int len=strlen(tile); int ret; - char tile2[len+1]; + char *tile2=g_alloca(sizeof(char)*(len+1)); void *data; strcpy(tile2, tile); tile2[len-1]=c; @@ -436,14 +436,14 @@ ocean_tile2(struct rect *r, int dx, int dy, int wf, int hf, struct item_bin_sink static void tile_collector_add_siblings2(char *tile, void *edgesp, struct coastline_tile_data *data) { + int edges=(int)edgesp; + int pedges=0; + int debug=0; int len=strlen(tile); - char tile2[len+1]; + char *tile2=g_alloca(sizeof(char)*(len+1)); char t=tile[len-1]; strcpy(tile2, tile); tile2[len-1]='\0'; - int edges=(int)edgesp; - int pedges=0; - int debug=0; #if 0 if (!strncmp(tile,"bcacccaadbdcd",10)) debug=1; @@ -482,9 +482,10 @@ tile_collector_finish(struct item_bin_sink_func *tile_collector) { struct coastline_tile_data data; int i; + GHashTable *hash; data.sink=tile_collector; data.tile_edges=g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); - GHashTable *hash=tile_collector->priv_data[0]; + hash=tile_collector->priv_data[0]; fprintf(stderr,"tile_collector_finish\n"); g_hash_table_foreach(hash, (GHFunc) tile_collector_process_tile, &data); fprintf(stderr,"tile_collector_finish foreach done\n"); diff --git a/navit/navit/maptool/geom.c b/navit/navit/maptool/geom.c index 5d4bbcc..ad32b74 100644 --- a/navit/navit/maptool/geom.c +++ b/navit/navit/maptool/geom.c @@ -290,7 +290,7 @@ clip_line_code(struct coord *p1, struct coord *p2, struct rect *r) void clip_line(struct item_bin *ib, struct rect *r, struct tile_parameter *param, struct item_bin_sink *out) { - char buffer[ib->len*4+32]; + char *buffer=g_alloca(sizeof(char)*(ib->len*4+32)); struct item_bin *ib_new=(struct item_bin *)buffer; struct coord *pa=(struct coord *)(ib+1); int count=ib->clen/2; @@ -376,9 +376,9 @@ clip_polygon(struct item_bin *ib, struct rect *r, struct tile_parameter *param, { int count_in=ib->clen/2; struct coord *pin,*p,*s,pi; - char buffer1[ib->len*4+ib->clen*7+32]; + char *buffer1=g_alloca(sizeof(char)*(ib->len*4+ib->clen*7+32)); struct item_bin *ib1=(struct item_bin *)buffer1; - char buffer2[ib->len*4+ib->clen*7+32]; + char *buffer2=g_alloca(sizeof(char)*(ib->len*4+ib->clen*7+32)); struct item_bin *ib2=(struct item_bin *)buffer2; struct item_bin *ib_in,*ib_out; int edge,i; -- 2.7.4