summaryrefslogtreecommitdiff
path: root/Applications/Terminal/Terminal.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-05-08 19:21:51 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-05-08 19:21:51 +0200
commitb5b44a29bbfbf83e348ab0007d04039fb252bbe5 (patch)
tree4138c5d79961cf8d5582bdb46ca712ac1f246b9b /Applications/Terminal/Terminal.cpp
parentcea631d90c4808b3d161fa25bbf09af65a72ef62 (diff)
downloadserenity-b5b44a29bbfbf83e348ab0007d04039fb252bbe5.zip
Replace various copies of parse_uint(String) with String::to_uint().
Diffstat (limited to 'Applications/Terminal/Terminal.cpp')
-rw-r--r--Applications/Terminal/Terminal.cpp19
1 files changed, 2 insertions, 17 deletions
diff --git a/Applications/Terminal/Terminal.cpp b/Applications/Terminal/Terminal.cpp
index 3e628deb8d..8c68c4e241 100644
--- a/Applications/Terminal/Terminal.cpp
+++ b/Applications/Terminal/Terminal.cpp
@@ -116,21 +116,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;
-}
-
static inline Color lookup_color(unsigned color)
{
return Color::from_rgb(xterm_colors[color]);
@@ -397,7 +382,7 @@ void Terminal::execute_xterm_command()
{
m_final = '@';
bool ok;
- unsigned value = parse_uint(String::copy(m_xterm_param1), ok);
+ unsigned value = String::copy(m_xterm_param1).to_uint(ok);
if (ok) {
switch (value) {
case 0:
@@ -421,7 +406,7 @@ void Terminal::execute_escape_sequence(byte final)
ParamVector params;
for (auto& parampart : paramparts) {
bool ok;
- unsigned value = parse_uint(parampart, ok);
+ unsigned value = parampart.to_uint(ok);
if (!ok) {
m_parameters.clear_with_capacity();
m_intermediates.clear_with_capacity();