X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FclitkXdrImageIOWriter.cxx;h=d769b3df2b4bcf2d00bf7716ae7cce76f44d0303;hb=c234e07e4ef90bb8b08c75ca4f1b3a76055e7859;hp=a9eb77b62d1e9f889cef65632c7e38068f31c848;hpb=4895c46e3855ebafb8011e1699e637bc712787d9;p=clitk.git diff --git a/common/clitkXdrImageIOWriter.cxx b/common/clitkXdrImageIOWriter.cxx old mode 100755 new mode 100644 index a9eb77b..d769b3d --- a/common/clitkXdrImageIOWriter.cxx +++ b/common/clitkXdrImageIOWriter.cxx @@ -41,7 +41,7 @@ //From portdefs.h #if defined(unix) || defined(__APPLE__) #define O_BINARY 0 -#define setmode(a,b) 0 +//#define setmode(a,b) 0 // comment by ds #endif #ifndef __LARGE__ @@ -97,6 +97,9 @@ void clitk::XdrImageIO::Write(const void* buffer) #include #include #include +#ifndef _WIN32 +# include +#endif #if !defined(unix) && !defined(__APPLE__) #include #endif @@ -105,7 +108,7 @@ void clitk::XdrImageIO::Write(const void* buffer) #include -#ifdef WIN32 +#ifdef _WIN32 // don't use min() and max() macros indirectly defined by windows.h, // but use portable std::min() and std:max() instead #ifndef NOMINMAX @@ -253,7 +256,7 @@ static int wxdr_write(int handle, const void * buf, unsigned len) { // if (handle == 1) // stdout if (handle == fileno(stdout)) { -#ifdef WIN32 +#ifdef _WIN32 // Behave as C standard library write(): return number of bytes // written or -1 and errno set on error. fflush(stdout); @@ -834,6 +837,12 @@ void clitk::XdrImageIO::WriteImage(const char* file, char* headerinfo, char* hea char *buf2; size_t slen; +#ifdef _WIN32 + int oldFMode; + _get_fmode(&oldFMode); + _set_fmode(O_BINARY); /* default binary i/o */ +#endif + if (bLittleEndian) swap_test = 0x00000001; @@ -948,7 +957,7 @@ void clitk::XdrImageIO::WriteImage(const char* file, char* headerinfo, char* hea for (i=0; i