mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +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)
|
bool FileSystemPath::canonicalize(bool resolveSymbolicLinks)
|
||||||
{
|
{
|
||||||
// FIXME: Implement "resolveSymbolicLinks"
|
// FIXME: Implement "resolveSymbolicLinks"
|
||||||
|
(void) resolveSymbolicLinks;
|
||||||
auto parts = m_string.split('/');
|
auto parts = m_string.split('/');
|
||||||
Vector<String> canonicalParts;
|
Vector<String> canonicalParts;
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ struct SC_mmap_params {
|
||||||
int32_t prot;
|
int32_t prot;
|
||||||
int32_t flags;
|
int32_t flags;
|
||||||
int32_t fd;
|
int32_t fd;
|
||||||
uint32_t offset; // FIXME: 64-bit off_t?
|
int32_t offset; // FIXME: 64-bit off_t?
|
||||||
};
|
};
|
||||||
|
|
||||||
void initialize();
|
void initialize();
|
||||||
|
|
|
@ -91,7 +91,7 @@ int getopt(int nargc, char* const nargv[], const char* ostr)
|
||||||
}
|
}
|
||||||
else { /* need an argument */
|
else { /* need an argument */
|
||||||
if (*place) /* no white space */
|
if (*place) /* no white space */
|
||||||
optarg = (char*)place;
|
optarg = const_cast<char*>(place);
|
||||||
else if (nargc <= ++optind) { /* no arg */
|
else if (nargc <= ++optind) { /* no arg */
|
||||||
place = EMSG;
|
place = EMSG;
|
||||||
if (*ostr == ':')
|
if (*ostr == ':')
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
struct mntent* getmntent(FILE* stream)
|
struct mntent* getmntent(FILE*)
|
||||||
{
|
{
|
||||||
assert(false);
|
assert(false);
|
||||||
return nullptr;
|
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 (base == 16 && (q = strchr(p, '.')) != 0) {
|
||||||
if (q - p > sizeof(tmp) - 1)
|
if (q - p > (int)sizeof(tmp) - 1)
|
||||||
return 0;
|
return 0;
|
||||||
strncpy(tmp, p, q - p);
|
strncpy(tmp, p, q - p);
|
||||||
tmp[q - p] = '\0';
|
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)
|
static int vsscanf(const char *buf, const char *s, va_list ap)
|
||||||
{
|
{
|
||||||
int base;
|
int base = 10;
|
||||||
char *t;
|
char *t;
|
||||||
char tmp[MAXLN];
|
char tmp[MAXLN];
|
||||||
bool noassign = false;
|
bool noassign = false;
|
||||||
bool lflag = false;
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int width = 0;
|
int width = 0;
|
||||||
|
|
||||||
|
@ -182,8 +181,6 @@ static int vsscanf(const char *buf, const char *s, va_list ap)
|
||||||
break;
|
break;
|
||||||
if (*s == '*')
|
if (*s == '*')
|
||||||
noassign = true;
|
noassign = true;
|
||||||
else if (*s == 'l' || *s == 'L')
|
|
||||||
lflag = true;
|
|
||||||
else if (*s >= '1' && *s <= '9') {
|
else if (*s >= '1' && *s <= '9') {
|
||||||
const char* tc;
|
const char* tc;
|
||||||
for (tc = s; isdigit(*s); s++);
|
for (tc = s; isdigit(*s); s++);
|
||||||
|
@ -238,7 +235,6 @@ static int vsscanf(const char *buf, const char *s, va_list ap)
|
||||||
++count;
|
++count;
|
||||||
width = 0;
|
width = 0;
|
||||||
noassign = false;
|
noassign = false;
|
||||||
lflag = false;
|
|
||||||
++s;
|
++s;
|
||||||
} else {
|
} else {
|
||||||
while (isspace(*buf))
|
while (isspace(*buf))
|
||||||
|
|
|
@ -49,12 +49,14 @@ void free(void* ptr)
|
||||||
|
|
||||||
void* calloc(size_t nmemb, size_t)
|
void* calloc(size_t nmemb, size_t)
|
||||||
{
|
{
|
||||||
|
(void) nmemb;
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* realloc(void *ptr, size_t)
|
void* realloc(void *ptr, size_t)
|
||||||
{
|
{
|
||||||
|
(void) ptr;
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -62,6 +64,7 @@ void* realloc(void *ptr, size_t)
|
||||||
void exit(int status)
|
void exit(int status)
|
||||||
{
|
{
|
||||||
Syscall::invoke(Syscall::SC_exit, (dword)status);
|
Syscall::invoke(Syscall::SC_exit, (dword)status);
|
||||||
|
for (;;);
|
||||||
}
|
}
|
||||||
|
|
||||||
void abort()
|
void abort()
|
||||||
|
@ -91,7 +94,7 @@ char* getenv(const char* name)
|
||||||
|
|
||||||
int atoi(const char* str)
|
int atoi(const char* str)
|
||||||
{
|
{
|
||||||
ssize_t len = strlen(str);
|
size_t len = strlen(str);
|
||||||
int value = 0;
|
int value = 0;
|
||||||
bool isNegative = false;
|
bool isNegative = false;
|
||||||
for (size_t i = 0; i < len; ++i) {
|
for (size_t i = 0; i < len; ++i) {
|
||||||
|
|
|
@ -119,7 +119,7 @@ char* strchr(const char* str, int c)
|
||||||
char ch = c;
|
char ch = c;
|
||||||
for (;; ++str) {
|
for (;; ++str) {
|
||||||
if (*str == ch)
|
if (*str == ch)
|
||||||
return (char*)str;
|
return const_cast<char*>(str);
|
||||||
if (!*str)
|
if (!*str)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ char* strrchr(const char* str, int ch)
|
||||||
char c;
|
char c;
|
||||||
for (; (c = *str); ++str) {
|
for (; (c = *str); ++str) {
|
||||||
if (c == ch)
|
if (c == ch)
|
||||||
last = (char*)str;
|
last = const_cast<char*>(str);
|
||||||
}
|
}
|
||||||
return last;
|
return last;
|
||||||
}
|
}
|
||||||
|
@ -168,18 +168,18 @@ char* strerror(int errnum)
|
||||||
{
|
{
|
||||||
if (errnum >= __errno_count) {
|
if (errnum >= __errno_count) {
|
||||||
printf("strerror() missing string for errnum=%d\n", errnum);
|
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)
|
char* strsignal(int signum)
|
||||||
{
|
{
|
||||||
if (signum >= __signal_count) {
|
if (signum >= __signal_count) {
|
||||||
printf("strsignal() missing string for signum=%d\n", signum);
|
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;
|
struct timezone tz;
|
||||||
if (gettimeofday(&tv, &tz) < 0)
|
if (gettimeofday(&tv, &tz) < 0)
|
||||||
return (time_t)-1;
|
return (time_t)-1;
|
||||||
|
if (tloc)
|
||||||
|
*tloc = tv.tv_sec;
|
||||||
return tv.tv_sec;
|
return tv.tv_sec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
typedef struct timezone {
|
struct timezone {
|
||||||
int tz_minuteswest;
|
int tz_minuteswest;
|
||||||
int tz_dsttime;
|
int tz_dsttime;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue