Skip to content

Commit

Permalink
Simplify return statements with brace-enclosed initializer
Browse files Browse the repository at this point in the history
Simplified the return statements in two conditional blocks by removing the explicit type `libCZI::IntPointAndFrameOfReference` and using the brace-enclosed initializer list directly. This change makes the code more concise and leverages the compiler's ability to deduce the return type.
  • Loading branch information
ptahmose committed Dec 12, 2024
1 parent f4023d4 commit 826e36c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Src/libCZI/CZIReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@ CCZIReader::CCZIReader() : isOperational(false), default_frame_of_reference(CZIF
destination_frame_of_reference_consolidated == CZIFrameOfReference::RawSubBlockCoordinateSystem)
{
const auto& statistics = this->subBlkDir.GetStatistics();
return libCZI::IntPointAndFrameOfReference{ CZIFrameOfReference::RawSubBlockCoordinateSystem, {source_point.point.x + statistics.boundingBoxLayer0Only.x, source_point.point.y + statistics.boundingBoxLayer0Only.y} };
return { CZIFrameOfReference::RawSubBlockCoordinateSystem, {source_point.point.x + statistics.boundingBoxLayer0Only.x, source_point.point.y + statistics.boundingBoxLayer0Only.y} };
}

if (source_frame_of_reference_consolidated == CZIFrameOfReference::RawSubBlockCoordinateSystem &&
destination_frame_of_reference_consolidated == CZIFrameOfReference::PixelCoordinateSystem)
{
const auto& statistics = this->subBlkDir.GetStatistics();
return libCZI::IntPointAndFrameOfReference{ CZIFrameOfReference::PixelCoordinateSystem, {source_point.point.x - statistics.boundingBoxLayer0Only.x, source_point.point.y - statistics.boundingBoxLayer0Only.y} };
return { CZIFrameOfReference::PixelCoordinateSystem, {source_point.point.x - statistics.boundingBoxLayer0Only.x, source_point.point.y - statistics.boundingBoxLayer0Only.y} };
}

throw logic_error("Unsupported frame-of-reference transformation.");

Check warning on line 159 in Src/libCZI/CZIReader.cpp

View check run for this annotation

Codecov / codecov/patch

Src/libCZI/CZIReader.cpp#L159

Added line #L159 was not covered by tests
Expand Down

0 comments on commit 826e36c

Please sign in to comment.