1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 15:27:35 +00:00

AK: Rename the common integer typedefs to make it obvious what they are.

These types can be picked up by including <AK/Types.h>:

* u8, u16, u32, u64 (unsigned)
* i8, i16, i32, i64 (signed)
This commit is contained in:
Andreas Kling 2019-07-03 21:17:35 +02:00
parent c4c4bbc5ba
commit 27f699ef0c
208 changed files with 1603 additions and 1621 deletions

View file

@ -70,14 +70,14 @@ int main(int argc, char** argv)
}
if (mode == ReadFromUninitializedMallocMemory) {
auto* uninitialized_memory = (volatile dword**)malloc(1024);
auto* uninitialized_memory = (volatile u32**)malloc(1024);
volatile auto x = uninitialized_memory[0][0];
(void)x;
ASSERT_NOT_REACHED();
}
if (mode == ReadFromFreedMemory) {
auto* uninitialized_memory = (volatile dword**)malloc(1024);
auto* uninitialized_memory = (volatile u32**)malloc(1024);
free(uninitialized_memory);
volatile auto x = uninitialized_memory[4][0];
(void)x;
@ -85,13 +85,13 @@ int main(int argc, char** argv)
}
if (mode == WriteToUninitializedMallocMemory) {
auto* uninitialized_memory = (volatile dword**)malloc(1024);
auto* uninitialized_memory = (volatile u32**)malloc(1024);
uninitialized_memory[4][0] = 1;
ASSERT_NOT_REACHED();
}
if (mode == WriteToFreedMemory) {
auto* uninitialized_memory = (volatile dword**)malloc(1024);
auto* uninitialized_memory = (volatile u32**)malloc(1024);
free(uninitialized_memory);
uninitialized_memory[4][0] = 1;
ASSERT_NOT_REACHED();

View file

@ -31,10 +31,10 @@ int main(int, char**)
json.for_each([](auto& value) {
auto fs_object = value.as_object();
auto fs = fs_object.get("class_name").to_string();
auto total_block_count = fs_object.get("total_block_count").to_dword();
auto free_block_count = fs_object.get("free_block_count").to_dword();
auto total_inode_count = fs_object.get("total_inode_count").to_dword();
auto free_inode_count = fs_object.get("free_inode_count").to_dword();
auto total_block_count = fs_object.get("total_block_count").to_u32();
auto free_block_count = fs_object.get("free_block_count").to_u32();
auto total_inode_count = fs_object.get("total_inode_count").to_u32();
auto free_inode_count = fs_object.get("free_inode_count").to_u32();
auto mount_point = fs_object.get("mount_point").to_string();
(void)total_inode_count;

View file

@ -54,7 +54,7 @@ int main(int argc, char** argv)
}
for (;;) {
dword call[5];
u32 call[5];
int nread = read(fd, &call, sizeof(call));
if (nread == 0)
break;

View file

@ -30,7 +30,7 @@ struct Process {
struct Snapshot {
HashMap<unsigned, Process> map;
dword sum_nsched { 0 };
u32 sum_nsched { 0 };
};
static Snapshot get_snapshot()
@ -47,19 +47,19 @@ static Snapshot get_snapshot()
auto json = JsonValue::from_string({ file_contents.data(), file_contents.size() });
json.as_array().for_each([&](auto& value) {
const JsonObject& process_object = value.as_object();
pid_t pid = process_object.get("pid").to_dword();
unsigned nsched = process_object.get("times_scheduled").to_dword();
pid_t pid = process_object.get("pid").to_u32();
unsigned nsched = process_object.get("times_scheduled").to_u32();
snapshot.sum_nsched += nsched;
Process process;
process.pid = pid;
process.nsched = nsched;
unsigned uid = process_object.get("uid").to_dword();
unsigned uid = process_object.get("uid").to_u32();
process.user = s_usernames->get(uid);
process.priority = process_object.get("priority").to_string();
process.state = process_object.get("state").to_string();
process.name = process_object.get("name").to_string();
process.virtual_size = process_object.get("amount_virtual").to_dword();
process.physical_size = process_object.get("amount_resident").to_dword();
process.virtual_size = process_object.get("amount_virtual").to_u32();
process.physical_size = process_object.get("amount_resident").to_u32();
snapshot.map.set(pid, move(process));
});
return snapshot;
@ -94,12 +94,12 @@ int main(int, char**)
pid_t pid = it.key;
if (pid == 0)
continue;
dword nsched_now = it.value.nsched;
u32 nsched_now = it.value.nsched;
auto jt = prev.map.find(pid);
if (jt == prev.map.end())
continue;
dword nsched_before = (*jt).value.nsched;
dword nsched_diff = nsched_now - nsched_before;
u32 nsched_before = (*jt).value.nsched;
u32 nsched_diff = nsched_now - nsched_before;
it.value.nsched_since_prev = nsched_diff;
it.value.cpu_percent = ((nsched_diff * 100) / sum_diff);
it.value.cpu_percent_decimal = (((nsched_diff * 1000) / sum_diff) % 10);