1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 05:54:58 +00:00

AK: Use size_t for the length of strings

Using int was a mistake. This patch changes String, StringImpl,
StringView and StringBuilder to use size_t instead of int for lengths.
Obviously a lot of code needs to change as a result of this.
This commit is contained in:
Andreas Kling 2019-12-09 17:45:40 +01:00
parent 1726c17d0d
commit 6f4c380d95
54 changed files with 387 additions and 377 deletions

View file

@ -47,7 +47,7 @@ String JsonParser::consume_quoted_string()
Vector<char, 1024> buffer;
for (;;) {
int peek_index = m_index;
size_t peek_index = m_index;
char ch = 0;
for (;;) {
if (peek_index == m_input.length())
@ -104,7 +104,7 @@ String JsonParser::consume_quoted_string()
return String::empty();
auto& last_string_starting_with_character = m_last_string_starting_with_character[(int)buffer.first()];
if (last_string_starting_with_character.length() == buffer.size()) {
if (last_string_starting_with_character.length() == (size_t)buffer.size()) {
if (!memcmp(last_string_starting_with_character.characters(), buffer.data(), buffer.size()))
return last_string_starting_with_character;
}