Diff of /trunk/src/gpx.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 13 by harbaum, Sat Jun 27 11:09:19 2009 UTC revision 74 by harbaum, Mon Aug 24 09:23:36 2009 UTC
# Line 155  gpx_dialog_t *gpx_busy_dialog_new(GtkWid Line 155  gpx_dialog_t *gpx_busy_dialog_new(GtkWid
155    gtk_window_set_title(GTK_WINDOW(dialog->dialog), _("Loading"));    gtk_window_set_title(GTK_WINDOW(dialog->dialog), _("Loading"));
156    gtk_window_set_default_size(GTK_WINDOW(dialog->dialog), 300, 10);    gtk_window_set_default_size(GTK_WINDOW(dialog->dialog), 300, 10);
157    
158    gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);    gtk_window_set_modal(GTK_WINDOW(dialog->dialog), TRUE);
159    gtk_window_set_transient_for(GTK_WINDOW(dialog->dialog), GTK_WINDOW(parent));    gtk_window_set_transient_for(GTK_WINDOW(dialog->dialog), GTK_WINDOW(parent));
160    
161    dialog->label = gtk_label_new("---");    dialog->label = gtk_label_new("---");
# Line 463  static log_t *process_gpx_wpt_gc_logs_lo Line 463  static log_t *process_gpx_wpt_gc_logs_lo
463      ret = xmlTextReaderRead(reader);      ret = xmlTextReaderRead(reader);
464    }    }
465    
466    g_assert(0);    gpx_free_log(log);
467    return log;    return NULL;
468  }  }
469    
470  static log_t *process_gpx_wpt_gc_logs(xmlTextReaderPtr reader) {  static log_t *process_gpx_wpt_gc_logs(xmlTextReaderPtr reader) {
# Line 513  static log_t *process_gpx_wpt_gc_logs(xm Line 513  static log_t *process_gpx_wpt_gc_logs(xm
513      ret = xmlTextReaderRead(reader);      ret = xmlTextReaderRead(reader);
514    }    }
515    
516    g_assert(0);    /* free the entire log chain */
517    return log_chain;    while(log_chain) {
518        log_t *next = log_chain->next;
519        gpx_free_log(log_chain);
520        log_chain = next;
521      }
522    
523      return NULL;
524  }  }
525    
526  static tb_t *process_gpx_wpt_gc_tbs_travelbug(xmlTextReaderPtr reader) {  static tb_t *process_gpx_wpt_gc_tbs_travelbug(xmlTextReaderPtr reader) {
# Line 563  static tb_t *process_gpx_wpt_gc_tbs_trav Line 569  static tb_t *process_gpx_wpt_gc_tbs_trav
569      ret = xmlTextReaderRead(reader);      ret = xmlTextReaderRead(reader);
570    }    }
571    
572    g_assert(0);    gpx_free_tb(tb);
573    return tb;    return NULL;
574  }  }
575    
576  static tb_t *process_gpx_wpt_gc_tbs(xmlTextReaderPtr reader) {  static tb_t *process_gpx_wpt_gc_tbs(xmlTextReaderPtr reader) {
# Line 605  static tb_t *process_gpx_wpt_gc_tbs(xmlT Line 611  static tb_t *process_gpx_wpt_gc_tbs(xmlT
611      ret = xmlTextReaderRead(reader);      ret = xmlTextReaderRead(reader);
612    }    }
613    
614    g_assert(0);    while(tb) {
615    return tb;      tb_t *next = tb;
616        gpx_free_tb(tb);
617        tb = next;
618      }
619    
620      return NULL;
621  }  }
622    
623  static void process_gpx_wpt_gc(xmlTextReaderPtr reader, cache_t *cache) {  static void process_gpx_wpt_gc(xmlTextReaderPtr reader, cache_t *cache) {
# Line 764  static cache_t *process_gpx_wpt(xmlTextR Line 775  static cache_t *process_gpx_wpt(xmlTextR
775        /* neither geocaching.com GC* nor opencaching.com OC* nor */        /* neither geocaching.com GC* nor opencaching.com OC* nor */
776        /* geocaching australia GA* waypoint */        /* geocaching australia GA* waypoint */
777        if(cache->id &&        if(cache->id &&
778             (strncasecmp(cache->id, "__", 2) != 0) &&
779           (strncasecmp(cache->id, "GC", 2) != 0) &&           (strncasecmp(cache->id, "GC", 2) != 0) &&
780           (strncasecmp(cache->id, "OC", 2) != 0) &&           (strncasecmp(cache->id, "OC", 2) != 0) &&
781           (strncasecmp(cache->id, "GA", 2) != 0)) {           (strncasecmp(cache->id, "GA", 2) != 0)) {
# Line 830  static cache_t *process_gpx_wpt(xmlTextR Line 842  static cache_t *process_gpx_wpt(xmlTextR
842      ret = xmlTextReaderRead(reader);      ret = xmlTextReaderRead(reader);
843    }    }
844    
845    g_assert(0);    gpx_free_cache(cache);
846    return cache;    return NULL;
847  }  }
848    
849  static void process_gpx(xmlTextReaderPtr reader, gpx_dialog_t *dialog,  static gboolean process_gpx(xmlTextReaderPtr reader, gpx_dialog_t *dialog,
850                          gpx_t *gpx) {                              gpx_t *gpx) {
851    
852    /* no attributes of interest */    /* no attributes of interest */
853    
# Line 846  static void process_gpx(xmlTextReaderPtr Line 858  static void process_gpx(xmlTextReaderPtr
858    while(*cache) cache = &(*cache)->next;    while(*cache) cache = &(*cache)->next;
859    
860    const xmlChar *name = xmlTextReaderConstName(reader);    const xmlChar *name = xmlTextReaderConstName(reader);
861    g_assert(name);    if(!name) return FALSE;
862    
863    /* read next node */    /* read next node */
864    int ret = xmlTextReaderRead(reader);    int ret = xmlTextReaderRead(reader);
# Line 876  static void process_gpx(xmlTextReaderPtr Line 888  static void process_gpx(xmlTextReaderPtr
888      case XML_READER_TYPE_END_ELEMENT:      case XML_READER_TYPE_END_ELEMENT:
889        /* end element must be for the current element */        /* end element must be for the current element */
890        g_assert(xmlTextReaderDepth(reader) == 0);        g_assert(xmlTextReaderDepth(reader) == 0);
891        return;        return TRUE;
892        break;        break;
893    
894      default:      default:
# Line 885  static void process_gpx(xmlTextReaderPtr Line 897  static void process_gpx(xmlTextReaderPtr
897      ret = xmlTextReaderRead(reader);      ret = xmlTextReaderRead(reader);
898    }    }
899    
900    g_assert(0);    return FALSE;
901  }  }
902    
903  /* parse loc waypoint entry */  /* parse loc waypoint entry */
# Line 1345  float gpx_pos_get_distance(pos_t p1, pos Line 1357  float gpx_pos_get_distance(pos_t p1, pos
1357    
1358  void gpx_pos_get_distance_str(char *str, int len,  void gpx_pos_get_distance_str(char *str, int len,
1359                                pos_t p1, pos_t p2, int mil) {                                pos_t p1, pos_t p2, int mil) {
1360    if(!p1.lat && !p1.lon) {    if(isnan(p1.lat) || isnan(p1.lon)) {
1361      snprintf(str, len, "---");      snprintf(str, len, "---");
1362      return;      return;
1363    }    }

Legend:
Removed from v.13  
changed lines
  Added in v.74