From: Eduardo DAVILA Date: Tue, 26 Apr 2016 06:18:31 +0000 (+0200) Subject: #2919 creaVtk Bug New Normal ReadMHDPlane not compiling in windows for big data X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=2076b540c52e3c4c62304f0cc99e4155256a138e;p=creaVtk.git #2919 creaVtk Bug New Normal ReadMHDPlane not compiling in windows for big data --- diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkReadMHDPlane.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkReadMHDPlane.cxx index 56e8590..3b8fb24 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkReadMHDPlane.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkReadMHDPlane.cxx @@ -6,17 +6,17 @@ #include "stdio.h" -#include -#include - - - #define _LARGEFILE64_SOURCE #include #include + +#if defined(_WIN32) +#else #include +#endif // defined(_WIN32) + #include #include #include @@ -230,7 +230,16 @@ void ReadMHDPlane::Read64lseek() long long pos; long long lsize = dimX*dimY*1 *dataSize; + + +#if defined(_WIN32) + _sopen_s( &fd, filename.c_str(), _O_RDONLY, _SH_DENYNO, 0 ); +#else fd = open ( filename.c_str() , O_RDONLY|O_LARGEFILE ); +#endif // defined(_WIN32) + + + if (fd < 0) { printf("EED ReadMHDPlane::Read64lseek \n"); @@ -248,7 +257,15 @@ void ReadMHDPlane::Read64lseek() newImage->AllocateScalars(); newImage->Update(); pos = dimX*dimY*(long long)bbGetInputSlice()*dataSize; + + + +#if defined(_WIN32) + if (_lseeki64( fd, pos, SEEK_SET ) < 0) +#else if (lseek64(fd, pos, SEEK_SET) < 0) +#endif // defined(_WIN32) + { printf("EED ReadMHDPlane::Read64lseek \n"); fprintf(stderr, "Failed seeking to %lld, %s\n", pos, strerror(errno)); @@ -262,7 +279,7 @@ void ReadMHDPlane::Read64lseek() } } // if PLANE XY - + /* if (bbGetInputDirectionPlane()=="XZ") { long long int j; @@ -293,7 +310,7 @@ printf("EED EED ReadMHDPlane::Read64lseek XZ j=%d \n", j); } pImage=pImage+dimX*dataSize; } // for j - } // if PLANE XY + } // if PLANE XZ if (bbGetInputDirectionPlane()=="YZ") @@ -331,10 +348,14 @@ printf("EED EED ReadMHDPlane::Read64lseek YZ i=%d j=%d \n", i,j); } } } // for j - } // if PLANE XY - + } // if PLANE YZ + */ +#if defined(_WIN32) + _close (fd); +#else close (fd); +#endif // defined(_WIN32) bbSetOutputOut( newImage ); } // if