mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 17:10:23 +00:00
Fix all current build warnings in LibC.
This commit is contained in:
parent
47b7eeda44
commit
e9cdb6bb9b
Notes:
sideshowbarker
2024-07-19 18:31:22 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/e9cdb6bb9bc
9 changed files with 19 additions and 17 deletions
|
@ -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<String> canonicalParts;
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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<char*>(place);
|
||||
else if (nargc <= ++optind) { /* no arg */
|
||||
place = EMSG;
|
||||
if (*ostr == ':')
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
extern "C" {
|
||||
|
||||
struct mntent* getmntent(FILE* stream)
|
||||
struct mntent* getmntent(FILE*)
|
||||
{
|
||||
assert(false);
|
||||
return nullptr;
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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<char*>(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<char*>(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<char*>("Unknown error");
|
||||
}
|
||||
return (char*)sys_errlist[errnum];
|
||||
return const_cast<char*>(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<char*>("Unknown signal");
|
||||
}
|
||||
return (char*)sys_siglist[signum];
|
||||
return const_cast<char*>(sys_siglist[signum]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
__BEGIN_DECLS
|
||||
|
||||
typedef struct timezone {
|
||||
struct timezone {
|
||||
int tz_minuteswest;
|
||||
int tz_dsttime;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue