mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:38:12 +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:
parent
1726c17d0d
commit
6f4c380d95
54 changed files with 387 additions and 377 deletions
|
@ -457,7 +457,7 @@ struct CommandTimer {
|
|||
|
||||
static bool is_glob(const StringView& s)
|
||||
{
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
for (size_t i = 0; i < s.length(); i++) {
|
||||
char c = s.characters_without_null_termination()[i];
|
||||
if (c == '*' || c == '?')
|
||||
return true;
|
||||
|
@ -469,19 +469,19 @@ static Vector<StringView> split_path(const StringView& path)
|
|||
{
|
||||
Vector<StringView> parts;
|
||||
|
||||
ssize_t substart = 0;
|
||||
for (ssize_t i = 0; i < path.length(); i++) {
|
||||
size_t substart = 0;
|
||||
for (size_t i = 0; i < path.length(); i++) {
|
||||
char ch = path.characters_without_null_termination()[i];
|
||||
if (ch != '/')
|
||||
continue;
|
||||
ssize_t sublen = i - substart;
|
||||
size_t sublen = i - substart;
|
||||
if (sublen != 0)
|
||||
parts.append(path.substring_view(substart, sublen));
|
||||
parts.append(path.substring_view(i, 1));
|
||||
substart = i + 1;
|
||||
}
|
||||
|
||||
ssize_t taillen = path.length() - substart;
|
||||
size_t taillen = path.length() - substart;
|
||||
if (taillen != 0)
|
||||
parts.append(path.substring_view(substart, taillen));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue