Add braces around try-catch block. Apply clang-format to the function.
This commit is contained in:
+41
-39
@@ -1034,46 +1034,48 @@ namespace Action {
|
||||
}
|
||||
|
||||
int Extract::run(const std::string& path)
|
||||
try {
|
||||
path_ = path;
|
||||
int rc = 0;
|
||||
|
||||
bool bStdout = Params::instance().target_ & Params::ctStdInOut?true:false;
|
||||
if (bStdout) { _setmode(_fileno(stdout), _O_BINARY) ; }
|
||||
|
||||
if (Params::instance().target_ & Params::ctThumb) {
|
||||
rc = writeThumbnail();
|
||||
}
|
||||
if (!rc && Params::instance().target_ & Params::ctPreview) {
|
||||
rc = writePreviews();
|
||||
}
|
||||
if (!rc && Params::instance().target_ & Params::ctXmpSidecar) {
|
||||
std::string xmpPath = bStdout ? "-" : newFilePath(path_, ".xmp");
|
||||
if (dontOverwrite(xmpPath)) return 0;
|
||||
rc = metacopy(path_, xmpPath, Exiv2::ImageType::xmp, false);
|
||||
}
|
||||
if (!rc && Params::instance().target_ & Params::ctIccProfile) {
|
||||
std::string iccPath = bStdout ? "-" : newFilePath(path_,".icc");
|
||||
rc = writeIccProfile(iccPath);
|
||||
}
|
||||
if (!rc
|
||||
&& !(Params::instance().target_ & Params::ctXmpSidecar)
|
||||
&& !(Params::instance().target_ & Params::ctThumb)
|
||||
&& !(Params::instance().target_ & Params::ctPreview)
|
||||
&& !(Params::instance().target_ & Params::ctIccProfile)
|
||||
) {
|
||||
std::string exvPath = bStdout ? "-" : newFilePath(path_, ".exv");
|
||||
if (dontOverwrite(exvPath)) return 0;
|
||||
rc = metacopy(path_, exvPath, Exiv2::ImageType::exv, false);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
catch(const Exiv2::AnyError& e)
|
||||
{
|
||||
std::cerr << "Exiv2 exception in extract action for file " << path
|
||||
<< ":\n" << e << "\n";
|
||||
return 1;
|
||||
} // Extract::run
|
||||
try {
|
||||
path_ = path;
|
||||
int rc = 0;
|
||||
|
||||
bool bStdout = Params::instance().target_ & Params::ctStdInOut ? true : false;
|
||||
if (bStdout) {
|
||||
_setmode(_fileno(stdout), _O_BINARY);
|
||||
}
|
||||
|
||||
if (Params::instance().target_ & Params::ctThumb) {
|
||||
rc = writeThumbnail();
|
||||
}
|
||||
if (!rc && Params::instance().target_ & Params::ctPreview) {
|
||||
rc = writePreviews();
|
||||
}
|
||||
if (!rc && Params::instance().target_ & Params::ctXmpSidecar) {
|
||||
std::string xmpPath = bStdout ? "-" : newFilePath(path_, ".xmp");
|
||||
if (dontOverwrite(xmpPath))
|
||||
return 0;
|
||||
rc = metacopy(path_, xmpPath, Exiv2::ImageType::xmp, false);
|
||||
}
|
||||
if (!rc && Params::instance().target_ & Params::ctIccProfile) {
|
||||
std::string iccPath = bStdout ? "-" : newFilePath(path_, ".icc");
|
||||
rc = writeIccProfile(iccPath);
|
||||
}
|
||||
if (!rc
|
||||
&& !(Params::instance().target_ & Params::ctXmpSidecar)
|
||||
&& !(Params::instance().target_ & Params::ctThumb)
|
||||
&& !(Params::instance().target_ & Params::ctPreview)
|
||||
&& !(Params::instance().target_ & Params::ctIccProfile)) {
|
||||
std::string exvPath = bStdout ? "-" : newFilePath(path_, ".exv");
|
||||
if (dontOverwrite(exvPath))
|
||||
return 0;
|
||||
rc = metacopy(path_, exvPath, Exiv2::ImageType::exv, false);
|
||||
}
|
||||
return rc;
|
||||
} catch (const Exiv2::AnyError& e) {
|
||||
std::cerr << "Exiv2 exception in extract action for file " << path << ":\n" << e << "\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int Extract::writeThumbnail() const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user