]> git.tdb.fi Git - ext/subsurface.git/blobdiff - libdivecomputer.c
Only set the window icon if the icon file exists
[ext/subsurface.git] / libdivecomputer.c
index bcf59eeb588ba463de2de58d3e2af719f00ab8f0..daf724190d44d7868ff1a753c29a6a9954c06e09 100644 (file)
@@ -1,5 +1,7 @@
 #include <stdio.h>
 #include <pthread.h>
+#include <unistd.h>
+#include <inttypes.h>
 
 #include "dive.h"
 #include "divelist.h"
@@ -107,7 +109,7 @@ static int parse_gasmixes(struct dive *dive, parser_t *parser, int ngases)
                he = gasmix.helium * 1000 + 0.5;
 
                /* Ignore bogus data - libdivecomputer does some crazy stuff */
-               if (o2 < 210 || o2 >= 1000)
+               if (o2 <= AIR_PERMILLE || o2 >= 1000)
                        o2 = 0;
                if (he < 0 || he >= 800 || o2+he >= 1000)
                        he = 0;
@@ -411,10 +413,10 @@ static device_status_t device_open(const char *devname,
 
 static void event_cb(device_t *device, device_event_t event, const void *data, void *userdata)
 {
-       const device_progress_t *progress = (device_progress_t *) data;
-       const device_devinfo_t *devinfo = (device_devinfo_t *) data;
-       const device_clock_t *clock = (device_clock_t *) data;
-       device_data_t *devdata = (device_data_t *) userdata;
+       const device_progress_t *progress = data;
+       const device_devinfo_t *devinfo = data;
+       const device_clock_t *clock = data;
+       device_data_t *devdata = userdata;
 
        switch (event) {
        case DEVICE_EVENT_WAITING:
@@ -433,8 +435,8 @@ static void event_cb(device_t *device, device_event_t event, const void *data, v
                break;
        case DEVICE_EVENT_CLOCK:
                devdata->clock = *clock;
-               printf("Event: systime=%lld, devtime=%u\n",
-                       clock->systime, clock->devtime);
+               printf("Event: systime=%"PRId64", devtime=%u\n",
+                       (uint64_t)clock->systime, clock->devtime);
                break;
        default:
                break;