mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:58:11 +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
|
@ -1085,11 +1085,11 @@ bool ProcFSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntry&)
|
|||
if (!entry.name)
|
||||
continue;
|
||||
if (entry.proc_file_type > __FI_Root_Start && entry.proc_file_type < __FI_Root_End)
|
||||
callback({ entry.name, (int)strlen(entry.name), to_identifier(fsid(), PDI_Root, 0, (ProcFileType)entry.proc_file_type), 0 });
|
||||
callback({ entry.name, strlen(entry.name), to_identifier(fsid(), PDI_Root, 0, (ProcFileType)entry.proc_file_type), 0 });
|
||||
}
|
||||
for (auto pid_child : Process::all_pids()) {
|
||||
char name[16];
|
||||
int name_length = sprintf(name, "%u", pid_child);
|
||||
size_t name_length = (size_t)sprintf(name, "%u", pid_child);
|
||||
callback({ name, name_length, to_identifier(fsid(), PDI_Root, pid_child, FI_PID), 0 });
|
||||
}
|
||||
break;
|
||||
|
@ -1119,7 +1119,7 @@ bool ProcFSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntry&)
|
|||
if (entry.proc_file_type == FI_PID_exe && !process.executable())
|
||||
continue;
|
||||
// FIXME: strlen() here is sad.
|
||||
callback({ entry.name, (int)strlen(entry.name), to_identifier(fsid(), PDI_PID, pid, (ProcFileType)entry.proc_file_type), 0 });
|
||||
callback({ entry.name, strlen(entry.name), to_identifier(fsid(), PDI_PID, pid, (ProcFileType)entry.proc_file_type), 0 });
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
@ -1134,7 +1134,7 @@ bool ProcFSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntry&)
|
|||
if (!description)
|
||||
continue;
|
||||
char name[16];
|
||||
int name_length = sprintf(name, "%u", i);
|
||||
size_t name_length = (size_t)sprintf(name, "%u", i);
|
||||
callback({ name, name_length, to_identifier_with_fd(fsid(), pid, i), 0 });
|
||||
}
|
||||
} break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue