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

Do a pass of compiler warning fixes.

This is really making me question not using 64-bit integers more.
This commit is contained in:
Andreas Kling 2019-04-23 13:00:53 +02:00
parent 243e1d8462
commit 58240fdb33
21 changed files with 89 additions and 84 deletions

View file

@ -9,6 +9,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <AK/printf.cpp>
#include <AK/StdLibExtras.h>
#include <Kernel/Syscall.h>
extern "C" {
@ -405,6 +406,7 @@ FILE* freopen(const char* pathname, const char* mode, FILE* stream)
FILE* fdopen(int fd, const char* mode)
{
UNUSED_PARAM(mode);
// FIXME: Verify that the mode matches how fd is already open.
if (fd < 0)
return nullptr;

View file

@ -133,7 +133,7 @@ void free(void* ptr)
return;
}
for (unsigned i = header->first_chunk_index; i < (header->first_chunk_index + header->chunk_count); ++i)
for (int i = header->first_chunk_index; i < (header->first_chunk_index + header->chunk_count); ++i)
s_malloc_map[i / 8] &= ~(1 << (i % 8));
s_malloc_sum_alloc -= header->chunk_count * CHUNK_SIZE;
@ -473,7 +473,7 @@ long strtol(const char* str, char** endptr, int base)
} else if (neg)
acc = -acc;
if (endptr)
*endptr = (char*)(any ? s - 1 : str);
*endptr = const_cast<char*>((any ? s - 1 : str));
return acc;
}

View file

@ -202,10 +202,10 @@ char* strchr(const char* str, int c)
void* memchr(const void* ptr, int c, size_t size)
{
char ch = c;
char* cptr = (char*)ptr;
auto* cptr = (const char*)ptr;
for (size_t i = 0; i < size; ++i) {
if (cptr[i] == ch)
return cptr + i;
return const_cast<char*>(cptr + i);
}
return nullptr;
}
@ -358,7 +358,7 @@ char* strpbrk(const char* s, const char* accept)
{
while (*s)
if(strchr(accept, *s++))
return (char*)--s;
return const_cast<char*>(--s);
return nullptr;
}

View file

@ -83,7 +83,7 @@ int execl(const char* filename, const char* arg0, ...)
}
va_end(ap);
args.append(nullptr);
return execve(filename, (char* const *)args.data(), environ);
return execve(filename, const_cast<char* const*>(args.data()), environ);
}
uid_t getuid()