dbg(1,"enter");
dbg(1,"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\n", d);
+ dbg(1,"country %d (%d vs %d)\n", d, mr->search_item.id_hi & 0xffff, country);
if (!d) {
- d=mr->search_item.id_lo-town_assoc;
- dbg(1,"assoc %d 0x%x-0x%x\n",d, mr->search_item.id_lo, town_assoc);
- if (! d) {
+ if (mr->search_item.id_lo == town_assoc ) {
+ dbg(1,"town_assoc match (0x%x)\n", town_assoc);
if (mr->search_partial)
d=strncasecmp(mr->search_str, name, strlen(mr->search_str));
else
d=strcasecmp(mr->search_str, name);
dbg(1,"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(1,"d=%d\n", d);
{
struct coord *c=NULL;
GtkTreeIter iter;
- gtk_tree_model_get_iter_first (GTK_TREE_MODEL (search->liststore2), &iter);
+ if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (search->liststore2), &iter))
+ return;
gtk_tree_model_get (GTK_TREE_MODEL (search->liststore2), &iter, COL_COUNT, &c, -1);
if (c)
navit_set_center(search->nav, c);
GtkTreeIter iter;
char *desc;
- gtk_tree_model_get_iter_first (GTK_TREE_MODEL (search->liststore2), &iter);
+ if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (search->liststore2), &iter))
+ return;
gtk_tree_model_get (GTK_TREE_MODEL (search->liststore2), &iter, COL_COUNT, &c, -1);
if (c) {
desc=description(search, &iter);
GtkTreeIter iter;
char *desc;
- gtk_tree_model_get_iter_first (GTK_TREE_MODEL (search->liststore2), &iter);
+ if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (search->liststore2), &iter))
+ return;
gtk_tree_model_get (GTK_TREE_MODEL (search->liststore2), &iter, COL_COUNT, &c, -1);
if (c) {
desc=description(search, &iter);
navit_debug(struct navit *this_)
{
#if 0
-#include "attr.h"
-#include "item.h"
-#include "search.h"
struct attr attr;
+#include "search.h"
struct search_list *sl;
struct search_list_result *res;
- debug_level_set("data_mg:town_search_get_item",1);
- debug_level_set("data_mg:town_search_compare",1);
- debug_level_set("data_mg:tree_search_next",1);
+ debug_level_set("data_mg:town_search_get_item",9);
+ debug_level_set("data_mg:town_search_compare",9);
+ debug_level_set("data_mg:tree_search_next",9);
+ debug_level_set("data_mg:map_search_new_mg",9);
sl=search_list_new(this_->mapsets->data);
attr.type=attr_country_all;
- attr.u.str="Deu";
+ attr.u.str="Fra";
search_list_search(sl, &attr, 1);
- while (res=search_list_get_result(sl)) {
+ while ((res=search_list_get_result(sl))) {
printf("country result\n");
}
attr.type=attr_town_name;
- attr.u.str="U";
+ attr.u.str="seclin";
search_list_search(sl, &attr, 1);
- while (res=search_list_get_result(sl)) {
+ while ((res=search_list_get_result(sl))) {
printf("town result\n");
}
+ attr.type=attr_street_name;
+ attr.u.str="rue";
+ search_list_search(sl, &attr, 1);
+ while ((res=search_list_get_result(sl))) {
+ printf("street result\n");
+ }
search_list_destroy(sl);
+ exit(0);
#endif
}