1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 14:37:45 +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

@ -101,7 +101,7 @@ void CHttpJob::on_socket_connected()
}
auto name = parts[0];
if (chomped_line.length() < name.length() + 2) {
fprintf(stderr, "CHttpJob: Malformed HTTP header: '%s' (%d)\n", chomped_line.characters(), chomped_line.length());
fprintf(stderr, "CHttpJob: Malformed HTTP header: '%s' (%zu)\n", chomped_line.characters(), chomped_line.length());
return deferred_invoke([this](auto&) { did_fail(CNetworkJob::Error::ProtocolFailed); });
}
auto value = chomped_line.substring(name.length() + 2, chomped_line.length() - name.length() - 2);

View file

@ -19,7 +19,7 @@ HashMap<pid_t, CProcessStatistics> CProcessStatisticsReader::get_all()
HashMap<pid_t, CProcessStatistics> map;
auto file_contents = file->read_all();
auto json = JsonValue::from_string({ file_contents.data(), file_contents.size() });
auto json = JsonValue::from_string({ file_contents.data(), (size_t)file_contents.size() });
json.as_array().for_each([&](auto& value) {
const JsonObject& process_object = value.as_object();
CProcessStatistics process;