diff --git a/src/actions.cpp b/src/actions.cpp index 0e74e5cf..36843138 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -70,6 +70,11 @@ EXIV2_RCSID("@(#) $Id$") # include #endif +#if !defined(__MINGW__) && !defined(_MSC_VER) +#define _fileno(a) +#define _setmod(a,b) +#endif + // ***************************************************************************** // local declarations namespace { @@ -247,9 +252,7 @@ namespace Action { option = option == Exiv2::kpsNone ? Exiv2::kpsXMP : option; // drop case Params::pmIccProfile:{ option = option == Exiv2::kpsNone ? Exiv2::kpsIccProfile : option; -#ifdef __MINGW__ _setmode(_fileno(stdout),O_BINARY); -#endif rc = printStructure(std::cout,option); } break; } @@ -1069,11 +1072,9 @@ namespace Action { path_ = path; int rc = 0; -#ifdef __MINGW__ if ( Params::instance().target_ & Params::ctStdInOut ) { _setmode(_fileno(stdout),O_BINARY); } -#endif if (!rc && Params::instance().target_ & Params::ctThumb) { rc = writeThumbnail(); @@ -1265,11 +1266,9 @@ namespace Action { return -1; } -#ifdef __MINGW__ if ( Params::instance().target_ & Params::ctStdInOut ) { _setmode(_fileno(stdin),O_BINARY); } -#endif int rc = 0; Timestamp ts; diff --git a/src/basicio.cpp b/src/basicio.cpp index 06371e99..dbefcf35 100644 --- a/src/basicio.cpp +++ b/src/basicio.cpp @@ -1493,7 +1493,7 @@ namespace Exiv2 { if (prot == pStdin) { if (isatty(fileno(stdin))) throw Error(53); -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__MINGW__) // convert stdin to binary if (_setmode(_fileno(stdin), _O_BINARY) == -1) throw Error(54);