diff options
author | Mike Pall <mike> | 2025-03-09 16:25:34 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2025-03-09 16:25:34 +0100 |
commit | f14556234cf67ea8639f0efe81f118664cc8dd49 (patch) | |
tree | f20009d35c58ce3a9fc6ac663a8ce3852c501bed | |
parent | e27ee688172d1a63231d6fa74b3903d941e38d80 (diff) | |
parent | d508715ab657261e8437a52c1b1966c20ab1631d (diff) | |
download | luajit-f14556234cf67ea8639f0efe81f118664cc8dd49.tar.gz luajit-f14556234cf67ea8639f0efe81f118664cc8dd49.tar.bz2 luajit-f14556234cf67ea8639f0efe81f118664cc8dd49.zip |
Merge branch 'master' into v2.1
-rw-r--r-- | src/Makefile.dep | 2 | ||||
-rw-r--r-- | src/lib_io.c | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/Makefile.dep b/src/Makefile.dep index 7b534b05..e10a6b29 100644 --- a/src/Makefile.dep +++ b/src/Makefile.dep | |||
@@ -25,7 +25,7 @@ lib_ffi.o: lib_ffi.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \ | |||
25 | lib_init.o: lib_init.c lua.h luaconf.h lauxlib.h lualib.h lj_arch.h | 25 | lib_init.o: lib_init.c lua.h luaconf.h lauxlib.h lualib.h lj_arch.h |
26 | lib_io.o: lib_io.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \ | 26 | lib_io.o: lib_io.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \ |
27 | lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_buf.h lj_str.h lj_state.h \ | 27 | lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_buf.h lj_str.h lj_state.h \ |
28 | lj_strfmt.h lj_ff.h lj_ffdef.h lj_lib.h lj_libdef.h | 28 | lj_strfmt.h lj_ff.h lj_ffdef.h lj_lib.h lj_strscan.h lj_libdef.h |
29 | lib_jit.o: lib_jit.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \ | 29 | lib_jit.o: lib_jit.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \ |
30 | lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_debug.h lj_str.h lj_tab.h \ | 30 | lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_debug.h lj_str.h lj_tab.h \ |
31 | lj_state.h lj_bc.h lj_ctype.h lj_ir.h lj_jit.h lj_ircall.h lj_iropt.h \ | 31 | lj_state.h lj_bc.h lj_ctype.h lj_ir.h lj_jit.h lj_ircall.h lj_iropt.h \ |
diff --git a/src/lib_io.c b/src/lib_io.c index 4e0397d4..5659ff51 100644 --- a/src/lib_io.c +++ b/src/lib_io.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include "lj_strfmt.h" | 25 | #include "lj_strfmt.h" |
26 | #include "lj_ff.h" | 26 | #include "lj_ff.h" |
27 | #include "lj_lib.h" | 27 | #include "lj_lib.h" |
28 | #include "lj_strscan.h" | ||
28 | 29 | ||
29 | /* Userdata payload for I/O file. */ | 30 | /* Userdata payload for I/O file. */ |
30 | typedef struct IOFileUD { | 31 | typedef struct IOFileUD { |
@@ -323,13 +324,14 @@ LJLIB_CF(io_method_seek) | |||
323 | FILE *fp = io_tofile(L)->fp; | 324 | FILE *fp = io_tofile(L)->fp; |
324 | int opt = lj_lib_checkopt(L, 2, 1, "\3set\3cur\3end"); | 325 | int opt = lj_lib_checkopt(L, 2, 1, "\3set\3cur\3end"); |
325 | int64_t ofs = 0; | 326 | int64_t ofs = 0; |
326 | cTValue *o; | 327 | TValue *o; |
327 | int res; | 328 | int res; |
328 | if (opt == 0) opt = SEEK_SET; | 329 | if (opt == 0) opt = SEEK_SET; |
329 | else if (opt == 1) opt = SEEK_CUR; | 330 | else if (opt == 1) opt = SEEK_CUR; |
330 | else if (opt == 2) opt = SEEK_END; | 331 | else if (opt == 2) opt = SEEK_END; |
331 | o = L->base+2; | 332 | o = L->base+2; |
332 | if (o < L->top) { | 333 | if (o < L->top) { |
334 | if (tvisstr(o)) lj_strscan_num(strV(o), o); | ||
333 | if (tvisint(o)) | 335 | if (tvisint(o)) |
334 | ofs = (int64_t)intV(o); | 336 | ofs = (int64_t)intV(o); |
335 | else if (tvisnum(o)) | 337 | else if (tvisnum(o)) |