#1109 Work in Progress on MinGW/32. Put stdout into binary mode for options -pC -pX, -eABC-, -eABC-

This commit is contained in:
Robin Mills
2016-09-22 14:34:01 +00:00
parent 13a990d3d9
commit 52f0bd2ea1
2 changed files with 31 additions and 8 deletions
+1
View File
@@ -105,6 +105,7 @@ namespace Exiv2 {
@throw Error if reading of the file fails or the image data is
not valid (does not look like data of the specific image type).
@caution This function is not thread safe and intended for exiv2 -pS for debugging.
@caution You may need to put the stream into binary mode (see src/actions.cpp)
*/
virtual void printStructure(std::ostream& out, PrintStructureOption option =kpsNone, int depth=0);
/*!
+30 -8
View File
@@ -234,15 +234,24 @@ namespace Action {
try {
path_ = path;
int rc = 0;
Exiv2::PrintStructureOption option = Exiv2::kpsNone ;
switch (Params::instance().printMode_) {
case Params::pmSummary: rc = printSummary(); break;
case Params::pmList: rc = printList(); break;
case Params::pmComment: rc = printComment(); break;
case Params::pmPreview: rc = printPreviewList(); break;
case Params::pmStructure: rc = printStructure(std::cout,Exiv2::kpsBasic) ; break;
case Params::pmXMP: rc = printStructure(std::cout,Exiv2::kpsXMP) ; break;
case Params::pmIccProfile:rc = printStructure(std::cout,Exiv2::kpsIccProfile); break;
case Params::pmRecursive: rc = printStructure(std::cout,Exiv2::kpsRecursive) ; break;
case Params::pmSummary: rc = printSummary(); break;
case Params::pmList: rc = printList(); break;
case Params::pmComment: rc = printComment(); break;
case Params::pmPreview: rc = printPreviewList(); break;
case Params::pmStructure: rc = printStructure(std::cout,Exiv2::kpsBasic) ; break;
case Params::pmRecursive: rc = printStructure(std::cout,Exiv2::kpsRecursive) ; break;
case Params::pmXMP:
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;
}
return rc;
}
@@ -1060,6 +1069,12 @@ 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();
}
@@ -1249,6 +1264,13 @@ namespace Action {
<< ": " << _("Failed to open the file\n");
return -1;
}
#ifdef __MINGW__
if ( Params::instance().target_ & Params::ctStdInOut ) {
_setmode(_fileno(stdin),O_BINARY);
}
#endif
int rc = 0;
Timestamp ts;
if (Params::instance().preserve_) {