Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Dukhovnikov <[email protected]>
  • Loading branch information
antond-weta committed Sep 27, 2024
1 parent 21d5461 commit f48c022
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
19 changes: 12 additions & 7 deletions src/rawtoaces2/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
}
Expand All @@ -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;
Expand All @@ -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;
}
15 changes: 9 additions & 6 deletions src/rawtoaces_util2/rawtoaces_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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++ )
Expand All @@ -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++ )
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit f48c022

Please sign in to comment.