From 129f2e421e16bd008cdca8713cc91f67d103d94e Mon Sep 17 00:00:00 2001 From: Mel Date: Fri, 7 Jul 2023 23:05:14 +0200 Subject: Fix minor quality issues --- src/GFX/Image/PPMParser.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/GFX/Image/PPMParser.cpp') diff --git a/src/GFX/Image/PPMParser.cpp b/src/GFX/Image/PPMParser.cpp index cf1bf77..f002db8 100644 --- a/src/GFX/Image/PPMParser.cpp +++ b/src/GFX/Image/PPMParser.cpp @@ -66,7 +66,7 @@ RawImage::Pixel PPMParser::parse_pixel(uint8_t max_color) { throw std::runtime_error("Sample can not be greater than Maxval."); } - auto map_to_range = [=](uint64_t s) -> uint8_t { return (s * 255) / max_color; }; + auto map_to_range = [=](uint64_t s) -> uint8_t { return s * 255 / max_color; }; RawImage::Pixel pixel{}; pixel.r = map_to_range(r_sample); @@ -120,9 +120,8 @@ std::string_view PPMParser::chomp_part() { } void PPMParser::skip_whitespace() { - uint8_t c; while (!is_eof()) { - c = m_source[m_cursor]; + uint8_t c = m_source[m_cursor]; if (c == '#') { skip_comment(); continue; @@ -147,7 +146,7 @@ void PPMParser::skip_comment() { } } -bool PPMParser::is_eof() { +bool PPMParser::is_eof() const { return m_cursor >= m_source.size(); } -- cgit 1.4.1