]> git.tdb.fi Git - ext/subsurface.git/blobdiff - parse-xml.c
Use 'cairo_translate()' instead of manual translation
[ext/subsurface.git] / parse-xml.c
index 8aaeedc9f72d9146b0939042969240c87b7741da..36db7e74453dcd8b6f1f4796daab1df6ae51c367 100644 (file)
@@ -648,7 +648,7 @@ static void uemis_date_time(char *buffer, void *_when)
 
         switch (integer_or_float(buffer, &val)) {
         case FLOAT:
-               *when = (val.fp - 40587.5) * 86400;
+               *when = (val.fp - 40587) * 86400;
                break;
        default:
                fprintf(stderr, "Strange julian date: %s", buffer);
@@ -665,10 +665,14 @@ static void uemis_date_time(char *buffer, void *_when)
  */
 static void uemis_time_zone(char *buffer, void *_when)
 {
+#if 0 /* seems like this is only used to display it correctly
+       * the stored time appears to be UTC */
+
        time_t *when = _when;
        signed char tz = atoi(buffer);
 
        *when += tz * 3600;
+#endif
 }
 
 /* 0 - air ; 1 - nitrox1 ; 2 - nitrox2 ; 3 = nitrox3 */
@@ -1228,13 +1232,20 @@ static void reset_all(void)
        import_source = UNKNOWN;
 }
 
-void parse_xml_file(const char *filename)
+void parse_xml_file(const char *filename, GError **error)
 {
        xmlDoc *doc;
 
        doc = xmlReadFile(filename, NULL, 0);
        if (!doc) {
                fprintf(stderr, "Failed to parse '%s'.\n", filename);
+               if (error != NULL)
+               {
+                       *error = g_error_new(g_quark_from_string("divelog"),
+                                            DIVE_ERROR_PARSE,
+                                            "Failed to parse '%s'",
+                                            filename);
+               }
                return;
        }