--- navit/navit/map/textfile/textfile.c 2012/04/09 21:27:36 27 +++ navit/navit/map/textfile/textfile.c 2012/06/17 08:12:47 28 @@ -55,7 +55,7 @@ static void map_destroy_textfile(struct map_priv *m) { - dbg(1,"map_destroy_textfile\n"); + // dbg(1,"map_destroy_textfile\n"); g_free(m->filename); if(m->charset) { g_free(m->charset); @@ -85,17 +85,20 @@ { struct map_rect_priv *mr=priv_data; int ret=0; - dbg(1,"textfile_coord_get %d\n",count); + // dbg(1,"textfile_coord_get %d\n",count); while (count--) { - if (mr->f && !feof(mr->f) && (!mr->item.id_hi || !mr->eoc) && parse_line(mr, mr->item.id_hi)) { + if (mr->f && !feof(mr->f) && (!mr->item.id_hi || !mr->eoc) && parse_line(mr, mr->item.id_hi)) + { *c=mr->c; - dbg(1,"c=0x%x,0x%x\n", c->x, c->y); + //dbg(1,"c=0x%x,0x%x\n", c->x, c->y); c++; ret++; get_line(mr); if (mr->item.id_hi) mr->eoc=1; - } else { + } + else + { mr->more=0; break; } @@ -125,31 +128,31 @@ { struct map_rect_priv *mr=priv_data; char *str=NULL; - dbg(1,"textfile_attr_get mr=%p attrs='%s' ", mr, mr->attrs); + //dbg(1,"textfile_attr_get mr=%p attrs='%s' ", mr, mr->attrs); if (attr_type != mr->attr_last) { - dbg(1,"reset attr_pos\n"); + //dbg(1,"reset attr_pos\n"); mr->attr_pos=0; mr->attr_last=attr_type; } if (attr_type == attr_any) { - dbg(1,"attr_any"); + //dbg(1,"attr_any"); if (attr_from_line(mr->attrs,NULL,&mr->attr_pos,mr->attr, mr->attr_name)) { attr_type=attr_from_name(mr->attr_name); - dbg(1,"found attr '%s' 0x%x\n", mr->attr_name, attr_type); + //dbg(1,"found attr '%s' 0x%x\n", mr->attr_name, attr_type); attr->type=attr_type; textfile_encode_attr(mr->attr, attr_type, attr); return 1; } } else { str=attr_to_name(attr_type); - dbg(1,"attr='%s' ",str); + //dbg(1,"attr='%s' ",str); if (attr_from_line(mr->attrs,str,&mr->attr_pos,mr->attr, NULL)) { textfile_encode_attr(mr->attr, attr_type, attr); - dbg(1,"found\n"); + //dbg(1,"found\n"); return 1; } } - dbg(1,"not found\n"); + //dbg(1,"not found\n"); return 0; } @@ -165,7 +168,7 @@ { struct map_rect_priv *mr; - dbg(1,"map_rect_new_textfile\n"); + //dbg(1,"map_rect_new_textfile\n"); mr=g_new0(struct map_rect_priv, 1); mr->m=map; mr->sel=sel; @@ -193,7 +196,7 @@ } sel=sel->next; } - dbg(1,"popen args %s\n", args); + //dbg(1,"popen args %s\n", args); mr->args=args; mr->f=popen(mr->args, "r"); mr->pos=0; @@ -204,7 +207,8 @@ } else { mr->f=fopen(map->filename, "r"); } - if(!mr->f) { + if(!mr->f) + { printf("map_rect_new_textfile unable to open textfile %s\n",map->filename); } get_line(mr); @@ -215,24 +219,27 @@ static void map_rect_destroy_textfile(struct map_rect_priv *mr) { - if (mr->f) { - if (mr->m->is_pipe) { + if (mr->f) + { + if (mr->m->is_pipe) + { #ifdef HAVE_POPEN pclose(mr->f); #endif } - else { + else + { fclose(mr->f); } } - g_free(mr); + g_free(mr); } static struct item * map_rect_get_item_textfile(struct map_rect_priv *mr) { char *p,type[SIZE]; - dbg(1,"map_rect_get_item_textfile id_hi=%d line=%s", mr->item.id_hi, mr->line); + //dbg(1,"map_rect_get_item_textfile id_hi=%d line=%s", mr->item.id_hi, mr->line); if (!mr->f) { return NULL; } @@ -242,7 +249,7 @@ } for(;;) { if (feof(mr->f)) { - dbg(1,"map_rect_get_item_textfile: eof %d\n",mr->item.id_hi); + //dbg(1,"map_rect_get_item_textfile: eof %d\n",mr->item.id_hi); if (mr->m->flags & 1) { if (!mr->item.id_hi) return NULL; @@ -273,7 +280,7 @@ get_line(mr); continue; } - dbg(1,"map_rect_get_item_textfile: point found\n"); + //dbg(1,"map_rect_get_item_textfile: point found\n"); mr->eoc=0; mr->item.id_lo=mr->pos; } else { @@ -281,7 +288,7 @@ get_line(mr); continue; } - dbg(1,"map_rect_get_item_textfile: line found\n"); + //dbg(1,"map_rect_get_item_textfile: line found\n"); if (! mr->line[0]) { get_line(mr); continue; @@ -289,11 +296,11 @@ mr->item.id_lo=mr->pos; strcpy(mr->attrs, mr->line); get_line(mr); - dbg(1,"mr=%p attrs=%s\n", mr, mr->attrs); + //dbg(1,"mr=%p attrs=%s\n", mr, mr->attrs); } - dbg(1,"get_attrs %s\n", mr->attrs); + //dbg(1,"get_attrs %s\n", mr->attrs); if (attr_from_line(mr->attrs,"type",NULL,type,NULL)) { - dbg(1,"type='%s'\n", type); + //dbg(1,"type='%s'\n", type); mr->item.type=item_from_name(type); if (mr->item.type == type_none) printf("Warning: type '%s' unknown\n", type); @@ -303,7 +310,7 @@ } mr->attr_last=attr_none; mr->more=1; - dbg(1,"return attr='%s'\n", mr->attrs); + //dbg(1,"return attr='%s'\n", mr->attrs); return &mr->item; } } @@ -378,7 +385,7 @@ void plugin_init(void) { - dbg(1,"textfile: plugin_init\n"); + //dbg(1,"textfile: plugin_init\n"); plugin_register_map_type("textfile", map_new_textfile); }