osdep/io: redefine off_t for Windows build

off_t is long (4 bytes) on Windows, regardless of _FILE_OFFSET_BITS,
which is not supported there.

Fixes: #14790
This commit is contained in:
Kacper Michajłow 2024-09-03 21:37:41 +02:00
parent a0ebfc3462
commit 1ecfb29932
2 changed files with 5 additions and 3 deletions

View File

@ -708,7 +708,7 @@ char ***mp_penviron(void)
return &utf8_environ; // `environ' should be an l-value
}
off_t mp_lseek(int fd, off_t offset, int whence)
off_t mp_lseek64(int fd, off_t offset, int whence)
{
HANDLE h = (HANDLE)_get_osfhandle(fd);
if (h != INVALID_HANDLE_VALUE && GetFileType(h) != FILE_TYPE_DISK) {

View File

@ -130,7 +130,9 @@ char *mp_getenv(const char *name);
#define environ (*mp_penviron()) /* ensure initialization and l-value */
char ***mp_penviron(void);
off_t mp_lseek(int fd, off_t offset, int whence);
#undef off_t
#define off_t int64_t
off_t mp_lseek64(int fd, off_t offset, int whence);
void *mp_dlopen(const char *filename, int flag);
void *mp_dlsym(void *handle, const char *symbol);
char *mp_dlerror(void);
@ -194,7 +196,7 @@ void mp_globfree(mp_glob_t *pglob);
#define getenv(...) mp_getenv(__VA_ARGS__)
#undef lseek
#define lseek(...) mp_lseek(__VA_ARGS__)
#define lseek(...) mp_lseek64(__VA_ARGS__)
#define RTLD_NOW 0
#define RTLD_LOCAL 0