mirror of
https://github.com/bellard/quickjs.git
synced 2024-11-22 21:58:12 +08:00
Use ftello() & fseeko() on any OS based on GNU libc
Strictly speaking, they are available in POSIX.1-2008 [1][2], so they could be used on more platforms/OSes. To be cautious, enable them when using GNU libc, since they have been available with that libc for a very long time. [1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/ftell.html [2] https://pubs.opengroup.org/onlinepubs/9699919799/functions/fseek.html
This commit is contained in:
parent
34894936d8
commit
8624b5c6f0
@ -1090,7 +1090,7 @@ static JSValue js_std_file_tell(JSContext *ctx, JSValueConst this_val,
|
|||||||
int64_t pos;
|
int64_t pos;
|
||||||
if (!f)
|
if (!f)
|
||||||
return JS_EXCEPTION;
|
return JS_EXCEPTION;
|
||||||
#if defined(__linux__)
|
#if defined(__linux__) || defined(__GLIBC__)
|
||||||
pos = ftello(f);
|
pos = ftello(f);
|
||||||
#else
|
#else
|
||||||
pos = ftell(f);
|
pos = ftell(f);
|
||||||
@ -1113,7 +1113,7 @@ static JSValue js_std_file_seek(JSContext *ctx, JSValueConst this_val,
|
|||||||
return JS_EXCEPTION;
|
return JS_EXCEPTION;
|
||||||
if (JS_ToInt32(ctx, &whence, argv[1]))
|
if (JS_ToInt32(ctx, &whence, argv[1]))
|
||||||
return JS_EXCEPTION;
|
return JS_EXCEPTION;
|
||||||
#if defined(__linux__)
|
#if defined(__linux__) || defined(__GLIBC__)
|
||||||
ret = fseeko(f, pos, whence);
|
ret = fseeko(f, pos, whence);
|
||||||
#else
|
#else
|
||||||
ret = fseek(f, pos, whence);
|
ret = fseek(f, pos, whence);
|
||||||
|
Loading…
Reference in New Issue
Block a user