1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-23 18:27:40 +00:00

LibGfx/PortableFormat: Use static_cast instead of C-style casts

This commit is contained in:
Lucas CHOLLET 2023-03-16 20:28:40 -04:00 committed by Andreas Kling
parent fd04b2dc9b
commit fcaa535dec
2 changed files with 2 additions and 2 deletions

View file

@ -39,7 +39,7 @@ ErrorOr<void> read_image_data(PGMLoadingContext& context)
TRY(read_whitespace(context)); TRY(read_whitespace(context));
color_data[i] = { (u8)value, (u8)value, (u8)value }; color_data[i] = { static_cast<u8>(value), static_cast<u8>(value), static_cast<u8>(value) };
} }
} else if (context.type == PGMLoadingContext::Type::RAWBITS) { } else if (context.type == PGMLoadingContext::Type::RAWBITS) {
for (u64 i = 0; i < context_size; ++i) { for (u64 i = 0; i < context_size; ++i) {

View file

@ -29,7 +29,7 @@ ErrorOr<void> read_image_data(PPMLoadingContext& context)
auto const blue = TRY(read_number(stream)); auto const blue = TRY(read_number(stream));
TRY(read_whitespace(context)); TRY(read_whitespace(context));
Color color { (u8)red, (u8)green, (u8)blue }; Color color { static_cast<u8>(red), static_cast<u8>(green), static_cast<u8>(blue) };
if (context.format_details.max_val < 255) if (context.format_details.max_val < 255)
color = adjust_color(context.format_details.max_val, color); color = adjust_color(context.format_details.max_val, color);
color_data[i] = color; color_data[i] = color;