way_names++;
-
sqlite3_bind_int(sql.insert_way_name, 1, w->id);
sqlite3_bind_text(sql.insert_way_name, 2, w->data->name, -1, SQLITE_TRANSIENT);
static void
osm_new_node_data(node *n)
{
-if (n==NULL) return;
-if (n->data!=NULL) return;
+if (n==NULL)
+ return;
+if (n->data!=NULL)
+ return;
n->data=g_slice_new(node_data);
n->data->name=NULL;
n->data->url=NULL;
static void
osm_new_way_data(way *w)
{
-if (w==NULL) return;
-if (w->data!=NULL) return;
+if (w==NULL)
+ return;
+if (w->data!=NULL)
+ return;
w->data=g_slice_new(way_data);
w->data->name=NULL;
void
osm_free_way_data(way *w)
{
+g_assert(w);
if (!w->data)
return;
if (w->data->name)
way *w;
w=g_slice_new(way);
+g_assert(w);
w->id=id;
w->nodes=NULL;
w->type=WAY_UNWAYED;
static void
osm_way_add_to_list(way *w)
{
+g_assert(w);
osm_ways=g_slist_prepend(osm_ways, w);
}
{
node *n;
+g_assert(w);
n=osm_find_node(nid);
w->nodes=g_slist_prepend(w->nodes, n);
w->ncnt++;
dbnode_cnt++;
db_insert_node(n);
if (dbnode_cnt % 26214==0)
- g_printf("Nodes: %f%%\n",((float)dbnode_cnt/(float)node_cnt)*100);
+ g_printf("\rNodes: %f%%\n",((float)dbnode_cnt/(float)node_cnt)*100);
}
/**
{
dbway_cnt++;
db_insert_way(value);
-if (dbway_cnt % 8192==0 && dbway_cnt>0) {
- g_printf("Ways: %f%%\n",(((float)dbway_cnt/(float)way_cnt)*100));
+if (dbway_cnt % 16384==0 && dbway_cnt>0) {
+ g_printf("\rWays: %f%%\n",(((float)dbway_cnt/(float)way_cnt)*100));
print_way(value);
}
}
if (cnode->data->name) {
switch (cnode->type) {
case NODE_PLACE_COUNTRY:
- g_printf("Country: [%s] (%d)\n", cnode->data->name, cnode->id);
g_hash_table_insert(osm_place_country, cnode->data->name, cnode);
break;
case NODE_PLACE_CITY:
case NODE_PLACE_TOWN:
- g_printf("City: [%s] (%d)\n", cnode->data->name, cnode->id);
g_hash_table_insert(osm_place_city, cnode->data->name, cnode);
break;
case NODE_PLACE_SUBURB:
break;
case IN_WAY_TAG:
if (way_cnt % 1024==0) {
- g_printf("Ways: %d\n", way_cnt);
+ g_printf("\rWays: %d\n", way_cnt);
}
cway->nodes=g_slist_reverse(cway->nodes);
/* */
break;
case IN_OSM_TAG:
- g_printf("Planet loaded.\n");
+ g_printf("\nPlanet loaded.\n");
break;
default:;
}
print_memory_usage(void)
{
g_print("Memory usage per item:\n");
-g_printf("Node size: %d\n", (int)sizeof(node));
-g_printf("NodeD size: %d\n", (int)sizeof(node_data));
-g_printf("Way size: %d\n", (int)sizeof(way));
-g_printf("WayD size: %d\n", (int)sizeof(way_data));
+g_printf("Node size: %d\n", (gint)sizeof(node));
+g_printf("NodeD size: %d\n", (gint)sizeof(node_data));
+g_printf("Way size: %d\n", (gint)sizeof(way));
+g_printf("WayD size: %d\n", (gint)sizeof(way_data));
}
/************************************************************************/