]> Creatis software - creaVtk.git/commitdiff
#2919 creaVtk Bug New Normal ReadMHDPlane not compiling in windows for big data
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Tue, 26 Apr 2016 06:18:31 +0000 (08:18 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Tue, 26 Apr 2016 06:18:31 +0000 (08:18 +0200)
bbtk_creaVtk_PKG/src/bbcreaVtkReadMHDPlane.cxx

index 56e8590e137c918e16517345266511a10bb37e17..3b8fb24e373d5cd7593918fec5c2dd7b83b67077 100644 (file)
@@ -6,17 +6,17 @@
 
 #include "stdio.h"
 
-#include <sys/types.h>
-#include <unistd.h> 
-
-
-
 
 #define _LARGEFILE64_SOURCE
 
 #include <stdio.h>
 #include <sys/types.h>
+
+#if defined(_WIN32)
+#else
 #include <unistd.h>
+#endif // defined(_WIN32)
+
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
@@ -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