From 374e6d244f184056d64fd02729a7badf02991e29 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sun, 22 Aug 2021 12:17:43 +0200 Subject: fix almost all compiler warnings --- src/kernel/mem.c | 4 ++-- src/kernel/proc.c | 2 +- src/kernel/syscalls.c | 8 ++++---- src/kernel/vfs/path.c | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/kernel') diff --git a/src/kernel/mem.c b/src/kernel/mem.c index 63f5379..7c1c640 100644 --- a/src/kernel/mem.c +++ b/src/kernel/mem.c @@ -87,8 +87,8 @@ bool virt_user_cpy( struct virt_iter dest_iter, src_iter; size_t min; - virt_iter_new(&dest_iter, dest, length, dest_pages, true, true); - virt_iter_new( &src_iter, src, length, src_pages, true, false); + virt_iter_new(&dest_iter, dest, length, dest_pages, true, true); + virt_iter_new( &src_iter, (void*)src, length, src_pages, true, false); dest_iter.frag_len = 0; src_iter.frag_len = 0; diff --git a/src/kernel/proc.c b/src/kernel/proc.c index eb36caf..bdd92ba 100644 --- a/src/kernel/proc.c +++ b/src/kernel/proc.c @@ -21,7 +21,7 @@ struct process *process_seed() { // map the stack to the last page in memory pagedir_map(proc->pages, (void*)~PAGE_MASK, page_alloc(1), true, true); - proc->stack_top = proc->regs.esp = ~0xF; + proc->stack_top = (void*) (proc->regs.esp = ~0xF); // map the kernel // yup, .text is writeable too. the plan is to not map the kernel diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c index 13d32a2..b6eede6 100644 --- a/src/kernel/syscalls.c +++ b/src/kernel/syscalls.c @@ -26,7 +26,7 @@ _Noreturn static void await_finish(struct process *dead, struct process *listene _Noreturn void _syscall_exit(const char *msg, size_t len) { process_current->state = PS_DEAD; - process_current->saved_addr = msg; + process_current->saved_addr = (void*)msg; // discard const process_current->saved_len = len; if (process_current->parent->state == PS_WAITS4CHILDDEATH) @@ -72,9 +72,9 @@ int _syscall_fork() { int _syscall_debuglog(const char *msg, size_t len) { struct virt_iter iter; - size_t written; + size_t written = 0; - virt_iter_new(&iter, msg, len, process_current->pages, true, false); + virt_iter_new(&iter, (void*)msg, len, process_current->pages, true, false); while (virt_iter_next(&iter)) { tty_write(iter.frag, iter.frag_len); written += iter.frag_len; @@ -87,7 +87,7 @@ int syscall_handler(int num, int a, int b, int c) { case _SYSCALL_EXIT: _syscall_exit((void*)a, b); case _SYSCALL_AWAIT: - return _syscall_await((void*)a, (void*)b); + return _syscall_await((void*)a, b); case _SYSCALL_FORK: return _syscall_fork(); case _SYSCALL_DEBUGLOG: diff --git a/src/kernel/vfs/path.c b/src/kernel/vfs/path.c index dad4373..00af95c 100644 --- a/src/kernel/vfs/path.c +++ b/src/kernel/vfs/path.c @@ -10,12 +10,12 @@ int path_simplify(const char *in, char *out, size_t len) { int out_pos = 0; bool directory = 0; - for (int i = 0; i < len; i += seg_len + 1) { + for (size_t i = 0; i < len; i += seg_len + 1) { assert(in[i] == '/'); seg_len = 0; directory = false; - for (int j = i + 1; j < len; j++) { + for (size_t j = i + 1; j < len; j++) { if (in[j] == '/') { directory = true; break; -- cgit v1.2.3