1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:57:45 +00:00

LibGfx: Use Core::System::open() in Gfx::Bitmap :^)

This commit is contained in:
Andreas Kling 2021-11-23 12:02:43 +01:00
parent 0ed5f84bd9
commit adb9b86807

View file

@ -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);
}