]> git.street.me.uk Git - andy/viking.git/blobdiff - src/degrees_converters.c
Add capability to save layer defaults from outside the layer defaults code.
[andy/viking.git] / src / degrees_converters.c
index 8e674dff576c5cee94f71ba8d756618d9cb23373..f78b178f9fb15d7dfecf0586f9cae98ca1e93a23 100644 (file)
@@ -25,8 +25,8 @@
 #ifdef HAVE_MATH_H
 #include <math.h>
 #endif
-#include <glib.h>
 #include <string.h>
+#include "degrees_converters.h"
 
 #define DEGREE_SYMBOL "\302\260"
 
@@ -138,7 +138,7 @@ static gchar *convert_dec_to_dms(gdouble dec, gchar pos_c, gchar neg_c)
   val_s = (tmp - val_m) * 60;
 
   /* Format */
-  result = g_strdup_printf ( "%c%d" DEGREE_SYMBOL "%d'%f\"",
+  result = g_strdup_printf ( "%c%d" DEGREE_SYMBOL "%d'%.4f\"",
                              sign_c, val_d, val_m, val_s );
   return result;
 }
@@ -178,7 +178,7 @@ gdouble convert_dms_to_dec(const gchar *dms)
                        gdouble value;
                        ptr = strpbrk (endptr, "0123456789,.");
                        if (ptr != NULL) {
-                               value = g_strtod(ptr, &endptr);
+                         value = g_strtod((const gchar *)ptr, (gchar **)&endptr);
                        nbFloat++;
                switch(nbFloat) {
                        case 1:
@@ -190,6 +190,7 @@ gdouble convert_dms_to_dec(const gchar *dms)
                        case 3:
                                s = value;
                                break;
+                       default: break;
                }
                        }
                } while (ptr != NULL && endptr != NULL);