diff options
Diffstat (limited to '')
-rw-r--r-- | src/lib_io.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib_io.c b/src/lib_io.c index 6e330a73..cb6df46d 100644 --- a/src/lib_io.c +++ b/src/lib_io.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "lj_state.h" | 23 | #include "lj_state.h" |
24 | #include "lj_ff.h" | 24 | #include "lj_ff.h" |
25 | #include "lj_lib.h" | 25 | #include "lj_lib.h" |
26 | #include "lj_strscan.h" | ||
26 | 27 | ||
27 | /* Userdata payload for I/O file. */ | 28 | /* Userdata payload for I/O file. */ |
28 | typedef struct IOFileUD { | 29 | typedef struct IOFileUD { |
@@ -324,13 +325,14 @@ LJLIB_CF(io_method_seek) | |||
324 | FILE *fp = io_tofile(L)->fp; | 325 | FILE *fp = io_tofile(L)->fp; |
325 | int opt = lj_lib_checkopt(L, 2, 1, "\3set\3cur\3end"); | 326 | int opt = lj_lib_checkopt(L, 2, 1, "\3set\3cur\3end"); |
326 | int64_t ofs = 0; | 327 | int64_t ofs = 0; |
327 | cTValue *o; | 328 | TValue *o; |
328 | int res; | 329 | int res; |
329 | if (opt == 0) opt = SEEK_SET; | 330 | if (opt == 0) opt = SEEK_SET; |
330 | else if (opt == 1) opt = SEEK_CUR; | 331 | else if (opt == 1) opt = SEEK_CUR; |
331 | else if (opt == 2) opt = SEEK_END; | 332 | else if (opt == 2) opt = SEEK_END; |
332 | o = L->base+2; | 333 | o = L->base+2; |
333 | if (o < L->top) { | 334 | if (o < L->top) { |
335 | if (tvisstr(o)) lj_strscan_num(strV(o), o); | ||
334 | if (tvisint(o)) | 336 | if (tvisint(o)) |
335 | ofs = (int64_t)intV(o); | 337 | ofs = (int64_t)intV(o); |
336 | else if (tvisnum(o)) | 338 | else if (tvisnum(o)) |