diff --git a/AK/FileSystemPath.cpp b/AK/FileSystemPath.cpp index ab00a61c3c4..8c5ffb49325 100644 --- a/AK/FileSystemPath.cpp +++ b/AK/FileSystemPath.cpp @@ -14,6 +14,7 @@ FileSystemPath::FileSystemPath(const String& s) bool FileSystemPath::canonicalize(bool resolveSymbolicLinks) { // FIXME: Implement "resolveSymbolicLinks" + (void) resolveSymbolicLinks; auto parts = m_string.split('/'); Vector canonicalParts; diff --git a/Kernel/Syscall.h b/Kernel/Syscall.h index 40f952bdbd8..c680cd0a31b 100644 --- a/Kernel/Syscall.h +++ b/Kernel/Syscall.h @@ -88,7 +88,7 @@ struct SC_mmap_params { int32_t prot; int32_t flags; int32_t fd; - uint32_t offset; // FIXME: 64-bit off_t? + int32_t offset; // FIXME: 64-bit off_t? }; void initialize(); diff --git a/LibC/getopt.cpp b/LibC/getopt.cpp index 76b5e688de5..c7c6afa637c 100644 --- a/LibC/getopt.cpp +++ b/LibC/getopt.cpp @@ -91,7 +91,7 @@ int getopt(int nargc, char* const nargv[], const char* ostr) } else { /* need an argument */ if (*place) /* no white space */ - optarg = (char*)place; + optarg = const_cast(place); else if (nargc <= ++optind) { /* no arg */ place = EMSG; if (*ostr == ':') diff --git a/LibC/mntent.cpp b/LibC/mntent.cpp index 6c57801abaa..792a0f71568 100644 --- a/LibC/mntent.cpp +++ b/LibC/mntent.cpp @@ -3,7 +3,7 @@ extern "C" { -struct mntent* getmntent(FILE* stream) +struct mntent* getmntent(FILE*) { assert(false); return nullptr; diff --git a/LibC/scanf.cpp b/LibC/scanf.cpp index b9b4726b7b9..913dbb21eff 100644 --- a/LibC/scanf.cpp +++ b/LibC/scanf.cpp @@ -71,7 +71,7 @@ static int _atob(unsigned long* vp, const char* p, int base) } if (base == 16 && (q = strchr(p, '.')) != 0) { - if (q - p > sizeof(tmp) - 1) + if (q - p > (int)sizeof(tmp) - 1) return 0; strncpy(tmp, p, q - p); tmp[q - p] = '\0'; @@ -164,11 +164,10 @@ static int vfscanf(FILE *fp, const char* fmt, va_list ap) static int vsscanf(const char *buf, const char *s, va_list ap) { - int base; + int base = 10; char *t; char tmp[MAXLN]; bool noassign = false; - bool lflag = false; int count = 0; int width = 0; @@ -182,8 +181,6 @@ static int vsscanf(const char *buf, const char *s, va_list ap) break; if (*s == '*') noassign = true; - else if (*s == 'l' || *s == 'L') - lflag = true; else if (*s >= '1' && *s <= '9') { const char* tc; for (tc = s; isdigit(*s); s++); @@ -238,7 +235,6 @@ static int vsscanf(const char *buf, const char *s, va_list ap) ++count; width = 0; noassign = false; - lflag = false; ++s; } else { while (isspace(*buf)) diff --git a/LibC/stdlib.cpp b/LibC/stdlib.cpp index 342ab92e2f8..63583ab77ba 100644 --- a/LibC/stdlib.cpp +++ b/LibC/stdlib.cpp @@ -49,12 +49,14 @@ void free(void* ptr) void* calloc(size_t nmemb, size_t) { + (void) nmemb; ASSERT_NOT_REACHED(); return nullptr; } void* realloc(void *ptr, size_t) { + (void) ptr; ASSERT_NOT_REACHED(); return nullptr; } @@ -62,6 +64,7 @@ void* realloc(void *ptr, size_t) void exit(int status) { Syscall::invoke(Syscall::SC_exit, (dword)status); + for (;;); } void abort() @@ -91,7 +94,7 @@ char* getenv(const char* name) int atoi(const char* str) { - ssize_t len = strlen(str); + size_t len = strlen(str); int value = 0; bool isNegative = false; for (size_t i = 0; i < len; ++i) { diff --git a/LibC/string.cpp b/LibC/string.cpp index e905248ed0c..e840f28e9d8 100644 --- a/LibC/string.cpp +++ b/LibC/string.cpp @@ -119,7 +119,7 @@ char* strchr(const char* str, int c) char ch = c; for (;; ++str) { if (*str == ch) - return (char*)str; + return const_cast(str); if (!*str) return nullptr; } @@ -131,7 +131,7 @@ char* strrchr(const char* str, int ch) char c; for (; (c = *str); ++str) { if (c == ch) - last = (char*)str; + last = const_cast(str); } return last; } @@ -168,18 +168,18 @@ char* strerror(int errnum) { if (errnum >= __errno_count) { printf("strerror() missing string for errnum=%d\n", errnum); - return "Unknown error"; + return const_cast("Unknown error"); } - return (char*)sys_errlist[errnum]; + return const_cast(sys_errlist[errnum]); } char* strsignal(int signum) { if (signum >= __signal_count) { printf("strsignal() missing string for signum=%d\n", signum); - return "Unknown signal"; + return const_cast("Unknown signal"); } - return (char*)sys_siglist[signum]; + return const_cast(sys_siglist[signum]); } } diff --git a/LibC/time.cpp b/LibC/time.cpp index b1bee005573..eedac5422c5 100644 --- a/LibC/time.cpp +++ b/LibC/time.cpp @@ -10,6 +10,8 @@ time_t time(time_t* tloc) struct timezone tz; if (gettimeofday(&tv, &tz) < 0) return (time_t)-1; + if (tloc) + *tloc = tv.tv_sec; return tv.tv_sec; } diff --git a/LibC/time.h b/LibC/time.h index c1b61b574a4..38a1fb21e89 100644 --- a/LibC/time.h +++ b/LibC/time.h @@ -5,7 +5,7 @@ __BEGIN_DECLS -typedef struct timezone { +struct timezone { int tz_minuteswest; int tz_dsttime; };