Skip to content

Commit 9f4fc09

Browse files
committed
fix up float type validation
Signed-off-by: Aleksandr Motsjonov <[email protected]>
1 parent 416c5f5 commit 9f4fc09

File tree

2 files changed

+2
-25
lines changed

2 files changed

+2
-25
lines changed

src/rawtoaces_util/image_converter.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,8 +1203,6 @@ void fix_metadata( OIIO::ImageSpec &spec )
12031203
{
12041204
if ( type.basetype == OIIO::TypeDesc::STRING )
12051205
spec[dst_name] = src_attribute->get_string();
1206-
else if ( type.basetype == OIIO::TypeDesc::FLOAT )
1207-
spec[dst_name] = src_attribute->get_float();
12081206
}
12091207
spec.erase_attribute( src_name );
12101208
}

tests/test_image_converter.cpp

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -455,25 +455,6 @@ void test_fix_metadata_both_attributes()
455455
OIIO_CHECK_EQUAL( spec.find_attribute( "Model" ), nullptr );
456456
}
457457

458-
/// Tests fix_metadata with float attributes
459-
void test_fix_metadata_float_make()
460-
{
461-
std::cout << std::endl << "test_fix_metadata_float_make()" << std::endl;
462-
OIIO::ImageSpec spec;
463-
464-
// Add original "Make" attribute as float (unusual but possible)
465-
spec["Make"] = 42.5f;
466-
467-
// Call fix_metadata
468-
fix_metadata( spec );
469-
470-
// Check that "cameraMake" was created with correct float value
471-
OIIO_CHECK_EQUAL( spec.get_float_attribute( "cameraMake" ), 42.5f );
472-
473-
// Check that original "Make" was removed
474-
OIIO_CHECK_EQUAL( spec.find_attribute( "Make" ), nullptr );
475-
}
476-
477458
/// Tests fix_metadata when destination already exists (should not overwrite or remove source)
478459
void test_fix_metadata_destination_exists()
479460
{
@@ -511,15 +492,15 @@ void test_fix_metadata_source_missing()
511492
OIIO_CHECK_EQUAL( spec.find_attribute( "cameraModel" ), nullptr );
512493
}
513494

514-
/// Tests fix_metadata with non-string, non-float attributes (should be ignored)
495+
/// Tests fix_metadata with non-string (should be ignored)
515496
void test_fix_metadata_unsupported_type()
516497
{
517498
std::cout << std::endl
518499
<< "test_fix_metadata_unsupported_type()" << std::endl;
519500
OIIO::ImageSpec spec;
520501

521502
// Add integer attribute (this should be ignored by fix_metadata)
522-
spec["Make"] = 42; // Integer, not string or float
503+
spec["Make"] = 42; // Integer, not string
523504

524505
// Call fix_metadata
525506
fix_metadata( spec );
@@ -552,8 +533,6 @@ int main( int, char ** )
552533

553534
// Tests for fix_metadata
554535
test_fix_metadata_both_attributes();
555-
test_fix_metadata_float_make();
556-
test_fix_metadata_float_make();
557536
test_fix_metadata_destination_exists();
558537
test_fix_metadata_source_missing();
559538
test_fix_metadata_source_missing();

0 commit comments

Comments
 (0)