1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 13:47:35 +00:00

Keymap: Clean up source a bit

This commit is contained in:
Jami Kettunen 2019-12-30 02:53:02 +02:00 committed by Andreas Kling
parent a1f2a7eaa8
commit 0b3f1e70ca

View file

@ -16,8 +16,7 @@ char* read_map(const JsonObject& json, const String& name)
char* map = new char[80]; char* map = new char[80];
auto map_arr = json.get(name).as_array(); auto map_arr = json.get(name).as_array();
for(int i=0; i<map_arr.size(); i++) for (int i = 0; i < map_arr.size(); i++) {
{
auto key_value = map_arr.at(i).as_string(); auto key_value = map_arr.at(i).as_string();
char character = 0; char character = 0;
if (key_value.length() == 0) { if (key_value.length() == 0) {
@ -41,7 +40,8 @@ char* read_map(const JsonObject& json, const String& name)
return map; return map;
} }
int read_map_from_file(String filename){ int read_map_from_file(String filename)
{
auto file = CFile::construct(filename); auto file = CFile::construct(filename);
if (!file->open(CIODevice::ReadOnly)) { if (!file->open(CIODevice::ReadOnly)) {
fprintf(stderr, "Failed to open %s: %s\n", filename.characters(), file->error_string()); fprintf(stderr, "Failed to open %s: %s\n", filename.characters(), file->error_string());