_fileno is only for Windows

This commit is contained in:
Luis Díaz Más 2022-03-04 17:22:24 +01:00
parent 15697fcd1e
commit 867132f7c7
2 changed files with 7 additions and 5 deletions

View File

@ -202,7 +202,7 @@ namespace Action {
}
}
} else {
_setmode(_fileno(stdout),O_BINARY);
_setmode(fileno(stdout),O_BINARY);
result = printStructure(std::cout, option, path);
}
@ -834,7 +834,7 @@ namespace Action {
bool bStdout = (Params::instance().target_ & Params::ctStdInOut) != 0;
if (bStdout) {
_setmode(_fileno(stdout), _O_BINARY);
_setmode(fileno(stdout), _O_BINARY);
}
if (Params::instance().target_ & Params::ctThumb) {
@ -1905,7 +1905,7 @@ namespace {
// if we used a temporary target, copy it to stdout
if ( rc == 0 && bStdout ) {
FILE* f = ::fopen(target.c_str(),"rb") ;
_setmode(_fileno(stdout),O_BINARY);
_setmode(fileno(stdout),O_BINARY);
if ( f ) {
char buffer[8*1024];

View File

@ -971,7 +971,7 @@ void Params::getStdin(Exiv2::DataBuf& buf)
if (stdinBuf.empty()) {
#if defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW__) || defined(_MSC_VER)
DWORD fdwMode;
_setmode(fileno(stdin), O_BINARY);
_setmode(fileno(stdin),O_BINARY);
Sleep(300);
if ( !GetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), &fdwMode) ) { // failed: stdin has bytes!
#else
@ -1380,7 +1380,9 @@ namespace {
if (cmdEnd == std::string::npos || keyStart == std::string::npos) {
std::string cmdLine ;
#if defined(_MSC_VER) || defined(__MINGW__)
for ( int i = 1 ; i < __argc ; i++ ) { cmdLine += std::string(" ") + formatArg(__argv[i]) ; }
for ( int i = 1 ; i < __argc ; i++ ) {
cmdLine += std::string(" ") + formatArg(__argv[i]) ;
}
#endif
throw Exiv2::Error(Exiv2::kerErrorMessage, Exiv2::toString(num)
+ ": " + _("Invalid command line:") + cmdLine);