From eb08a0edd5159ee36782496f10736521147b575a Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 25 Feb 2021 16:08:02 +0100 Subject: [PATCH] LibC: Make it compile on 64-bit It won't actually work on 64-bit yet, but let's do our future selves a favor and make it compile. --- Userland/Libraries/LibC/mman.cpp | 6 +++--- Userland/Libraries/LibC/netdb.cpp | 2 +- Userland/Libraries/LibC/scanf.cpp | 20 ++++++++++---------- Userland/Libraries/LibC/serenity.cpp | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Userland/Libraries/LibC/mman.cpp b/Userland/Libraries/LibC/mman.cpp index 0f01395ab56..b44c1a68033 100644 --- a/Userland/Libraries/LibC/mman.cpp +++ b/Userland/Libraries/LibC/mman.cpp @@ -35,7 +35,7 @@ extern "C" { void* serenity_mmap(void* addr, size_t size, int prot, int flags, int fd, off_t offset, size_t alignment, const char* name) { Syscall::SC_mmap_params params { (uintptr_t)addr, size, alignment, prot, flags, fd, offset, { name, name ? strlen(name) : 0 } }; - ssize_t rc = syscall(SC_mmap, ¶ms); + ptrdiff_t rc = syscall(SC_mmap, ¶ms); if (rc < 0 && -rc < EMAXERRNO) { errno = -rc; return MAP_FAILED; @@ -56,7 +56,7 @@ void* mmap_with_name(void* addr, size_t size, int prot, int flags, int fd, off_t void* mremap(void* old_address, size_t old_size, size_t new_size, int flags) { Syscall::SC_mremap_params params { (uintptr_t)old_address, old_size, new_size, flags }; - ssize_t rc = syscall(SC_mremap, ¶ms); + ptrdiff_t rc = syscall(SC_mremap, ¶ms); if (rc < 0 && -rc < EMAXERRNO) { errno = -rc; return MAP_FAILED; @@ -95,7 +95,7 @@ int madvise(void* address, size_t size, int advice) void* allocate_tls(size_t size) { - int rc = syscall(SC_allocate_tls, size); + ptrdiff_t rc = syscall(SC_allocate_tls, size); if (rc < 0 && -rc < EMAXERRNO) { errno = -rc; return MAP_FAILED; diff --git a/Userland/Libraries/LibC/netdb.cpp b/Userland/Libraries/LibC/netdb.cpp index 881e1beffef..2450d0a0e9c 100644 --- a/Userland/Libraries/LibC/netdb.cpp +++ b/Userland/Libraries/LibC/netdb.cpp @@ -132,7 +132,7 @@ hostent* gethostbyname(const char* name) i32 message_id; i32 name_length; } request_header = { - sizeof(request_header) - sizeof(request_header.message_size) + name_length, + (u32)(sizeof(request_header) - sizeof(request_header.message_size) + name_length), lookup_server_endpoint_magic, 1, (i32)name_length, diff --git a/Userland/Libraries/LibC/scanf.cpp b/Userland/Libraries/LibC/scanf.cpp index 7ec13da4eef..13f306d5aa8 100644 --- a/Userland/Libraries/LibC/scanf.cpp +++ b/Userland/Libraries/LibC/scanf.cpp @@ -512,61 +512,61 @@ extern "C" int vsscanf(const char* input, const char* format, va_list ap) dbgln("Invalid conversion specifier {} in scanf!", (int)conversion_specifier); VERIFY_NOT_REACHED(); case Decimal: - if (!read_element {}(length_modifier, input_lexer, &ap)) + if (!read_element {}(length_modifier, input_lexer, (va_list*)&ap)) format_lexer.consume_all(); else ++elements_matched; break; case Integer: - if (!read_element {}(length_modifier, input_lexer, &ap)) + if (!read_element {}(length_modifier, input_lexer, (va_list*)&ap)) format_lexer.consume_all(); else ++elements_matched; break; case Octal: - if (!read_element {}(length_modifier, input_lexer, &ap)) + if (!read_element {}(length_modifier, input_lexer, (va_list*)&ap)) format_lexer.consume_all(); else ++elements_matched; break; case Unsigned: - if (!read_element {}(length_modifier, input_lexer, &ap)) + if (!read_element {}(length_modifier, input_lexer, (va_list*)&ap)) format_lexer.consume_all(); else ++elements_matched; break; case Hex: - if (!read_element {}(length_modifier, input_lexer, &ap)) + if (!read_element {}(length_modifier, input_lexer, (va_list*)&ap)) format_lexer.consume_all(); else ++elements_matched; break; case Floating: - if (!read_element {}(length_modifier, input_lexer, &ap)) + if (!read_element {}(length_modifier, input_lexer, (va_list*)&ap)) format_lexer.consume_all(); else ++elements_matched; break; case String: - if (!read_element {}(length_modifier, input_lexer, &ap)) + if (!read_element {}(length_modifier, input_lexer, (va_list*)&ap)) format_lexer.consume_all(); else ++elements_matched; break; case UseScanList: - if (!read_element { scanlist, invert_scanlist }(length_modifier, input_lexer, &ap)) + if (!read_element { scanlist, invert_scanlist }(length_modifier, input_lexer, (va_list*)&ap)) format_lexer.consume_all(); else ++elements_matched; break; case Character: - if (!read_element {}(length_modifier, input_lexer, &ap)) + if (!read_element {}(length_modifier, input_lexer, (va_list*)&ap)) format_lexer.consume_all(); else ++elements_matched; break; case Pointer: - if (!read_element {}(length_modifier, input_lexer, &ap)) + if (!read_element {}(length_modifier, input_lexer, (va_list*)&ap)) format_lexer.consume_all(); else ++elements_matched; diff --git a/Userland/Libraries/LibC/serenity.cpp b/Userland/Libraries/LibC/serenity.cpp index 8899a2b7df7..1cf5f5f68f1 100644 --- a/Userland/Libraries/LibC/serenity.cpp +++ b/Userland/Libraries/LibC/serenity.cpp @@ -73,7 +73,7 @@ int futex(uint32_t* userspace_address, int futex_op, uint32_t value, const struc .userspace_address = userspace_address, .futex_op = futex_op, .val = value, - .val2 = (uint32_t)timeout, + .val2 = (FlatPtr)timeout, .userspace_address2 = userspace_address2, .val3 = value3 };