mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
LibC: Minor changes to make nasm work
* Added some missing macros to headers * Stubbed strftime() time function to not assert * Added "rt" mode to fopen(), working just like "r" or "rb"
This commit is contained in:
parent
aba6e6de6a
commit
c2a8c4cedd
Notes:
sideshowbarker
2024-07-19 11:18:34 +09:00
Author: https://github.com/Mcpg 🔰 Commit: https://github.com/SerenityOS/serenity/commit/c2a8c4cedd8 Pull-request: https://github.com/SerenityOS/serenity/pull/744
@ -101,6 +101,15 @@ typedef __INTMAX_TYPE__ intmax_t;
|
||||
#define UINT_LEAST32_MAX UINT32_MAX
|
||||
#define UINT_LEAST64_MAX UINT64_MAX
|
||||
|
||||
#define INT8_C(x) x
|
||||
#define UINT8_C(x) x
|
||||
|
||||
#define INT16_C(x) x
|
||||
#define UINT16_C(x) x
|
||||
|
||||
#define INT32_C(x) x
|
||||
#define UINT32_C(x) x
|
||||
|
||||
#define INT64_C(x) x##LL
|
||||
#define UINT64_C(x) x##ULL
|
||||
|
||||
|
@ -17,7 +17,9 @@
|
||||
#define PRIx8 "b"
|
||||
#define PRIx16 "w"
|
||||
#define PRIx32 "x"
|
||||
#define PRIX32 "X"
|
||||
#define PRIx64 "llx"
|
||||
#define PRIX64 "llX"
|
||||
|
||||
#define __PRI64_PREFIX "ll"
|
||||
#define __PRIPTR_PREFIX
|
||||
|
@ -437,7 +437,9 @@ void perror(const char* s)
|
||||
FILE* fopen(const char* pathname, const char* mode)
|
||||
{
|
||||
int flags = 0;
|
||||
if (!strcmp(mode, "r") || !strcmp(mode, "rb"))
|
||||
// NOTE: rt is a non-standard mode which opens a file for read, explicitly
|
||||
// specifying that it's a text file
|
||||
if (!strcmp(mode, "r") || !strcmp(mode, "rb") || !strcmp(mode, "rt"))
|
||||
flags = O_RDONLY;
|
||||
else if (!strcmp(mode, "r+") || !strcmp(mode, "rb+"))
|
||||
flags = O_RDWR;
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#define FILENAME_MAX 1024
|
||||
#define BUFSIZ 1024
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/times.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
@ -96,9 +97,11 @@ char* asctime(const struct tm*)
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
size_t strftime(char*, size_t, const char*, const struct tm*)
|
||||
size_t strftime(char* destination, size_t, const char*, const struct tm*)
|
||||
{
|
||||
ASSERT_NOT_REACHED();
|
||||
// FIXME: Stubbed function to make nasm work. Should be properly implemented
|
||||
strcpy(destination, "strftime_unimplemented");
|
||||
return strlen("strftime_unimplemented");
|
||||
}
|
||||
|
||||
long timezone;
|
||||
|
Loading…
Reference in New Issue
Block a user