]> git.tdb.fi Git - ext/subsurface.git/blobdiff - file.c
Fix profile and average depth for freedives
[ext/subsurface.git] / file.c
diff --git a/file.c b/file.c
index 3f06259faa1cd7087ef926e1cdd8a60b4d1bf9c1..da498995cc0c1522c802a86f4d34ae4522023702 100644 (file)
--- a/file.c
+++ b/file.c
@@ -8,16 +8,21 @@
 #include "dive.h"
 #include "file.h"
 
+/* Crazy windows sh*t */
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
 static int readfile(const char *filename, struct memblock *mem)
 {
-       int ret, fd = open(filename, O_RDONLY);
+       int ret, fd;
        struct stat st;
        char *buf;
 
        mem->buffer = NULL;
        mem->size = 0;
 
-       fd = open(filename, O_RDONLY);
+       fd = open(filename, O_RDONLY | O_BINARY);
        if (fd < 0)
                return fd;
        ret = fstat(fd, &st);
@@ -140,7 +145,7 @@ static void add_sample_data(struct sample *sample, enum csv_format type, double
                sample->temperature.mkelvin = F_to_mkelvin(val);
                break;
        case CSV_PRESSURE:
-               sample->cylinderpressure.mbar = psi_to_mbar(val);
+               sample->cylinderpressure.mbar = psi_to_mbar(val*4);
                break;
        }
 }