From 49ed168cedd2ca544a7d676cb3d7bb1f0197c6de Mon Sep 17 00:00:00 2001 From: Sahan Fernando Date: Wed, 8 Dec 2021 10:56:50 +1100 Subject: [PATCH] Userland: Use File::lines() range-based for loop where appropriate --- Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp | 4 +--- Userland/Applications/PixelPaint/PaletteWidget.cpp | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp b/Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp index 4ef2a87c13..ae239544e5 100644 --- a/Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp +++ b/Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp @@ -20,9 +20,7 @@ RefPtr WavefrontOBJLoader::load(Core::File& file) dbgln("Wavefront: Loading {}...", file.name()); // Start reading file line by line - for (auto line = file.line_begin(); !line.at_end(); ++line) { - auto object_line = *line; - + for (auto object_line : file.lines()) { // Ignore file comments if (object_line.starts_with("#")) continue; diff --git a/Userland/Applications/PixelPaint/PaletteWidget.cpp b/Userland/Applications/PixelPaint/PaletteWidget.cpp index d5adcf290c..688f71df3b 100644 --- a/Userland/Applications/PixelPaint/PaletteWidget.cpp +++ b/Userland/Applications/PixelPaint/PaletteWidget.cpp @@ -228,8 +228,7 @@ Result, String> PaletteWidget::load_palette_file(Core::File& file) { Vector palette; - while (file.can_read_line()) { - auto line = file.read_line(); + for (auto line : file.lines()) { if (line.is_whitespace()) continue;