1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-09 21:51:45 +00:00

fusee: accept spaces inside ini values (we still left/right strip)

This commit is contained in:
Michael Scire 2021-09-06 00:31:56 -07:00 committed by SciresM
parent 4ad300c33c
commit 443271de35

View file

@ -69,7 +69,7 @@ namespace ams::nxboot {
TrailingSpace, TrailingSpace,
}; };
char *sec_start, *key_start, *val_start; char *sec_start, *key_start, *val_start, *val_end;
IniSection *cur_sec = nullptr; IniSection *cur_sec = nullptr;
State state = State::Newline; State state = State::Newline;
@ -144,13 +144,15 @@ namespace ams::nxboot {
state = State::Newline; state = State::Newline;
} else if (!IsWhiteSpace(c)) { } else if (!IsWhiteSpace(c)) {
val_start = buffer + i; val_start = buffer + i;
val_end = buffer + i + 1;
state = State::Value; state = State::Value;
} }
break; break;
case State::Value: case State::Value:
if (IsWhiteSpace(c) || c == '\n') { if (c == '\r' || c == '\n') {
buffer[i] = '\x00'; buffer[i] = '\x00';
*val_end = '\x00';
auto *entry = AllocateObject<IniKeyValueEntry>(); auto *entry = AllocateObject<IniKeyValueEntry>();
entry->key = key_start; entry->key = key_start;
@ -159,6 +161,8 @@ namespace ams::nxboot {
cur_sec->kv_list.push_back(*entry); cur_sec->kv_list.push_back(*entry);
state = (c == '\n') ? State::Newline : State::TrailingSpace; state = (c == '\n') ? State::Newline : State::TrailingSpace;
} else if (c != ' ') {
val_end = buffer + i + 1;
} }
break; break;
case State::TrailingSpace: case State::TrailingSpace: