summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-03-01 12:35:09 +0100
committerAndreas Kling <kling@serenityos.org>2020-03-01 12:58:22 +0100
commit22d0a6d92f9e5a93b248eef0609d40ecb332f869 (patch)
tree6ec543d38dbeda281c6719ae5cc33ef3eb47c496 /AK
parentfee20bd8de0f9c4222f7123f5c6ea31f00221d7b (diff)
downloadserenity-22d0a6d92f9e5a93b248eef0609d40ecb332f869.zip
AK: Remove unnecessary casts to size_t, after Vector changes
Now that Vector uses size_t, we can remove a whole bunch of redundant casts to size_t.
Diffstat (limited to 'AK')
-rw-r--r--AK/JsonParser.cpp2
-rw-r--r--AK/String.cpp2
-rw-r--r--AK/StringBuilder.cpp4
-rw-r--r--AK/StringView.cpp2
4 files changed, 5 insertions, 5 deletions
diff --git a/AK/JsonParser.cpp b/AK/JsonParser.cpp
index 2f21e3b04b..b99bb91bd5 100644
--- a/AK/JsonParser.cpp
+++ b/AK/JsonParser.cpp
@@ -130,7 +130,7 @@ String JsonParser::consume_quoted_string()
return String::empty();
auto& last_string_starting_with_character = m_last_string_starting_with_character[(u8)buffer.first()];
- if (last_string_starting_with_character.length() == (size_t)buffer.size()) {
+ if (last_string_starting_with_character.length() == buffer.size()) {
if (!memcmp(last_string_starting_with_character.characters(), buffer.data(), buffer.size()))
return last_string_starting_with_character;
}
diff --git a/AK/String.cpp b/AK/String.cpp
index 980b346867..131ba9e70f 100644
--- a/AK/String.cpp
+++ b/AK/String.cpp
@@ -143,7 +143,7 @@ Vector<String> String::split_limit(char separator, size_t limit, bool keep_empty
Vector<String> v;
size_t substart = 0;
- for (size_t i = 0; i < length() && ((size_t)v.size() + 1) != limit; ++i) {
+ for (size_t i = 0; i < length() && (v.size() + 1) != limit; ++i) {
char ch = characters()[i];
if (ch == separator) {
size_t sublen = i - substart;
diff --git a/AK/StringBuilder.cpp b/AK/StringBuilder.cpp
index da97a970c8..28f89098f5 100644
--- a/AK/StringBuilder.cpp
+++ b/AK/StringBuilder.cpp
@@ -33,8 +33,8 @@ namespace AK {
inline void StringBuilder::will_append(size_t size)
{
- if ((m_length + size) > (size_t)m_buffer.size())
- m_buffer.grow(max((size_t)16, (size_t)m_buffer.size() * 2 + size));
+ if ((m_length + size) > m_buffer.size())
+ m_buffer.grow(max(static_cast<size_t>(16), m_buffer.size() * 2 + size));
}
StringBuilder::StringBuilder(size_t initial_capacity)
diff --git a/AK/StringView.cpp b/AK/StringView.cpp
index 6f8af57d10..0dcd8e5b54 100644
--- a/AK/StringView.cpp
+++ b/AK/StringView.cpp
@@ -40,7 +40,7 @@ StringView::StringView(const String& string)
StringView::StringView(const ByteBuffer& buffer)
: m_characters((const char*)buffer.data())
- , m_length((size_t)buffer.size())
+ , m_length(buffer.size())
{
}