1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:48:11 +00:00

Replace various copies of parse_uint(String) with String::to_uint().

This commit is contained in:
Andreas Kling 2019-05-08 19:21:51 +02:00
parent cea631d90c
commit b5b44a29bb
4 changed files with 6 additions and 70 deletions

View file

@ -128,21 +128,6 @@ inline bool is_valid_final_character(byte ch)
return ch >= 0x40 && ch <= 0x7e;
}
unsigned parse_uint(const String& str, bool& ok)
{
unsigned value = 0;
for (int i = 0; i < str.length(); ++i) {
if (str[i] < '0' || str[i] > '9') {
ok = false;
return 0;
}
value = value * 10;
value += str[i] - '0';
}
ok = true;
return value;
}
enum class VGAColor : byte {
Black = 0,
Blue,
@ -324,7 +309,7 @@ void VirtualConsole::execute_escape_sequence(byte final)
Vector<unsigned> params;
for (auto& parampart : paramparts) {
bool ok;
unsigned value = parse_uint(parampart, ok);
unsigned value = parampart.to_uint(ok);
if (!ok) {
// FIXME: Should we do something else?
return;