ソースを参照

LibKeyboard: Read keymap through File, not DeprecatedFile

This results in a new OOM prevention. Hooray!
Ben Wiederhake 2 年 前
コミット
97e60f2c7d
1 ファイル変更3 行追加3 行削除
  1. 3 3
      Userland/Libraries/LibKeyboard/CharacterMapFile.cpp

+ 3 - 3
Userland/Libraries/LibKeyboard/CharacterMapFile.cpp

@@ -7,7 +7,7 @@
 #include "CharacterMapFile.h"
 #include <AK/ByteBuffer.h>
 #include <AK/Utf8View.h>
-#include <LibCore/DeprecatedFile.h>
+#include <LibCore/File.h>
 
 namespace Keyboard {
 
@@ -22,8 +22,8 @@ ErrorOr<CharacterMapData> CharacterMapFile::load_from_file(DeprecatedString cons
         path = full_path.to_deprecated_string();
     }
 
-    auto file = TRY(Core::DeprecatedFile::open(path, Core::OpenMode::ReadOnly));
-    auto file_contents = file->read_all();
+    auto file = TRY(Core::File::open(path, Core::File::OpenMode::Read));
+    auto file_contents = TRY(file->read_until_eof());
     auto json_result = TRY(JsonValue::from_string(file_contents));
     auto const& json = json_result.as_object();