diff options
author | Andreas Kling <kling@serenityos.org> | 2021-11-07 11:25:25 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-11-08 00:35:27 +0100 |
commit | c6cc0a88a1452ceb51d515be33623388dc9c7406 (patch) | |
tree | 68380739243c632314fe98c2d392319bace0f121 /Userland/Libraries/LibKeyboard | |
parent | e76b21a66fbcde92dc76ecffd688affd99834130 (diff) | |
download | serenity-c6cc0a88a1452ceb51d515be33623388dc9c7406.zip |
LibKeyboard: Use ErrorOr<T> for CharacterMap::fetch_system_map()
Diffstat (limited to 'Userland/Libraries/LibKeyboard')
-rw-r--r-- | Userland/Libraries/LibKeyboard/CharacterMap.cpp | 7 | ||||
-rw-r--r-- | Userland/Libraries/LibKeyboard/CharacterMap.h | 5 |
2 files changed, 5 insertions, 7 deletions
diff --git a/Userland/Libraries/LibKeyboard/CharacterMap.cpp b/Userland/Libraries/LibKeyboard/CharacterMap.cpp index c2268897b5..d5b76c710b 100644 --- a/Userland/Libraries/LibKeyboard/CharacterMap.cpp +++ b/Userland/Libraries/LibKeyboard/CharacterMap.cpp @@ -40,14 +40,13 @@ int CharacterMap::set_system_map() return setkeymap(m_character_map_name.characters(), m_character_map_data.map, m_character_map_data.shift_map, m_character_map_data.alt_map, m_character_map_data.altgr_map, m_character_map_data.shift_altgr_map); } -Result<CharacterMap, OSError> CharacterMap::fetch_system_map() +ErrorOr<CharacterMap> CharacterMap::fetch_system_map() { CharacterMapData map_data; char keymap_name[50 + 1] = { 0 }; - if (getkeymap(keymap_name, sizeof(keymap_name), map_data.map, map_data.shift_map, map_data.alt_map, map_data.altgr_map, map_data.shift_altgr_map) < 0) { - return OSError(errno); - } + if (getkeymap(keymap_name, sizeof(keymap_name), map_data.map, map_data.shift_map, map_data.alt_map, map_data.altgr_map, map_data.shift_altgr_map) < 0) + return Error::from_errno(errno); return CharacterMap { keymap_name, map_data }; } diff --git a/Userland/Libraries/LibKeyboard/CharacterMap.h b/Userland/Libraries/LibKeyboard/CharacterMap.h index d12c1f4940..b1338953f1 100644 --- a/Userland/Libraries/LibKeyboard/CharacterMap.h +++ b/Userland/Libraries/LibKeyboard/CharacterMap.h @@ -7,8 +7,7 @@ #pragma once #ifndef KERNEL -# include <AK/OSError.h> -# include <AK/Result.h> +# include <AK/Error.h> #endif #include <AK/String.h> #include <Kernel/API/KeyCode.h> @@ -24,7 +23,7 @@ public: #ifndef KERNEL int set_system_map(); - static Result<CharacterMap, OSError> fetch_system_map(); + static ErrorOr<CharacterMap> fetch_system_map(); #endif u32 get_char(KeyEvent) const; |