42 |
free(wpt); |
free(wpt); |
43 |
} |
} |
44 |
|
|
45 |
|
void gpx_free_user(user_t *user) { |
46 |
|
if(user->name) xmlFree(user->name); |
47 |
|
free(user); |
48 |
|
} |
49 |
|
|
50 |
void gpx_free_log(log_t *log) { |
void gpx_free_log(log_t *log) { |
51 |
if(log->finder) xmlFree(log->finder); |
if(log->finder) xmlFree(log->finder); |
52 |
if(log->text) xmlFree(log->text); |
if(log->text) xmlFree(log->text); |
66 |
|
|
67 |
if(cache->id) xmlFree(cache->id); |
if(cache->id) xmlFree(cache->id); |
68 |
if(cache->name) xmlFree(cache->name); |
if(cache->name) xmlFree(cache->name); |
69 |
if(cache->owner) xmlFree(cache->owner); |
if(cache->owner) gpx_free_user(cache->owner); |
70 |
if(cache->short_description) xmlFree(cache->short_description); |
if(cache->short_description) xmlFree(cache->short_description); |
71 |
if(cache->long_description) xmlFree(cache->long_description); |
if(cache->long_description) xmlFree(cache->long_description); |
72 |
if(cache->hint) xmlFree(cache->hint); |
if(cache->hint) xmlFree(cache->hint); |
284 |
printf(" name: %s\n", cache->name); |
printf(" name: %s\n", cache->name); |
285 |
printf(" latitude: %f\n", cache->pos.lat); |
printf(" latitude: %f\n", cache->pos.lat); |
286 |
printf(" longitude: %f\n", cache->pos.lon); |
printf(" longitude: %f\n", cache->pos.lon); |
287 |
printf(" owner: %s\n", cache->owner); |
printf(" owner: %s\n", cache->owner->name); |
288 |
printf(" type: %s\n", cache_type_str[cache->type+1]); |
printf(" type: %s\n", cache_type_str[cache->type+1]); |
289 |
printf(" container: %s\n", cache_container_str[cache->container+1]); |
printf(" container: %s\n", cache_container_str[cache->container+1]); |
290 |
printf(" difficulty: %.1f\n", cache->difficulty); |
printf(" difficulty: %.1f\n", cache->difficulty); |
331 |
return ret; |
return ret; |
332 |
} |
} |
333 |
|
|
334 |
|
static unsigned int xml_get_prop_id(xmlTextReaderPtr reader) { |
335 |
|
unsigned int ret = 0; |
336 |
|
char *prop; |
337 |
|
if((prop = (char*)xmlTextReaderGetAttribute(reader, BAD_CAST "id"))) { |
338 |
|
ret = atoi(prop); |
339 |
|
xmlFree(prop); |
340 |
|
} |
341 |
|
return ret; |
342 |
|
} |
343 |
|
|
344 |
static int xml_prop_is(xmlTextReaderPtr reader, char *name, char *value, |
static int xml_prop_is(xmlTextReaderPtr reader, char *name, char *value, |
345 |
int def_value) { |
int def_value) { |
346 |
int match = def_value; |
int match = def_value; |
663 |
if(strcasecmp(name, "name") == 0) { |
if(strcasecmp(name, "name") == 0) { |
664 |
if(!cache->name) cache->name = process_text(reader); |
if(!cache->name) cache->name = process_text(reader); |
665 |
} else if(strcasecmp(name, "owner") == 0) { |
} else if(strcasecmp(name, "owner") == 0) { |
666 |
if(!cache->owner) cache->owner = process_text(reader); |
if(!cache->owner) { |
667 |
|
cache->owner = g_new0(user_t, 1); |
668 |
|
cache->owner->name = process_text(reader); |
669 |
|
cache->owner->id = xml_get_prop_id(reader); |
670 |
|
} |
671 |
} else if(strcasecmp(name, "type") == 0) { |
} else if(strcasecmp(name, "type") == 0) { |
672 |
cache->type = xml_str_search(reader, cache_type_str, |
cache->type = xml_str_search(reader, cache_type_str, |
673 |
"cache type", CACHE_TYPE_UNKNOWN); |
"cache type", CACHE_TYPE_UNKNOWN); |