diff options
author | sleske <sleske@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2014-11-22 22:34:19 +0000 |
---|---|---|
committer | sleske <sleske@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2014-11-22 22:34:19 +0000 |
commit | 2a6aa9b917249f44e4aa27d88e255f61eb171d6a (patch) | |
tree | 0ad46b248e42f96e93b54874aa3b073ad1273aa1 /navit/map | |
parent | 05edfdebd6b83267121b11538abafe39bff266e7 (diff) | |
download | navit-2a6aa9b917249f44e4aa27d88e255f61eb171d6a.tar.gz |
Refactor:core:Introduce enum for debug levels, and use it everywhere.|First part of #1269.
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5960 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/map')
-rw-r--r-- | navit/map/binfile/binfile.c | 188 | ||||
-rw-r--r-- | navit/map/csv/csv.c | 44 | ||||
-rw-r--r-- | navit/map/csv/quadtree.c | 26 | ||||
-rw-r--r-- | navit/map/filter/filter.c | 10 | ||||
-rw-r--r-- | navit/map/mg/block.c | 18 | ||||
-rw-r--r-- | navit/map/mg/map.c | 36 | ||||
-rw-r--r-- | navit/map/mg/poly.c | 6 | ||||
-rw-r--r-- | navit/map/mg/street.c | 80 | ||||
-rw-r--r-- | navit/map/mg/town.c | 22 | ||||
-rw-r--r-- | navit/map/mg/tree.c | 52 | ||||
-rw-r--r-- | navit/map/shapefile/shapefile.c | 26 | ||||
-rw-r--r-- | navit/map/textfile/textfile.c | 54 |
12 files changed, 281 insertions, 281 deletions
diff --git a/navit/map/binfile/binfile.c b/navit/map/binfile/binfile.c index c5e283cd8..1abc14c23 100644 --- a/navit/map/binfile/binfile.c +++ b/navit/map/binfile/binfile.c @@ -241,9 +241,9 @@ binfile_read_eoc(struct file *fi) eoc=(struct zip_eoc *)file_data_read(fi,fi->size-sizeof(struct zip_eoc), sizeof(struct zip_eoc)); if (eoc) { eoc_to_cpu(eoc); - dbg(1,"sig 0x%x\n", eoc->zipesig); + dbg(lvl_warning,"sig 0x%x\n", eoc->zipesig); if (eoc->zipesig != zip_eoc_sig) { - dbg(0,"eoc signature check failed: 0x%x vs 0x%x\n",eoc->zipesig,zip_eoc_sig); + dbg(lvl_error,"eoc signature check failed: 0x%x vs 0x%x\n",eoc->zipesig,zip_eoc_sig); file_data_free(fi,(unsigned char *)eoc); eoc=NULL; } @@ -259,20 +259,20 @@ binfile_read_eoc64(struct file *fi) eocl=(struct zip64_eocl *)file_data_read(fi,fi->size-sizeof(struct zip_eoc)-sizeof(struct zip64_eocl), sizeof(struct zip64_eocl)); if (!eocl) return NULL; - dbg(1,"sig 0x%x\n", eocl->zip64lsig); + dbg(lvl_warning,"sig 0x%x\n", eocl->zip64lsig); if (eocl->zip64lsig != zip64_eocl_sig) { file_data_free(fi,(unsigned char *)eocl); - dbg(1,"eocl wrong\n"); + dbg(lvl_warning,"eocl wrong\n"); return NULL; } eoc=(struct zip64_eoc *)file_data_read(fi,eocl->zip64lofst, sizeof(struct zip64_eoc)); if (eoc) { if (eoc->zip64esig != zip64_eoc_sig) { file_data_free(fi,(unsigned char *)eoc); - dbg(1,"eoc wrong\n"); + dbg(lvl_warning,"eoc wrong\n"); eoc=NULL; } - dbg(1,"eoc64 ok 0x"LONGLONG_HEX_FMT " 0x"LONGLONG_HEX_FMT "\n",eoc->zip64eofst,eoc->zip64ecsz); + dbg(lvl_warning,"eoc64 ok 0x"LONGLONG_HEX_FMT " 0x"LONGLONG_HEX_FMT "\n",eoc->zip64eofst,eoc->zip64ecsz); } file_data_free(fi,(unsigned char *)eocl); return eoc; @@ -297,9 +297,9 @@ binfile_read_cd(struct map_priv *m, int offset, int len) } cd=(struct zip_cd *)file_data_read(m->fi,cdoffset+offset, sizeof(*cd)+len); if (cd) { - dbg(1,"cd at "LONGLONG_FMT" %zu bytes\n",cdoffset+offset, sizeof(*cd)+len); + dbg(lvl_warning,"cd at "LONGLONG_FMT" %zu bytes\n",cdoffset+offset, sizeof(*cd)+len); cd_to_cpu(cd); - dbg(1,"sig 0x%x\n", cd->zipcensig); + dbg(lvl_warning,"sig 0x%x\n", cd->zipcensig); if (cd->zipcensig != zip_cd_sig) { file_data_free(m->fi,(unsigned char *)cd); cd=NULL; @@ -389,12 +389,12 @@ binfile_read_content(struct map_priv *m, struct file *fi, long long offset, stru ret=file_data_read_encrypted(fi, offset, lfh->zipsize, lfh->zipuncmp, 1, m->passwd); break; default: - dbg(0,"Unknown encrypted compression method %d\n",enc->compress_method); + dbg(lvl_error,"Unknown encrypted compression method %d\n",enc->compress_method); } file_data_free(fi, (unsigned char *)enc); break; default: - dbg(0,"Unknown compression method %d\n", lfh->zipmthd); + dbg(lvl_error,"Unknown compression method %d\n", lfh->zipmthd); } return ret; } @@ -408,7 +408,7 @@ binfile_search_cd(struct map_priv *m, int offset, char *name, int partial, int s long long cdoffset=m->eoc64?m->eoc64->zip64eofst:m->eoc->zipeofst; struct zip_cd *cd; #if 0 - dbg(0,"end=%d\n",end); + dbg(lvl_error,"end=%d\n",end); #endif while (offset < end) { cd=(struct zip_cd *)(m->search_data+offset-m->search_offset); @@ -418,7 +418,7 @@ binfile_search_cd(struct map_priv *m, int offset, char *name, int partial, int s offset-m->search_offset+sizeof(*cd)+cd->zipcfnl+cd->zipcxtl > m->search_size ) { #if 0 - dbg(0,"reload %p %d %d\n", m->search_data, m->search_offset, offset); + dbg(lvl_error,"reload %p %d %d\n", m->search_data, m->search_offset, offset); #endif if (m->search_data) file_data_free(m->fi,m->search_data); @@ -430,8 +430,8 @@ binfile_search_cd(struct map_priv *m, int offset, char *name, int partial, int s cd=(struct zip_cd *)m->search_data; } #if 0 - dbg(0,"offset=%d search_offset=%d search_size=%d search_data=%p cd=%p\n", offset, m->search_offset, m->search_size, m->search_data, cd); - dbg(0,"offset=%d fn='%s'\n",offset,cd->zipcfn); + dbg(lvl_error,"offset=%d search_offset=%d search_size=%d search_data=%p cd=%p\n", offset, m->search_offset, m->search_size, m->search_data, cd); + dbg(lvl_error,"offset=%d fn='%s'\n",offset,cd->zipcfn); #endif if (!skip && (partial || cd->zipcfnl == len) && @@ -447,7 +447,7 @@ binfile_search_cd(struct map_priv *m, int offset, char *name, int partial, int s static void map_destroy_binfile(struct map_priv *m) { - dbg(1,"map_destroy_binfile\n"); + dbg(lvl_warning,"map_destroy_binfile\n"); if (m->fi) map_binfile_close(m); map_binfile_destroy(m); @@ -542,7 +542,7 @@ binfile_extract(struct map_priv *m, char *dir, char *filename, int partial) if (full[len-2] != '/') { lfh=binfile_read_lfh(m->fi, binfile_cd_offset(cd)); start=binfile_read_content(m, m->fi, binfile_cd_offset(cd), lfh); - dbg(0,"fopen '%s'\n", full); + dbg(lvl_error,"fopen '%s'\n", full); f=fopen(full,"w"); fwrite(start, lfh->zipuncmp, 1, f); fclose(f); @@ -588,7 +588,7 @@ binfile_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr) mr->label_attr[4]=t->pos_attr; if (type == attr_type || attr_type == attr_any) { if (attr_type == attr_any) { - dbg(1,"pos %p attr %s size %d\n", t->pos_attr-1, attr_to_name(type), size); + dbg(lvl_warning,"pos %p attr %s size %d\n", t->pos_attr-1, attr_to_name(type), size); } attr->type=type; if (ATTR_IS_GROUP(type)) { @@ -666,13 +666,13 @@ binfile_item_dup(struct map_priv *m, struct item *item, struct tile *t, int exte entry->id.id_hi=item->id_hi; entry->id.id_lo=item->id_lo; entry->flags=1; - dbg(0,"id 0x%x,0x%x\n",entry->id.id_hi,entry->id.id_lo); + dbg(lvl_error,"id 0x%x,0x%x\n",entry->id.id_hi,entry->id.id_lo); memcpy(ret, t->pos, (size+1)*sizeof(int)); if (!m->changes) m->changes=g_hash_table_new_full(binfile_hash_entry_hash, binfile_hash_entry_equal, g_free, NULL); g_hash_table_replace(m->changes, entry, entry); - dbg(0,"ret %p\n",ret); + dbg(lvl_error,"ret %p\n",ret); return ret; } @@ -687,15 +687,15 @@ binfile_coord_set(void *priv_data, struct coord *c, int count, enum change_mode { int *i=t->pos,j=0; - dbg(0,"Before: pos_coord=%td\n",t->pos_coord-i); + dbg(lvl_error,"Before: pos_coord=%td\n",t->pos_coord-i); while (i < t->pos_next) - dbg(0,"%d:0x%x\n",j++,*i++); + dbg(lvl_error,"%d:0x%x\n",j++,*i++); } aoffset=t->pos_attr-t->pos_attr_start; coffset=t->pos_coord-t->pos_coord_start-2; clen=t->pos_attr_start-t->pos_coord+2; - dbg(0,"coffset=%d clen=%d\n",coffset,clen); + dbg(lvl_error,"coffset=%d clen=%d\n",coffset,clen); switch (mode) { case change_mode_delete: if (count*2 > clen) @@ -732,7 +732,7 @@ binfile_coord_set(void *priv_data, struct coord *c, int count, enum change_mode default: return 0; } - dbg(0,"delta %d\n",delta); + dbg(lvl_error,"delta %d\n",delta); data=binfile_item_dup(mr->m, &mr->item, t, delta > 0 ? delta:0); data[0]=cpu_to_le32(le32_to_cpu(data[0])+delta); data[2]=cpu_to_le32(le32_to_cpu(data[2])+delta); @@ -744,18 +744,18 @@ binfile_coord_set(void *priv_data, struct coord *c, int count, enum change_mode tn=mr->t; tn->pos_coord=tn->pos_coord_start+coffset; tn->pos_attr=tn->pos_attr_start+aoffset; - dbg(0,"moving %d ints from offset %td to %td\n",move_len,tn->pos_coord_start+move_offset-data,tn->pos_coord_start+move_offset+delta-data); + dbg(lvl_error,"moving %d ints from offset %td to %td\n",move_len,tn->pos_coord_start+move_offset-data,tn->pos_coord_start+move_offset+delta-data); memmove(tn->pos_coord_start+move_offset+delta, tn->pos_coord_start+move_offset, move_len*4); { int *i=tn->pos,j=0; - dbg(0,"After move: pos_coord=%td\n",tn->pos_coord-i); + dbg(lvl_error,"After move: pos_coord=%td\n",tn->pos_coord-i); while (i < tn->pos_next) - dbg(0,"%d:0x%x\n",j++,*i++); + dbg(lvl_error,"%d:0x%x\n",j++,*i++); } if (mode != change_mode_append) tn->pos_coord+=move_offset; if (mode != change_mode_delete) { - dbg(0,"writing %d ints at offset %td\n",count*2,write_offset+tn->pos_coord_start-data); + dbg(lvl_error,"writing %d ints at offset %td\n",count*2,write_offset+tn->pos_coord_start-data); for (i = 0 ; i < count ; i++) { tn->pos_coord_start[write_offset++]=c[i].x; tn->pos_coord_start[write_offset++]=c[i].y; @@ -764,9 +764,9 @@ binfile_coord_set(void *priv_data, struct coord *c, int count, enum change_mode } { int *i=tn->pos,j=0; - dbg(0,"After: pos_coord=%td\n",tn->pos_coord-i); + dbg(lvl_error,"After: pos_coord=%td\n",tn->pos_coord-i); while (i < tn->pos_next) - dbg(0,"%d:0x%x\n",j++,*i++); + dbg(lvl_error,"%d:0x%x\n",j++,*i++); } return 1; } @@ -783,9 +783,9 @@ binfile_attr_set(void *priv_data, struct attr *attr, enum change_mode mode) { int *i=t->pos,j=0; - dbg(0,"Before: pos_attr=%td\n",t->pos_attr-i); + dbg(lvl_error,"Before: pos_attr=%td\n",t->pos_attr-i); while (i < t->pos_next) - dbg(0,"%d:0x%x\n",j++,*i++); + dbg(lvl_error,"%d:0x%x\n",j++,*i++); } @@ -796,7 +796,7 @@ binfile_attr_set(void *priv_data, struct attr *attr, enum change_mode mode) oattr_len=0; if (!naoffset) { if (mode == change_mode_delete || mode == change_mode_modify) { - dbg(0,"no attribute selected\n"); + dbg(lvl_error,"no attribute selected\n"); return 0; } if (mode == change_mode_append) @@ -804,7 +804,7 @@ binfile_attr_set(void *priv_data, struct attr *attr, enum change_mode mode) } while (offset < naoffset) { oattr_len=le32_to_cpu(t->pos_attr_start[offset])+1; - dbg(0,"len %d\n",oattr_len); + dbg(lvl_error,"len %d\n",oattr_len); write_offset=offset; offset+=oattr_len; } @@ -837,7 +837,7 @@ binfile_attr_set(void *priv_data, struct attr *attr, enum change_mode mode) delta=nattr_len-oattr_len; else delta=nattr_len; - dbg(0,"delta %d oattr_len %d nattr_len %d\n",delta,oattr_len, nattr_len); + dbg(lvl_error,"delta %d oattr_len %d nattr_len %d\n",delta,oattr_len, nattr_len); data=binfile_item_dup(mr->m, &mr->item, t, delta > 0 ? delta:0); data[0]=cpu_to_le32(le32_to_cpu(data[0])+delta); new.pos=new.start=data; @@ -848,20 +848,20 @@ binfile_attr_set(void *priv_data, struct attr *attr, enum change_mode mode) tn=mr->t; tn->pos_coord=tn->pos_coord_start+coffset; tn->pos_attr=tn->pos_attr_start+offset; - dbg(0,"attr start %td offset %d\n",tn->pos_attr_start-data,offset); - dbg(0,"moving %d ints from offset %td to %td\n",move_len,tn->pos_attr_start+move_offset-data,tn->pos_attr_start+move_offset+delta-data); + dbg(lvl_error,"attr start %td offset %d\n",tn->pos_attr_start-data,offset); + dbg(lvl_error,"moving %d ints from offset %td to %td\n",move_len,tn->pos_attr_start+move_offset-data,tn->pos_attr_start+move_offset+delta-data); memmove(tn->pos_attr_start+move_offset+delta, tn->pos_attr_start+move_offset, move_len*4); if (mode != change_mode_append) tn->pos_attr+=delta; { int *i=tn->pos,j=0; - dbg(0,"After move: pos_attr=%td\n",tn->pos_attr-i); + dbg(lvl_error,"After move: pos_attr=%td\n",tn->pos_attr-i); while (i < tn->pos_next) - dbg(0,"%d:0x%x\n",j++,*i++); + dbg(lvl_error,"%d:0x%x\n",j++,*i++); } if (nattr_len) { int *nattr=tn->pos_attr_start+write_offset; - dbg(0,"writing %d ints at %td\n",nattr_len,nattr-data); + dbg(lvl_error,"writing %d ints at %td\n",nattr_len,nattr-data); nattr[0]=cpu_to_le32(nattr_len-1); nattr[1]=cpu_to_le32(attr->type); memcpy(nattr+2, attr_data_get(attr), nattr_size); @@ -869,11 +869,11 @@ binfile_attr_set(void *priv_data, struct attr *attr, enum change_mode mode) } { int *i=tn->pos,j=0; - dbg(0,"After: pos_attr=%td\n",tn->pos_attr-i); + dbg(lvl_error,"After: pos_attr=%td\n",tn->pos_attr-i); while (i < tn->pos_next) - dbg(0,"After: pos_attr=%td\n",tn->pos_attr-i); + dbg(lvl_error,"After: pos_attr=%td\n",tn->pos_attr-i); while (i < tn->pos_next) - dbg(0,"%d:0x%x\n",j++,*i++); + dbg(lvl_error,"%d:0x%x\n",j++,*i++); } return 1; } @@ -910,7 +910,7 @@ pop_tile(struct map_rect_priv *mr) file_data_free(mr->m->fi, (unsigned char *)(mr->t->start)); #ifdef DEBUG_SIZE #if DEBUG_SIZE > 0 - dbg(0,"leave %d\n",mr->t->zipfile_num); + dbg(lvl_error,"leave %d\n",mr->t->zipfile_num); #endif #endif mr->t=&mr->tiles[--mr->tile_depth-1]; @@ -925,8 +925,8 @@ zipfile_to_tile(struct map_priv *m, struct zip_cd *cd, struct tile *t) struct zip_lfh *lfh; char *zipfn; struct file *fi; - dbg(1,"enter %p %p %p\n", m, cd, t); - dbg(1,"cd->zipofst=0x"LONGLONG_HEX_FMT "\n", binfile_cd_offset(cd)); + dbg(lvl_warning,"enter %p %p %p\n", m, cd, t); + dbg(lvl_warning,"cd->zipofst=0x"LONGLONG_HEX_FMT "\n", binfile_cd_offset(cd)); t->start=NULL; t->mode=1; if (m->fis) @@ -957,7 +957,7 @@ map_binfile_handle_redirect(struct map_priv *m) if (m->redirect) return 0; m->redirect=1; - dbg(0,"redirected from %s to %s\n",m->url,location); + dbg(lvl_error,"redirected from %s to %s\n",m->url,location); g_free(m->url); m->url=g_strdup(location); file_destroy(m->http); @@ -1006,7 +1006,7 @@ map_binfile_download_size(struct map_priv *m) } while (map_binfile_handle_redirect(m)); ret=file_size(m->http); - dbg(1,"file size "LONGLONG_FMT"\n",ret); + dbg(lvl_warning,"file size "LONGLONG_FMT"\n",ret); return ret; } @@ -1052,7 +1052,7 @@ map_binfile_download_range(struct map_priv *m, long long offset, int size) ret=file_data_read_special(http, size, &size_ret); if (size_ret != size) { - dbg(0,"size %d vs %d\n",size,size_ret); + dbg(lvl_error,"size %d vs %d\n",size,size_ret); g_free(ret); return NULL; } @@ -1066,7 +1066,7 @@ download_cd(struct map_download *download) struct zip64_eoc *zip64_eoc=(struct zip64_eoc *)file_data_read(m->fi, 0, sizeof(*zip64_eoc)); struct zip_cd *cd=(struct zip_cd *)map_binfile_download_range(m, zip64_eoc->zip64eofst+download->zipfile*m->cde_size,m->cde_size); file_data_free(m->fi, (unsigned char *)zip64_eoc); - dbg(0,"needed cd, result %p\n",cd); + dbg(lvl_error,"needed cd, result %p\n",cd); return cd; } @@ -1080,7 +1080,7 @@ download_request(struct map_download *download) if(!download->m->download_enabled) { - dbg(0,"Tried downloading while it's not allowed\n"); + dbg(lvl_error,"Tried downloading while it's not allowed\n"); return 0; } attrs[0]=&url; @@ -1099,7 +1099,7 @@ download_request(struct map_download *download) attrs[3]=NULL; download->dl_size=size; } - dbg(0,"encountered missing tile %d %s(%s), Downloading %d bytes at "LONGLONG_FMT"\n",download->zipfile, url.u.str,(char *)(download->cd_copy+1), download->dl_size, download->offset); + dbg(lvl_error,"encountered missing tile %d %s(%s), Downloading %d bytes at "LONGLONG_FMT"\n",download->zipfile, url.u.str,(char *)(download->cd_copy+1), download->dl_size, download->offset); map_binfile_http_request(download->m, attrs); g_free(url.u.str); download->http=download->m->http; @@ -1147,7 +1147,7 @@ download_download(struct map_download *download) return 0; } - dbg(1,"got %d bytes writing at offset "LONGLONG_FMT"\n",size_ret,download->offset); + dbg(lvl_warning,"got %d bytes writing at offset "LONGLONG_FMT"\n",size_ret,download->offset); if (size_ret <= 0) { g_free(data); return 1; @@ -1189,7 +1189,7 @@ download_finish(struct map_download *download) g_free(download->cd_copy); download->cd=(struct zip_cd *)(file_data_read(download->file, download->m->eoc->zipeofst + download->zipfile*download->m->cde_size, download->m->cde_size)); cd_to_cpu(download->cd); - dbg(1,"Offset %d\n",download->cd->zipofst); + dbg(lvl_warning,"Offset %d\n",download->cd->zipofst); return 1; } @@ -1197,7 +1197,7 @@ static int download_planet_size(struct map_download *download) { download->size=map_binfile_download_size(download->m); - dbg(0,"Planet size "LONGLONG_FMT"\n",download->size); + dbg(lvl_error,"Planet size "LONGLONG_FMT"\n",download->size); if (!download->size) return 0; return 1; @@ -1213,7 +1213,7 @@ download_eoc(struct map_download *download) download->zip_eoc=(struct zip_eoc *)(download->zip64_eocl+1); if (download->zip64_eoc->zip64esig != zip64_eoc_sig || download->zip64_eocl->zip64lsig != zip64_eocl_sig || download->zip_eoc->zipesig != zip_eoc_sig) { - dbg(0,"wrong signature on zip64_eoc downloaded from "LONGLONG_FMT"\n",download->size-98); + dbg(lvl_error,"wrong signature on zip64_eoc downloaded from "LONGLONG_FMT"\n",download->size-98); g_free(download->zip64_eoc); return 0; } @@ -1240,11 +1240,11 @@ download_directory_do(struct map_download *download) struct zip_cd *cd; cd=(struct zip_cd *)file_data_read_special(download->http, sizeof(*cd), &size_ret); cd->zipcunc=0; - dbg(1,"size_ret=%d\n",size_ret); + dbg(lvl_warning,"size_ret=%d\n",size_ret); if (!size_ret) return 0; if (size_ret != sizeof(*cd) || cd->zipcensig != zip_cd_sig) { - dbg(0,"error1 size=%d vs %zu\n",size_ret, sizeof(*cd)); + dbg(lvl_error,"error1 size=%d vs %zu\n",size_ret, sizeof(*cd)); return 0; } file_data_write(download->file, download->offset, sizeof(*cd), (unsigned char *)cd); @@ -1252,7 +1252,7 @@ download_directory_do(struct map_download *download) cd_xlen=cd->zipcfnl+cd->zipcxtl; cd_data=file_data_read_special(download->http, cd_xlen, &size_ret); if (size_ret != cd_xlen) { - dbg(0,"error2 size=%d vs %d\n",size_ret,cd_xlen); + dbg(lvl_error,"error2 size=%d vs %d\n",size_ret,cd_xlen); return 0; } file_data_write(download->file, download->offset, cd_xlen, cd_data); @@ -1297,14 +1297,14 @@ push_zipfile_tile_do(struct map_rect_priv *mr, struct zip_cd *cd, int zipfile, i struct map_priv *m=mr->m; struct file *f=m->fi; - dbg(1,"enter %p %d\n", mr, zipfile); + dbg(lvl_warning,"enter %p %d\n", mr, zipfile); #ifdef DEBUG_SIZE #if DEBUG_SIZE > 0 { char filename[cd->zipcfnl+1]; memcpy(filename, cd+1, cd->zipcfnl); filename[cd->zipcfnl]='\0'; - dbg(0,"enter %d (%s) %d\n",zipfile, filename, cd->zipcunc); + dbg(lvl_error,"enter %d (%s) %d\n",zipfile, filename, cd->zipcunc); } #endif mr->size+=cd->zipcunc; @@ -1360,10 +1360,10 @@ download(struct map_priv *m, struct map_rect_priv *mr, struct zip_cd *cd, int zi return NULL; } for (;;) { - dbg(0,"state=%d\n",download->state); + dbg(lvl_error,"state=%d\n",download->state); switch (download->state) { case 0: - dbg(0,"error\n"); + dbg(lvl_error,"error\n"); break; case 1: if (download_start(download)) @@ -1413,7 +1413,7 @@ download(struct map_priv *m, struct map_rect_priv *mr, struct zip_cd *cd, int zi if (download_eoc(download)) download->state=6; else { - dbg(0,"download of eoc failed\n"); + dbg(lvl_error,"download of eoc failed\n"); download->state=0; } break; @@ -1462,7 +1462,7 @@ push_zipfile_tile(struct map_rect_priv *mr, int zipfile, int offset, int length, struct file *f=m->fi; long long cdoffset=m->eoc64?m->eoc64->zip64eofst:m->eoc->zipeofst; struct zip_cd *cd=(struct zip_cd *)(file_data_read(f, cdoffset + zipfile*m->cde_size, m->cde_size)); - dbg(1,"read from "LONGLONG_FMT" %d bytes\n",cdoffset + zipfile*m->cde_size, m->cde_size); + dbg(lvl_warning,"read from "LONGLONG_FMT" %d bytes\n",cdoffset + zipfile*m->cde_size, m->cde_size); cd_to_cpu(cd); if (!cd->zipcunc && m->url) { cd=download(m, mr, cd, zipfile, offset, length, async); @@ -1479,7 +1479,7 @@ map_rect_new_binfile_int(struct map_priv *map, struct map_selection *sel) struct map_rect_priv *mr; binfile_check_version(map); - dbg(1,"map_rect_new_binfile\n"); + dbg(lvl_warning,"map_rect_new_binfile\n"); if (!map->fi && !map->url) return NULL; map_binfile_http_close(map); @@ -1567,7 +1567,7 @@ map_rect_new_binfile(struct map_priv *map, struct map_selection *sel) { struct map_rect_priv *mr=map_rect_new_binfile_int(map, sel); struct tile t; - dbg(1,"zip_members=%d\n", map->zip_members); + dbg(lvl_warning,"zip_members=%d\n", map->zip_members); if (map->url && map->fi && sel && sel->order == 255) { map_download_selection(map, mr, sel); } @@ -1599,7 +1599,7 @@ write_changes_do(gpointer key, gpointer value, gpointer user_data) if (entry->flags) { entry->flags=0; fwrite(entry, sizeof(*entry)+(le32_to_cpu(entry->data[0])+1)*4, 1, out); - dbg(0,"yes\n"); + dbg(lvl_error,"yes\n"); } } @@ -1652,7 +1652,7 @@ map_rect_destroy_binfile(struct map_rect_priv *mr) write_changes(mr->m); while (pop_tile(mr)); #ifdef DEBUG_SIZE - dbg(0,"size=%d kb\n",mr->size/1024); + dbg(lvl_error,"size=%d kb\n",mr->size/1024); #endif if (mr->tiles[0].fi && mr->tiles[0].start) file_data_free(mr->tiles[0].fi, (unsigned char *)(mr->tiles[0].start)); @@ -1668,11 +1668,11 @@ setup_pos(struct map_rect_priv *mr) struct tile *t=mr->t; size=le32_to_cpu(t->pos[0]); if (size > 1024*1024 || size < 0) { - dbg(0,"size=0x%x\n", size); + dbg(lvl_error,"size=0x%x\n", size); #if 0 fprintf(stderr,"offset=%d\n", (unsigned char *)(mr->pos)-mr->m->f->begin); #endif - dbg(0,"size error\n"); + dbg(lvl_error,"size error\n"); } t->pos_next=t->pos+size+1; mr->item.type=le32_to_cpu(t->pos[1]); @@ -1690,7 +1690,7 @@ selection_contains(struct map_selection *sel, struct coord_rect *r, struct range while (sel) { if (coord_rect_overlap(r, &sel->u.c_rect)) { order=sel->order; - dbg(1,"min %d max %d order %d\n", mima->min, mima->max, order); + dbg(lvl_warning,"min %d max %d order %d\n", mima->min, mima->max, order); if (!mima->min && !mima->max) return 1; if (order >= mima->min && order <= mima->max) @@ -1722,13 +1722,13 @@ map_parse_country_binfile(struct map_rect_priv *mr) struct attr af, al; if(binfile_attr_get(mr->item.priv_data, attr_first_key, &af)) { if(linguistics_compare(af.u.str,search->u.str,linguistics_cmp_partial)>0) { - dbg(1,"Skipping index item with first_key='%s'\n", af.u.str); + dbg(lvl_warning,"Skipping index item with first_key='%s'\n", af.u.str); return; } } if(binfile_attr_get(mr->item.priv_data, attr_last_key, &al)) { if(linguistics_compare(al.u.str,search->u.str,linguistics_cmp_partial)<0) { - dbg(1,"Skipping index item with first_key='%s', last_key='%s'\n", af.u.str, al.u.str); + dbg(lvl_warning,"Skipping index item with first_key='%s', last_key='%s'\n", af.u.str, al.u.str); return; } } @@ -1763,7 +1763,7 @@ map_parse_submap(struct map_rect_priv *mr, int async) return 0; if (!binfile_attr_get(mr->item.priv_data, attr_zipfile_ref, &at)) return 0; - dbg(1,"pushing zipfile %ld from %d\n", at.u.num, mr->t->zipfile_num); + dbg(lvl_warning,"pushing zipfile %ld from %d\n", at.u.num, mr->t->zipfile_num); return push_zipfile_tile(mr, at.u.num, 0, 0, async); } @@ -2108,7 +2108,7 @@ binmap_search_new(struct map_priv *map, struct item *item, struct attr *search, map_rect_destroy_binfile(map_rec); break; case attr_house_number: - dbg(1,"case house_number"); + dbg(lvl_warning,"case house_number"); if (! item->map) break; if (!map_priv_is(item->map, map)) @@ -2131,12 +2131,12 @@ binmap_search_new(struct map_priv *map, struct item *item, struct attr *search, msp->mr = binmap_search_street_by_place(map, town, &c, &msp->ms, &msp->boundaries); map_rect_destroy_binfile(map_rec); if (msp->boundaries) - dbg(0, "using map town boundaries\n"); + dbg(lvl_error, "using map town boundaries\n"); if (!msp->boundaries && town) { binmap_get_estimated_boundaries(town, &msp->boundaries); if (msp->boundaries) - dbg(0, "using estimated boundaries\n"); + dbg(lvl_error, "using estimated boundaries\n"); } /* start searching in area around the street segment even if town boundaries are available */ msp->mr=binmap_search_housenumber_by_estimate(map, &c, &msp->ms); @@ -2144,7 +2144,7 @@ binmap_search_new(struct map_priv *map, struct item *item, struct attr *search, msp->rect_new=msp->ms.u.c_rect; if(item_attr_get(msp->item, attr_street_name, &attr)) msp->parent_name=g_strdup(attr.u.str); - dbg(0,"pn=%s\n",msp->parent_name); + dbg(lvl_error,"pn=%s\n",msp->parent_name); } } if (idx != 3) { @@ -2432,7 +2432,7 @@ binmap_search_get_item(struct map_search_priv *map_search) map_search->ms.u.c_rect=map_search->rect_new; map_rect_destroy_binfile(map_search->mr); map_search->mr=map_rect_new_binfile(map_search->map, &map_search->ms); - dbg(0,"Extended house number search region to %d x %d, restarting...\n",map_search->ms.u.c_rect.rl.x - map_search->ms.u.c_rect.lu.x, map_search->ms.u.c_rect.lu.y-map_search->ms.u.c_rect.rl.y); + dbg(lvl_error,"Extended house number search region to %d x %d, restarting...\n",map_search->ms.u.c_rect.rl.x - map_search->ms.u.c_rect.lu.x, map_search->ms.u.c_rect.lu.y-map_search->ms.u.c_rect.rl.y); continue; } } @@ -2564,7 +2564,7 @@ map_binfile_zip_setup(struct map_priv *m, char *filename, int mmap) struct zip_cd *first_cd; int i; if (!(m->eoc=binfile_read_eoc(m->fi))) { - dbg(0,"unable to read eoc\n"); + dbg(lvl_error,"unable to read eoc\n"); return 0; } dbg_assert(m->eoc->zipedsk == m->eoc->zipecen); @@ -2580,20 +2580,20 @@ map_binfile_zip_setup(struct map_priv *m, char *filename, int mmap) m->fis[m->eoc->zipedsk-1]=m->fi; g_free(tmpfilename); } - dbg(1,"num_disk %d\n",m->eoc->zipedsk); + dbg(lvl_warning,"num_disk %d\n",m->eoc->zipedsk); m->eoc64=binfile_read_eoc64(m->fi); if (!binfile_get_index(m)) { - dbg(0,"no index found\n"); + dbg(lvl_error,"no index found\n"); return 0; } if (!(first_cd=binfile_read_cd(m, 0, 0))) { - dbg(0,"unable to get first cd\n"); + dbg(lvl_error,"unable to get first cd\n"); return 0; } m->cde_size=sizeof(struct zip_cd)+first_cd->zipcfnl+first_cd->zipcxtl; m->zip_members=m->index_offset/m->cde_size+1; - dbg(1,"cde_size %d\n", m->cde_size); - dbg(1,"members %d\n",m->zip_members); + dbg(lvl_warning,"cde_size %d\n", m->cde_size); + dbg(lvl_warning,"members %d\n",m->zip_members); file_data_free(m->fi, (unsigned char *)first_cd); if (mmap) file_mmap(m->fi); @@ -2692,12 +2692,12 @@ map_binfile_open(struct map_priv *m) struct attr readwrite={attr_readwrite, {(void *)1}}; struct attr *attrs[]={&readwrite, NULL}; - dbg(1,"file_create %s\n", m->filename); + dbg(lvl_warning,"file_create %s\n", m->filename); m->fi=file_create(m->filename, m->url?attrs:NULL); if (! m->fi && m->url) return 0; if (! m->fi) { - dbg(0,"Failed to load '%s'\n", m->filename); + dbg(lvl_error,"Failed to load '%s'\n", m->filename); return 0; } if (m->check_version) @@ -2711,13 +2711,13 @@ map_binfile_open(struct map_priv *m) *magic = le32_to_cpu(*magic); if (*magic == zip_lfh_sig || *magic == zip_split_sig || *magic == zip_cd_sig || *magic == zip64_eoc_sig) { if (!map_binfile_zip_setup(m, m->filename, m->flags & 1)) { - dbg(0,"invalid file format for '%s'\n", m->filename); + dbg(lvl_error,"invalid file format for '%s'\n", m->filename); file_destroy(m->fi); m->fi=NULL; return 0; } } else if (*magic == zip_lfh_sig_rev || *magic == zip_split_sig_rev || *magic == zip_cd_sig_rev || *magic == zip64_eoc_sig_rev) { - dbg(0,"endianness mismatch\n"); + dbg(lvl_error,"endianness mismatch\n"); file_destroy(m->fi); m->fi=NULL; return 0; @@ -2735,7 +2735,7 @@ map_binfile_open(struct map_priv *m) if (binfile_attr_get(item->priv_data, attr_map_release, &attr)) m->map_release=g_strdup(attr.u.str); if (m->url && binfile_attr_get(item->priv_data, attr_url, &attr)) { - dbg(0,"url config %s map %s\n",m->url,attr.u.str); + dbg(lvl_error,"url config %s map %s\n",m->url,attr.u.str); if (strcmp(m->url, attr.u.str)) m->update_available=1; g_free(m->url); @@ -2744,7 +2744,7 @@ map_binfile_open(struct map_priv *m) } map_rect_destroy_binfile(mr); if (m->map_version >= 16) { - dbg(0,"Warning: This map is incompatible with your navit version. Please update navit.\n"); + dbg(lvl_error,"Warning: This map is incompatible with your navit version. Please update navit.\n"); return 0; } } @@ -2807,7 +2807,7 @@ map_new_binfile(struct map_methods *meth, struct attr **attrs, struct callback_l wexp=file_wordexp_new(data->u.str); wexp_data=file_wordexp_get_array(wexp); - dbg(1,"map_new_binfile %s\n", data->u.str); + dbg(lvl_warning,"map_new_binfile %s\n", data->u.str); *meth=map_methods_binfile; m=g_new0(struct map_priv, 1); @@ -2843,9 +2843,9 @@ map_new_binfile(struct map_methods *meth, struct attr **attrs, struct callback_l void plugin_init(void) { - dbg(1,"binfile: plugin_init\n"); + dbg(lvl_warning,"binfile: plugin_init\n"); if (sizeof(struct zip_cd) != 46) { - dbg(0,"error: sizeof(struct zip_cd)=%zu\n",sizeof(struct zip_cd)); + dbg(lvl_error,"error: sizeof(struct zip_cd)=%zu\n",sizeof(struct zip_cd)); } plugin_register_map_type("binfile", map_new_binfile); } diff --git a/navit/map/csv/csv.c b/navit/map/csv/csv.c index e8d7a9879..8cb677839 100644 --- a/navit/map/csv/csv.c +++ b/navit/map/csv/csv.c @@ -88,7 +88,7 @@ save_map_csv(struct map_priv *m) struct quadtree_item *qitem; if( ! (fp=fopen(filename,"w+"))) { - dbg(0, "Error opening csv file to write new entries"); + dbg(lvl_error, "Error opening csv file to write new entries"); return; } /*query the world*/ @@ -126,11 +126,11 @@ save_map_csv(struct map_priv *m) } else if(ATTR_IS_STRING(*at)) { tmpstr = g_strdup(found_attr->u.str); } else { - dbg(0,"Cant represent attribute %s\n",attr_to_name(*at)); + dbg(lvl_error,"Cant represent attribute %s\n",attr_to_name(*at)); tmpstr=g_strdup(""); } } else { - dbg(0,"No value defined for the atribute %s, assuming empty string\n",attr_to_name(*at)); + dbg(lvl_error,"No value defined for the atribute %s, assuming empty string\n",attr_to_name(*at)); tmpstr=g_strdup(""); } } @@ -149,7 +149,7 @@ save_map_csv(struct map_priv *m) if(m->charset) { tmpstr=g_convert(csv_line, -1,m->charset,"utf-8",NULL,NULL,NULL); if(!tmpstr) - dbg(0,"Error converting '%s' to %s\n",csv_line, m->charset); + dbg(lvl_error,"Error converting '%s' to %s\n",csv_line, m->charset); } else tmpstr=csv_line; @@ -181,7 +181,7 @@ static const int zoom_max = 18; static void map_destroy_csv(struct map_priv *m) { - dbg(1,"map_destroy_csv\n"); + dbg(lvl_warning,"map_destroy_csv\n"); /*save if changed */ save_map_csv(m); g_hash_table_destroy(m->qitem_hash); @@ -355,10 +355,10 @@ static int csv_type_set(void *priv_data, enum item_type type) { struct map_rect_priv* mr = (struct map_rect_priv*)priv_data; - dbg(1,"Enter %d\n", type); + dbg(lvl_warning,"Enter %d\n", type); if(!mr || !mr->qitem) { - dbg(1,"Nothing to do\n"); + dbg(lvl_warning,"Nothing to do\n"); return 0; } @@ -366,7 +366,7 @@ csv_type_set(void *priv_data, enum item_type type) return 0; mr->qitem->deleted=1; - dbg(1,"Item %p is deleted\n",mr->qitem); + dbg(lvl_warning,"Item %p is deleted\n",mr->qitem); return 1; } @@ -395,7 +395,7 @@ csv_coord_set(void *priv_data, struct coord *c, int count, enum change_mode mode struct map_priv* m; struct quadtree_item* qi; GList* new_it; - dbg(1,"Set coordinates %d %d\n", c->x, c->y); + dbg(lvl_warning,"Set coordinates %d %d\n", c->x, c->y); /* for now we only support coord modification only */ if( ! change_mode_modify) { @@ -430,7 +430,7 @@ csv_coord_set(void *priv_data, struct coord *c, int count, enum change_mode mode qi->longitude = cg.lng; qi->latitude = cg.lat; quadtree_add( m->tree_root, qi, mr->qiter); - dbg(1,"Set coordinates %f %f\n", cg.lng, cg.lat); + dbg(lvl_warning,"Set coordinates %f %f\n", cg.lng, cg.lat); m->new_items = g_list_remove_link(m->new_items,new_it); m->dirty=1; save_map_csv(m); @@ -493,11 +493,11 @@ static void map_csv_debug_dump_hash_item(gpointer key, gpointer value, gpointer { struct quadtree_item *qi=value; GList *attrs; - dbg(3,"%p del=%d ref=%d\n", qi,qi->deleted, qi->ref_count); + dbg(lvl_debug,"%p del=%d ref=%d\n", qi,qi->deleted, qi->ref_count); attrs=((struct quadtree_data *)qi->data)->attr_list; while(attrs) { if(((struct attr*)attrs->data)->type==attr_label) - dbg(3,"... %s\n",((struct attr*)attrs->data)->u.str); + dbg(lvl_debug,"... %s\n",((struct attr*)attrs->data)->u.str); attrs=g_list_next(attrs); } } @@ -518,7 +518,7 @@ map_rect_new_csv(struct map_priv *map, struct map_selection *sel) struct coord_geo lu; struct coord_geo rl; struct quadtree_iter *res = NULL; - dbg(1,"map_rect_new_csv\n"); + dbg(lvl_warning,"map_rect_new_csv\n"); if(debug_level_get("map_csv")>2) { map_csv_debug_dump(map); } @@ -725,7 +725,7 @@ map_new_csv(struct map_methods *meth, struct attr **attrs, struct callback_list charset = attr_search(attrs, NULL, attr_charset); if(charset) { - dbg(1,"charset:%s\n",charset->u.str); + dbg(lvl_warning,"charset:%s\n",charset->u.str); m->charset=g_strdup(charset->u.str); } else { m->charset=g_strdup(map_methods_csv.charset); @@ -757,7 +757,7 @@ map_new_csv(struct map_methods *meth, struct attr **attrs, struct callback_list 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); + dbg(lvl_warning,"map_new_csv %s\n", data->u.str); m->filename=g_strdup(wexp_data[0]); file_wordexp_destroy(wexp); @@ -774,7 +774,7 @@ map_new_csv(struct map_methods *meth, struct attr **attrs, struct callback_list int col_cnt=0; char *tok; if(!line) { - dbg(0,"Error converting '%s' to utf-8 from %s\n",linebuf, m->charset); + dbg(lvl_error,"Error converting '%s' to utf-8 from %s\n",linebuf, m->charset); continue; } if(line[strlen(line)-1]=='\n' || line[strlen(line)-1]=='\r') { @@ -847,7 +847,7 @@ map_new_csv(struct map_methods *meth, struct attr **attrs, struct callback_list *pID = m->next_item_idx; g_hash_table_insert(m->qitem_hash, pID,qi); ++m->next_item_idx; - dbg(1,"%s\n",line); + dbg(lvl_warning,"%s\n",line); } else { g_free(curr_item); @@ -855,7 +855,7 @@ map_new_csv(struct map_methods *meth, struct attr **attrs, struct callback_list } else { - dbg(0,"ERROR: Non-matching attr count and column count: %d %d SKIPPING line: %s\n",col_cnt, attr_cnt,line); + dbg(lvl_error,"ERROR: Non-matching attr count and column count: %d %d SKIPPING line: %s\n",col_cnt, attr_cnt,line); } g_free(line); g_free(line2); @@ -864,20 +864,20 @@ map_new_csv(struct map_methods *meth, struct attr **attrs, struct callback_list fclose(fp); } else { - dbg(0,"Error opening csv map file %s, starting with empty map\n", m->filename); + dbg(lvl_error,"Error opening csv map file %s, starting with empty map\n", m->filename); } } else { - dbg(1,"No data attribute, starting with in-memory map\n"); + dbg(lvl_warning,"No data attribute, starting with in-memory map\n"); } - dbg(2,"%p\n",tree_root); + dbg(lvl_info,"%p\n",tree_root); return m; } void plugin_init(void) { - dbg(1,"csv: plugin_init\n"); + dbg(lvl_warning,"csv: plugin_init\n"); plugin_register_map_type("csv", map_new_csv); } diff --git a/navit/map/csv/quadtree.c b/navit/map/csv/quadtree.c index 1becab7ce..f7b3fdc30 100644 --- a/navit/map/csv/quadtree.c +++ b/navit/map/csv/quadtree.c @@ -379,7 +379,7 @@ void quadtree_node_drop_garbage(struct quadtree_node* node, struct quadtree_iter { int i,j; int node_num=node->node_num; - dbg(1,"Processing unreferenced subnode children...\n"); + dbg(lvl_warning,"Processing unreferenced subnode children...\n"); for(i=0,j=0;i<node_num;i++) { if(node->items[i]->deleted && !node->items[i]->ref_count) { if(iter->item_free) { @@ -426,7 +426,7 @@ quadtree_add(struct quadtree_node* this_, struct quadtree_item* item, struct qua } if (bSame) { //FIXME: memleak and items thrown away if more than QUADTREE_NODE_CAPACITY-1 items with same coordinates added. - dbg(0,"Unable to add another item with same coordinates. Throwing item to the ground. Will leak %p.\n",item); + dbg(lvl_error,"Unable to add another item with same coordinates. Throwing item to the ground. Will leak %p.\n",item); return; } this_->items[this_->node_num++] = item; @@ -561,7 +561,7 @@ struct quadtree_iter *quadtree_query(struct quadtree_node *this_, double dXMin, ret->xmax=dXMax; ret->ymin=dYMin; ret->ymax=dYMax; - dbg(1,"%f %f %f %f\n",dXMin,dXMax,dYMin,dYMax) + dbg(lvl_warning,"%f %f %f %f\n",dXMin,dXMax,dYMin,dYMax) ret->item_free=item_free; ret->item_free_context=item_free_context; n->node=this_; @@ -577,7 +577,7 @@ struct quadtree_iter *quadtree_query(struct quadtree_node *this_, double dXMin, } this_->ref_count++; - dbg(1,"Query %p \n",this_) + dbg(lvl_warning,"Query %p \n",this_) return ret; } @@ -627,16 +627,16 @@ struct quadtree_item * quadtree_item_next(struct quadtree_iter *iter) if(iter_node->is_leaf) { /* Try to find undeleted item in the current node */ - dbg(1,"find item %p %p ...\n",iter->iter_nodes,iter->iter_nodes->data); + dbg(lvl_warning,"find item %p %p ...\n",iter->iter_nodes,iter->iter_nodes->data); while(iter_node->item<iter_node->node_num) { - dbg(1,"%d %d\n",iter_node->item,iter_node->items[iter_node->item]->deleted); + dbg(lvl_warning,"%d %d\n",iter_node->item,iter_node->items[iter_node->item]->deleted); if(iter_node->items[iter_node->item]->deleted) { iter_node->item++; continue; } iter->item=iter_node->items[iter_node->item]; iter_node->item++; - dbg(1,"Returning %p\n",iter->item); + dbg(lvl_warning,"Returning %p\n",iter->item); iter->item->ref_count++; return iter->item; } @@ -654,13 +654,13 @@ struct quadtree_item * quadtree_item_next(struct quadtree_iter *iter) i=iter_node->subnode; if(!nodes[i] || !rects_overlap(nodes[i]->xmin, nodes[i]->ymin, nodes[i]->xmax, nodes[i]->ymax, iter->xmin, iter->ymin, iter->xmax, iter->ymax)) continue; - dbg(1,"%f %f %f %f\n",nodes[i]->xmin, nodes[i]->xmax, nodes[i]->ymin, nodes[i]->ymax) + dbg(lvl_warning,"%f %f %f %f\n",nodes[i]->xmin, nodes[i]->xmax, nodes[i]->ymin, nodes[i]->ymax) subnode=nodes[i]; } if(subnode) { /* Go one level deeper */ - dbg(1,"Go one level deeper...\n"); + dbg(lvl_warning,"Go one level deeper...\n"); iter_node=g_new0(struct quadtree_iter_node, 1); iter_node->node=subnode; iter_node->is_leaf=subnode->is_leaf; @@ -692,7 +692,7 @@ struct quadtree_item * quadtree_item_next(struct quadtree_iter *iter) /* 2. remove empty leaf subnode if it's unreferenced */ if(!subnode->ref_count && !subnode->node_num && subnode->is_leaf ) { - dbg(1,"Going to delete an empty unreferenced leaf subnode...\n"); + dbg(lvl_warning,"Going to delete an empty unreferenced leaf subnode...\n"); if(subnode->parent) { if(subnode->parent->aa==subnode) { @@ -704,19 +704,19 @@ struct quadtree_item * quadtree_item_next(struct quadtree_iter *iter) } else if(subnode->parent->bb==subnode) { subnode->parent->bb=NULL; } else { - dbg(0,"Found Quadtree structure corruption while trying to free an empty node.\n"); + dbg(lvl_error,"Found Quadtree structure corruption while trying to free an empty node.\n"); } if(!subnode->parent->aa && !subnode->parent->ab && !subnode->parent->ba && !subnode->parent->bb ) subnode->parent->is_leaf=1; g_free(subnode); } else - dbg(1,"Quadtree is empty. NOT deleting the root subnode...\n"); + dbg(lvl_warning,"Quadtree is empty. NOT deleting the root subnode...\n"); } /* Go one step towards root */ - dbg(2,"Going towards root...\n"); + dbg(lvl_info,"Going towards root...\n"); g_free(iter->iter_nodes->data); iter->iter_nodes=g_list_delete_link(iter->iter_nodes,iter->iter_nodes); } diff --git a/navit/map/filter/filter.c b/navit/map/filter/filter.c index 2b9bceb98..cf083c85a 100644 --- a/navit/map/filter/filter.c +++ b/navit/map/filter/filter.c @@ -319,7 +319,7 @@ map_filter_rect_get_item(struct map_rect_priv *mr) static struct item * map_filter_rect_get_item_byid(struct map_rect_priv *mr, int id_hi, int id_lo) { - dbg(0,"enter\n"); + dbg(lvl_error,"enter\n"); mr->parent_item=map_rect_get_item_byid(mr->parent, id_hi, id_lo); if (!mr->parent_item) return NULL; @@ -332,21 +332,21 @@ map_filter_rect_get_item_byid(struct map_rect_priv *mr, int id_hi, int id_lo) static struct map_search_priv * map_filter_search_new(struct map_priv *map, struct item *item, struct attr *search, int partial) { - dbg(0,"enter\n"); + dbg(lvl_error,"enter\n"); return NULL; } static struct item * map_filter_search_get_item(struct map_search_priv *map_search) { - dbg(0,"enter\n"); + dbg(lvl_error,"enter\n"); return NULL; } static void map_filter_search_destroy(struct map_search_priv *ms) { - dbg(0,"enter\n"); + dbg(lvl_error,"enter\n"); } static void @@ -429,7 +429,7 @@ map_filter_new(struct map_methods *meth, struct attr **attrs, struct callback_li void plugin_init(void) { - dbg(1,"filter: plugin_init\n"); + dbg(lvl_warning,"filter: plugin_init\n"); plugin_register_map_type("filter", map_filter_new); } diff --git a/navit/map/mg/block.c b/navit/map/mg/block.c index 988865728..f18e77863 100644 --- a/navit/map/mg/block.c +++ b/navit/map/mg/block.c @@ -77,7 +77,7 @@ block_get_byid(struct file *file, int id, unsigned char **p_ret) int block_get_byindex(struct file *file, int idx, struct block_priv *blk) { - dbg(1,"idx=%d\n", idx); + dbg(lvl_warning,"idx=%d\n", idx); blk->b=block_get_byid(file, idx, &blk->p); blk->block_start=(unsigned char *)(blk->b); blk->p_start=blk->p; @@ -177,7 +177,7 @@ block_next_lin(struct map_rect_priv *mr) else mr->b.p=mr->b.block_start+block_get_blocks(mr->b.b)*512; if (mr->b.p >= mr->file->end) { - dbg(1,"end of blocks %p vs %p\n", mr->b.p, mr->file->end); + dbg(lvl_warning,"end of blocks %p vs %p\n", mr->b.p, mr->file->end); return 0; } mr->b.block_start=mr->b.p; @@ -185,17 +185,17 @@ block_next_lin(struct map_rect_priv *mr) mr->b.p_start=mr->b.p; mr->b.end=mr->b.block_start+block_get_size(mr->b.b); if (block_get_count(mr->b.b) == -1) { - dbg(1,"empty blocks\n"); + dbg(lvl_warning,"empty blocks\n"); return 0; } block_get_r(mr->b.b, &r); if (!mr->cur_sel || coord_rect_overlap(&mr->cur_sel->u.c_rect, &r)) { block_active_count++; block_active_mem+=block_get_blocks(mr->b.b)*512-sizeof(struct block *); - dbg(1,"block ok\n"); + dbg(lvl_warning,"block ok\n"); return 1; } - dbg(2,"block not in cur_sel\n"); + dbg(lvl_info,"block not in cur_sel\n"); } } @@ -210,14 +210,14 @@ block_next(struct map_rect_priv *mr) return block_next_lin(mr); for (;;) { if (! bt->p) { - dbg(1,"block 0x%x\n", bt->next); + dbg(lvl_warning,"block 0x%x\n", bt->next); if (bt->next == -1) return 0; bt->b=block_get_byid(mr->file, bt->next, &bt->p); bt->end=(unsigned char *)mr->b.bt.b+block_get_size(mr->b.bt.b); bt->next=block_get_next(bt->b); bt->order=0; - dbg(1,"size 0x%x next 0x%x\n", block_get_size(bt->b), block_get_next(bt->b)); + dbg(lvl_warning,"size 0x%x next 0x%x\n", block_get_size(bt->b), block_get_next(bt->b)); if (! mr->b.bt.block_count) { #if 0 if (debug) { @@ -238,8 +238,8 @@ block_next(struct map_rect_priv *mr) blk_num=get_u32(&mr->b.bt.p); coord=get_u32(&mr->b.bt.p); block_mem+=8; - dbg(1,"%p vs %p coord 0x%x ", mr->b.bt.end, mr->b.bt.p, coord); - dbg(1,"block 0x%x", blk_num); + dbg(lvl_warning,"%p vs %p coord 0x%x ", mr->b.bt.end, mr->b.bt.p, coord); + dbg(lvl_warning,"block 0x%x", blk_num); r_w=bt->r_curr.rl.x-bt->r_curr.lu.x; r_h=bt->r_curr.lu.y-bt->r_curr.rl.y; diff --git a/navit/map/mg/map.c b/navit/map/mg/map.c index 682b6917c..b5a67fd09 100644 --- a/navit/map/mg/map.c +++ b/navit/map/mg/map.c @@ -289,7 +289,7 @@ map_rect_get_item_mg(struct map_rect_priv *mr) } if (file_next(mr)) continue; - dbg(1,"lin_count %d idx_count %d active_count %d %d kB (%d kB)\n", block_lin_count, block_idx_count, block_active_count, (block_mem+block_active_mem)/1024, block_active_mem/1024); + dbg(lvl_warning,"lin_count %d idx_count %d active_count %d %d kB (%d kB)\n", block_lin_count, block_idx_count, block_active_count, (block_mem+block_active_mem)/1024, block_active_mem/1024); return NULL; } } @@ -361,7 +361,7 @@ map_search_mg_convert_special(char *str) *c++='u'; break; default: - dbg(1,"0x%x\n", *str); + dbg(lvl_warning,"0x%x\n", *str); *c++=*str; break; } @@ -375,11 +375,11 @@ static int map_search_setup(struct map_rect_priv *mr) { char *prefix; - dbg(1,"%s\n", attr_to_name(mr->search_type)); + dbg(lvl_warning,"%s\n", attr_to_name(mr->search_type)); switch (mr->search_type) { case attr_town_postal: if (mr->search_item.type != type_country_label) { - dbg(0,"wrong parent type %s\n", item_to_name(mr->search_item.type)); + dbg(lvl_error,"wrong parent type %s\n", item_to_name(mr->search_item.type)); return 0; } prefix=mg_country_postal_prefix(mr->search_item.id_lo); @@ -388,12 +388,12 @@ map_search_setup(struct map_rect_priv *mr) tree_search_init(mr->m->dirname, "town.b1", &mr->ts, 0); mr->current_file=file_town_twn; mr->search_str=g_strdup_printf("%s%s",prefix,mr->search_attr->u.str); - dbg(0,"search_str='%s'\n",mr->search_str); + dbg(lvl_error,"search_str='%s'\n",mr->search_str); mr->search_country=mg_country_from_isonum(mr->search_item.id_lo); break; case attr_town_name: if (mr->search_item.type != type_country_label) { - dbg(0,"wrong parent type %s\n", item_to_name(mr->search_item.type)); + dbg(lvl_error,"wrong parent type %s\n", item_to_name(mr->search_item.type)); return 0; } tree_search_init(mr->m->dirname, "town.b2", &mr->ts, 0x1000); @@ -403,7 +403,7 @@ map_search_setup(struct map_rect_priv *mr) break; case attr_district_name: if (mr->search_item.type != type_country_label) { - dbg(0,"wrong parent type %s\n", item_to_name(mr->search_item.type)); + dbg(lvl_error,"wrong parent type %s\n", item_to_name(mr->search_item.type)); return 0; } tree_search_init(mr->m->dirname, "town.b3", &mr->ts, 0x1000); @@ -434,11 +434,11 @@ map_search_setup(struct map_rect_priv *mr) return 0; } } else { - dbg(0,"wrong parent type %s %p 0x%x 0x%x\n", item_to_name(mr->search_item.type), item, mr->search_item.id_hi, mr->search_item.id_lo); + dbg(lvl_error,"wrong parent type %s %p 0x%x 0x%x\n", item_to_name(mr->search_item.type), item, mr->search_item.id_hi, mr->search_item.id_lo); return 0; } } - dbg(1,"street_assoc=0x%x\n", mr->search_item.id_lo); + dbg(lvl_warning,"street_assoc=0x%x\n", mr->search_item.id_lo); tree_search_init(mr->m->dirname, "strname.b1", &mr->ts, 0); mr->current_file=file_strname_stn; mr->search_str=g_strdup(mr->search_attr->u.str); @@ -447,12 +447,12 @@ map_search_setup(struct map_rect_priv *mr) if (!map_priv_is(mr->search_item.map, mr->m)) return 0; if (!housenumber_search_setup(mr)) { - dbg(0,"failed to search for attr_house_number\n"); + dbg(lvl_error,"failed to search for attr_house_number\n"); return 0; } break; default: - dbg(0,"unknown search %s\n",attr_to_name(mr->search_type)); + dbg(lvl_error,"unknown search %s\n",attr_to_name(mr->search_type)); return 0; } mr->file=mr->m->file[mr->current_file]; @@ -467,9 +467,9 @@ static struct map_search_priv * map_search_new_mg(struct map_priv *map, struct item *item, struct attr *search, int partial) { struct map_rect_priv *mr=g_new0(struct map_rect_priv, 1); - dbg(1,"searching for %s '%s'\n", attr_to_name(search->type), search->u.str); - dbg(1,"id_lo=0x%x\n", item->id_lo); - dbg(1,"search=%s\n", search->u.str); + dbg(lvl_warning,"searching for %s '%s'\n", attr_to_name(search->type), search->u.str); + dbg(lvl_warning,"id_lo=0x%x\n", item->id_lo); + dbg(lvl_warning,"search=%s\n", search->u.str); mr->m=map; mr->search_attr=attr_dup(search); mr->search_type=search->type; @@ -480,7 +480,7 @@ map_search_new_mg(struct map_priv *map, struct item *item, struct attr *search, mr->search_type_next=attr_district_name; } if (!map_search_setup(mr)) { - dbg(1,"map_search_new_mg failed\n"); + dbg(lvl_warning,"map_search_new_mg failed\n"); g_free(mr); return NULL; } @@ -507,7 +507,7 @@ map_search_destroy_mg(struct map_search_priv *ms) { struct map_rect_priv *mr=(struct map_rect_priv *)ms; - dbg(1,"mr=%p\n", mr); + dbg(lvl_warning,"mr=%p\n", mr); if (! mr) return; map_search_cleanup(mr); @@ -538,7 +538,7 @@ map_search_get_item_mg(struct map_search_priv *ms) ret=housenumber_search_get_item(mr); break; default: - dbg(0,"unknown search %s\n",attr_to_name(mr->search_type)); + dbg(lvl_error,"unknown search %s\n",attr_to_name(mr->search_type)); break; } if (!ret && mr->search_type_next != attr_none) { @@ -595,7 +595,7 @@ map_new_mg(struct map_methods *meth, struct attr **attrs, struct callback_list * if (! m->file[i]) { maybe_missing=(i == file_border_ply || i == file_height_ply || i == file_sea_ply); if (! maybe_missing) - dbg(0,"Failed to load %s\n", filename); + dbg(lvl_error,"Failed to load %s\n", filename); } else file_mmap(m->file[i]); g_free(filename); diff --git a/navit/map/mg/poly.c b/navit/map/mg/poly.c index 5bd08303f..43256a295 100644 --- a/navit/map/mg/poly.c +++ b/navit/map/mg/poly.c @@ -225,7 +225,7 @@ poly_get(struct map_rect_priv *mr, struct poly_priv *poly, struct item *item) item->type=type_rail; break; default: - dbg(0,"Unknown poly type 0x%x '%s' 0x%x,0x%x\n", poly->type,poly->name,r.lu.x,r.lu.y); + dbg(lvl_error,"Unknown poly type 0x%x '%s' 0x%x,0x%x\n", poly->type,poly->name,r.lu.x,r.lu.y); item->type=type_street_unkn; } if (!map_selection_contains_item(mr->cur_sel, 0, item->type)) { @@ -235,10 +235,10 @@ poly_get(struct map_rect_priv *mr, struct poly_priv *poly, struct item *item) } } else mr->b.p=poly->subpoly_next; - dbg(1,"%d %d %s\n", poly->subpoly_num_all, mr->b.block_num, poly->name); + dbg(lvl_warning,"%d %d %s\n", poly->subpoly_num_all, mr->b.block_num, poly->name); item->id_lo=poly->subpoly_num_all | (mr->b.block_num << 16); item->id_hi=(mr->current_file << 16); - dbg(1,"0x%x 0x%x\n", item->id_lo, item->id_hi); + dbg(lvl_warning,"0x%x 0x%x\n", item->id_lo, item->id_hi); poly->subpoly_next=mr->b.p+L(poly->count[poly->subpoly_num])*sizeof(struct coord); poly->subpoly_num++; poly->subpoly_num_all++; diff --git a/navit/map/mg/street.c b/navit/map/mg/street.c index 363980be4..9a43ca14a 100644 --- a/navit/map/mg/street.c +++ b/navit/map/mg/street.c @@ -208,7 +208,7 @@ static int street_get_coord(unsigned char **pos, int bytes, struct coord_rect *r if (f) { f->x=ref->lu.x+x; f->y=ref->rl.y+y; - dbg(1,"0x%x,0x%x + 0x%x,0x%x = 0x%x,0x%x\n", x, y, ref->lu.x, ref->rl.y, f->x, f->y); + dbg(lvl_warning,"0x%x,0x%x + 0x%x,0x%x = 0x%x,0x%x\n", x, y, ref->lu.x, ref->rl.y, f->x, f->y); } *pos=p; return flags; @@ -282,14 +282,14 @@ street_coord_get(void *priv_data, struct coord *c, int count) if (segid == 0x15) debug=1; if (debug) { - dbg(0,"enter 0x%x\n",segid); + dbg(lvl_error,"enter 0x%x\n",segid); } #endif while (count > 0) { if (street_coord_get_helper(street, c)) { #ifdef DEBUG_COORD_GET if (debug) { - dbg(0,"0x%x,0x%x\n", c->x, c->y); + dbg(lvl_error,"0x%x,0x%x\n", c->x, c->y); } #endif c++; @@ -316,7 +316,7 @@ street_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr) struct street_priv *street=priv_data; int nameid; - dbg(1,"segid 0x%x\n", street_str_get_segid(street->str)); + dbg(lvl_warning,"segid 0x%x\n", street_str_get_segid(street->str)); attr->type=attr_type; switch (attr_type) { case attr_any: @@ -516,7 +516,7 @@ street_get(struct map_rect_priv *mr, struct street_priv *street, struct item *it break; default: item->type=type_street_unkn; - dbg(0,"unknown type 0x%x\n",street_str_get_type(street->str)); + dbg(lvl_error,"unknown type 0x%x\n",street_str_get_type(street->str)); } flags=item_get_default_flags(item->type); if (flags) @@ -557,12 +557,12 @@ street_get_byid(struct map_rect_priv *mr, struct street_priv *street, int id_hi, int country=id_hi & 0xffff; int res; struct coord_rect r; - dbg(1,"enter(%p,%p,0x%x,0x%x,%p)\n", mr, street, id_hi, id_lo, item); + dbg(lvl_warning,"enter(%p,%p,0x%x,0x%x,%p)\n", mr, street, id_hi, id_lo, item); if (! country) return 0; if (! tree_search_hv(mr->m->dirname, "street", (id_lo >> 8) | (country << 24), id_lo & 0xff, &res)) return 0; - dbg(1,"res=0x%x (blk=0x%x)\n", res, res >> 12); + dbg(lvl_warning,"res=0x%x (blk=0x%x)\n", res, res >> 12); block_get_byindex(mr->m->file[mr->current_file], res >> 12, &mr->b); street_get_data(street, &mr->b.p); street->name_file=mr->m->file[file_strname_stn]; @@ -578,7 +578,7 @@ street_get_byid(struct map_rect_priv *mr, struct street_priv *street, int id_hi, item->meth=&street_meth; item->priv_data=street; street->str+=(res & 0xfff)-1; - dbg(1,"segid 0x%x\n", street_str_get_segid(&street->str[1])); + dbg(lvl_warning,"segid 0x%x\n", street_str_get_segid(&street->str[1])); return street_get(mr, street, item); #if 0 mr->b.p=mr->b.block_start+(res & 0xffff); @@ -620,7 +620,7 @@ latin1_tolower_ascii(unsigned char c) return 'u'; default: if (ret >= 0x80) - dbg(1,"ret=0x%x\n",c); + dbg(lvl_warning,"ret=0x%x\n",c); return ret; } } @@ -662,27 +662,27 @@ street_search_compare_do(struct map_rect_priv *mr, int country, int town_assoc, { int d,len; - dbg(1,"enter"); - dbg(1,"country 0x%x town_assoc 0x%x name '%s'\n", country, town_assoc, name); + dbg(lvl_warning,"enter"); + dbg(lvl_warning,"country 0x%x town_assoc 0x%x name '%s'\n", country, town_assoc, name); d=(mr->search_item.id_hi & 0xffff)-country; - dbg(1,"country %d (%d vs %d)\n", d, mr->search_item.id_hi & 0xffff, country); + dbg(lvl_warning,"country %d (%d vs %d)\n", d, mr->search_item.id_hi & 0xffff, country); if (!d) { if (mr->search_item.id_lo == town_assoc ) { - dbg(1,"town_assoc match (0x%x)\n", town_assoc); + dbg(lvl_warning,"town_assoc match (0x%x)\n", town_assoc); len=mr->search_partial ? strlen(mr->search_str):INT_MAX; d=strncasecmp_latin1(mr->search_str, name, len); if (!strncasecmp_latin1_ascii(mr->search_str, name, len)) d=0; - dbg(1,"string %d\n", d); + dbg(lvl_warning,"string %d\n", d); } else { if (town_assoc < mr->search_item.id_lo) d=1; else d=-1; - dbg(1,"assoc %d 0x%x-0x%x\n",d, mr->search_item.id_lo, town_assoc); + dbg(lvl_warning,"assoc %d 0x%x-0x%x\n",d, mr->search_item.id_lo, town_assoc); } } - dbg(1,"d=%d\n", d); + dbg(lvl_warning,"d=%d\n", d); return d; } @@ -692,11 +692,11 @@ street_search_compare(unsigned char **p, struct map_rect_priv *mr) struct street_name_index *i; int ret; - dbg(1,"enter\n"); + dbg(lvl_warning,"enter\n"); i=(struct street_name_index *)(*p); *p+=sizeof(*i)+strlen(i->name)+1; - dbg(1,"block 0x%x\n", i->block); + dbg(lvl_warning,"block 0x%x\n", i->block); ret=street_search_compare_do(mr, i->country, i->town_assoc, i->name); if (ret <= 0) @@ -725,7 +725,7 @@ street_name_coord_get(void *priv_data, struct coord *c, int count) struct street_name_numbers snns; unsigned char *p=mr->street.name.aux_data; - dbg(1,"aux_data=%p\n", p); + dbg(lvl_warning,"aux_data=%p\n", p); if (count) { street_name_numbers_get(&snns, &p); street_name_numbers_get_coord(&snns, c); @@ -801,7 +801,7 @@ street_name_attr_get(void *priv_data, enum attr_type attr_type, struct attr *att return 0; return item_attr_get(mr->search_item_tmp, attr_type, attr); default: - dbg(0,"unknown attr %s\n",attr_to_name(attr_type)); + dbg(lvl_error,"unknown attr %s\n",attr_to_name(attr_type)); return 0; } } @@ -830,7 +830,7 @@ street_name_get_byid(struct map_rect_priv *mr, struct street_priv *street, int i item->map=NULL; item->priv_data=mr; mr->b.p=street->name_file->begin+item->id_lo; - dbg(1,"last %p map %p file %d begin %p\n", mr->b.p, mr->m, mr->current_file, mr->m->file[mr->current_file]->begin); + dbg(lvl_warning,"last %p map %p file %d begin %p\n", mr->b.p, mr->m, mr->current_file, mr->m->file[mr->current_file]->begin); street_name_get(&street->name, &mr->b.p); return 1; } @@ -841,30 +841,30 @@ street_search_get_item_street_name(struct map_rect_priv *mr) int dir=1,leaf; unsigned char *last; - dbg(1,"enter\n"); + dbg(lvl_warning,"enter\n"); if (! mr->search_blk_count) { - dbg(1,"partial 0x%x '%s' ***\n", mr->town.street_assoc, mr->search_str); + dbg(lvl_warning,"partial 0x%x '%s' ***\n", mr->town.street_assoc, mr->search_str); if (mr->search_linear) return NULL; - dbg(1,"tree_search_next\n"); + dbg(lvl_warning,"tree_search_next\n"); mr->search_block=-1; while ((leaf=tree_search_next(&mr->ts, &mr->search_p, dir)) != -1) { dir=street_search_compare(&mr->search_p, mr); } - dbg(1,"dir=%d mr->search_block=0x%x\n", dir, mr->search_block); + dbg(lvl_warning,"dir=%d mr->search_block=0x%x\n", dir, mr->search_block); if (mr->search_block == -1) return NULL; mr->search_blk_count=1; block_get_byindex(mr->m->file[file_strname_stn], mr->search_block, &mr->b); mr->b.p=mr->b.block_start+12; } - dbg(1,"name id %td\n", mr->b.p-mr->m->file[file_strname_stn]->begin); + dbg(lvl_warning,"name id %td\n", mr->b.p-mr->m->file[file_strname_stn]->begin); if (! mr->search_blk_count) return NULL; for (;;) { if (mr->b.p >= mr->b.end) { if (!block_next_lin(mr)) { - dbg(1,"end of blocks in %p, %p\n", mr->m->file[file_strname_stn]->begin, mr->m->file[file_strname_stn]->end); + dbg(lvl_warning,"end of blocks in %p, %p\n", mr->m->file[file_strname_stn]->begin, mr->m->file[file_strname_stn]->end); return NULL; } mr->b.p=mr->b.block_start+12; @@ -873,23 +873,23 @@ street_search_get_item_street_name(struct map_rect_priv *mr) last=mr->b.p; street_name_get(&mr->street.name, &mr->b.p); dir=street_search_compare_do(mr, mr->street.name.country, mr->street.name.townassoc, mr->street.name.name2); - dbg(1,"country 0x%x assoc 0x%x name1 '%s' name2 '%s' dir=%d\n", mr->street.name.country, mr->street.name.townassoc, mr->street.name.name1, mr->street.name.name2, dir); + dbg(lvl_warning,"country 0x%x assoc 0x%x name1 '%s' name2 '%s' dir=%d\n", mr->street.name.country, mr->street.name.townassoc, mr->street.name.name1, mr->street.name.name2, dir); if (dir < 0) { - dbg(1,"end of data\n"); + dbg(lvl_warning,"end of data\n"); mr->search_blk_count=0; return NULL; } if (!dir) { - dbg(1,"result country 0x%x assoc 0x%x name1 '%s' name2 '%s' dir=%d aux_data=%p len=0x%x\n", mr->street.name.country, mr->street.name.townassoc, mr->street.name.name1, mr->street.name.name2, dir, mr->street.name.aux_data, mr->street.name.aux_len); + dbg(lvl_warning,"result country 0x%x assoc 0x%x name1 '%s' name2 '%s' dir=%d aux_data=%p len=0x%x\n", mr->street.name.country, mr->street.name.townassoc, mr->street.name.name1, mr->street.name.name2, dir, mr->street.name.aux_data, mr->street.name.aux_len); mr->item.type = type_street_name; mr->item.id_hi=(file_strname_stn << 16); mr->item.id_lo=last-mr->m->file[file_strname_stn]->begin; - dbg(1,"id 0x%x 0x%x last %p map %p file %d begin %p\n", mr->item.id_hi, mr->item.id_lo, last, mr->m, mr->current_file, mr->m->file[mr->current_file]->begin); + dbg(lvl_warning,"id 0x%x 0x%x last %p map %p file %d begin %p\n", mr->item.id_hi, mr->item.id_lo, last, mr->m, mr->current_file, mr->m->file[mr->current_file]->begin); mr->item.meth=&street_name_meth; mr->item.map=NULL; mr->item.priv_data=mr; /* debug(mr); */ - dbg(1,"last %p\n",last); + dbg(lvl_warning,"last %p\n",last); return &mr->item; } } @@ -920,7 +920,7 @@ street_name_numbers_next(struct map_rect_priv *mr) { if (street_name_eod(&mr->street.name)) return 0; - dbg(1,"%p vs %p\n",mr->street.name.tmp_data, mr->street.name.aux_data); + dbg(lvl_warning,"%p vs %p\n",mr->street.name.tmp_data, mr->street.name.aux_data); street_name_numbers_get(&mr->street.name_numbers, &mr->street.name.tmp_data); return 1; } @@ -975,7 +975,7 @@ housenumber_attr_get(void *priv_data, enum attr_type attr_type, struct attr *att return 0; return item_attr_get(mr->search_item_tmp, attr_type, attr); default: - dbg(0,"unknown attr %s\n",attr_to_name(attr_type)); + dbg(lvl_error,"unknown attr %s\n",attr_to_name(attr_type)); return 0; } } @@ -991,20 +991,20 @@ static struct item_methods housenumber_meth = { int housenumber_search_setup(struct map_rect_priv *mr) { - dbg(1,"enter (0x%x,0x%x)\n",mr->search_item.id_hi,mr->search_item.id_lo); + dbg(lvl_warning,"enter (0x%x,0x%x)\n",mr->search_item.id_hi,mr->search_item.id_lo); int id=mr->search_item.id_hi & 0xff; mr->current_file=file_strname_stn; mr->street.name_file=mr->m->file[mr->current_file]; mr->b.p=mr->street.name_file->begin+mr->search_item.id_lo; mr->search_str=g_strdup(mr->search_attr->u.str); - dbg(1,"last %p\n",mr->b.p); + dbg(lvl_warning,"last %p\n",mr->b.p); street_name_get(&mr->street.name, &mr->b.p); #if 0 debug(mr); #endif while (id > 0) { id--; - dbg(1,"loop\n"); + dbg(lvl_warning,"loop\n"); if (!street_name_numbers_next(mr)) return 0; } @@ -1015,10 +1015,10 @@ housenumber_search_setup(struct map_rect_priv *mr) if (!id) mr->item.id_hi+=1; mr->item.id_lo=mr->search_item.id_lo; - dbg(1,"getting name_number %p vs %p + %d\n",mr->street.name_numbers.tmp_data,mr->street.name_numbers.aux_data, mr->street.name_numbers.aux_len); + dbg(lvl_warning,"getting name_number %p vs %p + %d\n",mr->street.name_numbers.tmp_data,mr->street.name_numbers.aux_data, mr->street.name_numbers.aux_len); if (!street_name_number_next(mr)) return 0; - dbg(1,"enter\n"); + dbg(lvl_warning,"enter\n"); // debug(mr); return 1; } @@ -1055,7 +1055,7 @@ struct item * housenumber_search_get_item(struct map_rect_priv *mr) { int d; - dbg(1,"enter %s %s\n",mr->street.first_number,mr->street.last_number); + dbg(lvl_warning,"enter %s %s\n",mr->street.first_number,mr->street.last_number); for (;;) { if (!house_number_next(mr->street.current_number, mr->street.first_number, mr->street.last_number, 0, NULL)) { if (!street_name_number_next(mr)) diff --git a/navit/map/mg/town.c b/navit/map/mg/town.c index 8ef5e808e..ab7a19786 100644 --- a/navit/map/mg/town.c +++ b/navit/map/mg/town.c @@ -105,7 +105,7 @@ town_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr) twn->attr_next=attr_none; return 1; default: - dbg(1, "Don't know about attribute %d[%04X]=%s yet\n", + dbg(lvl_warning, "Don't know about attribute %d[%04X]=%s yet\n", attr_type, attr_type, attr_to_name(attr_type)); return 0; } @@ -222,12 +222,12 @@ town_search_compare(unsigned char **p, struct map_rect_priv *mr) d=0; } else { country=get_u16_unal(p); - dbg(1,"country 0x%x ", country); + dbg(lvl_warning,"country 0x%x ", country); name=get_string(p); - dbg(1,"name '%s' ",name); + dbg(lvl_warning,"name '%s' ",name); mr->search_blk_count=get_u32_unal(p); mr->search_blk_off=(struct block_offset *)(*p); - dbg(1,"len %d ", mr->search_blk_count); + dbg(lvl_warning,"len %d ", mr->search_blk_count); (*p)+=mr->search_blk_count*4; d=mr->search_country-country; } @@ -237,7 +237,7 @@ town_search_compare(unsigned char **p, struct map_rect_priv *mr) else d=strcasecmp(mr->search_str, name); } - dbg(1,"%d \n",d); + dbg(lvl_warning,"%d \n",d); return d; } @@ -250,7 +250,7 @@ town_search_get_item(struct map_rect_priv *mr) int dir=1,leaf; if (! mr->search_blk_count) { - dbg(1,"partial %d 0x%x '%s' ***\n", mr->search_partial, mr->search_country, mr->search_str); + dbg(lvl_warning,"partial %d 0x%x '%s' ***\n", mr->search_partial, mr->search_country, mr->search_str); if (! mr->search_linear) { while ((leaf=tree_search_next(&mr->ts, &mr->search_p, dir)) != -1) { dir=town_search_compare(&mr->search_p, mr); @@ -261,23 +261,23 @@ town_search_get_item(struct map_rect_priv *mr) } } if (! mr->search_linear) { - dbg(1,"not found\n"); + dbg(lvl_warning,"not found\n"); return NULL; } } if (! tree_search_next_lin(&mr->ts, &mr->search_p)) { - dbg(1,"linear not found\n"); + dbg(lvl_warning,"linear not found\n"); return NULL; } if (town_search_compare(&mr->search_p, mr)) { - dbg(1,"no match\n"); + dbg(lvl_warning,"no match\n"); return NULL; } - dbg(1,"found %d blocks\n",mr->search_blk_count); + dbg(lvl_warning,"found %d blocks\n",mr->search_blk_count); } if (! mr->search_blk_count) return NULL; - dbg(1,"block 0x%x offset 0x%x\n", block_offset_get_block(mr->search_blk_off), block_offset_get_offset(mr->search_blk_off)); + dbg(lvl_warning,"block 0x%x offset 0x%x\n", block_offset_get_block(mr->search_blk_off), block_offset_get_offset(mr->search_blk_off)); block_get_byindex(mr->m->file[mr->current_file], block_offset_get_block(mr->search_blk_off), &mr->b); mr->b.p=mr->b.block_start+block_offset_get_offset(mr->search_blk_off); town_get(mr, &mr->town, &mr->item); diff --git a/navit/map/mg/tree.c b/navit/map/mg/tree.c index 3b6a2c2d0..27100007c 100644 --- a/navit/map/mg/tree.c +++ b/navit/map/mg/tree.c @@ -78,22 +78,22 @@ tree_search_h(struct file *file, unsigned int search) struct tree_hdr_h *thdr; struct tree_leaf_h *tleaf; - dbg(1,"enter\n"); + dbg(lvl_warning,"enter\n"); while (i++ < 1000) { thdr=(struct tree_hdr_h *)p; p+=sizeof(*thdr); end=p+tree_hdr_h_get_size(thdr); - dbg(1,"@%td\n", p-file->begin); + dbg(lvl_warning,"@%td\n", p-file->begin); last=0; while (p < end) { tleaf=(struct tree_leaf_h *)p; p+=sizeof(*tleaf); - dbg(1,"low:0x%x high:0x%x match:0x%x val:0x%x search:0x%x\n", tree_leaf_h_get_lower(tleaf), tree_leaf_h_get_higher(tleaf), tree_leaf_h_get_match(tleaf), tree_leaf_h_get_value(tleaf), search); + dbg(lvl_warning,"low:0x%x high:0x%x match:0x%x val:0x%x search:0x%x\n", tree_leaf_h_get_lower(tleaf), tree_leaf_h_get_higher(tleaf), tree_leaf_h_get_match(tleaf), tree_leaf_h_get_value(tleaf), search); value=tree_leaf_h_get_value(tleaf); if (value == search) return tree_leaf_h_get_match(tleaf); if (value > search) { - dbg(1,"lower\n"); + dbg(lvl_warning,"lower\n"); lower=tree_leaf_h_get_lower(tleaf); if (lower) last=lower; @@ -119,11 +119,11 @@ tree_search_v(struct file *file, int offset, int search) thdr=(struct tree_hdr_v *)p; p+=sizeof(*thdr); count=tree_hdr_v_get_count(thdr); - dbg(1,"offset=%td count=0x%x\n", p-file->begin, count); + dbg(lvl_warning,"offset=%td count=0x%x\n", p-file->begin, count); while (count--) { tleaf=(struct tree_leaf_v *)p; p+=sizeof(*tleaf); - dbg(1,"0x%x 0x%x\n", tleaf->key, search); + dbg(lvl_warning,"0x%x 0x%x\n", tleaf->key, search); if (tleaf->key == search) return tree_leaf_v_get_value(tleaf); } @@ -142,32 +142,32 @@ tree_search_hv(char *dirname, char *filename, unsigned int search_h, unsigned in char buffer[4096]; int h,v; - dbg(1,"enter(%s, %s, 0x%x, 0x%x, %p)\n",dirname, filename, search_h, search_v, result); + dbg(lvl_warning,"enter(%s, %s, 0x%x, 0x%x, %p)\n",dirname, filename, search_h, search_v, result); sprintf(buffer, "%s/%s.h1", dirname, filename); f_idx_h=file_create_caseinsensitive(buffer, 0); if ((!f_idx_h) || (!file_mmap(f_idx_h))) return 0; sprintf(buffer, "%s/%s.v1", dirname, filename); f_idx_v=file_create_caseinsensitive(buffer, 0); - dbg(1,"%p %p\n", f_idx_h, f_idx_v); + dbg(lvl_warning,"%p %p\n", f_idx_h, f_idx_v); if ((!f_idx_v) || (!file_mmap(f_idx_v))) { file_destroy(f_idx_h); return 0; } if ((h=tree_search_h(f_idx_h, search_h))) { - dbg(1,"h=0x%x\n", h); + dbg(lvl_warning,"h=0x%x\n", h); if ((v=tree_search_v(f_idx_v, h, search_v))) { - dbg(1,"v=0x%x\n", v); + dbg(lvl_warning,"v=0x%x\n", v); *result=v; file_destroy(f_idx_v); file_destroy(f_idx_h); - dbg(1,"return 1\n"); + dbg(lvl_warning,"return 1\n"); return 1; } } file_destroy(f_idx_v); file_destroy(f_idx_h); - dbg(1,"return 0\n"); + dbg(lvl_warning,"return 0\n"); return 0; } @@ -183,7 +183,7 @@ tree_search_enter(struct tree_search *ts, int offset) tsn->end=p+tree_hdr_get_size(tsn->hdr); tsn->low=tree_hdr_get_low(tsn->hdr); tsn->high=tree_hdr_get_low(tsn->hdr); - dbg(1,"pos %td addr 0x%ux size 0x%ux low 0x%ux end %tu\n", p-ts->f->begin, tree_hdr_get_addr(tsn->hdr), tree_hdr_get_size(tsn->hdr), tree_hdr_get_low(tsn->hdr), tsn->end-ts->f->begin); + dbg(lvl_warning,"pos %td addr 0x%ux size 0x%ux low 0x%ux end %tu\n", p-ts->f->begin, tree_hdr_get_addr(tsn->hdr), tree_hdr_get_size(tsn->hdr), tree_hdr_get_low(tsn->hdr), tsn->end-ts->f->begin); return tsn; } @@ -193,17 +193,17 @@ int tree_search_next(struct tree_search *ts, unsigned char **p, int dir) if (! *p) *p=tsn->p; - dbg(1,"next *p=%p dir=%d\n", *p, dir); - dbg(1,"low1=0x%x high1=0x%x\n", tsn->low, tsn->high); + dbg(lvl_warning,"next *p=%p dir=%d\n", *p, dir); + dbg(lvl_warning,"low1=0x%x high1=0x%x\n", tsn->low, tsn->high); if (dir <= 0) { - dbg(1,"down 0x%x\n", tsn->low); + dbg(lvl_warning,"down 0x%x\n", tsn->low); if (tsn->low != 0xffffffff) { tsn=tree_search_enter(ts, tsn->low); *p=tsn->p; tsn->high=get_u32(p); ts->last_node=ts->curr_node; - dbg(1,"saving last2 %d %td\n", ts->curr_node, tsn->last-ts->f->begin); - dbg(1,"high2=0x%x\n", tsn->high); + dbg(lvl_warning,"saving last2 %d %td\n", ts->curr_node, tsn->last-ts->f->begin); + dbg(lvl_warning,"high2=0x%x\n", tsn->high); return 0; } return -1; @@ -211,18 +211,18 @@ int tree_search_next(struct tree_search *ts, unsigned char **p, int dir) tsn->low=tsn->high; tsn->last=*p; tsn->high=get_u32_unal(p); - dbg(1,"saving last3 %d %p\n", ts->curr_node, tsn->last); + dbg(lvl_warning,"saving last3 %d %p\n", ts->curr_node, tsn->last); if (*p < tsn->end) return (tsn->low == 0xffffffff ? 1 : 0); - dbg(1,"end reached high=0x%x\n",tsn->high); + dbg(lvl_warning,"end reached high=0x%x\n",tsn->high); if (tsn->low != 0xffffffff) { - dbg(1,"low 0x%x\n", tsn->low); + dbg(lvl_warning,"low 0x%x\n", tsn->low); tsn=tree_search_enter(ts, tsn->low); *p=tsn->p; tsn->high=get_u32_unal(p); ts->last_node=ts->curr_node; - dbg(1,"saving last4 %d %td\n", ts->curr_node, tsn->last-ts->f->begin); - dbg(1,"high4=0x%x\n", tsn->high); + dbg(lvl_warning,"saving last4 %d %td\n", ts->curr_node, tsn->last-ts->f->begin); + dbg(lvl_warning,"high4=0x%x\n", tsn->high); return 0; } return -1; @@ -233,7 +233,7 @@ int tree_search_next_lin(struct tree_search *ts, unsigned char **p) struct tree_search_node *tsn=&ts->nodes[ts->curr_node]; int high; - dbg(1,"pos=%d %td\n", ts->curr_node, *p-ts->f->begin); + dbg(lvl_warning,"pos=%d %td\n", ts->curr_node, *p-ts->f->begin); if (*p) ts->nodes[ts->last_node].last=*p; *p=tsn->last; @@ -243,12 +243,12 @@ int tree_search_next_lin(struct tree_search *ts, unsigned char **p) ts->last_node=ts->curr_node; while (high != 0xffffffff) { tsn=tree_search_enter(ts, high); - dbg(1,"reload %d\n",ts->curr_node); + dbg(lvl_warning,"reload %d\n",ts->curr_node); high=tsn->low; } return 1; } - dbg(1,"eon %d %td %td\n", ts->curr_node, *p-ts->f->begin, tsn->end-ts->f->begin); + dbg(lvl_warning,"eon %d %td %td\n", ts->curr_node, *p-ts->f->begin, tsn->end-ts->f->begin); if (! ts->curr_node) break; ts->curr_node--; diff --git a/navit/map/shapefile/shapefile.c b/navit/map/shapefile/shapefile.c index 7f4872d62..f311d514e 100644 --- a/navit/map/shapefile/shapefile.c +++ b/navit/map/shapefile/shapefile.c @@ -76,7 +76,7 @@ struct map_rect_priv { static void map_destroy_shapefile(struct map_priv *m) { - dbg(1,"map_destroy_shapefile\n"); + dbg(lvl_warning,"map_destroy_shapefile\n"); g_free(m); } @@ -328,7 +328,7 @@ build_match(struct longest_match *lm, struct longest_match_list *lml, char *line { struct longest_match_list_item *lmli; char *kvl=NULL,*i=NULL,*p,*kv; - dbg(1,"line=%s\n",line); + dbg(lvl_warning,"line=%s\n",line); kvl=line; p=strchr(line,'\t'); if (p) { @@ -424,7 +424,7 @@ attr_resolve(struct map_rect_priv *mr, enum attr_type attr_type, struct attr *at } if (!value[0]) return -1; - dbg(1,"name=%s value=%s\n",name,value); + dbg(lvl_warning,"name=%s value=%s\n",name,value); attr_free(mr->attr); mr->attr=attr_new_from_text(name,value); if (mr->attr) { @@ -524,14 +524,14 @@ map_rect_new_shapefile(struct map_priv *map, struct map_selection *sel) } file_destroy(file); } else { - dbg(0,"Failed to open %s\n",dbfmapfile); + dbg(lvl_error,"Failed to open %s\n",dbfmapfile); if (map->dbfmap_data) { changed=1; g_free(map->dbfmap_data); map->dbfmap_data=NULL; } } - dbg(1,"%s changed %d old %p\n",dbfmapfile,changed,map->dbfmap_data); + dbg(lvl_warning,"%s changed %d old %p\n",dbfmapfile,changed,map->dbfmap_data); if (changed) { longest_match_destroy(map->lm,1); map->lm=NULL; @@ -539,7 +539,7 @@ map_rect_new_shapefile(struct map_priv *map, struct map_selection *sel) build_matches(map,map->dbfmap_data); } } - dbg(1,"map_rect_new_shapefile\n"); + dbg(lvl_warning,"map_rect_new_shapefile\n"); mr=g_new0(struct map_rect_priv, 1); mr->m=map; mr->idx=0; @@ -595,12 +595,12 @@ map_rect_get_item_shapefile(struct map_rect_priv *mr) if (count) { mr->line=lines[0]; if (attr_from_line(mr->line,"type",NULL,type,NULL)) { - dbg(1,"type='%s'\n", type); + dbg(lvl_warning,"type='%s'\n", type); mr->item.type=item_from_name(type); if (mr->item.type == type_none && strcmp(type,"none")) - dbg(0,"Warning: type '%s' unknown\n", type); + dbg(lvl_error,"Warning: type '%s' unknown\n", type); } else { - dbg(0,"failed to get attribute type\n"); + dbg(lvl_error,"failed to get attribute type\n"); } } else mr->line=NULL; @@ -649,7 +649,7 @@ map_new_shapefile(struct map_methods *meth, struct attr **attrs, struct callback char *shapefile,*dbffile; if (! data) return NULL; - dbg(1,"map_new_shapefile %s\n", data->u.str); + dbg(lvl_warning,"map_new_shapefile %s\n", data->u.str); wdata=g_strdup(data->u.str); wexp=file_wordexp_new(wdata); wexp_data=file_wordexp_get_array(wexp); @@ -665,7 +665,7 @@ map_new_shapefile(struct map_methods *meth, struct attr **attrs, struct callback m->hDBF=DBFOpen(dbffile, "rb"); m->nFields=DBFGetFieldCount(m->hDBF); g_free(dbffile); - dbg(1,"map_new_shapefile %s %s\n", m->filename, wdata); + dbg(lvl_warning,"map_new_shapefile %s %s\n", m->filename, wdata); if (charset) { m->charset=g_strdup(charset->u.str); meth->charset=m->charset; @@ -681,7 +681,7 @@ map_new_shapefile(struct map_methods *meth, struct attr **attrs, struct callback void plugin_init(void) { - dbg(1,"shapefile: plugin_init\n"); + dbg(lvl_warning,"shapefile: plugin_init\n"); plugin_register_map_type("shapefile", map_new_shapefile); } @@ -759,7 +759,7 @@ static int VSI_SHP_Close( SAFile file ) static void VSI_SHP_Error( const char *message ) { - dbg(0,"error:%s\n", message); + dbg(lvl_error,"error:%s\n", message); } /************************************************************************/ diff --git a/navit/map/textfile/textfile.c b/navit/map/textfile/textfile.c index b019aaab2..558c86219 100644 --- a/navit/map/textfile/textfile.c +++ b/navit/map/textfile/textfile.c @@ -54,11 +54,11 @@ get_line(struct map_rect_priv *mr) else mr->pos+=mr->lastlen; fgets(mr->line, TEXTFILE_LINE_SIZE, mr->f); - dbg(1,"read textfile line: %s\n", mr->line); + dbg(lvl_warning,"read textfile line: %s\n", mr->line); remove_comment_line(mr->line); mr->lastlen=strlen(mr->line)+1; if (strlen(mr->line) >= TEXTFILE_LINE_SIZE-1) - dbg(0, "line too long: %s\n", mr->line); + dbg(lvl_error, "line too long: %s\n", mr->line); } } @@ -94,12 +94,12 @@ textfile_coord_get(void *priv_data, struct coord *c, int count) { struct map_rect_priv *mr=priv_data; int ret=0; - dbg(1,"enter, count: %d\n",count); + dbg(lvl_warning,"enter, count: %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 (c){ *c=mr->c; - dbg(1,"c=0x%x,0x%x\n", c->x, c->y); + dbg(lvl_warning,"c=0x%x,0x%x\n", c->x, c->y); c++; } ret++; @@ -136,31 +136,31 @@ textfile_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr) { struct map_rect_priv *mr=priv_data; char *str=NULL; - dbg(1,"mr=%p attrs='%s' ", mr, mr->attrs); + dbg(lvl_warning,"mr=%p attrs='%s' ", mr, mr->attrs); if (attr_type != mr->attr_last) { - dbg(1,"reset attr_pos\n"); + dbg(lvl_warning,"reset attr_pos\n"); mr->attr_pos=0; mr->attr_last=attr_type; } if (attr_type == attr_any) { - dbg(1,"attr_any"); + dbg(lvl_warning,"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(lvl_warning,"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(lvl_warning,"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(lvl_warning,"found\n"); return 1; } } - dbg(1,"not found\n"); + dbg(lvl_warning,"not found\n"); return 0; } @@ -176,7 +176,7 @@ map_rect_new_textfile(struct map_priv *map, struct map_selection *sel) { struct map_rect_priv *mr; - dbg(1,"enter\n"); + dbg(lvl_warning,"enter\n"); mr=g_new0(struct map_rect_priv, 1); mr->m=map; mr->sel=sel; @@ -204,20 +204,20 @@ map_rect_new_textfile(struct map_priv *map, struct map_selection *sel) } sel=sel->next; } - dbg(1,"popen args %s\n", args); + dbg(lvl_warning,"popen args %s\n", args); mr->args=args; mr->f=popen(mr->args, "r"); mr->pos=0; mr->lastlen=0; #else - dbg(0,"unable to work with pipes %s\n",map->filename); + dbg(lvl_error,"unable to work with pipes %s\n",map->filename); #endif } else { mr->f=fopen(map->filename, "r"); } if(!mr->f) { if (!(errno == ENOENT && map->no_warning_if_map_file_missing)) { - dbg(0, "error opening textfile %s: %s\n", map->filename, strerror(errno)); + dbg(lvl_error, "error opening textfile %s: %s\n", map->filename, strerror(errno)); } } get_line(mr); @@ -245,7 +245,7 @@ static struct item * map_rect_get_item_textfile(struct map_rect_priv *mr) { char *p,type[TEXTFILE_LINE_SIZE]; - dbg(1,"map_rect_get_item_textfile id_hi=%d line=%s", mr->item.id_hi, mr->line); + dbg(lvl_warning,"map_rect_get_item_textfile id_hi=%d line=%s", mr->item.id_hi, mr->line); if (!mr->f) { return NULL; } @@ -255,7 +255,7 @@ map_rect_get_item_textfile(struct map_rect_priv *mr) } for(;;) { if (feof(mr->f)) { - dbg(1,"map_rect_get_item_textfile: eof %d\n",mr->item.id_hi); + dbg(lvl_warning,"map_rect_get_item_textfile: eof %d\n",mr->item.id_hi); if (mr->m->flags & 1) { if (!mr->item.id_hi) return NULL; @@ -286,7 +286,7 @@ map_rect_get_item_textfile(struct map_rect_priv *mr) get_line(mr); continue; } - dbg(1,"map_rect_get_item_textfile: point found\n"); + dbg(lvl_warning,"map_rect_get_item_textfile: point found\n"); mr->eoc=0; mr->item.id_lo=mr->pos; } else { @@ -294,7 +294,7 @@ map_rect_get_item_textfile(struct map_rect_priv *mr) get_line(mr); continue; } - dbg(1,"map_rect_get_item_textfile: line found\n"); + dbg(lvl_warning,"map_rect_get_item_textfile: line found\n"); if (! mr->line[0]) { get_line(mr); continue; @@ -302,21 +302,21 @@ map_rect_get_item_textfile(struct map_rect_priv *mr) 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(lvl_warning,"mr=%p attrs=%s\n", mr, mr->attrs); } - dbg(1,"get_attrs %s\n", mr->attrs); + dbg(lvl_warning,"get_attrs %s\n", mr->attrs); if (attr_from_line(mr->attrs,"type",NULL,type,NULL)) { - dbg(1,"type='%s'\n", type); + dbg(lvl_warning,"type='%s'\n", type); mr->item.type=item_from_name(type); if (mr->item.type == type_none) - dbg(0, "Warning: type '%s' unknown\n", type); + dbg(lvl_error, "Warning: type '%s' unknown\n", type); } else { get_line(mr); continue; } mr->attr_last=attr_none; mr->more=1; - dbg(1,"return attr='%s'\n", mr->attrs); + dbg(lvl_warning,"return attr='%s'\n", mr->attrs); return &mr->item; } } @@ -362,7 +362,7 @@ map_new_textfile(struct map_methods *meth, struct attr **attrs, struct callback_ char **wexp_data; if (! data) return NULL; - dbg(1,"map_new_textfile %s\n", data->u.str); + dbg(lvl_warning,"map_new_textfile %s\n", data->u.str); wdata=g_strdup(data->u.str); len=strlen(wdata); if (len && wdata[len-1] == '|') { @@ -380,7 +380,7 @@ map_new_textfile(struct map_methods *meth, struct attr **attrs, struct callback_ m->no_warning_if_map_file_missing=(no_warn!=NULL) && (no_warn->u.num); if (flags) m->flags=flags->u.num; - dbg(1,"map_new_textfile %s %s\n", m->filename, wdata); + dbg(lvl_warning,"map_new_textfile %s %s\n", m->filename, wdata); if (charset) { m->charset=g_strdup(charset->u.str); meth->charset=m->charset; @@ -393,7 +393,7 @@ map_new_textfile(struct map_methods *meth, struct attr **attrs, struct callback_ void plugin_init(void) { - dbg(1,"textfile: plugin_init\n"); + dbg(lvl_warning,"textfile: plugin_init\n"); plugin_register_map_type("textfile", map_new_textfile); } |