X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=file.c;h=da498995cc0c1522c802a86f4d34ae4522023702;hb=9d46581913ce33664e333a4d6eaf7f4e26e20b1c;hp=3f06259faa1cd7087ef926e1cdd8a60b4d1bf9c1;hpb=ba31e37063308ab74b282db983557797d05f59d1;p=ext%2Fsubsurface.git diff --git a/file.c b/file.c index 3f06259..da49899 100644 --- 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; } }