]> git.tdb.fi Git - ext/subsurface.git/blobdiff - save-xml.c
Use the right function to get resource path on Mac
[ext/subsurface.git] / save-xml.c
index d6774b5c7f880bb425f9e43209038b13568756f7..c9085db51554394442e3f92ef2782e52c52ec37f 100644 (file)
@@ -162,7 +162,7 @@ static void show_location(FILE *f, struct dive *dive)
         */
        if (latitude || longitude) {
                int len = snprintf(buffer, sizeof(buffer)-4,
-                       "  <location gps='%f %f'>",
+                       "  <location gps='%.12g %.12g'>",
                        latitude, longitude);
                if (!dive->location) {
                        memcpy(&buffer[len-1], "/>\n", 4);
@@ -202,16 +202,16 @@ static void save_cylinder_info(FILE *f, struct dive *dive)
                if (!o2 && !volume && !start && !end)
                        return;
                fprintf(f, "  <cylinder");
-               if (o2) {
-                       fprintf(f, " o2='%u.%u%%'", FRACTION(o2, 10));
-                       if (he)
-                               fprintf(f, " he='%u.%u%%'", FRACTION(he, 10));
-               }
                if (volume)
                        show_milli(f, " size='", volume, " l", "'");
                show_pressure(f, cylinder->type.workingpressure, " workpressure='", "'");
                if (description && *description)
                        fprintf(f, " description='%s'", description);
+               if (o2) {
+                       fprintf(f, " o2='%u.%u%%'", FRACTION(o2, 10));
+                       if (he)
+                               fprintf(f, " he='%u.%u%%'", FRACTION(he, 10));
+               }
                show_pressure(f, cylinder->start, " start='", "'");
                show_pressure(f, cylinder->end, " end='", "'");
                fprintf(f, " />\n");
@@ -262,6 +262,8 @@ static void save_dive(FILE *f, struct dive *dive)
        fputs("<dive", f);
        if (dive->number)
                fprintf(f, " number='%d'", dive->number);
+       if (dive->rating)
+               fprintf(f, " rating='%d'", dive->rating);
        fprintf(f, " date='%04u-%02u-%02u'",
                tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday);
        fprintf(f, " time='%02u:%02u:%02u'",