From f48c02279f7a95eab298dcfad1f31d514eadbb00 Mon Sep 17 00:00:00 2001 From: Anton Dukhovnikov Date: Fri, 27 Sep 2024 17:33:14 +1200 Subject: [PATCH] small fixes Signed-off-by: Anton Dukhovnikov --- src/rawtoaces2/main.cpp | 19 ++++++++++++------- src/rawtoaces_util2/rawtoaces_util.cpp | 15 +++++++++------ 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/rawtoaces2/main.cpp b/src/rawtoaces2/main.cpp index 318a9ef..3e8d8cf 100644 --- a/src/rawtoaces2/main.cpp +++ b/src/rawtoaces2/main.cpp @@ -38,8 +38,8 @@ int main( int argc, const char *argv[] ) for ( auto filename2: it ) { - if ( std::filesystem::is_regular_file( filename ) || - std::filesystem::is_symlink( filename ) ) + if ( std::filesystem::is_regular_file( filename2 ) || + std::filesystem::is_symlink( filename2 ) ) { files_to_convert.push_back( filename2.path().string() ); } @@ -58,6 +58,7 @@ int main( int argc, const char *argv[] ) } } + bool result = true; for ( auto const &input_filename: files_to_convert ) { std::string output_filename = input_filename; @@ -72,30 +73,34 @@ int main( int argc, const char *argv[] ) { std::cerr << "Failed to configure the reader for the file: " << input_filename << std::endl; - return 1; + result = false; + continue; } if ( !converter.load( input_filename ) ) { std::cerr << "Failed to read for the file: " << input_filename << std::endl; - return 1; + result = false; + continue; } if ( !converter.process() ) { std::cerr << "Failed to convert the file: " << input_filename << std::endl; - return 1; + result = false; + continue; } if ( !converter.save( output_filename ) ) { std::cerr << "Failed to save the file: " << output_filename << std::endl; - return 1; + result = false; + continue; } } - return 0; + return result ? 0 : 1; } diff --git a/src/rawtoaces_util2/rawtoaces_util.cpp b/src/rawtoaces_util2/rawtoaces_util.cpp index 742232a..349d839 100644 --- a/src/rawtoaces_util2/rawtoaces_util.cpp +++ b/src/rawtoaces_util2/rawtoaces_util.cpp @@ -290,7 +290,7 @@ bool check_param( std::cerr << "Warning: " << mode_name << " was set to \"" << mode_value << "\", but no \"--" << param_name << "\" parameter provided. " << default_value_message - << " will be used." << std::endl; + << std::endl; on_failure(); return false; @@ -300,8 +300,7 @@ bool check_param( { std::cerr << "Warning: The parameter \"" << param_name << "\" must have " << correct_size << " values. " - << default_value_message << " will be used." - << std::endl; + << default_value_message << std::endl; on_failure(); return false; @@ -497,7 +496,7 @@ bool ImageConverter::parse( int argc, const char *argv[] ) "custom-wb", custom_wb, 4, - "The scalers will be ignored. The default values of (1, 1, 1)", + "The scalers will be ignored. The default values of (1, 1, 1, 1) will be used", wbMethod == WBMethod::Custom, [&]() { for ( int i = 0; i < 4; i++ ) @@ -515,7 +514,7 @@ bool ImageConverter::parse( int argc, const char *argv[] ) "custom-mat", custom_mat, 9, - "Identity matrix", + "Identity matrix will be used", matrixMethod == MatrixMethod::Custom, [&]() { for ( int i = 0; i < 3; i++ ) @@ -571,7 +570,11 @@ bool ImageConverter::configure( const std::string &input_filename ) } auto imageInput = OIIO::ImageInput::create( "raw", false, &_inputHint ); - imageInput->open( input_filename, _inputFull, _inputHint ); + bool result = imageInput->open( input_filename, _inputFull, _inputHint ); + if (!result) + { + return false; + } _is_DNG = _inputFull.extra_attribs.find( "raw:dng:version" )->get_int() > 0;