summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGfx
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-11-23 12:02:43 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-23 12:23:54 +0100
commitadb9b86807a8d7f29d53df18c0db8983566750e1 (patch)
treef81dbe6f06850daa54601c1704404eca35df50f5 /Userland/Libraries/LibGfx
parent0ed5f84bd9575f71cb78b80eed1fb75f287f48de (diff)
downloadserenity-adb9b86807a8d7f29d53df18c0db8983566750e1.zip
LibGfx: Use Core::System::open() in Gfx::Bitmap :^)
Diffstat (limited to 'Userland/Libraries/LibGfx')
-rw-r--r--Userland/Libraries/LibGfx/Bitmap.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/Userland/Libraries/LibGfx/Bitmap.cpp b/Userland/Libraries/LibGfx/Bitmap.cpp
index 32ff60175c..468dfe07c4 100644
--- a/Userland/Libraries/LibGfx/Bitmap.cpp
+++ b/Userland/Libraries/LibGfx/Bitmap.cpp
@@ -13,6 +13,7 @@
#include <AK/String.h>
#include <AK/Try.h>
#include <LibCore/MappedFile.h>
+#include <LibCore/System.h>
#include <LibGfx/Bitmap.h>
#include <LibGfx/ImageDecoder.h>
#include <LibGfx/ShareableBitmap.h>
@@ -113,9 +114,7 @@ ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_load_from_file(String const& path, in
highdpi_icon_path.append(lexical_path.extension());
auto highdpi_icon_string = highdpi_icon_path.to_string();
- int fd = open(highdpi_icon_string.characters(), O_RDONLY);
- if (fd < 0)
- return Error::from_errno(errno);
+ auto fd = TRY(Core::System::open(highdpi_icon_string, O_RDONLY));
auto bitmap = TRY(try_load_from_fd_and_close(fd, highdpi_icon_string));
VERIFY(bitmap->width() % scale_factor == 0);
@@ -126,9 +125,7 @@ ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_load_from_file(String const& path, in
return bitmap;
}
- int fd = open(path.characters(), O_RDONLY);
- if (fd < 0)
- return Error::from_errno(errno);
+ auto fd = TRY(Core::System::open(path, O_RDONLY));
return try_load_from_fd_and_close(fd, path);
}