]> git.street.me.uk Git - andy/viking.git/blobdiff - src/viktrack.c
[DOC] Fix: Viking's sources are hosted by Git now
[andy/viking.git] / src / viktrack.c
index 2607be14f8f7b34b916c37e9dbe7f9948408853d..e03d8aa2a096f6153d302ce444ddd62b74557963 100644 (file)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include <glib.h>
 #include <time.h>
 #include <stdlib.h>
+#ifdef HAVE_STRING_H
 #include <string.h>
+#endif
+#ifdef HAVE_MATH_H
 #include <math.h>
+#endif
+
 #include "coords.h"
 #include "vikcoord.h"
 #include "viktrack.h"
@@ -107,9 +115,12 @@ VikTrack *vik_track_copy ( const VikTrack *tr )
 VikTrackpoint *vik_trackpoint_new()
 {
   VikTrackpoint *tp = g_malloc0(sizeof(VikTrackpoint));
-  tp->extended = FALSE;
   tp->speed = NAN;
   tp->course = NAN;
+  tp->altitude = VIK_DEFAULT_ALTITUDE;
+  tp->hdop = VIK_DEFAULT_DOP;
+  tp->vdop = VIK_DEFAULT_DOP;
+  tp->pdop = VIK_DEFAULT_DOP;
   return tp;
 }
 
@@ -368,8 +379,10 @@ gdouble *vik_track_make_elevation_map ( const VikTrack *tr, guint16 num_chunks )
   chunk_length = total_length / num_chunks;
 
   /* Zero chunk_length (eg, track of 2 tp with the same loc) will cause crash */
-  if (chunk_length <= 0)
+  if (chunk_length <= 0) {
+    g_free(pts);
     return NULL;
+  }
 
   current_dist = 0.0;
   current_area_under_curve = 0;